summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2019-04-23 20:19:37 -0700
committerKenneth Graunke <kenneth@whitecape.org>2019-08-22 18:31:17 -0700
commit136629a1e3aace12297ff61c2ee32caa21aba99b (patch)
tree2a8e4d20aa9a272127f0361b2511a4d8d634d498
parent1cd13ccee7bc2733e7a56284dc02bdb1b1c40081 (diff)
iris: Drop copy format hacks from copy region based transfer path.
This doesn't work for compressed formats, as the source texture and temporary texture would have different block sizes. (Forcing the driver to always take the GPU path would expose the bug.) Instead, just use the source format for the temporary, and let blorp_copy deal with overrides. The one case where we can't do this is ASTC, because isl won't let us create a linear ASTC surface. Fall back to the CPU paths there for now. Fixes: 9d1334d2a0f ("iris: Use copy_region and staging resources to avoid transfer stalls") Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
-rw-r--r--src/gallium/drivers/iris/iris_resource.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index eb2430ecf4e0..cc19e601a75a 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -1247,6 +1247,7 @@ iris_map_copy_region(struct iris_transfer *map)
.nr_samples = xfer->resource->nr_samples,
.nr_storage_samples = xfer->resource->nr_storage_samples,
.array_size = box->depth,
+ .format = res->internal_format,
};
if (xfer->resource->target == PIPE_BUFFER)
@@ -1256,22 +1257,6 @@ iris_map_copy_region(struct iris_transfer *map)
else
templ.target = PIPE_TEXTURE_2D;
- /* Depth, stencil, and ASTC can't be linear surfaces, so we can't use
- * xfer->resource->format directly. Pick a bpb compatible format so
- * resource creation will succeed; blorp_copy will override it anyway.
- */
- switch (util_format_get_blocksizebits(res->internal_format)) {
- case 8: templ.format = PIPE_FORMAT_R8_UINT; break;
- case 16: templ.format = PIPE_FORMAT_R8G8_UINT; break;
- case 24: templ.format = PIPE_FORMAT_R8G8B8_UINT; break;
- case 32: templ.format = PIPE_FORMAT_R8G8B8A8_UINT; break;
- case 48: templ.format = PIPE_FORMAT_R16G16B16_UINT; break;
- case 64: templ.format = PIPE_FORMAT_R16G16B16A16_UINT; break;
- case 96: templ.format = PIPE_FORMAT_R32G32B32_UINT; break;
- case 128: templ.format = PIPE_FORMAT_R32G32B32A32_UINT; break;
- default: unreachable("Invalid bpb");
- }
-
map->staging = iris_resource_create(pscreen, &templ);
assert(map->staging);
@@ -1790,6 +1775,10 @@ iris_transfer_map(struct pipe_context *ctx,
no_gpu = true;
}
+ const struct isl_format_layout *fmtl = isl_format_get_layout(surf->format);
+ if (fmtl->txc == ISL_TXC_ASTC)
+ no_gpu = true;
+
if ((map_would_stall || res->aux.usage == ISL_AUX_USAGE_CCS_E) && !no_gpu) {
/* If we need a synchronous mapping and the resource is busy,
* we copy to/from a linear temporary buffer using the GPU.