Example #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_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_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);
}
Example #3
0
void r600_destroy_common_screen(struct r600_common_screen *rscreen)
{
	r600_perfcounters_destroy(rscreen);
	r600_gpu_load_kill_thread(rscreen);

	pipe_mutex_destroy(rscreen->gpu_load_mutex);
	pipe_mutex_destroy(rscreen->aux_context_lock);
	rscreen->aux_context->destroy(rscreen->aux_context);

	rscreen->ws->destroy(rscreen->ws);
	FREE(rscreen);
}
Example #4
0
static void
virgl_drm_winsys_destroy(struct virgl_winsys *qws)
{
   struct virgl_drm_winsys *qdws = virgl_drm_winsys(qws);

   virgl_cache_flush(qdws);

   util_hash_table_destroy(qdws->bo_handles);
   util_hash_table_destroy(qdws->bo_names);
   pipe_mutex_destroy(qdws->bo_handles_mutex);
   pipe_mutex_destroy(qdws->mutex);

   FREE(qdws);
}
Example #5
0
static void
svga_destroy_screen( struct pipe_screen *screen )
{
   struct svga_screen *svgascreen = svga_screen(screen);
   
   svga_screen_cache_cleanup(svgascreen);

   pipe_mutex_destroy(svgascreen->swc_mutex);
   pipe_mutex_destroy(svgascreen->tex_mutex);

   svgascreen->sws->destroy(svgascreen->sws);
   
   FREE(svgascreen);
}
static void radeon_winsys_destroy(struct radeon_winsys *rws)
{
    struct radeon_drm_winsys *ws = (struct radeon_drm_winsys*)rws;

    pipe_mutex_destroy(ws->hyperz_owner_mutex);
    pipe_mutex_destroy(ws->cmask_owner_mutex);

    ws->cman->destroy(ws->cman);
    ws->kman->destroy(ws->kman);
    if (ws->gen >= R600) {
        radeon_surface_manager_free(ws->surf_man);
    }
    FREE(rws);
}
Example #7
0
void
stw_cleanup(void)
{
   DHGLRC dhglrc;

   debug_printf("%s\n", __FUNCTION__);

   if (!stw_dev)
      return;
   
   /*
    * Abort cleanup if there are still active contexts. In some situations
    * this DLL may be unloaded before the DLL that is using GL contexts is.
    */
   pipe_mutex_lock( stw_dev->ctx_mutex );
   dhglrc = handle_table_get_first_handle(stw_dev->ctx_table);
   pipe_mutex_unlock( stw_dev->ctx_mutex );
   if (dhglrc) {
      debug_printf("%s: contexts still active -- cleanup aborted\n", __FUNCTION__);
      stw_dev = NULL;
      return;
   }

   handle_table_destroy(stw_dev->ctx_table);

   stw_framebuffer_cleanup();
   
   pipe_mutex_destroy( stw_dev->fb_mutex );
   pipe_mutex_destroy( stw_dev->ctx_mutex );
   
   FREE(stw_dev->smapi);
   stw_dev->stapi->destroy(stw_dev->stapi);

   stw_dev->screen->destroy(stw_dev->screen);

   /* glapi is statically linked: we can call the local destroy function. */
#ifdef _GLAPI_NO_EXPORTS
   _glapi_destroy_multithread();
#endif

#ifdef DEBUG
   debug_memory_end(stw_dev->memdbg_no);
#endif

   stw_tls_cleanup();

   stw_dev = NULL;
}
Example #8
0
static void etna_screen_destroy( struct pipe_screen *screen )
{
    struct etna_screen *priv = etna_screen(screen);
    etna_screen_destroy_fences(screen);
    pipe_mutex_destroy(priv->fence_mutex);
    FREE(screen);
}
Example #9
0
void
vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst,
                                  struct vmw_svga_winsys_surface *src)
{
    struct pipe_reference *src_ref;
    struct pipe_reference *dst_ref;
    struct vmw_svga_winsys_surface *dst;

    if(pdst == NULL || *pdst == src)
        return;

    dst = *pdst;

    src_ref = src ? &src->refcnt : NULL;
    dst_ref = dst ? &dst->refcnt : NULL;

    if (pipe_reference(dst_ref, src_ref)) {
        if (dst->buf)
            vmw_svga_winsys_buffer_destroy(&dst->screen->base, dst->buf);
        vmw_ioctl_surface_destroy(dst->screen, dst->sid);
#ifdef DEBUG
        /* to detect dangling pointers */
        assert(p_atomic_read(&dst->validated) == 0);
        dst->sid = SVGA3D_INVALID_ID;
#endif
        pipe_mutex_destroy(dst->mutex);
        FREE(dst);
    }

    *pdst = src;
}
Example #10
0
static void
fenced_bufmgr_destroy(struct pb_manager *mgr)
{
   struct fenced_manager *fenced_mgr = fenced_manager(mgr);

   pipe_mutex_lock(fenced_mgr->mutex);

   /* Wait on outstanding fences */
   while (fenced_mgr->num_fenced) {
      pipe_mutex_unlock(fenced_mgr->mutex);
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
      sched_yield();
#endif
      pipe_mutex_lock(fenced_mgr->mutex);
      while(fenced_manager_check_signalled_locked(fenced_mgr, TRUE))
         ;
   }

#ifdef DEBUG
   /*assert(!fenced_mgr->num_unfenced);*/
#endif

   pipe_mutex_unlock(fenced_mgr->mutex);
   pipe_mutex_destroy(fenced_mgr->mutex);

   if(fenced_mgr->provider)
      fenced_mgr->provider->destroy(fenced_mgr->provider);

   fenced_mgr->ops->destroy(fenced_mgr->ops);

   FREE(fenced_mgr);
}
void util_ringbuffer_destroy( struct util_ringbuffer *ring )
{
   pipe_condvar_destroy(ring->change);
   pipe_mutex_destroy(ring->mutex);
   FREE(ring->buf);
   FREE(ring);
}
Example #12
0
static void radeon_bomgr_destroy(struct pb_manager *_mgr)
{
    struct radeon_bomgr *mgr = radeon_bomgr(_mgr);
    util_hash_table_destroy(mgr->bo_handles);
    pipe_mutex_destroy(mgr->bo_handles_mutex);
    FREE(mgr);
}
Example #13
0
static void si_destroy_screen(struct pipe_screen* pscreen)
{
	struct si_screen *sscreen = (struct si_screen *)pscreen;
	struct si_shader_part *parts[] = {
		sscreen->vs_prologs,
		sscreen->vs_epilogs,
		sscreen->tcs_epilogs,
		sscreen->ps_prologs,
		sscreen->ps_epilogs
	};
	unsigned i;

	if (!sscreen)
		return;

	if (!sscreen->b.ws->unref(sscreen->b.ws))
		return;

	/* Free shader parts. */
	for (i = 0; i < ARRAY_SIZE(parts); i++) {
		while (parts[i]) {
			struct si_shader_part *part = parts[i];

			parts[i] = part->next;
			radeon_shader_binary_clean(&part->binary);
			FREE(part);
		}
	}
	pipe_mutex_destroy(sscreen->shader_parts_mutex);
	si_destroy_shader_cache(sscreen);
	r600_destroy_common_screen(&sscreen->b);
}
Example #14
0
/**
 * Destroy this framebuffer. Both stw_dev::fb_mutex and stw_framebuffer::mutex
 * must be held, by this order.  If there are still references to the
 * framebuffer, nothing will happen.
 */
static INLINE void
stw_framebuffer_destroy_locked(
   struct stw_framebuffer *fb )
{
   struct stw_framebuffer **link;

   /* check the reference count */
   fb->refcnt--;
   if (fb->refcnt) {
      pipe_mutex_unlock( fb->mutex );
      return;
   }

   link = &stw_dev->fb_head;
   while (*link != fb)
      link = &(*link)->next;
   assert(*link);
   *link = fb->next;
   fb->next = NULL;

   if(fb->shared_surface)
      stw_dev->stw_winsys->shared_surface_close(stw_dev->screen, fb->shared_surface);

   stw_st_destroy_framebuffer_locked(fb->stfb);
   
   ReleaseDC(fb->hWnd, fb->hDC);

   pipe_mutex_unlock( fb->mutex );

   pipe_mutex_destroy( fb->mutex );
   
   FREE( fb );
}
Example #15
0
/**
 * Free all data associated with the given scene, and the scene itself.
 */
void
lp_scene_destroy(struct lp_scene *scene)
{
   pipe_mutex_destroy(scene->mutex);
   assert(scene->data.head->next == NULL);
   FREE(scene->data.head);
   FREE(scene);
}
Example #16
0
/**
 * Free all data associated with the given scene, and the scene itself.
 */
void
lp_scene_destroy(struct lp_scene *scene)
{
   lp_fence_reference(&scene->fence, NULL);
   pipe_mutex_destroy(scene->mutex);
   assert(scene->data.head->next == NULL);
   FREE(scene->data.head);
   FREE(scene);
}
Example #17
0
/** Destroy a fence.  Called when refcount hits zero. */
void
lp_fence_destroy(struct lp_fence *fence)
{
   if (LP_DEBUG & DEBUG_FENCE)
      debug_printf("%s %d\n", __FUNCTION__, fence->id);

   pipe_mutex_destroy(fence->mutex);
   pipe_condvar_destroy(fence->signalled);
   FREE(fence);
}
Example #18
0
static void
virgl_vtest_winsys_destroy(struct virgl_winsys *vws)
{
   struct virgl_vtest_winsys *vtws = virgl_vtest_winsys(vws);

   virgl_cache_flush(vtws);

   pipe_mutex_destroy(vtws->mutex);
   FREE(vtws);
}
Example #19
0
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);
}
Example #20
0
void
stw_cleanup(void)
{
   unsigned i;

   debug_printf("%s\n", __FUNCTION__);

   if (!stw_dev)
      return;
   
   pipe_mutex_lock( stw_dev->ctx_mutex );
   {
      /* Ensure all contexts are destroyed */
      i = handle_table_get_first_handle(stw_dev->ctx_table);
      while (i) {
         stw_delete_context(i);
         i = handle_table_get_next_handle(stw_dev->ctx_table, i);
      }
      handle_table_destroy(stw_dev->ctx_table);
   }
   pipe_mutex_unlock( stw_dev->ctx_mutex );

   stw_framebuffer_cleanup();
   
   pipe_mutex_destroy( stw_dev->fb_mutex );
   pipe_mutex_destroy( stw_dev->ctx_mutex );
   
   stw_dev->screen->destroy(stw_dev->screen);

#ifdef WIN32_THREADS
   _glthread_DESTROY_MUTEX(OneTimeLock);
   FreeAllTSD();
#endif

#ifdef DEBUG
   debug_memory_end(stw_dev->memdbg_no);
#endif

   stw_tls_cleanup();

   stw_dev = NULL;
}
static void r300_destroy_screen(struct pipe_screen* pscreen)
{
    struct r300_screen* r300screen = r300_screen(pscreen);
    struct radeon_winsys *rws = radeon_winsys(pscreen);

    pipe_mutex_destroy(r300screen->cmask_mutex);

    if (rws)
      rws->destroy(rws);

    FREE(r300screen);
}
Example #22
0
void
dri_destroy_screen_helper(struct dri_screen * screen)
{
   if (screen->st_api && screen->st_api->destroy)
      screen->st_api->destroy(screen->st_api);

   if (screen->base.screen)
      screen->base.screen->destroy(screen->base.screen);

   dri_destroy_option_cache(screen);
   pipe_mutex_destroy(screen->opencl_func_mutex);
}
Example #23
0
void r600_destroy_common_screen(struct r600_common_screen *rscreen)
{
    pipe_mutex_destroy(rscreen->aux_context_lock);
    rscreen->aux_context->destroy(rscreen->aux_context);

    if (rscreen->trace_bo) {
        rscreen->ws->buffer_unmap(rscreen->trace_bo->cs_buf);
        pipe_resource_reference((struct pipe_resource**)&rscreen->trace_bo, NULL);
    }

    rscreen->ws->destroy(rscreen->ws);
    FREE(rscreen);
}
Example #24
0
void
intel_winsys_destroy(struct intel_winsys *winsys)
{
   if (winsys->decode)
      drm_intel_decode_context_free(winsys->decode);

   if (winsys->first_gem_ctx)
      drm_intel_gem_context_destroy(winsys->first_gem_ctx);

   pipe_mutex_destroy(winsys->mutex);
   drm_intel_bufmgr_destroy(winsys->bufmgr);
   FREE(winsys);
}
Example #25
0
static void r300_destroy_screen(struct pipe_screen* pscreen)
{
    struct r300_screen* r300screen = r300_screen(pscreen);
    struct radeon_winsys *rws = radeon_winsys(pscreen);

    util_slab_destroy(&r300screen->pool_buffers);
    pipe_mutex_destroy(r300screen->num_contexts_mutex);

    if (rws)
      rws->destroy(rws);

    FREE(r300screen);
}
GalliumContext::~GalliumContext()
{
	CALLED();

	// Destroy our contexts
	Lock();
	for (context_id i = 0; i < CONTEXT_MAX; i++)
		DestroyContext(i);
	Unlock();

	pipe_mutex_destroy(fMutex);

	// TODO: Destroy fScreen
}
Example #27
0
static void r300_destroy_screen(struct pipe_screen* pscreen)
{
    struct r300_screen* r300screen = r300_screen(pscreen);
    struct radeon_winsys *rws = radeon_winsys(pscreen);

    if (rws && !rws->unref(rws))
      return;

    pipe_mutex_destroy(r300screen->cmask_mutex);
    slab_destroy_parent(&r300screen->pool_transfers);

    if (rws)
      rws->destroy(rws);

    FREE(r300screen);
}
Example #28
0
static void
pb_debug_manager_destroy(struct pb_manager *_mgr)
{
   struct pb_debug_manager *mgr = pb_debug_manager(_mgr);
   
   pipe_mutex_lock(mgr->mutex);
   if(!LIST_IS_EMPTY(&mgr->list)) {
      debug_printf("%s: unfreed buffers\n", __FUNCTION__);
      pb_debug_manager_dump(mgr);
   }
   pipe_mutex_unlock(mgr->mutex);
   
   pipe_mutex_destroy(mgr->mutex);
   mgr->provider->destroy(mgr->provider);
   FREE(mgr);
}
Example #29
0
static void
llvmpipe_destroy_screen( struct pipe_screen *_screen )
{
   struct llvmpipe_screen *screen = llvmpipe_screen(_screen);
   struct sw_winsys *winsys = screen->winsys;

   if (screen->rast)
      lp_rast_destroy(screen->rast);

   lp_jit_screen_cleanup(screen);

   if(winsys->destroy)
      winsys->destroy(winsys);

   pipe_mutex_destroy(screen->rast_mutex);

   FREE(screen);
}
Example #30
0
static void
pb_debug_buffer_destroy(struct pb_buffer *_buf)
{
   struct pb_debug_buffer *buf = pb_debug_buffer(_buf);
   struct pb_debug_manager *mgr = buf->mgr;
   
   assert(!pipe_is_referenced(&buf->base.base.reference));
   
   pb_debug_buffer_check(buf);

   pipe_mutex_lock(mgr->mutex);
   LIST_DEL(&buf->head);
   pipe_mutex_unlock(mgr->mutex);

   pipe_mutex_destroy(buf->mutex);
   
   pb_reference(&buf->buffer, NULL);
   FREE(buf);
}