aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Hu <bohu@google.com>2023-04-26 08:25:26 -0700
committerBo Hu <bohu@google.com>2023-04-26 15:31:17 +0000
commit3a15976f326d878c658c1a527ed369414c9c4811 (patch)
treea3a1498ac5caaba087eeb9dcfacbe1ecd4935ec8
parentf7a2e1ab1077ee3c46a112949a277d3f5041d907 (diff)
downloadgoldfish-opengl-3a15976f326d878c658c1a527ed369414c9c4811.tar.gz
codecs: set cpu read and write usage for encoder and decoder
They need both cpu and gpu access, lets make sure they get them. Bug: 279752421 Change-Id: I521710b1390ff36535cad8fc20d2a350a6f4b79a
-rw-r--r--system/hals/allocator3.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/system/hals/allocator3.cpp b/system/hals/allocator3.cpp
index 8a05abd9..3ff8c848 100644
--- a/system/hals/allocator3.cpp
+++ b/system/hals/allocator3.cpp
@@ -27,6 +27,7 @@
#include "debug.h"
const int kOMX_COLOR_FormatYUV420Planar = 19;
+const int kC2_COLOR_FormatYCBCR_420_888 = 0x23;
using ::android::hardware::hidl_handle;
using ::android::hardware::hidl_vec;
@@ -101,7 +102,7 @@ private:
if (!descriptor.height) { RETURN_ERROR(Error3::UNSUPPORTED); }
if (descriptor.layerCount != 1) { RETURN_ERROR(Error3::UNSUPPORTED); }
- const uint32_t usage = descriptor.usage;
+ uint32_t usage = descriptor.usage;
int bpp = 1;
int glFormat = 0;
@@ -112,7 +113,7 @@ private:
EmulatorFrameworkFormat::GL_COMPATIBLE;
PixelFormat format;
- Error3 e = getBufferFormat(descriptor.format, usage, &format);
+ Error3 e = getBufferFormat(descriptor.format, &usage, &format);
if (e != Error3::NONE) {
ALOGE("%s:%d Unsupported format: frameworkFormat=%d, usage=%x",
__func__, __LINE__, descriptor.format, usage);
@@ -290,19 +291,22 @@ private:
}
}
- static Error3 getBufferFormat(const PixelFormat frameworkFormat,
- const uint32_t usage,
+ static Error3 getBufferFormat(const PixelFormat frameworkFormat, uint32_t* pusage,
PixelFormat* format) {
+ uint32_t& usage = *pusage;
if (frameworkFormat == PixelFormat::IMPLEMENTATION_DEFINED) {
RETURN_ERROR(Error3::UNSUPPORTED);
- } else if (static_cast<int>(frameworkFormat) == kOMX_COLOR_FormatYUV420Planar &&
- (usage & BufferUsage::VIDEO_DECODER)) {
+ } else if ((static_cast<int>(frameworkFormat) == kOMX_COLOR_FormatYUV420Planar ||
+ static_cast<int>(frameworkFormat) == kC2_COLOR_FormatYCBCR_420_888) &&
+ (usage & BufferUsage::VIDEO_DECODER)) {
ALOGW("gralloc_alloc: Requested OMX_COLOR_FormatYUV420Planar, given "
"YCbCr_420_888, taking experimental path. "
"usage=%x", usage);
*format = PixelFormat::YCBCR_420_888;
+ usage = static_cast<typeof(usage)>(usage | BufferUsage::CPU_READ_OFTEN);
+ usage = static_cast<typeof(usage)>(usage | BufferUsage::CPU_WRITE_OFTEN);
RETURN(Error3::NONE);
- } else {
+ } else {
*format = frameworkFormat;
RETURN(Error3::NONE);
}