summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-graphics/xorg-driver
diff options
context:
space:
mode:
authorSebastian Krzyszkowiak <dos@dosowisko.net>2011-08-23 16:32:12 +0000
committerKoen Kooi <koen@dominion.thruhere.net>2011-09-01 19:21:11 +0200
commit6c4ade873b33de20559b1e29c1bf1d4949cccd1f (patch)
tree56e1bfc379dd938b6265cd5558031295b9bfc49b /meta-oe/recipes-graphics/xorg-driver
parent506d990f7215217e6d36af4788cd5d08fb54332e (diff)
downloadmeta-openembedded-6c4ade873b33de20559b1e29c1bf1d4949cccd1f.tar.gz
xf86-video-omapfb: add patch for fixing segfault on starting X when using VRFB
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe/recipes-graphics/xorg-driver')
-rw-r--r--meta-oe/recipes-graphics/xorg-driver/xf86-video-omapfb/0004-Attempt-to-fix-VRFB.patch320
-rw-r--r--meta-oe/recipes-graphics/xorg-driver/xf86-video-omapfb_git.bb3
2 files changed, 322 insertions, 1 deletions
diff --git a/meta-oe/recipes-graphics/xorg-driver/xf86-video-omapfb/0004-Attempt-to-fix-VRFB.patch b/meta-oe/recipes-graphics/xorg-driver/xf86-video-omapfb/0004-Attempt-to-fix-VRFB.patch
new file mode 100644
index 000000000..4d2ecd36a
--- /dev/null
+++ b/meta-oe/recipes-graphics/xorg-driver/xf86-video-omapfb/0004-Attempt-to-fix-VRFB.patch
@@ -0,0 +1,320 @@
1From 9f034f7a83751e4d1bbff6dd742d54bd96d38230 Mon Sep 17 00:00:00 2001
2From: Eino-Ville Talvala <talvala@stanford.edu>
3Date: Tue, 23 Aug 2011 18:37:01 +0200
4Subject: [PATCH] Attempt to fix VRFB Signed-off-by: Sebastian Krzyszkowiak
5 <dos@dosowisko.net>
6
7---
8 src/image-format-conversions.c | 4 +-
9 src/image-format-conversions.h | 2 +-
10 src/omapfb-driver.c | 28 +++++++++++++--
11 src/omapfb-xv-blizzard.c | 1 +
12 src/omapfb-xv-generic.c | 72 +++++++++++++++++++++++++++++++--------
13 src/omapfb-xv.c | 3 ++
14 6 files changed, 88 insertions(+), 22 deletions(-)
15
16diff --git a/src/image-format-conversions.c b/src/image-format-conversions.c
17index dcefa9b..d43427d 100644
18--- a/src/image-format-conversions.c
19+++ b/src/image-format-conversions.c
20@@ -38,13 +38,13 @@
21 #include "image-format-conversions.h"
22
23 /* Basic line-based copy for packed formats */
24-void packed_line_copy(int w, int h, int stride, uint8_t *src, uint8_t *dest)
25+void packed_line_copy(int w, int h, int src_stride, int dst_stride, uint8_t *src, uint8_t *dest)
26 {
27 int i;
28 int len = w * 2;
29 for (i = 0; i < h; i++)
30 {
31- memcpy(dest + i * len, src + i * stride, len);
32+ memcpy(dest + i * dst_stride, src + i * src_stride, len);
33 }
34 }
35
36diff --git a/src/image-format-conversions.h b/src/image-format-conversions.h
37index 584896a..ba7caf2 100644
38--- a/src/image-format-conversions.h
39+++ b/src/image-format-conversions.h
40@@ -27,7 +27,7 @@
41 #include <stdint.h>
42
43 /* Basic line-based copy for packed formats */
44-void packed_line_copy(int w, int h, int stride, uint8_t *src, uint8_t *dest);
45+void packed_line_copy(int w, int h, int src_stride, int dst_stride, uint8_t *src, uint8_t *dest);
46
47 /* Basic C implementation of YV12/I420 to UYVY conversion */
48 void uv12_to_uyvy(int w, int h, int y_pitch, int uv_pitch, uint8_t *y_p, uint8_t *u_p, uint8_t *v_p, uint8_t *dest);
49diff --git a/src/omapfb-driver.c b/src/omapfb-driver.c
50index 48aa09c..07989f5 100644
51--- a/src/omapfb-driver.c
52+++ b/src/omapfb-driver.c
53@@ -66,6 +66,7 @@
54 #define OMAPFB_VERSION 1000
55 #define OMAPFB_DRIVER_NAME "OMAPFB"
56 #define OMAPFB_NAME "omapfb"
57+#define ENFORCE_MODES
58
59 static Bool OMAPFBProbe(DriverPtr drv, int flags);
60 static Bool OMAPFBPreInit(ScrnInfoPtr pScrn, int flags);
61@@ -105,11 +106,13 @@ static SymTabRec OMAPFBChipsets[] = {
62 typedef enum {
63 OPTION_ACCELMETHOD,
64 OPTION_FB,
65+ OPTION_ROTATE,
66 } FBDevOpts;
67
68 static const OptionInfoRec OMAPFBOptions[] = {
69 { OPTION_ACCELMETHOD, "AccelMethod", OPTV_STRING, {0}, FALSE },
70 { OPTION_FB, "fb", OPTV_STRING, {0}, FALSE },
71+ { OPTION_ROTATE, "rotation", OPTV_STRING, {0}, FALSE },
72 { -1, NULL, OPTV_NONE, {0}, FALSE }
73 };
74
75@@ -286,6 +289,7 @@ OMAPFBPreInit(ScrnInfoPtr pScrn, int flags)
76 {
77 OMAPFBPtr ofb;
78 EntityInfoPtr pEnt;
79+ char *rotate;
80 rgb zeros = { 0, 0, 0 };
81 struct stat st;
82
83@@ -379,6 +383,8 @@ OMAPFBPreInit(ScrnInfoPtr pScrn, int flags)
84 pScrn->progClock = TRUE;
85 pScrn->chipset = "omapfb";
86
87+ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Rotate test version 0.02\n");
88+
89 /* Start with configured virtual size */
90 pScrn->virtualX = pScrn->display->virtualX;
91 pScrn->virtualY = pScrn->display->virtualY;
92@@ -496,12 +502,21 @@ OMAPFBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
93 ofb->CloseScreen = pScreen->CloseScreen;
94 pScreen->CloseScreen = OMAPFBCloseScreen;
95
96+ /* Enforce the default mode (this is silly I guess) */
97+#ifdef ENFORCE_MODES
98+ //xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Enforcing modes\n");
99+ //set_mode(ofb, &ofb->default_mode);
100+ //pScrn->displayWidth = ofb->fixed_info.line_length /
101+ // (ofb->state_info.bits_per_pixel>>3); //ofb->state_info.xres;
102+#endif
103+
104 /* Map our framebuffer memory */
105+ ofb->mem_info.size = ofb->fixed_info.line_length * ofb->state_info.yres;
106 ofb->fb = mmap (NULL, ofb->mem_info.size,
107 PROT_READ | PROT_WRITE, MAP_SHARED,
108 ofb->fd, 0);
109- if (ofb->fb == NULL) {
110- xf86DrvMsg(scrnIndex, X_ERROR, "Mapping framebuffer memory failed\n");
111+ if (ofb->fb == MAP_FAILED) {
112+ xf86DrvMsg(scrnIndex, X_ERROR, "Mapping framebuffer memory failed, wanted %d bytes.\n", ofb->mem_info.size);
113 return FALSE;
114 }
115
116@@ -578,8 +593,13 @@ OMAPFBScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
117 } else if (!ofb->dss) {
118
119 ofb->plane_info.enabled = 1;
120- ofb->plane_info.out_width = ofb->state_info.xres;
121- ofb->plane_info.out_height = ofb->state_info.yres;
122+ if (ofb->state_info.rotate == 0 || ofb->state_info.rotate == 2) {
123+ ofb->plane_info.out_width = ofb->state_info.xres;
124+ ofb->plane_info.out_height = ofb->state_info.yres;
125+ } else {
126+ ofb->plane_info.out_width = ofb->state_info.yres;
127+ ofb->plane_info.out_height = ofb->state_info.xres;
128+ }
129
130 if (ioctl (ofb->fd, OMAPFB_SETUP_PLANE, &ofb->plane_info)) {
131 xf86DrvMsg(scrnIndex, X_ERROR,
132diff --git a/src/omapfb-xv-blizzard.c b/src/omapfb-xv-blizzard.c
133index 406ffc6..b71d2aa 100644
134--- a/src/omapfb-xv-blizzard.c
135+++ b/src/omapfb-xv-blizzard.c
136@@ -220,6 +220,7 @@ int OMAPFBXVPutImageBlizzard (ScrnInfoPtr pScrn,
137 packed_line_copy(src_w & ~3,
138 src_h & ~3,
139 ((src_w + 1) & ~1) * 2,
140+ ofb->port->fixed_info.line_length,
141 (uint8_t*)buf,
142 (uint8_t*)ofb->port->fb);
143 break;
144diff --git a/src/omapfb-xv-generic.c b/src/omapfb-xv-generic.c
145index e6f89fe..b33f344 100644
146--- a/src/omapfb-xv-generic.c
147+++ b/src/omapfb-xv-generic.c
148@@ -62,7 +62,7 @@ int OMAPXVAllocPlane(ScrnInfoPtr pScrn)
149 {
150 OMAPFBPtr ofb = OMAPFB(pScrn);
151
152- /* The memory size is already set in OMAPFBXVQueryImageAttributes */
153+ /* The memory size is already set before we get here */
154 if (ioctl(ofb->port->fd, OMAPFB_SETUP_MEM, &ofb->port->mem_info) != 0) {
155 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
156 "Failed to allocate video plane memory\n");
157@@ -73,19 +73,20 @@ int OMAPXVAllocPlane(ScrnInfoPtr pScrn)
158 ofb->port->fb = mmap (NULL, ofb->port->mem_info.size,
159 PROT_READ | PROT_WRITE, MAP_SHARED,
160 ofb->port->fd, 0);
161- if (ofb->port->fb == NULL) {
162+ if (ofb->port->fb == MAP_FAILED) {
163 xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
164 "Mapping video memory failed\n");
165 return XvBadAlloc;
166 }
167
168 /* Update the state info */
169+ /* Let's not - it's bad
170 if (ioctl (ofb->port->fd, FBIOGET_VSCREENINFO, &ofb->port->state_info))
171 {
172 xf86Msg(X_ERROR, "%s: Reading state info failed\n", __FUNCTION__);
173 return XvBadAlloc;
174 }
175-
176+ */
177 return Success;
178 }
179
180@@ -93,6 +94,7 @@ int OMAPXVAllocPlane(ScrnInfoPtr pScrn)
181 int OMAPXVSetupVideoPlane(ScrnInfoPtr pScrn)
182 {
183 OMAPFBPtr ofb = OMAPFB(pScrn);
184+ int ret;
185
186 if (ioctl (ofb->port->fd, FBIOPUT_VSCREENINFO, &ofb->port->state_info))
187 {
188@@ -104,6 +106,31 @@ int OMAPXVSetupVideoPlane(ScrnInfoPtr pScrn)
189 xf86Msg(X_ERROR, "%s: Reading state info failed\n", __FUNCTION__);
190 return XvBadAlloc;
191 }
192+ /* Changing rotation/nonstd flags can change the fixed info! */
193+ if (ioctl (ofb->port->fd, FBIOGET_FSCREENINFO, &ofb->port->fixed_info))
194+ {
195+ xf86Msg(X_ERROR, "%s: Reading state info failed\n", __FUNCTION__);
196+ return XvBadAlloc;
197+ }
198+ /* Correct fixed info requires recalculation of needed memory */
199+ ofb->port->mem_info.size = ofb->port->fixed_info.line_length * ofb->port->state_info.yres;
200+
201+ /* Allocate buffer memory */
202+ ret = OMAPXVAllocPlane(pScrn);
203+ if (ret != Success)
204+ return ret;
205+
206+ /* Workaround for reset of mode after memory allo */
207+ if (ioctl (ofb->port->fd, FBIOPUT_VSCREENINFO, &ofb->port->state_info))
208+ {
209+ xf86Msg(X_ERROR, "%s: setting state info failed\n", __FUNCTION__);
210+ return XvBadAlloc;
211+ }
212+ if (ioctl (ofb->port->fd, FBIOGET_VSCREENINFO, &ofb->port->state_info))
213+ {
214+ xf86Msg(X_ERROR, "%s: Reading state info failed\n", __FUNCTION__);
215+ return XvBadAlloc;
216+ }
217
218 if(ioctl(ofb->port->fd, OMAPFB_SETUP_PLANE,
219 &ofb->port->plane_info) != 0) {
220@@ -124,6 +151,8 @@ int OMAPFBXVPutImageGeneric (ScrnInfoPtr pScrn,
221 DrawablePtr pDraw)
222 {
223 OMAPFBPtr ofb = OMAPFB(pScrn);
224+ short drw_temp;
225+ short rot_xres, rot_yres;
226
227 if (!ofb->port->plane_info.enabled
228 || ofb->port->update_window.x != src_x
229@@ -163,13 +192,6 @@ int OMAPFBXVPutImageGeneric (ScrnInfoPtr pScrn,
230 return Success;
231 }
232
233- /* If we don't have the plane running, enable it */
234- if (!ofb->port->plane_info.enabled) {
235- ret = OMAPXVAllocPlane(pScrn);
236- if (ret != Success)
237- return ret;
238- }
239-
240 /* Set up the state info, xres and yres will be used for
241 * scaling to the values in the plane info struct
242 */
243@@ -179,12 +201,31 @@ int OMAPFBXVPutImageGeneric (ScrnInfoPtr pScrn,
244 ofb->port->state_info.yres_virtual = 0;
245 ofb->port->state_info.xoffset = 0;
246 ofb->port->state_info.yoffset = 0;
247- ofb->port->state_info.rotate = 0;
248+ //ofb->port->state_info.rotate = 0;
249 ofb->port->state_info.grayscale = 0;
250 ofb->port->state_info.activate = FB_ACTIVATE_NOW;
251 ofb->port->state_info.bits_per_pixel = 0;
252 ofb->port->state_info.nonstd = xv_to_omapfb_format(image);
253
254+ /* Plane info does not rotate with state_info */
255+ if (ofb->port->state_info.rotate == 1 ||
256+ ofb->port->state_info.rotate == 3) {
257+ drw_temp = drw_x;
258+ drw_x = drw_y;
259+ drw_y = drw_temp;
260+
261+ drw_temp = drw_w;
262+ drw_w = drw_h;
263+ drw_h = drw_temp;
264+
265+ rot_xres = ofb->port->state_info.yres;
266+ rot_yres = ofb->port->state_info.xres;
267+ } else {
268+ rot_xres = ofb->port->state_info.xres;
269+ rot_yres = ofb->port->state_info.yres;
270+ }
271+
272+
273 /* Set up the video plane info */
274 ofb->port->plane_info.enabled = 1;
275 ofb->port->plane_info.pos_x = drw_x;
276@@ -193,13 +234,13 @@ int OMAPFBXVPutImageGeneric (ScrnInfoPtr pScrn,
277 ofb->port->plane_info.out_height = drw_h & ~15;
278
279 /* Cap output to screen size */
280- if (ofb->port->plane_info.out_width > ofb->state_info.xres) {
281+ if (ofb->port->plane_info.out_width > rot_xres) {
282 ofb->port->plane_info.pos_x = 0;
283- ofb->port->plane_info.out_width = ofb->state_info.xres;
284+ ofb->port->plane_info.out_width = rot_xres;
285 }
286- if (ofb->port->plane_info.out_height > ofb->state_info.yres) {
287+ if (ofb->port->plane_info.out_height > rot_yres) {
288 ofb->port->plane_info.pos_y = 0;
289- ofb->port->plane_info.out_height = ofb->state_info.yres;
290+ ofb->port->plane_info.out_height = rot_yres;
291 }
292
293 ret = OMAPXVSetupVideoPlane(pScrn);
294@@ -223,6 +264,7 @@ int OMAPFBXVPutImageGeneric (ScrnInfoPtr pScrn,
295 packed_line_copy(src_w & ~15,
296 src_h & ~15,
297 ((src_w + 1) & ~1) * 2,
298+ ofb->port->fixed_info.line_length,
299 (uint8_t*)buf,
300 (uint8_t*)ofb->port->fb);
301 break;
302diff --git a/src/omapfb-xv.c b/src/omapfb-xv.c
303index 1df651e..0fee2c6 100644
304--- a/src/omapfb-xv.c
305+++ b/src/omapfb-xv.c
306@@ -169,8 +169,11 @@ static int OMAPFBXVQueryImageAttributes (ScrnInfoPtr pScrn,
307 h = *height;
308
309 w = (w + 1) & ~1;
310+
311+ /* Can't calculate these here - don't know line length
312 ofb->port->mem_info.size = w << 1;
313 ofb->port->mem_info.size *= h;
314+ */
315
316 return size;
317 }
318--
3191.7.5.4
320
diff --git a/meta-oe/recipes-graphics/xorg-driver/xf86-video-omapfb_git.bb b/meta-oe/recipes-graphics/xorg-driver/xf86-video-omapfb_git.bb
index 151eb7731..2cc744f41 100644
--- a/meta-oe/recipes-graphics/xorg-driver/xf86-video-omapfb_git.bb
+++ b/meta-oe/recipes-graphics/xorg-driver/xf86-video-omapfb_git.bb
@@ -5,7 +5,7 @@ INC_PR ?= "r15"
5DESCRIPTION = "X.Org X server -- OMAP display driver" 5DESCRIPTION = "X.Org X server -- OMAP display driver"
6PE = "1" 6PE = "1"
7PV = "0.1.1+${PR}+gitr${SRCREV}" 7PV = "0.1.1+${PR}+gitr${SRCREV}"
8PR = "${INC_PR}.3" 8PR = "${INC_PR}.4"
9 9
10LICENSE = "MIT-X" 10LICENSE = "MIT-X"
11LIC_FILES_CHKSUM = "file://src/omapfb-driver.c;beginline=1;endline=30;md5=a44c2a37e04d1c2c5f0313afb493f833" 11LIC_FILES_CHKSUM = "file://src/omapfb-driver.c;beginline=1;endline=30;md5=a44c2a37e04d1c2c5f0313afb493f833"
@@ -14,6 +14,7 @@ SRC_URI = "git://git.pingu.fi/xf86-video-omapfb;protocol=http \
14 file://0001-blacklist-tv-out.patch \ 14 file://0001-blacklist-tv-out.patch \
15 file://0002-Revert-Set-virtual-size-when-configuring-framebuffer.patch \ 15 file://0002-Revert-Set-virtual-size-when-configuring-framebuffer.patch \
16 file://0003-force-plain-mode.patch \ 16 file://0003-force-plain-mode.patch \
17 file://0004-Attempt-to-fix-VRFB.patch \
17 " 18 "
18 19
19SRCREV_pn-${PN} = "28c006c94e57ea71df11ec4fff79d7ffcfc4860f" 20SRCREV_pn-${PN} = "28c006c94e57ea71df11ec4fff79d7ffcfc4860f"