[PATCH 15/19] present: In window flip mode report damage on flip to driver

Roman Gilg subdiff at gmail.com
Mon Jan 29 13:34:13 UTC 2018


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

Signed-off-by: Roman Gilg <subdiff at gmail.com>
---
 present/present.h      |  3 ++-
 present/present_wnmd.c | 24 +++++++++++++-----------
 2 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/present/present.h b/present/present.h
index 7929cf9..b9e7839 100644
--- a/present/present.h
+++ b/present/present.h
@@ -96,7 +96,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
  *
diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index c428232..77f4f19 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -351,7 +351,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);
@@ -361,7 +362,8 @@ present_wnmd_flip(WindowPtr window,
                                             event_id,
                                             target_msc,
                                             pixmap,
-                                            sync_flip);
+                                            sync_flip,
+                                            damage);
 }
 
 static void
@@ -422,12 +424,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)) {
 
                 /* Fix window pixmap: Copy pixmap content to window drawable */
                 present_copy_region(&window->drawable,
@@ -436,14 +445,7 @@ present_wnmd_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
                                     vblank->x_off,
                                     vblank->y_off);
 
-                /* 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;
             }
-- 
2.7.4



More information about the xorg-devel mailing list