[PATCH 05/12] drm/atomic/uapi: Eliminate the confusing drm_atomic_check_prop_changes()
Ville Syrjala
ville.syrjala at linux.intel.com
Mon Nov 16 01:11:23 PST 2026
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
drm_atomic_check_prop_changes() is a very confusing for
many reasons:
- the 'ret' propagation through it is completely non-obvious
- for planes it prints the debug message about rejecting the
update before we actually decide whether the update needs
to be rejected or not
- the debug message is also printed if the property doesn't
exist, which is confusing
- the debug message lacks the KMS object type/ID/name,
which could be helpful during debugging
Just get rid of the whole drm_atomic_check_prop_changes() and
do things by hand.
Also remove the debug message for the case where the property
doesn't exist as drm_atomic_*_get_property() will already print
its own debug message in that situation.
Cc: amd-gfx at lists.freedesktop.org
Cc: André Almeida <andrealmeid at igalia.com>
Cc: Boris Brezillon <bbrezillon at kernel.org>
Cc: Christopher Snowhill <chris at kode54.net>
Cc: Dave Stevenson <dave.stevenson at raspberrypi.com>
Cc: Dharma Balasubiramani <dharma.b at microchip.com>
Cc: Dmitry Baryshkov <lumag at kernel.org>
Cc: freedreno at lists.freedesktop.org
Cc: Gustavo Padovan <gustavo.padovan at collabora.com>
Cc: Huacai Chen <chenhuacai at kernel.org>
Cc: Icenowy Zheng <zhengxingda at iscas.ac.cn>
Cc: intel-gfx at lists.freedesktop.org
Cc: intel-xe at lists.freedesktop.org
Cc: Jianmin Lv <lvjianmin at loongson.cn>
Cc: linux-arm-msm at vger.kernel.org
Cc: linux-mediatek at lists.infradead.org
Cc: linux-rockchip at lists.infradead.org
Cc: linux-tegra at vger.kernel.org
Cc: Liviu Dudau <liviu.dudau at arm.com>
Cc: Maíra Canal <mcanal at igalia.com>
Cc: Manikandan Muralidharan <manikandan.m at microchip.com>
Cc: Maxime Ripard <mripard at kernel.org>
Cc: Mingcong Bai <jeffbai at aosc.io>
Cc: nouveau at lists.freedesktop.org
Cc: Qianhai Wu <wuqianhai at loongson.cn>
Cc: Raspberry Pi Kernel Maintenance <kernel-list at raspberrypi.com>
Cc: Simon Ser <contact at emersion.fr>
Cc: wayland-devel at lists.freedesktop.org
Cc: Xaver Hugl <xaver.hugl at kde.org>
Cc: Xi Ruoyao <xry111 at xry111.site>
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/drm_atomic_uapi.c | 51 +++++++++++++++++++------------
1 file changed, 31 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index eb002799497c..2ea03b4b0be9 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -1194,19 +1194,6 @@ int drm_atomic_connector_commit_dpms(struct drm_atomic_commit *state,
return ret;
}
-static int drm_atomic_check_prop_changes(int ret, uint64_t old_val, uint64_t prop_value,
- struct drm_property *prop)
-{
- if (ret != 0 || old_val != prop_value) {
- drm_dbg_atomic(prop->dev,
- "[PROP:%d:%s] No prop can be changed during async flip\n",
- prop->base.id, prop->name);
- return -EINVAL;
- }
-
- return 0;
-}
-
int drm_atomic_set_property(struct drm_atomic_commit *state,
struct drm_file *file_priv,
struct drm_mode_object *obj,
@@ -1235,8 +1222,16 @@ int drm_atomic_set_property(struct drm_atomic_commit *state,
if (async_flip) {
ret = drm_atomic_connector_get_property(connector, connector_state,
prop, &old_val);
- ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop);
- break;
+ if (ret)
+ break;
+
+ if (old_val != prop_value) {
+ drm_dbg_atomic(prop->dev,
+ "[PROP:%d:%s] No prop can be changed during async flip\n",
+ prop->base.id, prop->name);
+ ret = -EINVAL;
+ break;
+ }
}
ret = drm_atomic_connector_set_property(connector,
@@ -1257,8 +1252,16 @@ int drm_atomic_set_property(struct drm_atomic_commit *state,
if (async_flip) {
ret = drm_atomic_crtc_get_property(crtc, crtc_state,
prop, &old_val);
- ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop);
- break;
+ if (ret)
+ break;
+
+ if (old_val != prop_value) {
+ drm_dbg_atomic(prop->dev,
+ "[PROP:%d:%s] No prop can be changed during async flip\n",
+ prop->base.id, prop->name);
+ ret = -EINVAL;
+ break;
+ }
}
ret = drm_atomic_crtc_set_property(crtc,
@@ -1281,12 +1284,18 @@ int drm_atomic_set_property(struct drm_atomic_commit *state,
/* no-op changes are always allowed */
ret = drm_atomic_plane_get_property(plane, plane_state,
prop, &old_val);
- ret = drm_atomic_check_prop_changes(ret, old_val, prop_value, prop);
+ if (ret)
+ break;
/* fail everything that isn't no-op or a pure flip */
- if (ret && prop != config->prop_fb_id &&
+ if (old_val != prop_value &&
+ prop != config->prop_fb_id &&
prop != config->prop_in_fence_fd &&
prop != config->prop_fb_damage_clips) {
+ drm_dbg_atomic(prop->dev,
+ "[PROP:%d:%s] No prop can be changed during async flip\n",
+ prop->base.id, prop->name);
+ ret = -EINVAL;
break;
}
@@ -1296,10 +1305,12 @@ int drm_atomic_set_property(struct drm_atomic_commit *state,
* decision. Drivers that want this need to just do
* these checks themselves somewhere.
*/
- if (ret && plane->type != DRM_PLANE_TYPE_PRIMARY) {
+ if (old_val != prop_value && plane->type != DRM_PLANE_TYPE_PRIMARY) {
/* ask the driver if this non-primary plane is supported */
if (plane_funcs && plane_funcs->atomic_bypass_check)
ret = plane_funcs->atomic_bypass_check(plane, state, true);
+ else
+ ret = -EINVAL;
if (ret) {
drm_dbg_atomic(prop->dev,
--
2.56.0
More information about the Linux-rockchip
mailing list