diff options
author | Mathias Agopian <mathias@google.com> | 2009-07-30 18:14:56 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2009-07-30 18:14:56 -0700 |
commit | cb6b9041647b4f080324742eee5ce709960ff610 (patch) | |
tree | 14e5efafa0eace5d3a7943dc9c6316880ef22d11 /opengl/libagl | |
parent | 69bdcb9b7b5089984bf474f30029fa024f519e47 (diff) | |
download | frameworks_native-cb6b9041647b4f080324742eee5ce709960ff610.zip frameworks_native-cb6b9041647b4f080324742eee5ce709960ff610.tar.gz frameworks_native-cb6b9041647b4f080324742eee5ce709960ff610.tar.bz2 |
fixed some issues with the software renderer when surfaces are made current.
there was several issues:
- when a surface was made non-current, the last frame wasn't shown and the buffer could stay locked
- when a surface was made current the 2nd time, it would not dequeue a new buffer
now, queue/dequeue are done when the surface is made current.
for this to work, a new query() hook had to be added on android_native_window_t, it allows to retrieve some attributes of a window (currently only width and height).
Diffstat (limited to 'opengl/libagl')
-rw-r--r-- | opengl/libagl/egl.cpp | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp index 7afcae7..b0e54d8 100644 --- a/opengl/libagl/egl.cpp +++ b/opengl/libagl/egl.cpp @@ -216,8 +216,8 @@ struct egl_window_surface_v2_t : public egl_surface_t virtual EGLBoolean bindReadSurface(ogles_context_t* gl); virtual void connect(); virtual void disconnect(); - virtual EGLint getWidth() const { return buffer->width; } - virtual EGLint getHeight() const { return buffer->height; } + virtual EGLint getWidth() const { return width; } + virtual EGLint getHeight() const { return height; } virtual EGLint getHorizontalResolution() const; virtual EGLint getVerticalResolution() const; virtual EGLint getRefreshRate() const; @@ -365,14 +365,32 @@ egl_window_surface_v2_t::egl_window_surface_v2_t(EGLDisplay dpy, // keep a reference on the window nativeWindow->common.incRef(&nativeWindow->common); + nativeWindow->query(nativeWindow, NATIVE_WINDOW_WIDTH, &width); + nativeWindow->query(nativeWindow, NATIVE_WINDOW_HEIGHT, &height); +} +egl_window_surface_v2_t::~egl_window_surface_v2_t() { + if (buffer) { + buffer->common.decRef(&buffer->common); + } + if (previousBuffer) { + previousBuffer->common.decRef(&previousBuffer->common); + } + nativeWindow->common.decRef(&nativeWindow->common); + if (blitengine) { + copybit_close(blitengine); + } +} + +void egl_window_surface_v2_t::connect() +{ // dequeue a buffer nativeWindow->dequeueBuffer(nativeWindow, &buffer); // allocate a corresponding depth-buffer width = buffer->width; height = buffer->height; - if (depthFormat) { + if (depth.format) { depth.width = width; depth.height = height; depth.stride = depth.width; // use the width here @@ -385,23 +403,7 @@ egl_window_surface_v2_t::egl_window_surface_v2_t(EGLDisplay dpy, // keep a reference on the buffer buffer->common.incRef(&buffer->common); -} -egl_window_surface_v2_t::~egl_window_surface_v2_t() { - if (buffer) { - buffer->common.decRef(&buffer->common); - } - if (previousBuffer) { - previousBuffer->common.decRef(&previousBuffer->common); - } - nativeWindow->common.decRef(&nativeWindow->common); - if (blitengine) { - copybit_close(blitengine); - } -} - -void egl_window_surface_v2_t::connect() -{ // Lock the buffer nativeWindow->lockBuffer(nativeWindow, buffer); // pin the buffer down @@ -420,6 +422,16 @@ void egl_window_surface_v2_t::disconnect() bits = NULL; unlock(buffer); } + // enqueue the last frame + nativeWindow->queueBuffer(nativeWindow, buffer); + if (buffer) { + buffer->common.decRef(&buffer->common); + buffer = 0; + } + if (previousBuffer) { + previousBuffer->common.decRef(&previousBuffer->common); + previousBuffer = 0; + } } status_t egl_window_surface_v2_t::lock( |