Re: [PATCH] drm: Move property validation to a helper.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Op 07-09-16 om 10:58 schreef Maarten Lankhorst:
> Property lifetimes are equal to the device lifetime, so the separate
> drm_property_find is not needed. The pointer can be retrieved from
> the properties member, which saves us some locking and a extra lookup.
>
> The lifetime for properties is until the device is destroyed, which
> happens late in the device unload path.
>
> Testcase: kms_properties
> Suggested-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/drm_atomic.c        | 16 ++++------------
>  drivers/gpu/drm/drm_crtc_internal.h |  2 ++
>  drivers/gpu/drm/drm_mode_object.c   | 31 ++++++++++++++++---------------
>  3 files changed, 22 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index fac156c43506..8bec8466781c 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -1609,7 +1609,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  	struct drm_crtc_state *crtc_state;
>  	unsigned plane_mask;
>  	int ret = 0;
> -	unsigned int i, j, k;
> +	unsigned int i, j;
>  
>  	/* disallow for drivers not supporting atomic: */
>  	if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
> @@ -1691,19 +1691,11 @@ retry:
>  				goto out;
>  			}
>  
> -			for (k = 0; k < obj->properties->count; k++)
> -				if (obj->properties->properties[k]->base.id == prop_id)
> -					break;
> -
> -			if (k == obj->properties->count) {
> -				ret = -EINVAL;
> -				goto out;
> -			}
> -
> -			prop = drm_property_find(dev, prop_id);
> +			prop = drm_mode_obj_find_prop_id(obj, prop_id);
>  			if (!prop) {
>  				drm_mode_object_unreference(obj);
> -				ret = -ENOENT;
> +				DRM_DEBUG_ATOMIC("cannot find property %u for obj %u\n", prop_id, obj_id);
> +				ret = -EINVAL;
This needs to stay -ENOENT it seems. kms_atomic testcase relies on it.
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux