[PATCH 03/11] drm: Retain reference to blob properties in lookup

Daniel Vetter daniel at ffwll.ch
Fri May 22 07:11:47 PDT 2015


On Fri, May 22, 2015 at 01:34:46PM +0100, Daniel Stone wrote:
> When we look up a blob property, make sure we retain a reference to the
> blob for the lifetime.
> 
> Signed-off-by: Daniel Stone <daniels at collabora.com>
> Tested-by: Sean Paul <seanpaul at chromium.org>
> ---
>  drivers/gpu/drm/drm_crtc.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 7e5085f..da2b117 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -4661,7 +4661,9 @@ bool drm_property_change_valid_get(struct drm_property *property,
>  		for (i = 0; i < property->num_values; i++)
>  			valid_mask |= (1ULL << property->values[i]);
>  		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) ||
> +		   (drm_property_type_is(property, DRM_MODE_PROP_OBJECT) &&
> +		    property->values[0] == DRM_MODE_OBJECT_BLOB)) {
>  		struct drm_property_blob *blob;
>  
>  		if (value == 0)
> @@ -4709,6 +4711,8 @@ void drm_property_change_valid_put(struct drm_property *property,
>  	if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
>  		if (property->values[0] == DRM_MODE_OBJECT_FB)
>  			drm_framebuffer_unreference(obj_to_fb(ref));
> +		else if (property->values[0] == DRM_MODE_OBJECT_BLOB)
> +			drm_property_unreference_blob(obj_to_blob(ref));

Hm why this? I know it's a bit inconsistent that for all the other atomic
obj props we use DRM_MODE_PROP_OBJ, but for blobs we have a special one. I
guess I'll see the reason later on, but without more details I'd vote to
not subsume props under the generic PROP_OBJECT.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list