[mutter] clutter/frame-info: Add ZERO_COPY flag



commit 93ef83a96c054868d98fa49af8990b56f221dccf
Author: Ivan Molodetskikh <yalterz gmail com>
Date:   Thu Jan 28 11:21:01 2021 +0300

    clutter/frame-info: Add ZERO_COPY flag
    
    Will be used in the presentation-time Wayland protocol.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1484>

 clutter/clutter/clutter-stage.h           | 8 ++++++++
 clutter/clutter/cogl/clutter-stage-cogl.c | 3 +++
 2 files changed, 11 insertions(+)
---
diff --git a/clutter/clutter/clutter-stage.h b/clutter/clutter/clutter-stage.h
index c697e31821..36aafd0a58 100644
--- a/clutter/clutter/clutter-stage.h
+++ b/clutter/clutter/clutter-stage.h
@@ -119,6 +119,14 @@ typedef enum
   CLUTTER_FRAME_INFO_FLAG_NONE = 0,
   /* presentation_time timestamp was provided by the hardware */
   CLUTTER_FRAME_INFO_FLAG_HW_CLOCK = 1 << 0,
+  /*
+   * The presentation of this frame was done zero-copy. This means the buffer
+   * from the client was given to display hardware as is, without copying it.
+   * Compositing with OpenGL counts as copying, even if textured directly from
+   * the client buffer. Possible zero-copy cases include direct scanout of a
+   * fullscreen surface and a surface on a hardware overlay.
+   */
+  CLUTTER_FRAME_INFO_FLAG_ZERO_COPY = 1 << 1,
 } ClutterFrameInfoFlag;
 
 /**
diff --git a/clutter/clutter/cogl/clutter-stage-cogl.c b/clutter/clutter/cogl/clutter-stage-cogl.c
index 8c9c503718..5a10934307 100644
--- a/clutter/clutter/cogl/clutter-stage-cogl.c
+++ b/clutter/clutter/cogl/clutter-stage-cogl.c
@@ -832,6 +832,9 @@ frame_cb (CoglOnscreen  *onscreen,
       if (cogl_frame_info_is_hw_clock (frame_info))
         flags |= CLUTTER_FRAME_INFO_FLAG_HW_CLOCK;
 
+      if (cogl_frame_info_is_zero_copy (frame_info))
+        flags |= CLUTTER_FRAME_INFO_FLAG_ZERO_COPY;
+
       clutter_frame_info = (ClutterFrameInfo) {
         .frame_counter = cogl_frame_info_get_global_frame_counter (frame_info),
         .refresh_rate = cogl_frame_info_get_refresh_rate (frame_info),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]