diff options
author | Archit Taneja <archit@ti.com> | 2010-11-25 07:28:10 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@nokia.com> | 2011-01-10 04:09:54 -0500 |
commit | 8dad2ab6727f4dd9fdef06b890d736d7c6d1a725 (patch) | |
tree | 59ddbe8f875cc91824447b36afade883fe9516a3 /drivers/video | |
parent | ac1427e13b114f0c394fbc9bb7616f47d03bdba2 (diff) |
OMAP: DSS2: Clean up DISPC color mode validation checks
The supported set of color modes varies for different DISPC pipelines(plane)
and omap version. This makes the checks for validation of a color mode more
complicated as new omap versions are added.
A dss_feature function is created which tells if a color_mode is supported
for a plane on the current omap revision.
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/omap2/dss/dispc.c | 53 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss_features.c | 7 | ||||
-rw-r--r-- | drivers/video/omap2/dss/dss_features.h | 2 |
3 files changed, 14 insertions, 48 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c index 54ba8d3ad317..4e9ebdecc436 100644 --- a/drivers/video/omap2/dss/dispc.c +++ b/drivers/video/omap2/dss/dispc.c | |||
@@ -1550,29 +1550,12 @@ static int _dispc_setup_plane(enum omap_plane plane, | |||
1550 | height, pos_y, out_height); | 1550 | height, pos_y, out_height); |
1551 | } | 1551 | } |
1552 | 1552 | ||
1553 | if (!dss_feat_color_mode_supported(plane, color_mode)) | ||
1554 | return -EINVAL; | ||
1555 | |||
1553 | if (plane == OMAP_DSS_GFX) { | 1556 | if (plane == OMAP_DSS_GFX) { |
1554 | if (width != out_width || height != out_height) | 1557 | if (width != out_width || height != out_height) |
1555 | return -EINVAL; | 1558 | return -EINVAL; |
1556 | |||
1557 | switch (color_mode) { | ||
1558 | case OMAP_DSS_COLOR_ARGB16: | ||
1559 | case OMAP_DSS_COLOR_ARGB32: | ||
1560 | case OMAP_DSS_COLOR_RGBA32: | ||
1561 | if (!dss_has_feature(FEAT_GLOBAL_ALPHA)) | ||
1562 | return -EINVAL; | ||
1563 | case OMAP_DSS_COLOR_RGBX32: | ||
1564 | if (cpu_is_omap24xx()) | ||
1565 | return -EINVAL; | ||
1566 | /* fall through */ | ||
1567 | case OMAP_DSS_COLOR_RGB12U: | ||
1568 | case OMAP_DSS_COLOR_RGB16: | ||
1569 | case OMAP_DSS_COLOR_RGB24P: | ||
1570 | case OMAP_DSS_COLOR_RGB24U: | ||
1571 | break; | ||
1572 | |||
1573 | default: | ||
1574 | return -EINVAL; | ||
1575 | } | ||
1576 | } else { | 1559 | } else { |
1577 | /* video plane */ | 1560 | /* video plane */ |
1578 | 1561 | ||
@@ -1586,35 +1569,9 @@ static int _dispc_setup_plane(enum omap_plane plane, | |||
1586 | out_height > height * 8) | 1569 | out_height > height * 8) |
1587 | return -EINVAL; | 1570 | return -EINVAL; |
1588 | 1571 | ||
1589 | switch (color_mode) { | 1572 | if (color_mode == OMAP_DSS_COLOR_YUV2 || |
1590 | case OMAP_DSS_COLOR_RGBX32: | 1573 | color_mode == OMAP_DSS_COLOR_UYVY) |
1591 | case OMAP_DSS_COLOR_RGB12U: | ||
1592 | if (cpu_is_omap24xx()) | ||
1593 | return -EINVAL; | ||
1594 | /* fall through */ | ||
1595 | case OMAP_DSS_COLOR_RGB16: | ||
1596 | case OMAP_DSS_COLOR_RGB24P: | ||
1597 | case OMAP_DSS_COLOR_RGB24U: | ||
1598 | break; | ||
1599 | |||
1600 | case OMAP_DSS_COLOR_ARGB16: | ||
1601 | case OMAP_DSS_COLOR_ARGB32: | ||
1602 | case OMAP_DSS_COLOR_RGBA32: | ||
1603 | if (!dss_has_feature(FEAT_GLOBAL_ALPHA)) | ||
1604 | return -EINVAL; | ||
1605 | if (!dss_has_feature(FEAT_GLOBAL_ALPHA_VID1) && | ||
1606 | plane == OMAP_DSS_VIDEO1) | ||
1607 | return -EINVAL; | ||
1608 | break; | ||
1609 | |||
1610 | case OMAP_DSS_COLOR_YUV2: | ||
1611 | case OMAP_DSS_COLOR_UYVY: | ||
1612 | cconv = 1; | 1574 | cconv = 1; |
1613 | break; | ||
1614 | |||
1615 | default: | ||
1616 | return -EINVAL; | ||
1617 | } | ||
1618 | 1575 | ||
1619 | /* Must use 5-tap filter? */ | 1576 | /* Must use 5-tap filter? */ |
1620 | five_taps = height > out_height * 2; | 1577 | five_taps = height > out_height * 2; |
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c index 854deba4e0d8..620221f678f9 100644 --- a/drivers/video/omap2/dss/dss_features.c +++ b/drivers/video/omap2/dss/dss_features.c | |||
@@ -179,6 +179,13 @@ enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane) | |||
179 | return omap_current_dss_features->supported_color_modes[plane]; | 179 | return omap_current_dss_features->supported_color_modes[plane]; |
180 | } | 180 | } |
181 | 181 | ||
182 | bool dss_feat_color_mode_supported(enum omap_plane plane, | ||
183 | enum omap_color_mode color_mode) | ||
184 | { | ||
185 | return omap_current_dss_features->supported_color_modes[plane] & | ||
186 | color_mode; | ||
187 | } | ||
188 | |||
182 | /* DSS has_feature check */ | 189 | /* DSS has_feature check */ |
183 | bool dss_has_feature(enum dss_feat_id id) | 190 | bool dss_has_feature(enum dss_feat_id id) |
184 | { | 191 | { |
diff --git a/drivers/video/omap2/dss/dss_features.h b/drivers/video/omap2/dss/dss_features.h index aeb2eea454fc..806db43bab17 100644 --- a/drivers/video/omap2/dss/dss_features.h +++ b/drivers/video/omap2/dss/dss_features.h | |||
@@ -44,6 +44,8 @@ int dss_feat_get_num_mgrs(void); | |||
44 | int dss_feat_get_num_ovls(void); | 44 | int dss_feat_get_num_ovls(void); |
45 | enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel); | 45 | enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel); |
46 | enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane); | 46 | enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane); |
47 | bool dss_feat_color_mode_supported(enum omap_plane plane, | ||
48 | enum omap_color_mode color_mode); | ||
47 | 49 | ||
48 | bool dss_has_feature(enum dss_feat_id id); | 50 | bool dss_has_feature(enum dss_feat_id id); |
49 | void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end); | 51 | void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end); |