virgl: add virgl_renderer_resource_export_blob

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
macos/master
Chia-I Wu 4 years ago
parent d257fbf7f2
commit 69a985dcca
  1. 21
      src/virglrenderer.c
  2. 6
      src/virglrenderer.h

@ -751,3 +751,24 @@ int virgl_renderer_resource_get_map_info(uint32_t res_handle, uint32_t *map_info
return vrend_renderer_resource_get_map_info(res->pipe_resource, map_info);
}
int
virgl_renderer_resource_export_blob(uint32_t res_id, uint32_t *fd_type, int *fd)
{
struct virgl_resource *res = virgl_resource_lookup(res_id);
if (!res)
return EINVAL;
switch (virgl_resource_export_fd(res, fd)) {
case VIRGL_RESOURCE_FD_DMABUF:
*fd_type = VIRGL_RENDERER_BLOB_FD_TYPE_DMABUF;
break;
case VIRGL_RESOURCE_FD_OPAQUE:
*fd_type = VIRGL_RENDERER_BLOB_FD_TYPE_OPAQUE;
break;
default:
return EINVAL;
}
return 0;
}

@ -291,6 +291,12 @@ VIRGL_EXPORT int virgl_renderer_resource_unmap(uint32_t res_handle);
VIRGL_EXPORT int virgl_renderer_resource_get_map_info(uint32_t res_handle, uint32_t *map_info);
#define VIRGL_RENDERER_BLOB_FD_TYPE_DMABUF 0x0001
#define VIRGL_RENDERER_BLOB_FD_TYPE_OPAQUE 0x0002
VIRGL_EXPORT int
virgl_renderer_resource_export_blob(uint32_t res_id, uint32_t *fd_type, int *fd);
#endif /* VIRGL_RENDERER_UNSTABLE_APIS */
#endif

Loading…
Cancel
Save