Although gralloc0 doesn't include a video decoder flag, the IAllocator
gralloc0 passthrough gives the lower 32 bits of the BufferUsage flags
to gralloc0. This change makes cros_gralloc add the video decoder BO_USE
flag when that happens. It also adds some missing combinations for when
the BO_USE_HW_VIDEO_DECODER flag is actually set.
Change-Id: If2248f33ac2456c077fe63e90d2c39e7f57e2568
Reviewed-on: https://chromium-review.googlesource.com/
1786419
Tested-by: David Stevens <stevensd@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
};
// clang-format on
+// Gralloc0 doesn't define a video decoder flag. However, the IAllocator gralloc0
+// passthrough gives the low 32-bits of the BufferUsage flags to gralloc0 in their
+// entirety, so we can detect the video decoder flag passed by IAllocator clients.
+#define BUFFER_USAGE_VIDEO_DECODER (1 << 22)
+
static uint64_t gralloc0_convert_usage(int usage)
{
uint64_t use_flags = BO_USE_NONE;
use_flags |= BO_USE_CAMERA_READ;
if (usage & GRALLOC_USAGE_RENDERSCRIPT)
use_flags |= BO_USE_RENDERSCRIPT;
+ if (usage & BUFFER_USAGE_VIDEO_DECODER)
+ use_flags |= BO_USE_HW_VIDEO_DECODER;
return use_flags;
}
* Video Encoder Accelerator (VEA). It could also support NV12 potentially in the future.
*/
drv_modify_combination(drv, DRM_FORMAT_YVU420, &metadata, BO_USE_HW_VIDEO_ENCODER);
- drv_modify_combination(drv, DRM_FORMAT_NV12, &metadata, BO_USE_HW_VIDEO_ENCODER);
+ drv_modify_combination(drv, DRM_FORMAT_NV12, &metadata,
+ BO_USE_HW_VIDEO_ENCODER | BO_USE_HW_VIDEO_DECODER);
/* Android CTS tests require this. */
drv_add_combination(drv, DRM_FORMAT_BGR888, &metadata, BO_USE_SW_MASK);
drv_add_combination(drv, DRM_FORMAT_BGR888, &LINEAR_METADATA, BO_USE_SW_MASK);
drv_modify_combination(drv, DRM_FORMAT_NV12, &LINEAR_METADATA,
- BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE);
+ BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE | BO_USE_HW_VIDEO_DECODER);
drv_modify_combination(drv, DRM_FORMAT_R8, &LINEAR_METADATA,
BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE);