summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Bragg <bob@openedhand.com>2008-05-22 13:49:31 +0000
committerRobert Bragg <bob@openedhand.com>2008-05-22 13:49:31 +0000
commitbd072907ae9136f36efd538f183338c729b48552 (patch)
tree1ab56e2008f20276b2abcfd1878f5d7f967d8510
parent1db5747b475304072f30965b741e39dcfcad3702 (diff)
downloadpoky-bd072907ae9136f36efd538f183338c729b48552.tar.gz
Adds support for changing the fbdev pixel format when the
default (e.g. 8bpp pallet mode) isn't supported. git-svn-id: https://svn.o-hand.com/repos/poky/trunk@4544 311d38ba-8fff-0310-9ca6-ca027cbcb966
-rw-r--r--meta/packages/psplash/files/psplash-fbdev-pixfmt.patch127
-rw-r--r--meta/packages/psplash/psplash_svn.bb4
2 files changed, 130 insertions, 1 deletions
diff --git a/meta/packages/psplash/files/psplash-fbdev-pixfmt.patch b/meta/packages/psplash/files/psplash-fbdev-pixfmt.patch
new file mode 100644
index 0000000000..5b866cb119
--- /dev/null
+++ b/meta/packages/psplash/files/psplash-fbdev-pixfmt.patch
@@ -0,0 +1,127 @@
1Index: psplash-fb.c
2===================================================================
3--- psplash-fb.c (revision 376)
4+++ psplash-fb.c (working copy)
5@@ -25,6 +25,77 @@
6 free(fb);
7 }
8
9+static int
10+attempt_to_change_pixel_format (PSplashFB *fb,
11+ struct fb_var_screeninfo *fb_var)
12+{
13+ /* By default the framebuffer driver may have set an oversized
14+ * yres_virtual to support VT scrolling via the panning interface.
15+ *
16+ * We don't try and maintain this since it's more likely that we
17+ * will fail to increase the bpp if the driver's pre allocated
18+ * framebuffer isn't large enough.
19+ */
20+ fb_var->yres_virtual = fb_var->yres;
21+
22+ /* First try setting an 8,8,8,0 pixel format so we don't have to do
23+ * any conversions while drawing. */
24+
25+ fb_var->bits_per_pixel = 32;
26+
27+ fb_var->red.offset = 0;
28+ fb_var->red.length = 8;
29+
30+ fb_var->green.offset = 8;
31+ fb_var->green.length = 8;
32+
33+ fb_var->blue.offset = 16;
34+ fb_var->blue.length = 8;
35+
36+ fb_var->transp.offset = 0;
37+ fb_var->transp.length = 0;
38+
39+ if (ioctl (fb->fd, FBIOPUT_VSCREENINFO, fb_var) == 0)
40+ {
41+ fprintf(stdout, "Switched to a 32 bpp 8,8,8 frame buffer\n");
42+ return 1;
43+ }
44+ else
45+ {
46+ fprintf(stderr,
47+ "Error, failed to switch to a 32 bpp 8,8,8 frame buffer\n");
48+ }
49+
50+ /* Otherwise try a 16bpp 5,6,5 format */
51+
52+ fb_var->bits_per_pixel = 16;
53+
54+ fb_var->red.offset = 11;
55+ fb_var->red.length = 5;
56+
57+ fb_var->green.offset = 5;
58+ fb_var->green.length = 6;
59+
60+ fb_var->blue.offset = 0;
61+ fb_var->blue.length = 5;
62+
63+ fb_var->transp.offset = 0;
64+ fb_var->transp.length = 0;
65+
66+ if (ioctl (fb->fd, FBIOPUT_VSCREENINFO, fb_var) == 0)
67+ {
68+ fprintf(stdout, "Switched to a 16 bpp 5,6,5 frame buffer\n");
69+ return 1;
70+ }
71+ else
72+ {
73+ fprintf(stderr,
74+ "Error, failed to switch to a 16 bpp 5,6,5 frame buffer\n");
75+ }
76+
77+ return 0;
78+}
79+
80 PSplashFB*
81 psplash_fb_new (int angle)
82 {
83@@ -55,20 +126,31 @@
84 goto fail;
85 }
86
87- if (ioctl (fb->fd, FBIOGET_FSCREENINFO, &fb_fix) == -1
88- || ioctl (fb->fd, FBIOGET_VSCREENINFO, &fb_var) == -1)
89+ if (ioctl (fb->fd, FBIOGET_VSCREENINFO, &fb_var) == -1)
90 {
91- perror ("Error getting framebuffer info");
92+ perror ("Error getting variable framebuffer info");
93 goto fail;
94 }
95
96 if (fb_var.bits_per_pixel < 16)
97 {
98 fprintf(stderr,
99- "Error, no support currently for %i bpp frame buffers\n",
100+ "Error, no support currently for %i bpp frame buffers\n"
101+ "Trying to change pixel format...\n",
102 fb_var.bits_per_pixel);
103+ if (!attempt_to_change_pixel_format (fb, &fb_var))
104+ goto fail;
105 }
106
107+ /* NB: It looks like the fbdev concept of fixed vs variable screen info is
108+ * broken. The line_length is part of the fixed info but it can be changed
109+ * if you set a new pixel format. */
110+ if (ioctl (fb->fd, FBIOGET_FSCREENINFO, &fb_fix) == -1)
111+ {
112+ perror ("Error getting fixed framebuffer info");
113+ goto fail;
114+ }
115+
116 fb->real_width = fb->width = fb_var.xres;
117 fb->real_height = fb->height = fb_var.yres;
118 fb->bpp = fb_var.bits_per_pixel;
119Index: psplash.c
120===================================================================
121--- psplash.c (revision 376)
122+++ psplash.c (working copy)
123@@ -286,3 +286,4 @@
124
125 return 0;
126 }
127+
diff --git a/meta/packages/psplash/psplash_svn.bb b/meta/packages/psplash/psplash_svn.bb
index 825dc1dbca..30626ea954 100644
--- a/meta/packages/psplash/psplash_svn.bb
+++ b/meta/packages/psplash/psplash_svn.bb
@@ -2,9 +2,11 @@ DESCRIPTION = "Userspace framebuffer boot logo based on usplash."
2SECTION = "base" 2SECTION = "base"
3LICENSE = "GPL" 3LICENSE = "GPL"
4PV = "0.0+svnr${SRCREV}" 4PV = "0.0+svnr${SRCREV}"
5PR = "r1"
5 6
6SRC_URI = "svn://svn.o-hand.com/repos/misc/trunk;module=psplash;proto=http \ 7SRC_URI = "svn://svn.o-hand.com/repos/misc/trunk;module=psplash;proto=http \
7 file://psplash-init" 8 file://psplash-init \
9 file://psplash-fbdev-pixfmt.patch;patch=1;pnum=0"
8 10
9S = "${WORKDIR}/psplash" 11S = "${WORKDIR}/psplash"
10 12