sna/present: Cancel pending unflips when resizing the screen

Otherwise we try to flip back before we complete the mode change.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2016-03-24 10:31:02 +00:00
parent f656f6afa2
commit 1b82b7b48d
3 changed files with 17 additions and 0 deletions

View File

@ -599,11 +599,13 @@ bool sna_present_open(struct sna *sna, ScreenPtr pScreen);
void sna_present_update(struct sna *sna);
void sna_present_close(struct sna *sna, ScreenPtr pScreen);
void sna_present_vblank_handler(struct drm_event_vblank *event);
void sna_present_cancel_flip(struct sna *sna);
#else
static inline bool sna_present_open(struct sna *sna, ScreenPtr pScreen) { return false; }
static inline void sna_present_update(struct sna *sna) { }
static inline void sna_present_close(struct sna *sna, ScreenPtr pScreen) { }
static inline void sna_present_vblank_handler(struct drm_event_vblank *event) { }
void sna_present_cancel_flip(struct sna *sna) { }
#endif
extern bool sna_crtc_set_sprite_rotation(xf86CrtcPtr crtc, uint32_t rotation);

View File

@ -5346,6 +5346,8 @@ sna_mode_resize(ScrnInfoPtr scrn, int width, int height)
assert(sna->mode.shadow_damage == NULL);
assert(sna->mode.shadow == NULL);
/* Cancel a pending [un]flip (as the pixmaps no longer match) */
sna_present_cancel_flip(sna);
copy_front(sna, sna->front, new_front);
screen->SetScreenPixmap(new_front);

View File

@ -790,6 +790,19 @@ reset_mode:
goto reset_mode;
}
void sna_present_cancel_flip(struct sna *sna)
{
if (sna->present.unflip) {
const struct ust_msc *swap;
swap = sna_crtc_last_swap(sna_primary_crtc(sna));
present_event_notify(sna->present.unflip,
swap_ust(swap), swap->msc);
sna->present.unflip = 0;
}
}
static present_screen_info_rec present_info = {
.version = PRESENT_SCREEN_INFO_VERSION,