Skip to contentSkip to conversation

drm/vmwgfx: Check whether CRTC is active when updating planes

PATCH In review Ian Forbes 2 participants 2 messages May 22 – Nov 16

Subsystems (3)
lore
Share & tools
lore

Ian Forbes

author
#0 lore raw

PATCH 1/1 drm/vmwgfx: Check whether CRTC is active when updating planes

The IGT test kms_universal_plane triggers the error condition in this branch because the screen target is not defined.

Also access the STDU via the plane since it's guaranteed to be non-null.

Fixes e05162c017e2 ("drm: Store new plane state in a variable for atomic_update and disable")
---
 drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +6 -4
index 5ad7e942ceb8..9deeee9b92da 100644
@@ -44,6 +44,8 @@
 	container_of(x, struct vmw_screen_target_display_unit, base.encoder)
 #define vmw_connector_to_stdu(x) \
 	container_of(x, struct vmw_screen_target_display_unit, base.connector)
+#define vmw_primary_to_stdu(x) \
+	container_of(x, struct vmw_screen_target_display_unit, base.primary)
 
 /*
  * Some renderers such as llvmpipe will align the width and height of their
@@ -1418,7 +1420,8 @@ vmw_stdu_primary_plane_atomic_update(struct drm_plane *plane,
 	int ret;
 
 	/* If case of device error, maintain consistent atomic state */
-	if (crtc && new_state->fb) {
+	if (crtc && new_state->fb &&
+	    drm_atomic_get_new_crtc_state(state, crtc)->active) {
 		struct vmw_framebuffer *vfb =
 			vmw_framebuffer_to_vfb(new_state->fb);
 		stdu = vmw_crtc_to_stdu(crtc);
@@ -1442,9 +1445,8 @@ vmw_stdu_primary_plane_atomic_update(struct drm_plane *plane,
 		if (ret)
 			DRM_ERROR("Failed to update STDU.\n");
 	} else {
-		crtc = old_state->crtc;
-		stdu = vmw_crtc_to_stdu(crtc);
-		dev_priv = vmw_priv(crtc->dev);
+		stdu = vmw_primary_to_stdu(plane);
+		dev_priv = vmw_priv(plane->dev);
 
 		/* Blank STDU when fb and crtc are NULL */
 		if (!stdu->defined)
Signature · 1 line
2.54.0
maintainer
#1 lore raw

Thank you. Applied to drm-misc-fixes.

z