RE: [RFCv1 04/12] drm: add DRM_MODE_PROP_SIGNED property flag

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

 



> static bool drm_property_change_is_valid(struct drm_property *property,
>  					 uint64_t value)
>  {
> -	if (property->flags & DRM_MODE_PROP_IMMUTABLE)
> +	if (property->flags & DRM_MODE_PROP_IMMUTABLE) {
>  		return false;
> -	if (property->flags & DRM_MODE_PROP_RANGE) {
> +	} else if (property->flags & (DRM_MODE_PROP_RANGE|DRM_MODE_PROP_SIGNED)) {
> +		int64_t svalue = U642I64(value);
> +		if (svalue < U642I64(property->values[0]) ||
> +				svalue > U642I64(property->values[1]))
> +			return false;
> +		return true;
> +	} else if (property->flags & DRM_MODE_PROP_RANGE) {
>		if (value < property->values[0] || value > property->values[1])
>  			return false;
>  		return true;

I don't think this is doing what you think it should. If the flags include
DRM_MODE_PROP_RANGE, the first "else if" will be executed regardless of
whether DRM_MODE_PROP_SIGNED is set or not. This means that the second
"else if" will never be executed.

You'd need to add "== (DRM_MODE_PROP_RANGE|DRM_MODE_PROP_SIGNED)" or
similar.

Matt

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://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