aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/omap2
diff options
context:
space:
mode:
authorArchit Taneja <archit@ti.com>2012-09-11 02:34:47 -0400
committerTomi Valkeinen <tomi.valkeinen@ti.com>2012-09-26 07:58:51 -0400
commit6e5264b0380593efda8157406ec40f00daac9f2d (patch)
treee09e075957c7e9b8299e57883d50eb3cff6ee3b2 /drivers/video/omap2
parent0b23e5b86850857192c589f837b92e1ac568b485 (diff)
OMAPDSS: DISPC: Configure color conversion coefficients for writeback
Writeback pipeline receives RGB data from one of the overlays or one of the overlay managers. If the target color mode is YUV422 or NV12, we need to convert the RGB pixels to YUV. The scaler in WB then converts it to the target color mode. Hence, the color conversion coefficients that need to be programmed are the ones which convert a RGB24 pixel to YUV444. Program these coefficients for writeback pipeline. Rearrange the code a bit to configure different coefficients for overlays and writeback. Signed-off-by: Archit Taneja <archit@ti.com>
Diffstat (limited to 'drivers/video/omap2')
-rw-r--r--drivers/video/omap2/dss/dispc.c61
1 files changed, 33 insertions, 28 deletions
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 3ca9a30473d3..a173a9481a23 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -236,6 +236,11 @@ static const struct {
236 }, 236 },
237}; 237};
238 238
239struct color_conv_coef {
240 int ry, rcr, rcb, gy, gcr, gcb, by, bcr, bcb;
241 int full_range;
242};
243
239static void _omap_dispc_set_irqs(void); 244static void _omap_dispc_set_irqs(void);
240static unsigned long dispc_plane_pclk_rate(enum omap_plane plane); 245static unsigned long dispc_plane_pclk_rate(enum omap_plane plane);
241static unsigned long dispc_plane_lclk_rate(enum omap_plane plane); 246static unsigned long dispc_plane_lclk_rate(enum omap_plane plane);
@@ -674,41 +679,41 @@ static void dispc_ovl_set_scale_coef(enum omap_plane plane, int fir_hinc,
674 } 679 }
675} 680}
676 681
677static void _dispc_setup_color_conv_coef(void)
678{
679 int i;
680 const struct color_conv_coef {
681 int ry, rcr, rcb, gy, gcr, gcb, by, bcr, bcb;
682 int full_range;
683 } ctbl_bt601_5 = {
684 298, 409, 0, 298, -208, -100, 298, 0, 517, 0,
685 };
686
687 const struct color_conv_coef *ct;
688 682
683static void dispc_ovl_write_color_conv_coef(enum omap_plane plane,
684 const struct color_conv_coef *ct)
685{
689#define CVAL(x, y) (FLD_VAL(x, 26, 16) | FLD_VAL(y, 10, 0)) 686#define CVAL(x, y) (FLD_VAL(x, 26, 16) | FLD_VAL(y, 10, 0))
690 687
691 ct = &ctbl_bt601_5; 688 dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 0), CVAL(ct->rcr, ct->ry));
689 dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 1), CVAL(ct->gy, ct->rcb));
690 dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 2), CVAL(ct->gcb, ct->gcr));
691 dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 3), CVAL(ct->bcr, ct->by));
692 dispc_write_reg(DISPC_OVL_CONV_COEF(plane, 4), CVAL(0, ct->bcb));
692 693
693 for (i = 1; i < dss_feat_get_num_ovls(); i++) { 694 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), ct->full_range, 11, 11);
694 dispc_write_reg(DISPC_OVL_CONV_COEF(i, 0),
695 CVAL(ct->rcr, ct->ry));
696 dispc_write_reg(DISPC_OVL_CONV_COEF(i, 1),
697 CVAL(ct->gy, ct->rcb));
698 dispc_write_reg(DISPC_OVL_CONV_COEF(i, 2),
699 CVAL(ct->gcb, ct->gcr));
700 dispc_write_reg(DISPC_OVL_CONV_COEF(i, 3),
701 CVAL(ct->bcr, ct->by));
702 dispc_write_reg(DISPC_OVL_CONV_COEF(i, 4),
703 CVAL(0, ct->bcb));
704
705 REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(i), ct->full_range,
706 11, 11);
707 }
708 695
709#undef CVAL 696#undef CVAL
710} 697}
711 698
699static void dispc_setup_color_conv_coef(void)
700{
701 int i;
702 int num_ovl = dss_feat_get_num_ovls();
703 int num_wb = dss_feat_get_num_wbs();
704 const struct color_conv_coef ctbl_bt601_5_ovl = {
705 298, 409, 0, 298, -208, -100, 298, 0, 517, 0,
706 };
707 const struct color_conv_coef ctbl_bt601_5_wb = {
708 66, 112, -38, 129, -94, -74, 25, -18, 112, 0,
709 };
710
711 for (i = 1; i < num_ovl; i++)
712 dispc_ovl_write_color_conv_coef(i, &ctbl_bt601_5_ovl);
713
714 for (; i < num_wb; i++)
715 dispc_ovl_write_color_conv_coef(i, &ctbl_bt601_5_wb);
716}
712 717
713static void dispc_ovl_set_ba0(enum omap_plane plane, u32 paddr) 718static void dispc_ovl_set_ba0(enum omap_plane plane, u32 paddr)
714{ 719{
@@ -3975,7 +3980,7 @@ static void _omap_dispc_initial_config(void)
3975 if (dss_has_feature(FEAT_FUNCGATED)) 3980 if (dss_has_feature(FEAT_FUNCGATED))
3976 REG_FLD_MOD(DISPC_CONFIG, 1, 9, 9); 3981 REG_FLD_MOD(DISPC_CONFIG, 1, 9, 9);
3977 3982
3978 _dispc_setup_color_conv_coef(); 3983 dispc_setup_color_conv_coef();
3979 3984
3980 dispc_set_loadmode(OMAP_DSS_LOAD_FRAME_ONLY); 3985 dispc_set_loadmode(OMAP_DSS_LOAD_FRAME_ONLY);
3981 3986