uxa: Update Screen Pixmap width/height first

Since commit dd6db82680 [2.99.912]
Author: Chris Wilson <chris@chris-wilson.co.uk>
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 <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-06-27 16:26:24 +01:00
parent 0584604b53
commit 72c041e57b
2 changed files with 26 additions and 13 deletions

View File

@ -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)

View File

@ -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