OSDN Git Service

drm: rcar-du: Add new formats (2-10-10-10 ARGB, Y210)
authorTomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Wed, 21 Dec 2022 09:24:48 +0000 (11:24 +0200)
committerLaurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Fri, 20 Jan 2023 23:18:04 +0000 (01:18 +0200)
Add new pixel formats: RGBX1010102, RGBA1010102, ARGB2101010, Y210 and
Y212.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
drivers/gpu/drm/rcar-du/rcar_du_kms.c
drivers/gpu/drm/rcar-du/rcar_du_vsp.c

index 8c2719e..adfb36b 100644 (file)
@@ -260,6 +260,24 @@ static const struct rcar_du_format_info rcar_du_format_infos[] = {
                .planes = 1,
                .hsub = 1,
        }, {
+               .fourcc = DRM_FORMAT_RGBX1010102,
+               .v4l2 = V4L2_PIX_FMT_RGBX1010102,
+               .bpp = 32,
+               .planes = 1,
+               .hsub = 1,
+       }, {
+               .fourcc = DRM_FORMAT_RGBA1010102,
+               .v4l2 = V4L2_PIX_FMT_RGBA1010102,
+               .bpp = 32,
+               .planes = 1,
+               .hsub = 1,
+       }, {
+               .fourcc = DRM_FORMAT_ARGB2101010,
+               .v4l2 = V4L2_PIX_FMT_ARGB2101010,
+               .bpp = 32,
+               .planes = 1,
+               .hsub = 1,
+       }, {
                .fourcc = DRM_FORMAT_YVYU,
                .v4l2 = V4L2_PIX_FMT_YVYU,
                .bpp = 16,
@@ -307,6 +325,18 @@ static const struct rcar_du_format_info rcar_du_format_infos[] = {
                .bpp = 24,
                .planes = 3,
                .hsub = 1,
+       }, {
+               .fourcc = DRM_FORMAT_Y210,
+               .v4l2 = V4L2_PIX_FMT_Y210,
+               .bpp = 32,
+               .planes = 1,
+               .hsub = 2,
+       }, {
+               .fourcc = DRM_FORMAT_Y212,
+               .v4l2 = V4L2_PIX_FMT_Y212,
+               .bpp = 32,
+               .planes = 1,
+               .hsub = 2,
        },
 };
 
index e465aef..fe90be5 100644 (file)
@@ -139,6 +139,43 @@ static const u32 rcar_du_vsp_formats[] = {
        DRM_FORMAT_YVU444,
 };
 
+/*
+ * Gen4 supports the same formats as above, and additionally 2-10-10-10 RGB
+ * formats and Y210 & Y212 formats.
+ */
+static const u32 rcar_du_vsp_formats_gen4[] = {
+       DRM_FORMAT_RGB332,
+       DRM_FORMAT_ARGB4444,
+       DRM_FORMAT_XRGB4444,
+       DRM_FORMAT_ARGB1555,
+       DRM_FORMAT_XRGB1555,
+       DRM_FORMAT_RGB565,
+       DRM_FORMAT_BGR888,
+       DRM_FORMAT_RGB888,
+       DRM_FORMAT_BGRA8888,
+       DRM_FORMAT_BGRX8888,
+       DRM_FORMAT_ARGB8888,
+       DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_RGBX1010102,
+       DRM_FORMAT_RGBA1010102,
+       DRM_FORMAT_ARGB2101010,
+       DRM_FORMAT_UYVY,
+       DRM_FORMAT_YUYV,
+       DRM_FORMAT_YVYU,
+       DRM_FORMAT_NV12,
+       DRM_FORMAT_NV21,
+       DRM_FORMAT_NV16,
+       DRM_FORMAT_NV61,
+       DRM_FORMAT_YUV420,
+       DRM_FORMAT_YVU420,
+       DRM_FORMAT_YUV422,
+       DRM_FORMAT_YVU422,
+       DRM_FORMAT_YUV444,
+       DRM_FORMAT_YVU444,
+       DRM_FORMAT_Y210,
+       DRM_FORMAT_Y212,
+};
+
 static void rcar_du_vsp_plane_setup(struct rcar_du_vsp_plane *plane)
 {
        struct rcar_du_vsp_plane_state *state =
@@ -436,14 +473,23 @@ int rcar_du_vsp_init(struct rcar_du_vsp *vsp, struct device_node *np,
                                         ? DRM_PLANE_TYPE_PRIMARY
                                         : DRM_PLANE_TYPE_OVERLAY;
                struct rcar_du_vsp_plane *plane = &vsp->planes[i];
+               unsigned int num_formats;
+               const u32 *formats;
+
+               if (rcdu->info->gen < 4) {
+                       num_formats = ARRAY_SIZE(rcar_du_vsp_formats);
+                       formats = rcar_du_vsp_formats;
+               } else {
+                       num_formats = ARRAY_SIZE(rcar_du_vsp_formats_gen4);
+                       formats = rcar_du_vsp_formats_gen4;
+               }
 
                plane->vsp = vsp;
                plane->index = i;
 
                ret = drm_universal_plane_init(&rcdu->ddev, &plane->plane,
                                               crtcs, &rcar_du_vsp_plane_funcs,
-                                              rcar_du_vsp_formats,
-                                              ARRAY_SIZE(rcar_du_vsp_formats),
+                                              formats, num_formats,
                                               NULL, type, NULL);
                if (ret < 0)
                        return ret;