OpenGL issues on OSX (wine 1.3.21)

Questions about Wine on macOS.
asiga
Level 2
Level 2
Posts: 14
Joined: Wed Jun 01, 2011 6:42 am

OpenGL issues on OSX (wine 1.3.21)

Post by asiga »

I just compiled 1.3.21 on OSX using the osxwinebuilder script. It's the first time I try wine on the Mac.

I've tried some short OpenGL demos and they work, but others fail. Remarkable ones that fail are wxWidgets OpenGL demos (remarkable because the source is available, so I guess it should be easy to fix).

I run OSX 10.6.7.

While running the wxWidgets "penguin" demo, the OpenGL view remains blank, and this is printed in the terminal:

wine[592] <Error>: unknown error code: invalid drawable
wine[592] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
set off screen: invalid drawable

Any hint about the cause for this issue? Any workaround? (the source for wxWidgets is available, but I also have some inhouse apps that fail with this very same problem, and I don't have access to their source).

TIA
Thunderbird
Level 5
Level 5
Posts: 336
Joined: Mon Nov 24, 2008 8:10 am

Post by Thunderbird »

Rendering to OpenGL 'child windows' (small OpenGL views like in Google Earth) is a tricky operation for Wine. It has to do between differences between X11 and Windows.

Anyway, the way this type of GL rendering works is that we render to an 'offscreen window' and we copy the result back to the main window of the application. This 'offscreen window' rendering mechanism uses the X Composite extension and GLX. Not all drivers support this properly (it is essentially the functionality needed to run compiz well). On Linux, the drivers from Nvidia and AMD support it and drivers which support DRI2 (DRI2 is a hard requirement). I don't think it is supported on OSX yet.
asiga
Level 2
Level 2
Posts: 14
Joined: Wed Jun 01, 2011 6:42 am

Post by asiga »

The OpenGL apps that fail have the view in the main window... it's not a child window.

I've a first guess, though: When I first compiled some of my UNIX code in OSX, I found that OSX is a bit picky if you render into a GLX context before initializing it: if you do it, the app may crash, or the view become unusable. In Linux and Windows it's also an error, but not a fatal one... the app will continue running, and the view will work fine once you initialize it. I'm not sure if it's this problem or not, but it remembers me of it.

However, I don't think it's a issue related to rendering into child windows. If you look the wxWidgets "penguin" GL demo you'll see the GL view is on the main window.
asiga
Level 2
Level 2
Posts: 14
Joined: Wed Jun 01, 2011 6:42 am

Post by asiga »

Btw, sorry for this reply-to-myself, but in case it's useful, take a look at this screenshot of the "penguin" wxWidgets demo (this screenshot belongs to the Linux build, but it looks very similar on the Windows build):

http://www.wxwidgets.org/images/screens/penguinm.gif

As you can see, the view is on the main window, and, as said above, you get this when you start this demo with wine 1.3.21 on OSX:

wine[592] <Error>: unknown error code: invalid drawable
wine[592] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
set off screen: invalid drawable
ryan woodsmall

OpenGL issues on OSX (wine 1.3.21)

Post by ryan woodsmall »

Btw, sorry for this reply-to-myself, but in case it's useful, take a look at this screenshot of the "penguin" wxWidgets demo (this screenshot belongs to the Linux build, but it looks very similar on the Windows build):

http://www.wxwidgets.org/images/screens/penguinm.gif

As you can see, the view is on the main window, and, as said above, you get this when you start this demo with wine 1.3.21 on OSX:

wine[592] <Error>: unknown error code: invalid drawable
wine[592] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
set off screen: invalid drawable
Are you running on XQuartz (http://xquartz.macosforge.org/) or the OS-packaged X11? XQuartz is definitely recommended.

Can you also try running the demo in a Wine virtual desktop to see if that helps the issue? GLX on OS X has always been something of a moving target but it's getting much better. -r
Thunderbird
Level 5
Level 5
Posts: 336
Joined: Mon Nov 24, 2008 8:10 am

Post by Thunderbird »

It depends on how the program is doing its rendering. If the OpenGL area is a true win32 client area then it is fine, but I doubt that's the case for WxWidgets.
asiga
Level 2
Level 2
Posts: 14
Joined: Wed Jun 01, 2011 6:42 am

Re: OpenGL issues on OSX (wine 1.3.21)

Post by asiga »

ryan woodsmall wrote:
Btw, sorry for this reply-to-myself, but in case it's useful, take a look at this screenshot of the "penguin" wxWidgets demo (this screenshot belongs to the Linux build, but it looks very similar on the Windows build):

http://www.wxwidgets.org/images/screens/penguinm.gif

As you can see, the view is on the main window, and, as said above, you get this when you start this demo with wine 1.3.21 on OSX:

wine[592] <Error>: unknown error code: invalid drawable
wine[592] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
set off screen: invalid drawable
Are you running on XQuartz (http://xquartz.macosforge.org/) or the OS-packaged X11? XQuartz is definitely recommended.

Can you also try running the demo in a Wine virtual desktop to see if that helps the issue? GLX on OS X has always been something of a moving target but it's getting much better. -r
Using a virtual desktop doesn't help.

Btw, where in the code is the "set off screen: invalid drawable" message triggered? I searched for it, with the hope of being able to fix it, but it seems that message isn't in the Wine source code.

And, how are you rendering offscreen? With pbuffers? If affirmative, I believe pbuffers aren't supported in Apple's GLX, but framebuffer objects (FBOs) are supported. Can I try to rewrite the pbuffer code and translate it to FBOs, or would it take thousands of hundreds of code lines?

Anyway, first of all, I need to be sure what lines in the source are triggering the above warnings, but searched the source without success. Any advice for finding them?

Thanks!
doh123
Level 8
Level 8
Posts: 1227
Joined: Tue Jul 14, 2009 1:21 pm

Re: OpenGL issues on OSX (wine 1.3.21)

Post by doh123 »

asiga wrote: And, how are you rendering offscreen? With pbuffers? If affirmative, I believe pbuffers aren't supported in Apple's GLX, but framebuffer objects (FBOs) are supported. Can I try to rewrite the pbuffer code and translate it to FBOs, or would it take thousands of hundreds of code lines?

Anyway, first of all, I need to be sure what lines in the source are triggering the above warnings, but searched the source without success. Any advice for finding them?

Thanks!
FBO is default as far as I know.
asiga
Level 2
Level 2
Posts: 14
Joined: Wed Jun 01, 2011 6:42 am

Re: OpenGL issues on OSX (wine 1.3.21)

Post by asiga »

doh123 wrote:
asiga wrote: And, how are you rendering offscreen? With pbuffers? If affirmative, I believe pbuffers aren't supported in Apple's GLX, but framebuffer objects (FBOs) are supported. Can I try to rewrite the pbuffer code and translate it to FBOs, or would it take thousands of hundreds of code lines?

Anyway, first of all, I need to be sure what lines in the source are triggering the above warnings, but searched the source without success. Any advice for finding them?

Thanks!
FBO is default as far as I know.
After debugging the penguin demo in relay mode, these are all the wgl-related calls that happen before the errors are output (where [...] means non-wgl calls have been ommited)

Code: Select all

[...]
0029:Call gdi32.wglCreateContext(000006cc) ret=00407ca7
0029:Ret  gdi32.wglCreateContext() retval=0017e708 ret=00407ca7
[...]
0029:Call user32.GetDC(00000000) ret=00497402
0029:Ret  user32.GetDC() retval=000006b4 ret=00497402
0029:Call gdi32.GetDeviceCaps(000006b4,0000000e) ret=0049741d
0029:Ret  gdi32.GetDeviceCaps() retval=00000001 ret=0049741d
0029:Call gdi32.GetDeviceCaps(000006b4,0000000c) ret=00497435
0029:Ret  gdi32.GetDeviceCaps() retval=00000020 ret=00497435
0029:Call user32.ReleaseDC(00000000,000006b4) ret=00497454
0029:Ret  user32.ReleaseDC() retval=00000001 ret=00497454
0029:Ret  window proc 0x42dc00 (hwnd=0x30076,msg=WM_ERASEBKGND,wp=000006cc,lp=00000000) retval=00000001
0029:Call window proc 0x42dc00 (hwnd=0x30076,msg=WM_WINDOWPOSCHANGED,wp=00000000,lp=008aed24)
0029:Call user32.DefWindowProcA(00030076,00000047,00000000,008aed24) ret=0042de70
0029:Call window proc 0x42dc00 (hwnd=0x30076,msg=WM_SIZE,wp=00000000,lp=00c80184)
0029:Call user32.GetWindow(00030076,00000005) ret=00431c69
0029:Ret  user32.GetWindow() retval=00000000 ret=00431c69
0029:Call user32.GetWindowRect(00030076,008ad630) ret=0042ce4b
0029:Ret  user32.GetWindowRect() retval=00000001 ret=0042ce4b
0029:Call user32.GetClientRect(00030076,008ad550) ret=0042cfe3
0029:Ret  user32.GetClientRect() retval=00000001 ret=0042cfe3
0029:Call gdi32.wglMakeCurrent(000006cc,0017e708) ret=00407a08
Sat Jun  4 23:12:07 mba-cbu.local wine[613] <Error>: unknown error code: invalid drawable
Sat Jun  4 23:12:07 mba-cbu.local wine[613] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
set off screen: invalid drawable
0029:Ret  gdi32.wglMakeCurrent() retval=00000000 ret=00407a08
So, it seems the warnings are triggered by gdi32.wglMakeCurrent(). Any hint on what can be happening here, and where should I be looking at?

Thanks!
Charles Davis

OpenGL issues on OSX (wine 1.3.21)

Post by Charles Davis »

On 6/4/11 3:23 PM, asiga wrote:
Sat Jun 4 23:12:07 mba-cbu.local wine[613] <Error>: unknown error code: invalid drawable
Sat Jun 4 23:12:07 mba-cbu.local wine[613] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
set off screen: invalid drawable
Looks like it tried to wglMakeCurrent() a bitmap context. For some
reason, bitmap contexts don't work very well under Wine.

Chip
asiga
Level 2
Level 2
Posts: 14
Joined: Wed Jun 01, 2011 6:42 am

Re: OpenGL issues on OSX (wine 1.3.21)

Post by asiga »

Charles Davis wrote:On 6/4/11 3:23 PM, asiga wrote:
Sat Jun 4 23:12:07 mba-cbu.local wine[613] <Error>: unknown error code: invalid drawable
Sat Jun 4 23:12:07 mba-cbu.local wine[613] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
set off screen: invalid drawable
Looks like it tried to wglMakeCurrent() a bitmap context. For some
reason, bitmap contexts don't work very well under Wine.

Chip
AFAIK it's not a bitmap context, but an OpenGL window...

Btw, where is pwglMakeCurrent() initialized? What function does it point to? I'm trying to diagnose the problem, but I'm unable to find the code of the function it points to.
Charles Davis

OpenGL issues on OSX (wine 1.3.21)

Post by Charles Davis »

On 6/4/11 5:09 PM, asiga wrote:
Charles Davis wrote:
On 6/4/11 3:23 PM, asiga wrote:
Sat Jun 4 23:12:07 mba-cbu.local wine[613] <Error>: unknown error code: invalid drawable
Sat Jun 4 23:12:07 mba-cbu.local wine[613] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
set off screen: invalid drawable
Looks like it tried to wglMakeCurrent() a bitmap context. For some
reason, bitmap contexts don't work very well under Wine.

Chip
AFAIK it's not a bitmap context, but an OpenGL window...
Are you sure?
Btw, where is pwglMakeCurrent() initialized? What function does it point to? I'm trying to diagnose the problem, but I'm unable to find the code of the function it points to.
In the driver, of course. The driver in this case is winex11.drv. The
source file you're looking for is dlls/winex11.drv/opengl.c.

Chip
Thunderbird
Level 5
Level 5
Posts: 336
Joined: Mon Nov 24, 2008 8:10 am

Post by Thunderbird »

Create a log running with '+wgl'. Though I still think the application triggers our child window rendering code. There are two ways we can do that:
- if wine was compiled with X Composite, we create an offscreen X11 window and when a new frame is ready we copy the contents over to the application window through XCopyArea (there is only 1 X11 window, any other win32 windows are not actual X11 windows hence why child window rendering is hard)
- if X composite is not available we try to fall back to pixmap rendering (this is single buffered only). The same XCopyArea stuff is used
asiga
Level 2
Level 2
Posts: 14
Joined: Wed Jun 01, 2011 6:42 am

Post by asiga »

Thunderbird wrote:Create a log running with '+wgl'.
This is what I get:

First, this:

Code: Select all

trace:wgl:wglGetProcAddress func: 'wglGetIntegerv'
trace:wgl:X11DRV_WineGL_InitOpenglInfo GL version             : 2.1 NVIDIA-1.6.26.
trace:wgl:X11DRV_WineGL_InitOpenglInfo GL renderer            : NVIDIA GeForce 320M OpenGL Engine.
trace:wgl:X11DRV_WineGL_InitOpenglInfo GLX version            : 1.2.
trace:wgl:X11DRV_WineGL_InitOpenglInfo Server GLX version     : 1.2.
trace:wgl:X11DRV_WineGL_InitOpenglInfo Server GLX vendor:     : SGI.
trace:wgl:X11DRV_WineGL_InitOpenglInfo Client GLX version     : 1.4.
trace:wgl:X11DRV_WineGL_InitOpenglInfo Client GLX vendor:     : Mesa Project and SGI.
trace:wgl:X11DRV_WineGL_InitOpenglInfo Direct rendering enabled: True
trace:wgl:has_opengl GLX is up and running error_base = 147
trace:wgl:register_extension_string ''
trace:wgl:register_extension     - 'wglGetIntegerv'
trace:wgl:register_extension     - 'wglFinish'
trace:wgl:register_extension     - 'wglFlush'
trace:wgl:register_extension_string 'WGL_ARB_extensions_string'
trace:wgl:register_extension     - 'wglGetExtensionsStringARB'
trace:wgl:register_extension_string 'WGL_ARB_multisample'
trace:wgl:register_extension_string 'WGL_ARB_pixel_format'
trace:wgl:register_extension     - 'wglChoosePixelFormatARB'
trace:wgl:register_extension     - 'wglGetPixelFormatAttribfvARB'
trace:wgl:register_extension     - 'wglGetPixelFormatAttribivARB'
trace:wgl:register_extension_string 'WGL_EXT_extensions_string'
trace:wgl:register_extension     - 'wglGetExtensionsStringEXT'
trace:wgl:register_extension_string 'WGL_EXT_swap_control'
trace:wgl:register_extension     - 'wglSwapIntervalEXT'
trace:wgl:register_extension     - 'wglGetSwapIntervalEXT'
trace:wgl:register_extension_string 'WGL_WINE_pixel_format_passthrough'
trace:wgl:register_extension     - 'wglSetPixelFormatWINE'
trace:wgl:X11DRV_wglGetProcAddress ('wglGetIntegerv'):                  (0x43815540) - WineGL
trace:wgl:wglGetProcAddress func: 'wglFinish'
trace:wgl:X11DRV_wglGetProcAddress ('wglFinish'):                       (0x43815670) - WineGL
trace:wgl:wglGetProcAddress func: 'wglFlush'
trace:wgl:X11DRV_wglGetProcAddress ('wglFlush'):                        (0x438184e0) - WineGL
trace:wgl:X11DRV_ChoosePixelFormat (0x16aad8,0x8afa28)
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - size / version : 40 / 1
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - dwFlags : PFD_DOUBLEBUFFER PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL 
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - iPixelType : PFD_TYPE_RGBA
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Color   : 16
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Red     : 0
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Green   : 0
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Blue    : 0
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Alpha   : 0
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Accum   : 0
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Depth   : 16
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Stencil : 0
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Aux     : 0
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - iLayerType : PFD_MAIN_PLANE
trace:wgl:get_formats Found 0 bitmap capable fbconfigs
Then, about 400 lines like this, with incrementing indexes for each pixel formats, from 0 to 415:

Code: Select all

trace:wgl:get_formats Found onscreen format FBCONFIG_ID 0x24 corresponding to iPixelFormat 1 at GLX index 0
Then about 90 lines like this (ie: not all pixel formats fail, only about 90 of them):

Code: Select all

trace:wgl:X11DRV_ChoosePixelFormat depth mismatch for iPixelFormat=5
Then it creates the context:

Code: Select all

trace:wgl:X11DRV_ChoosePixelFormat Successfully found a matching mode, returning index: 83 76
trace:wgl:X11DRV_SetPixelFormat (0x16aad8,83,0x8afa28)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=83
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=416
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 83 for fmt_id 0x76
path: 342_0xc0010a
trace:wgl:internal_SetPixelFormat  FBConfig have :
trace:wgl:internal_SetPixelFormat  - FBCONFIG_ID   0x76
trace:wgl:internal_SetPixelFormat  - VISUAL_ID     0x76
trace:wgl:internal_SetPixelFormat  - DRAWABLE_TYPE 0x1
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 83 for fmt_id 0x76
trace:wgl:X11DRV_GetPixelFormat (0x16aad8)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=83
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=416
trace:wgl:X11DRV_GetPixelFormat (0x16aad8): returns 83
trace:wgl:X11DRV_DescribePixelFormat (0x16aad8,83,40,0x8afa20)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=83
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=416
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - size / version : 40 / 1
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - dwFlags : PFD_DOUBLEBUFFER PFD_DRAW_TO_WINDOW PFD_SUPPORT_OPENGL 
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - iPixelType : PFD_TYPE_RGBA
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Color   : 24
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Red     : 8
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Green   : 8
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Blue    : 8
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Alpha   : 0
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Accum   : 32
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Depth   : 16
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Stencil : 0
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - Aux     : 0
trace:wgl:dump_PIXELFORMATDESCRIPTOR   - iLayerType : PFD_MAIN_PLANE
trace:wgl:wglCreateContext (0x6cc)
trace:wgl:X11DRV_wglCreateContext (0x6cc)->(PF:83)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=83
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=416
trace:wgl:X11DRV_wglCreateContext  creating context 0x16ae40 (GL context creation delayed)
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 83 for fmt_id 0x76
path: 342_0xc00120
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 83 for fmt_id 0x76
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 83 for fmt_id 0x76
Some time later, it makes it current and then everything goes wrong:

Code: Select all

trace:wgl:wglMakeCurrent hdc: (0x6cc), hglrc: (0x16ae40)
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 83 for fmt_id 0x76
trace:wgl:X11DRV_wglMakeCurrent (0x6cc,0x16ae40)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=83
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=416
trace:wgl:describeDrawable  HDC 0x6cc has:
trace:wgl:describeDrawable  - iPixelFormat 83
trace:wgl:describeDrawable  - Drawable 0xc00120
trace:wgl:describeDrawable  - FBCONFIG_ID 0x76
trace:wgl:describeDrawable  - VISUAL_ID 0x76
trace:wgl:describeContext  Context 0x16ae40 have (vis:0x404ae620):
trace:wgl:describeContext  - FBCONFIG_ID 0x76
trace:wgl:describeContext  - VISUAL_ID 0x76
trace:wgl:X11DRV_wglMakeCurrent  make current for dis 0x4081be00, drawable 0xc00120, ctx 0x404aafd0
Sun Jun  5 10:00:02 mba-cbu.local wine[456] <Error>: unknown error code: invalid drawable
Sun Jun  5 10:00:02 mba-cbu.local wine[456] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
set off screen: invalid drawable
trace:wgl:X11DRV_wglMakeCurrent  returning False
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 83 for fmt_id 0x76
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 83 for fmt_id 0x76
trace:wgl:wglMakeCurrent hdc: (0x6cc), hglrc: (0x16ae40)
trace:wgl:X11DRV_wglMakeCurrent (0x6cc,0x16ae40)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=83
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=416
trace:wgl:describeDrawable  HDC 0x6cc has:
trace:wgl:describeDrawable  - iPixelFormat 83
trace:wgl:describeDrawable  - Drawable 0xc00120
trace:wgl:describeDrawable  - FBCONFIG_ID 0x76
trace:wgl:describeDrawable  - VISUAL_ID 0x76
trace:wgl:describeContext  Context 0x16ae40 have (vis:0x404ae620):
trace:wgl:describeContext  - FBCONFIG_ID 0x76
trace:wgl:describeContext  - VISUAL_ID 0x76
trace:wgl:X11DRV_wglMakeCurrent  make current for dis 0x4081be00, drawable 0xc00120, ctx 0x404aafd0
trace:wgl:X11DRV_wglMakeCurrent  returning True
trace:wgl:wglMakeCurrent hdc: (0x6cc), hglrc: (0x16ae40)
trace:wgl:X11DRV_wglMakeCurrent (0x6cc,0x16ae40)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=83
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=416
trace:wgl:describeDrawable  HDC 0x6cc has:
trace:wgl:describeDrawable  - iPixelFormat 83
trace:wgl:describeDrawable  - Drawable 0xc00120
trace:wgl:describeDrawable  - FBCONFIG_ID 0x76
trace:wgl:describeDrawable  - VISUAL_ID 0x76
trace:wgl:describeContext  Context 0x16ae40 have (vis:0x404ae620):
trace:wgl:describeContext  - FBCONFIG_ID 0x76
trace:wgl:describeContext  - VISUAL_ID 0x76
trace:wgl:X11DRV_wglMakeCurrent  make current for dis 0x4081be00, drawable 0xc00120, ctx 0x404aafd0
trace:wgl:X11DRV_wglMakeCurrent  returning True
trace:wgl:wine_glFlush ()
trace:wgl:X11DRV_SwapBuffers (0x16aad8)
(note you can see where the warning message appears in the above log block)
So it has visual id 0x76 and fbconfig 0x76. This is what glxinfo says about 0x76:

Code: Select all

Vis  Vis   Visual Trans  buff lev render DB ste  r   g   b   a  aux dep ste  accum buffers  MS   MS
 ID Depth   Type  parent size el   type     reo sz  sz  sz  sz  buf th  ncl  r   g   b   a  num bufs
----------------------------------------------------------------------------------------------------

0x76 24 TrueColor    1     24  0  rgba   1   0   8   8   8   0   0   16  0   8   8   8   8   0   0
The only "strange" thing I see in that visual is that it only gets 16 bits of depth buffer, while this GPU has 24bit and 32bit depth buffer, but maybe this is a problem of what capabilities is the app asking, anyway it should also work with a 16bit depth buffer.

Do you see any "clue" in these logs. Why would MakeCurrent fail?

Thanks!
asiga
Level 2
Level 2
Posts: 14
Joined: Wed Jun 01, 2011 6:42 am

Post by asiga »

Btw, I found one suspicious thing. In the above logs, when the context is created, you can read:

Code: Select all

(GL context creation delayed)
If the context isn't created and you make it current, this is fatal in OSX (in other OSs doing that doesn't have too many consequences, but on OSX the OpenGL view becomes unusable after that).

I don't have time for looking more into it today, but if the context isn't being created, I suspect that avoiding that creation delay would fix the problem.
Thunderbird
Level 5
Level 5
Posts: 336
Joined: Mon Nov 24, 2008 8:10 am

Post by Thunderbird »

Oops, the context creation trace line is a 'bug'. In the past we delayed context creation until wglMakeCurrent (has to do with wglShareLists which doesn't exist in GLX; context sharing is done at context creation). These days we just try to recreate the context.

I don't quickly see anything suspicious in the log. You may want to look at set_win_format in dlls/winex11.drv/window.c which is where the child window magic for a part lives (the rest is in opengl.c). You are dealing with child window rendering when 'if (data->whole_window)' is false.
asiga
Level 2
Level 2
Posts: 14
Joined: Wed Jun 01, 2011 6:42 am

Post by asiga »

Well, I've tried to diagnose the problem, but after some hours hunting, all I can say is that I've wine compiled with the X Composite extension, but it can't use it because it can't query the extension, so it uses GLXPixmaps.

There're no OpenGL errors on glGetError(), nor in the Apple OpenGL Profiler (note: GLX errors aren't pushed into glGetError() but into the X protocol AFAIK, so the MakeCurrent error can't be seen from glGetError).

I conclude there aren't any other users in the planet trying to run a windowed OpenGL application on Mac through wine, because otherwise they would hit this bug. I guess all Mac wine users run whole-window OpenGL apps (like games, for example).

I feel sad because it seems wine isn't for me. I successfully used it on Linux, but on the Mac isn't as robust for OpenGL apps, and I need it for OpenGL apps.

I could continue trying to diagnose the problem, but I don't have more available hours to spend on it. Sorry.

I believe the developer team needs Mac contributors that use a Mac as their only machine, for both testing and developing. This will be the only way of wine running on the Mac as great as on Linux, but that needs volunteers, of course. I don't have time.

Thank you anyway for the great work done on Wine.
doh123
Level 8
Level 8
Posts: 1227
Joined: Tue Jul 14, 2009 1:21 pm

Post by doh123 »

nah... its something with that specific app. I've run plenty of DirectX-OpenGL or straight OpenGL apps that run in a window on Macs, it works fine.

If I saw a way to test with whatever it it your testing with I would, but it looks like it all needs to be compiled from scratch and I don't really have the time to look into it if its not something I can just run a few quick tests on.
jjmckenzie
Moderator
Moderator
Posts: 1153
Joined: Wed Apr 27, 2011 11:01 pm

OpenGL issues on OSX (wine 1.3.21)

Post by jjmckenzie »

On 6/7/11, asiga <[email protected]> wrote:
Well, I've tried to diagnose the problem, but after some hours hunting, all
I can say is that I've wine compiled with the X Composite extension, but it
can't use it because it can't query the extension, so it uses GLXPixmaps.

There're no OpenGL errors on glGetError(), nor in the Apple OpenGL Profiler
(note: GLX errors aren't pushed into glGetError() but into the X protocol
AFAIK, so the MakeCurrent error can't be seen from glGetError).

I conclude there aren't any other users in the planet trying to run a
windowed OpenGL application on Mac through wine, because otherwise they
would hit this bug. I guess all Mac wine users run whole-window OpenGL apps
(like games, for example).
I have no problems running programs that were specifically designed to
use OpenGL like dOOmII on my Mac. However, I did replace the poorly
implemented X11 system provided by Apple with XQuartz's much better
implementation. With the introduction of Lion this week, I expect to
see better X11 and hopefully some missing features added.

I don't remember if you were using XQuartz or not. If you are not,
try to use it. On Snow Leopard, it installs in addition to, not as a
replacement for, Apple's X11.

The same can be said for CrossOver Mac and doh123's WineSkin (they
both use customized X11 engines in place of Apple's X11 and do not
replace it.)

James McKenzie
chyman
Level 1
Level 1
Posts: 5
Joined: Mon Nov 07, 2011 7:25 am

I have a similar problem...

Post by chyman »

I just tried the "qtgears" OpenGL demo from http://lab.bachem-it.com/opengl/qtgears (source is included) on my MacBook and I got this error:

DIAG: apple_glx_create_context: ac 0x41931730 ac->context_obj 0x4104ce00
DIAG: apple_glx_drawable_create: new drawable 0x4088a000
DIAG: create_surface: created a surface for drawable 0x600010 with uid 153
DIAG: surface_make_current: ac->context_obj 0x4104ce00 s->surface_id 21
DIAG: surface_make_current: drawable 0x600010
DIAG: applegl_bind_context: error NO
fixme:wgl:X11DRV_wglGetPixelFormatAttribivARB unsupported 2008 WGL Attribute
DIAG: apple_glx_drawable_create: new drawable 0x4088aa00
DIAG: offscreen rendering enabled. Using kCGLPFAOffScreen
DIAG: created: pixmap buffer for 0xa0015e
DIAG: apple_glx_create_context: ac 0x41967c20 ac->context_obj 0x41045c00
DIAG: apple_glx_destroy_context: ac 0x41967c20 ac->context_obj 0x41045c00
DIAG: apple_glx_create_context: ac 0x41967c20 ac->context_obj 0x41045c00
Mon Nov 7 05:51:26 mxws2.local wine[99893] <Error>: unknown error code: invalid drawable
Mon Nov 7 05:51:26 mxws2.local wine[99893] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
set off screen: invalid drawable
DIAG: applegl_bind_context: error YES
X Error of failed request: 0
Major opcode of failed request: 149 (GLX)
Minor opcode of failed request: 26 (X_GLXMakeContextCurrent)
Serial number of failed request: 1341
Current serial number in output stream: 1341


I compiled Wine 1.3.32 on OSX using the osxwinebuilder script. It's the first time I try wine on Mac. I am using the recent XQuartz 2.7.0 for X11 and I run OSX 10.6.8.

Since I am getting similar errors I thought that someone perhaps has an idea...
Thanks!
jjmckenzie
Moderator
Moderator
Posts: 1153
Joined: Wed Apr 27, 2011 11:01 pm

OpenGL issues on OSX (wine 1.3.21)

Post by jjmckenzie »

On 11/7/11 5:37 AM, chyman wrote:
I just tried the "qtgears" OpenGL demo from http://lab.bachem-it.com/opengl/qtgears (source is included) on my MacBook and I got this error:

You need to file a bug report with the XQuartz folks. However, before
doing that, ensure that you are using XQuartz's X11 and not Apple's. By
the look of the error messages it appears that you were using Apple's
but I could be seriously incorrect.

Which X11 Icon did you use to start the program and did you reboot your
Mac after installing? (XQuartz recommends this, at least they did for
2.6.x and SnowLeopard.)

James
chyman
Level 1
Level 1
Posts: 5
Joined: Mon Nov 07, 2011 7:25 am

Post by chyman »

Hi James,

thank you for your kind reply. The XQuartz folks recommend to logout and back in to have the DISPLAY variable set correctly, which I did. But I will also try a reboot to be sure.
When I start something with wine, the XQuartz icon comes up automatically, so I am pretty sure that XQuartz is used (Apple's X11 is not active).

I had another try with WINEDEBUG=+wgl, perhaps that brings more details:

trace:wgl:wglGetCurrentContext returning 0x0
trace:wgl:X11DRV_GetPixelFormat (0x12a228)
trace:wgl:X11DRV_SetPixelFormat (0x12a228,81,0x0)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 81 for fmt_id 0x76
trace:wgl:internal_SetPixelFormat FBConfig have :
trace:wgl:internal_SetPixelFormat - FBCONFIG_ID 0x76
trace:wgl:internal_SetPixelFormat - VISUAL_ID 0xc5
trace:wgl:internal_SetPixelFormat - DRAWABLE_TYPE 0x7
trace:wgl:wglCreateContext (0x58c)
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 81 for fmt_id 0x76
trace:wgl:X11DRV_wglCreateContext (0x58c)->(PF:81)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
DIAG: apple_glx_create_context: ac 0x40464da0 ac->context_obj 0x4085d800
trace:wgl:X11DRV_wglCreateContext creating context 0x30de568 (GL context creation delayed)
trace:wgl:X11DRV_GetPixelFormat (0x12a228)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
trace:wgl:X11DRV_GetPixelFormat (0x12a228): returns 81
trace:wgl:wglMakeCurrent hdc: (0x58c), hglrc: (0x30de568)
trace:wgl:X11DRV_wglMakeCurrent (0x58c,0x30de568)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
trace:wgl:describeDrawable HDC 0x58c has:
trace:wgl:describeDrawable - iPixelFormat 81
trace:wgl:describeDrawable - Drawable 0x600008
trace:wgl:describeDrawable - FBCONFIG_ID 0x76
trace:wgl:describeDrawable - VISUAL_ID 0xc5
trace:wgl:describeContext Context 0x30de568 have (vis:0x40420b50):
trace:wgl:describeContext - FBCONFIG_ID 0x76
trace:wgl:describeContext - VISUAL_ID 0xc5
trace:wgl:X11DRV_wglMakeCurrent make current for dis 0x4081ce00, drawable 0x600008, ctx 0x404880d0
DIAG: apple_glx_drawable_create: new drawable 0x41073e00
DIAG: create_surface: created a surface for drawable 0x600008 with uid 25
DIAG: surface_make_current: ac->context_obj 0x4085d800 s->surface_id 13
DIAG: surface_make_current: drawable 0x600008
DIAG: applegl_bind_context: error NO
trace:wgl:X11DRV_wglMakeCurrent returning True
trace:wgl:X11DRV_wglSwapIntervalEXT (1)
warn:wgl:X11DRV_wglSwapIntervalEXT GLX_SGI_swap_control extension is not available
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 81 for fmt_id 0x76
trace:wgl:wglGetCurrentContext returning 0x30de568
trace:wgl:wglGetCurrentContext returning 0x30de568
DIAG: caller is the same thread for uid 25
DIAG: surface notify updated 0
DIAG: caller is the same thread for uid 25
DIAG: surface notify updated 0
DIAG: caller is the same thread for uid 25
DIAG: surface notify updated 0
trace:wgl:wglGetCurrentContext returning 0x30de568
trace:wgl:X11DRV_GetPixelFormat (0x1b849c0)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
trace:wgl:X11DRV_GetPixelFormat (0x1b849c0): returns 81
trace:wgl:wglCreateContext (0xa14)
trace:wgl:X11DRV_wglCreateContext (0xa14)->(PF:81)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
DIAG: apple_glx_create_context: ac 0x41926a10 ac->context_obj 0x410ba400
trace:wgl:X11DRV_wglCreateContext creating context 0x3152308 (GL context creation delayed)
trace:wgl:wglShareLists hglrc1: (0x30de568); hglrc: (0x3152308)
trace:wgl:X11DRV_wglShareLists (0x30de568, 0x3152308)
trace:wgl:describeContext Context 0x30de568 have (vis:0x40420b50):
trace:wgl:describeContext - FBCONFIG_ID 0x76
trace:wgl:describeContext - VISUAL_ID 0xc5
trace:wgl:describeContext Context 0x3152308 have (vis:0x41951c70):
trace:wgl:describeContext - FBCONFIG_ID 0x76
trace:wgl:describeContext - VISUAL_ID 0xc5
DIAG: apple_glx_destroy_context: ac 0x41926a10 ac->context_obj 0x410ba400
DIAG: apple_glx_create_context: ac 0x41926a10 ac->context_obj 0x410ba400
trace:wgl:X11DRV_wglShareLists re-created an OpenGL context (0x41907ea0) for Wine context 0x3152308 sharing lists with OpenGL ctx 0x404880d0
trace:wgl:X11DRV_GetPixelFormat (0x1b849c0)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
trace:wgl:X11DRV_GetPixelFormat (0x1b849c0): returns 81
trace:wgl:wglMakeCurrent hdc: (0xa14), hglrc: (0x3152308)
trace:wgl:X11DRV_wglMakeCurrent (0xa14,0x3152308)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
trace:wgl:describeDrawable HDC 0xa14 has:
trace:wgl:describeDrawable - iPixelFormat 81
trace:wgl:describeDrawable - Drawable 0x600008
trace:wgl:describeDrawable - FBCONFIG_ID 0x76
trace:wgl:describeDrawable - VISUAL_ID 0xc5
trace:wgl:describeContext Context 0x3152308 have (vis:0x41951c70):
trace:wgl:describeContext - FBCONFIG_ID 0x76
trace:wgl:describeContext - VISUAL_ID 0xc5
trace:wgl:X11DRV_wglMakeCurrent make current for dis 0x4081ce00, drawable 0x600008, ctx 0x41907ea0
DIAG: surface_make_current: ac->context_obj 0x410ba400 s->surface_id 13
DIAG: caller is the same thread for uid 25
DIAG: caller is the same thread for uid 25
DIAG: surface notify updated 0
DIAG: surface_make_current: drawable 0x600008
DIAG: applegl_bind_context: error NO
trace:wgl:X11DRV_wglMakeCurrent returning True
trace:wgl:X11DRV_wglSwapIntervalEXT (1)
warn:wgl:X11DRV_wglSwapIntervalEXT GLX_SGI_swap_control extension is not available
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 81 for fmt_id 0x76
trace:wgl:wglGetCurrentContext returning 0x3152308
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
trace:wgl:wglGetCurrentContext returning 0x3152308
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
fixme:d3d:resource_check_usage Unhandled usage flags 0x8.
trace:wgl:wglGetCurrentContext returning 0x3152308
fixme:d3d:wined3d_buffer_preload Too many declaration changes or converting dynamic buffer, stopping converting
trace:wgl:wglGetCurrentContext returning 0x3152308
trace:wgl:X11DRV_GetPixelFormat (0x1b849c0)
trace:wgl:X11DRV_SetPixelFormat (0x1b849c0,81,0x0)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 81 for fmt_id 0x76
DIAG: apple_glx_drawable_create: new drawable 0x408b3200
DIAG: offscreen rendering enabled. Using kCGLPFAOffScreen
DIAG: created: pixmap buffer for 0xe00481
trace:wgl:internal_SetPixelFormat FBConfig have :
trace:wgl:internal_SetPixelFormat - FBCONFIG_ID 0x76
trace:wgl:internal_SetPixelFormat - VISUAL_ID 0xc5
trace:wgl:internal_SetPixelFormat - DRAWABLE_TYPE 0x7
trace:wgl:ConvertPixelFormatGLXtoWGL Returning iPixelFormat 81 for fmt_id 0x76
trace:wgl:X11DRV_GetPixelFormat (0x1b849c0)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
trace:wgl:X11DRV_GetPixelFormat (0x1b849c0): returns 81
trace:wgl:wglMakeCurrent hdc: (0xa14), hglrc: (0x3152308)
trace:wgl:X11DRV_wglMakeCurrent (0xa14,0x3152308)
trace:wgl:ConvertPixelFormatWGLtoGLX Returning fmt_id=0x76 for iPixelFormat=81
trace:wgl:ConvertPixelFormatWGLtoGLX Number of returned pixelformats=120
trace:wgl:describeDrawable HDC 0xa14 has:
trace:wgl:describeDrawable - iPixelFormat 81
trace:wgl:describeDrawable - Drawable 0xe00481
trace:wgl:describeDrawable - FBCONFIG_ID 0x76
trace:wgl:describeDrawable - VISUAL_ID 0xc5
trace:wgl:describeContext Context 0x3152308 have (vis:0x41951c70):
trace:wgl:describeContext - FBCONFIG_ID 0x76
trace:wgl:describeContext - VISUAL_ID 0xc5
trace:wgl:X11DRV_wglMakeCurrent make current for dis 0x4081ce00, drawable 0xe00481, ctx 0x41907ea0
DIAG: destroy_drawable_callback: 0x41073e00 ->reference_count before -- 3
Fri Nov 11 10:34:36 mxws2.local wine[2791] <Error>: unknown error code: invalid drawable
Fri Nov 11 10:34:36 mxws2.local wine[2791] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
set off screen: invalid drawable
DIAG: applegl_bind_context: error YES
X Error of failed request: 0
Major opcode of failed request: 149 (GLX)
Minor opcode of failed request: 26 (X_GLXMakeContextCurrent)
Serial number of failed request: 4752
Current serial number in output stream: 4752

Thanks a lot for looking at this!
Chyman
ischou
Level 4
Level 4
Posts: 109
Joined: Sun Nov 28, 2010 7:22 pm

Post by ischou »

There seems to be some adverse interaction with Wine/OpenGL/XQuartz/Mac OS X at the moment.

I had an complete inability to run a game without running it in a virtual desktop with Wine 1.3.31-32 when I had XQuartz 2.6.3 installed which I described here: http://forum.winehq.org/viewtopic.php?t=13678

After upgrading to XQuartz 2.7.0 I was once again able to run the game without virtual desktop, but I am still getting those invalid drawable errors, and additionally I'm getting lots of intermittent crashes of wine or the game.

XQuartz already has an open bug report that seems related to chyman's issues: http://xquartz.macosforge.org/trac/ticket/512

If the bug report matches this issue then its on the XQuartz development road map for 2.7.1.
doh123
Level 8
Level 8
Posts: 1227
Joined: Tue Jul 14, 2009 1:21 pm

Post by doh123 »

XQuartz 2.7.0 uses Mesa 7.11. I had nothing but issues using this for WineskinX11... and found Mesa 7.8 to be much more stable... Not sure if its related, but XQuartz 2.7.0 might be a bit too bleeding edge.
chyman
Level 1
Level 1
Posts: 5
Joined: Mon Nov 07, 2011 7:25 am

Post by chyman »

Thank you for your kind hints and comments.

I also feel that the reason may lie in an interaction mismatch between Wine's OpenGL and XQuartz. Running the XQuartz OpenGL test "glxgears" works fine and delivers good performance.

A reboot as suggested by James didn't help the issue unfortunately.

I tried to use Wine's virtual desktop feature, but there was no change in the behavior. Thanks for this hint.

I also saw the issue over at http://xquartz.macosforge.org/trac/ticket/512, but I was unsure how related that is to mine, because my crashes are not random at all...

Perhaps I try a downgrade to XQuartz 2.6.3

I hope that both teams, the Wine team and the XQuartz team, get the change to probably coordinate on this interface a little to have have Wine with OS X be the same stable as with Linux...

Thanks,
Chyman
Locked