From fadf5528d929eb84928518b2a09644f185e51d23 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 24 Aug 2020 13:25:28 -0700 Subject: [PATCH] virgl: move resource/context table cleanup out of vrend Those tables should not be tied to vrend. Signed-off-by: Chia-I Wu Reviewed-by: Gurchetan Singh --- src/virglrenderer.c | 12 ++++++++++-- src/vrend_decode.c | 5 ----- src/vrend_renderer.c | 8 -------- src/vrend_renderer.h | 1 - 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/virglrenderer.c b/src/virglrenderer.c index 30065e4..b9faa07 100644 --- a/src/virglrenderer.c +++ b/src/virglrenderer.c @@ -439,8 +439,12 @@ void virgl_renderer_poll(void) void virgl_renderer_cleanup(UNUSED void *cookie) { - if (state.vrend_initialized) + if (state.vrend_initialized) { + vrend_renderer_prepare_reset(); + virgl_context_table_reset(); + virgl_resource_table_cleanup(); vrend_renderer_fini(); + } virgl_context_table_cleanup(); vrend_winsys_cleanup(); @@ -503,8 +507,12 @@ int virgl_renderer_get_fd_for_texture2(uint32_t tex_id, int *fd, int *stride, in void virgl_renderer_reset(void) { - if (state.vrend_initialized) + if (state.vrend_initialized) { + vrend_renderer_prepare_reset(); + virgl_context_table_reset(); + virgl_resource_table_reset(); vrend_renderer_reset(); + } } int virgl_renderer_get_poll_fd(void) diff --git a/src/vrend_decode.c b/src/vrend_decode.c index 52e9095..9e573f1 100644 --- a/src/vrend_decode.c +++ b/src/vrend_decode.c @@ -1722,8 +1722,3 @@ static void vrend_decode_ctx_init_base(struct vrend_decode_ctx *dctx, ctx->get_blob_done = NULL; ctx->submit_cmd = vrend_decode_ctx_submit_cmd; } - -void vrend_decode_reset(void) -{ - virgl_context_table_reset(); -} diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index fd2c7a1..6a87a49 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -6054,10 +6054,6 @@ vrend_renderer_fini(void) { vrend_state.finishing = true; - vrend_renderer_prepare_reset(); - vrend_decode_reset(); - virgl_resource_table_cleanup(); - if (vrend_state.eventfd != -1) { close(vrend_state.eventfd); vrend_state.eventfd = -1; @@ -10465,10 +10461,6 @@ void vrend_renderer_prepare_reset(void) void vrend_renderer_reset(void) { - vrend_renderer_prepare_reset(); - vrend_decode_reset(); - virgl_resource_table_reset(); - vrend_reset_fences(); vrend_blitter_fini(); diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index 65e6069..271c761 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -461,7 +461,6 @@ void vrend_blitter_fini(void); void vrend_renderer_prepare_reset(void); void vrend_renderer_reset(void); int vrend_renderer_get_poll_fd(void); -void vrend_decode_reset(void); unsigned vrend_context_has_debug_flag(const struct vrend_context *ctx, enum virgl_debug_flags flag);