drm: don't run atomic_async_check for disabled planes
Subsystems (2)
PATCH v3 1/1 drm: don't run atomic_async_check for disabled planes
It's entirely valid and correct for compositors to include disabled planes in the atomic commit, and doing that should not prevent async flips from working. To fix that, this commit moves the plane check to after all the properties of the object have been set, and skips the async checks if the plane was and still is not visible.
--- drivers/gpu/drm/drm_atomic_uapi.c | 51 +++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 16 deletions(-)
drivers/gpu/drm/drm_atomic_uapi.c +35 -16
@@ -1068,7 +1068,6 @@ int drm_atomic_set_property(struct drm_atomic_state *state,struct drm_plane *plane =obj_to_plane (obj);struct drm_plane_state *plane_state;struct drm_mode_config *config = &plane->dev->mode_config; -const struct drm_plane_helper_funcs *plane_funcs = plane->helper_private; plane_state =drm_atomic_get_plane_state (state, plane);if (IS_ERR (plane_state)) {
@@ -1084,21 +1083,8 @@ int drm_atomic_set_property(struct drm_atomic_state *state, ret =drm_atomic_plane_get_property (plane, plane_state, prop, &old_val); ret =drm_atomic_check_prop_changes (ret, old_val, prop_value, prop); - } - -/* ask the driver if this non-primary plane is supported */ -if (plane->type !=DRM_PLANE_TYPE_PRIMARY ) { - ret = -EINVAL ; - -if (plane_funcs && plane_funcs->atomic_async_check) - ret = plane_funcs->atomic_async_check (plane, state, true); - -if (ret) { -drm_dbg_atomic (prop->dev, -"[PLANE:%d:%s] does not support async flips\n" , - obj->id, plane->name); -break ; - } +if (ret) +break ; } }
@@ -1394,6 +1380,10 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,int ret =0 ;unsigned int i, j, num_fences;bool async_flip = false; +struct drm_plane *plane; +struct drm_plane_state *old_plane_state =NULL ; +struct drm_plane_state *new_plane_state =NULL ; +u64 fb_id =0 ;/* disallow for drivers not supporting atomic: */ if (!drm_core_check_feature (dev,DRIVER_ATOMIC ))
@@ -1521,6 +1511,35 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, copied_props++; } +if (async_flip && obj->type ==DRM_MODE_OBJECT_PLANE && +obj_to_plane (obj)->type !=DRM_PLANE_TYPE_PRIMARY ) { +/* need to ask the driver if this plane is supported */ + plane =obj_to_plane (obj); + old_plane_state =drm_atomic_get_old_plane_state (state, plane); + new_plane_state =drm_atomic_get_new_plane_state (state, plane); + ret =drm_atomic_plane_get_property (plane, new_plane_state, + dev->mode_config.prop_fb_id, + &fb_id); +if (ret) +break ; +/* +* Only do the check if the plane was or is enabled. +* Note that the new state doesn't have "visible" set yet, +* so this uses fb_id instead. +*/ +if (old_plane_state->visible || fb_id) + ret = -EINVAL ; +if (ret && plane->helper_private && + plane->helper_private->atomic_async_check) { + ret = plane->helper_private->atomic_async_check (plane, state, true); + } +if (ret) { +drm_dbg_atomic (dev,"[PLANE:%d:%s] does not support async flips\n" , + obj->id, plane->name); +break ; + } + } +drm_mode_object_put (obj); }
Signature · 1 line
2.50.1
Patchwork
CI✗ LGCI.VerificationFailed: failure for drm: don't run atomic_async_check for disabled planes (rev3)
== Series Details ==
== Series Details ==
Series: drm: don't run atomic_async_check for disabled planes (rev3)
URL : https://patchwork.freedesktop.org/series/152013/
State : failure
== Summary ==
Address '[email protected]' is not on the allowlist, which prevents CI from being triggered for this patch. If you want Intel GFX CI to accept this address, please contact the script maintainers at [email protected]. Exception occurred during validation, bailing out!
Quoted 4 lines · Xaver Hugl
It's entirely valid and correct for compositors to include disabled planes in the atomic commit, and doing that should not prevent async flips from working. To fix that, this commit moves the plane check to after all the properties of the object have been set,
I dont think this is required. Again the plane states will have to be fetched outside the set_prop()
Alternate approach
@@ -1091,8 +1091,16 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
/* ask the driver if this non-primary plane is supported */ if (plane->type != DRM_PLANE_TYPE_PRIMARY) {
- ret = -EINVAL;
+ /*
+ * continue if no change in prop on non-supported async planes as well + * or when disabling the plane
+ */
+ if (ret == 0 || (prop == config->prop_fb_id && prop_value == 0))
+ drm_dbg_atomic(prop->dev,
+ "[PLANE:%d:%s] continue async as there is no prop change\n",
+ obj->id, plane->name);
+ else
+ ret = -EINVAL;
if (plane_funcs && plane_funcs->atomic_async_check)
Thanks and Regards,
Arun R Murthy
--------------------
Quoted 94 lines
and skips
the async checks if the plane was and still is not visible.Fixes fd40a63c drm/atomic (Let drivers decide which planes to async flip)Signed-off-by Xaver Hugl <[email protected]>--- drivers/gpu/drm/drm_atomic_uapi.c | 51 +++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 16 deletions(-)drivers/gpu/drm/drm_atomic_uapi.c +35
-16@@ -1068,7 +1068,6 @@ int drm_atomic_set_property(struct drm_atomic_state *state,struct drm_plane *plane =obj_to_plane (obj);struct drm_plane_state *plane_state;struct drm_mode_config *config = &plane->dev->mode_config; -const struct drm_plane_helper_funcs *plane_funcs = plane->helper_private; plane_state =drm_atomic_get_plane_state (state, plane);if (IS_ERR (plane_state)) {@@ -1084,21 +1083,8 @@ int drm_atomic_set_property(struct drm_atomic_state *state, ret =drm_atomic_plane_get_property (plane, plane_state, prop, &old_val); ret =drm_atomic_check_prop_changes (ret, old_val, prop_value, prop); - } - -/* ask the driver if this non-primary plane is supported */ -if (plane->type !=DRM_PLANE_TYPE_PRIMARY ) { - ret = -EINVAL ; - -if (plane_funcs && plane_funcs->atomic_async_check) - ret = plane_funcs->atomic_async_check (plane, state, true); - -if (ret) { -drm_dbg_atomic (prop->dev, -"[PLANE:%d:%s] does not support async flips\n" , - obj->id, plane->name); -break ; - } +if (ret) +break ; } }@@ -1394,6 +1380,10 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,int ret =0 ;unsigned int i, j, num_fences;bool async_flip = false; +struct drm_plane *plane; +struct drm_plane_state *old_plane_state =NULL ; +struct drm_plane_state *new_plane_state =NULL ; +u64 fb_id =0 ;/* disallow for drivers not supporting atomic: */ if (!drm_core_check_feature (dev,DRIVER_ATOMIC ))@@ -1521,6 +1511,35 @@ int drm_mode_atomic_ioctl(struct drm_device *dev, copied_props++; } +if (async_flip && obj->type ==DRM_MODE_OBJECT_PLANE && +obj_to_plane (obj)->type !=DRM_PLANE_TYPE_PRIMARY ) { +/* need to ask the driver if this plane is supported */ + plane =obj_to_plane (obj); + old_plane_state =drm_atomic_get_old_plane_state (state, plane); + new_plane_state =drm_atomic_get_new_plane_state (state, plane); + ret =drm_atomic_plane_get_property (plane, new_plane_state, + dev->mode_config.prop_fb_id, + &fb_id); +if (ret) +break ; +/* +* Only do the check if the plane was or is enabled. +* Note that the new state doesn't have "visible" set yet, +* so this uses fb_id instead. +*/ +if (old_plane_state->visible || fb_id) + ret = -EINVAL ; +if (ret && plane->helper_private && + plane->helper_private->atomic_async_check) { + ret = plane->helper_private->atomic_async_check (plane, state, true); + } +if (ret) { +drm_dbg_atomic (dev,"[PLANE:%d:%s] does not support async flips\n" , + obj->id, plane->name); +break ; + } + } +drm_mode_object_put (obj); }
Am Mo., 4. Aug. 2025 um 11:54 Uhr schrieb Murthy, Arun R <[email protected]>:
Quoted 23 lines · Xaver Hugl
Quoted 4 lines
It's entirely valid and correct for compositors to include disabled planes in the atomic commit, and doing that should not prevent async flips from working. To fix that, this commit moves the plane check to after all the properties of the object have been set,
I dont think this is required. Again the plane states will have to be fetched outside the
set_prop()Alternate approach
(quoted diff) +0
-0@@ -1091,8 +1091,16 @@ int drm_atomic_set_property(struct drm_atomic_state *state, /* ask the driver if this non-primary plane issupported */
if (plane->type != DRM_PLANE_TYPE_PRIMARY) {(quoted diff) +2
-1- ret = -EINVAL; + /* + * continue if no change in prop onnon-supported async planes as well
(quoted diff) +3
-0+ * or when disabling the plane + */ + if (ret == 0 || (prop ==
Quoted 1 line
config->prop_fb_id&&prop_value== 0))
This would allow disabling a plane in an async commit that was previously enabled, not sure that should be allowed? Also, if the property is fb_id, ret would be used uninitialized. But you're right, this should be fixable with smaller changes. Probably best to keep it minimal for the bugfix.
Looking more at this code, I also notice that it currently allows you to change *any* property on overlay planes in an async flip, which doesn't seem right.
Quoted 12 lines
(quoted diff) +3
-0+ drm_dbg_atomic(prop->dev, + "[PLANE:%d:%s] continue async as there is no prop change\n", + obj->id,
plane->name);drivers/gpu/drm/drm_atomic_uapi.c +2
-0+else + ret = -EINVAL ; if (plane_funcs &&
plane_funcs->atomic_async_check)Thanks and Regards,
Arun R Murthy
Hi Xaver,
Quoted 26 lines
-----Original Message-----
From: Xaver Hugl <[email protected]>
Sent: Tuesday, August 5, 2025 3:03 AM
To: Murthy, Arun R <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; Kumar, Naveen1 <[email protected]>; [email protected]; [email protected]; intel- [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH v3] drm: don't runatomic_async_checkfor disabled planesAm Mo., 4. Aug. 2025 um 11:54 Uhr schrieb Murthy, Arun R <[email protected]>:
Quoted 13 lines · Xaver Hugl
Quoted 4 lines
It's entirely valid and correct for compositors to include disabled planes in the atomic commit, and doing that should not prevent async flips from working. To fix that, this commit moves the plane check to after all the properties of the object have been set,
I dont think this is required. Again the plane states will have to be fetched outside the
set_prop()Alternate approach
(quoted diff) +0
-0@@ -1091,8 +1091,16 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
Quoted 15 lines
Quoted 11 lines
(quoted diff) +0
-0/* ask the driver if this non-primary planeis supported */
if (plane->type != DRM_PLANE_TYPE_PRIMARY) {(quoted diff) +2
-1- ret = -EINVAL; + /* + * continue if no change in prop onnon-supported async planes as well
(quoted diff) +3
-0+ * or when disabling the plane + */ + if (ret == 0 || (prop ==
config->prop_fb_id&&prop_value== 0))This would allow disabling a plane in an async commit that was previously enabled, not sure that should be allowed? Also, if the property is
fb_id, ret would be used uninitialized. But you're right, this should be fixable with smaller changes. Probably best to keep it minimal for the bugfix.
As I commented earlier in the gitlab issue [1], any change of property, including disabling a plane is not allowed in the async commit. We must disable a plane (e.g. HW cursor) during the first (synchronized) flip, and allowing later flips to proceed asynchronously. This change should be done in the compositor. As per Ville's opinion in related series [2], kernel driver should reject all these disabled Planes in the drm core and driver should only get the planes which is supported with async flip. Based on his comment, I have started Working and will be addressing it in the next version of my series [3].
[1]. https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13834#note_2994595
[2]. https://lore.kernel.org/all/[email protected]/
[3]. https://patchwork.freedesktop.org/series/151280/
Regards,
Naveen Kumar
Quoted 16 lines
Looking more at this code, I also notice that it currently allows you to change *any* property on overlay planes in an async flip, which doesn't seem right.
Quoted 12 lines
(quoted diff) +3
-0+ drm_dbg_atomic(prop->dev, + "[PLANE:%d:%s] continue async as there is no prop change\n", + obj->id,
plane->name);drivers/gpu/drm/drm_atomic_uapi.c +2
-0+else + ret = -EINVAL ; if (plane_funcs &&
plane_funcs->atomic_async_check)Thanks and Regards,
Arun R Murthy
Quoted 3 lines
As I commented earlier in the gitlab issue [1], any change of property, including disabling a plane is not allowed in the async commit. We must disable a plane (e.g. HW cursor) during the first (synchronized) flip, and allowing later flips to proceed asynchronously. This change should be done in the compositor.
No change is needed there, compositors already do that.
Quoted 3 lines
As per Ville's opinion in related series [2], kernel driver should reject all these disabled
Planes in the drm core and driver should only get the planes which is supported with async flip. Based on his comment, I have started Working and will be addressing it in the next version of my series [3].
As long as it only filters out planes that were and still are disabled, I think that could work out fine - in theory they shouldn't have any side effects.
Note though that my patch intends to specifically fix a regression for amdgpu in 6.15, which I think we can do with fewer changes.
Quoted 6 lines
[1]. https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13834#note_2994595
[2]. https://lore.kernel.org/all/[email protected]/
[3]. https://patchwork.freedesktop.org/series/151280/Regards,
Naveen Kumar
Quoted 14 lines · Xaver Hugl
Am Mo., 4. Aug. 2025 um 11:54 Uhr schrieb Murthy, Arun R <[email protected]>:
Quoted 12 lines · Xaver Hugl
Quoted 4 lines
It's entirely valid and correct for compositors to include disabled planes in the atomic commit, and doing that should not prevent async flips from working. To fix that, this commit moves the plane check to after all the properties of the object have been set,
I dont think this is required. Again the plane states will have to be fetched outside the
set_prop()Alternate approach
(quoted diff) +0
-0@@ -1091,8 +1091,16 @@ int drm_atomic_set_property(struct drm_atomic_state *state,
Quoted 13 lines
Quoted 11 lines
(quoted diff) +0
-0/* ask the driver if this non-primary plane issupported */
if (plane->type != DRM_PLANE_TYPE_PRIMARY) {(quoted diff) +2
-1- ret = -EINVAL; + /* + * continue if no change in prop onnon-supported async planes as well
(quoted diff) +3
-0+ * or when disabling the plane + */ + if (ret == 0 || (prop ==
config->prop_fb_id&&prop_value== 0))This would allow disabling a plane in an async commit that was previously enabled, not sure that should be allowed?
Yes, I assumes this is what you intended to do as you had if (curr_state->visible or prev_state->visible) in your 1st patchset changes. If disabling of plane is not suppose to be allowed then prop_value == 0 condition should be removed.
Quoted 8 lines
Also, if the
property isfb_id, ret would be used uninitialized. But you're right, this should be fixable with smaller changes. Probably best to keep it minimal for the bugfix.Looking more at this code, I also notice that it currently allows you to change *any* property on overlay planes in an async flip, which doesn't seem right.
As part of ret = drm_atomci_check_prop_changes() ret will be -EINVAL. ret should be checked for failure and returned over here.
Thanks and Regards,
Arun R Murthy
--------------------
Quoted 12 lines
Quoted 12 lines
(quoted diff) +3
-0+ drm_dbg_atomic(prop->dev, + "[PLANE:%d:%s] continue async as there is no prop change\n", + obj->id,
plane->name);drivers/gpu/drm/drm_atomic_uapi.c +2
-0+else + ret = -EINVAL ; if (plane_funcs &&
plane_funcs->atomic_async_check)Thanks and Regards,
Arun R Murthy