diff options
authorAnton Kindestam <>2020-02-02 16:27:54 +0100
committerJan Ekström <>2020-02-02 18:01:55 +0200
commit19e51551472c5810a3362a8f6f8be12dca28cf31 (patch)
parentf304a799350ced0f0a8882843e17bcd5fcea2e25 (diff)
drm_atomic: do not set immutable properties
On some platforms the ZPOS property might exist, but be immutable. This is at least the case on Intel Sandy Bridge since Linux kernel 5.5.0. Trying to set an immutable property will cause. drmModeAtomicCommit to fail with -EINVAL. On other platforms we might want to set ZPOS to tweak the layering of planes. To reconcile these two, simply have drm_object_set_property check if a property is immutable before attempting to add it to the atomic commit, instead returning an error code (which is, as previously, ignored in the case of ZPOS as we don't strictly need it)
1 files changed, 6 insertions, 1 deletions
diff --git a/video/out/drm_atomic.c b/video/out/drm_atomic.c
index 51b3da89c6..0fa22f0823 100644
--- a/video/out/drm_atomic.c
+++ b/video/out/drm_atomic.c
@@ -94,6 +94,11 @@ int drm_object_set_property(drmModeAtomicReq *request, struct drm_object *object
for (int i = 0; i < object->props->count_props; i++) {
if (strcasecmp(name, object->props_info[i]->name) == 0) {
+ if (object->props_info[i]->flags & DRM_MODE_PROP_IMMUTABLE) {
+ /* Do not try to set immutable values, as this might cause the
+ * atomic commit operation to fail. */
+ return -EINVAL;
+ }
return drmModeAtomicAddProperty(request, object->id,
object->props_info[i]->prop_id, value);
@@ -362,7 +367,7 @@ static bool drm_atomic_restore_plane_state(drmModeAtomicReq *request,
ret = false;
if (0 > drm_object_set_property(request, plane, "CRTC_H", plane_state->crtc_h))
ret = false;
- // ZPOS might not exist, so ignore whether or not this succeeds
+ // ZPOS might not exist, or be immutable, so ignore whether or not this succeeds
drm_object_set_property(request, plane, "ZPOS", plane_state->zpos);
return ret;