Permalink
Browse files

Update patches: fix DECIDE_TEXTURE_TARGET

The DECIDE_TEXTURE_TARGET hack wasn't correctly handling the
BufferRejecter that was added in JB and this resulted in various
graphical corruption.

Change-Id: I9499940402f16b71bc6846542e07f553b0aa31bf
  • Loading branch information...
1 parent 28fa7df commit f1bbba27fbc439db283cde010cbbf4f962cc8c50 @grigorig committed Mar 28, 2013
View
85 patches/frameworks_native/0001-surfacetexture-Select-texture-target-based-on-pixel-.patch
@@ -1,7 +1,8 @@
-From e7bc00ee305119dabbaf38b903cc97b419d7fb7d Mon Sep 17 00:00:00 2001
+From 85f98bf7915f1daff2d857d1487c7e4df4d91c32 Mon Sep 17 00:00:00 2001
From: Neti Ravi Kumar <ravineti@codeaurora.org>
Date: Thu, 15 Nov 2012 19:15:09 +0200
-Subject: [PATCH] surfacetexture: Select texture target based on pixel format
+Subject: [PATCH 1/2] surfacetexture: Select texture target based on pixel
+ format
Adreno is not optimized for GL_TEXTURE_EXTERNAL_OES, making GPU
utilization (and power), high with GL_TEXTURE_EXTERNAL_OES for
@@ -23,14 +24,16 @@ https://github.com/CyanogenMod/android_frameworks_base/commit/2961a0f0d63285caed
Also thanks to erikcas:
https://github.com/Jellaxy/android_frameworks_native/commit/1fb8eba0a8de3852555db48c25a9c0de65f2a75d
+v2: fix for BufferRejecter added in JB
+
Change-Id: I775e3a67df9f2aa0b6352634b863590503716d0d
---
- include/gui/SurfaceTexture.h | 8 ++++++++
- libs/gui/Android.mk | 4 ++++
- libs/gui/SurfaceTexture.cpp | 27 +++++++++++++++++++++++++++
- services/surfaceflinger/Android.mk | 4 ++++
- services/surfaceflinger/Layer.cpp | 34 ++++++++++++++++++++++++++++++++++
- 5 files changed, 77 insertions(+)
+ include/gui/SurfaceTexture.h | 8 ++++++++
+ libs/gui/Android.mk | 4 ++++
+ libs/gui/SurfaceTexture.cpp | 29 +++++++++++++++++++++++++++++
+ services/surfaceflinger/Android.mk | 4 ++++
+ services/surfaceflinger/Layer.cpp | 34 ++++++++++++++++++++++++++++++++++
+ 5 files changed, 79 insertions(+)
diff --git a/include/gui/SurfaceTexture.h b/include/gui/SurfaceTexture.h
index 2635e2f..d116b21 100644
@@ -76,7 +79,7 @@ index e71650f..e46b3fd 100644
LOCAL_C_INCLUDES += hardware/qcom/display/libgralloc
LOCAL_C_INCLUDES += hardware/qcom/display/libqdutils
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
-index 68014da..9012588 100644
+index 2eca228..0d02221 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -183,7 +183,11 @@ status_t SurfaceTexture::updateTexImage() {
@@ -91,33 +94,49 @@ index 68014da..9012588 100644
ATRACE_CALL();
ST_LOGV("updateTexImage");
Mutex::Autolock lock(mMutex);
-@@ -263,6 +267,29 @@ status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) {
- if(gpuSupportedFormat) {
- image = createImage(dpy, mEGLSlots[buf].mGraphicBuffer);
- mEGLSlots[buf].mEglImage = image;
+@@ -226,6 +230,7 @@ status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) {
+ err = mBufferQueue->acquireBuffer(&item);
+ if (err == NO_ERROR) {
+ int buf = item.mBuf;
+
+ // This buffer was newly allocated, so we need to clean up on our side
+ if (item.mGraphicBuffer != NULL) {
+ mEGLSlots[buf].mGraphicBuffer = 0;
+@@ -236,6 +241,29 @@ status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) {
+ mEGLSlots[buf].mGraphicBuffer = item.mGraphicBuffer;
+ }
+
+#ifdef DECIDE_TEXTURE_TARGET
-+ // GPU is not efficient in handling GL_TEXTURE_EXTERNAL_OES
-+ // texture target. Depending on the image format, decide,
-+ // the texture target to be used
++ // GPU is not efficient in handling GL_TEXTURE_EXTERNAL_OES
++ // texture target. Depending on the image format, decide,
++ // the texture target to be used
+
-+ if(isComposition){
-+ switch (mEGLSlots[buf].mGraphicBuffer->format) {
-+ case HAL_PIXEL_FORMAT_RGBA_8888:
-+ case HAL_PIXEL_FORMAT_RGBX_8888:
-+ case HAL_PIXEL_FORMAT_RGB_888:
-+ case HAL_PIXEL_FORMAT_RGB_565:
-+ case HAL_PIXEL_FORMAT_BGRA_8888:
-+ case HAL_PIXEL_FORMAT_RGBA_5551:
-+ case HAL_PIXEL_FORMAT_RGBA_4444:
-+ mTexTarget = GL_TEXTURE_2D;
-+ break;
-+ default:
-+ mTexTarget = GL_TEXTURE_EXTERNAL_OES;
-+ break;
-+ }
-+ }
++ if(isComposition){
++ switch (mEGLSlots[buf].mGraphicBuffer->format) {
++ case HAL_PIXEL_FORMAT_RGBA_8888:
++ case HAL_PIXEL_FORMAT_RGBX_8888:
++ case HAL_PIXEL_FORMAT_RGB_888:
++ case HAL_PIXEL_FORMAT_RGB_565:
++ case HAL_PIXEL_FORMAT_BGRA_8888:
++ case HAL_PIXEL_FORMAT_RGBA_5551:
++ case HAL_PIXEL_FORMAT_RGBA_4444:
++ mTexTarget = GL_TEXTURE_2D;
++ break;
++ default:
++ mTexTarget = GL_TEXTURE_EXTERNAL_OES;
++ break;
++ }
++ }
+#endif
++
+ // we call the rejecter here, in case the caller has a reason to
+ // not accept this buffer. this is used by SurfaceFlinger to
+ // reject buffers which have the wrong size
+@@ -263,6 +291,7 @@ status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) {
+ if(gpuSupportedFormat) {
+ image = createImage(dpy, mEGLSlots[buf].mGraphicBuffer);
+ mEGLSlots[buf].mEglImage = image;
++
if (image == EGL_NO_IMAGE_KHR) {
// NOTE: if dpy was invalid, createImage() is guaranteed to
// fail. so we'd end up here.
@@ -216,5 +235,5 @@ index 84a9060..8345f85 100644
recomputeVisibleRegions = true;
return;
--
-1.7.9.5
+1.8.2
View
6 patches/frameworks_native/0002-Prefer-16bpp-surface-formats.patch
@@ -1,7 +1,7 @@
-From 62919a2e9fe6049b4ef411b9ac85d6374f661225 Mon Sep 17 00:00:00 2001
+From 77618963f8b8fbb5446e24da399de65aa5797b79 Mon Sep 17 00:00:00 2001
From: Grigori Goronzy <greg@blackbox>
Date: Mon, 28 Jan 2013 08:05:39 +0100
-Subject: [PATCH] Prefer 16bpp surface formats
+Subject: [PATCH 2/2] Prefer 16bpp surface formats
Adds a property to use RGB565 surface formats for the opaque
surface default, enabled by default.
@@ -61,5 +61,5 @@ index 0492aa3..c225aab 100644
SecHdmiClient * mHdmiClient;
#endif
--
-1.8.0.3
+1.8.2

0 comments on commit f1bbba2

Please sign in to comment.