Skip to content

Commit 43d5ac7

Browse files
committed
drm: document DRM_IOCTL_MODE_GETFB2
There are a few details specific to the GETFB2 IOCTL. It's not immediately clear how user-space should check for the number of planes. Suggest using the handles field or the pitches field. The modifier array is filled with zeroes, ie. DRM_FORMAT_MOD_LINEAR. So explicitly tell user-space to not look at it unless the flag is set. Changes in v2 (Daniel): - Mention that handles should be used to compute the number of planes, and only refer to pitches as a fallback. - Reword bit about undefined modifier. Signed-off-by: Simon Ser <[email protected]> Acked-by: Daniel Vetter <[email protected]> Acked-by: Pekka Paalanen <[email protected]> Acked-by: Daniel Stone <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 1c66496 commit 43d5ac7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

include/uapi/drm/drm.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,24 @@ extern "C" {
10961096
#define DRM_IOCTL_SYNCOBJ_TRANSFER DRM_IOWR(0xCC, struct drm_syncobj_transfer)
10971097
#define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
10981098

1099+
/**
1100+
* DRM_IOCTL_MODE_GETFB2 - Get framebuffer metadata.
1101+
*
1102+
* This queries metadata about a framebuffer. User-space fills
1103+
* &drm_mode_fb_cmd2.fb_id as the input, and the kernels fills the rest of the
1104+
* struct as the output.
1105+
*
1106+
* If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles
1107+
* will be filled with GEM buffer handles. Planes are valid until one has a
1108+
* zero handle -- this can be used to compute the number of planes.
1109+
*
1110+
* Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid
1111+
* until one has a zero &drm_mode_fb_cmd2.pitches.
1112+
*
1113+
* If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set
1114+
* in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the
1115+
* modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier.
1116+
*/
10991117
#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
11001118

11011119
/*

0 commit comments

Comments
 (0)