Skip to contentSkip to conversation

drm/vmwgfx: Fix vmw_du_cursor_plane_atomic_check

PATCH In review Thomas Hellstrom 3 participants 4 messages Mar 27, 2018 – Sep 4, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/vmwgfx: Fix vmw_du_cursor_plane_atomic_check

Use the correct helper and also return early on helper success rather than on helper failure.

Also explicitly return 0 in the case of no fb.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +11 -11
index 3628a9fe705f..0f7dc9ea2657 100644
@@ -494,23 +494,23 @@ int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane,
 				     struct drm_plane_state *new_state)
 {
 	int ret = 0;
+	struct drm_crtc_state *crtc_state = NULL;
 	struct vmw_surface *surface = NULL;
 	struct drm_framebuffer *fb = new_state->fb;
 
-	struct drm_rect src = drm_plane_state_src(new_state);
-	struct drm_rect dest = drm_plane_state_dest(new_state);
-
 	/* Turning off */
 	if (!fb)
-		return ret;
+		return 0;
 
-	ret = drm_plane_helper_check_update(plane, new_state->crtc, fb,
-					    &src, &dest,
-					    DRM_MODE_ROTATE_0,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    true, true, &new_state->visible);
-	if (!ret)
+	if (new_state->crtc)
+		crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
+							   new_state->crtc);
+
+	ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  true, true);
+	if (ret)
 		return ret;
 
 	/* A lot of the code assumes this */
Signature · 6 lines
2.14.3

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

Use the correct helper and also return early on helper success rather than on helper failure.

Also explicitly return 0 in the case of no fb.

---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -0
index 3628a9fe705f..0f7dc9ea2657 100644
@@ -494,23 +494,23 @@ int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane,
 				     struct drm_plane_state *new_state)
 {
 	int ret = 0;
+	struct drm_crtc_state *crtc_state = NULL;

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane, · line 503

Quoted 10 lines
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -4
 	struct vmw_surface *surface = NULL;
 	struct drm_framebuffer *fb = new_state->fb;
 
-	struct drm_rect src = drm_plane_state_src(new_state);
-	struct drm_rect dest = drm_plane_state_dest(new_state);
-
 	/* Turning off */
 	if (!fb)
-		return ret;
+		return 0;

This should probably be checked after drm_atomic_helper_check_plane_state() has been called. Otherwise new_state->visible may be left with a stale value.

Quoted 27 lines
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +9 -7
-	ret = drm_plane_helper_check_update(plane, new_state->crtc, fb,
-					    &src, &dest,
-					    DRM_MODE_ROTATE_0,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    DRM_PLANE_HELPER_NO_SCALING,
-					    true, true, &new_state->visible);
-	if (!ret)
+	if (new_state->crtc)
+		crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
+							   new_state->crtc);
+
+	ret = drm_atomic_helper_check_plane_state(new_state, crtc_state,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  DRM_PLANE_HELPER_NO_SCALING,
+						  true, true);
+	if (ret)
 		return ret;
 
 	/* A lot of the code assumes this */
Signature · 6 lines
2.14.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Signature · 6 lines
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw
Quoted 25 lines · Ville Syrjälä
Quoted 24 lines · Thomas Hellstrom

Use the correct helper and also return early on helper success rather than on helper failure.

Also explicitly return 0 in the case of no fb.

---
  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 22 +++++++++++-----------
  1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -0
index 3628a9fe705f..0f7dc9ea2657 100644
@@ -494,23 +494,23 @@ int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane,
  				     struct drm_plane_state *new_state)
  {
  	int ret = 0;
+	struct drm_crtc_state *crtc_state = NULL;
  	struct vmw_surface *surface = NULL;
  	struct drm_framebuffer *fb = new_state->fb;
 
Quoted 11 lines

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane, · line 503

Quoted 7 lines
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -4
-	struct drm_rect src = drm_plane_state_src(new_state);
-	struct drm_rect dest = drm_plane_state_dest(new_state);
-
  	/* Turning off */
  	if (!fb)
-		return ret;
+		return 0;

This should probably be checked after drm_atomic_helper_check_plane_state() has been called. Otherwise new_state->visible may be left with a stale value.

Thanks. I'll respin.

/Thomas

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

#3 lore raw
Quoted 42 lines · Thomas Hellstrom
Quoted 31 lines · Ville Syrjälä
Quoted 29 lines · Thomas Hellstrom

Use the correct helper and also return early on helper success rather than on helper failure.

Also explicitly return 0 in the case of no fb.

---
  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 22 +++++++++++-----------
  1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -2
index 3628a9fe705f..0f7dc9ea2657 100644
@@ -494,23 +494,23 @@ int vmw_du_cursor_plane_atomic_check(struct
 drm_plane *plane,
                                     struct drm_plane_state *new_state)
  {
        int ret = 0;
+       struct drm_crtc_state *crtc_state = NULL;
        struct vmw_surface *surface = NULL;
        struct drm_framebuffer *fb = new_state->fb;
  -     struct drm_rect src = drm_plane_state_src(new_state);
-       struct drm_rect dest = drm_plane_state_dest(new_state);
-
Quoted 9 lines

drivers/gpu/drm/vmwgfx/vmwgfx_kms.c int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane, · line 503

Quoted 4 lines
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -1
        /* Turning off */
        if (!fb)
-               return ret;
+               return 0;

This should probably be checked after drm_atomic_helper_check_plane_state() has been called. Otherwise new_state->visible may be left with a stale value.

Quoted 1 line

Thanks. I'll respin.

I just wanted to nuke drm_plane_helper_check_update and noticed that vmwgfx is still using it. Will you respin, or did I catch it in-flight, or should I respin to get this going?

Thanks, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel