Bug 93804

Summary: mpv opengl vo with vaapi decode renders OK with DRI2 but not DRI3
Product: xorg Reporter: Andy Furniss <adf.lists>
Component: Driver/AMDgpuAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
xorg log dri3 enabled none

Description Andy Furniss 2016-01-21 00:14:22 UTC
Been testing some things with mpv recently and notice that when DRI3 is enabled it doesn't render when using vaapi decode + opengl vo eg.

mpv --hwdec=vaapi --vo=opengl ....

works with dri2 but not dri3, I just get a static frame of GPU mem, the player behaves as if nothing is wrong.

I am using R9285 gits mesa/llvm and release X with Server 1.18.0 (also tried 1.18.0 git branch). Git xf86-video-amdgpu.

There is no difference between the output of R600_DEBUG=vs,ps,fs or mpv -v between working and not working.

mpv --vo=opengl works fine with anything other than --vo=vaapi.
Comment 1 Andy Furniss 2016-01-21 00:25:16 UTC
Created attachment 121166 [details]
xorg log dri3 enabled
Comment 2 Michel Dänzer 2016-01-27 09:39:49 UTC
I can't seem to reproduce this. Does it also happen with an older kernel? (Thinking of the regression discussed in http://lists.freedesktop.org/archives/dri-devel/2016-January/098823.html and followups)
Comment 3 Andy Furniss 2016-01-28 00:37:27 UTC
(In reply to Michel Dänzer from comment #2)
> I can't seem to reproduce this. Does it also happen with an older kernel?
> (Thinking of the regression discussed in
> http://lists.freedesktop.org/archives/dri-devel/2016-January/098823.html and
> followups)

It's the same on 4.3.4 assuming that's old enough.

Also same with vblank_mode=0

I just noticed the last line of my first post needs correcting -

"mpv --vo=opengl works fine with anything other than --vo=vaapi"

should read

mpv --vo=opengl works fine with anything other than --hwdec=vaapi
Comment 4 Andy Furniss 2016-02-09 15:52:25 UTC
I've found another issue with dri3 + mpv and mplayer. This also exists with older kernel.

mpv -fs --vo=opengl or

mplayer -fs -vo gl <something-smaller-than-screen>

while it's playing press f to toggle fullscreen/windowed and it's possible that I still see sections of the fullscreen output when they should have been cleared.

Maybe those who use compositing desktops won't be able to reproduce - I use fluxbox, so no compositing.
Comment 5 csaba.halasz 2016-02-19 19:28:37 UTC
Same here. No compositing (wm: awesome). Side note: vaapi decoded version looks a lot blockier than vdpau but that maybe due to mpv and/or some settings. Also, -vo=vaapi works fine.

System: r9 380, kernel agd5f/drm-fixes-4.5 cc1de6e8 merged with agd5f/drm-next-4.6-wip fa9e6991, llvm git ae316aa0, mesa git fe14110f, Xorg 1.18, amdgpu git a3eac85d
Comment 6 Andy Furniss 2016-02-19 21:17:57 UTC
Oh good, it's nice not to be the only one :-)

On blockiness, if you are testing mpeg2 vaapi hardware decode then I already have a bug open for this -

https://bugs.freedesktop.org/show_bug.cgi?id=93760
Comment 7 Michel Dänzer 2016-02-27 06:29:15 UTC
commit 5ec1797a2858d693d18d21326e2307d71555e1db
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Wed Feb 24 17:33:49 2016 +0900

    DRI2: Use amdgpu_pixmap_get_handle
    
    Now we can share pixmaps with no struct amdgpu_buffer via DRI2.
    
    Fixes VDPAU video playback freezing when using an OpenGL compositor with
    DRI3 enabled and mpv VAAPI hardware decoding with OpenGL output.
Comment 8 Andy Furniss 2016-02-27 10:49:55 UTC
Thanks, it does work now but sometimes can look quite choppy like it's not rendering all the frames. This effect clears its self and seems easier to reproduce with 25fps vid on 60Hz refresh. Maybe it's mpv or it's sometimes hitting some unlucky vsync timing.

Forcing CPU + GPU to full perf doesn't help and it seems only this combination of hwdec and vo is affected.

The corruption when flipping between fullscreen and windowed with gl still occurs - I'll file a new bug for that.
Comment 9 Andy Furniss 2016-02-27 10:51:17 UTC
Forgot to put, I am currently running adg5f drm-fixes-4.5.

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.