コード例 #1
0
ファイル: virgl_drm_winsys.c プロジェクト: grate-driver/mesa
static void virgl_hw_res_destroy(struct virgl_drm_winsys *qdws,
                                 struct virgl_hw_res *res)
{
      struct drm_gem_close args;

      if (res->flinked) {
         mtx_lock(&qdws->bo_handles_mutex);
         util_hash_table_remove(qdws->bo_names,
                                (void *)(uintptr_t)res->flink);
         mtx_unlock(&qdws->bo_handles_mutex);
      }

      if (res->bo_handle) {
         mtx_lock(&qdws->bo_handles_mutex);
         util_hash_table_remove(qdws->bo_handles,
                                (void *)(uintptr_t)res->bo_handle);
         mtx_unlock(&qdws->bo_handles_mutex);
      }

      if (res->ptr)
         os_munmap(res->ptr, res->size);

      memset(&args, 0, sizeof(args));
      args.handle = res->bo_handle;
      drmIoctl(qdws->fd, DRM_IOCTL_GEM_CLOSE, &args);
      FREE(res);
}
static void
openchrome_bo_unmap(struct pb_buffer *buf)
{
	struct openchrome_bo *bo = (struct openchrome_bo *) buf;

	if (bo->ptr)
		os_munmap(bo->ptr, bo->base.size);
}
コード例 #3
0
ファイル: vmw_screen_ioctl.c プロジェクト: dumbbell/mesa
void
vmw_ioctl_region_destroy(struct vmw_region *region)
{
   struct drm_vmw_unref_dmabuf_arg arg;

   vmw_printf("%s: gmrId = %u, offset = %u\n", __FUNCTION__,
              region->ptr.gmrId, region->ptr.offset);

   if (region->data) {
      os_munmap(region->data, region->size);
      region->data = NULL;
   }

   memset(&arg, 0, sizeof(arg));
   arg.handle = region->handle;
   drmCommandWrite(region->drm_fd, DRM_VMW_UNREF_DMABUF, &arg, sizeof(arg));

   FREE(region);
}