Bug 95475

Summary: DRI3 screen corruption
Product: xorg Reporter: Ivan Majhen <majhen.ivan>
Component: Driver/RadeonAssignee: xf86-video-ati maintainers <xorg-driver-ati>
Status: RESOLVED WONTFIX QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: lehjr1, majhen.ivan
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
chromium right click
none
firefox right click
none
system tray popup widgets
none
taskbar with chromium as main window
none
taskbar with empty desktop
none
dmesg
none
Xorg.log
none
Old dri3
none
old xorg log driver with dri3 enabled
none
Always call exaMoveInPixmap in radeon_dri3_fd_from_pixmap
none
tooltips and widgets not updating none

Description Ivan Majhen 2016-05-18 19:49:36 UTC
Created attachment 123886 [details]
chromium right click

With DRI3 set as default in radeon driver, screen corruption appears in plasma taskmanager, system tray widgets and firefox&chromium right click menus.


DRI3 with glamour doesn't have this corruption, only EXA and XAA.

Corruption also happens if desktop effect are disabled in Kwin.

With DRI2 enabled, rendering is bug free.

This is rather old laptop graphics VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] RV530/M56-P [Mobility Radeon X1600].

Using glamour is not an option since it is slower and results in higher  graphics card temperatures. 

Kernel is 4.5, Xorg-server 1.18.3, gentoo linux.
Comment 1 Ivan Majhen 2016-05-18 19:50:26 UTC
Created attachment 123887 [details]
firefox right click
Comment 2 Ivan Majhen 2016-05-18 19:50:57 UTC
Created attachment 123888 [details]
system tray popup widgets
Comment 3 Ivan Majhen 2016-05-18 19:51:56 UTC
Created attachment 123889 [details]
taskbar with chromium as main window
Comment 4 Ivan Majhen 2016-05-18 19:52:26 UTC
Created attachment 123890 [details]
taskbar with empty desktop
Comment 5 Michel Dänzer 2016-05-19 16:42:34 UTC
Does the patch attached to bug 94901 help by any chance? If not, please attach the Xorg log file and output of dmesg.
Comment 6 Ivan Majhen 2016-05-19 23:04:16 UTC
I already have that patch applied and it fixed pre sddm screen corruption. Without patch everything looks fine once sddm login is available.
Comment 7 Ivan Majhen 2016-05-19 23:04:52 UTC
Created attachment 123931 [details]
dmesg
Comment 8 Ivan Majhen 2016-05-19 23:05:38 UTC
Created attachment 123932 [details]
Xorg.log
Comment 9 Ivan Majhen 2016-05-19 23:06:29 UTC
And I'm using EGL in KWIN.
Comment 10 Michel Dänzer 2016-05-20 04:51:35 UTC
(In reply to Ivan Majhen from comment #6)
> Without patch everything looks fine once sddm login is available.

Are you saying the problem described in this report doesn't happen without the patch?
Comment 11 Ivan Majhen 2016-05-20 08:31:22 UTC
Problem happens with/without patch. My bug is different than #bug 94901.
Comment 12 Michel Dänzer 2016-05-25 09:11:09 UTC
Was this problem already present with xf86-video-ati Git commit 64e1e4db ("Add DRI3 support v2"), which was when DRI3 support was initially added? Note that this commit will only recognize Option "DRI3", not the current variant Option "DRI" "3".
Comment 13 Ivan Majhen 2016-05-25 12:25:10 UTC
I always had glitches with dri3. I tested it about 30 times in the past year.

Commit 64e1e4db didn't compile. First commit that compiles with current setup is https://cgit.freedesktop.org/xorg/driver/xf86-video-ati/commit/?id=b16609b453bb1a181198cf27778f205dc23fb642

It doesn't compile cleanly.

/usr/src/portagetmp/portage/x11-drivers/xf86-video-ati-9999/work/xf86-video-ati-9999/src/radeon_kms.c: In function ‘redisplay_dirty’:
/usr/src/portagetmp/portage/x11-drivers/xf86-video-ati-9999/work/xf86-video-ati-9999/src/radeon_kms.c:284:2: error: too many arguments to function ‘PixmapSyncDirtyHelper’
  PixmapSyncDirtyHelper(dirty, &pixregion);
  
  removed &pixregion

 error: too few arguments to function ‘PixmapStartDirtyTracking’
  PixmapStartDirtyTracking(ppix, screenpix, 0, 0);

  changed to PixmapStartDirtyTracking2 in drmmode_display.c

After that enabled DRI3 and got completely corrupted screen. 

Screenshot and xorg.log attached.
Comment 14 Ivan Majhen 2016-05-25 12:25:54 UTC
Created attachment 124081 [details]
Old dri3
Comment 15 Ivan Majhen 2016-05-25 12:26:55 UTC
Created attachment 124082 [details]
old xorg log driver with dri3 enabled
Comment 16 Michel Dänzer 2016-05-31 08:27:38 UTC
Created attachment 124202 [details] [review]
Always call exaMoveInPixmap in radeon_dri3_fd_from_pixmap

Does this patch fix the problem?
Comment 17 Ivan Majhen 2016-05-31 10:10:34 UTC
It doesn't fix anything.

Window previews are now almost always empty with transparent background.

If desktop has windows, tooltips on desktop switcher are fine.

Clock widget tooltips and Application launcher tooltips are always fine, systray is completely broken, except tooltips on clipboard.

Chromium and Firefox right click menu is still broken. 

Screenshots attached.
Comment 18 Ivan Majhen 2016-05-31 10:12:06 UTC
Created attachment 124209 [details]
tooltips and widgets not updating
Comment 19 Michel Dänzer 2016-07-26 06:27:03 UTC
*** Bug 96960 has been marked as a duplicate of this bug. ***
Comment 20 Michel Dänzer 2016-07-26 06:31:59 UTC
I looked into this issue, and I'm afraid it's probably unfixable due to the way EXA works. So I changed the driver to no longer enable DRI3 by default with EXA as of the commit referenced below.

commit 94fe42f29e0b00a26e810581d6c438ac6d8ecd8a
Author: Michel Dänzer <michel.daenzer@amd.com>
Date:   Tue Jul 12 17:36:27 2016 +0900

    Don't enable DRI3 by default with EXA
Comment 21 Michel Dänzer 2017-08-31 00:34:07 UTC
To elaborate on comment 21:

The problem is that DRI3 can be used as a general buffer sharing mechanism. The shared buffers can be used like any other pixmap in X, and the client can also do whatever it wants with them on the client side.

EXA doesn't know that these pixmaps are shared with the client, so its tracking of valid pixmap contents gets confused, and it ends up using stale contents. I believe this is unfixable with the current EXA design because in contrast to DRI2, there is no clearly defined flow of data between client and server side.

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.