[PATCH i-g-t v4 4/5] lib/igt_fb: put intel blt cleanup into its own function
Juha-Pekka Heikkila
juhapekka.heikkila at gmail.com
Thu May 30 14:23:45 UTC 2024
make blitcopy function bit easier to handle
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>
---
lib/igt_fb.c | 33 +++++++++++++++++++++------------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/lib/igt_fb.c b/lib/igt_fb.c
index e225b9090..d8608ef08 100644
--- a/lib/igt_fb.c
+++ b/lib/igt_fb.c
@@ -2939,6 +2939,25 @@ static void setup_context_and_memory_region(const struct igt_fb *fb, uint32_t *c
}
}
+static void cleanup_blt_resources(uint32_t ctx, uint64_t ahnd, bool is_xe,
+ uint32_t xe_bb, uint32_t exec_queue,
+ uint32_t vm, intel_ctx_t *xe_ctx,
+ int fd, const intel_ctx_t *ictx)
+{
+ if (ctx)
+ gem_context_destroy(fd, ctx);
+ put_ahnd(ahnd);
+
+ if(is_xe) {
+ gem_close(fd, xe_bb);
+ xe_exec_queue_destroy(fd, exec_queue);
+ xe_vm_destroy(fd, vm);
+ free(xe_ctx);
+ }
+
+ intel_ctx_destroy(fd, ictx);
+}
+
static void blitcopy(const struct igt_fb *dst_fb,
const struct igt_fb *src_fb)
{
@@ -3079,18 +3098,8 @@ static void blitcopy(const struct igt_fb *dst_fb,
}
}
- if (ctx)
- gem_context_destroy(dst_fb->fd, ctx);
- put_ahnd(ahnd);
-
- if(is_xe) {
- gem_close(dst_fb->fd, xe_bb);
- xe_exec_queue_destroy(dst_fb->fd, exec_queue);
- xe_vm_destroy(dst_fb->fd, vm);
- free(xe_ctx);
- }
-
- intel_ctx_destroy(src_fb->fd, ictx);
+ cleanup_blt_resources(ctx, ahnd, is_xe, bb, exec_queue, vm, xe_ctx,
+ src_fb->fd, ictx);
}
static void free_linear_mapping(struct fb_blit_upload *blit)
--
2.43.2
More information about the igt-dev
mailing list