drm: omapdrm: Move color modes feature to dispc_features structure
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Fri, 4 Aug 2017 22:44:04 +0000 (01:44 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Tue, 15 Aug 2017 12:18:25 +0000 (15:18 +0300)
The supported_color_modes is a dispc feature. Move it from the
omap_dss_features structure to the dispc_features structure.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/gpu/drm/omapdrm/dss/dispc.c
drivers/gpu/drm/omapdrm/dss/dss_features.c
drivers/gpu/drm/omapdrm/dss/dss_features.h

index 99a308446283d09c6d4574da82a637684c942629..f3ae7f16e65ce4e6f3e24ceb9dbe7ac019c1923b 100644 (file)
@@ -88,6 +88,7 @@ struct dispc_features {
                u16 width, u16 height, u16 out_width, u16 out_height,
                bool mem_to_mem);
        u8 num_fifos;
+       const u32 **supported_color_modes;
        unsigned int buffer_size_unit;
        unsigned int burst_size_unit;
 
@@ -1144,9 +1145,24 @@ static u32 dispc_ovl_get_burst_size(enum omap_plane_id plane)
        return dispc.feat->burst_size_unit * 8;
 }
 
+static bool dispc_ovl_color_mode_supported(enum omap_plane_id plane, u32 fourcc)
+{
+       const u32 *modes;
+       unsigned int i;
+
+       modes = dispc.feat->supported_color_modes[plane];
+
+       for (i = 0; modes[i]; ++i) {
+               if (modes[i] == fourcc)
+                       return true;
+       }
+
+       return false;
+}
+
 static const u32 *dispc_ovl_get_color_modes(enum omap_plane_id plane)
 {
-       return dss_feat_get_supported_color_modes(plane);
+       return dispc.feat->supported_color_modes[plane];
 }
 
 static int dispc_get_num_ovls(void)
@@ -1867,7 +1883,7 @@ static void dispc_ovl_set_rotation_attrs(enum omap_plane_id plane, u8 rotation,
                REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane),
                        row_repeat ? 1 : 0, 18, 18);
 
-       if (dss_feat_color_mode_supported(plane, DRM_FORMAT_NV12)) {
+       if (dispc_ovl_color_mode_supported(plane, DRM_FORMAT_NV12)) {
                bool doublestride =
                        fourcc == DRM_FORMAT_NV12 &&
                        rotation_type == OMAP_DSS_ROT_TILER &&
@@ -2431,7 +2447,7 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane,
                        out_height);
        }
 
-       if (!dss_feat_color_mode_supported(plane, fourcc))
+       if (!dispc_ovl_color_mode_supported(plane, fourcc))
                return -EINVAL;
 
        r = dispc_ovl_calc_scaling(pclk, lclk, caps, vm, in_width,
@@ -3692,6 +3708,106 @@ static void _omap_dispc_initial_config(void)
                dispc_init_mflag();
 }
 
+#define COLOR_ARRAY(arr...) (const u32[]) { arr, 0 }
+
+static const u32 *omap2_dispc_supported_color_modes[] = {
+
+       /* OMAP_DSS_GFX */
+       COLOR_ARRAY(
+       DRM_FORMAT_RGBX4444, DRM_FORMAT_RGB565,
+       DRM_FORMAT_XRGB8888, DRM_FORMAT_RGB888),
+
+       /* OMAP_DSS_VIDEO1 */
+       COLOR_ARRAY(
+       DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_RGB888, DRM_FORMAT_YUYV,
+       DRM_FORMAT_UYVY),
+
+       /* OMAP_DSS_VIDEO2 */
+       COLOR_ARRAY(
+       DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_RGB888, DRM_FORMAT_YUYV,
+       DRM_FORMAT_UYVY),
+};
+
+static const u32 *omap3_dispc_supported_color_modes[] = {
+       /* OMAP_DSS_GFX */
+       COLOR_ARRAY(
+       DRM_FORMAT_RGBX4444, DRM_FORMAT_ARGB4444,
+       DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_RGB888, DRM_FORMAT_ARGB8888,
+       DRM_FORMAT_RGBA8888, DRM_FORMAT_RGBX8888),
+
+       /* OMAP_DSS_VIDEO1 */
+       COLOR_ARRAY(
+       DRM_FORMAT_XRGB8888, DRM_FORMAT_RGB888,
+       DRM_FORMAT_RGBX4444, DRM_FORMAT_RGB565,
+       DRM_FORMAT_YUYV, DRM_FORMAT_UYVY),
+
+       /* OMAP_DSS_VIDEO2 */
+       COLOR_ARRAY(
+       DRM_FORMAT_RGBX4444, DRM_FORMAT_ARGB4444,
+       DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_RGB888, DRM_FORMAT_YUYV,
+       DRM_FORMAT_UYVY, DRM_FORMAT_ARGB8888,
+       DRM_FORMAT_RGBA8888, DRM_FORMAT_RGBX8888),
+};
+
+static const u32 *omap4_dispc_supported_color_modes[] = {
+       /* OMAP_DSS_GFX */
+       COLOR_ARRAY(
+       DRM_FORMAT_RGBX4444, DRM_FORMAT_ARGB4444,
+       DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_RGB888, DRM_FORMAT_ARGB8888,
+       DRM_FORMAT_RGBA8888, DRM_FORMAT_RGBX8888,
+       DRM_FORMAT_ARGB1555, DRM_FORMAT_XRGB4444,
+       DRM_FORMAT_RGBA4444, DRM_FORMAT_XRGB1555),
+
+       /* OMAP_DSS_VIDEO1 */
+       COLOR_ARRAY(
+       DRM_FORMAT_RGB565, DRM_FORMAT_RGBX4444,
+       DRM_FORMAT_YUYV, DRM_FORMAT_ARGB1555,
+       DRM_FORMAT_RGBA8888, DRM_FORMAT_NV12,
+       DRM_FORMAT_RGBA4444, DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_RGB888, DRM_FORMAT_UYVY,
+       DRM_FORMAT_ARGB4444, DRM_FORMAT_XRGB1555,
+       DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB4444,
+       DRM_FORMAT_RGBX8888),
+
+       /* OMAP_DSS_VIDEO2 */
+       COLOR_ARRAY(
+       DRM_FORMAT_RGB565, DRM_FORMAT_RGBX4444,
+       DRM_FORMAT_YUYV, DRM_FORMAT_ARGB1555,
+       DRM_FORMAT_RGBA8888, DRM_FORMAT_NV12,
+       DRM_FORMAT_RGBA4444, DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_RGB888, DRM_FORMAT_UYVY,
+       DRM_FORMAT_ARGB4444, DRM_FORMAT_XRGB1555,
+       DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB4444,
+       DRM_FORMAT_RGBX8888),
+
+       /* OMAP_DSS_VIDEO3 */
+       COLOR_ARRAY(
+       DRM_FORMAT_RGB565, DRM_FORMAT_RGBX4444,
+       DRM_FORMAT_YUYV, DRM_FORMAT_ARGB1555,
+       DRM_FORMAT_RGBA8888, DRM_FORMAT_NV12,
+       DRM_FORMAT_RGBA4444, DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_RGB888, DRM_FORMAT_UYVY,
+       DRM_FORMAT_ARGB4444, DRM_FORMAT_XRGB1555,
+       DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB4444,
+       DRM_FORMAT_RGBX8888),
+
+       /* OMAP_DSS_WB */
+       COLOR_ARRAY(
+       DRM_FORMAT_RGB565, DRM_FORMAT_RGBX4444,
+       DRM_FORMAT_YUYV, DRM_FORMAT_ARGB1555,
+       DRM_FORMAT_RGBA8888, DRM_FORMAT_NV12,
+       DRM_FORMAT_RGBA4444, DRM_FORMAT_XRGB8888,
+       DRM_FORMAT_RGB888, DRM_FORMAT_UYVY,
+       DRM_FORMAT_ARGB4444, DRM_FORMAT_XRGB1555,
+       DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB4444,
+       DRM_FORMAT_RGBX8888),
+};
+
 static const struct dispc_features omap24xx_dispc_feats = {
        .sw_start               =       5,
        .fp_start               =       15,
@@ -3707,6 +3823,7 @@ static const struct dispc_features omap24xx_dispc_feats = {
        .calc_scaling           =       dispc_ovl_calc_scaling_24xx,
        .calc_core_clk          =       calc_core_clk_24xx,
        .num_fifos              =       3,
+       .supported_color_modes  =       omap2_dispc_supported_color_modes,
        .buffer_size_unit       =       1,
        .burst_size_unit        =       8,
        .no_framedone_tv        =       true,
@@ -3730,6 +3847,7 @@ static const struct dispc_features omap34xx_rev1_0_dispc_feats = {
        .calc_scaling           =       dispc_ovl_calc_scaling_34xx,
        .calc_core_clk          =       calc_core_clk_34xx,
        .num_fifos              =       3,
+       .supported_color_modes  =       omap3_dispc_supported_color_modes,
        .buffer_size_unit       =       1,
        .burst_size_unit        =       8,
        .no_framedone_tv        =       true,
@@ -3753,6 +3871,7 @@ static const struct dispc_features omap34xx_rev3_0_dispc_feats = {
        .calc_scaling           =       dispc_ovl_calc_scaling_34xx,
        .calc_core_clk          =       calc_core_clk_34xx,
        .num_fifos              =       3,
+       .supported_color_modes  =       omap3_dispc_supported_color_modes,
        .buffer_size_unit       =       1,
        .burst_size_unit        =       8,
        .no_framedone_tv        =       true,
@@ -3776,6 +3895,7 @@ static const struct dispc_features omap44xx_dispc_feats = {
        .calc_scaling           =       dispc_ovl_calc_scaling_44xx,
        .calc_core_clk          =       calc_core_clk_44xx,
        .num_fifos              =       5,
+       .supported_color_modes  =       omap4_dispc_supported_color_modes,
        .buffer_size_unit       =       16,
        .burst_size_unit        =       16,
        .gfx_fifo_workaround    =       true,
@@ -3804,6 +3924,7 @@ static const struct dispc_features omap54xx_dispc_feats = {
        .calc_scaling           =       dispc_ovl_calc_scaling_44xx,
        .calc_core_clk          =       calc_core_clk_44xx,
        .num_fifos              =       5,
+       .supported_color_modes  =       omap4_dispc_supported_color_modes,
        .buffer_size_unit       =       16,
        .burst_size_unit        =       16,
        .gfx_fifo_workaround    =       true,
index 7393f3fde16934b03122f8a1a6befe691782d963..cb099f43a8a2eff25cc1e04f664888e975fe47af 100644 (file)
@@ -47,7 +47,6 @@ struct omap_dss_features {
        const int num_mgrs;
        const int num_ovls;
        const enum omap_dss_output_id *supported_outputs;
-       const u32 **supported_color_modes;
        const enum omap_overlay_caps *overlay_caps;
        const struct dss_param_range *dss_params;
 };
@@ -170,106 +169,6 @@ static const enum omap_dss_output_id omap5_dss_supported_outputs[] = {
        OMAP_DSS_OUTPUT_DSI2,
 };
 
-#define COLOR_ARRAY(arr...) (const u32[]) { arr, 0 }
-
-static const u32 *omap2_dss_supported_color_modes[] = {
-
-       /* OMAP_DSS_GFX */
-       COLOR_ARRAY(
-       DRM_FORMAT_RGBX4444, DRM_FORMAT_RGB565,
-       DRM_FORMAT_XRGB8888, DRM_FORMAT_RGB888),
-
-       /* OMAP_DSS_VIDEO1 */
-       COLOR_ARRAY(
-       DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888,
-       DRM_FORMAT_RGB888, DRM_FORMAT_YUYV,
-       DRM_FORMAT_UYVY),
-
-       /* OMAP_DSS_VIDEO2 */
-       COLOR_ARRAY(
-       DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888,
-       DRM_FORMAT_RGB888, DRM_FORMAT_YUYV,
-       DRM_FORMAT_UYVY),
-};
-
-static const u32 *omap3_dss_supported_color_modes[] = {
-       /* OMAP_DSS_GFX */
-       COLOR_ARRAY(
-       DRM_FORMAT_RGBX4444, DRM_FORMAT_ARGB4444,
-       DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888,
-       DRM_FORMAT_RGB888, DRM_FORMAT_ARGB8888,
-       DRM_FORMAT_RGBA8888, DRM_FORMAT_RGBX8888),
-
-       /* OMAP_DSS_VIDEO1 */
-       COLOR_ARRAY(
-       DRM_FORMAT_XRGB8888, DRM_FORMAT_RGB888,
-       DRM_FORMAT_RGBX4444, DRM_FORMAT_RGB565,
-       DRM_FORMAT_YUYV, DRM_FORMAT_UYVY),
-
-       /* OMAP_DSS_VIDEO2 */
-       COLOR_ARRAY(
-       DRM_FORMAT_RGBX4444, DRM_FORMAT_ARGB4444,
-       DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888,
-       DRM_FORMAT_RGB888, DRM_FORMAT_YUYV,
-       DRM_FORMAT_UYVY, DRM_FORMAT_ARGB8888,
-       DRM_FORMAT_RGBA8888, DRM_FORMAT_RGBX8888),
-};
-
-static const u32 *omap4_dss_supported_color_modes[] = {
-       /* OMAP_DSS_GFX */
-       COLOR_ARRAY(
-       DRM_FORMAT_RGBX4444, DRM_FORMAT_ARGB4444,
-       DRM_FORMAT_RGB565, DRM_FORMAT_XRGB8888,
-       DRM_FORMAT_RGB888, DRM_FORMAT_ARGB8888,
-       DRM_FORMAT_RGBA8888, DRM_FORMAT_RGBX8888,
-       DRM_FORMAT_ARGB1555, DRM_FORMAT_XRGB4444,
-       DRM_FORMAT_RGBA4444, DRM_FORMAT_XRGB1555),
-
-       /* OMAP_DSS_VIDEO1 */
-       COLOR_ARRAY(
-       DRM_FORMAT_RGB565, DRM_FORMAT_RGBX4444,
-       DRM_FORMAT_YUYV, DRM_FORMAT_ARGB1555,
-       DRM_FORMAT_RGBA8888, DRM_FORMAT_NV12,
-       DRM_FORMAT_RGBA4444, DRM_FORMAT_XRGB8888,
-       DRM_FORMAT_RGB888, DRM_FORMAT_UYVY,
-       DRM_FORMAT_ARGB4444, DRM_FORMAT_XRGB1555,
-       DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB4444,
-       DRM_FORMAT_RGBX8888),
-
-       /* OMAP_DSS_VIDEO2 */
-       COLOR_ARRAY(
-       DRM_FORMAT_RGB565, DRM_FORMAT_RGBX4444,
-       DRM_FORMAT_YUYV, DRM_FORMAT_ARGB1555,
-       DRM_FORMAT_RGBA8888, DRM_FORMAT_NV12,
-       DRM_FORMAT_RGBA4444, DRM_FORMAT_XRGB8888,
-       DRM_FORMAT_RGB888, DRM_FORMAT_UYVY,
-       DRM_FORMAT_ARGB4444, DRM_FORMAT_XRGB1555,
-       DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB4444,
-       DRM_FORMAT_RGBX8888),
-
-       /* OMAP_DSS_VIDEO3 */
-       COLOR_ARRAY(
-       DRM_FORMAT_RGB565, DRM_FORMAT_RGBX4444,
-       DRM_FORMAT_YUYV, DRM_FORMAT_ARGB1555,
-       DRM_FORMAT_RGBA8888, DRM_FORMAT_NV12,
-       DRM_FORMAT_RGBA4444, DRM_FORMAT_XRGB8888,
-       DRM_FORMAT_RGB888, DRM_FORMAT_UYVY,
-       DRM_FORMAT_ARGB4444, DRM_FORMAT_XRGB1555,
-       DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB4444,
-       DRM_FORMAT_RGBX8888),
-
-       /* OMAP_DSS_WB */
-       COLOR_ARRAY(
-       DRM_FORMAT_RGB565, DRM_FORMAT_RGBX4444,
-       DRM_FORMAT_YUYV, DRM_FORMAT_ARGB1555,
-       DRM_FORMAT_RGBA8888, DRM_FORMAT_NV12,
-       DRM_FORMAT_RGBA4444, DRM_FORMAT_XRGB8888,
-       DRM_FORMAT_RGB888, DRM_FORMAT_UYVY,
-       DRM_FORMAT_ARGB4444, DRM_FORMAT_XRGB1555,
-       DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB4444,
-       DRM_FORMAT_RGBX8888),
-};
-
 static const enum omap_overlay_caps omap2_dss_overlay_caps[] = {
        /* OMAP_DSS_GFX */
        OMAP_DSS_OVL_CAP_POS | OMAP_DSS_OVL_CAP_REPLICATION,
@@ -545,7 +444,6 @@ static const struct omap_dss_features omap2_dss_features = {
        .num_mgrs = 2,
        .num_ovls = 3,
        .supported_outputs = omap2_dss_supported_outputs,
-       .supported_color_modes = omap2_dss_supported_color_modes,
        .overlay_caps = omap2_dss_overlay_caps,
        .dss_params = omap2_dss_param_range,
 };
@@ -561,7 +459,6 @@ static const struct omap_dss_features omap3430_dss_features = {
        .num_mgrs = 2,
        .num_ovls = 3,
        .supported_outputs = omap3430_dss_supported_outputs,
-       .supported_color_modes = omap3_dss_supported_color_modes,
        .overlay_caps = omap3430_dss_overlay_caps,
        .dss_params = omap3_dss_param_range,
 };
@@ -580,7 +477,6 @@ static const struct omap_dss_features am35xx_dss_features = {
        .num_mgrs = 2,
        .num_ovls = 3,
        .supported_outputs = omap3430_dss_supported_outputs,
-       .supported_color_modes = omap3_dss_supported_color_modes,
        .overlay_caps = omap3430_dss_overlay_caps,
        .dss_params = omap3_dss_param_range,
 };
@@ -595,7 +491,6 @@ static const struct omap_dss_features am43xx_dss_features = {
        .num_mgrs = 1,
        .num_ovls = 3,
        .supported_outputs = am43xx_dss_supported_outputs,
-       .supported_color_modes = omap3_dss_supported_color_modes,
        .overlay_caps = omap3430_dss_overlay_caps,
        .dss_params = am43xx_dss_param_range,
 };
@@ -610,7 +505,6 @@ static const struct omap_dss_features omap3630_dss_features = {
        .num_mgrs = 2,
        .num_ovls = 3,
        .supported_outputs = omap3630_dss_supported_outputs,
-       .supported_color_modes = omap3_dss_supported_color_modes,
        .overlay_caps = omap3630_dss_overlay_caps,
        .dss_params = omap3_dss_param_range,
 };
@@ -627,7 +521,6 @@ static const struct omap_dss_features omap4430_es1_0_dss_features  = {
        .num_mgrs = 3,
        .num_ovls = 4,
        .supported_outputs = omap4_dss_supported_outputs,
-       .supported_color_modes = omap4_dss_supported_color_modes,
        .overlay_caps = omap4_dss_overlay_caps,
        .dss_params = omap4_dss_param_range,
 };
@@ -643,7 +536,6 @@ static const struct omap_dss_features omap4430_es2_0_1_2_dss_features = {
        .num_mgrs = 3,
        .num_ovls = 4,
        .supported_outputs = omap4_dss_supported_outputs,
-       .supported_color_modes = omap4_dss_supported_color_modes,
        .overlay_caps = omap4_dss_overlay_caps,
        .dss_params = omap4_dss_param_range,
 };
@@ -659,7 +551,6 @@ static const struct omap_dss_features omap4_dss_features = {
        .num_mgrs = 3,
        .num_ovls = 4,
        .supported_outputs = omap4_dss_supported_outputs,
-       .supported_color_modes = omap4_dss_supported_color_modes,
        .overlay_caps = omap4_dss_overlay_caps,
        .dss_params = omap4_dss_param_range,
 };
@@ -675,7 +566,6 @@ static const struct omap_dss_features omap5_dss_features = {
        .num_mgrs = 4,
        .num_ovls = 4,
        .supported_outputs = omap5_dss_supported_outputs,
-       .supported_color_modes = omap4_dss_supported_color_modes,
        .overlay_caps = omap4_dss_overlay_caps,
        .dss_params = omap5_dss_param_range,
 };
@@ -706,31 +596,11 @@ enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel
        return omap_current_dss_features->supported_outputs[channel];
 }
 
-const u32 *dss_feat_get_supported_color_modes(enum omap_plane_id plane)
-{
-       return omap_current_dss_features->supported_color_modes[plane];
-}
-
 enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane_id plane)
 {
        return omap_current_dss_features->overlay_caps[plane];
 }
 
-bool dss_feat_color_mode_supported(enum omap_plane_id plane, u32 fourcc)
-{
-       const u32 *modes;
-       unsigned int i;
-
-       modes = omap_current_dss_features->supported_color_modes[plane];
-
-       for (i = 0; modes[i]; ++i) {
-               if (modes[i] == fourcc)
-                       return true;
-       }
-
-       return false;
-}
-
 /* DSS has_feature check */
 bool dss_has_feature(enum dss_feat_id id)
 {
index 3fb56d68962bce54bf0b6478a9e20caaa45edee8..06ddfc406b13591fad0cbc17bbfd2775c06e395c 100644 (file)
@@ -89,8 +89,6 @@ enum dss_range_param {
 unsigned long dss_feat_get_param_min(enum dss_range_param param);
 unsigned long dss_feat_get_param_max(enum dss_range_param param);
 enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane_id plane);
-bool dss_feat_color_mode_supported(enum omap_plane_id plane,
-               u32 fourcc);
 
 bool dss_has_feature(enum dss_feat_id id);
 void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end);
@@ -100,6 +98,5 @@ enum omap_dss_output_id dss_feat_get_supported_outputs(enum omap_channel channel
 
 int dss_feat_get_num_mgrs(void);
 int dss_feat_get_num_ovls(void);
-const u32 *dss_feat_get_supported_color_modes(enum omap_plane_id plane);
 
 #endif