[mutter] kms/crtc: Find MODE_ID and ACTIVE property IDs
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] kms/crtc: Find MODE_ID and ACTIVE property IDs
- Date: Fri, 22 Jan 2021 17:08:26 +0000 (UTC)
commit 11966dc6cb1199a06923f683dad15b8a9578812f
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu Jun 4 17:19:26 2020 +0200
kms/crtc: Find MODE_ID and ACTIVE property IDs
Will be used by the atomic KMS backend.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1488>
src/backends/native/meta-kms-crtc-private.h | 13 ++++++
src/backends/native/meta-kms-crtc.c | 61 +++++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
---
diff --git a/src/backends/native/meta-kms-crtc-private.h b/src/backends/native/meta-kms-crtc-private.h
index f9a3a6e0ae..bbf014bf56 100644
--- a/src/backends/native/meta-kms-crtc-private.h
+++ b/src/backends/native/meta-kms-crtc-private.h
@@ -24,6 +24,13 @@
#include "backends/native/meta-kms-types.h"
+typedef enum _MetaKmsCrtcProp
+{
+ META_KMS_CRTC_PROP_MODE_ID = 0,
+ META_KMS_CRTC_PROP_ACTIVE,
+ META_KMS_CRTC_N_PROPS
+} MetaKmsCrtcProp;
+
MetaKmsCrtc * meta_kms_crtc_new (MetaKmsImplDevice *impl_device,
drmModeCrtc *drm_crtc,
int idx);
@@ -33,4 +40,10 @@ void meta_kms_crtc_update_state (MetaKmsCrtc *crtc);
void meta_kms_crtc_predict_state (MetaKmsCrtc *crtc,
MetaKmsUpdate *update);
+uint32_t meta_kms_crtc_get_prop_id (MetaKmsCrtc *crtc,
+ MetaKmsCrtcProp prop);
+
+const char * meta_kms_crtc_get_prop_name (MetaKmsCrtc *crtc,
+ MetaKmsCrtcProp prop);
+
#endif /* META_KMS_CRTC_PRIVATE_H */
diff --git a/src/backends/native/meta-kms-crtc.c b/src/backends/native/meta-kms-crtc.c
index 0040ee340e..2b04aa6271 100644
--- a/src/backends/native/meta-kms-crtc.c
+++ b/src/backends/native/meta-kms-crtc.c
@@ -27,6 +27,11 @@
#include "backends/native/meta-kms-mode.h"
#include "backends/native/meta-kms-update-private.h"
+typedef struct _MetaKmsCrtcPropTable
+{
+ MetaKmsProp props[META_KMS_CRTC_N_PROPS];
+} MetaKmsCrtcPropTable;
+
struct _MetaKmsCrtc
{
GObject parent;
@@ -37,6 +42,8 @@ struct _MetaKmsCrtc
int idx;
MetaKmsCrtcState current_state;
+
+ MetaKmsCrtcPropTable prop_table;
};
G_DEFINE_TYPE (MetaKmsCrtc, meta_kms_crtc, G_TYPE_OBJECT)
@@ -76,6 +83,20 @@ meta_kms_crtc_get_idx (MetaKmsCrtc *crtc)
return crtc->idx;
}
+uint32_t
+meta_kms_crtc_get_prop_id (MetaKmsCrtc *crtc,
+ MetaKmsCrtcProp prop)
+{
+ return crtc->prop_table.props[prop].prop_id;
+}
+
+const char *
+meta_kms_crtc_get_prop_name (MetaKmsCrtc *crtc,
+ MetaKmsCrtcProp prop)
+{
+ return crtc->prop_table.props[prop].name;
+}
+
static void
read_gamma_state (MetaKmsCrtc *crtc,
MetaKmsImplDevice *impl_device,
@@ -214,6 +235,44 @@ meta_kms_crtc_predict_state (MetaKmsCrtc *crtc,
}
}
+static void
+init_proporties (MetaKmsCrtc *crtc,
+ MetaKmsImplDevice *impl_device,
+ drmModeCrtc *drm_crtc)
+{
+ MetaKmsCrtcPropTable *prop_table = &crtc->prop_table;
+ int fd;
+ drmModeObjectProperties *drm_props;
+
+ *prop_table = (MetaKmsCrtcPropTable) {
+ .props = {
+ [META_KMS_CRTC_PROP_MODE_ID] =
+ {
+ .name = "MODE_ID",
+ .type = DRM_MODE_PROP_BLOB,
+ },
+ [META_KMS_CRTC_PROP_ACTIVE] =
+ {
+ .name = "ACTIVE",
+ .type = DRM_MODE_PROP_RANGE,
+ },
+ }
+ };
+
+ fd = meta_kms_impl_device_get_fd (impl_device);
+ drm_props = drmModeObjectGetProperties (fd,
+ drm_crtc->crtc_id,
+ DRM_MODE_OBJECT_CRTC);
+
+ meta_kms_impl_device_init_prop_table (impl_device,
+ drm_props->props,
+ drm_props->count_props,
+ crtc->prop_table.props,
+ META_KMS_CRTC_N_PROPS);
+
+ drmModeFreeObjectProperties (drm_props);
+}
+
MetaKmsCrtc *
meta_kms_crtc_new (MetaKmsImplDevice *impl_device,
drmModeCrtc *drm_crtc,
@@ -226,6 +285,8 @@ meta_kms_crtc_new (MetaKmsImplDevice *impl_device,
crtc->id = drm_crtc->crtc_id;
crtc->idx = idx;
+ init_proporties (crtc, impl_device, drm_crtc);
+
meta_kms_crtc_read_state (crtc, impl_device, drm_crtc);
return crtc;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]