nanogui: Thread: vnc for nano-X question


[<<] [<] Page 1 of 1 [>] [>>]
Subject: vnc for nano-X question
From: "LC. Chang" ####@####.####
Date: 21 Feb 2001 02:37:55 -0000
Message-Id: <3A932B5F.42A58E8C@sis.com.tw>

Hi,

I am using vnc in microwin0.89pre7 under linux framebuffer.
The color is ok with 8bpp but vnc seems to change the color palette
so that the background and other apps get wrong colors.
When it runs with 16bpp, vnc gets wrong colors even when I adjust
the RGB Max & Shift to RGB565 for client. Do you know where
the problem is?


thanks,
L.C. Chang

Subject: Re: vnc for nano-X question
From: "Greg Haerr" ####@####.####
Date: 21 Feb 2001 17:27:00 -0000
Message-Id: <021c01c09c2b$ef2ffc00$15320cd0@gregh>

: I am using vnc in microwin0.89pre7 under linux framebuffer.
: The color is ok with 8bpp but vnc seems to change the color palette
: so that the background and other apps get wrong colors.
: When it runs with 16bpp, vnc gets wrong colors even when I adjust
: the RGB Max & Shift to RGB565 for client. Do you know where
: the problem is?

Yes, the problem is in the vnc port to Microwindows,
support for 16bpp has not been finished.  Why don't you
look into it at microwin/src/demos/nanox/vnc.  It shouldn't
be too much work.

Regards,

Greg

Subject: Re: vnc for nano-X question
From: George Harvey ####@####.####
Date: 22 Feb 2001 22:31:13 -0000
Message-Id: <yam8453.1731.139958296@smtp.dial.pipex.com>

On 21-Feb-01, Greg Haerr wrote:
> 
> : I am using vnc in microwin0.89pre7 under linux framebuffer.
> : The color is ok with 8bpp but vnc seems to change the color palette
> : so that the background and other apps get wrong colors.
> : When it runs with 16bpp, vnc gets wrong colors even when I adjust
> : the RGB Max & Shift to RGB565 for client. Do you know where
> : the problem is?
> 
> Yes, the problem is in the vnc port to Microwindows,
> support for 16bpp has not been finished.  Why don't you
> look into it at microwin/src/demos/nanox/vnc.  It shouldn't
> be too much work.

There is version of the VNC viewer with much improved colour support on
my web site. I did the work on 0.88 final so it may need tweaking for
0.89pre7. I am currently occupied with a uClinux kernel port so further
VNC development is on hold. I hope to get back to it eventually but if
anyone else wants to pick it up in the meantime, please go ahead.

Look for nx-vnc332-250800.tar.gz at:
http://dspace.dial.pipex.com/town/way/fr30/uclinux/downloads/contents.shtml

Regards,
George


Subject: Re: vnc for nano-X question
From: "Greg Haerr" ####@####.####
Date: 23 Feb 2001 03:47:54 -0000
Message-Id: <045401c09d4b$deaa88c0$15320cd0@gregh>

: There is version of the VNC viewer with much improved colour support on
: my web site. I did the work on 0.88 final so it may need tweaking for
: 0.89pre7. I am currently occupied with a uClinux kernel port so further
: VNC development is on hold. I hope to get back to it eventually but if
: anyone else wants to pick it up in the meantime, please go ahead.
: 
: Look for nx-vnc332-250800.tar.gz at:
: http://dspace.dial.pipex.com/town/way/fr30/uclinux/downloads/contents.shtml


George,
    Thanks for the update.  I'll make sure I add this to the tree!

Regards,

Greg

Subject: Re: vnc for nano-X question
From: "LC. Chang" ####@####.####
Date: 26 Feb 2001 02:08:16 -0000
Message-Id: <3A99BC9C.620E9A9D@sis.com.tw>

>
> There is version of the VNC viewer with much improved colour support on
> my web site. I did the work on 0.88 final so it may need tweaking for
> 0.89pre7. I am currently occupied with a uClinux kernel port so further
> VNC development is on hold. I hope to get back to it eventually but if
> anyone else wants to pick it up in the meantime, please go ahead.
>
> Look for nx-vnc332-250800.tar.gz at:
> http://dspace.dial.pipex.com/town/way/fr30/uclinux/downloads/contents.shtml
>
> Regards,
> George
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####

Thanks for your help. I have download your version and run with
microwin0.89pre7. There is something to fix before it can run and I
attached the patch here. I can see you use FindBestVisual() to match
the RGB setting between client and server. Unfortunately it did not
work on my linux framebuffer with 16bpp. I have tried several setting
myself but it just doesn't show the right color (seems to losing blue value).
I think I should do further debug on RFB messages.

Regards,
L.C. Chang

diff -urN vnc/vncviewer/nanox.c vnc.fix/vncviewer/nanox.c
--- vnc/vncviewer/nanox.c	Sat Aug 26 06:06:03 2000
+++ vnc.fix/vncviewer/nanox.c	Mon Feb 26 09:41:42 2001
@@ -124,6 +124,7 @@
 	}
 	nx_dpy.fd = fd;
 	dpy = &nx_dpy;
+	GrGetScreenInfo(&si);
 
 #if 0
 	printf("CreateXWindow: calling FindBestVisual\n");	/* DEBUG */
Subject: Re: vnc for nano-X question
From: George Harvey ####@####.####
Date: 27 Feb 2001 21:40:01 -0000
Message-Id: <yam8458.612.144961144@smtp.dial.pipex.com>

Hello LC.

On 26-Feb-01, LC. Chang wrote:
>> 
[ snip ]

> Thanks for your help. I have download your version and run with
> microwin0.89pre7. There is something to fix before it can run and I
> attached the patch here. I can see you use FindBestVisual() to match
> the RGB setting between client and server. Unfortunately it did not
> work on my linux framebuffer with 16bpp. I have tried several setting
> myself but it just doesn't show the right color (seems to losing blue
> value). I think I should do further debug on RFB messages.

I didn't have a Linux framebuffer to test with at the time so I hacked
together a quick framebuffer interface for NetBSD-Amiga. It shouldn't
make a difference but the possibility is there. There is also an
interaction with the resolution of the VNC server, which server are
you using and at what colour depth?

I am in the process of building a new, faster, Linux box for cross-
compiling uClinux kernels. It has a chipset which supports VESA 2.0
modes so I will have another look at VNC and see how it behaves
with the Linux framebuffer.

Regards,
George


Subject: Re: vnc for nano-X question
From: George Harvey ####@####.####
Date: 1 Mar 2001 20:46:57 -0000
Message-Id: <yam8460.381.147595064@smtp.dial.pipex.com>

Hello George

On 27-Feb-01, George Harvey wrote:
> Hello LC.
> 
> On 26-Feb-01, LC. Chang wrote:
>>> 
> [ snip ]
> 
[ another snip ]

> I am in the process of building a new, faster, Linux box for cross-
> compiling uClinux kernels. It has a chipset which supports VESA 2.0
> modes so I will have another look at VNC and see how it behaves
> with the Linux framebuffer.

Following up my own post...

I've now tried VNC on a 16-bit Linux framebuffer, with a 16-bit Xvnc
server, and the colours are indeed wrong. Running on NetBSD-Amiga,
with a Picasso-II graphics card and my hacked-together driver, the
colours are correct. My guess is that there is a byte-ordering
problem somewhere (the Amiga is big-endian, PCs are little-endian).
Unfortunately, the hard disk in my new Linux box seems to have died
after only a couple of days use so I won't be able to investigate
any further for a while :-(

Regards,
George


Subject: Re: vnc for nano-X question
From: George Harvey ####@####.####
Date: 6 Mar 2001 21:42:19 -0000
Message-Id: <yam8465.341.144165648@smtp.dial.pipex.com>

On 01-Mar-01, George Harvey wrote:

[ snip ].

> I've now tried VNC on a 16-bit Linux framebuffer, with a 16-bit Xvnc
> server, and the colours are indeed wrong. Running on NetBSD-Amiga,
> with a Picasso-II graphics card and my hacked-together driver, the
> colours are correct. My guess is that there is a byte-ordering
> problem somewhere (the Amiga is big-endian, PCs are little-endian).
> Unfortunately, the hard disk in my new Linux box seems to have died
> after only a couple of days use so I won't be able to investigate
> any further for a while :-(

Well, after a new hard disk, re-install, rebuild, etc. I've had
another look and it seems that I'm still not correctly matching
the server and client pixel formats in FindBestVisual(). However,
there is a quick fix for 16-bit truecolour on Linux, start the
vnc viewer as follows:

  vnc -trucolour -depth 16 <hostname:n>

where <hostname> is the name of the VNC server and <n> is the
display number. I've tried this with a 16-bit Xvnc server and
with nano-X running on a 16-bit Linux framebuffer, and the 
colours look OK.

Note: this only works with the updated viewer from my web site.
For those who missed the earlier post, get:

nx-vnc332-250800.tar.gz from
http://dspace.dial.pipex.com/town/way/fr30/uclinux/downloads/contents.shtml

Regards,
George


Subject: Re: vnc for nano-X question
From: "LC. Chang" ####@####.####
Date: 7 Mar 2001 07:11:19 -0000
Message-Id: <3AA5E14E.ECBADA8D@sis.com.tw>

Hi,

I have tried your vnc viewer but it did not work for me.
We find the problem is caused by using GrSetGCForeground().
The color format needs to be transformed before calling it.
I have modified the source from microwin0.89pre7 and it
now works fine. The attached patch is the modification we made.

Regards,
L.C. Chang


> Well, after a new hard disk, re-install, rebuild, etc. I've had
> another look and it seems that I'm still not correctly matching
> the server and client pixel formats in FindBestVisual(). However,
> there is a quick fix for 16-bit truecolour on Linux, start the
> vnc viewer as follows:
>
>   vnc -trucolour -depth 16 <hostname:n>
>
> where <hostname> is the name of the VNC server and <n> is the
> display number. I've tried this with a 16-bit Xvnc server and
> with nano-X running on a 16-bit Linux framebuffer, and the
> colours look OK.
>
> Note: this only works with the updated viewer from my web site.
> For those who missed the earlier post, get:
>
> nx-vnc332-250800.tar.gz from
> http://dspace.dial.pipex.com/town/way/fr30/uclinux/downloads/contents.shtml
>
> Regards,
> George
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####

diff -urN vnc/vncviewer/nanox.c vnc.new/vncviewer/nanox.c
--- vnc/vncviewer/nanox.c	Sun Jun 18 12:20:14 2000
+++ vnc.new/vncviewer/nanox.c	Wed Mar  7 14:54:00 2001
@@ -46,6 +46,19 @@
 #define INVALID_PIXEL 0xffffffff
 #define COLORMAP_SIZE 256
 
+/* create RGB colorval (0x00BBGGRR) from 8/8/8 format pixel*/
+#define PIXEL888TOCOLORVAL(p)   \
+        ((((p) & 0xff0000) >> 16) | ((p) & 0xff00) | (((p) & 0xff) << 16))
+
+/* create RGB colorval (0x00BBGGRR) from 5/6/5 format pixel*/
+#define PIXEL565TOCOLORVAL(p)   \
+        ((((p) & 0xf800) >> 8) | (((p) & 0x07e0) << 5) | (((p) & 0x1f) << 19))
+
+/* create BGR colorval (0x00BBGGRR) from 2/3/3 format pixel*/
+#define PIXEL233TOCOLORVAL(p)   \
+        ((((p) & 0x07) << 5) | (((p) & 0x38) << 10) | (((p) & 0x0c) << 16))
+
+
 /*
  * global data
  */
@@ -125,11 +138,31 @@
 	myFormat.bigEndian = 0;		/* how do I find this out? */
 	myFormat.trueColour = (myFormat.depth == 8 && !useBGR233) ? 0 : 1;
 	if (myFormat.trueColour) {
-		myFormat.redMax = myFormat.greenMax = 7;
-		myFormat.blueMax = 3;
-		myFormat.redShift = 0;
-		myFormat.greenShift = 3;
-		myFormat.blueShift = 6;
+		switch (myFormat.bitsPerPixel) {
+		case 8:
+			myFormat.redMax = myFormat.greenMax = 7;
+			myFormat.blueMax = 3;
+			myFormat.redShift = 0;
+			myFormat.greenShift = 3;
+			myFormat.blueShift = 6;
+			break;
+		case 16:
+			myFormat.redMax = 31;
+			myFormat.greenMax = 63;
+			myFormat.blueMax = 31;
+			myFormat.redShift = 11;
+			myFormat.greenShift = 5;
+			myFormat.blueShift = 0;
+			break;
+		case 32:
+			myFormat.redMax = 255;
+			myFormat.greenMax = 255;
+			myFormat.blueMax = 255;
+			myFormat.redShift = 16;
+			myFormat.greenShift = 8;
+			myFormat.blueShift = 0;
+
+		}
 	}
 	pixtype = si.pixtype;
 	/* get the initial server palette */
@@ -155,6 +188,7 @@
 	GrSelectEvents(wid, GR_EVENT_MASK_BUTTON_DOWN |
 		GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_KEY_DOWN |
 		GR_EVENT_MASK_KEY_UP | GR_EVENT_MASK_MOUSE_POSITION);
+
 	/* make thw window visible */
 	GrMapWindow(wid);
 	canvas = wid;
@@ -202,7 +236,7 @@
 XCopyArea(Display *dpy, Window src, Window dst, GR_GC_ID gc,
         int x1, int y1, int w, int h, int x2, int y2)
 {
-/*	printf("XCopyArea: src=%d, dst=%d, w=%d, h=%d\n",src, dst, w, h); */
+//	printf("XCopyArea: src=%d, dst=%d, w=%d, h=%d\n",src, dst, w, h); 
 	GrCopyArea(dst, gc, x2, y2, w, h, src, x1, y1, MWROP_SRCCOPY);
 	return(0);
 }
@@ -215,7 +249,7 @@
         int x, int y, int w, int h)
 {
 	GrFillRect(canvas, gc, x, y, w, h);
-/*	printf("XFillRectangle: gr_foreground=%08x\n", (int)gr_foreground); */
+//	printf("XFillRectangle: gr_foreground=%08x\n", (int)gr_foreground); 
 	return(0);
 }
 
@@ -245,7 +279,17 @@
 		 */
 		GrSetGCForeground(gc, gcv->foreground | MWF_PALINDEX);
 	} else {
-		GrSetGCForeground(gc, gcv->foreground);
+            switch (myFormat.bitsPerPixel) {
+            
+            case 8:
+            	    GrSetGCForeground(gc, PIXEL233TOCOLORVAL(gcv->foreground));
+            	    break;
+            case 16:
+		    GrSetGCForeground(gc, PIXEL565TOCOLORVAL(gcv->foreground));
+		    break;
+	    case 32:
+	    	    GrSetGCForeground(gc, PIXEL888TOCOLORVAL(gcv->foreground));
+	    }
 	}
         return(0);
 }
[<<] [<] Page 1 of 1 [>] [>>]


Powered by ezmlm-browse 0.20.