Bug 100510

Summary: [radeon] Heavy artifacts during hw accelerated playback of wmv files
Product: DRI Reporter: Jan Burgmeier <jan.burgmeier>
Component: libdrmAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
full dmesg output
none
Hack for testing
none
Hack number 2 for testing
none
Final solution. none

Description Jan Burgmeier 2017-03-31 10:06:52 UTC
Hi,

with versions newer than libdrm-2.4.66 I have heavy artifacts during hw
accelerated playback of wmv files vaapi/vdpau tested with gstreamer-
0.10 and ffmpeg based mpv.

The error occures only with wmv, h264 works.

Bisect result:
db138b9ba12a0de5d6140832c0679c2418e3e7e0 is the first bad commit
commit db138b9ba12a0de5d6140832c0679c2418e3e7e0
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Thu Jan 21 18:08:49 2016 +0900

    radeon: Pass radeon_bo_open flags to the DRM_RADEON_GEM_CREATE ioctl
    
    Not doing so makes it impossible for radeon_bo_open callers to set any
    RADEON_GEM_* flags for the newly created BO.
    
    Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

If I revert this commit on the current master branch the artefacts are
gone.

System environment:
-- chipset: AMD GX-217GA SOC with Radeon(tm) HD Graphics
-- system architecture: 32-bit
-- xserver: 1.19.1
-- mesa: 13.0.3, 13.0.6, 17.0.2
-- libdrm: 2.4.74
-- kernel: 4.4.11
-- Linux distribution: eLux
-- Machine or mobo model: HP t620 dual core thin client

Regards,
Jan Burgmeier
Comment 1 Christian König 2017-03-31 11:39:33 UTC
Please attach your full dmesg output as well.
Comment 2 Jan Burgmeier 2017-03-31 11:44:54 UTC
Created attachment 130614 [details]
full dmesg output
Comment 3 Christian König 2017-03-31 11:53:21 UTC
Created attachment 130615 [details] [review]
Hack for testing

Please apply the attached code change with "git apply hack.patch" on a linux kernel tree and see if that helps.

It overrides the setting from libdrm to always use VRAM for UVD submissions. Not a final solution, but it should help to narrow down the problem.
Comment 4 Jan Burgmeier 2017-03-31 13:07:11 UTC
I applied the hack to HEAD of the staging-next branch and it worked.
Comment 5 Christian König 2017-03-31 13:33:50 UTC
Created attachment 130618 [details] [review]
Hack number 2 for testing

Ok, just as I expected we suddenly don't put buffers into VRAM any more and the UVD block has an undocumented requirement for WMV playback that those buffers needs to be in VRAM.

No idea why user space is broken, but the kernel should catch such cases and force them into VRAM when the hardware needs that.

Please revert the last hack and try this one. It should only the first and second buffer into VRAM.

If that doesn't work try to change the if so that the first,second and third buffer are forced into VRAM etc....

I need to know which one is needed in VRAM here.
Comment 6 Jan Burgmeier 2017-04-03 09:32:17 UTC
Your hack number 2 worked directly.
Comment 7 Christian König 2017-04-12 10:12:26 UTC
Created attachment 130810 [details] [review]
Final solution.
Comment 8 Michel Dänzer 2017-04-12 15:05:06 UTC
Thanks, but I actually receive updates via the dri-devel mailing list.

Do we know yet which flags are getting passed to radeon_bo_open for the BO(s) in question?
Comment 9 Christian König 2017-04-12 17:15:14 UTC
(In reply to Michel Dänzer from comment #8)
> Thanks, but I actually receive updates via the dri-devel mailing list.
> 
> Do we know yet which flags are getting passed to radeon_bo_open for the
> BO(s) in question?

No, so far I've concentrated on figuring out what's going on inside the kernel.
Comment 10 Arthur Marsh 2017-05-17 10:00:35 UTC
commit 8f12bbe6d94a51f3ae314c27cc7b9b315adfe383
Author: Christian König <christian.koenig@amd.com>
Date:   Tue Apr 11 19:20:20 2017 +0200

    drm/radeon: force the UVD DPB into VRAM as well
    
    Seems to be mandatory for WMV playback.

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

breaks video playback for me with a VERDE card (DVD and some other formats), with the error: 

[75728.141010] [drm:radeon_uvd_cs_parse [radeon]] *ERROR* msg/fb buffer 14674000-1686F000 out of 256MB segment!                                                 
[75728.141030] [drm:radeon_cs_ioctl [radeon]] *ERROR* Invalid command stream !

I'm happy to supply more specifics of my configuration.
Comment 11 Michel Dänzer 2017-05-17 14:42:43 UTC
Arthur, please file your own report. The commit in question did fix the problem reported here, so this is the correct status.

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.