From 758e5e23fa7981691b7a531a58164783284e3659 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Tue, 22 Jun 2021 15:28:37 +0200 Subject: [PATCH] kms/mode: Add width/height getters This avoids some situations where one would otherwise need to fetch the drm mode to check the dimensions. Part-of: --- src/backends/native/meta-kms-mode.c | 12 ++++++++++++ src/backends/native/meta-kms-mode.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/src/backends/native/meta-kms-mode.c b/src/backends/native/meta-kms-mode.c index a52451620..88da86a85 100644 --- a/src/backends/native/meta-kms-mode.c +++ b/src/backends/native/meta-kms-mode.c @@ -30,6 +30,18 @@ struct _MetaKmsMode drmModeModeInfo drm_mode; }; +int +meta_kms_mode_get_width (MetaKmsMode *mode) +{ + return mode->drm_mode.hdisplay; +} + +int +meta_kms_mode_get_height (MetaKmsMode *mode) +{ + return mode->drm_mode.vdisplay; +} + uint32_t meta_kms_mode_create_blob_id (MetaKmsMode *mode, GError **error) diff --git a/src/backends/native/meta-kms-mode.h b/src/backends/native/meta-kms-mode.h index e017dc9f2..a3499cd99 100644 --- a/src/backends/native/meta-kms-mode.h +++ b/src/backends/native/meta-kms-mode.h @@ -34,6 +34,10 @@ typedef enum _MetaKmsModeFlag META_KMS_MODE_FLAG_FALLBACK_PORTRAIT = 1 << 1, } MetaKmsModeFlag; +int meta_kms_mode_get_width (MetaKmsMode *mode); + +int meta_kms_mode_get_height (MetaKmsMode *mode); + const char * meta_kms_mode_get_name (MetaKmsMode *mode); MetaKmsModeFlag meta_kms_mode_get_flags (MetaKmsMode *mode);