diff options
author | Greg Hackmann <ghackmann@google.com> | 2013-08-29 10:24:35 -0700 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2015-07-07 13:14:21 +0200 |
commit | 1c3b3a15333235f995f16eb8df1433e48f2daf34 (patch) | |
tree | 53e6ee4112ad047d22b67b644de90e271dd869d2 | |
parent | 3cf433dd0844a96bf36a10eb115b2031a2c8ff39 (diff) | |
download | android_hardware_samsung_slsi_exynos5430-1c3b3a15333235f995f16eb8df1433e48f2daf34.tar.gz android_hardware_samsung_slsi_exynos5430-1c3b3a15333235f995f16eb8df1433e48f2daf34.tar.xz android_hardware_samsung_slsi_exynos5430-1c3b3a15333235f995f16eb8df1433e48f2daf34.zip |
gralloc: use BGRA byte order for video encoder targets
Encoder does not recognize RGBA byte order, so refuse to allocate if SW
usage flags are set
Bug: 10429036
Change-Id: I3b9d0e71566c3565068b7c38c4f9189f4bb93fd0
Signed-off-by: Greg Hackmann <ghackmann@google.com>
-rw-r--r-- | gralloc/gralloc.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gralloc/gralloc.cpp b/gralloc/gralloc.cpp index 512cb87..a929306 100644 --- a/gralloc/gralloc.cpp +++ b/gralloc/gralloc.cpp @@ -134,11 +134,19 @@ static int gralloc_alloc_rgb(int ionfd, int w, int h, int format, int usage, int bpp = 0, vstride, fd, err; unsigned int heap_mask = _select_heap(usage); - if (format == HAL_PIXEL_FORMAT_RGBA_8888 && (usage & GRALLOC_USAGE_HW_FB)) { - ALOGW_IF(usage & (GRALLOC_USAGE_SW_READ_MASK | - GRALLOC_USAGE_SW_WRITE_MASK), - "framebuffer target should not have SW usage bits; ignoring"); - format = HAL_PIXEL_FORMAT_BGRA_8888; + if (format == HAL_PIXEL_FORMAT_RGBA_8888) { + bool sw_usage = !!(usage & (GRALLOC_USAGE_SW_READ_MASK | + GRALLOC_USAGE_SW_WRITE_MASK)); + + if (usage & GRALLOC_USAGE_HW_FB) { + ALOGW_IF(sw_usage, + "framebuffer target should not have SW usage bits; ignoring"); + format = HAL_PIXEL_FORMAT_BGRA_8888; + } else if (usage & GRALLOC_USAGE_HW_VIDEO_ENCODER) { + if (sw_usage) + return -EINVAL; + format = HAL_PIXEL_FORMAT_BGRA_8888; + } } switch (format) { |