minigbm: rockchip: Add support for buffers required by new camera subsystem
It's much the same as what we did for i915 in:
d30c0a5 (minigbm: i915: Add support for buffers required by new camera subsystem)
https://chromium-review.googlesource.com/559315
BUG=b:65390035
TEST=test arc_camera3_test on scarlet, no more this error:
[0905/104926:ERROR:camera3_test_gralloc.cc (76)] Can't detect flexible YUV 420 format
Change-Id: Ib99687ff2aaaca0233fa950abbe8581bc3572b74
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
Reviewed-on: https://chromium-review.googlesource.com/670888
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
diff --git a/rockchip.c b/rockchip.c
index 004ea77..93db664 100644
--- a/rockchip.c
+++ b/rockchip.c
@@ -132,6 +132,16 @@
drv_modify_combination(drv, DRM_FORMAT_XRGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT);
drv_modify_combination(drv, DRM_FORMAT_ARGB8888, &metadata, BO_USE_CURSOR | BO_USE_SCANOUT);
+ /* Camera ISP supports only NV12 output. */
+ drv_modify_combination(drv, DRM_FORMAT_NV12, &metadata,
+ BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE);
+ /*
+ * R8 format is used for Android's HAL_PIXEL_FORMAT_BLOB and is used for JPEG snapshots
+ * from camera.
+ */
+ drv_modify_combination(drv, DRM_FORMAT_R8, &metadata,
+ BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE);
+
items = drv_query_kms(drv, &num_items);
if (!items || !num_items)
return 0;
@@ -284,6 +294,9 @@
{
switch (format) {
case DRM_FORMAT_FLEX_IMPLEMENTATION_DEFINED:
+ /* Camera subsystem requires NV12. */
+ if (usage & (BO_USE_CAMERA_READ | BO_USE_CAMERA_WRITE))
+ return DRM_FORMAT_NV12;
/*HACK: See b/28671744 */
return DRM_FORMAT_XBGR8888;
case DRM_FORMAT_FLEX_YCbCr_420_888: