Commit 02ac4a0a authored by Simon Ser's avatar Simon Ser
Browse files

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's avatarSimon Ser <contact@emersion.fr>
Reviewed-by: Emil Velikov's avatarEmil Velikov <emil.velikov@collabora.com>
parent bb709e60
Pipeline #409884 passed with stages
in 30 seconds
......@@ -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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment