summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2014-08-07 15:26:23 -0400
committerRob Clark <robdclark@gmail.com>2014-08-07 16:26:11 -0400
commit31b1814c8f7cc51644dc23559a5ce3b9f70188fb (patch)
tree501dc0f67d373aad090e0cdda36c4e3f114c4c65
parent4d3bbdd7e3d721540a98378e1aae4bd108bfd3e6 (diff)
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 <robdclark@gmail.com>
-rw-r--r--src/drmmode_display.c15
1 files 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;