From 02ac4a0a36c2aabbd39dab0c7cd13ed2516a2bed Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 15 Jun 2021 14:48:28 +0200 Subject: [PATCH] xf86drmMode: simplify drm_property_type_is No need to have two branches depending on DRM_MODE_PROP_EXTENDED_TYPE. We can just use drmModeGetPropertyType instead. This does introduce a slight change: previously, drm_property_type_is() could be called with non-type flags such as IMMUTABLE. However no user seems to do this (checked KWin/Mutter/Sway/Weston/Xorg). Signed-off-by: Simon Ser Reviewed-by: Emil Velikov --- xf86drmMode.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/xf86drmMode.h b/xf86drmMode.h index 14ffdf3d..de0e2fdb 100644 --- a/xf86drmMode.h +++ b/xf86drmMode.h @@ -142,20 +142,17 @@ typedef struct _drmModeProperty { uint32_t *blob_ids; /* store the blob IDs */ } drmModePropertyRes, *drmModePropertyPtr; -static inline int drm_property_type_is(const drmModePropertyPtr property, - uint32_t type) -{ - /* instanceof for props.. handles extended type vs original types: */ - if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE) - return (property->flags & DRM_MODE_PROP_EXTENDED_TYPE) == type; - return property->flags & type; -} - static inline uint32_t drmModeGetPropertyType(const drmModePropertyRes *prop) { return prop->flags & (DRM_MODE_PROP_LEGACY_TYPE | DRM_MODE_PROP_EXTENDED_TYPE); } +static inline int drm_property_type_is(const drmModePropertyPtr property, + uint32_t type) +{ + return drmModeGetPropertyType(property) == type; +} + typedef struct _drmModeCrtc { uint32_t crtc_id; uint32_t buffer_id; /**< FB id to connect to 0 = disconnect */