diff options
author | Jim Huang <jserv@0xlab.org> | 2010-08-17 07:48:36 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-08-17 07:48:36 -0700 |
commit | 7caef0c70f51a4863969a537c5d5e954483304f6 (patch) | |
tree | 3cc53b5354c9cc286887a9c93aff7b7103cdc10e /libpixelflinger | |
parent | b1fb953877a08400b90ed1a6078cac5f6b849c98 (diff) | |
parent | 6090dacd1894429baaf13f7b30b2f6e9e2c1617f (diff) | |
download | system_core-7caef0c70f51a4863969a537c5d5e954483304f6.tar.gz system_core-7caef0c70f51a4863969a537c5d5e954483304f6.tar.bz2 system_core-7caef0c70f51a4863969a537c5d5e954483304f6.zip |
am 6090dacd: libpixelflinger: Move codeflinger test function to test-opengl-codegen
Merge commit '6090dacd1894429baaf13f7b30b2f6e9e2c1617f' into gingerbread-plus-aosp
* commit '6090dacd1894429baaf13f7b30b2f6e9e2c1617f':
libpixelflinger: Move codeflinger test function to test-opengl-codegen
Diffstat (limited to 'libpixelflinger')
-rw-r--r-- | libpixelflinger/scanline.cpp | 23 | ||||
-rw-r--r-- | libpixelflinger/tests/codegen/Android.mk | 5 | ||||
-rw-r--r-- | libpixelflinger/tests/codegen/codegen.cpp | 49 |
3 files changed, 51 insertions, 26 deletions
diff --git a/libpixelflinger/scanline.cpp b/libpixelflinger/scanline.cpp index a2f43eb08..931d6480d 100644 --- a/libpixelflinger/scanline.cpp +++ b/libpixelflinger/scanline.cpp @@ -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 -} - diff --git a/libpixelflinger/tests/codegen/Android.mk b/libpixelflinger/tests/codegen/Android.mk index 1bc421487..aa320fc0a 100644 --- a/libpixelflinger/tests/codegen/Android.mk +++ b/libpixelflinger/tests/codegen/Android.mk @@ -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 diff --git a/libpixelflinger/tests/codegen/codegen.cpp b/libpixelflinger/tests/codegen/codegen.cpp index 18658881b..94e24810d 100644 --- a/libpixelflinger/tests/codegen/codegen.cpp +++ b/libpixelflinger/tests/codegen/codegen.cpp @@ -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) { |