summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2018-10-25 15:33:00 -0400
committerMarek Olšák <[email protected]>2018-10-30 16:03:02 -0400
commit8ad12c8bec4bd20ea4241e412b477a155a42186b (patch)
tree4155600e79320d788e4f1df43e2b9230b5f67684 /src/gallium/state_trackers
parent00fc56a68d21d7aa91b95f0eaacba59a96c466f5 (diff)
gallium: rework PIPE_HANDLE_USAGE_* flags
Only radeonsi uses them, so adjust them to match its needs.
Diffstat (limited to 'src/gallium/state_trackers')
-rw-r--r--src/gallium/state_trackers/dri/dri2.c18
-rw-r--r--src/gallium/state_trackers/dri/drisw.c2
-rw-r--r--src/gallium/state_trackers/nine/swapchain9.c5
-rw-r--r--src/gallium/state_trackers/va/buffer.c2
-rw-r--r--src/gallium/state_trackers/va/surface.c6
-rw-r--r--src/gallium/state_trackers/vdpau/output.c2
-rw-r--r--src/gallium/state_trackers/vdpau/surface.c2
-rw-r--r--src/gallium/state_trackers/xa/xa_tracker.c4
8 files changed, 18 insertions, 23 deletions
diff --git a/src/gallium/state_trackers/dri/dri2.c b/src/gallium/state_trackers/dri/dri2.c
index 2fb3e592844..a09787bb215 100644
--- a/src/gallium/state_trackers/dri/dri2.c
+++ b/src/gallium/state_trackers/dri/dri2.c
@@ -651,7 +651,7 @@ dri2_allocate_buffer(__DRIscreen *sPriv,
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;
@@ -839,7 +839,7 @@ dri2_allocate_textures(struct dri_context *ctx,
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]);
}
}
@@ -1067,7 +1067,7 @@ dri2_create_image_from_winsys(__DRIscreen *_screen,
}
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);
@@ -1287,9 +1287,9 @@ dri2_query_image(__DRIimage *image, int attrib, int *value)
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));
@@ -1966,14 +1966,12 @@ dri2_interop_export_object(__DRIcontext *_ctx,
/* 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;
diff --git a/src/gallium/state_trackers/dri/drisw.c b/src/gallium/state_trackers/dri/drisw.c
index 1fba71bdd97..886f94dc02c 100644
--- a/src/gallium/state_trackers/dri/drisw.c
+++ b/src/gallium/state_trackers/dri/drisw.c
@@ -129,7 +129,7 @@ get_image_shm(__DRIdrawable *dPriv, int x, int y, int width, int height,
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);
diff --git a/src/gallium/state_trackers/nine/swapchain9.c b/src/gallium/state_trackers/nine/swapchain9.c
index cd77081e915..0958a907013 100644
--- a/src/gallium/state_trackers/nine/swapchain9.c
+++ b/src/gallium/state_trackers/nine/swapchain9.c
@@ -100,9 +100,8 @@ D3DWindowBuffer_create(struct NineSwapChain9 *This,
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;
diff --git a/src/gallium/state_trackers/va/buffer.c b/src/gallium/state_trackers/va/buffer.c
index 42ec9730fc1..0691b7023b2 100644
--- a/src/gallium/state_trackers/va/buffer.c
+++ b/src/gallium/state_trackers/va/buffer.c
@@ -309,7 +309,7 @@ vlVaAcquireBufferHandle(VADriverContextP ctx, VABufferID buf_id,
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;
}
diff --git a/src/gallium/state_trackers/va/surface.c b/src/gallium/state_trackers/va/surface.c
index cc26efe1c1a..5376be28531 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -583,7 +583,7 @@ surface_from_external_memory(VADriverContextP ctx, vlVaSurface *surface,
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;
@@ -1000,10 +1000,8 @@ vlVaExportSurfaceHandle(VADriverContextP ctx,
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;
diff --git a/src/gallium/state_trackers/vdpau/output.c b/src/gallium/state_trackers/vdpau/output.c
index 878a3546727..1f873daa814 100644
--- a/src/gallium/state_trackers/vdpau/output.c
+++ b/src/gallium/state_trackers/vdpau/output.c
@@ -811,7 +811,7 @@ VdpStatus vlVdpOutputSurfaceDMABuf(VdpOutputSurface surface,
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;
}
diff --git a/src/gallium/state_trackers/vdpau/surface.c b/src/gallium/state_trackers/vdpau/surface.c
index 95bab8790db..e9d55a282e2 100644
--- a/src/gallium/state_trackers/vdpau/surface.c
+++ b/src/gallium/state_trackers/vdpau/surface.c
@@ -532,7 +532,7 @@ VdpStatus vlVdpVideoSurfaceDMABuf(VdpVideoSurface surface,
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;
}
diff --git a/src/gallium/state_trackers/xa/xa_tracker.c b/src/gallium/state_trackers/xa/xa_tracker.c
index d07cd146af9..5ac98f8eed0 100644
--- a/src/gallium/state_trackers/xa/xa_tracker.c
+++ b/src/gallium/state_trackers/xa/xa_tracker.c
@@ -358,7 +358,7 @@ surface_create(struct xa_tracker *xa,
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)
@@ -546,7 +546,7 @@ xa_surface_handle(struct xa_surface *srf,
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;