}
boolean u_resource_get_handle_vtbl(struct pipe_screen *screen,
+ struct pipe_context *ctx,
struct pipe_resource *resource,
struct winsys_handle *handle,
unsigned usage)
boolean u_resource_get_handle_vtbl(struct pipe_screen *screen,
+ struct pipe_context *ctx,
struct pipe_resource *resource,
struct winsys_handle *handle,
unsigned usage);
memset(&whandle, 0, sizeof(whandle));
whandle.type= DRM_API_HANDLE_TYPE_FD;
usage = PIPE_HANDLE_USAGE_EXPLICIT_FLUSH | PIPE_HANDLE_USAGE_READ;
- scrn->base.pscreen->resource_get_handle(scrn->base.pscreen,
+ scrn->base.pscreen->resource_get_handle(scrn->base.pscreen, NULL,
buffer->texture, &whandle,
usage);
buffer_fd = whandle.handle;
static boolean
dd_screen_resource_get_handle(struct pipe_screen *_screen,
+ struct pipe_context *_pipe,
struct pipe_resource *resource,
struct winsys_handle *handle,
unsigned usage)
{
struct pipe_screen *screen = dd_screen(_screen)->screen;
+ struct pipe_context *pipe = dd_context(_pipe)->pipe;
- return screen->resource_get_handle(screen, resource, handle, usage);
+ return screen->resource_get_handle(screen, pipe, resource, handle, usage);
}
static boolean
ilo_resource_get_handle(struct pipe_screen *screen,
+ struct pipe_context *ctx,
struct pipe_resource *res,
struct winsys_handle *handle,
unsigned usage)
static boolean
llvmpipe_resource_get_handle(struct pipe_screen *screen,
+ struct pipe_context *ctx,
struct pipe_resource *pt,
struct winsys_handle *whandle,
unsigned usage)
}
static boolean noop_resource_get_handle(struct pipe_screen *screen,
+ struct pipe_context *ctx,
struct pipe_resource *resource,
struct winsys_handle *handle,
unsigned usage)
}
boolean r300_resource_get_handle(struct pipe_screen* screen,
+ struct pipe_context *ctx,
struct pipe_resource *texture,
struct winsys_handle *whandle,
unsigned usage)
struct r300_texture_format_state *out);
boolean r300_resource_get_handle(struct pipe_screen* screen,
+ struct pipe_context *ctx,
struct pipe_resource *texture,
struct winsys_handle *whandle,
unsigned usage);
}
static boolean r600_texture_get_handle(struct pipe_screen* screen,
+ struct pipe_context *ctx,
struct pipe_resource *resource,
struct winsys_handle *whandle,
unsigned usage)
static boolean
rbug_screen_resource_get_handle(struct pipe_screen *_screen,
+ struct pipe_context *_pipe,
struct pipe_resource *_resource,
struct winsys_handle *handle,
unsigned usage)
{
struct rbug_screen *rb_screen = rbug_screen(_screen);
+ struct rbug_context *rb_pipe = rbug_context(_pipe);
struct rbug_resource *rb_resource = rbug_resource(_resource);
struct pipe_screen *screen = rb_screen->screen;
struct pipe_resource *resource = rb_resource->resource;
- return screen->resource_get_handle(screen, resource, handle, usage);
+ return screen->resource_get_handle(screen, rb_pipe ? rb_pipe->pipe : NULL,
+ resource, handle, usage);
}
static boolean
softpipe_resource_get_handle(struct pipe_screen *screen,
+ struct pipe_context *ctx,
struct pipe_resource *pt,
struct winsys_handle *whandle,
unsigned usage)
static boolean
trace_screen_resource_get_handle(struct pipe_screen *_screen,
+ struct pipe_context *_pipe,
struct pipe_resource *_resource,
struct winsys_handle *handle,
unsigned usage)
{
struct trace_screen *tr_screen = trace_screen(_screen);
+ struct trace_context *tr_pipe = _pipe ? trace_context(_pipe) : NULL;
struct trace_resource *tr_resource = trace_resource(_resource);
struct pipe_screen *screen = tr_screen->screen;
struct pipe_resource *resource = tr_resource->resource;
/* TODO trace call */
- return screen->resource_get_handle(screen, resource, handle, usage);
+ return screen->resource_get_handle(screen, tr_pipe ? tr_pipe->pipe : NULL,
+ resource, handle, usage);
}
* that the texture is created with a special usage flag like
* DISPLAYTARGET or PRIMARY.
*
+ * The context parameter can optionally be used to flush the resource and
+ * the context to make sure the resource is coherent with whatever user
+ * will use it. Some drivers may also use the context to convert
+ * the resource into a format compatible for sharing. The use case is
+ * OpenGL-OpenCL interop. The context parameter is allowed to be NULL.
+ *
* NOTE: in the case of DRM_API_HANDLE_TYPE_FD handles, the caller
* takes ownership of the FD. (This is consistent with
* EGL_MESA_image_dma_buf_export)
* \param usage A combination of PIPE_HANDLE_USAGE_* flags.
*/
boolean (*resource_get_handle)(struct pipe_screen *,
+ struct pipe_context *context,
struct pipe_resource *tex,
struct winsys_handle *handle,
unsigned usage);
else
whandle.type = DRM_API_HANDLE_TYPE_KMS;
- screen->base.screen->resource_get_handle(screen->base.screen,
+ screen->base.screen->resource_get_handle(screen->base.screen, NULL,
buffer->resource, &whandle,
PIPE_HANDLE_USAGE_EXPLICIT_FLUSH | PIPE_HANDLE_USAGE_READ);
case __DRI_IMAGE_ATTRIB_STRIDE:
whandle.type = DRM_API_HANDLE_TYPE_KMS;
image->texture->screen->resource_get_handle(image->texture->screen,
- image->texture, &whandle, usage);
+ NULL, image->texture, &whandle, usage);
*value = whandle.stride;
return GL_TRUE;
case __DRI_IMAGE_ATTRIB_HANDLE:
whandle.type = DRM_API_HANDLE_TYPE_KMS;
image->texture->screen->resource_get_handle(image->texture->screen,
- image->texture, &whandle, usage);
+ NULL, image->texture, &whandle, usage);
*value = whandle.handle;
return GL_TRUE;
case __DRI_IMAGE_ATTRIB_NAME:
whandle.type = DRM_API_HANDLE_TYPE_SHARED;
image->texture->screen->resource_get_handle(image->texture->screen,
- image->texture, &whandle, usage);
+ NULL, image->texture, &whandle, usage);
*value = whandle.handle;
return GL_TRUE;
case __DRI_IMAGE_ATTRIB_FD:
whandle.type= DRM_API_HANDLE_TYPE_FD;
image->texture->screen->resource_get_handle(image->texture->screen,
- image->texture, &whandle, usage);
+ NULL, image->texture, &whandle, usage);
*value = whandle.handle;
return GL_TRUE;
case __DRI_IMAGE_ATTRIB_FORMAT:
memset(&whandle, 0, sizeof(whandle));
whandle.type = DRM_API_HANDLE_TYPE_FD;
- success = screen->resource_get_handle(screen, res, &whandle, usage);
+ success = screen->resource_get_handle(screen, st->pipe, res, &whandle,
+ usage);
mtx_unlock(&ctx->Shared->Mutex);
if (!success)
memset(&whandle, 0, sizeof(whandle));
whandle.type = DRM_API_HANDLE_TYPE_FD;
- This->screen->resource_get_handle(This->screen, resource, &whandle,
+ This->screen->resource_get_handle(This->screen, This->pipe, resource,
+ &whandle,
for_frontbuffer_reading ?
PIPE_HANDLE_USAGE_WRITE :
PIPE_HANDLE_USAGE_EXPLICIT_FLUSH |
memset(&whandle, 0, sizeof(whandle));
whandle.type = DRM_API_HANDLE_TYPE_FD;
- if (!screen->resource_get_handle(screen, buf->derived_surface.resource,
+ if (!screen->resource_get_handle(screen, drv->pipe,
+ buf->derived_surface.resource,
&whandle, PIPE_HANDLE_USAGE_READ_WRITE))
return VA_STATUS_ERROR_INVALID_BUFFER;
whandle.type = DRM_API_HANDLE_TYPE_FD;
pscreen = vlsurface->surface->texture->screen;
- if (!pscreen->resource_get_handle(pscreen, vlsurface->surface->texture, &whandle,
+ if (!pscreen->resource_get_handle(pscreen, vlsurface->device->context,
+ vlsurface->surface->texture, &whandle,
PIPE_HANDLE_USAGE_READ_WRITE))
return VDP_STATUS_NO_IMPLEMENTATION;
whandle.layer = surf->u.tex.first_layer;
pscreen = surf->texture->screen;
- if (!pscreen->resource_get_handle(pscreen, surf->texture, &whandle,
+ if (!pscreen->resource_get_handle(pscreen, p_surf->device->context,
+ surf->texture, &whandle,
PIPE_HANDLE_USAGE_READ_WRITE))
return VDP_STATUS_NO_IMPLEMENTATION;
memset(&whandle, 0, sizeof(whandle));
whandle.type = handle_type(type);
- res = screen->resource_get_handle(screen, srf->tex, &whandle,
+ res = screen->resource_get_handle(screen, srf->xa->default_ctx->pipe,
+ srf->tex, &whandle,
PIPE_HANDLE_USAGE_READ_WRITE);
if (!res)
return -XA_ERR_INVAL;
struct wrapper_sw_displaytarget *wdt = wrapper_sw_displaytarget(dt);
struct pipe_resource *tex = wdt->tex;
- return wsw->screen->resource_get_handle(wsw->screen, tex, whandle,
+ return wsw->screen->resource_get_handle(wsw->screen, NULL, tex, whandle,
PIPE_HANDLE_USAGE_READ_WRITE);
}