Bug 60052

Summary: [Bisected]Piglit glx_extension_string_sanity fail
Product: Mesa Reporter: lu hua <huax.lu>
Component: Drivers/DRI/i915Assignee: Zack Rusin <zackr>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: high CC: brianp, idr, jbarnes, krh, tim, xunx.fang
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description lu hua 2013-01-30 03:26:35 UTC
System Environment:
--------------------------
Arch:             x86_64
Platform:         Ivybridge
Libdrm:		(master)libdrm-2.4.41-4-g9dc0072e8d5a47fb0b2ada50fb897cb2c740bb40
Mesa:		(master)9add4e803877f97ad7f6d479d81d537426f09b6f
Xserver:	(master)xorg-server-1.13.99.901-37-g7fe5e6dfa5c1e71d8b7540b28c1d508687a2fbee
Xf86_video_intel:(master)2.20.19-38-g63c71bcd96202e6da44d6776d119a82f0c06d386
Cairo:		(master)41ae904461e344fbfa3be3d276a7102bb4304b19
Libva:		(staging)21649988d6b532cc96f633db017d1e4369f640e9
Libva_intel_driver:(staging)b7cb38772e6f73d3c1b3465e0bc6c0009c2f5634
Kernel:	(drm-intel-nightly) 666476a090494e267f6c49197097c9740c1ed91c

Bug detailed description:
-------------------------
It fails on pineview,ironlake,sandybridge,ivybridge,haswell with mesa master branch. It also fails on 9.0 branch.

Bisect shows:dbb2d192de33064ae6cdb799d71c5ac89a6ea8ff is the first bad commit.
commit dbb2d192de33064ae6cdb799d71c5ac89a6ea8ff
Author: Zack Rusin <zackr@vmware.com>
Date:   Thu Jan 24 17:48:12 2013 -0800

    glx: only advertise GLX_INTEL_swap_event if it's supported

    Only drivers supporting DRI2 version >=4 support GLX_INTEL_swap_event.
    So lets mark it as such otherwise applications which use this extension
    (i.e. everything based on Clutter, e.g. gnome-shell) break horribly on
    drivers supporting DRI2 versions only up to 3.

    Note: This is a candidate for the 9.0 branch.

    Reviewed-by: Brian Paul <brianp@vmware.com>

output:
GLX_INTEL_swap_event found in both client and server extension strings, but missing from unified string.
PIGLIT: {'result': 'fail' }

Reproduce steps:
----------------
1. xinit
2. ./bin/glx-string-sanity
Comment 1 Ian Romanick 2013-01-30 06:07:27 UTC
So, now the extension isn't advertised on drivers that do support it. :(  That's no good.
Comment 2 Ian Romanick 2013-01-30 06:11:14 UTC
As far as I can tell by looking at dri_interface.h, __DRI_DRI2_VERSION only goes up to 3.  There is no version 4.
Comment 3 Zack Rusin 2013-01-30 07:02:25 UTC
(In reply to comment #2)
> As far as I can tell by looking at dri_interface.h, __DRI_DRI2_VERSION only
> goes up to 3.  There is no version 4.

Yea, you're right I was hoping the DRI2INFOREC_VERSION is propagated through it. It's the  drivers supporting DRI2InfoRec::version >= 4 that implement it. 
We don't have access to either DRI2InfoRec::version or DRI2HasSwapControl both of which are used on server side, without them I actually don't know how Jesse, you and Kristian envisioned it to be tested for on this side. So the big question is: how did you want it to be tested for?
Comment 4 Ian Romanick 2013-01-30 19:35:21 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > As far as I can tell by looking at dri_interface.h, __DRI_DRI2_VERSION only
> > goes up to 3.  There is no version 4.
> 
> Yea, you're right I was hoping the DRI2INFOREC_VERSION is propagated through
> it. It's the  drivers supporting DRI2InfoRec::version >= 4 that implement
> it. 
> We don't have access to either DRI2InfoRec::version or DRI2HasSwapControl
> both of which are used on server side, without them I actually don't know
> how Jesse, you and Kristian envisioned it to be tested for on this side. So
> the big question is: how did you want it to be tested for?

libGL only advertises the extension if both the client library and the server advertise it.  If I'm reading this correctly, it sounds like the server is advertising the extension when it possibly shouldn't.  If that's correct, we should revert this patch from Mesa and apply some sort of fix in the xserver.
Comment 5 Zack Rusin 2013-01-30 21:13:13 UTC
(In reply to comment #4)
> libGL only advertises the extension if both the client library and the
> server advertise it.  If I'm reading this correctly, it sounds like the
> server is advertising the extension when it possibly shouldn't.  If that's
> correct, we should revert this patch from Mesa and apply some sort of fix in
> the xserver.

Yea, reporting of this extension is completely broken. Given all the moving pieces and that enabling it for drivers that don't support completely breaks desktop environments (the entire desktop just hangs because the swap event they're waiting for never gets there), I'd be really happy if we just disabled this extension completely at least for the stable 9.0.x series until this can be resolved.

Jesse's initial patch to the server even had a fixme for properly reporting it. (http://cgit.freedesktop.org/xorg/xserver/commit/glx/glxdri2.c?id=84956ca43b087600d9db297cffd62e960c516d9e) then he removed it without actually fixing it http://cgit.freedesktop.org/xorg/xserver/commit/?id=165a4a9c7de0fcc6ef6a6421736b412ccb35965e , then someone realized that it breaks drivers so he manually disabled it for software rasterizers and then when Owen fixed reporting of this extension in Mesa everything broke. 

I'm ok with whatever that would make Fedora 18 not hang on startup and while this needs to be fixed in the Xserver I have no idea what are the Xserver release cycles nowadays and this is quite urgent.
Comment 6 Brian Paul 2013-01-31 17:32:37 UTC
Zack, as a temporary hack, could we just look if the driver == "vmwgfx" in the client side glx code and disable the extension there?
Comment 7 Zack Rusin 2013-01-31 18:36:31 UTC
(In reply to comment #6)
> Zack, as a temporary hack, could we just look if the driver == "vmwgfx" in
> the client side glx code and disable the extension there?

Yea, that's actually a pretty good idea. I'm not sure if any drivers are using the xorg state trackers which only supports dri2inforec version 3, or whether any other drivers also don't support version 4, but I'd be happy with having that hack in until we implement support for swap_event or/and the extension is fixed.
Ian, are you ok with that?
Comment 8 Ian Romanick 2013-02-19 20:52:06 UTC
Fixed on master by the following commit.  This commit has also been cherry picked to the 9.1 branch (as commit bdffccf)

commit 076403c30d9f5cc79374e30d9f6007b08a63bf2d
Author: Zack Rusin <zackr@vmware.com>
Date:   Thu Feb 14 20:39:36 2013 -0800

    DRI2: Don't disable GLX_INTEL_swap_event unconditionally
    
    GLX_INTEL_swap_event is broken on the server side, where it's
    currently unconditionally enabled. This completely breaks
    systems running on drivers which don't support that extension.
    There's no way to test for its presence on this side, so instead
    of disabling it uncondtionally, just disable it for drivers
    which are known to not support it. It makes sense because
    most drivers do support it right now.
    We'll be able to remove this once Xserver properly advertises
    GLX_INTEL_swap_event.
    
    Note: This is a candidate for stable branch branches.
    
    Signed-off-by: Zack Rusin <zackr@vmware.com>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=60052
    Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
    Reviewed-by: Brian Paul <brianp@vmware.com>
    Tested-by: Ian Romanick <ian.d.romanick@intel.com>
Comment 9 fangxun 2013-02-21 01:52:06 UTC
Verified it on mesa master and 9.1 branch.
Comment 10 Andreas Boll 2013-02-21 15:39:29 UTC
Cherry-picked to the 9.0 branch: f84fe6aa2eac6984b77ca6da0c7e5a571b425827

It will be available in Mesa 9.0.3.

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.