Commit 77953bd1 authored by Daniel Vetter's avatar Daniel Vetter

drm: Unify handling of blob and object properties

They work exactly the same now, after the refcounting unification a bit
ago. The only reason they're distinct is backwards compat with existing
userspace.

Cc: Daniel Stone <daniels@collabora.com>
Reviewed-by: default avatarArchit Taneja <architt@codeaurora.org>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20160829082757.17913-8-daniel.vetter@ffwll.ch
parent 59e71ee7
...@@ -911,20 +911,8 @@ bool drm_property_change_valid_get(struct drm_property *property, ...@@ -911,20 +911,8 @@ bool drm_property_change_valid_get(struct drm_property *property,
for (i = 0; i < property->num_values; i++) for (i = 0; i < property->num_values; i++)
valid_mask |= (1ULL << property->values[i]); valid_mask |= (1ULL << property->values[i]);
return !(value & ~valid_mask); return !(value & ~valid_mask);
} else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) { } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB) ||
struct drm_property_blob *blob; drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
if (value == 0)
return true;
blob = drm_property_lookup_blob(property->dev, value);
if (blob) {
*ref = &blob->base;
return true;
} else {
return false;
}
} else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
/* a zero value for an object property translates to null: */ /* a zero value for an object property translates to null: */
if (value == 0) if (value == 0)
return true; return true;
...@@ -941,13 +929,12 @@ bool drm_property_change_valid_get(struct drm_property *property, ...@@ -941,13 +929,12 @@ bool drm_property_change_valid_get(struct drm_property *property,
} }
void drm_property_change_valid_put(struct drm_property *property, void drm_property_change_valid_put(struct drm_property *property,
struct drm_mode_object *ref) struct drm_mode_object *ref)
{ {
if (!ref) if (!ref)
return; return;
if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT) ||
drm_property_type_is(property, DRM_MODE_PROP_BLOB))
drm_mode_object_unreference(ref); drm_mode_object_unreference(ref);
} else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))
drm_property_unreference_blob(obj_to_blob(ref));
} }
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