diff options
author | Mathias Agopian <mathias@google.com> | 2011-04-28 20:05:23 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-04-28 20:05:23 -0700 |
commit | d666768737a345f5ff30734e657c23d7ad5b83cf (patch) | |
tree | af8a06972b04d2ea458149d12bc44bed6e29633f | |
parent | 1ceee09ef476c91e0b7c2a44130c3687d313b1e9 (diff) |
remove dependency on copybit
Change-Id: I109d0b32a7c6a9a179ac911ce46660ae2afcf582
-rw-r--r-- | test/egl.cpp | 122 |
1 files changed, 30 insertions, 92 deletions
diff --git a/test/egl.cpp b/test/egl.cpp index f31e30d..3bc425c 100644 --- a/test/egl.cpp +++ b/test/egl.cpp @@ -51,8 +51,6 @@ #include <surfaceflinger/ISurface.h> #include <surfaceflinger/SurfaceComposerClient.h> -#include <hardware/copybit.h> - #undef NELEM #define NELEM(x) (sizeof(x)/sizeof(*(x))) @@ -108,13 +106,6 @@ struct ogles_context_t { unsigned width, height, stride, format; // curret backbuffer void * bits; - // copybits is only used if LIBAGL_USE_GRALLOC_COPYBITS is - // defined, but it is always present because ogles_context_t is a public - // struct that is used by clients of libagl. We want the size and offsets - // to stay the same, whether or not LIBAGL_USE_GRALLOC_COPYBITS is defined. - - //copybits_context_t copybits; - GLenum error; static inline ogles_context_t* get() { @@ -290,7 +281,6 @@ private: android_native_buffer_t* buffer; android_native_buffer_t* previousBuffer; gralloc_module_t const* module; - copybit_device_t* blitengine; int width; int height; void* bits; @@ -380,24 +370,6 @@ private: ssize_t count; }; - struct region_iterator : public copybit_region_t { - region_iterator(const Region& region) - : b(region.begin()), e(region.end()) { - this->next = iterate; - } -private: - static int iterate(copybit_region_t const * self, copybit_rect_t* rect) { - region_iterator const* me = static_cast<region_iterator const*>(self); - if (me->b != me->e) { - *reinterpret_cast<Rect*>(rect) = *me->b++; - return 1; - } - return 0; - } - mutable Region::const_iterator b; - Region::const_iterator const e; - }; - void copyBlt( android_native_buffer_t* dst, void* dst_vaddr, android_native_buffer_t* src, void const* src_vaddr, @@ -413,16 +385,12 @@ egl_window_surface_v2_t::egl_window_surface_v2_t(EGLDisplay dpy, ANativeWindow* window) : egl_surface_t(dpy, config, depthFormat), nativeWindow(window), buffer(0), previousBuffer(0), module(0), - blitengine(0), bits(NULL) + bits(NULL) { hw_module_t const* pModule; hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule); module = reinterpret_cast<gralloc_module_t const*>(pModule); - if (hw_get_module(COPYBIT_HARDWARE_MODULE_ID, &pModule) == 0) { - copybit_open(pModule, &blitengine); - } - pixelFormatTable = gglGetPixelFormatTable(); // keep a reference on the window @@ -440,9 +408,6 @@ egl_window_surface_v2_t::~egl_window_surface_v2_t() previousBuffer->common.decRef(&previousBuffer->common); } nativeWindow->common.decRef(&nativeWindow->common); - if (blitengine) { - copybit_close(blitengine); - } } EGLBoolean egl_window_surface_v2_t::connect() @@ -532,61 +497,34 @@ void egl_window_surface_v2_t::copyBlt( // FIXME: use copybit if possible // NOTE: dst and src must be the same format - status_t err = NO_ERROR; - copybit_device_t* const copybit = blitengine; - if (copybit) { - copybit_image_t simg; - simg.w = src->stride; - simg.h = src->height; - simg.format = src->format; - simg.handle = const_cast<native_handle_t*>(src->handle); - - copybit_image_t dimg; - dimg.w = dst->stride; - dimg.h = dst->height; - dimg.format = dst->format; - dimg.handle = const_cast<native_handle_t*>(dst->handle); - - copybit->set_parameter(copybit, COPYBIT_TRANSFORM, 0); - copybit->set_parameter(copybit, COPYBIT_PLANE_ALPHA, 255); - copybit->set_parameter(copybit, COPYBIT_DITHER, COPYBIT_DISABLE); - region_iterator it(clip); - err = copybit->blit(copybit, &dimg, &simg, &it); - if (err != NO_ERROR) { - LOGE("copybit failed (%s)", strerror(err)); - } - } - - if (!copybit || err) { - Region::const_iterator cur = clip.begin(); - Region::const_iterator end = clip.end(); - - const size_t bpp = pixelFormatTable[src->format].size; - const size_t dbpr = dst->stride * bpp; - const size_t sbpr = src->stride * bpp; - - uint8_t const * const src_bits = (uint8_t const *)src_vaddr; - uint8_t * const dst_bits = (uint8_t *)dst_vaddr; - - while (cur != end) { - const Rect& r(*cur++); - ssize_t w = r.right - r.left; - ssize_t h = r.bottom - r.top; - if (w <= 0 || h<=0) continue; - size_t size = w * bpp; - uint8_t const * s = src_bits + (r.left + src->stride * r.top) * bpp; - uint8_t * d = dst_bits + (r.left + dst->stride * r.top) * bpp; - if (dbpr==sbpr && size==sbpr) { - size *= h; - h = 1; - } - do { - memcpy(d, s, size); - d += dbpr; - s += sbpr; - } while (--h > 0); - } - } + Region::const_iterator cur = clip.begin(); + Region::const_iterator end = clip.end(); + + const size_t bpp = pixelFormatTable[src->format].size; + const size_t dbpr = dst->stride * bpp; + const size_t sbpr = src->stride * bpp; + + uint8_t const * const src_bits = (uint8_t const *)src_vaddr; + uint8_t * const dst_bits = (uint8_t *)dst_vaddr; + + while (cur != end) { + const Rect& r(*cur++); + ssize_t w = r.right - r.left; + ssize_t h = r.bottom - r.top; + if (w <= 0 || h<=0) continue; + size_t size = w * bpp; + uint8_t const * s = src_bits + (r.left + src->stride * r.top) * bpp; + uint8_t * d = dst_bits + (r.left + dst->stride * r.top) * bpp; + if (dbpr==sbpr && size==sbpr) { + size *= h; + h = 1; + } + do { + memcpy(d, s, size); + d += dbpr; + s += sbpr; + } while (--h > 0); + } } EGLBoolean egl_window_surface_v2_t::swapBuffers() @@ -2007,4 +1945,4 @@ extern "C" void DisposeDrawingSurface() puts("DisposeDrawingSurface"); } -#endif // #ifdef __arm__
\ No newline at end of file +#endif // #ifdef __arm__ |