[mutter] kms/mode: Add API to create blob IDs for modes on demand
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] kms/mode: Add API to create blob IDs for modes on demand
- Date: Fri, 22 Jan 2021 17:08:25 +0000 (UTC)
commit eb66449ab72f5dcb77e926c2abaa8f494a2c4f72
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu Jun 4 17:20:36 2020 +0200
kms/mode: Add API to create blob IDs for modes on demand
Will be used by the atomic KMS backend.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
src/backends/native/meta-kms-mode-private.h | 3 +++
src/backends/native/meta-kms-mode.c | 34 +++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
---
diff --git a/src/backends/native/meta-kms-mode-private.h b/src/backends/native/meta-kms-mode-private.h
index 3af6e2cd2b..5694db07a8 100644
--- a/src/backends/native/meta-kms-mode-private.h
+++ b/src/backends/native/meta-kms-mode-private.h
@@ -22,6 +22,9 @@
#include "backends/native/meta-kms-mode.h"
+uint32_t meta_kms_mode_ensure_blob_id (MetaKmsMode *mode,
+ GError **error);
+
void meta_kms_mode_free (MetaKmsMode *mode);
MetaKmsMode * meta_kms_mode_new (MetaKmsImplDevice *impl_device,
diff --git a/src/backends/native/meta-kms-mode.c b/src/backends/native/meta-kms-mode.c
index 68b5dc07f8..07c793f394 100644
--- a/src/backends/native/meta-kms-mode.c
+++ b/src/backends/native/meta-kms-mode.c
@@ -27,8 +27,33 @@ struct _MetaKmsMode
{
MetaKmsImplDevice *impl_device;
drmModeModeInfo drm_mode;
+ uint32_t blob_id;
};
+uint32_t
+meta_kms_mode_ensure_blob_id (MetaKmsMode *mode,
+ GError **error)
+{
+ int fd;
+ int ret;
+
+ fd = meta_kms_impl_device_get_fd (mode->impl_device);
+
+ ret = drmModeCreatePropertyBlob (fd,
+ &mode->drm_mode,
+ sizeof (mode->drm_mode),
+ &mode->blob_id);
+ if (ret < 0)
+ {
+ g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret),
+ "drmModeCreatePropertyBlob: %s",
+ g_strerror (-ret));
+ return 0;
+ }
+
+ return mode->blob_id;
+}
+
const drmModeModeInfo *
meta_kms_mode_get_drm_mode (MetaKmsMode *mode)
{
@@ -38,6 +63,15 @@ meta_kms_mode_get_drm_mode (MetaKmsMode *mode)
void
meta_kms_mode_free (MetaKmsMode *mode)
{
+ if (mode->blob_id)
+ {
+ int fd;
+
+ fd = meta_kms_impl_device_get_fd (mode->impl_device);
+
+ drmModeDestroyPropertyBlob (fd, mode->blob_id);
+ }
+
g_free (mode);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]