Re: ts_calibrate with 18bpp screen

Sergey Alyoshin <[email protected]>
Newsgroups gmane.linux.ports.arm.general
Message-ID <[email protected]>
On Thu, Nov 19, 2009 at 2:57 PM, Patrick <[email protected]> wrote:
> Hello all,
>
> ts_calibrate (package from angstöm) doesn't work with 18bpp screen. The screen is always black and the little white cross doesn't appear. I think it's because pixel coding format.
>
> Is there a special version of ts_calibrate, or a patch, to work with 18bpp screen ?
>

# This patch allow ts_calibrate and ts_test from tslib
# to show on 18/24 bpp (bits_per_pixel/nonstd).

diff -ur tslib-0.0.2.orig/tests/fbutils.c tslib-0.0.2/tests/fbutils.c
--- tslib-0.0.2.orig/tests/fbutils.c	2004-10-20 02:01:27.000000000 +0400
+++ tslib-0.0.2/tests/fbutils.c	2008-09-26 11:56:19.000000000 +0400
@@ -135,7 +135,7 @@
 	}
 	memset(fbuffer,0,fix.smem_len);

-	bytes_per_pixel = (var.bits_per_pixel + 7) / 8;
+	bytes_per_pixel = (var.nonstd ? var.nonstd : var.bits_per_pixel + 7) / 8;
 	line_addr = malloc (sizeof (__u32) * var.yres_virtual);
 	addr = 0;
 	for (y = 0; y < var.yres_virtual; y++, addr += fix.line_length)
@@ -247,6 +247,7 @@
         	        perror("ioctl FBIOPUTCMAP");
 		break;
 	case 2:
+	case 3:
 	case 4:
 		red = (value >> 16) & 0xff;
 		green = (value >> 8) & 0xff;
@@ -274,6 +275,17 @@
 		else
 			*loc.p16 = color;
 		break;
+	case 3:
+		if (xormode) {
+			*loc.p8 ^= color;
+			*(loc.p8 + 1) ^= color>>8;
+			*(loc.p8 + 2) ^= color>>16;
+		} else {
+			*loc.p8 = color;
+			*(loc.p8 + 1) = color>>8;
+			*(loc.p8 + 2) = color>>16;
+		}
+		break;
 	case 4:
 		if (xormode)
 			*loc.p32 ^= color;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.