From 0edca466f4b9494e64bf51d8032eafeb8af0fddd Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 24 Aug 2020 12:18:02 -0700 Subject: [PATCH] vrend: improve vrend_state.inited checks I am not sure what the check in vrend_renderer_init was previously for. This gives it some sense. Signed-off-by: Chia-I Wu Reviewed-by: Gurchetan Singh --- src/vrend_renderer.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c index dd8b37e..b178242 100644 --- a/src/vrend_renderer.c +++ b/src/vrend_renderer.c @@ -5938,15 +5938,17 @@ int vrend_renderer_init(const struct vrend_if_cbs *cbs, uint32_t flags) virgl_gl_context gl_context; struct virgl_gl_ctx_param ctx_params; - if (!vrend_state.inited) { - vrend_state.inited = true; - virgl_resource_table_init(vrend_renderer_get_pipe_callbacks()); - vrend_clicbs = cbs; - /* Give some defaults to be able to run the tests */ - vrend_state.max_texture_2d_size = - vrend_state.max_texture_3d_size = - vrend_state.max_texture_cube_size = 16384; - } + if (vrend_state.inited) + return 0; + + vrend_state.inited = true; + virgl_resource_table_init(vrend_renderer_get_pipe_callbacks()); + vrend_clicbs = cbs; + + /* Give some defaults to be able to run the tests */ + vrend_state.max_texture_2d_size = + vrend_state.max_texture_3d_size = + vrend_state.max_texture_cube_size = 16384; #ifndef NDEBUG vrend_init_debug_flags(); @@ -10468,6 +10470,9 @@ static void vrend_reset_fences(void) void vrend_renderer_reset(void) { + if (!vrend_state.inited) + return; + if (vrend_state.sync_thread) { vrend_free_sync_thread(); vrend_state.stop_sync_thread = false;