From 0c99a3c09d62349365d872f58016453148b64dd9 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 1 Feb 2021 14:22:03 +0100 Subject: [PATCH] Require planes to have a type property This is guaranteed by DRM core. --- src/drm.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/drm.cpp b/src/drm.cpp index ed223a7..f1fe4d3 100644 --- a/src/drm.cpp +++ b/src/drm.cpp @@ -172,7 +172,12 @@ static int get_plane_id(struct drm_t *drm) ret = id; uint64_t plane_type; - if (get_prop_value(drm, props, "type", &plane_type) && plane_type == DRM_PLANE_TYPE_PRIMARY) { + if (!get_prop_value(drm, props, "type", &plane_type)) { + fprintf(stderr, "Plane %" PRIu32 " is missing the type property", id); + return -1; + } + + if (plane_type == DRM_PLANE_TYPE_PRIMARY) { /* found our primary plane, lets use that: */ for (uint32_t k = 0; k < plane->count_formats; k++)