[mutter/gbsneto/scanout-screencast: 1/2] screen-cast/stream: Add DMABUF-only record flag




commit ef7f2c0b2729345517f4373db8940498903280f3
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Dec 27 16:39:34 2021 -0300

    screen-cast/stream: Add DMABUF-only record flag
    
    Next commits will reintroduce a certain behavior of stage
    capturing that can only happen with DMA-BUF buffers. To
    control this, add a new flag tp MetaScreenCastRecordFlags
    for this behavior.

 src/backends/meta-screen-cast-stream-src.c | 10 +++++++---
 src/backends/meta-screen-cast-stream-src.h |  1 +
 2 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c
index c3ede8aea8..9c13661ff1 100644
--- a/src/backends/meta-screen-cast-stream-src.c
+++ b/src/backends/meta-screen-cast-stream-src.c
@@ -430,15 +430,19 @@ maybe_record_cursor (MetaScreenCastStreamSrc *src,
 
 static gboolean
 do_record_frame (MetaScreenCastStreamSrc  *src,
+                 MetaScreenCastRecordFlag  flags,
                  struct spa_buffer        *spa_buffer,
                  uint8_t                  *data,
                  GError                  **error)
 {
   MetaScreenCastStreamSrcPrivate *priv =
     meta_screen_cast_stream_src_get_instance_private (src);
+  gboolean dmabuf_only;
 
-  if (spa_buffer->datas[0].data ||
-      spa_buffer->datas[0].type == SPA_DATA_MemFd)
+  dmabuf_only = flags & META_SCREEN_CAST_RECORD_FLAG_DMABUF_ONLY;
+  if (!dmabuf_only &&
+      (spa_buffer->datas[0].data ||
+       spa_buffer->datas[0].type == SPA_DATA_MemFd))
     {
       int width = priv->video_format.size.width;
       int height = priv->video_format.size.height;
@@ -566,7 +570,7 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc  *src,
   if (!(flags & META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY))
     {
       g_clear_handle_id (&priv->follow_up_frame_source_id, g_source_remove);
-      if (do_record_frame (src, spa_buffer, data, &error))
+      if (do_record_frame (src, flags, spa_buffer, data, &error))
         {
           struct spa_meta_region *spa_meta_video_crop;
 
diff --git a/src/backends/meta-screen-cast-stream-src.h b/src/backends/meta-screen-cast-stream-src.h
index 456b5bd978..0e14dbb61b 100644
--- a/src/backends/meta-screen-cast-stream-src.h
+++ b/src/backends/meta-screen-cast-stream-src.h
@@ -41,6 +41,7 @@ typedef enum _MetaScreenCastRecordFlag
 {
   META_SCREEN_CAST_RECORD_FLAG_NONE = 0,
   META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY = 1 << 0,
+  META_SCREEN_CAST_RECORD_FLAG_DMABUF_ONLY = 1 << 1,
 } MetaScreenCastRecordFlag;
 
 #define META_TYPE_SCREEN_CAST_STREAM_SRC (meta_screen_cast_stream_src_get_type ())


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