]> git.pld-linux.org Git - packages/fbterm.git/commitdiff
- fix colours on ATI cards (DIRECTCOLOR).
authorwitekfl <witekfl@pld-linux.org>
Mon, 15 Dec 2008 19:22:39 +0000 (19:22 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    fbterm-directcolor.patch -> 1.1

fbterm-directcolor.patch [new file with mode: 0644]

diff --git a/fbterm-directcolor.patch b/fbterm-directcolor.patch
new file mode 100644 (file)
index 0000000..f64c9d0
--- /dev/null
@@ -0,0 +1,82 @@
+--- fbterm-1.2/src/screen.cpp.old      2008-12-15 20:27:32.000000000 +0100
++++ fbterm-1.2/src/screen.cpp  2008-12-15 20:31:55.000000000 +0100
+@@ -184,8 +184,6 @@ void Screen::switchVc(bool enter)
+ void Screen::setupSysPalette(bool restore)
+ {
+-      if (vinfo.bits_per_pixel != 8) return;
+-
+       static bool palette_saved = false;
+       static u16 saved_red[NR_COLORS], saved_green[NR_COLORS], saved_blue[NR_COLORS];
+       fb_cmap cmap;
+@@ -212,17 +210,62 @@ void Screen::setupSysPalette(bool restor
+                       INIT_CMAP(saved_red, saved_green, saved_blue);
+                       ioctl(mFd, FBIOGETCMAP, &cmap);
+               }
++              if (finfo.visual == FB_VISUAL_DIRECTCOLOR && vinfo.bits_per_pixel != 8) {
++                      u16 *red, *green, *blue;
++                      int rcols = 1 << vinfo.red.length;
++                      int gcols = 1 << vinfo.green.length;
++                      int bcols = 1 << vinfo.blue.length;
++  
++                      /* Make our palette the length of the deepest color */
++                      int cols = (rcols > gcols ? rcols : gcols);
++                      cols = (cols > bcols ? cols : bcols);
++  
++                      red = new u16[cols];
++                      if (!red)
++                              return;
++                      for (int i = 0; i < rcols; i++)
++                              red[i] = (65535 / (rcols - 1)) * i;
++  
++                      green = new u16[cols];
++                      if (!green) {
++                              delete[] red;
++                              return;
++                      }
++                      for (int i = 0; i < gcols; i++)
++                              green[i] = (65535 / (gcols - 1)) * i;
++  
++                      blue = new u16[cols];
++                      if (!blue) {
++                              delete[] red;
++                              delete[] green;
++                              return;
++                      }
++                      for (int i = 0; i < bcols; i++)
++                              blue[i] = (65535 / (bcols - 1)) * i;
++  
++                      cmap.start = 0;
++                      cmap.len = cols;
++                      cmap.red = red;
++                      cmap.blue = blue;
++                      cmap.green = green;
++                      cmap.transp = NULL;
++                      ioctl(mFd, FBIOPUTCMAP, &cmap);
++                      delete[] red;
++                      delete[] blue;
++                      delete[] green;
+-              u16 red[NR_COLORS], green[NR_COLORS], blue[NR_COLORS];
++              } else {
++                      u16 red[NR_COLORS], green[NR_COLORS], blue[NR_COLORS];
+-              for (u32 i = 0; i < NR_COLORS; i++) {
+-                      red[i] = palette[i].red << 8 | palette[i].red;
+-                      green[i] = palette[i].green << 8 | palette[i].green;
+-                      blue[i] = palette[i].blue << 8 | palette[i].blue;
+-              }
++                      for (u32 i = 0; i < NR_COLORS; i++) {
++                              red[i] = palette[i].red << 8 | palette[i].red;
++                              green[i] = palette[i].green << 8 | palette[i].green;
++                              blue[i] = palette[i].blue << 8 | palette[i].blue;
++                      }
+-              INIT_CMAP(red, green, blue);
+-              ioctl(mFd, FBIOPUTCMAP, &cmap);
++                      INIT_CMAP(red, green, blue);
++                      ioctl(mFd, FBIOPUTCMAP, &cmap);
++              }
+       }
+ }
This page took 0.095367 seconds and 4 git commands to generate.