[igt-dev] [PATCH] lib/igt_fb: Elimine repetitive verification
Gabriela Bittencourt
gabrielabittencourt00 at gmail.com
Thu Feb 20 01:33:36 UTC 2020
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
More information about the igt-dev
mailing list