From 72c041e57b99367f327c51c50fce2a55d618fc63 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 27 Jun 2014 16:26:24 +0100 Subject: [PATCH] uxa: Update Screen Pixmap width/height first Since commit dd6db82680b05cde4a47116b7096c054f3837e20 [2.99.912] Author: Chris Wilson Date: Fri May 9 20:26:19 2014 +0100 uxa: Add DRI3 and miSyncShm support we verify that the attaching bo meets the constraints required for the Pixmap. However, when updating the ScreenPixmap following a resize, we did not update the Pixmap size until after we tried to update the bo, resulting in a validation failure when shrinking the screen. Signed-off-by: Chris Wilson --- src/uxa/intel_display.c | 5 +++-- src/uxa/intel_uxa.c | 34 +++++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/uxa/intel_display.c b/src/uxa/intel_display.c index a745dc5a..0b831409 100644 --- a/src/uxa/intel_display.c +++ b/src/uxa/intel_display.c @@ -1461,6 +1461,9 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height) scrn->virtualX = width; scrn->virtualY = height; + if (!intel_uxa_create_screen_resources(scrn->pScreen)) + goto fail; + for (i = 0; i < xf86_config->num_crtc; i++) { xf86CrtcPtr crtc = xf86_config->crtc[i]; @@ -1471,8 +1474,6 @@ intel_xf86crtc_resize(ScrnInfoPtr scrn, int width, int height) goto fail; } - intel_uxa_create_screen_resources(scrn->pScreen); - if (old_fb_id) drmModeRmFB(mode->fd, old_fb_id); if (old_front) diff --git a/src/uxa/intel_uxa.c b/src/uxa/intel_uxa.c index 5b037f1d..b3961881 100644 --- a/src/uxa/intel_uxa.c +++ b/src/uxa/intel_uxa.c @@ -1260,6 +1260,7 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen) PixmapPtr pixmap; intel_screen_private *intel = intel_get_screen_private(scrn); dri_bo *bo = intel->front_buffer; + int old_width, old_height, old_pitch; if (!uxa_resources_init(screen)) return FALSE; @@ -1268,23 +1269,34 @@ Bool intel_uxa_create_screen_resources(ScreenPtr screen) return FALSE; pixmap = screen->GetScreenPixmap(screen); + old_width = pixmap->drawable.width; + old_height = pixmap->drawable.height; + old_pitch = pixmap->devKind; + + if (!screen->ModifyPixmapHeader(pixmap, + scrn->virtualX, + scrn->virtualY, + -1, -1, + intel->front_pitch, + NULL)) + return FALSE; + intel_set_pixmap_bo(pixmap, bo); if (intel_get_pixmap_private(pixmap) == NULL) - return FALSE; - - intel_get_pixmap_private(pixmap)->pinned |= PIN_SCANOUT; - screen->ModifyPixmapHeader(pixmap, - scrn->virtualX, - scrn->virtualY, - -1, -1, - intel->front_pitch, - NULL); - scrn->displayWidth = intel->front_pitch / intel->cpp; + goto err; if (!intel_glamor_create_screen_resources(screen)) - return FALSE; + goto err; + + intel_get_pixmap_private(pixmap)->pinned |= PIN_SCANOUT; + scrn->displayWidth = intel->front_pitch / intel->cpp; return TRUE; + +err: + screen->ModifyPixmapHeader(pixmap, + old_width, old_height, -1, -1, old_pitch, NULL); + return FALSE; } #ifdef CREATE_PIXMAP_USAGE_SHARED