1 From: Mans Rullgard <mans@mansr.com>
2 Date: Fri, 29 Aug 2008 01:45:26 +0000 (+0100)
3 Subject: OMAP: Enable overlay optimisation
4 X-Git-Url: http://git.mansr.com/?p=linux-omap;a=commitdiff_plain;h=7e052af7e4c73dc450412486ad37eb529e725dc7
6 OMAP: Enable overlay optimisation
8 This enables the overlay optimisation feature when the video
9 overlay is active. This reduces memory bandwidth used by the
10 display subsystem, improving overall performance.
12 Signed-off-by: Mans Rullgard <mans@mansr.com>
15 diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
16 index 888d2c2..0f0b2e5 100644
17 --- a/drivers/video/omap/dispc.c
18 +++ b/drivers/video/omap/dispc.c
19 @@ -315,6 +315,60 @@ void omap_dispc_enable_digit_out(int enable)
21 EXPORT_SYMBOL(omap_dispc_enable_digit_out);
23 +#define MIN(a, b) ((a)<(b)?(a):(b))
24 +#define MAX(a, b) ((a)>(b)?(a):(b))
26 +static void setup_overlay_opt(void)
28 + struct fb_info **fbi = dispc.fbdev->fb_info;
29 + struct omapfb_plane_struct *gfx, *vid;
30 + struct fb_var_screeninfo *gvar;
31 + unsigned gx, gx2, gy, gy2, gw, gh;
32 + unsigned vx, vx2, vy, vy2, vw, vh;
34 + static unsigned last_skip;
36 + if (!fbi[0] || !fbi[1])
41 + gvar = &fbi[0]->var;
43 + gx = gfx->info.pos_x;
44 + gy = gfx->info.pos_y;
45 + gw = gfx->info.out_width;
46 + gh = gfx->info.out_height;
47 + vx = vid->info.pos_x;
48 + vy = vid->info.pos_y;
49 + vw = vid->info.out_width;
50 + vh = vid->info.out_height;
55 + bpp = gvar->bits_per_pixel / 8;
57 + if (!gfx->info.enabled || !vid->info.enabled ||
58 + dispc.color_key.key_type != OMAPFB_COLOR_KEY_DISABLED) {
60 + } else if (vx <= gx && vx2 >= gx2) {
61 + unsigned y = MIN(gy2, vy2) - MAX(gy, vy);
62 + skip = y * gvar->xres_virtual * bpp;
63 + } else if (vx <= gx || vx2 >= gx2) {
64 + unsigned x = MIN(gx2, vx2) - MAX(gx, vx);
67 + skip = vw * bpp + 1;
70 + if (skip != last_skip) {
72 + dispc_write_reg(DISPC_GFX_WINDOW_SKIP, skip);
73 + MOD_REG_FLD(DISPC_CONTROL, 1<<12, !!skip<<12);
77 static inline int _setup_plane(int plane, int channel_out,
78 u32 paddr, int screen_width,
79 int pos_x, int pos_y, int width, int height,
80 @@ -437,6 +491,9 @@ static inline int _setup_plane(int plane, int channel_out,
82 dispc_write_reg(ri_reg[plane], (screen_width - width) * bpp / 8 + 1);
85 + setup_overlay_opt();
87 MOD_REG_FLD(DISPC_CONTROL, 1<<5, 1<<5);
89 return height * screen_width * bpp / 8;
90 @@ -585,11 +642,19 @@ static int omap_dispc_enable_plane(int plane, int enable)
91 const u32 at_reg[] = { DISPC_GFX_ATTRIBUTES,
92 DISPC_VID1_BASE + DISPC_VID_ATTRIBUTES,
93 DISPC_VID2_BASE + DISPC_VID_ATTRIBUTES };
94 + struct omapfb_plane_struct *pi;
96 if ((unsigned int)plane > dispc.mem_desc.region_cnt)
99 + pi = dispc.fbdev->fb_info[plane]->par;
100 + pi->info.enabled = enable;
102 enable_lcd_clocks(1);
103 MOD_REG_FLD(at_reg[plane], 1, enable ? 1 : 0);
105 + setup_overlay_opt();
106 + MOD_REG_FLD(DISPC_CONTROL, 1<<5, 1<<5);
107 enable_lcd_clocks(0);
110 @@ -633,6 +698,7 @@ static int omap_dispc_set_color_key(struct omapfb_color_key *ck)
112 dispc_write_reg(tr_reg, ck->trans_key);
113 dispc_write_reg(df_reg, ck->background);
114 + setup_overlay_opt();
115 enable_lcd_clocks(0);
117 dispc.color_key = *ck;