From ffb484f7ef84099019b196ef97bfb2355eb6d52a Mon Sep 17 00:00:00 2001 From: Maarten Maathuis Date: Sat, 29 Nov 2008 14:30:55 +0100 Subject: randr: Avoid needlessly creating a shadow framebuffer. - pScreen->width and height were zero, so it didn't "fit" the screen. --- hw/xfree86/modes/xf86Crtc.c | 13 +++++++++++-- hw/xfree86/modes/xf86Rotate.c | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index e9652e1cb..6a3731c7c 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -112,6 +112,8 @@ xf86CrtcCreate (ScrnInfoPtr scrn, crtc->filter_width = 0; crtc->filter_height = 0; crtc->transform_in_use = FALSE; + crtc->transformPresent = FALSE; + crtc->desiredTransformPresent = FALSE; memset (&crtc->bounds, '\0', sizeof (crtc->bounds)); if (xf86_config->crtc) @@ -241,6 +243,8 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati RRTransformPtr transform, int x, int y) { ScrnInfoPtr scrn = crtc->scrn; + /* During ScreenInit() scrn->pScreen is still NULL */ + ScreenPtr pScreen = screenInfo.screens[scrn->scrnIndex]; xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(scrn); int i; Bool ret = FALSE; @@ -254,9 +258,9 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati if (crtc->funcs->set_mode_major) return crtc->funcs->set_mode_major(crtc, mode, rotation, x, y); - + crtc->enabled = xf86CrtcInUse (crtc); - + if (!crtc->enabled) { /* XXX disable crtc? */ @@ -290,6 +294,11 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati } else crtc->transformPresent = FALSE; + /* xf86CrtcFitsScreen() relies on these values being correct. */ + /* This should ensure the values are always set at modeset time. */ + pScreen->width = scrn->virtualX; + pScreen->height = scrn->virtualY; + /* Shift offsets that move us out of virtual size */ if (x + mode->HDisplay > xf86_config->maxWidth || y + mode->VDisplay > xf86_config->maxHeight) diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c index 07189a5ba..d7f7b3b78 100644 --- a/hw/xfree86/modes/xf86Rotate.c +++ b/hw/xfree86/modes/xf86Rotate.c @@ -464,7 +464,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc) /* mark shadowed area as damaged so it will be repainted */ xf86CrtcDamageShadow (crtc); } - + if (!xf86_config->rotation_damage) { /* Create damage structure */ -- cgit v1.2.3