aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/psplash/files/psplash-18bpp.patch
blob: 36ab43bf7891b1b784482d9251ac76c12e19d531 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
upstream: http://bugzilla.o-hand.com/show_bug.cgi?id=1764

---
 psplash-fb.c |    8 +++++++-
 psplash-fb.h |    1 +
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/psplash-fb.c b/psplash-fb.c
index 71740cd..860c0c0 100644
--- a/psplash-fb.c
+++ b/psplash-fb.c
@@ -160,6 +160,7 @@ psplash_fb_new (int angle)
   fb->real_width  = fb->width  = fb_var.xres;
   fb->real_height = fb->height = fb_var.yres;
   fb->bpp    = fb_var.bits_per_pixel;
+  fb->depth  = fb_var.red.length + fb_var.green.length + fb_var.blue.length;
   fb->stride = fb_fix.line_length;
   fb->type   = fb_fix.type;
   fb->visual = fb_fix.visual;
@@ -308,7 +309,7 @@ psplash_fb_plot_pixel (PSplashFB    *fb,
         break;
       }
   } else if (fb->rgbmode == BGR565 || fb->rgbmode == BGR888) {
-    switch (fb->bpp)
+    switch (fb->depth)
       {
       case 24:
       case 32:
@@ -316,6 +317,11 @@ psplash_fb_plot_pixel (PSplashFB    *fb,
         *(fb->data + off + 1) = green;
         *(fb->data + off + 2) = blue;
         break;
+      case 18:
+        *(fb->data + off)     = (red >> 2) | ((green & 0x0C) << 4);
+        *(fb->data + off + 1) = ((green & 0xF0) >> 4) | ((blue & 0x3C) << 2);
+        *(fb->data + off + 2) = (blue & 0xC0) >> 6;
+        break;
       case 16:
         *(volatile uint16_t *) (fb->data + off)
 	  = ((blue >> 3) << 11) | ((green >> 2) << 5) | (red >> 3);
diff --git a/psplash-fb.h b/psplash-fb.h
index ef5b39e..160cdeb 100644
--- a/psplash-fb.h
+++ b/psplash-fb.h
@@ -34,6 +34,7 @@ typedef struct PSplashFB
   int            visual;		
   int            width, height;
   int            bpp;
+  int            depth;
   int            stride;
   char		*data;
   char		*base;
-- 
1.6.3.3