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>
main
Simon Ser 2021-06-15 14:48:28 +02:00
parent bb709e6023
commit 02ac4a0a36
1 changed files with 6 additions and 9 deletions

View File

@ -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 */