Bug 85665

Summary: pdri3] mpv hits BadDrawable on vaapi/opengl interop teardown
Product: xorg Reporter: Kevin Mitchell <kevmitch>
Component: Driver/intelAssignee: Chris Wilson <chris>
Status: RESOLVED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: normal    
Priority: medium Keywords: bisected
Version: git   
Hardware: Other   
OS: Linux (All)   
URL: https://github.com/mpv-player/mpv/issues/1211
Whiteboard:
i915 platform: i915 features:

Description Kevin Mitchell 2014-10-31 00:04:33 UTC
I have bisected the appearence of this bug down to
    xf86-video-intel:d8eb87f84f88ad2df42c6fed1d93df76589a14e3
    Author: Chris Wilson <chris@chris-wilson.co.uk>
    Date:   Thu May 8 16:25:32 2014 +0100

        sna: Add support for DRI3

        Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>


Hardware: Mesa DRI Intel(R) Ivybridge Mobile

After this commit, running mpv-player from git master (though all tested versions show the same symptom) with the following command

    mpv/build/mpv --no-config --hwdec=vaapi --vo=opengl --msg-level=all=trace <h264file>

will result in the following output right before the player exits (either because of regular end of file or the user quitting the program with "q").

    .
    .
    .
    Exiting... (Quit)
    [osc] Exiting...
    [ao/alsa] draining...
    [ao/alsa] uninit: pcm closed
    [input] release all
    [vo/opengl/x11] Enabling screensaver.
    [vo/opengl/x11] X11 error: BadDrawable (invalid Pixmap or Window parameter)
    [vo/opengl/x11] Type: 0, display: 0x7f1a9825d0f0, resourceid: 4a0000d, serial: 141
    [vo/opengl/x11] Error code: 9, request code: 9a, minor code: 4
    [vo/opengl/x11] uninit ...

No other ill effects are observed by the user. I tried narrowing down the error within the mpv code, but it appears to be happening on essentially random/unrelated X calls (i.e., xss_suspend, or XDefineCursor depending on whehter the --no-stop-screensaver is added) likely because the x connection is asyncronous.

This behaviour is only observed with the above combination of vaapi hardware decoding with opengl interop output (i.e, none of "--hwdec=vaapi --vo=vaapi", "--hwdec=vaapi-copy --vo=opengl", or "--hwdec=no --vo=opengl" exhibit this problem).

I have linked the mpv bug report in the URL for this bug.
Comment 1 Chris Wilson 2014-11-01 10:37:42 UTC
The trick would be to set XSynchronize() inside mpv to capture the error as it happens and use gdb to see the culprit.
Comment 2 Kevin Mitchell 2014-11-02 02:38:41 UTC
Just tried XSychronizing the display. Of course, that makes the error go away :).
Comment 3 Kevin Mitchell 2015-06-22 23:29:32 UTC
With the same  xf86-video-intel and mpv commits, this no longer happens for me. Something has likely changed in the kernel or xserver itself.
Comment 4 Kevin Mitchell 2016-03-10 04:21:04 UTC
as above, no longer happens

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.