From: Brian Date: Thu, 10 Jan 2008 16:13:10 +0000 (-0700) Subject: Cell: clean-up cell_spu_exit() code X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d07b86dedfd87ed7c301fa81242314c891031693;p=mesa.git Cell: clean-up cell_spu_exit() code --- diff --git a/src/mesa/pipe/cell/ppu/cell_context.c b/src/mesa/pipe/cell/ppu/cell_context.c index 4fcf804d828..57178c835f9 100644 --- a/src/mesa/pipe/cell/ppu/cell_context.c +++ b/src/mesa/pipe/cell/ppu/cell_context.c @@ -148,7 +148,6 @@ cell_destroy_context( struct pipe_context *pipe ) struct cell_context *cell = cell_context(pipe); cell_spu_exit(cell); - wait_spus(cell->num_spus); free(cell); } @@ -255,7 +254,6 @@ cell_create_context(struct pipe_winsys *winsys, struct cell_winsys *cws) #if 0 test_spus(cell); - wait_spus(); #endif return &cell->pipe; diff --git a/src/mesa/pipe/cell/ppu/cell_spu.c b/src/mesa/pipe/cell/ppu/cell_spu.c index a7dbf24dd8f..44ad3f22b39 100644 --- a/src/mesa/pipe/cell/ppu/cell_spu.c +++ b/src/mesa/pipe/cell/ppu/cell_spu.c @@ -194,32 +194,23 @@ test_spus(struct cell_context *cell) } -/** - * Wait for all SPUs to exit/return. - */ -void -wait_spus(uint num_spus) -{ - uint i; - void *value; - - for (i = 0; i < num_spus; i++) { - pthread_join(cell_global.spe_threads[i], &value); - } -} - - /** * Tell all the SPUs to stop/exit. */ void cell_spu_exit(struct cell_context *cell) { - unsigned i; + uint i; for (i = 0; i < cell->num_spus; i++) { send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_EXIT); } - wait_spus(cell->num_spus); + /* wait for threads to exit */ + for (i = 0; i < cell->num_spus; i++) { + void *value; + pthread_join(cell_global.spe_threads[i], &value); + cell_global.spe_threads[i] = 0; + cell_global.spe_contexts[i] = 0; + } } diff --git a/src/mesa/pipe/cell/ppu/cell_spu.h b/src/mesa/pipe/cell/ppu/cell_spu.h index 612cb45c59d..d11001af62b 100644 --- a/src/mesa/pipe/cell/ppu/cell_spu.h +++ b/src/mesa/pipe/cell/ppu/cell_spu.h @@ -82,9 +82,6 @@ void test_spus(struct cell_context *cell); -void -wait_spus(uint num_spus); - void cell_spu_exit(struct cell_context *cell);