drm/vc4: plane: Add 3:3:2 and 4:4:4:4 RGB/RGBX/RGBA formats
authorDave Stevenson <dave.stevenson@raspberrypi.com>
Wed, 7 Dec 2022 11:53:22 +0000 (12:53 +0100)
committerMaxime Ripard <maxime@cerno.tech>
Mon, 9 Jan 2023 14:21:31 +0000 (15:21 +0100)
The hardware supports the 332 8bpp and 4:4:4:4 16bpp formats,
but the table of supported formats didn't include them.
Add them in.

In theory they are supported for T-format as well as linear,
but without a way to test them just add them as linear for now.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Link: https://lore.kernel.org/r/20221207-rpi-hvs-crtc-misc-v1-11-1f8e0770798b@cerno.tech
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
drivers/gpu/drm/vc4/vc4_plane.c

index 7b7bbe94d47a9fd2c365c3bd4dafd6ef7257d3b1..dee525bacd4b55ac6f71f4c8d2e9336773089c47 100644 (file)
@@ -175,6 +175,66 @@ static const struct hvs_format {
                .pixel_order_hvs5 = HVS_PIXEL_ORDER_ABGR,
                .hvs5_only = true,
        },
+       {
+               .drm = DRM_FORMAT_RGB332,
+               .hvs = HVS_PIXEL_FORMAT_RGB332,
+               .pixel_order = HVS_PIXEL_ORDER_ARGB,
+               .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB,
+       },
+       {
+               .drm = DRM_FORMAT_BGR233,
+               .hvs = HVS_PIXEL_FORMAT_RGB332,
+               .pixel_order = HVS_PIXEL_ORDER_ABGR,
+               .pixel_order_hvs5 = HVS_PIXEL_ORDER_ABGR,
+       },
+       {
+               .drm = DRM_FORMAT_XRGB4444,
+               .hvs = HVS_PIXEL_FORMAT_RGBA4444,
+               .pixel_order = HVS_PIXEL_ORDER_ABGR,
+               .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB,
+       },
+       {
+               .drm = DRM_FORMAT_ARGB4444,
+               .hvs = HVS_PIXEL_FORMAT_RGBA4444,
+               .pixel_order = HVS_PIXEL_ORDER_ABGR,
+               .pixel_order_hvs5 = HVS_PIXEL_ORDER_ARGB,
+       },
+       {
+               .drm = DRM_FORMAT_XBGR4444,
+               .hvs = HVS_PIXEL_FORMAT_RGBA4444,
+               .pixel_order = HVS_PIXEL_ORDER_ARGB,
+               .pixel_order_hvs5 = HVS_PIXEL_ORDER_ABGR,
+       },
+       {
+               .drm = DRM_FORMAT_ABGR4444,
+               .hvs = HVS_PIXEL_FORMAT_RGBA4444,
+               .pixel_order = HVS_PIXEL_ORDER_ARGB,
+               .pixel_order_hvs5 = HVS_PIXEL_ORDER_ABGR,
+       },
+       {
+               .drm = DRM_FORMAT_BGRX4444,
+               .hvs = HVS_PIXEL_FORMAT_RGBA4444,
+               .pixel_order = HVS_PIXEL_ORDER_RGBA,
+               .pixel_order_hvs5 = HVS_PIXEL_ORDER_BGRA,
+       },
+       {
+               .drm = DRM_FORMAT_BGRA4444,
+               .hvs = HVS_PIXEL_FORMAT_RGBA4444,
+               .pixel_order = HVS_PIXEL_ORDER_RGBA,
+               .pixel_order_hvs5 = HVS_PIXEL_ORDER_BGRA,
+       },
+       {
+               .drm = DRM_FORMAT_RGBX4444,
+               .hvs = HVS_PIXEL_FORMAT_RGBA4444,
+               .pixel_order = HVS_PIXEL_ORDER_BGRA,
+               .pixel_order_hvs5 = HVS_PIXEL_ORDER_RGBA,
+       },
+       {
+               .drm = DRM_FORMAT_RGBA4444,
+               .hvs = HVS_PIXEL_FORMAT_RGBA4444,
+               .pixel_order = HVS_PIXEL_ORDER_BGRA,
+               .pixel_order_hvs5 = HVS_PIXEL_ORDER_RGBA,
+       },
 };
 
 static const struct hvs_format *vc4_get_hvs_format(u32 drm_format)
@@ -1521,6 +1581,16 @@ static bool vc4_format_mod_supported(struct drm_plane *plane,
        case DRM_FORMAT_BGRX1010102:
        case DRM_FORMAT_RGBA1010102:
        case DRM_FORMAT_BGRA1010102:
+       case DRM_FORMAT_XRGB4444:
+       case DRM_FORMAT_ARGB4444:
+       case DRM_FORMAT_XBGR4444:
+       case DRM_FORMAT_ABGR4444:
+       case DRM_FORMAT_RGBX4444:
+       case DRM_FORMAT_RGBA4444:
+       case DRM_FORMAT_BGRX4444:
+       case DRM_FORMAT_BGRA4444:
+       case DRM_FORMAT_RGB332:
+       case DRM_FORMAT_BGR233:
        case DRM_FORMAT_YUV422:
        case DRM_FORMAT_YVU422:
        case DRM_FORMAT_YUV420: