Bug 63447

Summary: [i965 Bisected]Ogles1conform/Ogles2conform/Ogles3conform cases segfault
Product: Mesa Reporter: lu hua <huax.lu>
Component: Drivers/DRI/i965Assignee: Chad Versace <chadversary>
Status: VERIFIED FIXED QA Contact:
Severity: blocker    
Priority: highest CC: chadversary, xunx.fang
Version: unspecified   
Hardware: All   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: xform_output
Potential fix

Description lu hua 2013-04-12 02:35:48 UTC
Created attachment 77834 [details]
xform_output

System Environment:
--------------------------
Arch:           x86_64
Platform:       Ironlake/Sandybridge/Ivybridge/Haswell
Libdrm:	(master)libdrm-2.4.43-5-gb7bb9e929786eb8bae86cf50f54dcb94bfa7ad46
Mesa:		(master)cb12bf7606116e473bf19aee84582b4cee7f895d
Xserver:(master)xorg-server-1.14.0-52-gecf62755086fd65898998d5a509aee5f29a9583d
Xf86_video_intel:(master)2.21.6-9-gafe61281d8f92d6eb841e2522ab18e0d2fe73773
Cairo:		(master)a64ce09715162c57d6e4b6a460d426af1d443cdc
Libva:		(staging)5ec25c3d563d9ebd479a5ff978afe0a32f9cc00b
Libva_intel_driver:(staging)1fd62ffd336293dce7d091bcea8399a40ccea21e
Kernel:	(drm-intel-nightly) 524d90c616e56dcd9b64432a68f6013bd1e82811

Bug detailed description:
-------------------------
All Ogles1conform cases segfault on Ironlake/Sandybridge/Ivybridge/Haswell with mesa master branch.It doesn't happen on 9.1 branch.

Bisect shows:3998f8c6b5da1a223926249755e54d8f701f81ab is the first bad commit.
commit 3998f8c6b5da1a223926249755e54d8f701f81ab
Author:     Ralf Jung <post@ralfj.de>
AuthorDate: Tue Apr 9 14:09:50 2013 +0200
Commit:     Chad Versace <chad.versace@linux.intel.com>
CommitDate: Wed Apr 10 19:16:45 2013 -0700

    egl/x11: Fix initialisation of swap_interval

    The EGLConfig attributes EGL_MIN/MAX_SWAP_INTERVAL were incorrectly set to
    0 and 0. This prevented clients from setting the swap interval to a
    reasonable value, like 1 or 2.

    Swap interval worked correctly in Mesa 9.0. The commit below introduced
    the bug.

        commit 7e9bd2b2ed35a440a96362417100a7e43715d606
        Author: Eric Anholt <eric@anholt.net>
        Date:   Tue Sep 25 14:05:30 2012 -0700
        egl: Add support for driconf control of swapinterval.

    Note: This is a candidate for the 9.1 branch.
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63078
    [chadv: Wrote commit message]
    Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>

Run case xform.c
(gdb) bt
#0  intelCreateBuffer (driScrnPriv=0x67e0e0, driDrawPriv=0xbd15c0, mesaVis=0x0, isPixmap=0 '\000') at intel_screen.c:816
#1  0x00007ffff63ae0e4 in dri2CreateNewDrawable (screen=0x67e0e0, config=0x0, data=0x2f6af10) at dri_util.c:492
#2  0x00007ffff7bc0e0d in dri2_create_surface (drv=<optimized out>, disp=0x676fe0, type=4, conf=0x682340, native_window=6291482, attrib_list=<optimized out>)
    at platform_x11.c:220
#3  0x00007ffff7bc1195 in dri2_create_window_surface (drv=0x677d40, disp=0x676fe0, conf=<optimized out>, window=<optimized out>, attrib_list=<optimized out>)
    at platform_x11.c:285
#4  0x00007ffff7bb5d37 in eglCreateWindowSurface (dpy=0x676fe0, config=<optimized out>, window=6291482, attrib_list=0x0) at eglapi.c:534
#5  0x00000000004459cd in tkNewWindow (wind=0x66b7a0) at ctke.c:232
#6  0x000000000043d67b in main (argc=6, argv=0x7fffffffe158) at shell.c:369


Reproduce steps:
----------------
1. xinit
2. ./conform -s -v 2 -1 xform.c
Comment 1 lu hua 2013-04-12 02:56:16 UTC
All Ogles2conform and Ogles3conform cases also segfault with same bisect commit.
Comment 2 lu hua 2013-04-12 05:13:47 UTC
spec_EGL_NOK_swap_region_basic fails on Haswell, has same bisect commit.
Comment 3 fangxun 2013-04-18 09:27:43 UTC
Run test case with vblank_mode=0, it won't crash.
The culprit commit effectively changed vblank_mode to other value, which exposed bugs that are hidden before.
Comment 4 Chad Versace 2013-04-23 03:00:40 UTC
Created attachment 78354 [details] [review]
Potential fix

The attached patch fixes the segfault when running ``taro run ./conform -s -v 2 -1 xform.c``. The patch lives at git://people.freedesktop.org/~chadversary/mesa branch=bug/fdo-63447.

Please verify that this patch fixes all the segfaults that you are seeing.
Comment 5 lu hua 2013-04-23 05:07:12 UTC
Fixed by this patch.
Comment 6 Chad Versace 2013-04-23 07:47:57 UTC
Patch is now submitted to mesa-dev list.
Comment 7 Chad Versace 2013-04-24 06:08:02 UTC
Fixed by commit

commit d3dfce32768dd698d12948987f93680ce02d465a
Author: Chad Versace <chad.versace@linux.intel.com>
Date:   Tue Apr 23 04:17:48 2013 +0200

    egl/dri2: Fix min/max swap interval of configs
Comment 8 lu hua 2013-04-26 02:09:10 UTC
Verified.Fixed.
Comment 9 lu hua 2013-05-13 03:04:58 UTC
It happens on 9.1 branch, Bisect shows: d1b4165fcf79a75fc0ce8a81445ce58666103770 is the first bad commit.
commit d1b4165fcf79a75fc0ce8a81445ce58666103770
Author: Ralf Jung <post@ralfj.de>
Date:   Tue Apr 9 14:09:50 2013 +0200

    egl/x11: Fix initialisation of swap_interval

    The EGLConfig attributes EGL_MIN/MAX_SWAP_INTERVAL were incorrectly set to
    0 and 0. This prevented clients from setting the swap interval to a
    reasonable value, like 1 or 2.

    Swap interval worked correctly in Mesa 9.0. The commit below introduced
    the bug.

        commit 7e9bd2b2ed35a440a96362417100a7e43715d606
        Author: Eric Anholt <eric@anholt.net>
        Date:   Tue Sep 25 14:05:30 2012 -0700
        egl: Add support for driconf control of swapinterval.

    Note: This is a candidate for the 9.1 branch.
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=63078
    [chadv: Wrote commit message]
    Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
    Reviewed-by: Eric Anholt <eric@anholt.net>
    (cherry picked from commit 3998f8c6b5da1a223926249755e54d8f701f81ab)
Comment 10 lu hua 2013-05-15 00:59:36 UTC
Fixed on 9.1 branch.
commit 3933e653289d31d38d233cd0ddfebe6bd2d4eb04
Author:     Chad Versace <chad.versace@linux.intel.com>
AuthorDate: Tue Apr 23 04:17:48 2013 +0200
Commit:     Ian Romanick <ian.d.romanick@intel.com>
CommitDate: Mon May 13 09:14:24 2013 -0700

    egl/dri2: Fix min/max swap interval of configs

    The commit below exposed a bug in dri2_add_config.

        commit 3998f8c6b5da1a223926249755e54d8f701f81ab
        Author: Ralf Jung <post@ralfj.de>
        Date:   Tue Apr 9 14:09:50 2013 +0200

        egl/x11: Fix initialisation of swap_interval

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.