Bug 203471

Summary: Tearing on Raven Ridge and RX560X PRIME setup even with Vsync enabled
Product: Drivers Reporter: Haxk20 (haxk612)
Component: Video(DRI - non Intel)Assignee: drivers_video-dri
Status: REOPENED ---    
Severity: high CC: alexdeucher, nicholas.kazlauskas, vmuppalla
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: git master Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg
journalctl
Xorg log
DRI_PRIME=1 glxinfo
glxinfo

Description Haxk20 2019-05-01 16:30:33 UTC
I have Acer Nitro 5 AN515-42 with Ryzen 5 2500U and RX560X.
When i launch some game with DRI_PRIME=1 to have it on dGPU there is huge tearing on top of the screen that is there with or without Vsync.
If i launch the game on iGPU there is no tearing at all.
Also the tearing happens only when the game is in fullscreen.
If i take a screenshot there is no tearing in the screenshot.
And i cannot post a picture as my phone camera is broken in my latest build of android.
I have tried 5.2-wip branch and there is the same issue.
Will post dmesg and journalctl in few hours.
Comment 1 Haxk20 2019-05-01 21:02:06 UTC
Created attachment 282573 [details]
dmesg
Comment 2 Haxk20 2019-05-01 21:03:00 UTC
Created attachment 282575 [details]
journalctl

If you need anything more please tell me.
Comment 3 Michel Dänzer 2019-05-02 08:10:23 UTC
Please attach the corresponding Xorg log file and the output of glxinfo (both with and without DRI_PRIME=1).
Comment 4 Haxk20 2019-05-02 12:30:21 UTC
Created attachment 282585 [details]
Xorg log
Comment 5 Haxk20 2019-05-02 12:31:35 UTC
Created attachment 282587 [details]
DRI_PRIME=1 glxinfo
Comment 6 Haxk20 2019-05-02 12:32:29 UTC
Created attachment 282589 [details]
glxinfo

Here is Xorg log, glxinfo with DRI_PRIME=1 and glxinfo without PRIME.
Comment 7 Haxk20 2019-05-10 21:03:02 UTC
(In reply to Michel Dänzer from comment #3)
> Please attach the corresponding Xorg log file and the output of glxinfo
> (both with and without DRI_PRIME=1).

Is there anything more you need to figure out whats casuing this bug ?
I will try to play some game on HDMI output and see if its purely eDP issue or it applies to other connectors too.
Will post tomorrow.
Comment 8 Michel Dänzer 2019-05-13 09:16:17 UTC
The tearing occurs because amdgpu doesn't support scatter/gather scanout with Raven yet, so page flipping cannot be used.

For the time being, you can get rid of the tearing by enabling TearFree:

 xrandr --output eDP --set TearFree on

See the amdgpu (4) manpage for more information about TearFree.
Comment 9 Haxk20 2019-05-13 13:11:01 UTC
Thank you.
Comment 10 Haxk20 2019-06-05 22:55:30 UTC
(In reply to Michel Dänzer from comment #8)
> The tearing occurs because amdgpu doesn't support scatter/gather scanout
> with Raven yet, so page flipping cannot be used.
> 
> For the time being, you can get rid of the tearing by enabling TearFree:
> 
>  xrandr --output eDP --set TearFree on
> 
> See the amdgpu (4) manpage for more information about TearFree.

Also i forgot to ask. Isnt there an time estimate when can we expect scatter scanout support for Raven ?
Comment 11 vr00m 2019-08-07 17:52:32 UTC
ICYMI, I was able to solve the tearing problem with raven ridge using iommu=soft boot param.
Comment 12 Michel Dänzer 2019-08-08 07:58:58 UTC
(In reply to vr00m from comment #11)
> ICYMI, I was able to solve the tearing problem with raven ridge using
> iommu=soft boot param.

Tearing isn't related to the IOMMU. Scatter/gather scanout support for Raven Ridge is landing now, maybe you're running a development snapshot kernel which has it already?
Comment 13 Haxk20 2019-08-12 05:06:37 UTC
(In reply to Michel Dänzer from comment #12)
> (In reply to vr00m from comment #11)
> > ICYMI, I was able to solve the tearing problem with raven ridge using
> > iommu=soft boot param.
> 
> Tearing isn't related to the IOMMU. Scatter/gather scanout support for Raven
> Ridge is landing now, maybe you're running a development snapshot kernel
> which has it already?

Could you please point us to the patch series that implements scatter/gather scanout support for Raven Ridge ? I havent found it in rc4 nor in drm-next-5.4

Thank you.
Comment 15 Haxk20 2019-08-12 17:48:30 UTC
I have tried manually patching 5.3rc4 and even compiling drm-next-5.4 branch but sadly i still get tearing on the screen.
Is there a config option to enable it or its enabled by default ?
And as before TearFree fixes the tearing but causes stuttering sometimes so not perfect solution by any means.
Comment 16 Haxk20 2019-09-21 13:37:37 UTC
I just tried linux kernel from master and no improvement.
Games still produce tearing  even with Vsync on or off.
Only way to get rid of it is TearFree set to on.
Is there something im missing or what ?
Comment 17 Haxk20 2019-09-26 21:22:13 UTC
My bad. I just replaced the panel inside the laptop with 120Hz one and tearing is gone.
Comment 18 Haxk20 2019-09-27 07:26:36 UTC
Well i was blind it seems. The tearing is small but still is surely there sadly. Tearing is gone if using just iGPU. When using dGPU with PRIME then tearing is there.
Comment 19 Haxk20 2019-09-27 07:31:20 UTC
And yes im running linux kernel from master so the DRM patches for scatther/gather are there. Still tearing even tho they are there.
Help ?
Comment 20 Haxk20 2019-11-08 12:39:51 UTC
Can we get help on this ? This is a kind of bad bug because it seems to happen in some games and in some it does not.
Not only that but it started happening in video too on firefox and that is really horrible.
Comment 21 Michel Dänzer 2019-11-08 17:02:22 UTC
(In reply to Haxk20 from comment #20)
> Not only that but it started happening in video too on firefox and that is
> really horrible.

Sounds like you're referring to https://gitlab.freedesktop.org/xorg/xserver/issues/924 ? I thought we'd just established that's not using PRIME, in which case it's probably not directly related to this.
Comment 22 Haxk20 2019-11-12 06:20:42 UTC
(In reply to Michel Dänzer from comment #21)
> (In reply to Haxk20 from comment #20)
> > Not only that but it started happening in video too on firefox and that is
> > really horrible.
> 
> Sounds like you're referring to
> https://gitlab.freedesktop.org/xorg/xserver/issues/924 ? I thought we'd just
> established that's not using PRIME, in which case it's probably not directly
> related to this.

Yes. I will reopen that bug again as you closed it but well its not solved yet.
Comment 23 Haxk20 2020-10-16 15:34:36 UTC
For people wondering yes this is still an issue. The bug is 1 year old now. 
scatter/gather support has been enabled in the kernel for a long time now yet its still broken.