/* Shutdown: */ void lp_rast_destroy( struct lp_rasterizer *rast ) { unsigned i; /* Set exit_flag and signal each thread's work_ready semaphore. * Each thread will be woken up, notice that the exit_flag is set and * break out of its main loop. The thread will then exit. */ rast->exit_flag = TRUE; for (i = 0; i < rast->num_threads; i++) { pipe_semaphore_signal(&rast->tasks[i].work_ready); } /* Wait for threads to terminate before cleaning up per-thread data */ for (i = 0; i < rast->num_threads; i++) { pipe_thread_wait(rast->threads[i]); } /* Clean up per-thread data */ for (i = 0; i < rast->num_threads; i++) { pipe_semaphore_destroy(&rast->tasks[i].work_ready); pipe_semaphore_destroy(&rast->tasks[i].work_done); } /* for synchronizing rasterization threads */ pipe_barrier_destroy( &rast->barrier ); lp_scene_queue_destroy(rast->full_scenes); FREE(rast); }
void util_queue_destroy(struct util_queue *queue) { queue->kill_thread = 1; pipe_semaphore_signal(&queue->queued); pipe_thread_wait(queue->thread); pipe_semaphore_destroy(&queue->has_space); pipe_semaphore_destroy(&queue->queued); pipe_mutex_destroy(queue->lock); }
static void radeon_winsys_destroy(struct radeon_winsys *rws) { struct radeon_drm_winsys *ws = (struct radeon_drm_winsys*)rws; if (ws->thread) { ws->kill_thread = 1; pipe_semaphore_signal(&ws->cs_queued); pipe_thread_wait(ws->thread); } pipe_semaphore_destroy(&ws->cs_queued); pipe_mutex_destroy(ws->hyperz_owner_mutex); pipe_mutex_destroy(ws->cmask_owner_mutex); pipe_mutex_destroy(ws->cs_stack_lock); ws->cman->destroy(ws->cman); ws->kman->destroy(ws->kman); if (ws->gen >= DRV_R600) { radeon_surface_manager_free(ws->surf_man); } if (ws->fd >= 0) close(ws->fd); FREE(rws); }
static void radeon_winsys_destroy(struct radeon_winsys *rws) { struct radeon_drm_winsys *ws = (struct radeon_drm_winsys*)rws; if (ws->thread) { ws->kill_thread = 1; pipe_semaphore_signal(&ws->cs_queued); pipe_thread_wait(ws->thread); } pipe_semaphore_destroy(&ws->cs_queued); pipe_condvar_destroy(ws->cs_queue_empty); if (!pipe_reference(&ws->base.reference, NULL)) { return; } pipe_mutex_destroy(ws->hyperz_owner_mutex); pipe_mutex_destroy(ws->cmask_owner_mutex); pipe_mutex_destroy(ws->cs_stack_lock); ws->cman->destroy(ws->cman); ws->kman->destroy(ws->kman); if (ws->gen >= DRV_R600) { radeon_surface_manager_free(ws->surf_man); } if (fd_tab) { util_hash_table_remove(fd_tab, intptr_to_pointer(ws->fd)); } FREE(rws); }
static void radeon_drm_cs_destroy(struct radeon_winsys_cs *rcs) { struct radeon_drm_cs *cs = radeon_drm_cs(rcs); radeon_drm_cs_sync_flush(cs); if (cs->thread) { cs->kill_thread = 1; pipe_semaphore_signal(&cs->flush_queued); pipe_semaphore_wait(&cs->flush_completed); pipe_thread_wait(cs->thread); } pipe_semaphore_destroy(&cs->flush_queued); pipe_semaphore_destroy(&cs->flush_completed); radeon_cs_context_cleanup(&cs->csc1); radeon_cs_context_cleanup(&cs->csc2); p_atomic_dec(&cs->ws->num_cs); radeon_destroy_cs_context(&cs->csc1); radeon_destroy_cs_context(&cs->csc2); FREE(cs); }
/* Shutdown: */ void lp_rast_destroy( struct lp_rasterizer *rast ) { unsigned i; /* Set exit_flag and signal each thread's work_ready semaphore. * Each thread will be woken up, notice that the exit_flag is set and * break out of its main loop. The thread will then exit. */ rast->exit_flag = TRUE; for (i = 0; i < rast->num_threads; i++) { pipe_semaphore_signal(&rast->tasks[i].work_ready); } /* Wait for threads to terminate before cleaning up per-thread data. * We don't actually call pipe_thread_wait to avoid dead lock on Windows * per https://bugs.freedesktop.org/show_bug.cgi?id=76252 */ for (i = 0; i < rast->num_threads; i++) { #ifdef _WIN32 pipe_semaphore_wait(&rast->tasks[i].work_done); #else thrd_join(rast->threads[i], NULL); #endif } /* Clean up per-thread data */ for (i = 0; i < rast->num_threads; i++) { pipe_semaphore_destroy(&rast->tasks[i].work_ready); pipe_semaphore_destroy(&rast->tasks[i].work_done); } for (i = 0; i < MAX2(1, rast->num_threads); i++) { align_free(rast->tasks[i].thread_data.cache); } /* for synchronizing rasterization threads */ if (rast->num_threads > 0) { pipe_barrier_destroy( &rast->barrier ); } lp_scene_queue_destroy(rast->full_scenes); FREE(rast); }
static void radeon_drm_cs_destroy(struct radeon_winsys_cs *rcs) { struct radeon_drm_cs *cs = radeon_drm_cs(rcs); radeon_drm_cs_sync_flush(rcs); pipe_semaphore_destroy(&cs->flush_completed); radeon_cs_context_cleanup(&cs->csc1); radeon_cs_context_cleanup(&cs->csc2); p_atomic_dec(&cs->ws->num_cs); radeon_destroy_cs_context(&cs->csc1); radeon_destroy_cs_context(&cs->csc2); FREE(cs); }
void util_queue_fence_destroy(struct util_queue_fence *fence) { pipe_semaphore_destroy(&fence->done); }