aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-05-01 07:21:01 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-05-01 07:21:01 +0000
commit629d0ec617aded8618a130b65382d78e7302d283 (patch)
treead4d235688be3cc21345a4c95116c64cea625794
parent229807c7306a01226ae37db194fa957064fa668e (diff)
parent068717010e0481268c3abc23068cd7ec436f1253 (diff)
downloaddevice_generic_goldfish-opengl-629d0ec617aded8618a130b65382d78e7302d283.tar.gz
device_generic_goldfish-opengl-629d0ec617aded8618a130b65382d78e7302d283.tar.bz2
device_generic_goldfish-opengl-629d0ec617aded8618a130b65382d78e7302d283.zip
Snap for 4754571 from 068717010e0481268c3abc23068cd7ec436f1253 to pi-release
Change-Id: I93e3eafe0a8e029681764c67d1212df1f52d52c7
-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);
}