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