Bug 97969

Summary: [radeonsi, bisected: fb827c0] Video decoding shows green artifacts
Product: Mesa Reporter: Alexandre Demers <alexandre.f.demers>
Component: Drivers/Gallium/radeonsiAssignee: Default DRI bug account <dri-devel>
Status: RESOLVED FIXED QA Contact: Default DRI bug account <dri-devel>
Severity: normal    
Priority: medium CC: adf.lists, alexandre.f.demers, grantipak, gringo, maraeo, neatnoise, nhaehnle
Version: git   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: possible fix

Description Alexandre Demers 2016-09-29 04:52:22 UTC
Using R9 280X. Since today, playing videos with VLC displays green artifacts. Tested with a few videos (mostly mp4 and mkv).

---
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: X.Org (0x1002)
    Device: AMD TAHITI (DRM 2.46.0 / 4.7.0-AGD5F-g4ae4f77-dirty, LLVM 4.0.0) (0x6798)
    Version: 12.1.0
    Accelerated: yes
    Video memory: 3072MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.3
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.1
---

Bisecting points to the following bad commit

fb827c055cb1bdd2b18d0687c06c56b537d805f3 is the first bad commit
commit fb827c055cb1bdd2b18d0687c06c56b537d805f3
Author: Nicolai Hähnle <nicolai.haehnle@amd.com>
Date:   Mon Sep 12 12:19:47 2016 +0200

    winsys/radeon: enable buffer allocation from slabs
    
    Only enable for chips with GPUVM, because older driver paths do not take the
    required offset into account.
    
    Reviewed-by: Marek Olšák <marek.olsak@amd.com>

:040000 040000 4e1327d4b72890178a2057d2341971001f2de54d d162404a219307e5f6cda1009b864e66f23f4e63 M	src
Comment 1 Alex Deucher 2016-09-29 13:48:56 UTC
*** Bug 97976 has been marked as a duplicate of this bug. ***
Comment 2 Nicolai Hähnle 2016-09-29 14:52:47 UTC
Created attachment 126871 [details] [review]
possible fix

Does the attached patch fix the problem for you?
Comment 3 Alexandre Demers 2016-09-29 22:05:41 UTC
With the patch, when playing problematic videos, I get a black screen instead of a partial display with green artifacts.

Also, with and without the patch, dmesg catches the following when playing the problematic videos (I should have had a look previously):
[76261.125581] [drm:radeon_uvd_cs_parse [radeon]] *ERROR* Handle 0x8fd80001 already in use!
[76261.125594] [drm:radeon_cs_ioctl [radeon]] *ERROR* Invalid command stream !
[76261.126059] [drm:radeon_uvd_cs_parse [radeon]] *ERROR* Handle 0x8fd80001 already in use!
[76261.126072] [drm:radeon_cs_ioctl [radeon]] *ERROR* Invalid command stream !
[76261.126441] [drm:radeon_uvd_cs_parse [radeon]] *ERROR* Handle 0x8fd80001 already in use!
[76261.126452] [drm:radeon_cs_ioctl [radeon]] *ERROR* Invalid command stream !
Comment 4 Nicolai Hähnle 2016-09-30 10:47:59 UTC
Should be fixed in Mesa master as of commit 13cb41f666212ed50a7939a37a373b4431a84033. Please re-open if the problem persists.
Comment 5 Alexandre Demers 2016-09-30 14:59:15 UTC
(In reply to Nicolai Hähnle from comment #4)
> Should be fixed in Mesa master as of commit
> 13cb41f666212ed50a7939a37a373b4431a84033. Please re-open if the problem
> persists.

I still get a black screen when plating problematic videos with the latest Mesa from git as of this morning. And I still get the following error:
[...]
[  286.174162] [drm:radeon_uvd_cs_parse [radeon]] *ERROR* invalid reloc offset 13FA000!
[  286.174174] [drm:radeon_cs_ioctl [radeon]] *ERROR* Invalid command stream !
[  286.198203] [drm:radeon_uvd_cs_parse [radeon]] *ERROR* invalid reloc offset 148F000!
[  286.198215] [drm:radeon_cs_ioctl [radeon]] *ERROR* Invalid command stream !
[  286.246226] [drm:radeon_uvd_cs_parse [radeon]] *ERROR* invalid reloc offset 1524000!
[  286.246238] [drm:radeon_cs_ioctl [radeon]] *ERROR* Invalid command stream !
[  286.270245] [drm:radeon_uvd_cs_parse [radeon]] *ERROR* invalid reloc offset A1D000!
[  286.270257] [drm:radeon_cs_ioctl [radeon]] *ERROR* Invalid command stream !
Comment 6 Tom 2016-10-01 12:25:06 UTC
I confirm a bug. It occurs when playing h264 encoded videos using hardware vdpau acceleration. It happens using many players (tested with mpv, vlc), kernel 4.7, 4.8 and current mesa-git.

glxinfo:

OpenGL renderer string: Gallium 0.4 on AMD BONAIRE (DRM 2.46.0 / 4.8.0-rc8-mainline, LLVM 4.0.0)
OpenGL core profile version string: 4.3 (Core Profile) Mesa 12.1.0-devel (git-1d466b9)


dmesg messages while playing videos:

[  212.406985] [drm:radeon_uvd_cs_parse [radeon]] *ERROR* Handle 0x3a200001 already in use!
[  212.406999] [drm:radeon_cs_ioctl [radeon]] *ERROR* Invalid command stream !
Comment 7 Michel Dänzer 2016-10-03 02:51:39 UTC
*** Bug 98010 has been marked as a duplicate of this bug. ***
Comment 8 Nicolai Hähnle 2016-10-04 08:56:05 UTC
Now that I actually got to test this on radeon rather than just amdgpu, the problem was pretty obvious. It's fixed for me with https://patchwork.freedesktop.org/patch/113573/. I apologize for the inconvenience.
Comment 9 Alexandre Demers 2016-10-05 03:27:11 UTC
(In reply to Nicolai Hähnle from comment #8)
> Now that I actually got to test this on radeon rather than just amdgpu, the
> problem was pretty obvious. It's fixed for me with
> https://patchwork.freedesktop.org/patch/113573/. I apologize for the
> inconvenience.

Tested and it seems fixed over here. Closing.

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.