[mutter] wayland/dma-buf: Add tranche priorities
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] wayland/dma-buf: Add tranche priorities
- Date: Wed, 5 Jan 2022 17:17:47 +0000 (UTC)
commit 9a47766a9627e75fffb7c5a20c0e3d63aae38539
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Fri Aug 6 16:20:14 2021 +0200
wayland/dma-buf: Add tranche priorities
Unused for now, but will be added to prioritize scanout tranches higher
than render only ones.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1959>
src/wayland/meta-wayland-dma-buf.c | 36 ++++++++++++++++++++++++++++++++----
1 file changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/src/wayland/meta-wayland-dma-buf.c b/src/wayland/meta-wayland-dma-buf.c
index e009a3874e..0ce6ae11f6 100644
--- a/src/wayland/meta-wayland-dma-buf.c
+++ b/src/wayland/meta-wayland-dma-buf.c
@@ -76,6 +76,12 @@ typedef enum _MetaWaylandDmaBufTrancheFlags
META_WAYLAND_DMA_BUF_TRANCHE_FLAG_SCANOUT = 1,
} MetaWaylandDmaBufTrancheFlags;
+typedef enum _MetaWaylandDmaBufTranchePriority
+{
+ META_WAYLAND_DMA_BUF_TRANCHE_PRIORITY_HIGH = 0,
+ META_WAYLAND_DMA_BUF_TRANCHE_PRIORITY_DEFAULT = 10,
+} MetaWaylandDmaBufTranchePriority;
+
typedef struct _MetaWaylandDmaBufFormat
{
uint32_t drm_format;
@@ -85,6 +91,7 @@ typedef struct _MetaWaylandDmaBufFormat
typedef struct _MetaWaylandDmaBufTranche
{
+ MetaWaylandDmaBufTranchePriority priority;
dev_t target_device_id;
GArray *formats;
MetaWaylandDmaBufTrancheFlags flags;
@@ -127,16 +134,33 @@ G_DEFINE_TYPE (MetaWaylandDmaBufBuffer, meta_wayland_dma_buf_buffer, G_TYPE_OBJE
G_DEFINE_TYPE (MetaWaylandDmaBufManager, meta_wayland_dma_buf_manager,
G_TYPE_OBJECT)
+static gint
+compare_tranches (gconstpointer a,
+ gconstpointer b)
+{
+ const MetaWaylandDmaBufTranche *tranche_a = a;
+ const MetaWaylandDmaBufTranche *tranche_b = b;
+
+ if (tranche_a->priority > tranche_b->priority)
+ return 1;
+ if (tranche_a->priority < tranche_b->priority)
+ return -1;
+ else
+ return 0;
+}
+
static MetaWaylandDmaBufTranche *
-meta_wayland_dma_buf_tranche_new (dev_t device_id,
- GArray *formats,
- MetaWaylandDmaBufTrancheFlags flags)
+meta_wayland_dma_buf_tranche_new (dev_t device_id,
+ GArray *formats,
+ MetaWaylandDmaBufTranchePriority priority,
+ MetaWaylandDmaBufTrancheFlags flags)
{
MetaWaylandDmaBufTranche *tranche;
tranche = g_new0 (MetaWaylandDmaBufTranche, 1);
tranche->target_device_id = device_id;
tranche->formats = g_array_copy (formats);
+ tranche->priority = priority;
tranche->flags = flags;
return tranche;
@@ -217,7 +241,8 @@ static void
meta_wayland_dma_buf_feedback_add_tranche (MetaWaylandDmaBufFeedback *feedback,
MetaWaylandDmaBufTranche *tranche)
{
- feedback->tranches = g_list_append (feedback->tranches, tranche);
+ feedback->tranches = g_list_insert_sorted (feedback->tranches, tranche,
+ compare_tranches);
}
static MetaWaylandDmaBufFeedback *
@@ -1053,15 +1078,18 @@ init_formats (MetaWaylandDmaBufManager *dma_buf_manager,
static void
init_default_feedback (MetaWaylandDmaBufManager *dma_buf_manager)
{
+ MetaWaylandDmaBufTranchePriority priority;
MetaWaylandDmaBufTrancheFlags flags;
MetaWaylandDmaBufTranche *tranche;
dma_buf_manager->default_feedback =
meta_wayland_dma_buf_feedback_new (dma_buf_manager->main_device_id);
+ priority = META_WAYLAND_DMA_BUF_TRANCHE_PRIORITY_DEFAULT;
flags = META_WAYLAND_DMA_BUF_TRANCHE_FLAG_NONE;
tranche = meta_wayland_dma_buf_tranche_new (dma_buf_manager->main_device_id,
dma_buf_manager->formats,
+ priority,
flags);
meta_wayland_dma_buf_feedback_add_tranche (dma_buf_manager->default_feedback,
tranche);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]