Thanks for the detailed explanation. I tried generating two windows and draw on the second window in displays ':2.0' and ':2.1'. This makes the window id used for rendering different from the windows in displays ':1.0' and ':1.1'. And it works! The function glXMakeCurrent() does not crash, and the rendering also seems to be correct.
I looked into the source code of GLX, and I cannot find any clue that the same window id will cause this function to crash with a segmentation fault. Could it be possible that it is a bug in the graphics driver? Yu Sheng On Wed, Mar 4, 2009 at 11:04 PM, Glynn Clements <[email protected]> wrote: > > Sheng Yu wrote: > >> I have been tracking for a bug that makes my program crashing when >> calling function glXMakeCurrent. >> My program runs with multi-displays, ':0.0', ':1.0', ':1.1', ':2.0', >> ':2.1'. When glXMakeCurrent() is called >> to switch rendering context from ':0.0' to either ':1.0', ':1.1' or >> ':2.0', ':2.1', the program runs fine. >> However, if the rendering context is switch from ':1.1' to ':2.0', >> the program crashes with with a >> segmentation fault. >> >> The interesting thing I found when debugging is the window ID and >> root window ID for each display: >> display:':0.0',screen: 0, root window id: 315, window id: 71303171 >> display:':1.0',screen: 0, root window id: 595, window id: 2097156 >> display:':1.1',screen: 1, root window id: 597, window id: 4194308 >> display:':2.0',screen: 0, root window id: 595, window id: 2097156 >> display:':2.1',screen: 1, root window id: 597, window id: 4194308 >> >> It seems that X Server 1 and 2 assign window ID with the same >> strategy, which is different from X Server 0. >> I am wondering whether it is causing the crashing, which indicates >> problems in X Server settings. I have >> been digging into the source of X Server and I cannot find how the >> window ID is assigned. Could someone >> tell me which file I should look into? Thanks a lot! > > The X server doesn't assign individual XIDs (except for resources > which are created internally by the server, e.g. the root window). > Each client is assigned a block of XIDs upon connection, and the > client (i.e. Xlib) allocates XIDs from this block. > > It would be more clear if you print the XIDs in hexadecimal: > > display:':0.0',screen: 0, root window id: 13b, window id: 4400003 > display:':1.0',screen: 0, root window id: 253, window id: 200004 > display:':1.1',screen: 1, root window id: 255, window id: 400004 > display:':2.0',screen: 0, root window id: 253, window id: 200004 > display:':2.1',screen: 1, root window id: 255, window id: 400004 > > The most significant 11 bits of the XID indicate the client, leaving > 21 bits for each client, giving each client 2^21 (= 2,097,152) XIDs. > > In any case, I doubt that this has anything to do with your problems > with OpenGL. > > -- > Glynn Clements <[email protected]> > _______________________________________________ xorg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xorg
