summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian <[email protected]>2008-01-10 09:13:10 -0700
committerBrian <[email protected]>2008-01-10 11:26:20 -0700
commitd07b86dedfd87ed7c301fa81242314c891031693 (patch)
tree38992400a5cd276e783892bca5ad9506fa150085
parente6b33b6f35ab2f7b240ac902cc748d8e1a2fd4ef (diff)
Cell: clean-up cell_spu_exit() code
-rw-r--r--src/mesa/pipe/cell/ppu/cell_context.c2
-rw-r--r--src/mesa/pipe/cell/ppu/cell_spu.c25
-rw-r--r--src/mesa/pipe/cell/ppu/cell_spu.h3
3 files changed, 8 insertions, 22 deletions
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
@@ -195,31 +195,22 @@ 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
@@ -83,9 +83,6 @@ test_spus(struct cell_context *cell);
void
-wait_spus(uint num_spus);
-
-void
cell_spu_exit(struct cell_context *cell);