1
0
Fork 0

backends/native: Add PLANE_PROP_HOTSPOT_[X,Y]

Add META_KMS_PLANE_PROP_HOTSPOT_[X,Y] properties
to the MetaKmsPlaneProp enumeration, and
properly initialise them.

Also, add a convenience method in meta-kms-plane
(i.e., `meta_kms_plane_supports_cursor_hotspot`)
to check whether a plane supports hotspot
property setting.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3337>
This commit is contained in:
Albert Esteve 2023-10-23 15:08:44 +02:00
parent 8252f71447
commit 4b9d1271a0
4 changed files with 44 additions and 8 deletions

View file

@ -405,14 +405,17 @@ maybe_update_cursor_plane (MetaKmsCursorManagerImpl *cursor_manager_impl,
.height = round (cursor_rect.size.height),
};
plane_assignment = meta_kms_update_assign_plane (update,
crtc, cursor_plane,
buffer,
src_rect, dst_rect,
assign_plane_flags);
meta_kms_plane_assignment_set_cursor_hotspot (plane_assignment,
(int) roundf (hotspot->x),
(int) roundf (hotspot->y));
if (meta_kms_plane_supports_cursor_hotspot (cursor_plane))
{
plane_assignment = meta_kms_update_assign_plane (update,
crtc, cursor_plane,
buffer,
src_rect, dst_rect,
assign_plane_flags);
meta_kms_plane_assignment_set_cursor_hotspot (plane_assignment,
(int) roundf (hotspot->x),
(int) roundf (hotspot->y));
}
}
else
{

View file

@ -40,6 +40,8 @@ typedef enum _MetaKmsPlaneProp
META_KMS_PLANE_PROP_CRTC_ID,
META_KMS_PLANE_PROP_FB_DAMAGE_CLIPS_ID,
META_KMS_PLANE_PROP_IN_FENCE_FD,
META_KMS_PLANE_PROP_HOTSPOT_X,
META_KMS_PLANE_PROP_HOTSPOT_Y,
META_KMS_PLANE_N_PROPS
} MetaKmsPlaneProp;

View file

@ -26,6 +26,8 @@
#include "backends/meta-monitor-transform.h"
#include "backends/native/meta-kms-crtc.h"
#include "backends/native/meta-kms-impl-device.h"
#include "backends/native/meta-kms-impl-device-atomic.h"
#include "backends/native/meta-kms-device-private.h"
#include "backends/native/meta-kms-update-private.h"
typedef struct _MetaKmsPlanePropTable
@ -189,6 +191,23 @@ meta_kms_plane_is_transform_handled (MetaKmsPlane *plane,
return FALSE;
}
gboolean
meta_kms_plane_supports_cursor_hotspot (MetaKmsPlane *plane)
{
MetaKmsImplDevice *impl_device =
meta_kms_device_get_impl_device (plane->device);
if (META_IS_KMS_IMPL_DEVICE_ATOMIC (impl_device))
{
return (meta_kms_plane_get_prop_id (plane, META_KMS_PLANE_PROP_HOTSPOT_X) &&
meta_kms_plane_get_prop_id (plane, META_KMS_PLANE_PROP_HOTSPOT_Y));
}
else
{
return TRUE;
}
}
GArray *
meta_kms_plane_get_modifiers_for_format (MetaKmsPlane *plane,
uint32_t format)
@ -505,6 +524,16 @@ init_properties (MetaKmsPlane *plane,
.name = "IN_FENCE_FD",
.type = DRM_MODE_PROP_SIGNED_RANGE,
},
[META_KMS_PLANE_PROP_HOTSPOT_X] =
{
.name = "HOTSPOT_X",
.type = DRM_MODE_PROP_SIGNED_RANGE,
},
[META_KMS_PLANE_PROP_HOTSPOT_Y] =
{
.name = "HOTSPOT_Y",
.type = DRM_MODE_PROP_SIGNED_RANGE,
},
},
.rotation_bitmask = {
[META_KMS_PLANE_ROTATION_BIT_ROTATE_0] =

View file

@ -47,6 +47,8 @@ MetaKmsPlaneType meta_kms_plane_get_plane_type (MetaKmsPlane *plane);
gboolean meta_kms_plane_is_transform_handled (MetaKmsPlane *plane,
MetaMonitorTransform transform);
gboolean meta_kms_plane_supports_cursor_hotspot (MetaKmsPlane *plane);
GArray * meta_kms_plane_get_modifiers_for_format (MetaKmsPlane *plane,
uint32_t format);