Skip to content

Commit 6e5b47a

Browse files
committed
drm: document drm_mode_get_property
It's not obvious what the fields mean and how they should be used. The most important detail is the link to drm_property.flags, which describes how property types work. v2: document enum drm_mode_property_enum, add ref to "Modeset Base Object Abstraction" (Daniel) Signed-off-by: Simon Ser <[email protected]> Acked-by: Pekka Paalanen <[email protected]> Acked-by: Daniel Vetter <[email protected]> Cc: Leandro Ribeiro <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 2f425cf commit 6e5b47a

File tree

2 files changed

+58
-4
lines changed

2 files changed

+58
-4
lines changed

Documentation/gpu/drm-kms.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ KMS Core Structures and Functions
159159
.. kernel-doc:: drivers/gpu/drm/drm_mode_config.c
160160
:export:
161161

162+
.. _kms_base_object_abstraction:
163+
162164
Modeset Base Object Abstraction
163165
===============================
164166

include/uapi/drm/drm_mode.h

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -541,22 +541,74 @@ struct drm_mode_get_connector {
541541
*/
542542
#define DRM_MODE_PROP_ATOMIC 0x80000000
543543

544+
/**
545+
* struct drm_mode_property_enum - Description for an enum/bitfield entry.
546+
* @value: numeric value for this enum entry.
547+
* @name: symbolic name for this enum entry.
548+
*
549+
* See struct drm_property_enum for details.
550+
*/
544551
struct drm_mode_property_enum {
545552
__u64 value;
546553
char name[DRM_PROP_NAME_LEN];
547554
};
548555

556+
/**
557+
* struct drm_mode_get_property - Get property metadata.
558+
*
559+
* User-space can perform a GETPROPERTY ioctl to retrieve information about a
560+
* property. The same property may be attached to multiple objects, see
561+
* "Modeset Base Object Abstraction".
562+
*
563+
* The meaning of the @values_ptr field changes depending on the property type.
564+
* See &drm_property.flags for more details.
565+
*
566+
* The @enum_blob_ptr and @count_enum_blobs fields are only meaningful when the
567+
* property has the type &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK. For
568+
* backwards compatibility, the kernel will always set @count_enum_blobs to
569+
* zero when the property has the type &DRM_MODE_PROP_BLOB. User-space must
570+
* ignore these two fields if the property has a different type.
571+
*
572+
* User-space is expected to retrieve values and enums by performing this ioctl
573+
* at least twice: the first time to retrieve the number of elements, the
574+
* second time to retrieve the elements themselves.
575+
*
576+
* To retrieve the number of elements, set @count_values and @count_enum_blobs
577+
* to zero, then call the ioctl. @count_values will be updated with the number
578+
* of elements. If the property has the type &DRM_MODE_PROP_ENUM or
579+
* &DRM_MODE_PROP_BITMASK, @count_enum_blobs will be updated as well.
580+
*
581+
* To retrieve the elements themselves, allocate an array for @values_ptr and
582+
* set @count_values to its capacity. If the property has the type
583+
* &DRM_MODE_PROP_ENUM or &DRM_MODE_PROP_BITMASK, allocate an array for
584+
* @enum_blob_ptr and set @count_enum_blobs to its capacity. Calling the ioctl
585+
* again will fill the arrays.
586+
*/
549587
struct drm_mode_get_property {
550-
__u64 values_ptr; /* values and blob lengths */
551-
__u64 enum_blob_ptr; /* enum and blob id ptrs */
588+
/** @values_ptr: Pointer to a ``__u64`` array. */
589+
__u64 values_ptr;
590+
/** @enum_blob_ptr: Pointer to a struct drm_mode_property_enum array. */
591+
__u64 enum_blob_ptr;
552592

593+
/**
594+
* @prop_id: Object ID of the property which should be retrieved. Set
595+
* by the caller.
596+
*/
553597
__u32 prop_id;
598+
/**
599+
* @flags: ``DRM_MODE_PROP_*`` bitfield. See &drm_property.flags for
600+
* a definition of the flags.
601+
*/
554602
__u32 flags;
603+
/**
604+
* @name: Symbolic property name. User-space should use this field to
605+
* recognize properties.
606+
*/
555607
char name[DRM_PROP_NAME_LEN];
556608

609+
/** @count_values: Number of elements in @values_ptr. */
557610
__u32 count_values;
558-
/* This is only used to count enum values, not blobs. The _blobs is
559-
* simply because of a historical reason, i.e. backwards compat. */
611+
/** @count_enum_blobs: Number of elements in @enum_blob_ptr. */
560612
__u32 count_enum_blobs;
561613
};
562614

0 commit comments

Comments
 (0)