SOURCES: fbterm-directcolor.patch (NEW) - fix colours on ATI cards (DIRECTC...

witekfl witekfl at pld-linux.org
Mon Dec 15 20:22:45 CET 2008


Author: witekfl                      Date: Mon Dec 15 19:22:45 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- fix colours on ATI cards (DIRECTCOLOR).

---- Files affected:
SOURCES:
   fbterm-directcolor.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/fbterm-directcolor.patch
diff -u /dev/null SOURCES/fbterm-directcolor.patch:1.1
--- /dev/null	Mon Dec 15 20:22:46 2008
+++ SOURCES/fbterm-directcolor.patch	Mon Dec 15 20:22:39 2008
@@ -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);
++		}
+ 	}
+ }
+ 
================================================================


More information about the pld-cvs-commit mailing list