diff mbox series

[1/5] drm/vmwgfx: move the require_exist handling together

Message ID 20191101130313.8862-1-emil.l.velikov@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/5] drm/vmwgfx: move the require_exist handling together | expand

Commit Message

Emil Velikov Nov. 1, 2019, 1:03 p.m. UTC
From: Emil Velikov <emil.velikov@collabora.com>

Move the render_client hunk for require_exist alongside the rest.
Keeping all the reasons why an existing object is needed, in a single
place makes it easier to follow.

Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Emil Velikov Nov. 8, 2019, 1:13 p.m. UTC | #1
On Fri, 1 Nov 2019 at 13:05, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>
> From: Emil Velikov <emil.velikov@collabora.com>
>
> Move the render_client hunk for require_exist alongside the rest.
> Keeping all the reasons why an existing object is needed, in a single
> place makes it easier to follow.
>
> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> index 29d8794f0421..1f989f3605c8 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> @@ -909,16 +909,12 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
>         uint32_t handle;
>         struct ttm_base_object *base;
>         int ret;
> -       bool require_exist = false;
>
>         if (handle_type == DRM_VMW_HANDLE_PRIME) {
>                 ret = ttm_prime_fd_to_handle(tfile, u_handle, &handle);
>                 if (unlikely(ret != 0))
>                         return ret;
>         } else {
> -               if (unlikely(drm_is_render_client(file_priv)))
> -                       require_exist = true;
> -
>                 handle = u_handle;
>         }
>
> @@ -935,6 +931,8 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
>         }
>
>         if (handle_type != DRM_VMW_HANDLE_PRIME) {
> +               bool require_exist = false;
> +
>                 user_srf = container_of(base, struct vmw_user_surface,
>                                         prime.base);
>
> @@ -946,6 +944,9 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
>                     user_srf->master != file_priv->master)
>                         require_exist = true;
>
> +               if (unlikely(drm_is_render_client(file_priv)))
> +                       require_exist = true;
> +
>                 ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL,
>                                          require_exist);
>                 if (unlikely(ret != 0)) {
> --
Thomas, VMware devs, humble poke?
Any comments and review would be appreciated.

Thanks
Emil
Thomas Hellstrom Nov. 8, 2019, 3:22 p.m. UTC | #2
Hi, Emil!

On 11/8/19 2:14 PM, Emil Velikov wrote:
> On Fri, 1 Nov 2019 at 13:05, Emil Velikov <emil.l.velikov@gmail.com> wrote:
>> From: Emil Velikov <emil.velikov@collabora.com>
>>
>> Move the render_client hunk for require_exist alongside the rest.
>> Keeping all the reasons why an existing object is needed, in a single
>> place makes it easier to follow.
>>
>> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
>> Cc: Thomas Hellstrom <thellstrom@vmware.com>
>> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
>> ---
>>  drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 9 +++++----
>>  1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
>> index 29d8794f0421..1f989f3605c8 100644
>> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
>> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
>> @@ -909,16 +909,12 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
>>         uint32_t handle;
>>         struct ttm_base_object *base;
>>         int ret;
>> -       bool require_exist = false;
>>
>>         if (handle_type == DRM_VMW_HANDLE_PRIME) {
>>                 ret = ttm_prime_fd_to_handle(tfile, u_handle, &handle);
>>                 if (unlikely(ret != 0))
>>                         return ret;
>>         } else {
>> -               if (unlikely(drm_is_render_client(file_priv)))
>> -                       require_exist = true;
>> -
>>                 handle = u_handle;
>>         }
>>
>> @@ -935,6 +931,8 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
>>         }
>>
>>         if (handle_type != DRM_VMW_HANDLE_PRIME) {
>> +               bool require_exist = false;
>> +
>>                 user_srf = container_of(base, struct vmw_user_surface,
>>                                         prime.base);
>>
>> @@ -946,6 +944,9 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
>>                     user_srf->master != file_priv->master)
>>                         require_exist = true;
>>
>> +               if (unlikely(drm_is_render_client(file_priv)))
>> +                       require_exist = true;
>> +
>>                 ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL,
>>                                          require_exist);
>>                 if (unlikely(ret != 0)) {
>> --
> Thomas, VMware devs, humble poke?
> Any comments and review would be appreciated.
>
> Thanks
> Emil
>
Sorry, I'll look at this early monday.

Thanks,

Thomas
Thomas Hellstrom Nov. 12, 2019, 12:50 p.m. UTC | #3
On 11/1/19 2:05 PM, Emil Velikov wrote:
> From: Emil Velikov <emil.velikov@collabora.com>
>
> Move the render_client hunk for require_exist alongside the rest.
> Keeping all the reasons why an existing object is needed, in a single
> place makes it easier to follow.
>
> Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
> Cc: Thomas Hellstrom <thellstrom@vmware.com>
> Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_surface.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> index 29d8794f0421..1f989f3605c8 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
> @@ -909,16 +909,12 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
>  	uint32_t handle;
>  	struct ttm_base_object *base;
>  	int ret;
> -	bool require_exist = false;
>  
>  	if (handle_type == DRM_VMW_HANDLE_PRIME) {
>  		ret = ttm_prime_fd_to_handle(tfile, u_handle, &handle);
>  		if (unlikely(ret != 0))
>  			return ret;
>  	} else {
> -		if (unlikely(drm_is_render_client(file_priv)))
> -			require_exist = true;
> -
>  		handle = u_handle;
>  	}
>  
> @@ -935,6 +931,8 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
>  	}
>  
>  	if (handle_type != DRM_VMW_HANDLE_PRIME) {
> +		bool require_exist = false;
> +
>  		user_srf = container_of(base, struct vmw_user_surface,
>  					prime.base);
>  
> @@ -946,6 +944,9 @@ vmw_surface_handle_reference(struct vmw_private *dev_priv,
>  		    user_srf->master != file_priv->master)
>  			require_exist = true;
>  
> +		if (unlikely(drm_is_render_client(file_priv)))
> +			require_exist = true;
> +
>  		ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL,
>  					 require_exist);
>  		if (unlikely(ret != 0)) {

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
index 29d8794f0421..1f989f3605c8 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_surface.c
@@ -909,16 +909,12 @@  vmw_surface_handle_reference(struct vmw_private *dev_priv,
 	uint32_t handle;
 	struct ttm_base_object *base;
 	int ret;
-	bool require_exist = false;
 
 	if (handle_type == DRM_VMW_HANDLE_PRIME) {
 		ret = ttm_prime_fd_to_handle(tfile, u_handle, &handle);
 		if (unlikely(ret != 0))
 			return ret;
 	} else {
-		if (unlikely(drm_is_render_client(file_priv)))
-			require_exist = true;
-
 		handle = u_handle;
 	}
 
@@ -935,6 +931,8 @@  vmw_surface_handle_reference(struct vmw_private *dev_priv,
 	}
 
 	if (handle_type != DRM_VMW_HANDLE_PRIME) {
+		bool require_exist = false;
+
 		user_srf = container_of(base, struct vmw_user_surface,
 					prime.base);
 
@@ -946,6 +944,9 @@  vmw_surface_handle_reference(struct vmw_private *dev_priv,
 		    user_srf->master != file_priv->master)
 			require_exist = true;
 
+		if (unlikely(drm_is_render_client(file_priv)))
+			require_exist = true;
+
 		ret = ttm_ref_object_add(tfile, base, TTM_REF_USAGE, NULL,
 					 require_exist);
 		if (unlikely(ret != 0)) {