geschrader geschrader@mediaone.net writes:
When X11DRV_XF86DGA2_CreatePalette( ) creates the palette used by X11DRV_DDHAL_DestroyPalette( ) and X11DRV_DDHAL_SetPalEntries( ), the display which is used is returned by thread_display( ). This patch makes these two functions also use thread_display( ) ( rather than gdi_display ). This bug was causing a BadColor (i.e. invalid colormap) error in the X server when X11DRV_DDHAL_SetPalEntries( ) was called, followed by an application crash.
I think it would be better to create the palette on the gdi_display, this way it can be manipulated by other threads too. Could you try if this works for you?
Index: dlls/x11drv/dga2.c =================================================================== RCS file: /opt/cvs-commit/wine/dlls/x11drv/dga2.c,v retrieving revision 1.5 diff -u -r1.5 dga2.c --- dlls/x11drv/dga2.c 2001/09/11 00:32:33 1.5 +++ dlls/x11drv/dga2.c 2001/11/07 20:28:34 @@ -174,8 +174,8 @@
static DWORD PASCAL X11DRV_XF86DGA2_CreatePalette(LPDDHAL_CREATEPALETTEDATA data) { - Display *display = thread_display(); - data->lpDDPalette->u1.dwReserved1 = TSXDGACreateColormap(display, DefaultScreen(display), dga_dev, AllocAll); + data->lpDDPalette->u1.dwReserved1 = TSXDGACreateColormap(gdi_display, DefaultScreen(gdi_display), + dga_dev, AllocAll); if (data->lpColorTable) X11DRV_DDHAL_SetPalEntries(data->lpDDPalette->u1.dwReserved1, 0, 256, data->lpColorTable); @@ -199,10 +199,9 @@
static DWORD PASCAL X11DRV_XF86DGA2_SetPalette(LPDDHAL_SETPALETTEDATA data) { - Display *display = thread_display(); if ((data->lpDDSurface == X11DRV_DD_Primary) && data->lpDDPalette && data->lpDDPalette->u1.dwReserved1) { - TSXDGAInstallColormap(display, DefaultScreen(display), data->lpDDPalette->u1.dwReserved1); + TSXDGAInstallColormap(gdi_display, DefaultScreen(gdi_display), data->lpDDPalette->u1.dwReserved1); } data->ddRVal = DD_OK; return DDHAL_DRIVER_HANDLED;
Alexandre Julliard wrote:
I think it would be better to create the palette on the gdi_display, this way it can be manipulated by other threads too. Could you try if this works for you?
Index: dlls/x11drv/dga2.c
RCS file: /opt/cvs-commit/wine/dlls/x11drv/dga2.c,v retrieving revision 1.5 diff -u -r1.5 dga2.c --- dlls/x11drv/dga2.c 2001/09/11 00:32:33 1.5 +++ dlls/x11drv/dga2.c 2001/11/07 20:28:34 @@ -174,8 +174,8 @@
static DWORD PASCAL
X11DRV_XF86DGA2_CreatePalette(LPDDHAL_CREATEPALETTEDATA data)
{
- Display *display = thread_display();
- data->lpDDPalette->u1.dwReserved1 = TSXDGACreateColormap(display,
DefaultScreen(display), dga_dev, AllocAll);
- data->lpDDPalette->u1.dwReserved1 =
TSXDGACreateColormap(gdi_display, DefaultScreen(gdi_display),
dga_dev,
AllocAll);
if (data->lpColorTable) X11DRV_DDHAL_SetPalEntries(data->lpDDPalette->u1.dwReserved1, 0, 256, data->lpColorTable); @@ -199,10 +199,9 @@
static DWORD PASCAL X11DRV_XF86DGA2_SetPalette(LPDDHAL_SETPALETTEDATA
data)
{
- Display *display = thread_display(); if ((data->lpDDSurface == X11DRV_DD_Primary) && data->lpDDPalette && data->lpDDPalette->u1.dwReserved1) {
- TSXDGAInstallColormap(display, DefaultScreen(display),
data->lpDDPalette->u1.dwReserved1);
- TSXDGAInstallColormap(gdi_display, DefaultScreen(gdi_display),
data->lpDDPalette->u1.dwReserved1);
} data->ddRVal = DD_OK; return DDHAL_DRIVER_HANDLED;
Your reasoning makes sense but with your patch I get the following error:
X Error of failed request: XF86DGADirectNotActivated Major opcode of failed request: 138 (XFree86-DGA) Minor opcode of failed request: 26 (XDGACreateColormap) Serial number of failed request: 3691 Current serial number in output stream: 3951
I'm not sure how to interpret this. Documentation for DGA seems to be pretty non-existant. Is this complaining that the CreateColormap failed because DGA wasn't activated or that DGA wasn't activated because of the colormap failure?
--- Glenn Schrader
On Mon, 12 Nov 2001, geschrader wrote:
Your reasoning makes sense but with your patch I get the following error:
X Error of failed request: XF86DGADirectNotActivated Major opcode of failed request: 138 (XFree86-DGA) Minor opcode of failed request: 26 (XDGACreateColormap) Serial number of failed request: 3691 Current serial number in output stream: 3951
I'm not sure how to interpret this. Documentation for DGA seems to be pretty non-existant. Is this complaining that the CreateColormap failed because DGA wasn't activated or that DGA wasn't activated because of the colormap failure?
It's probably the former. I'm guessing that you need to create the colormap on the same display that XDGAOpenFrameBuffer and XDGASetMode was done on (those are currently done on thread_display(), you'll probably have to change them too, then?)