renderer: reset decode contexts in two stages

reset the non-0 contexts first, then kill resource
table, then nuke the 0 context.
macos/master
Dave Airlie 10 years ago
parent 38685b314b
commit 96e1b0b693
  1. 23
      src/vrend_decode.c
  2. 8
      src/vrend_renderer.c
  3. 2
      src/vrend_renderer.h

@ -1160,22 +1160,27 @@ void vrend_decode_block(uint32_t ctx_id, uint32_t *block, int ndw)
} }
void vrend_decode_reset(void) void vrend_decode_reset(bool ctx_0_only)
{ {
int i; int i;
vrend_hw_switch_context(dec_ctx[0]->grctx, TRUE); vrend_hw_switch_context(dec_ctx[0]->grctx, TRUE);
for (i = 1; i < VREND_MAX_CTX; i++) {
if (!dec_ctx[i]) if (ctx_0_only == false) {
for (i = 1; i < VREND_MAX_CTX; i++) {
if (!dec_ctx[i])
continue; continue;
if (!dec_ctx[i]->grctx) if (!dec_ctx[i]->grctx)
continue; continue;
vrend_destroy_context(dec_ctx[i]->grctx); vrend_destroy_context(dec_ctx[i]->grctx);
free(dec_ctx[i]); free(dec_ctx[i]);
dec_ctx[i] = NULL;
}
} else {
vrend_destroy_context(dec_ctx[0]->grctx);
free(dec_ctx[0]);
dec_ctx[0] = NULL;
} }
vrend_destroy_context(dec_ctx[0]->grctx);
free(dec_ctx[0]);
} }

@ -3179,9 +3179,9 @@ vrend_renderer_fini(void)
if (!inited) if (!inited)
return; return;
vrend_renderer_force_ctx_0(); vrend_decode_reset(false);
vrend_object_fini_resource_table(); vrend_object_fini_resource_table();
vrend_decode_reset(); vrend_decode_reset(true);
inited = 0; inited = 0;
} }
@ -5508,9 +5508,9 @@ static void vrend_reset_fences(void)
void vrend_renderer_reset(void) void vrend_renderer_reset(void)
{ {
vrend_reset_fences(); vrend_reset_fences();
vrend_decode_reset(); vrend_decode_reset(false);
vrend_object_fini_resource_table(); vrend_object_fini_resource_table();
vrend_decode_reset(true);
vrend_object_init_resource_table(); vrend_object_init_resource_table();
vrend_state.viewport_dirty = vrend_state.scissor_dirty = TRUE; vrend_state.viewport_dirty = vrend_state.scissor_dirty = TRUE;
vrend_state.program_id = (GLuint)-1; vrend_state.program_id = (GLuint)-1;

@ -383,7 +383,7 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
const struct pipe_blit_info *info); const struct pipe_blit_info *info);
void vrend_renderer_reset(void); void vrend_renderer_reset(void);
void vrend_decode_reset(void); void vrend_decode_reset(bool ctx_0_only);
#define VREND_GL_VER_MAJOR 3 #define VREND_GL_VER_MAJOR 3
#define VREND_GL_VER_MINOR 1 #define VREND_GL_VER_MINOR 1

Loading…
Cancel
Save