summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-06-12 18:45:08 +0200
committerMichel Dänzer <michel@daenzer.net>2018-06-12 18:45:08 +0200
commit940c8b39f79789d4d5ddb8ab8d25a8ae05932756 (patch)
tree75ff0bb7dd211c0d84ebe2f69d379720b940c738 /src
parent74124f2c17dbb4b752707bb7eee398ae099e8a2c (diff)
Check dimensions passed to drmmode_xf86crtc_resize
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.
Diffstat (limited to 'src')
-rw-r--r--src/drmmode_display.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 8a1a201..c55b4b7 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -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_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->shadow_primary)
hint = AMDGPU_CREATE_PIXMAP_LINEAR | AMDGPU_CREATE_PIXMAP_GTT;
else if (!info->use_glamor)