[PATCH xf86-video-ati 16/21] Check dimensions passed to drmmode_xf86crtc_resize

Michel Dänzer michel at daenzer.net
Wed Jul 11 17:28:01 UTC 2018


From: Michel Dänzer <michel.daenzer at amd.com>

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.

(Ported from amdgpu commit 940c8b39f79789d4d5ddb8ab8d25a8ae05932756)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 25fcabfa1..4b5f9f456 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2260,6 +2260,14 @@ 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_WARNING,
+			   "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->allowColorTiling && !info->shadow_primary) {
 		if (info->ChipFamily < CHIP_FAMILY_R600 || info->allowColorTiling2D)
 			usage |= RADEON_CREATE_PIXMAP_TILING_MACRO;
-- 
2.18.0



More information about the amd-gfx mailing list