Mesa (master): st/xorg: Re-enable crtc on resize
Jakob Bornecrantz
wallbraker at kemper.freedesktop.org
Sat Feb 27 03:10:20 UTC 2010
Module: Mesa
Branch: master
Commit: bbefd86125f89451d75a96f31e1f4c871a1582c0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bbefd86125f89451d75a96f31e1f4c871a1582c0
Author: Jakob Bornecrantz <jakob at vmware.com>
Date: Thu Feb 25 16:51:30 2010 +0100
st/xorg: Re-enable crtc on resize
---
src/gallium/state_trackers/xorg/xorg_driver.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c
index aa8ab79..8fb6e5a 100644
--- a/src/gallium/state_trackers/xorg/xorg_driver.c
+++ b/src/gallium/state_trackers/xorg/xorg_driver.c
@@ -183,10 +183,12 @@ drv_probe_ddc(ScrnInfoPtr pScrn, int index)
static Bool
drv_crtc_resize(ScrnInfoPtr pScrn, int width, int height)
{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);
modesettingPtr ms = modesettingPTR(pScrn);
ScreenPtr pScreen = pScrn->pScreen;
int old_width, old_height;
PixmapPtr rootPixmap;
+ int i;
if (width == pScrn->virtualX && height == pScrn->virtualY)
return TRUE;
@@ -204,13 +206,29 @@ drv_crtc_resize(ScrnInfoPtr pScrn, int width, int height)
pScrn->displayWidth = rootPixmap->devKind / (rootPixmap->drawable.bitsPerPixel / 8);
- if (ms->create_front_buffer(pScrn) && ms->bind_front_buffer(pScrn))
- return TRUE;
+ if (!ms->create_front_buffer(pScrn) || !ms->bind_front_buffer(pScrn))
+ goto error_create;
/*
- * This is the error recovery path.
+ * create && bind will turn off all crtc(s) in the kernel so we need to
+ * re-enable all the crtcs again. For real HW we might want to do this
+ * before destroying the old framebuffer.
*/
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ xf86CrtcPtr crtc = xf86_config->crtc[i];
+
+ if (!crtc->enabled)
+ continue;
+
+ crtc->funcs->set_mode_major(crtc, &crtc->mode, crtc->rotation, crtc->x, crtc->y);
+ }
+
+ return TRUE;
+ /*
+ * This is the error recovery path.
+ */
+error_create:
if (!pScreen->ModifyPixmapHeader(rootPixmap, old_width, old_height, -1, -1, -1, NULL))
FatalError("failed to resize rootPixmap error path\n");
More information about the mesa-commit
mailing list