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 <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Chia-I Wu 5 years ago
parent 159ee44f84
commit acc7fc7c11
  1. 6
      src/vrend_decode.c
  2. 4
      src/vrend_renderer.c
  3. 2
      src/vrend_renderer.h

@ -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) static void vrend_decode_ctx_destroy(struct virgl_context *ctx)
{ {
struct vrend_decode_ctx *dctx = (struct vrend_decode_ctx *)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); free(dctx);
} }

@ -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); bool switch_0 = (ctx == vrend_state.current_ctx);
struct vrend_context *cur = 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) if (!switch_0 && cur)
vrend_hw_switch_context(cur, true); vrend_hw_switch_context(cur, true);
return switch_0;
} }
struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *debug_name) struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *debug_name)

@ -164,7 +164,7 @@ void vrend_set_framebuffer_state(struct vrend_context *ctx,
uint32_t zsurf_handle); uint32_t zsurf_handle);
struct vrend_context *vrend_create_context(int id, uint32_t nlen, const char *debug_name); 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, struct virgl_context *vrend_renderer_context_create(uint32_t handle,
uint32_t nlen, uint32_t nlen,
const char *name); const char *name);

Loading…
Cancel
Save