aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-04-30 17:07:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-04-30 17:07:45 +0000
commit068717010e0481268c3abc23068cd7ec436f1253 (patch)
treead4d235688be3cc21345a4c95116c64cea625794
parentda929c7b4c1892cfbaa643b6c3402eb6ac5b5d8f (diff)
parentc02e65d1a3e74d96bedb9ea5486da3f5c9053d1c (diff)
downloaddevice_generic_goldfish-opengl-068717010e0481268c3abc23068cd7ec436f1253.tar.gz
device_generic_goldfish-opengl-068717010e0481268c3abc23068cd7ec436f1253.tar.bz2
device_generic_goldfish-opengl-068717010e0481268c3abc23068cd7ec436f1253.zip
Merge "Proper fix for HAL_PIXEL_FORMAT_RGBX_8888" into pi-dev
-rw-r--r--system/gralloc/gralloc.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp
index 37481487..cabc27b1 100644
--- a/system/gralloc/gralloc.cpp
+++ b/system/gralloc/gralloc.cpp
@@ -715,10 +715,19 @@ static int gralloc_alloc(alloc_device_t* dev,
if (needHostCb) {
if (hostCon && rcEnc) {
+ GLenum allocFormat = glFormat;
+ // The handling of RGBX_8888 is very subtle. Most of the time
+ // we want it to be treated as RGBA_8888, with the exception
+ // that alpha is always ignored and treated as 1. The solution
+ // is to create 3 channel RGB texture instead and host GL will
+ // handle the Alpha channel.
+ if (HAL_PIXEL_FORMAT_RGBX_8888 == format) {
+ allocFormat = GL_RGB;
+ }
if (s_grdma) {
- cb->hostHandle = rcEnc->rcCreateColorBufferDMA(rcEnc, w, h, glFormat, cb->emuFrameworkFormat);
+ cb->hostHandle = rcEnc->rcCreateColorBufferDMA(rcEnc, w, h, allocFormat, cb->emuFrameworkFormat);
} else {
- cb->hostHandle = rcEnc->rcCreateColorBuffer(rcEnc, w, h, glFormat);
+ cb->hostHandle = rcEnc->rcCreateColorBuffer(rcEnc, w, h, allocFormat);
}
D("Created host ColorBuffer 0x%x\n", cb->hostHandle);
}