History

drm: introduce CLOSEFB IOCTL

This new IOCTL allows callers to close a framebuffer without disabling planes or CRTCs. This takes inspiration from Rob Clark's unref_fb IOCTL [1] and DRM_MODE_FB_PERSIST [2]. User-space patch for wlroots available at [3]. IGT test available at [4]. v2: add an extra pad field just in case we want to extend this IOCTL in the future (Pekka, Sima). [1]: https://lore.kernel.org/dri-devel/20170509153654.23464-1-robdclark@gmail.com/ [2]: https://lore.kernel.org/dri-devel/20211006151921.312714-1-contact@emersion.fr/ [3]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4394 [4]: https://lists.freedesktop.org/archives/igt-dev/2023-October/063294.html

Simon Ser committed 3 years ago

Commit d208d871 parent 0226ba35 files · +55 −0Browse files

Showing the changes to include/uapi (2 of 5 files). Show all

Unified · Split

2 files
  1. include/uapi/drm/drm.h +20 −0
  2. include/uapi/drm/drm_mode.h +10 −0
include/uapi/drm/drm.h+20−0
@@ -1218,6 +1218,26 @@ extern "C" { · 1217 unmodified lines
12181218
12191219 #define DRM_IOCTL_SYNCOBJ_EVENTFD DRM_IOWR(0xCF, struct drm_syncobj_eventfd)
12201220
1221+/**
1222+ * DRM_IOCTL_MODE_CLOSEFB - Close a framebuffer.
1223+ *
1224+ * This closes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL
1225+ * argument is a framebuffer object ID.
1226+ *
1227+ * This IOCTL is similar to &DRM_IOCTL_MODE_RMFB, except it doesn't disable
1228+ * planes and CRTCs. As long as the framebuffer is used by a plane, it's kept
1229+ * alive. When the plane no longer uses the framebuffer (because the
1230+ * framebuffer is replaced with another one, or the plane is disabled), the
1231+ * framebuffer is cleaned up.
1232+ *
1233+ * This is useful to implement flicker-free transitions between two processes.
1234+ *
1235+ * Depending on the threat model, user-space may want to ensure that the
1236+ * framebuffer doesn't expose any sensitive user information: closed
1237+ * framebuffers attached to a plane can be read back by the next DRM master.
1238+ */
1239+#define DRM_IOCTL_MODE_CLOSEFB DRM_IOWR(0xD0, struct drm_mode_closefb)
1240+
12211241 /*
12221242 * Device specific ioctls should only be in their respective headers
12231243 * The device specific ioctl range is from 0x40 to 0x9f.
include/uapi/drm/drm_mode.h+10−0
@@ -1323,6 +1323,16 @@ struct drm_mode_rect { · 1322 unmodified lines
13231323 __s32 y2;
13241324 };
13251325
1326+/**
1327+ * struct drm_mode_closefb
1328+ * @fb_id: Framebuffer ID.
1329+ * @pad: Must be zero.
1330+ */
1331+struct drm_mode_closefb {
1332+ __u32 fb_id;
1333+ __u32 pad;
1334+};
1335+
13261336 #if defined(__cplusplus)
13271337 }
13281338 #endif

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