From 31b1814c8f7cc51644dc23559a5ce3b9f70188fb Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Thu, 7 Aug 2014 15:26:23 -0400 Subject: kms: fix problem with multiple displays Previously, by trying to re-use the fb creation in _resize(), we'd end up with a call back into _set_mode_major() with a bogus (all zero's) mode. Which results in trying to set mode 0x0@0 which results in bad things. The clocks react badly when trying to set them to 0Hz, so we need a bit of protection in the kernel for this. But we should get rid of the bogus modeset in DDX as well (which this patch does). Signed-off-by: Rob Clark --- src/drmmode_display.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/drmmode_display.c b/src/drmmode_display.c index b032f5f..5d1328b 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -340,9 +340,20 @@ drmmode_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, int fb_id; drmModeModeInfo kmode; - if (drmmode->fb_id == 0) - if (!drmmode_xf86crtc_resize(pScrn, mode->HDisplay, mode->VDisplay)) + if (drmmode->fb_id == 0) { + int pitch = MSMAlignedStride(pScrn->virtualX, + pScrn->bitsPerPixel); + ret = drmModeAddFB(drmmode->fd, pScrn->virtualX, pScrn->virtualY, + pScrn->depth, pScrn->bitsPerPixel, pitch, + fd_bo_handle(pMsm->scanout), &drmmode->fb_id); + if (ret) { + xf86DrvMsg(crtc->scrn->scrnIndex, X_ERROR, + "Error adding FB for scanout: %s\n", + strerror(-ret)); return FALSE; + } + pScrn->displayWidth = pitch / (pScrn->bitsPerPixel >> 3); + } if (!xf86CrtcRotate(crtc)) return FALSE; -- cgit v1.2.3