summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-10-27 13:58:12 +0200
committerSimon Ser <contact@emersion.fr>2023-11-20 12:55:31 +0000
commit07f4948bfc60288f179dafcf4ea0c0c8f9a558fd (patch)
tree68cdfb26e047f9fe66827456c5fcafa0edcc81a8
parent7b60986640c6584f112222fb65b23a2fc326ce6e (diff)
downloadlibdrm-07f4948bfc60288f179dafcf4ea0c0c8f9a558fd.tar.gz
libdrm-07f4948bfc60288f179dafcf4ea0c0c8f9a558fd.tar.bz2
libdrm-07f4948bfc60288f179dafcf4ea0c0c8f9a558fd.zip
xf86drmMode: add drmModeCloseFB()
Add a wrapper for the new CLOSEFB IOCTL, to close a framebuffer without implicitly disabling planes or CRTCs. See https://lore.kernel.org/dri-devel/20231020101926.145327-2-contact@emersion.fr/ Signed-off-by: Simon Ser <contact@emersion.fr>
-rw-r--r--core-symbols.txt1
-rw-r--r--xf86drmMode.c10
-rw-r--r--xf86drmMode.h7
3 files changed, 18 insertions, 0 deletions
diff --git a/core-symbols.txt b/core-symbols.txt
index 8b22f3a1..766c342d 100644
--- a/core-symbols.txt
+++ b/core-symbols.txt
@@ -104,6 +104,7 @@ drmModeAtomicGetCursor
drmModeAtomicMerge
drmModeAtomicSetCursor
drmModeAttachMode
+drmModeCloseFB
drmModeConnectorGetPossibleCrtcs
drmModeConnectorSetProperty
drmModeCreateDumbBuffer
diff --git a/xf86drmMode.c b/xf86drmMode.c
index 65d54d78..a4873a0f 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -320,6 +320,16 @@ drm_public int drmModeRmFB(int fd, uint32_t bufferId)
return DRM_IOCTL(fd, DRM_IOCTL_MODE_RMFB, &bufferId);
}
+drm_public int drmModeCloseFB(int fd, uint32_t buffer_id)
+{
+ struct drm_mode_closefb closefb;
+
+ memclear(closefb);
+ closefb.fb_id = buffer_id;
+
+ return DRM_IOCTL(fd, DRM_IOCTL_MODE_CLOSEFB, &closefb);
+}
+
drm_public drmModeFBPtr drmModeGetFB(int fd, uint32_t buf)
{
struct drm_mode_fb_cmd info;
diff --git a/xf86drmMode.h b/xf86drmMode.h
index b6410ab8..08487887 100644
--- a/xf86drmMode.h
+++ b/xf86drmMode.h
@@ -315,6 +315,13 @@ int drmModeAddFB2WithModifiers(int fd, uint32_t width, uint32_t height,
extern int drmModeRmFB(int fd, uint32_t bufferId);
/**
+ * Close a framebuffer.
+ *
+ * Same as drmModeRmFB(), except it doesn't implicitly disable planes and CRTCs.
+ */
+extern int drmModeCloseFB(int fd, uint32_t buffer_id);
+
+/**
* Mark a region of a framebuffer as dirty.
*/
extern int drmModeDirtyFB(int fd, uint32_t bufferId,