0a041bba4e22e25bb5b065ee581b3f5162227cd5
[openembedded.git] /
1 From a107c9c4bd642fd5044275ffcb00a8e20da481c7 Mon Sep 17 00:00:00 2001
2 From: Vaibhav Hiremath <hvaibhav@ti.com>
3 Date: Tue, 10 Aug 2010 20:05:51 +0530
4 Subject: [PATCH 5/9] Revert "Revert "OMAP: DSS2: FIFI UNDERFLOW issue fixed""
5
6 This reverts commit b2c74dc43741d8d824e5439f6a82c0a5aa5d1c80.
7
8 There was small bug in the GFX UNDERFLOW patch, so I had reverted it and now
9 since I have fix for the same so I am again commiting the fix which reverts the
10 original patch with fix.
11
12 Original commit - 4b58d194fd8f5a1c68803eb326e9a71621571696.
13 Revert commit - b2c74dc43741d8d824e5439f6a82c0a5aa5d1c80
14 ---
15  drivers/video/omap2/omapfb/omapfb-main.c |   83 ++++++++++++++++++++----------
16  1 files changed, 55 insertions(+), 28 deletions(-)
17
18 diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
19 index ef29983..7f47a34 100644
20 --- a/drivers/video/omap2/omapfb/omapfb-main.c
21 +++ b/drivers/video/omap2/omapfb/omapfb-main.c
22 @@ -182,6 +182,11 @@ static unsigned omapfb_get_vrfb_offset(struct omapfb_info *ofbi, int rot)
23  static u32 omapfb_get_region_rot_paddr(struct omapfb_info *ofbi, int rot)
24  {
25         if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
26 +               if (rot == FB_ROTATE_CW)
27 +                       rot = FB_ROTATE_CCW;
28 +               else if (rot == FB_ROTATE_CCW)
29 +                       rot = FB_ROTATE_CW;
30 +
31                 return ofbi->region.vrfb.paddr[rot]
32                         + omapfb_get_vrfb_offset(ofbi, rot);
33         } else {
34 @@ -189,20 +194,32 @@ static u32 omapfb_get_region_rot_paddr(struct omapfb_info *ofbi, int rot)
35         }
36  }
37  
38 -static u32 omapfb_get_region_paddr(struct omapfb_info *ofbi)
39 +static u32 omapfb_get_region_paddr(struct omapfb_info *ofbi, int rot)
40  {
41 -       if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
42 -               return ofbi->region.vrfb.paddr[0];
43 -       else
44 +       if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
45 +               if (rot == FB_ROTATE_CW)
46 +                       rot = FB_ROTATE_CCW;
47 +               else if (rot == FB_ROTATE_CCW)
48 +                       rot = FB_ROTATE_CW;
49 +
50 +               return ofbi->region.vrfb.paddr[rot];
51 +       } else {
52                 return ofbi->region.paddr;
53 +       }
54  }
55  
56 -static void __iomem *omapfb_get_region_vaddr(struct omapfb_info *ofbi)
57 +static void __iomem *omapfb_get_region_vaddr(struct omapfb_info *ofbi, int rot)
58  {
59 -       if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
60 -               return ofbi->region.vrfb.vaddr[0];
61 -       else
62 +       if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
63 +               if (rot == FB_ROTATE_CW)
64 +                       rot = FB_ROTATE_CCW;
65 +               else if (rot == FB_ROTATE_CCW)
66 +                       rot = FB_ROTATE_CW;
67 +
68 +               return ofbi->region.vrfb.vaddr[rot];
69 +       } else {
70                 return ofbi->region.vaddr;
71 +       }
72  }
73  
74  static struct omapfb_colormode omapfb_colormodes[] = {
75 @@ -501,7 +518,7 @@ static int setup_vrfb_rotation(struct fb_info *fbi)
76         unsigned bytespp;
77         bool yuv_mode;
78         enum omap_color_mode mode;
79 -       int r;
80 +       int r, rotation = var->rotate;
81         bool reconf;
82  
83         if (!rg->size || ofbi->rotation_type != OMAP_DSS_ROT_VRFB)
84 @@ -509,6 +526,11 @@ static int setup_vrfb_rotation(struct fb_info *fbi)
85  
86         DBG("setup_vrfb_rotation\n");
87  
88 +       if (rotation == FB_ROTATE_CW)
89 +               rotation = FB_ROTATE_CCW;
90 +       else if (rotation == FB_ROTATE_CCW)
91 +               rotation = FB_ROTATE_CW;
92 +
93         r = fb_mode_to_dss_mode(var, &mode);
94         if (r)
95                 return r;
96 @@ -532,32 +554,35 @@ static int setup_vrfb_rotation(struct fb_info *fbi)
97                         vrfb->yres != var->yres_virtual)
98                 reconf = true;
99  
100 -       if (vrfb->vaddr[0] && reconf) {
101 +       if (vrfb->vaddr[rotation] && reconf) {
102                 fbi->screen_base = NULL;
103                 fix->smem_start = 0;
104                 fix->smem_len = 0;
105 -               iounmap(vrfb->vaddr[0]);
106 -               vrfb->vaddr[0] = NULL;
107 +               iounmap(vrfb->vaddr[rotation]);
108 +               vrfb->vaddr[rotation] = NULL;
109                 DBG("setup_vrfb_rotation: reset fb\n");
110         }
111  
112 -       if (vrfb->vaddr[0])
113 +       if (vrfb->vaddr[rotation])
114                 return 0;
115  
116 -       omap_vrfb_setup(&rg->vrfb, rg->paddr,
117 -                       var->xres_virtual,
118 -                       var->yres_virtual,
119 -                       bytespp, yuv_mode);
120 +       if (rotation == FB_ROTATE_CW || rotation == FB_ROTATE_CCW)
121 +               omap_vrfb_setup(&rg->vrfb, rg->paddr,
122 +                               var->yres_virtual, var->xres_virtual,
123 +                               bytespp, yuv_mode);
124 +       else
125 +               omap_vrfb_setup(&rg->vrfb, rg->paddr,
126 +                               var->xres_virtual, var->yres_virtual,
127 +                               bytespp, yuv_mode);
128  
129 -       /* Now one can ioremap the 0 angle view */
130 -       r = omap_vrfb_map_angle(vrfb, var->yres_virtual, 0);
131 +       /* Now one can ioremap the rotation angle view */
132 +       r = omap_vrfb_map_angle(vrfb, var->yres_virtual, rotation);
133         if (r)
134                 return r;
135 -
136         /* used by open/write in fbmem.c */
137 -       fbi->screen_base = ofbi->region.vrfb.vaddr[0];
138 +       fbi->screen_base = ofbi->region.vrfb.vaddr[rotation];
139  
140 -       fix->smem_start = ofbi->region.vrfb.paddr[0];
141 +       fix->smem_start = ofbi->region.vrfb.paddr[rotation];
142  
143         switch (var->nonstd) {
144         case OMAPFB_COLOR_YUV422:
145 @@ -601,7 +626,8 @@ void set_fb_fix(struct fb_info *fbi)
146         DBG("set_fb_fix\n");
147  
148         /* used by open/write in fbmem.c */
149 -       fbi->screen_base = (char __iomem *)omapfb_get_region_vaddr(ofbi);
150 +       fbi->screen_base = (char __iomem *)omapfb_get_region_vaddr(ofbi,
151 +                       var->rotate);
152  
153         /* used by mmap in fbmem.c */
154         if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
155 @@ -624,7 +650,7 @@ void set_fb_fix(struct fb_info *fbi)
156                 fix->smem_len = rg->size;
157         }
158  
159 -       fix->smem_start = omapfb_get_region_paddr(ofbi);
160 +       fix->smem_start = omapfb_get_region_paddr(ofbi, var->rotate);
161  
162         fix->type = FB_TYPE_PACKED_PIXELS;
163  
164 @@ -860,11 +886,11 @@ static int omapfb_setup_overlay(struct fb_info *fbi, struct omap_overlay *ovl,
165  
166  
167         if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB) {
168 -               data_start_p = omapfb_get_region_rot_paddr(ofbi, rotation);
169 +               data_start_p = omapfb_get_region_rot_paddr(ofbi, 0);
170                 data_start_v = NULL;
171         } else {
172 -               data_start_p = omapfb_get_region_paddr(ofbi);
173 -               data_start_v = omapfb_get_region_vaddr(ofbi);
174 +               data_start_p = omapfb_get_region_paddr(ofbi, 0);
175 +               data_start_v = omapfb_get_region_vaddr(ofbi, 0);
176         }
177  
178         if (ofbi->rotation_type == OMAP_DSS_ROT_VRFB)
179 @@ -1076,6 +1102,7 @@ static struct vm_operations_struct mmap_user_ops = {
180  static int omapfb_mmap(struct fb_info *fbi, struct vm_area_struct *vma)
181  {
182         struct omapfb_info *ofbi = FB2OFB(fbi);
183 +       struct fb_var_screeninfo *var = &fbi->var;
184         struct fb_fix_screeninfo *fix = &fbi->fix;
185         unsigned long off;
186         unsigned long start;
187 @@ -1087,7 +1114,7 @@ static int omapfb_mmap(struct fb_info *fbi, struct vm_area_struct *vma)
188                 return -EINVAL;
189         off = vma->vm_pgoff << PAGE_SHIFT;
190  
191 -       start = omapfb_get_region_paddr(ofbi);
192 +       start = omapfb_get_region_paddr(ofbi, var->rotate);
193         len = fix->smem_len;
194         if (off >= len)
195                 return -EINVAL;
196 -- 
197 1.6.2.4
198