Skip to contentSkip to conversation

Fixes ported from / inspired by modesetting driver changes

PATCH In review Michel Dänzer 2 participants 6 messages Oct 25, 2016 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

cover Fixes ported from / inspired by modesetting driver changes

From: Michel Dänzer <[email protected]>

Hans de Goede (1):
PRIME: Fix swapping of provider sink / source capabilities

Michel Dänzer (3):
Don't rely on randr_crtc->scanout_pixmap in drmmode_set_scanout_pixmap Always call PixmapStopDirtyTracking in drmmode_set_scanout_pixmap Consume all available udev events at once

 src/drmmode_display.c | 30 ++++++++++++++++++++----------
 src/radeon_kms.c      |  4 ++--
 2 files changed, 22 insertions(+), 12 deletions(-)
Signature · 6 lines
2.10.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20161025084128.25410-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org

#2 lore raw

PATCH 1/4 Don't rely on randr_crtc->scanout_pixmap in drmmode_set_scanout_pixmap

From: Michel Dänzer <[email protected]>

RRReplaceScanoutPixmap may set randr_crtc->scanout_pixmap = NULL before we get here.

(Inspired by xserver commit f4c37eeee7953df1fe0e3196eda452acf0078e61)

---
 src/drmmode_display.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
src/drmmode_display.c +12 -5
index 2cb5931..00a484b 100644
@@ -1144,11 +1144,18 @@ drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 	RADEONInfoPtr info = RADEONPTR(crtc->scrn);
 
 	if (!ppix) {
-		if (crtc->randr_crtc->scanout_pixmap)
-			PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap,
-						drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap);
-		drmmode_crtc_scanout_free(drmmode_crtc);
-		return TRUE;
+		ScreenPtr screen = crtc->scrn->pScreen;
+		PixmapDirtyUpdatePtr dirty;
+
+		xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
+			if (dirty->slave_dst !=
+			    drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
+				continue;
+
+			PixmapStopDirtyTracking(dirty->src, dirty->slave_dst);
+			drmmode_crtc_scanout_free(drmmode_crtc);
+			return TRUE;
+		}
 	}
 
 	if (!drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[0],
Signature · 6 lines
2.10.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

PATCH 2/4 Always call PixmapStopDirtyTracking in drmmode_set_scanout_pixmap

In reply to a message not in the archive

From: Michel Dänzer <[email protected]>

Otherwise, we may leak screen->pixmap_dirty_list entries if drmmode_set_scanout_pixmap is called repatedly with ppix != NULL, which can happen from RRReplaceScanoutPixmap.

(Inspired by xserver commit b773a9c8126222e5fed2904d012fbf917a9f22fd)

---
 src/drmmode_display.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
src/drmmode_display.c +12 -12
index 00a484b..a5a34fd 100644
@@ -1142,22 +1142,22 @@ drmmode_set_scanout_pixmap(xf86CrtcPtr crtc, PixmapPtr ppix)
 {
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
 	RADEONInfoPtr info = RADEONPTR(crtc->scrn);
+	ScreenPtr screen = crtc->scrn->pScreen;
+	PixmapDirtyUpdatePtr dirty;
 
-	if (!ppix) {
-		ScreenPtr screen = crtc->scrn->pScreen;
-		PixmapDirtyUpdatePtr dirty;
-
-		xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
-			if (dirty->slave_dst !=
-			    drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
-				continue;
+	xorg_list_for_each_entry(dirty, &screen->pixmap_dirty_list, ent) {
+		if (dirty->slave_dst !=
+		    drmmode_crtc->scanout[drmmode_crtc->scanout_id].pixmap)
+			continue;
 
-			PixmapStopDirtyTracking(dirty->src, dirty->slave_dst);
-			drmmode_crtc_scanout_free(drmmode_crtc);
-			return TRUE;
-		}
+		PixmapStopDirtyTracking(dirty->src, dirty->slave_dst);
+		drmmode_crtc_scanout_free(drmmode_crtc);
+		break;
 	}
 
+	if (!ppix)
+		return TRUE;
+
 	if (!drmmode_crtc_scanout_create(crtc, &drmmode_crtc->scanout[0],
 					 ppix->drawable.width,
 					 ppix->drawable.height))
Signature · 6 lines
2.10.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#4 lore raw

PATCH 3/4 PRIME: Fix swapping of provider sink / source capabilities

In reply to a message not in the archive

From: Hans de Goede <[email protected]>

When a card has import capability it can be an offload _sink_, not a source and vice versa for export capability.

This went unnoticed sofar because most gpus have both import and export capability.

(Ported from xserver commit 94a1c77259ce39ba59ad87615df39b570ffab435)

---
 src/radeon_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/radeon_kms.c +2 -2
index faa1e0f..68c7837 100644
@@ -1587,9 +1587,9 @@ static void RADEONSetupCapabilities(ScrnInfoPtr pScrn)
     ret = drmGetCap(info->dri2.drm_fd, DRM_CAP_PRIME, &value);
     if (ret == 0) {
 	if (value & DRM_PRIME_CAP_EXPORT)
-	    pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SinkOffload;
+	    pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SourceOffload;
 	if (value & DRM_PRIME_CAP_IMPORT) {
-	    pScrn->capabilities |= RR_Capability_SourceOffload;
+	    pScrn->capabilities |= RR_Capability_SinkOffload;
 	    if (info->drmmode.count_crtcs)
 		pScrn->capabilities |= RR_Capability_SinkOutput;
 	}
Signature · 6 lines
2.10.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#5 lore raw

PATCH 4/4 Consume all available udev events at once

In reply to a message not in the archive

From: Michel Dänzer <[email protected]>

We get multiple udev events for actions like docking a laptop into its station or plugging a monitor to the station. By consuming as many events as we can, we reduce the number of output re-evalutions.

It depends on the timing how many events can be consumed at once.

(Inspired by xserver commit 363f4273dd4aec3e26cc57ecb6c20f27e6c813d8)

---
 src/drmmode_display.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
src/drmmode_display.c +8 -5
index a5a34fd..9cf4846 100644
@@ -2656,12 +2656,15 @@ drmmode_handle_uevents(int fd, void *closure)
 	drmmode_ptr drmmode = closure;
 	ScrnInfoPtr scrn = drmmode->scrn;
 	struct udev_device *dev;
-	dev = udev_monitor_receive_device(drmmode->uevent_monitor);
-	if (!dev)
-		return;
+	Bool received = FALSE;
+
+	while ((dev = udev_monitor_receive_device(drmmode->uevent_monitor))) {
+		udev_device_unref(dev);
+		received = TRUE;
+	}
 
-	radeon_mode_hotplug(scrn, drmmode);
-	udev_device_unref(dev);
+	if (received)
+		radeon_mode_hotplug(scrn, drmmode);
 }
 #endif
 
Signature · 6 lines
2.10.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by Alex Deucher
#6 lore raw
In reply to a message not in the archive
Quoted 10 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Michel Dänzer
Sent: Tuesday, October 25, 2016 4:41 AM
To: [email protected]
Subject: [PATCH xf86-video-ati 0/4] Fixes ported from / inspired by modesetting driver changes

From: Michel Dänzer <[email protected]>

Quoted 8 lines

Hans de Goede (1):
PRIME: Fix swapping of provider sink / source capabilities

Michel Dänzer (3):
Don't rely on randr_crtc->scanout_pixmap in
drmmode_set_scanout_pixmap
Always call PixmapStopDirtyTracking in drmmode_set_scanout_pixmap Consume all available udev events at once

For the series:

Quoted 5 lines
 src/drmmode_display.c | 30 ++++++++++++++++++++----------
 src/radeon_kms.c      |  4 ++--
 2 files changed, 22 insertions(+), 12 deletions(-)
Quoted 7 lines

--
2.10.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx