From c044ae5dfc62031924c2f4c0ecc87b0da72a6b3f Mon Sep 17 00:00:00 2001 From: Dan Stoza Date: Fri, 8 Jan 2016 10:52:16 -0800 Subject: libagl: Switch from gralloc to GraphicBufferMapper Removes all direct references to the gralloc module from libagl and uses the GraphicBufferMapper class instead when locking and unlocking buffers. Also a couple of minor code cleanups to eliminate warnings. Change-Id: Ie982d375b3152d5f677ab54c2067179b8d34c06d --- opengl/libagl/texture.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'opengl/libagl/texture.cpp') diff --git a/opengl/libagl/texture.cpp b/opengl/libagl/texture.cpp index 9aa1c4f867..3fe5ed0630 100644 --- a/opengl/libagl/texture.cpp +++ b/opengl/libagl/texture.cpp @@ -25,6 +25,9 @@ #include +#include +#include + namespace android { // ---------------------------------------------------------------------------- @@ -128,17 +131,11 @@ void ogles_lock_textures(ogles_context_t* c) ANativeWindowBuffer* native_buffer = u.texture->buffer; if (native_buffer) { c->rasterizer.procs.activeTexture(c, i); - hw_module_t const* pModule; - if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule)) - continue; - - gralloc_module_t const* module = - reinterpret_cast(pModule); + auto& mapper = GraphicBufferMapper::get(); void* vaddr; - int err = module->lock(module, native_buffer->handle, - GRALLOC_USAGE_SW_READ_OFTEN, - 0, 0, native_buffer->width, native_buffer->height, + mapper.lock(native_buffer->handle, GRALLOC_USAGE_SW_READ_OFTEN, + Rect(native_buffer->width, native_buffer->height), &vaddr); u.texture->setImageBits(vaddr); @@ -156,14 +153,10 @@ void ogles_unlock_textures(ogles_context_t* c) ANativeWindowBuffer* native_buffer = u.texture->buffer; if (native_buffer) { c->rasterizer.procs.activeTexture(c, i); - hw_module_t const* pModule; - if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule)) - continue; - gralloc_module_t const* module = - reinterpret_cast(pModule); + auto& mapper = GraphicBufferMapper::get(); + mapper.unlock(native_buffer->handle); - module->unlock(module, native_buffer->handle); u.texture->setImageBits(NULL); c->rasterizer.procs.bindTexture(c, &(u.texture->surface)); } @@ -405,7 +398,7 @@ int createTextureSurface(ogles_context_t* c, return 0; } -static size_t dataSizePalette4(int numLevels, int width, int height, int format) +static GLsizei dataSizePalette4(int numLevels, int width, int height, int format) { int indexBits = 8; int entrySize = 0; -- cgit v1.2.3-59-g8ed1b