summaryrefslogtreecommitdiffstats
path: root/include/ui/Surface.h
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2009-05-04 14:17:04 -0700
committerMathias Agopian <mathias@google.com>2009-05-04 14:17:04 -0700
commitdff8e58d47ede6e748c0b02e128ca33b42a4f362 (patch)
tree716d70cda74aa625d6e67c4debc2eb7c6b81bfc9 /include/ui/Surface.h
parentfa6eda01a9f3df0102ce6a65302c8674cc9c7e50 (diff)
downloadframeworks_base-dff8e58d47ede6e748c0b02e128ca33b42a4f362.zip
frameworks_base-dff8e58d47ede6e748c0b02e128ca33b42a4f362.tar.gz
frameworks_base-dff8e58d47ede6e748c0b02e128ca33b42a4f362.tar.bz2
update surfaceflinger, libui and libagl to the new gralloc api
- Currently the lock/unlock path is naive and is done for each drawing operation (glDrawElements and glDrawArrays). this should be improved eventually. - factor all the lock/unlock code in SurfaceBuffer. - fixed "showupdate" so it works even when we don't have preserving eglSwapBuffers(). - improved the situation with the dirty-region and fixed a problem that caused GL apps to not update. - make use of LightRefBase() where needed, instead of duplicating its implementation - add LightRefBase::getStrongCount() - renamed EGLNativeWindowSurface.cpp to FramebufferNativeWindow.cpp - disabled copybits test, since it clashes with the new gralloc api - Camera/Video will be fixed later when we rework the overlay apis
Diffstat (limited to 'include/ui/Surface.h')
-rw-r--r--include/ui/Surface.h39
1 files changed, 24 insertions, 15 deletions
diff --git a/include/ui/Surface.h b/include/ui/Surface.h
index 16d2edb..6eb06ae 100644
--- a/include/ui/Surface.h
+++ b/include/ui/Surface.h
@@ -34,7 +34,9 @@ namespace android {
// ---------------------------------------------------------------------------
+class BufferMapper;
class Rect;
+class Surface;
class SurfaceComposerClient;
struct per_client_cblk_t;
struct layer_cblk_t;
@@ -52,6 +54,10 @@ public:
return handle;
}
+ status_t lock(uint32_t usage);
+ status_t lock(uint32_t usage, const Rect& rect);
+ status_t unlock();
+
protected:
SurfaceBuffer();
SurfaceBuffer(const Parcel& reply);
@@ -59,7 +65,11 @@ protected:
buffer_handle_t handle;
bool mOwner;
+ inline const BufferMapper& getBufferMapper() const { return mBufferMapper; }
+ inline BufferMapper& getBufferMapper() { return mBufferMapper; }
+
private:
+ friend class Surface;
friend class BpSurface;
friend class BnSurface;
friend class LightRefBase<SurfaceBuffer>;
@@ -72,6 +82,8 @@ private:
static int getHandle(android_native_buffer_t const * base,
buffer_handle_t* handle);
+
+ BufferMapper& mBufferMapper;
};
// ---------------------------------------------------------------------------
@@ -191,9 +203,8 @@ public:
status_t lock(SurfaceInfo* info, Region* dirty, bool blocking = true);
status_t unlockAndPost();
- // setSwapRectangle() is mainly used by EGL
+ // setSwapRectangle() is intended to be used by GL ES clients
void setSwapRectangle(const Rect& r);
- const Rect& swapRectangle() const;
private:
// can't be copied
@@ -216,22 +227,14 @@ private:
const sp<ISurface>& getISurface() const { return mSurface; }
status_t getBufferLocked(int index);
-
-
-
- Region dirtyRegion() const;
- void setDirtyRegion(const Region& region) const;
-
status_t validate(per_client_cblk_t const* cblk) const;
static void _send_dirty_region(layer_cblk_t* lcblk, const Region& dirty);
+ inline const BufferMapper& getBufferMapper() const { return mBufferMapper; }
+ inline BufferMapper& getBufferMapper() { return mBufferMapper; }
- static void connect(android_native_window_t* window);
- static void disconnect(android_native_window_t* window);
static int setSwapInterval(android_native_window_t* window, int interval);
- static int setSwapRectangle(android_native_window_t* window,
- int l, int t, int w, int h);
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);
@@ -239,21 +242,27 @@ private:
int dequeueBuffer(android_native_buffer_t** buffer);
int lockBuffer(android_native_buffer_t* buffer);
int queueBuffer(android_native_buffer_t* buffer);
-
+
+ status_t dequeueBuffer(sp<SurfaceBuffer>* buffer);
+ status_t lockBuffer(const sp<SurfaceBuffer>& buffer);
+ status_t queueBuffer(const sp<SurfaceBuffer>& buffer);
+
alloc_device_t* mAllocDevice;
sp<SurfaceComposerClient> mClient;
sp<ISurface> mSurface;
sp<SurfaceBuffer> mBuffers[2];
- android_native_buffer_t* mLockedBuffer;
+ sp<SurfaceBuffer> mLockedBuffer;
SurfaceID mToken;
uint32_t mIdentity;
PixelFormat mFormat;
uint32_t mFlags;
mutable Region mDirtyRegion;
- mutable Rect mSwapRectangle;
+ mutable Region mOldDirtyRegion;
mutable uint8_t mBackbufferIndex;
mutable Mutex mSurfaceLock;
+ Rect mSwapRectangle;
+ BufferMapper& mBufferMapper;
};
}; // namespace android