Skip to content

Commit

Permalink
libpixelflinger: Move codeflinger test function to test-opengl-codegen
Browse files Browse the repository at this point in the history
There is no need to include codeflinger test function in
libpixelflinger.  Instead, it should exist in test-opengl-codegen.

Change-Id: Ic5b0bd1f754b2ac678d4e16565568c70ceb8d325
  • Loading branch information
jserv committed Aug 9, 2010
1 parent 0fcbdb4 commit 6090dac
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 26 deletions.
23 changes: 0 additions & 23 deletions libpixelflinger/scanline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1518,26 +1518,3 @@ void rect_memcpy(context_t* c, size_t yc)
// ----------------------------------------------------------------------------
}; // namespace android

using namespace android;
extern "C" void ggl_test_codegen(uint32_t n, uint32_t p, uint32_t t0, uint32_t t1)
{
#if ANDROID_ARM_CODEGEN
GGLContext* c;
gglInit(&c);
needs_t needs;
needs.n = n;
needs.p = p;
needs.t[0] = t0;
needs.t[1] = t1;
sp<ScanlineAssembly> a(new ScanlineAssembly(needs, ASSEMBLY_SCRATCH_SIZE));
GGLAssembler assembler( new ARMAssembler(a) );
int err = assembler.scanline(needs, (context_t*)c);
if (err != 0) {
printf("error %08x (%s)\n", err, strerror(-err));
}
gglUninit(c);
#else
printf("This test runs only on ARM\n");
#endif
}

5 changes: 4 additions & 1 deletion libpixelflinger/tests/codegen/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_SRC_FILES:= \
codegen.cpp
codegen.cpp.arm

LOCAL_SHARED_LIBRARIES := \
libcutils \
libpixelflinger

LOCAL_C_INCLUDES := \
system/core/libpixelflinger

LOCAL_MODULE:= test-opengl-codegen

LOCAL_MODULE_TAGS := tests
Expand Down
49 changes: 47 additions & 2 deletions libpixelflinger/tests/codegen/codegen.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,54 @@
#include <stdio.h>
#include <stdint.h>

extern "C" void ggl_test_codegen(
uint32_t n, uint32_t p, uint32_t t0, uint32_t t1);
#include "private/pixelflinger/ggl_context.h"

#include "buffer.h"
#include "scanline.h"

#include "codeflinger/CodeCache.h"
#include "codeflinger/GGLAssembler.h"
#include "codeflinger/ARMAssembler.h"

#if defined(__arm__)
# define ANDROID_ARM_CODEGEN 1
#else
# define ANDROID_ARM_CODEGEN 0
#endif

#define ASSEMBLY_SCRATCH_SIZE 2048

using namespace android;

class ScanlineAssembly : public Assembly {
AssemblyKey<needs_t> mKey;
public:
ScanlineAssembly(needs_t needs, size_t size)
: Assembly(size), mKey(needs) { }
const AssemblyKey<needs_t>& key() const { return mKey; }
};

static void ggl_test_codegen(uint32_t n, uint32_t p, uint32_t t0, uint32_t t1)
{
#if ANDROID_ARM_CODEGEN
GGLContext* c;
gglInit(&c);
needs_t needs;
needs.n = n;
needs.p = p;
needs.t[0] = t0;
needs.t[1] = t1;
sp<ScanlineAssembly> a(new ScanlineAssembly(needs, ASSEMBLY_SCRATCH_SIZE));
GGLAssembler assembler( new ARMAssembler(a) );
int err = assembler.scanline(needs, (context_t*)c);
if (err != 0) {
printf("error %08x (%s)\n", err, strerror(-err));
}
gglUninit(c);
#else
printf("This test runs only on ARM\n");
#endif
}

int main(int argc, char** argv)
{
Expand Down

0 comments on commit 6090dac

Please sign in to comment.