present: In window flip mode report damage on flip to driver

Calculate damage before trying to flip and report it to the driver.
This allows drivers to optimize their rendering.

Signed-off-by: Roman Gilg <subdiff@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Roman Gilg 2018-03-13 16:00:49 +01:00 committed by Adam Jackson
parent 029608dd80
commit 66a5c0bccb
2 changed files with 15 additions and 12 deletions

View File

@ -105,7 +105,8 @@ typedef Bool (*present_wnmd_flip_ptr) (WindowPtr window,
uint64_t event_id,
uint64_t target_msc,
PixmapPtr pixmap,
Bool sync_flip);
Bool sync_flip,
RegionPtr damage);
/* "unflip" back to the regular screen scanout buffer
*

View File

@ -350,7 +350,8 @@ present_wnmd_flip(WindowPtr window,
uint64_t event_id,
uint64_t target_msc,
PixmapPtr pixmap,
Bool sync_flip)
Bool sync_flip,
RegionPtr damage)
{
ScreenPtr screen = crtc->pScreen;
present_screen_priv_ptr screen_priv = present_screen_priv(screen);
@ -360,7 +361,8 @@ present_wnmd_flip(WindowPtr window,
event_id,
target_msc,
pixmap,
sync_flip);
sync_flip,
damage);
}
static void
@ -449,12 +451,19 @@ present_wnmd_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
*/
xorg_list_add(&vblank->event_queue, &window_priv->flip_queue);
/* Set update region as damaged */
if (vblank->update) {
damage = vblank->update;
RegionIntersect(damage, damage, &window->clipList);
} else
damage = &window->clipList;
/* Try to flip - the vblank is now pending
*/
window_priv->flip_pending = vblank;
// ask the driver
if (present_wnmd_flip(vblank->window, vblank->crtc, vblank->event_id,
vblank->target_msc, vblank->pixmap, vblank->sync_flip)) {
vblank->target_msc, vblank->pixmap, vblank->sync_flip, damage)) {
ScreenPtr screen = window->drawable.pScreen;
WindowPtr toplvl_window = present_wnmd_toplvl_pixmap_window(vblank->window);
PixmapPtr old_pixmap = screen->GetWindowPixmap(window);
@ -464,14 +473,7 @@ present_wnmd_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
vblank->pixmap->refcnt++;
dixDestroyPixmap(old_pixmap, old_pixmap->drawable.id);
/* Report update region as damaged
*/
if (vblank->update) {
damage = vblank->update;
RegionIntersect(damage, damage, &window->clipList);
} else
damage = &window->clipList;
/* Report damage */
DamageDamageRegion(&vblank->window->drawable, damage);
return;
}