Re: [PATCH] drm: document drm_property_enum.value for bitfields

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

 



On Wed, Jul 21, 2021 at 06:51:30AM +0000, Simon Ser wrote:
> When a property has the type DRM_MODE_PROP_BITMASK, the value field
> stores a bitshift, not a bitmask, which can be surprising.
> 
> Signed-off-by: Simon Ser <contact@xxxxxxxxxxx>
> Cc: Pekka Paalanen <pekka.paalanen@xxxxxxxxxxxxx>
> Cc: Daniel Vetter <daniel.vetter@xxxxxxxx>
> Cc: Leandro Ribeiro <leandro.ribeiro@xxxxxxxxxxxxx>
> ---
>  include/drm/drm_property.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/drm/drm_property.h b/include/drm/drm_property.h
> index bbf5c1fdd7b0..f3ea7f97f372 100644
> --- a/include/drm/drm_property.h
> +++ b/include/drm/drm_property.h
> @@ -37,6 +37,11 @@
>   *
>   * For enumeration and bitmask properties this structure stores the symbolic
>   * decoding for each value. This is used for example for the rotation property.
> + *
> + * If the property has the type &DRM_MODE_PROP_BITMASK, @value stores a
> + * bitshift, not a bitmask. In other words, the enum entry is enabled if the
> + * bit number @value is set in the property's value. This enum entry has the
> + * bitmask ``1 << value``.

Please move this into an inline comment to make it clear that this is
specifically about @value. With that:

Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>

I was also pondering whether we have a nice place to link to for
"property's value" but really they're just uint64_t all over the place,
and only stored in the drm_mode_object for non-atomic properties. So
wording sounds like the best option we have.

>   */
>  struct drm_property_enum {
>  	uint64_t value;
> -- 
> 2.32.0
> 
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch



[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