Skip to contentSkip to conversation

drm/atomic: Check old_plane_state->crtc in drm_atomic_helper_async_check()

PATCH Superseded Boris Brezillon 3 participants 3 messages Jul 23, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/atomic: Check old_plane_state->crtc in drm_atomic_helper_async_check()

Async plane update is supposed to work only when updating the FB or FB position of an already enabled plane. That does not apply to requests where the plane was previously disabled or assigned to a different CTRC.

Check old_plane_state->crtc value to make sure async plane update is allowed.

Fixes fef9df8b5945 ("drm/atomic: initial support for asynchronous plane update")

---
Hello,

As discussed on IRC, I'm not sure this "plane should already be enabled and assigned to the same CRTC to allow async updates" limitation applies to all drivers, but it's required for VC4 to work properly.

Just let me know if you think I should move this check to vc4_plane_atomic_async_check().

Thanks,

Boris

---
 drivers/gpu/drm/drm_atomic_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +2 -1
index 866a2cc72ef6..f7ccfebd3ca8 100644
@@ -1555,7 +1555,8 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
 	if (n_planes != 1)
 		return -EINVAL;
 
-	if (!new_plane_state->crtc)
+	if (!new_plane_state->crtc ||
+	    old_plane_state->crtc != new_plane_state->crtc)
 		return -EINVAL;
 
 	funcs = plane->helper_private;
Signature · 6 lines
2.14.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 13 lines · Boris Brezillon

Async plane update is supposed to work only when updating the FB or FB position of an already enabled plane. That does not apply to requests where the plane was previously disabled or assigned to a different CTRC.

Check old_plane_state->crtc value to make sure async plane update is allowed.

Fixes fef9df8b5945 ("drm/atomic: initial support for asynchronous plane update")

---
Hello,

Quoted 6 lines

As discussed on IRC, I'm not sure this "plane should already be enabled and assigned to the same CRTC to allow async updates" limitation applies to all drivers, but it's required for VC4 to work properly.

Just let me know if you think I should move this check to vc4_plane_atomic_async_check().

I don't _think_ there's any hardware that can switch planes without first disabling the plane for a frame and then re-enabling it, so this passes the smell test for me. I'd be very curious to be proven wrong, though :)

Sean

Quoted 29 lines

Thanks,

Boris

---
 drivers/gpu/drm/drm_atomic_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic_helper.c +2 -1
index 866a2cc72ef6..f7ccfebd3ca8 100644
@@ -1555,7 +1555,8 @@ int drm_atomic_helper_async_check(struct drm_device *dev,
 	if (n_planes != 1)
 		return -EINVAL;
 
-	if (!new_plane_state->crtc)
+	if (!new_plane_state->crtc ||
+	    old_plane_state->crtc != new_plane_state->crtc)
 		return -EINVAL;
 
 	funcs = plane->helper_private;
Signature · 6 lines
2.14.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 5 lines
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#2 lore raw
In reply to Boris Brezillon
Quoted 10 lines · Boris Brezillon

Async plane update is supposed to work only when updating the FB or FB position of an already enabled plane. That does not apply to requests where the plane was previously disabled or assigned to a different CTRC.

Check old_plane_state->crtc value to make sure async plane update is allowed.

Fixes fef9df8b5945 ("drm/atomic: initial support for asynchronous plane update")

I don't think any driver I've worked on would want an async flip of a plane between CRTCs.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel