vrend: change cleanup order in fini/reset

Add vrend_renderer_prepare_reset, and move context/resource table
cleanups, to the beginning of the fini/reset functions.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Chia-I Wu 4 years ago
parent d4c9ef86e4
commit e8ff76ef47
  1. 27
      src/vrend_renderer.c
  2. 1
      src/vrend_renderer.h

@ -6054,7 +6054,10 @@ vrend_renderer_fini(void)
{
vrend_state.finishing = true;
vrend_free_sync_thread();
vrend_renderer_prepare_reset();
vrend_decode_reset();
virgl_resource_table_cleanup();
if (vrend_state.eventfd != -1) {
close(vrend_state.eventfd);
vrend_state.eventfd = -1;
@ -6062,9 +6065,6 @@ vrend_renderer_fini(void)
vrend_blitter_fini();
vrend_hw_switch_context(vrend_state.ctx0, true);
vrend_decode_reset();
virgl_resource_table_cleanup();
vrend_destroy_context(vrend_state.ctx0);
vrend_state.current_ctx = NULL;
@ -10456,21 +10456,26 @@ static void vrend_reset_fences(void)
pipe_mutex_unlock(vrend_state.fence_mutex);
}
void vrend_renderer_prepare_reset(void)
{
/* make sure user contexts are no longer accessed */
vrend_free_sync_thread();
vrend_hw_switch_context(vrend_state.ctx0, true);
}
void vrend_renderer_reset(void)
{
if (vrend_state.sync_thread) {
vrend_free_sync_thread();
vrend_state.stop_sync_thread = false;
}
vrend_renderer_prepare_reset();
vrend_decode_reset();
virgl_resource_table_reset();
vrend_reset_fences();
vrend_blitter_fini();
vrend_hw_switch_context(vrend_state.ctx0, true);
vrend_decode_reset();
virgl_resource_table_reset();
vrend_destroy_context(vrend_state.ctx0);
vrend_state.ctx0 = vrend_create_context(0, strlen("HOST"), "HOST");
/* TODO respawn sync thread */
}
int vrend_renderer_get_poll_fd(void)

@ -458,6 +458,7 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
bool skip_dest_swizzle);
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);

Loading…
Cancel
Save