History

drm: document expectations for GETFB2 handles

There are two important details missing from the docs: - If the memory object backing the FB already has a GEM handle, it's not re-used, a new one is generated. - Aliased planes will return the same GEM handle. v2: document how user-space can obtain DMA-BUF FDs without leaking handles (Pekka)

Simon Ser committed 3 years ago

Commit 61a55f81 parent c2f2c721 file · +12 −2Browse files

Showing the changes to include/uapi (1 of 1 file). Show all

Unified · Split

include/uapi/drm/drm.h+12−2
@@ -1117,8 +1117,13 @@ extern "C" { · 1116 unmodified lines
1117 * struct as the output.1117 * struct as the output.
1118 *1118 *
1119 * If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles1119 * If the client is DRM master or has &CAP_SYS_ADMIN, &drm_mode_fb_cmd2.handles
1120 * will be filled with GEM buffer handles. Planes are valid until one has a1120 * will be filled with GEM buffer handles. Fresh new GEM handles are always
1121 * zero handle -- this can be used to compute the number of planes.1121 * returned, even if another GEM handle referring to the same memory object
1122 * already exists on the DRM file description. The caller is responsible for
1123 * removing the new handles, e.g. via the &DRM_IOCTL_GEM_CLOSE IOCTL. The same
1124 * new handle will be returned for multiple planes in case they use the same
1125 * memory object. Planes are valid until one has a zero handle -- this can be
1126 * used to compute the number of planes.
1122 *1127 *
1123 * Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid1128 * Otherwise, &drm_mode_fb_cmd2.handles will be zeroed and planes are valid
1124 * until one has a zero &drm_mode_fb_cmd2.pitches.1129 * until one has a zero &drm_mode_fb_cmd2.pitches.
@@ -1126,6 +1131,11 @@ extern "C" { · 1 unmodified line
1126 * If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set1131 * If the framebuffer has a format modifier, &DRM_MODE_FB_MODIFIERS will be set
1127 * in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the1132 * in &drm_mode_fb_cmd2.flags and &drm_mode_fb_cmd2.modifier will contain the
1128 * modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier.1133 * modifier. Otherwise, user-space must ignore &drm_mode_fb_cmd2.modifier.
1134 *
1135 * To obtain DMA-BUF FDs for each plane without leaking GEM handles, user-space
1136 * can export each handle via &DRM_IOCTL_PRIME_HANDLE_TO_FD, then immediately
1137 * close each unique handle via &DRM_IOCTL_GEM_CLOSE, making sure to not
1138 * double-close handles which are specified multiple times in the array.
1129 */1139 */
1130#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)1140#define DRM_IOCTL_MODE_GETFB2 DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
1131 1141

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t