From acc7fc7c110f6770437f660aada2c8ec7b9a1075 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 26 Mar 2020 16:12:04 -0700 Subject: [PATCH] vrend: remove unnecessary switch_0 logic When destroying any user context, vrend_destroy_context already calls vrend_renderer_force_ctx_0. The manual switch to context 0 is unnecessary. Signed-off-by: Chia-I Wu Reviewed-by: Gurchetan Singh --- src/vrend_decode.c | 6 +----- src/vrend_renderer.c | 4 +--- src/vrend_renderer.h | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/vrend_decode.c b/src/vrend_decode.c index a2f1f4e..9c20088 100644 --- a/src/vrend_decode.c +++ b/src/vrend_decode.c @@ -1424,12 +1424,8 @@ struct vrend_context *vrend_lookup_renderer_ctx(uint32_t ctx_id) static void vrend_decode_ctx_destroy(struct virgl_context *ctx) { struct vrend_decode_ctx *dctx = (struct vrend_decode_ctx *)ctx; - bool switch_0; - - switch_0 = vrend_destroy_context(dctx->grctx); - if (switch_0 && dec_ctx0 != dctx) - vrend_hw_switch_context(dec_ctx0->grctx, true); + vrend_destroy_context(dctx->grctx); free(dctx); } diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index 7d28822..2de4055 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -5975,7 +5975,7 @@ static void vrend_destroy_sub_context(struct vrend_sub_context *sub) } -bool vrend_destroy_context(struct vrend_context *ctx) +void vrend_destroy_context(struct vrend_context *ctx) { bool switch_0 = (ctx == vrend_state.current_ctx); struct vrend_context *cur = vrend_state.current_ctx; @@ -6018,8 +6018,6 @@ bool vrend_destroy_context(struct vrend_context *ctx) if (!switch_0 && cur) vrend_hw_switch_context(cur, true); - - return switch_0; } struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *debug_name) diff --git a/src/vrend_renderer.h b/src/vrend_renderer.h index cba8c2b..e8a751e 100644 --- a/src/vrend_renderer.h +++ b/src/vrend_renderer.h @@ -164,7 +164,7 @@ void vrend_set_framebuffer_state(struct vrend_context *ctx, uint32_t zsurf_handle); struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *debug_name); -bool vrend_destroy_context(struct vrend_context *ctx); +void vrend_destroy_context(struct vrend_context *ctx); struct virgl_context *vrend_renderer_context_create(uint32_t handle, uint32_t nlen, const char *name);