Bug 42699 - Segmentation fault if context is created indirect on a glXCreateWindow
Summary: Segmentation fault if context is created indirect on a glXCreateWindow
Status: RESOLVED MOVED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-08 02:12 UTC by Wolfgang Draxinger
Modified: 2019-09-25 18:49 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Testcases for context creation in combination with glXCreateWindow; use attached Makefile for building (9.39 KB, text/x-csrc)
2011-11-08 02:12 UTC, Wolfgang Draxinger
Details
Makefile for the testcases (1.04 KB, text/plain)
2011-11-08 02:13 UTC, Wolfgang Draxinger
Details

Description Wolfgang Draxinger 2011-11-08 02:12:41 UTC
Created attachment 53286 [details]
Testcases for context creation in combination with glXCreateWindow; use attached Makefile for building

System information:

xorg-server-1.10.4
mesa-7.11
00:02.1 Display controller: Intel Corporation Mobile 4 Series Chipset Integrated Graphics Controller (rev 07) (i965)

glxinfo | grep renderer:
OpenGL renderer string: Mesa DRI Mobile Intel® GM45 Express Chipset

Problem description:
If a OpenGL context is created indirect, glXCreateNewContext segfaults if created on a GLXWindow created with glXCreateWindow. Direct context creation on glXCreateWindow created drawable works. As does creating direct and indirect context on the plain XWindow, i.e. no intermediary GLXWindow drawable.

See attached testcase program for testing.
Comment 1 Wolfgang Draxinger 2011-11-08 02:13:37 UTC
Created attachment 53288 [details]
Makefile for the testcases
Comment 2 Matt Turner 2016-11-03 22:33:45 UTC
Sorry no one has ever investigated your bug. I can reproduce with current Mesa:

Starting program: /home/mattst88/Downloads/indirect_context_using_glXCreateWindow 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
FBConfig selected:
Doublebuffer: Yes
Red Bits: 8, Green Bits: 8, Blue Bits: 8, Alpha Bits: 8, Depth Bits: 24
Using glXCreateWindow
Context is created indirect
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff40d0be2 in intel_dri2_flush_with_flags (cPriv=0x61, dPriv=0x632790, flags=3, reason=__DRI2_THROTTLE_SWAPBUFFER)
    at ../../../../../../mesa/src/mesa/drivers/dri/i965/intel_screen.c:171
171	   struct brw_context *brw = cPriv->driverPrivate;
(gdb) bt
#0  0x00007ffff40d0be2 in intel_dri2_flush_with_flags (cPriv=0x61, dPriv=0x632790, flags=3, reason=__DRI2_THROTTLE_SWAPBUFFER)
    at ../../../../../../mesa/src/mesa/drivers/dri/i965/intel_screen.c:171
#1  0x00007ffff766f231 in loader_dri3_flush (draw=0x613ed8, flags=3, throttle_reason=__DRI2_THROTTLE_SWAPBUFFER) at ../../../mesa/src/loader/loader_dri3_helper.c:458
#2  0x00007ffff766837c in glx_dri3_flush_drawable (draw=0x613ed8, flags=3) at ../../../mesa/src/glx/dri3_glx.c:148
#3  0x00007ffff766f9ac in loader_dri3_swap_buffers_msc (draw=0x613ed8, target_msc=0, divisor=0, remainder=0, flush_flags=3, force_copy=false)
    at ../../../mesa/src/loader/loader_dri3_helper.c:641
#4  0x00007ffff7668d91 in dri3_swap_buffers (pdraw=0x613ea0, target_msc=0, divisor=0, remainder=0, flush=1) at ../../../mesa/src/glx/dri3_glx.c:521
#5  0x00007ffff761e5eb in glXSwapBuffers (dpy=0x604010, drawable=25165827) at ../../../mesa/src/glx/glxcmds.c:843
#6  0x000000000040207f in redrawTheWindow () at glXCreateWindow_testcases.c:362
#7  0x00000000004020b1 in main (argc=1, argv=0x7fffffffe0e8) at glXCreateWindow_testcases.c:371
Comment 3 Danylo 2018-08-01 14:31:27 UTC
I've made a patch to fix the issue https://patchwork.freedesktop.org/patch/242094/ . 

__glXInitialize is being called before Mesa may know that context will be indirect thus dri display is created (this doesn't happen with LIBGL_ALWAYS_INDIRECT=1 due to the check in __glXInitialize). Later GetGLXDRIDrawable will be able to return non-null value which some places treat as indicator that dri is enabled. I added check if direct rendering is enabled before calling GetGLXDRIDrawable where necessary.
Comment 4 GitLab Migration User 2019-09-25 18:49:10 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/1382.


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.