STRUCT DRM_MODE_GET_PROPERTY(9)
π struct drm_mode_get_property β Get property metadata β¨
okay bestie, welcome to the Kernel API Manual, section 9, and honestly? this one's a little iconic. it's struct drm_mode_get_property, and it's literally the answer to "wait, what is this property?" β let's get into it π
π¦ NAME π¦
struct drm_mode_get_property β Get property metadata.
πΈ SYNOPSIS πΈ
struct drm_mode_get_property {
__u64 values_ptr;
__u64 enum_blob_ptr;
__u32 prop_id;
__u32 flags;
char name[DRM_PROP_NAME_LEN];
__u32 count_values;
__u32 count_enum_blobs;
};
β¨ Members β¨
so here's the whole cast, no cap β every field, doing its thing π
π«Ά the fields
values_ptrβ a pointer to a__u64array. that's it, that's the field. it holds the values β¨enum_blob_ptrβ a pointer to astruct drm_mode_property_enumarray. the enum side of the story πprop_idβ the object ID of the property you want to retrieve. you, the caller, set this one. main character energy π₯flagsβ aDRM_MODE_PROP_*bitfield. for what all the flags mean, go peek atdrm_property.flagsβ that's where the definitions live πnameβ the symbolic property name. user-space, this is literally your field for recognizing properties, use it πcount_valuesβ the number of elements invalues_ptr. keep it honest πcount_enum_blobsβ the number of elements inenum_blob_ptr. same energy, different array π
π§ DESCRIPTION π§
okay so the whole point: user-space can do a GETPROPERTY ioctl to retrieve information about a property. and the same property? it may be attached to multiple objects β see "Modeset Base Object Abstraction" for that whole situation π¦
here's the spicy bit: the meaning of the values_ptr field changes depending on the property type. yep, it's giving shapeshifter. see drm_property.flags for more details on that π«
the enum_blob_ptr and count_enum_blobs fields are only meaningful when the property has the type DRM_MODE_PROP_ENUM or DRM_MODE_PROP_BITMASK. and for backwards compatibility, the kernel will always set count_enum_blobs to zero when the property has the type DRM_MODE_PROP_BLOB. so if the property has a different type, user-space must ignore these two fields. not "should", must β we respect the contract π
user-space is expected to retrieve values and enums by doing this ioctl at least twice: first round to get the number of elements, second round to get the elements themselves. two trips, one vibe check βοΈ
π round one: getting the count
to retrieve the number of elements, set count_values and count_enum_blobs to zero, then call the ioctl. count_values will be updated with the number of elements. and if the property has the type DRM_MODE_PROP_ENUM or DRM_MODE_PROP_BITMASK, count_enum_blobs gets updated too. slay, now you know the size π
π round two: getting the goods
to retrieve the elements themselves, allocate an array for values_ptr and set count_values to its capacity. if the property has the type DRM_MODE_PROP_ENUM or DRM_MODE_PROP_BITMASK, allocate an array for enum_blob_ptr and set count_enum_blobs to its capacity. calling the ioctl again will fill the arrays. that's the whole trick, iykyk π
ngl bestie, don't skip the first pass β you genuinely need the counts before you can allocate, and guessing sizes is not the move π
π SEE ALSO π
the whole friend group, fr fr π«Ά
- Kernel file
./include/uapi/drm/drm_mode.h overview(9)struct drm_mode_modeinfo(9)struct drm_mode_get_plane(9)struct drm_mode_get_connector(9)struct drm_mode_property_enum(9)struct drm_mode_fb_cmd2(9)enum drm_colorop_type(9)enum drm_colorop_lut3d_interpolation_type(9)enum drm_colorop_lut1d_interpolation_type(9)struct drm_plane_size_hint(9)struct hdr_metadata_infoframe(9)struct hdr_output_metadata(9)DRM_MODE_PAGE_FLIP_EVENT(9)DRM_MODE_PAGE_FLIP_ASYNC(9)DRM_MODE_PAGE_FLIP_FLAGS(9)struct drm_mode_create_dumb(9)DRM_MODE_ATOMIC_TEST_ONLY(9)DRM_MODE_ATOMIC_NONBLOCK(9)DRM_MODE_ATOMIC_ALLOW_MODESET(9)DRM_MODE_ATOMIC_FLAGS(9)struct drm_mode_create_blob(9)struct drm_mode_destroy_blob(9)struct drm_mode_create_lease(9)struct drm_mode_list_lessees(9)struct drm_mode_get_lease(9)struct drm_mode_revoke_lease(9)struct drm_mode_rect(9)struct drm_mode_closefb(9)
and that's the page, bestie!! π this icon lives in ./include/uapi/drm, dated October 2026 β go forth and GETPROPERTY responsibly, mwah ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms