diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-04-17 03:00:37 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-04-17 03:00:37 +0000 |
commit | ba77650403e3750a1425f5c8f50214cfe6f01506 (patch) | |
tree | 20adea706480a3d24d21093c2d3a4aee208d22e8 | |
parent | f7ce8cefef0e2346309fcb81a56f6921de562905 (diff) | |
parent | 76835be663b5a1723d7134bfb9fca58b0ed2a4e8 (diff) | |
download | device_generic_goldfish-opengl-ba77650403e3750a1425f5c8f50214cfe6f01506.tar.gz device_generic_goldfish-opengl-ba77650403e3750a1425f5c8f50214cfe6f01506.tar.bz2 device_generic_goldfish-opengl-ba77650403e3750a1425f5c8f50214cfe6f01506.zip |
Snap for 5476769 from 76835be663b5a1723d7134bfb9fca58b0ed2a4e8 to qt-release
Change-Id: I2363f0efbebbf5dee02557e94125510bea9ce6c4
-rw-r--r-- | shared/OpenglCodecCommon/gralloc_cb.h | 3 | ||||
-rw-r--r-- | system/gralloc/gralloc.cpp | 29 |
2 files changed, 24 insertions, 8 deletions
diff --git a/shared/OpenglCodecCommon/gralloc_cb.h b/shared/OpenglCodecCommon/gralloc_cb.h index 927c820f..ee4bd9a2 100644 --- a/shared/OpenglCodecCommon/gralloc_cb.h +++ b/shared/OpenglCodecCommon/gralloc_cb.h @@ -31,7 +31,8 @@ enum EmulatorFrameworkFormat { FRAMEWORK_FORMAT_GL_COMPATIBLE = 0, FRAMEWORK_FORMAT_YV12 = 1, - FRAMEWORK_FORMAT_YUV_420_888 = 2, + FRAMEWORK_FORMAT_YUV_420_888 = 2, // (Y+)(U+)(V+) + FRAMEWORK_FORMAT_YUV_420_888_INTERLEAVED = 3, // (Y+)(UV)+ }; // diff --git a/system/gralloc/gralloc.cpp b/system/gralloc/gralloc.cpp index 3706bc68..aace8e3f 100644 --- a/system/gralloc/gralloc.cpp +++ b/system/gralloc/gralloc.cpp @@ -622,7 +622,13 @@ static int gralloc_alloc(alloc_device_t* dev, // We are going to use RGB888 on the host glFormat = GL_RGB; glType = GL_UNSIGNED_BYTE; - selectedEmuFrameworkFormat = FRAMEWORK_FORMAT_YUV_420_888; + + if (usage & (GRALLOC_USAGE_HW_CAMERA_READ | GRALLOC_USAGE_HW_CAMERA_WRITE)) { + // EmulatedFakeCamera3.cpp assumes it is NV21 + selectedEmuFrameworkFormat = FRAMEWORK_FORMAT_YUV_420_888_INTERLEAVED; + } else { + selectedEmuFrameworkFormat = FRAMEWORK_FORMAT_YUV_420_888; + } break; default: ALOGE("gralloc_alloc: Unknown format %d", format); @@ -1360,12 +1366,21 @@ static int gralloc_lock_ycbcr(gralloc_module_t const* module, cStep = 1; break; case HAL_PIXEL_FORMAT_YCbCr_420_888: - yStride = cb->width; - cStride = yStride / 2; - yOffset = 0; - uOffset = cb->height * yStride; - vOffset = uOffset + cStride * cb->height / 2; - cStep = 1; + if (cb->emuFrameworkFormat == FRAMEWORK_FORMAT_YUV_420_888_INTERLEAVED) { + yStride = cb->width; + cStride = cb->width; + yOffset = 0; + vOffset = yStride * cb->height; + uOffset = vOffset + 1; + cStep = 2; + } else { + yStride = cb->width; + cStride = yStride / 2; + yOffset = 0; + uOffset = cb->height * yStride; + vOffset = uOffset + cStride * cb->height / 2; + cStep = 1; + } break; default: ALOGE("gralloc_lock_ycbcr unexpected internal format %x", |