OSDN Git Service

drm/sun4i: de2: rgb field in de2 format struct is redundant
authorJernej Skrabec <jernej.skrabec@siol.net>
Mon, 24 Feb 2020 17:38:58 +0000 (18:38 +0100)
committerJernej Skrabec <jernej.skrabec@siol.net>
Tue, 24 Mar 2020 20:12:51 +0000 (21:12 +0100)
drm_format_info structure already contains information if format is RGB
or YUV. Use that instead.

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20200224173901.174016-5-jernej.skrabec@siol.net
drivers/gpu/drm/sun4i/sun8i_mixer.c
drivers/gpu/drm/sun4i/sun8i_mixer.h
drivers/gpu/drm/sun4i/sun8i_ui_layer.c
drivers/gpu/drm/sun4i/sun8i_vi_layer.c

index 4a64f7a..45e3cd9 100644 (file)
@@ -31,297 +31,249 @@ static const struct de2_fmt_info de2_formats[] = {
        {
                .drm_fmt = DRM_FORMAT_ARGB8888,
                .de2_fmt = SUN8I_MIXER_FBFMT_ARGB8888,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_ABGR8888,
                .de2_fmt = SUN8I_MIXER_FBFMT_ABGR8888,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_RGBA8888,
                .de2_fmt = SUN8I_MIXER_FBFMT_RGBA8888,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_BGRA8888,
                .de2_fmt = SUN8I_MIXER_FBFMT_BGRA8888,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_XRGB8888,
                .de2_fmt = SUN8I_MIXER_FBFMT_XRGB8888,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_XBGR8888,
                .de2_fmt = SUN8I_MIXER_FBFMT_XBGR8888,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_RGBX8888,
                .de2_fmt = SUN8I_MIXER_FBFMT_RGBX8888,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_BGRX8888,
                .de2_fmt = SUN8I_MIXER_FBFMT_BGRX8888,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_RGB888,
                .de2_fmt = SUN8I_MIXER_FBFMT_RGB888,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_BGR888,
                .de2_fmt = SUN8I_MIXER_FBFMT_BGR888,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_RGB565,
                .de2_fmt = SUN8I_MIXER_FBFMT_RGB565,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_BGR565,
                .de2_fmt = SUN8I_MIXER_FBFMT_BGR565,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_ARGB4444,
                .de2_fmt = SUN8I_MIXER_FBFMT_ARGB4444,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                /* for DE2 VI layer which ignores alpha */
                .drm_fmt = DRM_FORMAT_XRGB4444,
                .de2_fmt = SUN8I_MIXER_FBFMT_ARGB4444,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_ABGR4444,
                .de2_fmt = SUN8I_MIXER_FBFMT_ABGR4444,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                /* for DE2 VI layer which ignores alpha */
                .drm_fmt = DRM_FORMAT_XBGR4444,
                .de2_fmt = SUN8I_MIXER_FBFMT_ABGR4444,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_RGBA4444,
                .de2_fmt = SUN8I_MIXER_FBFMT_RGBA4444,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                /* for DE2 VI layer which ignores alpha */
                .drm_fmt = DRM_FORMAT_RGBX4444,
                .de2_fmt = SUN8I_MIXER_FBFMT_RGBA4444,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_BGRA4444,
                .de2_fmt = SUN8I_MIXER_FBFMT_BGRA4444,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                /* for DE2 VI layer which ignores alpha */
                .drm_fmt = DRM_FORMAT_BGRX4444,
                .de2_fmt = SUN8I_MIXER_FBFMT_BGRA4444,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_ARGB1555,
                .de2_fmt = SUN8I_MIXER_FBFMT_ARGB1555,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                /* for DE2 VI layer which ignores alpha */
                .drm_fmt = DRM_FORMAT_XRGB1555,
                .de2_fmt = SUN8I_MIXER_FBFMT_ARGB1555,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_ABGR1555,
                .de2_fmt = SUN8I_MIXER_FBFMT_ABGR1555,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                /* for DE2 VI layer which ignores alpha */
                .drm_fmt = DRM_FORMAT_XBGR1555,
                .de2_fmt = SUN8I_MIXER_FBFMT_ABGR1555,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_RGBA5551,
                .de2_fmt = SUN8I_MIXER_FBFMT_RGBA5551,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                /* for DE2 VI layer which ignores alpha */
                .drm_fmt = DRM_FORMAT_RGBX5551,
                .de2_fmt = SUN8I_MIXER_FBFMT_RGBA5551,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_BGRA5551,
                .de2_fmt = SUN8I_MIXER_FBFMT_BGRA5551,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                /* for DE2 VI layer which ignores alpha */
                .drm_fmt = DRM_FORMAT_BGRX5551,
                .de2_fmt = SUN8I_MIXER_FBFMT_BGRA5551,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_ARGB2101010,
                .de2_fmt = SUN8I_MIXER_FBFMT_ARGB2101010,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_ABGR2101010,
                .de2_fmt = SUN8I_MIXER_FBFMT_ABGR2101010,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_RGBA1010102,
                .de2_fmt = SUN8I_MIXER_FBFMT_RGBA1010102,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_BGRA1010102,
                .de2_fmt = SUN8I_MIXER_FBFMT_BGRA1010102,
-               .rgb = true,
                .csc = SUN8I_CSC_MODE_OFF,
        },
        {
                .drm_fmt = DRM_FORMAT_UYVY,
                .de2_fmt = SUN8I_MIXER_FBFMT_UYVY,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_VYUY,
                .de2_fmt = SUN8I_MIXER_FBFMT_VYUY,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_YUYV,
                .de2_fmt = SUN8I_MIXER_FBFMT_YUYV,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_YVYU,
                .de2_fmt = SUN8I_MIXER_FBFMT_YVYU,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_NV16,
                .de2_fmt = SUN8I_MIXER_FBFMT_NV16,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_NV61,
                .de2_fmt = SUN8I_MIXER_FBFMT_NV61,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_NV12,
                .de2_fmt = SUN8I_MIXER_FBFMT_NV12,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_NV21,
                .de2_fmt = SUN8I_MIXER_FBFMT_NV21,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_YUV422,
                .de2_fmt = SUN8I_MIXER_FBFMT_YUV422,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_YUV420,
                .de2_fmt = SUN8I_MIXER_FBFMT_YUV420,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_YUV411,
                .de2_fmt = SUN8I_MIXER_FBFMT_YUV411,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_YVU422,
                .de2_fmt = SUN8I_MIXER_FBFMT_YUV422,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YVU2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_YVU420,
                .de2_fmt = SUN8I_MIXER_FBFMT_YUV420,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YVU2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_YVU411,
                .de2_fmt = SUN8I_MIXER_FBFMT_YUV411,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YVU2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_P010,
                .de2_fmt = SUN8I_MIXER_FBFMT_P010_YUV,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
        {
                .drm_fmt = DRM_FORMAT_P210,
                .de2_fmt = SUN8I_MIXER_FBFMT_P210_YUV,
-               .rgb = false,
                .csc = SUN8I_CSC_MODE_YUV2RGB,
        },
 };
index 345b28b..447ad0b 100644 (file)
 struct de2_fmt_info {
        u32                     drm_fmt;
        u32                     de2_fmt;
-       bool                    rgb;
        enum sun8i_csc_mode     csc;
 };
 
index c87fd84..99ee19a 100644 (file)
@@ -175,12 +175,14 @@ static int sun8i_ui_layer_update_formats(struct sun8i_mixer *mixer, int channel,
 {
        struct drm_plane_state *state = plane->state;
        const struct de2_fmt_info *fmt_info;
+       const struct drm_format_info *fmt;
        u32 val, ch_base;
 
        ch_base = sun8i_channel_base(mixer, channel);
 
-       fmt_info = sun8i_mixer_format_info(state->fb->format->format);
-       if (!fmt_info || !fmt_info->rgb) {
+       fmt = state->fb->format;
+       fmt_info = sun8i_mixer_format_info(fmt->format);
+       if (!fmt_info || fmt->is_yuv) {
                DRM_DEBUG_DRIVER("Invalid format\n");
                return -EINVAL;
        }
index b8398ca..a2eb437 100644 (file)
@@ -215,11 +215,13 @@ static int sun8i_vi_layer_update_formats(struct sun8i_mixer *mixer, int channel,
 {
        struct drm_plane_state *state = plane->state;
        const struct de2_fmt_info *fmt_info;
+       const struct drm_format_info *fmt;
        u32 val, ch_base;
 
        ch_base = sun8i_channel_base(mixer, channel);
 
-       fmt_info = sun8i_mixer_format_info(state->fb->format->format);
+       fmt = state->fb->format;
+       fmt_info = sun8i_mixer_format_info(fmt->format);
        if (!fmt_info) {
                DRM_DEBUG_DRIVER("Invalid format\n");
                return -EINVAL;
@@ -239,7 +241,7 @@ static int sun8i_vi_layer_update_formats(struct sun8i_mixer *mixer, int channel,
                sun8i_csc_enable_ccsc(mixer, channel, false);
        }
 
-       if (fmt_info->rgb)
+       if (!fmt->is_yuv)
                val = SUN8I_MIXER_CHAN_VI_LAYER_ATTR_RGB_MODE;
        else
                val = 0;