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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2159>
This commit is contained in:
Jonas Ådahl 2021-06-22 15:28:37 +02:00 committed by Marge Bot
parent 990267026a
commit 758e5e23fa
2 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -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);