Only radeonsi uses them, so adjust them to match its needs.
return NULL;
status = screen->resource_get_handle(screen, NULL, rsc, &handle,
- PIPE_HANDLE_USAGE_READ_WRITE);
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
if (!status)
goto free_scanout;
tex = scrn->base.pscreen->resource_from_handle(scrn->base.pscreen, &templ,
&dri2_handle,
- PIPE_HANDLE_USAGE_READ_WRITE);
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
free(reply);
return tex;
}
memset(&whandle, 0, sizeof(whandle));
whandle.type= WINSYS_HANDLE_TYPE_FD;
- usage = PIPE_HANDLE_USAGE_EXPLICIT_FLUSH | PIPE_HANDLE_USAGE_READ;
+ usage = PIPE_HANDLE_USAGE_EXPLICIT_FLUSH;
scrn->base.pscreen->resource_get_handle(scrn->base.pscreen, NULL,
pixmap_buffer_texture, &whandle,
usage);
scrn->front_buffer->texture =
scrn->base.pscreen->resource_from_handle(scrn->base.pscreen,
&templ, &whandle,
- PIPE_HANDLE_USAGE_READ_WRITE);
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
close(fds[0]);
if (!scrn->front_buffer->texture)
goto free_reply;
handle.modifier = modifier;
rsc = etna_resource(pscreen->resource_from_handle(pscreen, templat,
&handle,
- PIPE_HANDLE_USAGE_WRITE));
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE));
close(handle.handle);
if (!rsc)
return NULL;
pb_reference(&buf, memobj->buf);
rtex->resource.b.is_shared = true;
- rtex->resource.external_usage = PIPE_HANDLE_USAGE_READ_WRITE;
+ rtex->resource.external_usage = PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE;
if (rscreen->apply_opaque_metadata)
rscreen->apply_opaque_metadata(rscreen, rtex, &metadata);
/* We can't disable DCC if it can be written by another process. */
return tex->dcc_offset &&
(!tex->buffer.b.is_shared ||
- !(tex->buffer.external_usage & PIPE_HANDLE_USAGE_WRITE));
+ !(tex->buffer.external_usage & PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE));
}
static bool si_texture_discard_dcc(struct si_screen *sscreen,
* disable it for external clients that want write
* access.
*/
- if (usage & PIPE_HANDLE_USAGE_WRITE && tex->dcc_offset) {
+ if (usage & PIPE_HANDLE_USAGE_SHADER_WRITE && tex->dcc_offset) {
if (si_texture_disable_dcc(sctx, tex)) {
update_metadata = true;
/* si_texture_disable_dcc flushes the context */
struct pipe_resource *tex =
si_texture_from_winsys_buffer(sscreen, templ, memobj->buf,
memobj->stride, offset,
- PIPE_HANDLE_USAGE_READ_WRITE,
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE |
+ PIPE_HANDLE_USAGE_SHADER_WRITE,
memobj->b.dedicated);
if (!tex)
return NULL;
static int tegra_screen_import_resource(struct tegra_screen *screen,
struct tegra_resource *resource)
{
- unsigned usage = PIPE_HANDLE_USAGE_READ;
struct winsys_handle handle;
boolean status;
int fd, err;
handle.type = WINSYS_HANDLE_TYPE_FD;
status = screen->gpu->resource_get_handle(screen->gpu, NULL, resource->gpu,
- &handle, usage);
+ &handle, 0);
if (!status)
return -EINVAL;
* resource_get_handle flags.
*/
/* Requires pipe_context::flush_resource before external use. */
-#define PIPE_HANDLE_USAGE_EXPLICIT_FLUSH (1 << 0)
+#define PIPE_HANDLE_USAGE_EXPLICIT_FLUSH (1 << 0)
/* Expected external use of the resource: */
-#define PIPE_HANDLE_USAGE_READ (1 << 1)
-#define PIPE_HANDLE_USAGE_WRITE (1 << 2)
-#define PIPE_HANDLE_USAGE_READ_WRITE (PIPE_HANDLE_USAGE_READ | \
- PIPE_HANDLE_USAGE_WRITE)
+#define PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE (1 << 1)
+#define PIPE_HANDLE_USAGE_SHADER_WRITE (1 << 2)
/**
* pipe_image_view access flags.
screen->base.screen->resource_get_handle(screen->base.screen, NULL,
buffer->resource, &whandle,
- PIPE_HANDLE_USAGE_EXPLICIT_FLUSH | PIPE_HANDLE_USAGE_READ);
+ PIPE_HANDLE_USAGE_EXPLICIT_FLUSH);
buffer->base.attachment = attachment;
buffer->base.name = whandle.handle;
drawable->textures[statt] =
screen->base.screen->resource_from_handle(screen->base.screen,
&templ, &whandle,
- PIPE_HANDLE_USAGE_EXPLICIT_FLUSH | PIPE_HANDLE_USAGE_READ);
+ PIPE_HANDLE_USAGE_EXPLICIT_FLUSH);
assert(drawable->textures[statt]);
}
}
}
tex = pscreen->resource_from_handle(pscreen,
- &templ, &whandle[i], PIPE_HANDLE_USAGE_READ_WRITE);
+ &templ, &whandle[i], PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
if (!tex) {
pipe_resource_reference(&img->texture, NULL);
FREE(img);
unsigned usage;
if (image->use & __DRI_IMAGE_USE_BACKBUFFER)
- usage = PIPE_HANDLE_USAGE_EXPLICIT_FLUSH | PIPE_HANDLE_USAGE_READ;
+ usage = PIPE_HANDLE_USAGE_EXPLICIT_FLUSH;
else
- usage = PIPE_HANDLE_USAGE_READ_WRITE;
+ usage = PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE;
memset(&whandle, 0, sizeof(whandle));
/* Get the handle. */
switch (in->access) {
- case MESA_GLINTEROP_ACCESS_READ_WRITE:
- usage = PIPE_HANDLE_USAGE_READ_WRITE;
- break;
case MESA_GLINTEROP_ACCESS_READ_ONLY:
- usage = PIPE_HANDLE_USAGE_READ;
+ usage = 0;
break;
+ case MESA_GLINTEROP_ACCESS_READ_WRITE:
case MESA_GLINTEROP_ACCESS_WRITE_ONLY:
- usage = PIPE_HANDLE_USAGE_WRITE;
+ usage = PIPE_HANDLE_USAGE_SHADER_WRITE;
break;
default:
usage = 0;
if (loader->base.version < 4 || !loader->getImageShm)
return FALSE;
- if (!res->screen->resource_get_handle(res->screen, NULL, res, &whandle, PIPE_HANDLE_USAGE_WRITE))
+ if (!res->screen->resource_get_handle(res->screen, NULL, res, &whandle, PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE))
return FALSE;
loader->getImageShm(dPriv, x, y, width, height, whandle.handle, dPriv->loaderPrivate);
This->screen->resource_get_handle(This->screen, pipe, resource,
&whandle,
for_frontbuffer_reading ?
- PIPE_HANDLE_USAGE_WRITE :
- PIPE_HANDLE_USAGE_EXPLICIT_FLUSH |
- PIPE_HANDLE_USAGE_READ);
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE :
+ PIPE_HANDLE_USAGE_EXPLICIT_FLUSH);
nine_context_get_pipe_release(This->base.device);
stride = whandle.stride;
dmaBufFd = whandle.handle;
if (!screen->resource_get_handle(screen, drv->pipe,
buf->derived_surface.resource,
- &whandle, PIPE_HANDLE_USAGE_READ_WRITE)) {
+ &whandle, PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE)) {
mtx_unlock(&drv->mutex);
return VA_STATUS_ERROR_INVALID_BUFFER;
}
whandle.stride = memory_attribute->pitches[i];
whandle.offset = memory_attribute->offsets[i];
resources[i] = pscreen->resource_from_handle(pscreen, &res_templ, &whandle,
- PIPE_HANDLE_USAGE_READ_WRITE);
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
if (!resources[i]) {
result = VA_STATUS_ERROR_ALLOCATION_FAILED;
goto fail;
surfaces = surf->buffer->get_surfaces(surf->buffer);
usage = 0;
- if (flags & VA_EXPORT_SURFACE_READ_ONLY)
- usage |= PIPE_HANDLE_USAGE_READ;
if (flags & VA_EXPORT_SURFACE_WRITE_ONLY)
- usage |= PIPE_HANDLE_USAGE_WRITE;
+ usage |= PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE;
desc->fourcc = PipeFormatToVaFourcc(surf->buffer->buffer_format);
desc->width = surf->buffer->width;
pscreen = vlsurface->surface->texture->screen;
if (!pscreen->resource_get_handle(pscreen, vlsurface->device->context,
vlsurface->surface->texture, &whandle,
- PIPE_HANDLE_USAGE_READ_WRITE)) {
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE)) {
mtx_unlock(&vlsurface->device->mutex);
return VDP_STATUS_NO_IMPLEMENTATION;
}
pscreen = surf->texture->screen;
if (!pscreen->resource_get_handle(pscreen, p_surf->device->context,
surf->texture, &whandle,
- PIPE_HANDLE_USAGE_READ_WRITE)) {
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE)) {
mtx_unlock(&p_surf->device->mutex);
return VDP_STATUS_NO_IMPLEMENTATION;
}
if (whandle)
srf->tex = xa->screen->resource_from_handle(xa->screen, template, whandle,
- PIPE_HANDLE_USAGE_READ_WRITE);
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
else
srf->tex = xa->screen->resource_create(xa->screen, template);
if (!srf->tex)
whandle.type = handle_type(type);
res = screen->resource_get_handle(screen, srf->xa->default_ctx->pipe,
srf->tex, &whandle,
- PIPE_HANDLE_USAGE_READ_WRITE);
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
if (!res)
return -XA_ERR_INVAL;
struct pipe_resource *tex;
tex = wsw->screen->resource_from_handle(wsw->screen, templ, whandle,
- PIPE_HANDLE_USAGE_READ_WRITE);
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
if (!tex)
return NULL;
struct pipe_resource *tex = wdt->tex;
return wsw->screen->resource_get_handle(wsw->screen, NULL, tex, whandle,
- PIPE_HANDLE_USAGE_READ_WRITE);
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
}
static void *
whandle.stride = desc->stride;
res = st->pipe->screen->resource_from_handle(st->pipe->screen, &templ, &whandle,
- PIPE_HANDLE_USAGE_READ_WRITE);
+ PIPE_HANDLE_USAGE_FRAMEBUFFER_WRITE);
close(desc->handle);
return res;