コード例 #1
0
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);
}
コード例 #2
0
ファイル: lp_rast.c プロジェクト: venkatarajasekhar/Qt
/* 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);
}
コード例 #3
0
ファイル: radeon_drm_winsys.c プロジェクト: CSRedRat/mesa-1
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);
}
コード例 #4
0
ファイル: u_queue.c プロジェクト: airlied/mesa
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);
}
コード例 #5
0
ファイル: radeon_drm_cs.c プロジェクト: VadimGirlin/mesa
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);
}
コード例 #6
0
int main()
{
   int i;

   printf("pipe_barrier_test starting\n");

   pipe_barrier_init(&barrier, NUM_THREADS);

   for (i = 0; i < NUM_THREADS; i++) {
      thread_ids[i] = i;
      threads[i] = pipe_thread_create(thread_function, (void *) &thread_ids[i]);
   }

   for (i = 0; i < NUM_THREADS; i++ ) {
      pipe_thread_wait(threads[i]);
   }

   pipe_barrier_destroy(&barrier);

   printf("pipe_barrier_test exiting\n");

   return 0;
}