diff options
author | 2016-01-08 10:52:16 -0800 | |
---|---|---|
committer | 2016-01-11 16:29:39 -0800 | |
commit | c044ae5dfc62031924c2f4c0ecc87b0da72a6b3f (patch) | |
tree | 094e146f6bf769aae8c142aa5b846b346015a141 /opengl/libagl/egl.cpp | |
parent | 35f475653c2ca922acc358c607b204c8fafd6ad5 (diff) |
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
Diffstat (limited to 'opengl/libagl/egl.cpp')
-rw-r--r-- | opengl/libagl/egl.cpp | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp index 7560d8fdf0..47733e6d3d 100644 --- a/opengl/libagl/egl.cpp +++ b/opengl/libagl/egl.cpp @@ -32,6 +32,7 @@ #include <utils/threads.h> #include <ui/ANativeObjectBase.h> #include <ui/Fence.h> +#include <ui/GraphicBufferMapper.h> #include <EGL/egl.h> #include <EGL/eglext.h> @@ -242,7 +243,6 @@ private: ANativeWindow* nativeWindow; ANativeWindowBuffer* buffer; ANativeWindowBuffer* previousBuffer; - gralloc_module_t const* module; int width; int height; void* bits; @@ -341,16 +341,12 @@ egl_window_surface_v2_t::egl_window_surface_v2_t(EGLDisplay dpy, EGLConfig config, int32_t depthFormat, ANativeWindow* window) - : egl_surface_t(dpy, config, depthFormat), - nativeWindow(window), buffer(0), previousBuffer(0), module(0), - bits(NULL) + : egl_surface_t(dpy, config, depthFormat), + nativeWindow(window), buffer(0), previousBuffer(0), bits(NULL) { - hw_module_t const* pModule; - hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &pModule); - module = reinterpret_cast<gralloc_module_t const*>(pModule); pixelFormatTable = gglGetPixelFormatTable(); - + // keep a reference on the window nativeWindow->common.incRef(&nativeWindow->common); nativeWindow->query(nativeWindow, NATIVE_WINDOW_WIDTH, &width); @@ -440,22 +436,16 @@ void egl_window_surface_v2_t::disconnect() status_t egl_window_surface_v2_t::lock( ANativeWindowBuffer* buf, int usage, void** vaddr) { - int err; - - err = module->lock(module, buf->handle, - usage, 0, 0, buf->width, buf->height, vaddr); - - return err; + auto& mapper = GraphicBufferMapper::get(); + return mapper.lock(buf->handle, usage, + android::Rect(buf->width, buf->height), vaddr); } status_t egl_window_surface_v2_t::unlock(ANativeWindowBuffer* buf) { if (!buf) return BAD_VALUE; - int err = NO_ERROR; - - err = module->unlock(module, buf->handle); - - return err; + auto& mapper = GraphicBufferMapper::get(); + return mapper.unlock(buf->handle); } void egl_window_surface_v2_t::copyBlt( |