[igt-dev] [PATCH] lib/igt_fb: Elimine repetitive verification

Rodrigo Siqueira rodrigosiqueiramelo at gmail.com
Thu Feb 20 23:00:03 UTC 2020


Hi Gabriela,

Lgtm

Reviewed-by: Rodrigo Siqueira <rodrigosiqueiramelo at gmail.com>

Thanks for the patch :)

On 02/19, Gabriela Bittencourt wrote:
> Clean return function by elimine repetitive verification on return
> functions. The function is_ccs_modifier returns true either if fb->modifier
> is equals I915_FORMAT_MOD_Y_TILED or I915_FORMAT_MOD_Yf_TILED. What makes
> possible to eliminate this verification on the return of the function:
> use_enginecopy. The function blitter_ok returns false whenever
> is_ccs_modifier returns true, so it's possible to eliminate the
> fb->modifier verifications on use_blitter also.
> 
> Signed-off-by: Gabriela Bittencourt <gabrielabittencourt00 at gmail.com>
> ---
>  lib/igt_fb.c | 15 ++++-----------
>  1 file changed, 4 insertions(+), 11 deletions(-)
> 
> diff --git a/lib/igt_fb.c b/lib/igt_fb.c
> index 0c4fdc5d..34a91320 100644
> --- a/lib/igt_fb.c
> +++ b/lib/igt_fb.c
> @@ -2026,21 +2026,14 @@ static bool blitter_ok(const struct igt_fb *fb)
>  
>  static bool use_enginecopy(const struct igt_fb *fb)
>  {
> -	if (blitter_ok(fb))
> -		return false;
> -
> -	return fb->modifier == I915_FORMAT_MOD_Yf_TILED ||
> -	       is_ccs_modifier(fb->modifier) ||
> -	       !gem_has_mappable_ggtt(fb->fd);
> +	return !blitter_ok(fb) &&
> +	       (is_ccs_modifier(fb->modifier) ||
> +		!gem_has_mappable_ggtt(fb->fd));
>  }
>  
>  static bool use_blitter(const struct igt_fb *fb)
>  {
> -	if (!blitter_ok(fb))
> -		return false;
> -
> -	return fb->modifier == I915_FORMAT_MOD_Y_TILED ||
> -	       fb->modifier == I915_FORMAT_MOD_Yf_TILED ||
> +	return blitter_ok(fb) &&
>  	       !gem_has_mappable_ggtt(fb->fd);
>  }
>  
> -- 
> 2.25.0
> 

-- 
Rodrigo Siqueira
Software Engineer, Advanced Micro Devices (AMD)
https://siqueira.tech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/igt-dev/attachments/20200220/fc6e6454/attachment-0001.sig>


More information about the igt-dev mailing list