https://bugs.freedesktop.org/show_bug.cgi?id=74563

          Priority: medium
            Bug ID: 74563
          Assignee: mesa-dev@lists.freedesktop.org
           Summary: Surfaceless contexts are not properly released by DRI
                    drivers
          Severity: normal
    Classification: Unclassified
                OS: Linux (All)
          Reporter: alexandros.frant...@canonical.com
          Hardware: x86-64 (AMD64)
            Status: NEW
           Version: git
         Component: Other
           Product: Mesa

Created attachment 93443
  --> https://bugs.freedesktop.org/attachment.cgi?id=93443&action=edit
Example that exhibits the issue

Releasing a surfaceless EGL context doesn't properly release the underlying DRI
context, sometimes leading to crashes. I have attached an example that exhibits
such a crash (run it in a VT).

Without a fix, the example crashes when the main thread tries to make context2
current, because mesa tries to _mesa_flush the invalid (destroyed in the other
thread) context1, left as current in the main thread by the previous make
current operation (and not cleaned by releasing the egl context).

The problem seems to be that the driUnbindContext() function doesn't call the
driver unbind function if the context is surfaceless. Moving the call to the
driver function before the drawable validity checks fixes things for me (see
attached patch), although I am not familiar enough with that code to be
confident that this is indeed the right approach.

Note the absence of _mesa_make_current() calls for context releases in the
logs:

# MESA_VERBOSE=api ./mesa_surfaceless_context_crash
T1: Make current 1
Mesa: _mesa_make_current()
T1: Release current 1
T1: after Release current 1
Main: Make current 1
Mesa: _mesa_make_current()
Main: Release current 1
Main: after Release current 1
Mesa: _mesa_make_current()
Mesa: glDeleteObjectARB(0)
Mesa: glDeleteObjectARB(0)
Mesa: glDeleteTextures 1
Mesa: _mesa_make_current()
Mesa: _mesa_make_current()
Main: Make current 2
<crash>

I am using latest Mesa git with the i965 driver.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to