Skip to contentSkip to conversation

Check dimensions passed to drmmode_xf86crtc_resize

PATCH New Michel Dänzer 1 participant 1 message Jun 15, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Check dimensions passed to drmmode_xf86crtc_resize

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

When enabling a secondary GPU output, Xorg can try resizing the screen beyond the limit advertised by the driver, leading to drmModeAddFB failing and primary GPU outputs turning off. Check for this and bail instead.

---
 src/drmmode_display.c | 8 ++++++++
 1 file changed, 8 insertions(+)
src/drmmode_display.c +8 -0
index 8a1a201a8..a23724770 100644
@@ -2191,6 +2191,14 @@ static Bool drmmode_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height)
 	if (scrn->virtualX == width && scrn->virtualY == height)
 		return TRUE;
 
+	if (width > xf86_config->maxWidth || height > xf86_config->maxHeight) {
+		xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+			   "Xorg tried resizing screen to %dx%d, but maximum "
+			   "supported is %dx%d\n", width, height,
+			   xf86_config->maxWidth, xf86_config->maxHeight);
+		return FALSE;
+	}
+
 	if (info->shadow_primary)
 		hint = AMDGPU_CREATE_PIXMAP_LINEAR | AMDGPU_CREATE_PIXMAP_GTT;
 	else if (!info->use_glamor)
Signature · 6 lines
2.17.1

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