1
0
Fork 0

screen-cast/stream-src: Add timelines hash table

Will be used to look up a MetaDrmTimeline object for a syncobj file
descriptor.

v2:
* Add comment above timelines hash table declaration in
  MetaScreenCastStreamSrcPrivate. (Bilal Elmoussaoui)

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3876>
This commit is contained in:
Michel Dänzer 2024-06-28 18:55:06 +02:00 committed by Marge Bot
parent a3515eecb6
commit 0c10330392

View file

@ -117,6 +117,15 @@ typedef struct _MetaScreenCastStreamSrcPrivate
gboolean uses_dma_bufs; gboolean uses_dma_bufs;
GHashTable *dmabuf_handles; GHashTable *dmabuf_handles;
/* Keys: File descriptors
* Values: MetaDrmTimeline object pointers
*
* Both keys and values are owned by the hash table and destroyed /
* unreferenced when a key/value pair is removed from the hash table or the
* hash table is destroyed.
*/
GHashTable *timelines;
MtkRegion *redraw_clip; MtkRegion *redraw_clip;
GHashTable *modifiers; GHashTable *modifiers;
@ -1728,6 +1737,7 @@ meta_screen_cast_stream_src_dispose (GObject *object)
g_array_free (value, TRUE); g_array_free (value, TRUE);
g_clear_pointer (&priv->modifiers, g_hash_table_destroy); g_clear_pointer (&priv->modifiers, g_hash_table_destroy);
g_clear_pointer (&priv->timelines, g_hash_table_destroy);
g_clear_pointer (&priv->pipewire_stream, pw_stream_destroy); g_clear_pointer (&priv->pipewire_stream, pw_stream_destroy);
g_clear_pointer (&priv->dmabuf_handles, g_hash_table_destroy); g_clear_pointer (&priv->dmabuf_handles, g_hash_table_destroy);
g_clear_pointer (&priv->pipewire_core, pw_core_disconnect); g_clear_pointer (&priv->pipewire_core, pw_core_disconnect);
@ -1777,6 +1787,14 @@ meta_screen_cast_stream_src_get_property (GObject *object,
} }
} }
static void
close_fd (gpointer key)
{
int fd = GPOINTER_TO_INT (key);
close (fd);
}
static void static void
meta_screen_cast_stream_src_init (MetaScreenCastStreamSrc *src) meta_screen_cast_stream_src_init (MetaScreenCastStreamSrc *src)
{ {
@ -1787,6 +1805,9 @@ meta_screen_cast_stream_src_init (MetaScreenCastStreamSrc *src)
g_hash_table_new_full (NULL, NULL, NULL, g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) cogl_dma_buf_handle_free); (GDestroyNotify) cogl_dma_buf_handle_free);
priv->timelines =
g_hash_table_new_full (NULL, NULL, close_fd, g_object_unref);
priv->modifiers = g_hash_table_new (NULL, NULL); priv->modifiers = g_hash_table_new (NULL, NULL);
} }