All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/vmwgfx: Fix vmw_du_cursor_plane_atomic_check
@ 2018-03-27 14:26 Thomas Hellstrom
  2018-03-27 15:08 ` Ville Syrjälä
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Hellstrom @ 2018-03-27 14:26 UTC (permalink / raw)
  To: dri-devel; +Cc: Thomas Hellstrom, dan.carpenter

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.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Reported-by: Daniel Vetter <daniel@ffwll.ch>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 3628a9fe705f..0f7dc9ea2657 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -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 */
-- 
2.14.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/vmwgfx: Fix vmw_du_cursor_plane_atomic_check
  2018-03-27 14:26 [PATCH] drm/vmwgfx: Fix vmw_du_cursor_plane_atomic_check Thomas Hellstrom
@ 2018-03-27 15:08 ` Ville Syrjälä
  2018-03-27 15:15   ` Thomas Hellstrom
  0 siblings, 1 reply; 4+ messages in thread
From: Ville Syrjälä @ 2018-03-27 15:08 UTC (permalink / raw)
  To: Thomas Hellstrom; +Cc: dan.carpenter, dri-devel

On Tue, Mar 27, 2018 at 04:26:17PM +0200, Thomas Hellstrom wrote:
> 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.
> 
> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Reported-by: Daniel Vetter <daniel@ffwll.ch>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 3628a9fe705f..0f7dc9ea2657 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -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;

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.

>  
> -	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 */
> -- 
> 2.14.3
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/vmwgfx: Fix vmw_du_cursor_plane_atomic_check
  2018-03-27 15:08 ` Ville Syrjälä
@ 2018-03-27 15:15   ` Thomas Hellstrom
  2018-09-04 19:52     ` Daniel Vetter
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Hellstrom @ 2018-03-27 15:15 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: dan.carpenter, dri-devel

On 03/27/2018 05:08 PM, Ville Syrjälä wrote:
> On Tue, Mar 27, 2018 at 04:26:17PM +0200, Thomas Hellstrom wrote:
>> 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.
>>
>> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>> Reported-by: Daniel Vetter <daniel@ffwll.ch>
>> ---
>>   drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 22 +++++++++++-----------
>>   1 file changed, 11 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
>> index 3628a9fe705f..0f7dc9ea2657 100644
>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
>> @@ -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;
> 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
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] drm/vmwgfx: Fix vmw_du_cursor_plane_atomic_check
  2018-03-27 15:15   ` Thomas Hellstrom
@ 2018-09-04 19:52     ` Daniel Vetter
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2018-09-04 19:52 UTC (permalink / raw)
  To: Thomas Hellstrom; +Cc: dri-devel, Dan Carpenter

On Tue, Mar 27, 2018 at 5:15 PM, Thomas Hellstrom <thellstrom@vmware.com> wrote:
> On 03/27/2018 05:08 PM, Ville Syrjälä wrote:
>>
>> On Tue, Mar 27, 2018 at 04:26:17PM +0200, Thomas Hellstrom wrote:
>>>
>>> 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.
>>>
>>> Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
>>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>>> Reported-by: Daniel Vetter <daniel@ffwll.ch>
>>> ---
>>>   drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 22 +++++++++++-----------
>>>   1 file changed, 11 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
>>> b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
>>> index 3628a9fe705f..0f7dc9ea2657 100644
>>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
>>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
>>> @@ -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;
>>
>> 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.

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
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-04 19:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-27 14:26 [PATCH] drm/vmwgfx: Fix vmw_du_cursor_plane_atomic_check Thomas Hellstrom
2018-03-27 15:08 ` Ville Syrjälä
2018-03-27 15:15   ` Thomas Hellstrom
2018-09-04 19:52     ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.