[16/21] drm/vmwgfx: Fix vmw_du_cursor_plane_atomic_check
diff mbox series

Message ID 20181004202446.22905-17-daniel.vetter@ffwll.ch
State New
Headers show
Series
  • atomic helper cleanup, take 2
Related show

Commit Message

Daniel Vetter Oct. 4, 2018, 8:24 p.m. UTC
From: Thomas Hellstrom <thellstrom@vmware.com>

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.

v2: Check for !fb after updating state->visible (Ville).

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> (v1)
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Daniel Vetter <daniel@ffwll.ch>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Sinclair Yeh <syeh@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

Comments

Daniel Vetter Oct. 5, 2018, 4:06 p.m. UTC | #1
On Thu, Oct 04, 2018 at 10:24:41PM +0200, Daniel Vetter wrote:
> From: Thomas Hellstrom <thellstrom@vmware.com>
> 
> 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.
> 
> v2: Check for !fb after updating state->visible (Ville).
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> (v1)
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reported-by: Daniel Vetter <daniel@ffwll.ch>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
> Cc: Sinclair Yeh <syeh@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>

Ack for pulling this one in through drm-misc? It blocks the next patch.
All the other vmwgfx patches can be merged when/however, except this one
here.

Thanks, Daniel

> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index a50fb0360317..e88689b44efc 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -493,24 +493,24 @@ 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);
> +	if (new_state->crtc)
> +		crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
> +							   new_state->crtc);
>  
> -	/* Turning off */
> -	if (!fb)
> +	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;
>  
> -	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)
> -		return ret;
> +	/* Turning off */
> +	if (!fb)
> +		return 0;
>  
>  	/* A lot of the code assumes this */
>  	if (new_state->crtc_w != 64 || new_state->crtc_h != 64) {
> -- 
> 2.19.0.rc2
>
Thomas Hellstrom Oct. 5, 2018, 4:21 p.m. UTC | #2
On 10/05/2018 06:06 PM, Daniel Vetter wrote:
> On Thu, Oct 04, 2018 at 10:24:41PM +0200, Daniel Vetter wrote:
>> From: Thomas Hellstrom <thellstrom@vmware.com>
>>
>> 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.
>>
>> v2: Check for !fb after updating state->visible (Ville).
>>
>> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> (v1)
>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>> Reported-by: Daniel Vetter <daniel@ffwll.ch>
>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
>> Cc: Sinclair Yeh <syeh@vmware.com>
>> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Ack for pulling this one in through drm-misc? It blocks the next patch.
> All the other vmwgfx patches can be merged when/however, except this one
> here.
>
> Thanks, Daniel

Sure,

Thanks,
Thomas
Daniel Vetter Oct. 5, 2018, 8:46 p.m. UTC | #3
On Fri, Oct 05, 2018 at 04:21:43PM +0000, Thomas Hellstrom wrote:
> On 10/05/2018 06:06 PM, Daniel Vetter wrote:
> > On Thu, Oct 04, 2018 at 10:24:41PM +0200, Daniel Vetter wrote:
> >> From: Thomas Hellstrom <thellstrom@vmware.com>
> >>
> >> 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.
> >>
> >> v2: Check for !fb after updating state->visible (Ville).
> >>
> >> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> (v1)
> >> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> >> Reported-by: Daniel Vetter <daniel@ffwll.ch>
> >> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> >> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> >> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
> >> Cc: Sinclair Yeh <syeh@vmware.com>
> >> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> > Ack for pulling this one in through drm-misc? It blocks the next patch.
> > All the other vmwgfx patches can be merged when/however, except this one
> > here.
> >
> > Thanks, Daniel
> 
> Sure,

Thanks, applied to drm-misc-next, toghether with the remaining patches.
I'll leave all the other vmwgfx patches up to you.

Cheers, Daniel
Thomas Hellstrom Oct. 5, 2018, 8:53 p.m. UTC | #4
On 10/05/2018 10:46 PM, Daniel Vetter wrote:
> On Fri, Oct 05, 2018 at 04:21:43PM +0000, Thomas Hellstrom wrote:
>> On 10/05/2018 06:06 PM, Daniel Vetter wrote:
>>> On Thu, Oct 04, 2018 at 10:24:41PM +0200, Daniel Vetter wrote:
>>>> From: Thomas Hellstrom <thellstrom@vmware.com>
>>>>
>>>> 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.
>>>>
>>>> v2: Check for !fb after updating state->visible (Ville).
>>>>
>>>> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>>> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> (v1)
>>>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>>>> Reported-by: Daniel Vetter <daniel@ffwll.ch>
>>>> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
>>>> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>>>> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
>>>> Cc: Sinclair Yeh <syeh@vmware.com>
>>>> Cc: Thomas Hellstrom <thellstrom@vmware.com>
>>> Ack for pulling this one in through drm-misc? It blocks the next patch.
>>> All the other vmwgfx patches can be merged when/however, except this one
>>> here.
>>>
>>> Thanks, Daniel
>> Sure,
> Thanks, applied to drm-misc-next, toghether with the remaining patches.
> I'll leave all the other vmwgfx patches up to you.
>
> Cheers, Daniel

Thanks,

Thomas

Patch
diff mbox series

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index a50fb0360317..e88689b44efc 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -493,24 +493,24 @@  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);
+	if (new_state->crtc)
+		crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
+							   new_state->crtc);
 
-	/* Turning off */
-	if (!fb)
+	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;
 
-	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)
-		return ret;
+	/* Turning off */
+	if (!fb)
+		return 0;
 
 	/* A lot of the code assumes this */
 	if (new_state->crtc_w != 64 || new_state->crtc_h != 64) {