diff options
Diffstat (limited to 'backend/drm/properties.c')
-rw-r--r-- | backend/drm/properties.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/backend/drm/properties.c b/backend/drm/properties.c index 51fbc80a..4f495177 100644 --- a/backend/drm/properties.c +++ b/backend/drm/properties.c @@ -1,4 +1,5 @@ #define _POSIX_C_SOURCE 200809L +#include <assert.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> @@ -26,6 +27,7 @@ static const struct prop_info connector_info[] = { { "PATH", INDEX(path) }, { "content type", INDEX(content_type) }, { "link-status", INDEX(link_status) }, + { "max bpc", INDEX(max_bpc) }, { "non-desktop", INDEX(non_desktop) }, { "panel orientation", INDEX(panel_orientation) }, { "subconnector", INDEX(subconnector) }, @@ -181,3 +183,28 @@ char *get_drm_prop_enum(int fd, uint32_t obj, uint32_t prop_id) { return str; } + +bool introspect_drm_prop_range(int fd, uint32_t prop_id, + uint64_t *min, uint64_t *max) { + drmModePropertyRes *prop = drmModeGetProperty(fd, prop_id); + if (!prop) { + return false; + } + + if (drmModeGetPropertyType(prop) != DRM_MODE_PROP_RANGE) { + drmModeFreeProperty(prop); + return false; + } + + assert(prop->count_values == 2); + + if (min != NULL) { + *min = prop->values[0]; + } + if (max != NULL) { + *max = prop->values[1]; + } + + drmModeFreeProperty(prop); + return true; +} |