aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/omapdrm
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/omapdrm')
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dispc.c108
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dss_features.c5
-rw-r--r--drivers/gpu/drm/omapdrm/dss/dss_features.h2
-rw-r--r--drivers/gpu/drm/omapdrm/dss/omapdss.h4
-rw-r--r--drivers/gpu/drm/omapdrm/omap_fb.c2
5 files changed, 58 insertions, 63 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c
index 59af4dfc22da..7ccbcfc1d011 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -78,7 +78,7 @@ struct dispc_features {
78 int (*calc_scaling) (unsigned long pclk, unsigned long lclk, 78 int (*calc_scaling) (unsigned long pclk, unsigned long lclk,
79 const struct videomode *vm, 79 const struct videomode *vm,
80 u16 width, u16 height, u16 out_width, u16 out_height, 80 u16 width, u16 height, u16 out_width, u16 out_height,
81 u32 color_mode, bool *five_taps, 81 u32 fourcc, bool *five_taps,
82 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y, 82 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
83 u16 pos_x, unsigned long *core_clk, bool mem_to_mem); 83 u16 pos_x, unsigned long *core_clk, bool mem_to_mem);
84 unsigned long (*calc_core_clk) (unsigned long pclk, 84 unsigned long (*calc_core_clk) (unsigned long pclk,
@@ -906,12 +906,11 @@ static void dispc_ovl_set_row_inc(enum omap_plane_id plane, s32 inc)
906 dispc_write_reg(DISPC_OVL_ROW_INC(plane), inc); 906 dispc_write_reg(DISPC_OVL_ROW_INC(plane), inc);
907} 907}
908 908
909static void dispc_ovl_set_color_mode(enum omap_plane_id plane, 909static void dispc_ovl_set_color_mode(enum omap_plane_id plane, u32 fourcc)
910 u32 color_mode)
911{ 910{
912 u32 m = 0; 911 u32 m = 0;
913 if (plane != OMAP_DSS_GFX) { 912 if (plane != OMAP_DSS_GFX) {
914 switch (color_mode) { 913 switch (fourcc) {
915 case DRM_FORMAT_NV12: 914 case DRM_FORMAT_NV12:
916 m = 0x0; break; 915 m = 0x0; break;
917 case DRM_FORMAT_XRGB4444: 916 case DRM_FORMAT_XRGB4444:
@@ -946,7 +945,7 @@ static void dispc_ovl_set_color_mode(enum omap_plane_id plane,
946 BUG(); return; 945 BUG(); return;
947 } 946 }
948 } else { 947 } else {
949 switch (color_mode) { 948 switch (fourcc) {
950 case DRM_FORMAT_RGBX4444: 949 case DRM_FORMAT_RGBX4444:
951 m = 0x4; break; 950 m = 0x4; break;
952 case DRM_FORMAT_ARGB4444: 951 case DRM_FORMAT_ARGB4444:
@@ -979,9 +978,9 @@ static void dispc_ovl_set_color_mode(enum omap_plane_id plane,
979 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), m, 4, 1); 978 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), m, 4, 1);
980} 979}
981 980
982static bool format_is_yuv(u32 color_mode) 981static bool format_is_yuv(u32 fourcc)
983{ 982{
984 switch (color_mode) { 983 switch (fourcc) {
985 case DRM_FORMAT_YUYV: 984 case DRM_FORMAT_YUYV:
986 case DRM_FORMAT_UYVY: 985 case DRM_FORMAT_UYVY:
987 case DRM_FORMAT_NV12: 986 case DRM_FORMAT_NV12:
@@ -1563,7 +1562,7 @@ static void dispc_ovl_set_scale_param(enum omap_plane_id plane,
1563 1562
1564static void dispc_ovl_set_accu_uv(enum omap_plane_id plane, 1563static void dispc_ovl_set_accu_uv(enum omap_plane_id plane,
1565 u16 orig_width, u16 orig_height, u16 out_width, u16 out_height, 1564 u16 orig_width, u16 orig_height, u16 out_width, u16 out_height,
1566 bool ilace, u32 color_mode, u8 rotation) 1565 bool ilace, u32 fourcc, u8 rotation)
1567{ 1566{
1568 int h_accu2_0, h_accu2_1; 1567 int h_accu2_0, h_accu2_1;
1569 int v_accu2_0, v_accu2_1; 1568 int v_accu2_0, v_accu2_1;
@@ -1619,7 +1618,7 @@ static void dispc_ovl_set_accu_uv(enum omap_plane_id plane,
1619 return; 1618 return;
1620 } 1619 }
1621 1620
1622 switch (color_mode) { 1621 switch (fourcc) {
1623 case DRM_FORMAT_NV12: 1622 case DRM_FORMAT_NV12:
1624 if (ilace) 1623 if (ilace)
1625 accu_table = accu_nv12_ilace; 1624 accu_table = accu_nv12_ilace;
@@ -1653,7 +1652,7 @@ static void dispc_ovl_set_scaling_common(enum omap_plane_id plane,
1653 u16 orig_width, u16 orig_height, 1652 u16 orig_width, u16 orig_height,
1654 u16 out_width, u16 out_height, 1653 u16 out_width, u16 out_height,
1655 bool ilace, bool five_taps, 1654 bool ilace, bool five_taps,
1656 bool fieldmode, u32 color_mode, 1655 bool fieldmode, u32 fourcc,
1657 u8 rotation) 1656 u8 rotation)
1658{ 1657{
1659 int accu0 = 0; 1658 int accu0 = 0;
@@ -1707,7 +1706,7 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane_id plane,
1707 u16 orig_width, u16 orig_height, 1706 u16 orig_width, u16 orig_height,
1708 u16 out_width, u16 out_height, 1707 u16 out_width, u16 out_height,
1709 bool ilace, bool five_taps, 1708 bool ilace, bool five_taps,
1710 bool fieldmode, u32 color_mode, 1709 bool fieldmode, u32 fourcc,
1711 u8 rotation) 1710 u8 rotation)
1712{ 1711{
1713 int scale_x = out_width != orig_width; 1712 int scale_x = out_width != orig_width;
@@ -1717,7 +1716,7 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane_id plane,
1717 if (!dss_has_feature(FEAT_HANDLE_UV_SEPARATE)) 1716 if (!dss_has_feature(FEAT_HANDLE_UV_SEPARATE))
1718 return; 1717 return;
1719 1718
1720 if (!format_is_yuv(color_mode)) { 1719 if (!format_is_yuv(fourcc)) {
1721 /* reset chroma resampling for RGB formats */ 1720 /* reset chroma resampling for RGB formats */
1722 if (plane != OMAP_DSS_WB) 1721 if (plane != OMAP_DSS_WB)
1723 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), 0, 8, 8); 1722 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), 0, 8, 8);
@@ -1725,9 +1724,9 @@ static void dispc_ovl_set_scaling_uv(enum omap_plane_id plane,
1725 } 1724 }
1726 1725
1727 dispc_ovl_set_accu_uv(plane, orig_width, orig_height, out_width, 1726 dispc_ovl_set_accu_uv(plane, orig_width, orig_height, out_width,
1728 out_height, ilace, color_mode, rotation); 1727 out_height, ilace, fourcc, rotation);
1729 1728
1730 switch (color_mode) { 1729 switch (fourcc) {
1731 case DRM_FORMAT_NV12: 1730 case DRM_FORMAT_NV12:
1732 if (chroma_upscale) { 1731 if (chroma_upscale) {
1733 /* UV is subsampled by 2 horizontally and vertically */ 1732 /* UV is subsampled by 2 horizontally and vertically */
@@ -1786,7 +1785,7 @@ static void dispc_ovl_set_scaling(enum omap_plane_id plane,
1786 u16 orig_width, u16 orig_height, 1785 u16 orig_width, u16 orig_height,
1787 u16 out_width, u16 out_height, 1786 u16 out_width, u16 out_height,
1788 bool ilace, bool five_taps, 1787 bool ilace, bool five_taps,
1789 bool fieldmode, u32 color_mode, 1788 bool fieldmode, u32 fourcc,
1790 u8 rotation) 1789 u8 rotation)
1791{ 1790{
1792 BUG_ON(plane == OMAP_DSS_GFX); 1791 BUG_ON(plane == OMAP_DSS_GFX);
@@ -1795,26 +1794,25 @@ static void dispc_ovl_set_scaling(enum omap_plane_id plane,
1795 orig_width, orig_height, 1794 orig_width, orig_height,
1796 out_width, out_height, 1795 out_width, out_height,
1797 ilace, five_taps, 1796 ilace, five_taps,
1798 fieldmode, color_mode, 1797 fieldmode, fourcc,
1799 rotation); 1798 rotation);
1800 1799
1801 dispc_ovl_set_scaling_uv(plane, 1800 dispc_ovl_set_scaling_uv(plane,
1802 orig_width, orig_height, 1801 orig_width, orig_height,
1803 out_width, out_height, 1802 out_width, out_height,
1804 ilace, five_taps, 1803 ilace, five_taps,
1805 fieldmode, color_mode, 1804 fieldmode, fourcc,
1806 rotation); 1805 rotation);
1807} 1806}
1808 1807
1809static void dispc_ovl_set_rotation_attrs(enum omap_plane_id plane, u8 rotation, 1808static void dispc_ovl_set_rotation_attrs(enum omap_plane_id plane, u8 rotation,
1810 enum omap_dss_rotation_type rotation_type, 1809 enum omap_dss_rotation_type rotation_type,
1811 bool mirroring, u32 color_mode) 1810 bool mirroring, u32 fourcc)
1812{ 1811{
1813 bool row_repeat = false; 1812 bool row_repeat = false;
1814 int vidrot = 0; 1813 int vidrot = 0;
1815 1814
1816 if (color_mode == DRM_FORMAT_YUYV || 1815 if (fourcc == DRM_FORMAT_YUYV || fourcc == DRM_FORMAT_UYVY) {
1817 color_mode == DRM_FORMAT_UYVY) {
1818 1816
1819 if (mirroring) { 1817 if (mirroring) {
1820 switch (rotation) { 1818 switch (rotation) {
@@ -1859,8 +1857,7 @@ static void dispc_ovl_set_rotation_attrs(enum omap_plane_id plane, u8 rotation,
1859 * NV12 in 1D mode must use ROTATION=1. Otherwise DSS will fetch extra 1857 * NV12 in 1D mode must use ROTATION=1. Otherwise DSS will fetch extra
1860 * rows beyond the framebuffer, which may cause OCP error. 1858 * rows beyond the framebuffer, which may cause OCP error.
1861 */ 1859 */
1862 if (color_mode == DRM_FORMAT_NV12 && 1860 if (fourcc == DRM_FORMAT_NV12 && rotation_type != OMAP_DSS_ROT_TILER)
1863 rotation_type != OMAP_DSS_ROT_TILER)
1864 vidrot = 1; 1861 vidrot = 1;
1865 1862
1866 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), vidrot, 13, 12); 1863 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), vidrot, 13, 12);
@@ -1870,7 +1867,7 @@ static void dispc_ovl_set_rotation_attrs(enum omap_plane_id plane, u8 rotation,
1870 1867
1871 if (dss_feat_color_mode_supported(plane, DRM_FORMAT_NV12)) { 1868 if (dss_feat_color_mode_supported(plane, DRM_FORMAT_NV12)) {
1872 bool doublestride = 1869 bool doublestride =
1873 color_mode == DRM_FORMAT_NV12 && 1870 fourcc == DRM_FORMAT_NV12 &&
1874 rotation_type == OMAP_DSS_ROT_TILER && 1871 rotation_type == OMAP_DSS_ROT_TILER &&
1875 (rotation == OMAP_DSS_ROT_0 || rotation == OMAP_DSS_ROT_180); 1872 (rotation == OMAP_DSS_ROT_0 || rotation == OMAP_DSS_ROT_180);
1876 1873
@@ -1879,9 +1876,9 @@ static void dispc_ovl_set_rotation_attrs(enum omap_plane_id plane, u8 rotation,
1879 } 1876 }
1880} 1877}
1881 1878
1882static int color_mode_to_bpp(u32 color_mode) 1879static int color_mode_to_bpp(u32 fourcc)
1883{ 1880{
1884 switch (color_mode) { 1881 switch (fourcc) {
1885 case DRM_FORMAT_NV12: 1882 case DRM_FORMAT_NV12:
1886 return 8; 1883 return 8;
1887 case DRM_FORMAT_RGBX4444: 1884 case DRM_FORMAT_RGBX4444:
@@ -1921,13 +1918,13 @@ static s32 pixinc(int pixels, u8 ps)
1921} 1918}
1922 1919
1923static void calc_offset(u16 screen_width, u16 width, 1920static void calc_offset(u16 screen_width, u16 width,
1924 u32 color_mode, bool fieldmode, 1921 u32 fourcc, bool fieldmode,
1925 unsigned int field_offset, unsigned *offset0, unsigned *offset1, 1922 unsigned int field_offset, unsigned *offset0, unsigned *offset1,
1926 s32 *row_inc, s32 *pix_inc, int x_predecim, int y_predecim) 1923 s32 *row_inc, s32 *pix_inc, int x_predecim, int y_predecim)
1927{ 1924{
1928 u8 ps; 1925 u8 ps;
1929 1926
1930 ps = color_mode_to_bpp(color_mode) / 8; 1927 ps = color_mode_to_bpp(fourcc) / 8;
1931 1928
1932 DSSDBG("scrw %d, width %d\n", screen_width, width); 1929 DSSDBG("scrw %d, width %d\n", screen_width, width);
1933 1930
@@ -1940,8 +1937,7 @@ static void calc_offset(u16 screen_width, u16 width,
1940 1937
1941 *row_inc = pixinc(1 + (y_predecim * screen_width - width * x_predecim) + 1938 *row_inc = pixinc(1 + (y_predecim * screen_width - width * x_predecim) +
1942 (fieldmode ? screen_width : 0), ps); 1939 (fieldmode ? screen_width : 0), ps);
1943 if (color_mode == DRM_FORMAT_YUYV || 1940 if (fourcc == DRM_FORMAT_YUYV || fourcc == DRM_FORMAT_UYVY)
1944 color_mode == DRM_FORMAT_UYVY)
1945 *pix_inc = pixinc(x_predecim, 2 * ps); 1941 *pix_inc = pixinc(x_predecim, 2 * ps);
1946 else 1942 else
1947 *pix_inc = pixinc(x_predecim, ps); 1943 *pix_inc = pixinc(x_predecim, ps);
@@ -2008,7 +2004,7 @@ static int check_horiz_timing_omap3(unsigned long pclk, unsigned long lclk,
2008static unsigned long calc_core_clk_five_taps(unsigned long pclk, 2004static unsigned long calc_core_clk_five_taps(unsigned long pclk,
2009 const struct videomode *vm, u16 width, 2005 const struct videomode *vm, u16 width,
2010 u16 height, u16 out_width, u16 out_height, 2006 u16 height, u16 out_width, u16 out_height,
2011 u32 color_mode) 2007 u32 fourcc)
2012{ 2008{
2013 u32 core_clk = 0; 2009 u32 core_clk = 0;
2014 u64 tmp; 2010 u64 tmp;
@@ -2038,7 +2034,7 @@ static unsigned long calc_core_clk_five_taps(unsigned long pclk,
2038 do_div(tmp, out_width); 2034 do_div(tmp, out_width);
2039 core_clk = max_t(u32, core_clk, tmp); 2035 core_clk = max_t(u32, core_clk, tmp);
2040 2036
2041 if (color_mode == DRM_FORMAT_XRGB8888) 2037 if (fourcc == DRM_FORMAT_XRGB8888)
2042 core_clk <<= 1; 2038 core_clk <<= 1;
2043 } 2039 }
2044 2040
@@ -2101,7 +2097,7 @@ static unsigned long calc_core_clk_44xx(unsigned long pclk, u16 width,
2101static int dispc_ovl_calc_scaling_24xx(unsigned long pclk, unsigned long lclk, 2097static int dispc_ovl_calc_scaling_24xx(unsigned long pclk, unsigned long lclk,
2102 const struct videomode *vm, 2098 const struct videomode *vm,
2103 u16 width, u16 height, u16 out_width, u16 out_height, 2099 u16 width, u16 height, u16 out_width, u16 out_height,
2104 u32 color_mode, bool *five_taps, 2100 u32 fourcc, bool *five_taps,
2105 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y, 2101 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
2106 u16 pos_x, unsigned long *core_clk, bool mem_to_mem) 2102 u16 pos_x, unsigned long *core_clk, bool mem_to_mem)
2107{ 2103{
@@ -2147,7 +2143,7 @@ static int dispc_ovl_calc_scaling_24xx(unsigned long pclk, unsigned long lclk,
2147static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk, 2143static int dispc_ovl_calc_scaling_34xx(unsigned long pclk, unsigned long lclk,
2148 const struct videomode *vm, 2144 const struct videomode *vm,
2149 u16 width, u16 height, u16 out_width, u16 out_height, 2145 u16 width, u16 height, u16 out_width, u16 out_height,
2150 u32 color_mode, bool *five_taps, 2146 u32 fourcc, bool *five_taps,
2151 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y, 2147 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
2152 u16 pos_x, unsigned long *core_clk, bool mem_to_mem) 2148 u16 pos_x, unsigned long *core_clk, bool mem_to_mem)
2153{ 2149{
@@ -2169,7 +2165,7 @@ again:
2169 if (*five_taps) 2165 if (*five_taps)
2170 *core_clk = calc_core_clk_five_taps(pclk, vm, 2166 *core_clk = calc_core_clk_five_taps(pclk, vm,
2171 in_width, in_height, out_width, 2167 in_width, in_height, out_width,
2172 out_height, color_mode); 2168 out_height, fourcc);
2173 else 2169 else
2174 *core_clk = dispc.feat->calc_core_clk(pclk, in_width, 2170 *core_clk = dispc.feat->calc_core_clk(pclk, in_width,
2175 in_height, out_width, out_height, 2171 in_height, out_width, out_height,
@@ -2232,7 +2228,7 @@ again:
2232static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk, 2228static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk,
2233 const struct videomode *vm, 2229 const struct videomode *vm,
2234 u16 width, u16 height, u16 out_width, u16 out_height, 2230 u16 width, u16 height, u16 out_width, u16 out_height,
2235 u32 color_mode, bool *five_taps, 2231 u32 fourcc, bool *five_taps,
2236 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y, 2232 int *x_predecim, int *y_predecim, int *decim_x, int *decim_y,
2237 u16 pos_x, unsigned long *core_clk, bool mem_to_mem) 2233 u16 pos_x, unsigned long *core_clk, bool mem_to_mem)
2238{ 2234{
@@ -2266,7 +2262,7 @@ static int dispc_ovl_calc_scaling_44xx(unsigned long pclk, unsigned long lclk,
2266 return -EINVAL; 2262 return -EINVAL;
2267 } 2263 }
2268 2264
2269 if (*decim_x > 4 && color_mode != DRM_FORMAT_NV12) { 2265 if (*decim_x > 4 && fourcc != DRM_FORMAT_NV12) {
2270 /* 2266 /*
2271 * Let's disable all scaling that requires horizontal 2267 * Let's disable all scaling that requires horizontal
2272 * decimation with higher factor than 4, until we have 2268 * decimation with higher factor than 4, until we have
@@ -2297,7 +2293,7 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk,
2297 enum omap_overlay_caps caps, 2293 enum omap_overlay_caps caps,
2298 const struct videomode *vm, 2294 const struct videomode *vm,
2299 u16 width, u16 height, u16 out_width, u16 out_height, 2295 u16 width, u16 height, u16 out_width, u16 out_height,
2300 u32 color_mode, bool *five_taps, 2296 u32 fourcc, bool *five_taps,
2301 int *x_predecim, int *y_predecim, u16 pos_x, 2297 int *x_predecim, int *y_predecim, u16 pos_x,
2302 enum omap_dss_rotation_type rotation_type, bool mem_to_mem) 2298 enum omap_dss_rotation_type rotation_type, bool mem_to_mem)
2303{ 2299{
@@ -2336,7 +2332,7 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk,
2336 return -EINVAL; 2332 return -EINVAL;
2337 2333
2338 ret = dispc.feat->calc_scaling(pclk, lclk, vm, width, height, 2334 ret = dispc.feat->calc_scaling(pclk, lclk, vm, width, height,
2339 out_width, out_height, color_mode, five_taps, 2335 out_width, out_height, fourcc, five_taps,
2340 x_predecim, y_predecim, &decim_x, &decim_y, pos_x, &core_clk, 2336 x_predecim, y_predecim, &decim_x, &decim_y, pos_x, &core_clk,
2341 mem_to_mem); 2337 mem_to_mem);
2342 if (ret) 2338 if (ret)
@@ -2372,7 +2368,7 @@ static int dispc_ovl_calc_scaling(unsigned long pclk, unsigned long lclk,
2372static int dispc_ovl_setup_common(enum omap_plane_id plane, 2368static int dispc_ovl_setup_common(enum omap_plane_id plane,
2373 enum omap_overlay_caps caps, u32 paddr, u32 p_uv_addr, 2369 enum omap_overlay_caps caps, u32 paddr, u32 p_uv_addr,
2374 u16 screen_width, int pos_x, int pos_y, u16 width, u16 height, 2370 u16 screen_width, int pos_x, int pos_y, u16 width, u16 height,
2375 u16 out_width, u16 out_height, u32 color_mode, 2371 u16 out_width, u16 out_height, u32 fourcc,
2376 u8 rotation, bool mirror, u8 zorder, u8 pre_mult_alpha, 2372 u8 rotation, bool mirror, u8 zorder, u8 pre_mult_alpha,
2377 u8 global_alpha, enum omap_dss_rotation_type rotation_type, 2373 u8 global_alpha, enum omap_dss_rotation_type rotation_type,
2378 bool replication, const struct videomode *vm, 2374 bool replication, const struct videomode *vm,
@@ -2396,7 +2392,7 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane,
2396 if (paddr == 0 && rotation_type != OMAP_DSS_ROT_TILER) 2392 if (paddr == 0 && rotation_type != OMAP_DSS_ROT_TILER)
2397 return -EINVAL; 2393 return -EINVAL;
2398 2394
2399 if (format_is_yuv(color_mode) && (in_width & 1)) { 2395 if (format_is_yuv(fourcc) && (in_width & 1)) {
2400 DSSERR("input width %d is not even for YUV format\n", in_width); 2396 DSSERR("input width %d is not even for YUV format\n", in_width);
2401 return -EINVAL; 2397 return -EINVAL;
2402 } 2398 }
@@ -2418,11 +2414,11 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane,
2418 out_height); 2414 out_height);
2419 } 2415 }
2420 2416
2421 if (!dss_feat_color_mode_supported(plane, color_mode)) 2417 if (!dss_feat_color_mode_supported(plane, fourcc))
2422 return -EINVAL; 2418 return -EINVAL;
2423 2419
2424 r = dispc_ovl_calc_scaling(pclk, lclk, caps, vm, in_width, 2420 r = dispc_ovl_calc_scaling(pclk, lclk, caps, vm, in_width,
2425 in_height, out_width, out_height, color_mode, 2421 in_height, out_width, out_height, fourcc,
2426 &five_taps, &x_predecim, &y_predecim, pos_x, 2422 &five_taps, &x_predecim, &y_predecim, pos_x,
2427 rotation_type, mem_to_mem); 2423 rotation_type, mem_to_mem);
2428 if (r) 2424 if (r)
@@ -2435,7 +2431,7 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane,
2435 DSSDBG("predecimation %d x %x, new input size %d x %d\n", 2431 DSSDBG("predecimation %d x %x, new input size %d x %d\n",
2436 x_predecim, y_predecim, in_width, in_height); 2432 x_predecim, y_predecim, in_width, in_height);
2437 2433
2438 if (format_is_yuv(color_mode) && (in_width & 1)) { 2434 if (format_is_yuv(fourcc) && (in_width & 1)) {
2439 DSSDBG("predecimated input width is not even for YUV format\n"); 2435 DSSDBG("predecimated input width is not even for YUV format\n");
2440 DSSDBG("adjusting input width %d -> %d\n", 2436 DSSDBG("adjusting input width %d -> %d\n",
2441 in_width, in_width & ~1); 2437 in_width, in_width & ~1);
@@ -2443,7 +2439,7 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane,
2443 in_width &= ~1; 2439 in_width &= ~1;
2444 } 2440 }
2445 2441
2446 if (format_is_yuv(color_mode)) 2442 if (format_is_yuv(fourcc))
2447 cconv = 1; 2443 cconv = 1;
2448 2444
2449 if (ilace && !fieldmode) { 2445 if (ilace && !fieldmode) {
@@ -2478,14 +2474,14 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane,
2478 } 2474 }
2479 2475
2480 calc_offset(screen_width, frame_width, 2476 calc_offset(screen_width, frame_width,
2481 color_mode, fieldmode, field_offset, 2477 fourcc, fieldmode, field_offset,
2482 &offset0, &offset1, &row_inc, &pix_inc, 2478 &offset0, &offset1, &row_inc, &pix_inc,
2483 x_predecim, y_predecim); 2479 x_predecim, y_predecim);
2484 2480
2485 DSSDBG("offset0 %u, offset1 %u, row_inc %d, pix_inc %d\n", 2481 DSSDBG("offset0 %u, offset1 %u, row_inc %d, pix_inc %d\n",
2486 offset0, offset1, row_inc, pix_inc); 2482 offset0, offset1, row_inc, pix_inc);
2487 2483
2488 dispc_ovl_set_color_mode(plane, color_mode); 2484 dispc_ovl_set_color_mode(plane, fourcc);
2489 2485
2490 dispc_ovl_configure_burst_type(plane, rotation_type); 2486 dispc_ovl_configure_burst_type(plane, rotation_type);
2491 2487
@@ -2495,7 +2491,7 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane,
2495 dispc_ovl_set_ba0(plane, paddr + offset0); 2491 dispc_ovl_set_ba0(plane, paddr + offset0);
2496 dispc_ovl_set_ba1(plane, paddr + offset1); 2492 dispc_ovl_set_ba1(plane, paddr + offset1);
2497 2493
2498 if (color_mode == DRM_FORMAT_NV12) { 2494 if (fourcc == DRM_FORMAT_NV12) {
2499 dispc_ovl_set_ba0_uv(plane, p_uv_addr + offset0); 2495 dispc_ovl_set_ba0_uv(plane, p_uv_addr + offset0);
2500 dispc_ovl_set_ba1_uv(plane, p_uv_addr + offset1); 2496 dispc_ovl_set_ba1_uv(plane, p_uv_addr + offset1);
2501 } 2497 }
@@ -2516,13 +2512,13 @@ static int dispc_ovl_setup_common(enum omap_plane_id plane,
2516 if (caps & OMAP_DSS_OVL_CAP_SCALE) { 2512 if (caps & OMAP_DSS_OVL_CAP_SCALE) {
2517 dispc_ovl_set_scaling(plane, in_width, in_height, out_width, 2513 dispc_ovl_set_scaling(plane, in_width, in_height, out_width,
2518 out_height, ilace, five_taps, fieldmode, 2514 out_height, ilace, five_taps, fieldmode,
2519 color_mode, rotation); 2515 fourcc, rotation);
2520 dispc_ovl_set_output_size(plane, out_width, out_height); 2516 dispc_ovl_set_output_size(plane, out_width, out_height);
2521 dispc_ovl_set_vid_color_conv(plane, cconv); 2517 dispc_ovl_set_vid_color_conv(plane, cconv);
2522 } 2518 }
2523 2519
2524 dispc_ovl_set_rotation_attrs(plane, rotation, rotation_type, mirror, 2520 dispc_ovl_set_rotation_attrs(plane, rotation, rotation_type, mirror,
2525 color_mode); 2521 fourcc);
2526 2522
2527 dispc_ovl_set_zorder(plane, caps, zorder); 2523 dispc_ovl_set_zorder(plane, caps, zorder);
2528 dispc_ovl_set_pre_mult_alpha(plane, caps, pre_mult_alpha); 2524 dispc_ovl_set_pre_mult_alpha(plane, caps, pre_mult_alpha);
@@ -2546,13 +2542,13 @@ static int dispc_ovl_setup(enum omap_plane_id plane,
2546 " %dx%d, cmode %x, rot %d, mir %d, chan %d repl %d\n", 2542 " %dx%d, cmode %x, rot %d, mir %d, chan %d repl %d\n",
2547 plane, &oi->paddr, &oi->p_uv_addr, oi->screen_width, oi->pos_x, 2543 plane, &oi->paddr, &oi->p_uv_addr, oi->screen_width, oi->pos_x,
2548 oi->pos_y, oi->width, oi->height, oi->out_width, oi->out_height, 2544 oi->pos_y, oi->width, oi->height, oi->out_width, oi->out_height,
2549 oi->color_mode, oi->rotation, oi->mirror, channel, replication); 2545 oi->fourcc, oi->rotation, oi->mirror, channel, replication);
2550 2546
2551 dispc_ovl_set_channel_out(plane, channel); 2547 dispc_ovl_set_channel_out(plane, channel);
2552 2548
2553 r = dispc_ovl_setup_common(plane, caps, oi->paddr, oi->p_uv_addr, 2549 r = dispc_ovl_setup_common(plane, caps, oi->paddr, oi->p_uv_addr,
2554 oi->screen_width, oi->pos_x, oi->pos_y, oi->width, oi->height, 2550 oi->screen_width, oi->pos_x, oi->pos_y, oi->width, oi->height,
2555 oi->out_width, oi->out_height, oi->color_mode, oi->rotation, 2551 oi->out_width, oi->out_height, oi->fourcc, oi->rotation,
2556 oi->mirror, oi->zorder, oi->pre_mult_alpha, oi->global_alpha, 2552 oi->mirror, oi->zorder, oi->pre_mult_alpha, oi->global_alpha,
2557 oi->rotation_type, replication, vm, mem_to_mem); 2553 oi->rotation_type, replication, vm, mem_to_mem);
2558 2554
@@ -2576,16 +2572,16 @@ int dispc_wb_setup(const struct omap_dss_writeback_info *wi,
2576 2572
2577 DSSDBG("dispc_wb_setup, pa %x, pa_uv %x, %d,%d -> %dx%d, cmode %x, " 2573 DSSDBG("dispc_wb_setup, pa %x, pa_uv %x, %d,%d -> %dx%d, cmode %x, "
2578 "rot %d, mir %d\n", wi->paddr, wi->p_uv_addr, in_width, 2574 "rot %d, mir %d\n", wi->paddr, wi->p_uv_addr, in_width,
2579 in_height, wi->width, wi->height, wi->color_mode, wi->rotation, 2575 in_height, wi->width, wi->height, wi->fourcc, wi->rotation,
2580 wi->mirror); 2576 wi->mirror);
2581 2577
2582 r = dispc_ovl_setup_common(plane, caps, wi->paddr, wi->p_uv_addr, 2578 r = dispc_ovl_setup_common(plane, caps, wi->paddr, wi->p_uv_addr,
2583 wi->buf_width, pos_x, pos_y, in_width, in_height, wi->width, 2579 wi->buf_width, pos_x, pos_y, in_width, in_height, wi->width,
2584 wi->height, wi->color_mode, wi->rotation, wi->mirror, zorder, 2580 wi->height, wi->fourcc, wi->rotation, wi->mirror, zorder,
2585 wi->pre_mult_alpha, global_alpha, wi->rotation_type, 2581 wi->pre_mult_alpha, global_alpha, wi->rotation_type,
2586 replication, vm, mem_to_mem); 2582 replication, vm, mem_to_mem);
2587 2583
2588 switch (wi->color_mode) { 2584 switch (wi->fourcc) {
2589 case DRM_FORMAT_RGB565: 2585 case DRM_FORMAT_RGB565:
2590 case DRM_FORMAT_RGB888: 2586 case DRM_FORMAT_RGB888:
2591 case DRM_FORMAT_ARGB4444: 2587 case DRM_FORMAT_ARGB4444:
@@ -3919,7 +3915,7 @@ static const struct dispc_errata_i734_data {
3919 .ovli = { 3915 .ovli = {
3920 .screen_width = 1, 3916 .screen_width = 1,
3921 .width = 1, .height = 1, 3917 .width = 1, .height = 1,
3922 .color_mode = DRM_FORMAT_XRGB8888, 3918 .fourcc = DRM_FORMAT_XRGB8888,
3923 .rotation = OMAP_DSS_ROT_0, 3919 .rotation = OMAP_DSS_ROT_0,
3924 .rotation_type = OMAP_DSS_ROT_NONE, 3920 .rotation_type = OMAP_DSS_ROT_NONE,
3925 .mirror = 0, 3921 .mirror = 0,
@@ -3960,7 +3956,7 @@ static int dispc_errata_i734_wa_init(void)
3960 return 0; 3956 return 0;
3961 3957
3962 i734_buf.size = i734.ovli.width * i734.ovli.height * 3958 i734_buf.size = i734.ovli.width * i734.ovli.height *
3963 color_mode_to_bpp(i734.ovli.color_mode) / 8; 3959 color_mode_to_bpp(i734.ovli.fourcc) / 8;
3964 3960
3965 i734_buf.vaddr = dma_alloc_writecombine(&dispc.pdev->dev, i734_buf.size, 3961 i734_buf.vaddr = dma_alloc_writecombine(&dispc.pdev->dev, i734_buf.size,
3966 &i734_buf.paddr, GFP_KERNEL); 3962 &i734_buf.paddr, GFP_KERNEL);
diff --git a/drivers/gpu/drm/omapdrm/dss/dss_features.c b/drivers/gpu/drm/omapdrm/dss/dss_features.c
index 32e21ed45f47..0e599710dd95 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss_features.c
+++ b/drivers/gpu/drm/omapdrm/dss/dss_features.c
@@ -808,8 +808,7 @@ enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane_id plane)
808 return omap_current_dss_features->overlay_caps[plane]; 808 return omap_current_dss_features->overlay_caps[plane];
809} 809}
810 810
811bool dss_feat_color_mode_supported(enum omap_plane_id plane, 811bool dss_feat_color_mode_supported(enum omap_plane_id plane, u32 fourcc)
812 u32 color_mode)
813{ 812{
814 const u32 *modes; 813 const u32 *modes;
815 unsigned int i; 814 unsigned int i;
@@ -817,7 +816,7 @@ bool dss_feat_color_mode_supported(enum omap_plane_id plane,
817 modes = omap_current_dss_features->supported_color_modes[plane]; 816 modes = omap_current_dss_features->supported_color_modes[plane];
818 817
819 for (i = 0; modes[i]; ++i) { 818 for (i = 0; modes[i]; ++i) {
820 if (modes[i] == color_mode) 819 if (modes[i] == fourcc)
821 return true; 820 return true;
822 } 821 }
823 822
diff --git a/drivers/gpu/drm/omapdrm/dss/dss_features.h b/drivers/gpu/drm/omapdrm/dss/dss_features.h
index 8f48dc097717..c36436d27ff5 100644
--- a/drivers/gpu/drm/omapdrm/dss/dss_features.h
+++ b/drivers/gpu/drm/omapdrm/dss/dss_features.h
@@ -90,7 +90,7 @@ unsigned long dss_feat_get_param_min(enum dss_range_param param);
90unsigned long dss_feat_get_param_max(enum dss_range_param param); 90unsigned long dss_feat_get_param_max(enum dss_range_param param);
91enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane_id plane); 91enum omap_overlay_caps dss_feat_get_overlay_caps(enum omap_plane_id plane);
92bool dss_feat_color_mode_supported(enum omap_plane_id plane, 92bool dss_feat_color_mode_supported(enum omap_plane_id plane,
93 u32 color_mode); 93 u32 fourcc);
94 94
95u32 dss_feat_get_buffer_size_unit(void); /* in bytes */ 95u32 dss_feat_get_buffer_size_unit(void); /* in bytes */
96u32 dss_feat_get_burst_size_unit(void); /* in bytes */ 96u32 dss_feat_get_burst_size_unit(void); /* in bytes */
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index b339edcc91cf..bbda9357241b 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -268,7 +268,7 @@ struct omap_overlay_info {
268 u16 screen_width; 268 u16 screen_width;
269 u16 width; 269 u16 width;
270 u16 height; 270 u16 height;
271 u32 color_mode; 271 u32 fourcc;
272 u8 rotation; 272 u8 rotation;
273 enum omap_dss_rotation_type rotation_type; 273 enum omap_dss_rotation_type rotation_type;
274 bool mirror; 274 bool mirror;
@@ -316,7 +316,7 @@ struct omap_dss_writeback_info {
316 u16 buf_width; 316 u16 buf_width;
317 u16 width; 317 u16 width;
318 u16 height; 318 u16 height;
319 u32 color_mode; 319 u32 fourcc;
320 u8 rotation; 320 u8 rotation;
321 enum omap_dss_rotation_type rotation_type; 321 enum omap_dss_rotation_type rotation_type;
322 bool mirror; 322 bool mirror;
diff --git a/drivers/gpu/drm/omapdrm/omap_fb.c b/drivers/gpu/drm/omapdrm/omap_fb.c
index 16b510dcee2f..c5b2088ee168 100644
--- a/drivers/gpu/drm/omapdrm/omap_fb.c
+++ b/drivers/gpu/drm/omapdrm/omap_fb.c
@@ -132,7 +132,7 @@ void omap_framebuffer_update_scanout(struct drm_framebuffer *fb,
132 struct plane *plane = &omap_fb->planes[0]; 132 struct plane *plane = &omap_fb->planes[0];
133 uint32_t x, y, orient = 0; 133 uint32_t x, y, orient = 0;
134 134
135 info->color_mode = fb->format->format; 135 info->fourcc = fb->format->format;
136 136
137 info->pos_x = win->crtc_x; 137 info->pos_x = win->crtc_x;
138 info->pos_y = win->crtc_y; 138 info->pos_y = win->crtc_y;