Bug 23335

Summary: [wine] Indirect rendering returns invalid framebuffer status
Product: Mesa Reporter: Sergio Aranda <isbugged>
Component: GLXAssignee: Ian Romanick <idr>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: eric, hege, nbowler, randrik
Version: unspecified   
Hardware: All   
OS: All   
URL: http://bugs.winehq.org/show_bug.cgi?id=16516
i915 platform: i915 features:
Attachments: crash log

Description Sergio Aranda 2009-08-15 17:39:41 UTC

Many games using d3d doesn't start because Mesa returns 0 on glCheckFramebufferStatus().

Steps to Reproduce:

Note: There are MANY applications affected, this is only one.

1) Download and extract http://www.halt76.sakura.ne.jp/archive/myst_webt005.zip

2) Change directory to the extracted folder.

3) Run wine myst.exe

Actual Results:

1) Wine emits an error stating that it can't continue and exits

Expected Results:

The game runs


Ubuntu 9.10 (Karmic) x86-64
The lastest packages at xorg-edgers PPA: https://launchpad.net/~xorg-edgers/+archive/ppa
Intel Celeron 540
Intel 965GM

The URL link directs to a bug report with the same type of error than the one described.
Comment 1 Sergio Aranda 2009-08-20 11:36:46 UTC
Created attachment 28810 [details]
crash log

I've found that in x86 wine doesn't emit an error but crashes when it runs the game.
I've attached the crash in the message.
Comment 2 Sergio Aranda 2009-08-21 03:11:16 UTC
Comment on attachment 28810 [details]
crash log

Disregard my last post, on x86 the game runs fine.
Comment 3 Ian Romanick 2009-09-22 15:37:25 UTC
What version of Mesa was this?  Is the original bug (glCheckFramebufferStatus returning 0) still reproducible?  I've inspected the code, and it appears that the only way _mesa_CheckFramebufferStatus can return 0 is if an invalid parameter is passed.  In this case, a debug build of Mesa will also log a message to stderr.
Comment 4 Eric Anholt 2009-09-25 14:02:42 UTC
Appears to be a GLX problem:

anholt@gaiman:anholt/src/piglit% mesagl ./bin/fbo-readpixels
libGL: OpenDriver: trying /home/anholt/src/mesa/lib/tls/i965_dri.so
libGL: OpenDriver: trying /home/anholt/src/mesa/lib/i965_dri.so
testing with format 0x8058, 0x80e1, 0x8367 (8,8,8,8 rgba)
testing with format 0x8050, 0x1907, 0x8363 (5,6,5,0 rgba)
testing with format 0x8056, 0x80e1, 0x8365 (4,4,4,4 rgba)
testing with format 0x8057, 0x80e1, 0x8366 (5,5,5,1 rgba)

anholt@gaiman:anholt/src/piglit% LIBGL_ALWAYS_INDIRECT=yes mesagl ./bin/fbo-readpixels
testing with format 0x8058, 0x80e1, 0x8367 (8,8,8,8 rgba)
texture for internalformat 0x8058. format 0x80e1, type 0x8367 is framebuffer incomplete (0)
testing with format 0x8050, 0x1907, 0x8363 (5,6,5,0 rgba)
texture for internalformat 0x8050. format 0x1907, type 0x8363 is framebuffer incomplete (0)
testing with format 0x8056, 0x80e1, 0x8365 (4,4,4,4 rgba)
texture for internalformat 0x8056. format 0x80e1, type 0x8365 is framebuffer incomplete (0)
testing with format 0x8057, 0x80e1, 0x8366 (5,5,5,1 rgba)
texture for internalformat 0x8057. format 0x80e1, type 0x8366 is framebuffer incomplete (0)

On the other hand, ensuring that you get direct rendering should avoid this bug and improve performance as well.
Comment 5 Eric Anholt 2009-10-19 13:59:41 UTC
*** Bug 24049 has been marked as a duplicate of this bug. ***
Comment 6 Ian Romanick 2009-11-07 10:40:31 UTC
(In reply to comment #4)
> Appears to be a GLX problem:

I played with this a little bit.  I noticed a bunch of "no-op dispatch" messages being logged by the X server.  It would seem that something isn't being wired up correctly in the X server.
Comment 7 Ian Romanick 2009-11-09 12:41:02 UTC
*** Bug 24817 has been marked as a duplicate of this bug. ***
Comment 8 Ian Romanick 2009-11-09 14:56:40 UTC
Here's what's happening, and it's a pretty significant bug.

During 3D driver boot-strap, Mesa calls _mesa_init_remap_table.  This calls _mesa_map_function_spec, which in turn calls _glapi_add_dispatch.

_glapi_add_dispatch, in the X server's GLX module, calls add_function_name.  add_function_name, finally, calls generate_entrypoint. The server's GLX module is built without any USE_*_ASM flags defined, so generate_entrypoint always returns NULL.  As a result, the whole call chain fails.

This leaves the entry in the driDispatchRemapTable set to -1.  Since this is -1, the driver never installs its implementation of glGenFramebuffersEXT (or any other remapped extension function) into the dispatch table.  When GLX protocol comes in for one of these functions it ends up calling the no-op dispatch handler.

I think the correct fix is to change add_function_name to not call generate_entrypoint.  The entrypoints are returned by glXGetProcAddress to applications.  They are *never* used in the server.

However, making this change converted the client-side application failure to an assertion failure in the X server:

X: swrast/s_depth.c:580: depth_test_span: Assertion `rb->DataType == 0x1405' failed.
Comment 9 Ian Romanick 2009-11-09 15:32:21 UTC
(In reply to comment #8)

> X: swrast/s_depth.c:580: depth_test_span: Assertion `rb->DataType == 0x1405'
> failed.

This assertion occurred with progs/demos/shadowtex, and is a different bug altogether.  For indirect rendering, GL_EXT_packed_depth_stencil is not supported.  However, the demo doesn't bother to check that.  Somewhere inside Mesa there's a missing check about this extension when it gets a packed depth/stencil format.  This causes the depth attachment renderbuffer to not be properly wrapped, and BANG!
Comment 10 GitLab Migration User 2019-09-18 17:11:15 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/mesa/issues/55.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.