diff options
author | Simon Ser <contact@emersion.fr> | 2021-06-15 14:48:28 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-09-27 15:02:03 +0200 |
commit | 02ac4a0a36c2aabbd39dab0c7cd13ed2516a2bed (patch) | |
tree | babf1c3df04385878f21504aa5f107488afb713a /xf86drmMode.h | |
parent | bb709e60233d457f0c63d7b77baaab80f264ba16 (diff) |
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 <contact@emersion.fr>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Diffstat (limited to 'xf86drmMode.h')
-rw-r--r-- | xf86drmMode.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/xf86drmMode.h b/xf86drmMode.h index 14ffdf3d..de0e2fdb 100644 --- a/xf86drmMode.h +++ b/xf86drmMode.h @@ -142,18 +142,15 @@ 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) +static inline uint32_t drmModeGetPropertyType(const drmModePropertyRes *prop) { - /* 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; + return prop->flags & (DRM_MODE_PROP_LEGACY_TYPE | DRM_MODE_PROP_EXTENDED_TYPE); } -static inline uint32_t drmModeGetPropertyType(const drmModePropertyRes *prop) +static inline int drm_property_type_is(const drmModePropertyPtr property, + uint32_t type) { - return prop->flags & (DRM_MODE_PROP_LEGACY_TYPE | DRM_MODE_PROP_EXTENDED_TYPE); + return drmModeGetPropertyType(property) == type; } typedef struct _drmModeCrtc { |