From 3885d2b3f6b767e45ab65f9bf21aaa7be12709d9 Mon Sep 17 00:00:00 2001 From: Albert Esteve Date: Mon, 8 Jan 2024 15:40:52 +0100 Subject: [PATCH] backends/native: Set hotspot property on updates Add a `has_update` flag to the cursor hotspot struct to allow selective update of the hotsport property only when it will take an effect. Part-of: --- .../native/meta-kms-impl-device-atomic.c | 31 +++++++++++++++++++ src/backends/native/meta-kms-update-private.h | 1 + src/backends/native/meta-kms-update.c | 1 + 3 files changed, 33 insertions(+) diff --git a/src/backends/native/meta-kms-impl-device-atomic.c b/src/backends/native/meta-kms-impl-device-atomic.c index 3d361463e..df153213f 100644 --- a/src/backends/native/meta-kms-impl-device-atomic.c +++ b/src/backends/native/meta-kms-impl-device-atomic.c @@ -612,6 +612,37 @@ process_plane_assignment (MetaKmsImplDevice *impl_device, } } } + + if (plane_assignment->cursor_hotspot.has_update) + { + struct { + MetaKmsPlaneProp prop; + uint64_t value; + } props[] = { + { + .prop = META_KMS_PLANE_PROP_HOTSPOT_X, + .value = plane_assignment->cursor_hotspot.is_valid ? + plane_assignment->cursor_hotspot.x : + 0, + }, + { + .prop = META_KMS_PLANE_PROP_HOTSPOT_Y, + .value = plane_assignment->cursor_hotspot.is_valid ? + plane_assignment->cursor_hotspot.y : + 0, + }, + }; + + for (i = 0; i < G_N_ELEMENTS (props); i++) + { + if (!add_plane_property (impl_device, + plane, req, + props[i].prop, + props[i].value, + error)) + return FALSE; + } + } } else { diff --git a/src/backends/native/meta-kms-update-private.h b/src/backends/native/meta-kms-update-private.h index 9e0b9faf3..efdd51312 100644 --- a/src/backends/native/meta-kms-update-private.h +++ b/src/backends/native/meta-kms-update-private.h @@ -66,6 +66,7 @@ typedef struct _MetaKmsPlaneAssignment MetaKmsPlaneRotation rotation; struct { + gboolean has_update; gboolean is_valid; int x; int y; diff --git a/src/backends/native/meta-kms-update.c b/src/backends/native/meta-kms-update.c index 92bf3362c..2d4be8096 100644 --- a/src/backends/native/meta-kms-update.c +++ b/src/backends/native/meta-kms-update.c @@ -607,6 +607,7 @@ meta_kms_plane_assignment_set_cursor_hotspot (MetaKmsPlaneAssignment *plane_assi int x, int y) { + plane_assignment->cursor_hotspot.has_update = TRUE; plane_assignment->cursor_hotspot.is_valid = TRUE; plane_assignment->cursor_hotspot.x = x; plane_assignment->cursor_hotspot.y = y;