]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
6400da3c241410c86c9d97474a3333a591aa529b
[thirdparty/openembedded/openembedded-core-contrib.git] /
1 From c09f1a0642fd58a1b081594ea36dfd1bf71aec52 Mon Sep 17 00:00:00 2001
2 From: Hardik Shah <hardik.shah@ti.com>
3 Date: Thu, 9 Apr 2009 12:13:07 +0530
4 Subject: [PATCH] DSS2: OMAPFB: Added support for the YUV VRFB rotation and mirroring.
5
6 DSS2 now requires roatation_type to be specified by driver.
7 Added support for that.
8 DSS2 OMAPFB: Modified to pass the dss mode to omap_vrfb_setup function.
9
10 VRFB size register requires the width to be halved when the
11 mode is YUV or UYVY. So VRFB is modifed to pass the mode to omap_vrfb_setup
12 function.
13
14 Few changes done by Tim Yamin
15 Signed-off-by: Tim Yamin <plasm@roo.me.uk>
16 Signed-off-by: Hardik Shah <hardik.shah@ti.com>
17 ---
18 arch/arm/plat-omap/vrfb.c | 4 +-
19 drivers/video/omap2/omapfb/omapfb-main.c | 59 ++++++++++++++----------------
20 drivers/video/omap2/omapfb/omapfb.h | 7 +---
21 3 files changed, 30 insertions(+), 40 deletions(-)
22
23 diff --git a/arch/arm/plat-omap/vrfb.c b/arch/arm/plat-omap/vrfb.c
24 index 2f08f6d..2ae0d68 100644
25 --- a/arch/arm/plat-omap/vrfb.c
26 +++ b/arch/arm/plat-omap/vrfb.c
27 @@ -88,9 +88,9 @@ void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
28 color_mode == OMAP_DSS_COLOR_UYVY)
29 width >>= 1;
30
31 - if (bytespp == 4) {
32 + if (bytespp == 4)
33 pixel_size_exp = 2;
34 - } else if (bytespp == 2)
35 + else if (bytespp == 2)
36 pixel_size_exp = 1;
37 else
38 BUG();
39 diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
40 index 67c67c2..57f5900 100644
41 --- a/drivers/video/omap2/omapfb/omapfb-main.c
42 +++ b/drivers/video/omap2/omapfb/omapfb-main.c
43 @@ -176,15 +176,9 @@ static unsigned omapfb_get_vrfb_offset(struct omapfb_info *ofbi, int rot)
44
45 static u32 omapfb_get_region_rot_paddr(struct omapfb_info *ofbi)
46 {
47 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
48 - unsigned offset;
49 - int rot;
50 -
51 - rot = ofbi->rotation;
52 -
53 - offset = omapfb_get_vrfb_offset(ofbi, rot);
54 -
55 - return ofbi->region.vrfb.paddr[rot] + offset;
56 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
57 + return ofbi->region.vrfb.paddr[ofbi->rotation]
58 + + omapfb_get_vrfb_offset(ofbi, ofbi->rotation);
59 } else {
60 return ofbi->region.paddr;
61 }
62 @@ -192,7 +186,7 @@ static u32 omapfb_get_region_rot_paddr(struct omapfb_info *ofbi)
63
64 u32 omapfb_get_region_paddr(struct omapfb_info *ofbi)
65 {
66 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
67 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
68 return ofbi->region.vrfb.paddr[0];
69 else
70 return ofbi->region.paddr;
71 @@ -200,7 +194,7 @@ u32 omapfb_get_region_paddr(struct omapfb_info *ofbi)
72
73 void __iomem *omapfb_get_region_vaddr(struct omapfb_info *ofbi)
74 {
75 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
76 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
77 return ofbi->region.vrfb.vaddr[0];
78 else
79 return ofbi->region.vaddr;
80 @@ -398,7 +392,7 @@ void set_fb_fix(struct fb_info *fbi)
81 fbi->screen_base = (char __iomem *)omapfb_get_region_vaddr(ofbi);
82
83 /* used by mmap in fbmem.c */
84 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
85 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
86 fix->line_length =
87 (OMAP_VRFB_LINE_LEN * var->bits_per_pixel) >> 3;
88 else
89 @@ -434,11 +428,14 @@ void set_fb_fix(struct fb_info *fbi)
90 fix->xpanstep = 1;
91 fix->ypanstep = 1;
92
93 - if (rg->size) {
94 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
95 - omap_vrfb_setup(&rg->vrfb, rg->paddr,
96 - var->xres_virtual, var->yres_virtual,
97 - var->bits_per_pixel >> 3);
98 + if (rg->size && ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
99 + enum omap_color_mode mode = 0;
100 + mode = fb_mode_to_dss_mode(var);
101 +
102 + omap_vrfb_setup(&rg->vrfb, rg->paddr,
103 + var->xres_virtual,
104 + var->yres_virtual,
105 + mode);
106 }
107 }
108
109 @@ -527,7 +524,7 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
110 if (var->yres > var->yres_virtual)
111 var->yres = var->yres_virtual;
112
113 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
114 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
115 line_size = OMAP_VRFB_LINE_LEN * bytespp;
116 else
117 line_size = var->xres_virtual * bytespp;
118 @@ -549,7 +546,7 @@ int check_fb_var(struct fb_info *fbi, struct fb_var_screeninfo *var)
119
120 if (line_size * var->yres_virtual > max_frame_size) {
121 DBG("can't fit FB into memory, reducing x\n");
122 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB)
123 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
124 return -EINVAL;
125
126 var->xres_virtual = max_frame_size / var->yres_virtual /
127 @@ -672,7 +669,7 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
128 struct omap_overlay_info info;
129 int xres, yres;
130 int screen_width;
131 - int rot, mirror;
132 + int mirror;
133
134 DBG("setup_overlay %d, posx %d, posy %d, outw %d, outh %d\n", ofbi->id,
135 posx, posy, outw, outh);
136 @@ -688,7 +685,7 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
137 offset = ((var->yoffset * var->xres_virtual +
138 var->xoffset) * var->bits_per_pixel) >> 3;
139
140 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
141 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
142 data_start_p = omapfb_get_region_rot_paddr(ofbi);
143 data_start_v = NULL;
144 } else {
145 @@ -711,13 +708,10 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
146
147 ovl->get_overlay_info(ovl, &info);
148
149 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
150 - rot = 0;
151 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
152 mirror = 0;
153 - } else {
154 - rot = ofbi->rotation;
155 + else
156 mirror = ofbi->mirror;
157 - }
158
159 info.paddr = data_start_p;
160 info.vaddr = data_start_v;
161 @@ -725,7 +719,8 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
162 info.width = xres;
163 info.height = yres;
164 info.color_mode = mode;
165 - info.rotation = rot;
166 + info.rotation_type = ofbi->rotation_type;
167 + info.rotation = ofbi->rotation;
168 info.mirror = mirror;
169
170 info.pos_x = posx;
171 @@ -1121,7 +1116,7 @@ static void omapfb_free_fbmem(struct fb_info *fbi)
172 if (rg->vaddr)
173 iounmap(rg->vaddr);
174
175 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
176 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
177 /* unmap the 0 angle rotation */
178 if (rg->vrfb.vaddr[0]) {
179 iounmap(rg->vrfb.vaddr[0]);
180 @@ -1181,7 +1176,7 @@ static int omapfb_alloc_fbmem(struct fb_info *fbi, unsigned long size,
181 return -ENOMEM;
182 }
183
184 - if (ofbi->rotation_type != OMAPFB_ROT_VRFB) {
185 + if (ofbi->rotation_type != OMAP_DSS_ROT_VRFB) {
186 vaddr = ioremap_wc(paddr, size);
187
188 if (!vaddr) {
189 @@ -1260,7 +1255,7 @@ static int omapfb_alloc_fbmem_display(struct fb_info *fbi, unsigned long size,
190
191 display->get_resolution(display, &w, &h);
192
193 - if (ofbi->rotation_type == OMAPFB_ROT_VRFB) {
194 + if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
195 #ifdef DEBUG
196 int oldw = w, oldh = h;
197 #endif
198 @@ -1701,8 +1696,8 @@ static int omapfb_create_framebuffers(struct omapfb2_device *fbdev)
199 ofbi->id = i;
200
201 /* assign these early, so that fb alloc can use them */
202 - ofbi->rotation_type = def_vrfb ? OMAPFB_ROT_VRFB :
203 - OMAPFB_ROT_DMA;
204 + ofbi->rotation_type = def_vrfb ? OMAP_DSS_ROT_VRFB :
205 + OMAP_DSS_ROT_DMA;
206 ofbi->rotation = def_rotate;
207 ofbi->mirror = def_mirror;
208
209 diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h
210 index 2607def..43f6922 100644
211 --- a/drivers/video/omap2/omapfb/omapfb.h
212 +++ b/drivers/video/omap2/omapfb/omapfb.h
213 @@ -53,11 +53,6 @@ struct omapfb2_mem_region {
214 bool map; /* kernel mapped by the driver */
215 };
216
217 -enum omapfb_rotation_type {
218 - OMAPFB_ROT_DMA = 0,
219 - OMAPFB_ROT_VRFB = 1,
220 -};
221 -
222 /* appended to fb_info */
223 struct omapfb_info {
224 int id;
225 @@ -66,7 +61,7 @@ struct omapfb_info {
226 int num_overlays;
227 struct omap_overlay *overlays[OMAPFB_MAX_OVL_PER_FB];
228 struct omapfb2_device *fbdev;
229 - enum omapfb_rotation_type rotation_type;
230 + enum omap_dss_rotation_type rotation_type;
231 u8 rotation;
232 bool mirror;
233 };
234 --
235 1.5.6.5
236