summaryrefslogtreecommitdiff
path: root/src/backends/native/meta-drm-buffer.c
diff options
context:
space:
mode:
authorJonas Ådahl <jadahl@gmail.com>2021-05-05 14:35:48 +0200
committerJonas Ådahl <jadahl@gmail.com>2021-10-18 17:33:33 +0200
commitb3dffb43b3845d40d0463966b5ed836e1ae571df (patch)
treee95f8fae26879e425a58272f41e739cc5fea2d48 /src/backends/native/meta-drm-buffer.c
parenta1266e19f41b5b1ff91c64b0874189b6d27458f8 (diff)
downloadmutter-b3dffb43b3845d40d0463966b5ed836e1ae571df.tar.gz
drm-buffer: Don't always generate fb_id on construction
It might not be needed by the user of the buffer, so don't always require it up front. Instead make sure that any user that needs it first calls "meta_drm_buffer_ensure_fb_id()" to create the ID. Only the plain gbm implementation creates the ID lazilly, the other still does it on construction due to the objects used to create them only existing during construction. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1854>
Diffstat (limited to 'src/backends/native/meta-drm-buffer.c')
-rw-r--r--src/backends/native/meta-drm-buffer.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/backends/native/meta-drm-buffer.c b/src/backends/native/meta-drm-buffer.c
index 09e07b61d..c526263f7 100644
--- a/src/backends/native/meta-drm-buffer.c
+++ b/src/backends/native/meta-drm-buffer.c
@@ -67,9 +67,21 @@ meta_drm_buffer_get_device_file (MetaDrmBuffer *buffer)
}
gboolean
-meta_drm_buffer_ensure_fb_id (MetaDrmBuffer *buffer,
- const MetaDrmFbArgs *fb_args,
- GError **error)
+meta_drm_buffer_ensure_fb_id (MetaDrmBuffer *buffer,
+ GError **error)
+{
+ MetaDrmBufferPrivate *priv = meta_drm_buffer_get_instance_private (buffer);
+
+ if (priv->fb_id)
+ return TRUE;
+
+ return META_DRM_BUFFER_GET_CLASS (buffer)->ensure_fb_id (buffer, error);
+}
+
+gboolean
+meta_drm_buffer_do_ensure_fb_id (MetaDrmBuffer *buffer,
+ const MetaDrmFbArgs *fb_args,
+ GError **error)
{
MetaDrmBufferPrivate *priv = meta_drm_buffer_get_instance_private (buffer);
int fd;