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).
diff --git a/include/ui/Surface.h b/include/ui/Surface.h
index 8c4f63d..156d453 100644
--- a/include/ui/Surface.h
+++ b/include/ui/Surface.h
@@ -115,6 +115,8 @@
sp<ISurface> mSurface;
SurfaceID mToken;
uint32_t mIdentity;
+ uint32_t mWidth;
+ uint32_t mHeight;
PixelFormat mFormat;
uint32_t mFlags;
mutable Mutex mLock;
@@ -192,10 +194,12 @@
static int dequeueBuffer(android_native_window_t* window, android_native_buffer_t** buffer);
static int lockBuffer(android_native_window_t* window, android_native_buffer_t* buffer);
static int queueBuffer(android_native_window_t* window, android_native_buffer_t* buffer);
+ static int query(android_native_window_t* window, int what, int* value);
int dequeueBuffer(android_native_buffer_t** buffer);
int lockBuffer(android_native_buffer_t* buffer);
int queueBuffer(android_native_buffer_t* buffer);
+ int query(int what, int* value);
status_t dequeueBuffer(sp<SurfaceBuffer>* buffer);
status_t lockBuffer(const sp<SurfaceBuffer>& buffer);
@@ -209,6 +213,8 @@
sp<SurfaceBuffer> mLockedBuffer;
SurfaceID mToken;
uint32_t mIdentity;
+ uint32_t mWidth;
+ uint32_t mHeight;
PixelFormat mFormat;
uint32_t mFlags;
mutable Region mDirtyRegion;