[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freedesktop-xorg
Subject:    =?utf-8?B?UmU6IFgxMSBDb2xvciBNYXAgY3JlYXRpb24gcHJvYmxlbSwgWEFsbG9jQ29sb3JDZWxscyBjYWxsIHRocm93IEJhZF
From:       "Subrata Dasgupta" <subrata_usha () rediffmail ! com>
Date:       2017-04-19 4:12:34
Message-ID: 1492439031.S.9890.15395.f5-224-107.1492575154.7914 () webmail ! rediffmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Thomas ,

Yes both npixels and coffset are zero on vnc. Do you think this is the root cause of \
the problem ?? If yes then what should be the correct value of npixels ??

Thanks
Subrata



On Mon, 17 Apr 2017 19:53:51 +0530 Thomas Lübking  wrote
> looks like npixels is coffset is 0 on vnc, right?



On Mon, Apr 10, 2017 at 09:48:48AM -0000, Subrata Dasgupta wrote:

> Hello All,

> I have an 32 bit X11 application running on RHEL 7 and use libX11-1.6.3-2.el7.i686 \
> rpm X11 library. This application is facing problem while creating its own color \
> map. Please suggest what changes need to be made in the following code to make it \
> workable.

> 

> This X11 application is getting BadValue error while calling XAllocColorCells \
> function when I run the application from VNC. But it is working properly on Citrix. \
> Application tries to create a new color map by calling XCreateColormap.

> 

> From the gdb debugging I can see two major difference in Xlibrary call behavior \
> between VNC and Citrix.

> 

> 1> XDisplayCells return values are different . on VNC XDisplayCells returns 64 but \
> on Citrix client it return 256.

> 

> 2> On VNC the XCreateColormap call is returning a bigger color map ID (compared \
> with Citrix client) which maybe out of range and so bad value error occur.

> For VNC XCreateColormap return 37748737 but for Citrix it return 8388609.

> 

> I am not sure how to use Xlibrary to create color map for different X clients. \
> Please help.

> 

> Below is the high level code of the color map creation…

> 

> void createColormap(Display *display)

> {

> int i, n, snr, coffset, ncolors;

> Display *dnr;

> XColor dcolors[256];

> Window win;

> Colormap colormap0, colormap1;

> Visual *vis;

> 

> win = DefaultRootWindow(display);

> ncolors = XDisplayCells(display, DefaultScreen(display));  // Return 64 on VNC ,and \
> 256 for Citrix.

> dnr = display;

> snr = XDefaultScreen(display);

> colormap0 = DefaultColormap(dnr,snr);

> colormap = colormap0;

> 

> if(ncolors > 256) {

> return;

> }

> if(ncolors > 2) {

> 

> vis = XDefaultVisual(dnr, XDefaultScreen(dnr));

> if(vis == NULL) {

> return;

> }

> 

> //----------------------------------------- portion between this dotted lines do \
> not execute on VNC as ncolors =64 and thus coffset =0 \
> -------------------------------------------------------- //

> if(ncolors > 16) {

> if(ncolors > 128) {

> coffset = 32;

> } else {

> coffset = 0;

> }

> } else {

> coffset = 0;

> }

> if(coffset > ncolors) {

> coffset = 0;

> }

> n = ncolors - coffset;

> 

> for(i=0; i dcolors[i].pixel = i;

> XQueryColor(dnr, colormap0, &(dcolors[i]));

> dcolors[i].flags = DoRed | DoGreen | DoBlue;

> }

> //----------------------------------------- portion between this dotted lines do \
> not execute on VNC as ncolors =64 and thus coffset =0 \
> -------------------------------------------------------- //

> 

> 

> colormap1 = XCreateColormap(dnr, win, vis, AllocNone); // This line execute on \
> both. Returns 37748737 for VNC but 8388609 Citrix.

> if(colormap1 == colormap) {

> return;

> }

> 

> //============================ portion between this dotted lines do not execute on \
> VNC as ncolors < 256 and coffset < 128 ========================== //

> if(ncolors >= 256 && coffset < 128) {

> int r, g, b;

> for(r=0; r < 4; r++) {

> for(g=0; g < 4; g++) {

> for(b=0; b < 4; b++) {

> dcolors[coffset].pixel = coffset;

> dcolors[coffset].flags = DoRed | DoGreen | DoBlue;

> dcolors[coffset].red = (short) (r * 21845);

> dcolors[coffset].green = (short) (g * 21845);

> dcolors[coffset].blue = (short) (b * 21845);

> coffset++;

> if(coffset >= 256) break;

> }

> if(coffset >= 256) break;

> }

> if(coffset >= 256) break;

> }

> }

> //============================ portion between this dotted lines do not execute on \
> VNC as ncolors < 256 and coffset < 128 ========================== //

> 

> unsigned long plane_masks_return[1];

> unsigned int nplanes= 0;

> unsigned long pixels_return[256];

> unsigned int npixels = coffset;

> int status;

> status = XAllocColorCells(dnr, colormap1, True, plane_masks_return, nplanes, \
> pixels_return, npixels); //this call throw BadValue error.

> if(status == 0) {

> return;

> } else {

> XStoreColors(dnr, colormap1, &(dcolors[0]), coffset);

> colormap = colormap1;

> }

> }

> }

> 

> Thanks

> Subrata



> _______________________________________________

> xorg@lists.x.org: X.Org support

> Archives: http://lists.freedesktop.org/archives/xorg

> Info: https://lists.x.org/mailman/listinfo/xorg

> Your subscription address: %(user_address)s



_______________________________________________

xorg@lists.x.org: X.Org support

Archives: http://lists.freedesktop.org/archives/xorg

Info: https://lists.x.org/mailman/listinfo/xorg

Your subscription address: %(user_address)s


[Attachment #5 (unknown)]

<br />
Hi Thomas ,<br />
<br />
Yes both npixels and coffset are zero on vnc. Do you think this is the root cause of \
the problem ?? If yes then what should be the correct value of npixels ??<br /> <br \
/> Thanks<br />
Subrata<br />
<br />
<br />
<br />
On Mon, 17 Apr 2017 19:53:51 +0530 Thomas Lübking <thomas.luebking@gmx.de> wrote<br \
/>
> looks like npixels is coffset is 0 on vnc, right?<br />
<br />
<br />
<br />
On Mon, Apr 10, 2017 at 09:48:48AM -0000, Subrata Dasgupta wrote:<br />
<br />
> Hello All,<br />
<br />
> I have an 32 bit X11 application running on RHEL 7 and use libX11-1.6.3-2.el7.i686 \
> rpm X11 library. This application is facing problem while creating its own color \
> map. Please suggest what changes need to be made in the following code to make it \
> workable.<br />
<br />
> <br />
<br />
> This X11 application is getting BadValue error while calling XAllocColorCells \
> function when I run the application from VNC. But it is working properly on Citrix. \
> Application tries to create a new color map by calling XCreateColormap.<br />
<br />
> <br />
<br />
> From the gdb debugging I can see two major difference in Xlibrary call behavior \
> between VNC and Citrix.<br />
<br />
> <br />
<br />
> 1> XDisplayCells return values are different . on VNC XDisplayCells returns 64 but \
> on Citrix client it return 256.<br />
<br />
> <br />
<br />
> 2> On VNC the XCreateColormap call is returning a bigger color map ID (compared \
> with Citrix client) which maybe out of range and so bad value error occur.<br />
<br />
> For VNC XCreateColormap return 37748737 but for Citrix it return 8388609.<br />
<br />
> <br />
<br />
> I am not sure how to use Xlibrary to create color map for different X clients. \
> Please help.<br />
<br />
> <br />
<br />
> Below is the high level code of the color map creation…<br />
<br />
> <br />
<br />
> void createColormap(Display *display)<br />
<br />
> {<br />
<br />
> int i, n, snr, coffset, ncolors;<br />
<br />
> Display *dnr;<br />
<br />
> XColor dcolors[256];<br />
<br />
> Window win;<br />
<br />
> Colormap colormap0, colormap1;<br />
<br />
> Visual *vis;<br />
<br />
> <br />
<br />
> win = DefaultRootWindow(display);<br />
<br />
> ncolors = XDisplayCells(display, DefaultScreen(display));  // Return 64 on VNC ,and \
> 256 for Citrix.<br />
<br />
> dnr = display;<br />
<br />
> snr = XDefaultScreen(display);<br />
<br />
> colormap0 = DefaultColormap(dnr,snr);<br />
<br />
> colormap = colormap0;<br />
<br />
> <br />
<br />
> if(ncolors > 256) {<br />
<br />
> return;<br />
<br />
> }<br />
<br />
> if(ncolors > 2) {<br />
<br />
> <br />
<br />
> vis = XDefaultVisual(dnr, XDefaultScreen(dnr));<br />
<br />
> if(vis == NULL) {<br />
<br />
> return;<br />
<br />
> }<br />
<br />
> <br />
<br />
> //----------------------------------------- portion between this dotted lines do \
> not execute on VNC as ncolors =64 and thus coffset =0 \
> -------------------------------------------------------- //<br />
<br />
> if(ncolors > 16) {<br />
<br />
> if(ncolors > 128) {<br />
<br />
> coffset = 32;<br />
<br />
> } else {<br />
<br />
> coffset = 0;<br />
<br />
> }<br />
<br />
> } else {<br />
<br />
> coffset = 0;<br />
<br />
> }<br />
<br />
> if(coffset > ncolors) {<br />
<br />
> coffset = 0;<br />
<br />
> }<br />
<br />
> n = ncolors - coffset;<br />
<br />
> <br />
<br />
> for(i=0; i dcolors[i].pixel = i;<br />
<br />
> XQueryColor(dnr, colormap0, &(dcolors[i]));<br />
<br />
> dcolors[i].flags = DoRed | DoGreen | DoBlue;<br />
<br />
> }<br />
<br />
> //----------------------------------------- portion between this dotted lines do \
> not execute on VNC as ncolors =64 and thus coffset =0 \
> -------------------------------------------------------- //<br />
<br />
> <br />
<br />
> <br />
<br />
> colormap1 = XCreateColormap(dnr, win, vis, AllocNone); // This line execute on \
> both. Returns 37748737 for VNC but 8388609 Citrix.<br />
<br />
> if(colormap1 == colormap) {<br />
<br />
> return;<br />
<br />
> }<br />
<br />
> <br />
<br />
> //============================ portion between this dotted lines do not execute on \
> VNC as ncolors < 256 and coffset < 128 ========================== //<br />
<br />
> if(ncolors >= 256 && coffset < 128) {<br />
<br />
> int r, g, b;<br />
<br />
> for(r=0; r < 4; r++) {<br />
<br />
> for(g=0; g < 4; g++) {<br />
<br />
> for(b=0; b < 4; b++) {<br />
<br />
> dcolors[coffset].pixel = coffset;<br />
<br />
> dcolors[coffset].flags = DoRed | DoGreen | DoBlue;<br />
<br />
> dcolors[coffset].red = (short) (r * 21845);<br />
<br />
> dcolors[coffset].green = (short) (g * 21845);<br />
<br />
> dcolors[coffset].blue = (short) (b * 21845);<br />
<br />
> coffset++;<br />
<br />
> if(coffset >= 256) break;<br />
<br />
> }<br />
<br />
> if(coffset >= 256) break;<br />
<br />
> }<br />
<br />
> if(coffset >= 256) break;<br />
<br />
> }<br />
<br />
> }<br />
<br />
> //============================ portion between this dotted lines do not execute on \
> VNC as ncolors < 256 and coffset < 128 ========================== //<br />
<br />
> <br />
<br />
> unsigned long plane_masks_return[1];<br />
<br />
> unsigned int nplanes= 0;<br />
<br />
> unsigned long pixels_return[256];<br />
<br />
> unsigned int npixels = coffset;<br />
<br />
> int status;<br />
<br />
> status = XAllocColorCells(dnr, colormap1, True, plane_masks_return, nplanes, \
> pixels_return, npixels); //this call throw BadValue error.<br />
<br />
> if(status == 0) {<br />
<br />
> return;<br />
<br />
> } else {<br />
<br />
> XStoreColors(dnr, colormap1, &(dcolors[0]), coffset);<br />
<br />
> colormap = colormap1;<br />
<br />
> }<br />
<br />
> }<br />
<br />
> }<br />
<br />
> <br />
<br />
> Thanks<br />
<br />
> Subrata<br />
<br />
<br />
<br />
> _______________________________________________<br />
<br />
> xorg@lists.x.org: X.Org support<br />
<br />
> Archives: http://lists.freedesktop.org/archives/xorg<br />
<br />
> Info: https://lists.x.org/mailman/listinfo/xorg<br />
<br />
> Your subscription address: %(user_address)s<br />
<br />
<br />
<br />
_______________________________________________<br />
<br />
xorg@lists.x.org: X.Org support<br />
<br />
Archives: http://lists.freedesktop.org/archives/xorg<br />
<br />
Info: https://lists.x.org/mailman/listinfo/xorg<br />
<br />
Your subscription address: %(user_address)s<br />
<br>


[Attachment #6 (text/plain)]

_______________________________________________
xorg@lists.x.org: X.Org support
Archives: http://lists.freedesktop.org/archives/xorg
Info: https://lists.x.org/mailman/listinfo/xorg
Your subscription address: %(user_address)s

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic