From 8fe45d775078469d7b5cd72553af0e76dbd6bb31 Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 27 Dec 2021 16:39:34 -0300 Subject: [PATCH] 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. Part-of: --- 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 c3ede8aea..9c13661ff 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 456b5bd97..0e14dbb61 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 ())