iris: Disable aux as needed in iris_flush_resource

Disable compression in iris_flush_resource if the resource lacks a
modifier. When a caller wants to prepare such a resource for sharing
(via eglCreateImage for example), this change enables all reference
holders to access the resource in a common manner - without compression.

This fixes misrendering with 3D-accelerated qemu. A piglit test which
reproduces qemu's behavior, ext_image_dma_buf_import-export-tex, is also
enabled to pass.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2678
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8663>
(cherry picked from commit 40d6b92de9)
This commit is contained in:
Nanley Chery 2021-01-13 14:34:13 -08:00 committed by Dylan Baker
parent 587d1f75fb
commit 87d20549c8
2 changed files with 15 additions and 1 deletions

View file

@ -346,7 +346,7 @@
"description": "iris: Disable aux as needed in iris_flush_resource",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"master_sha": null,
"because_sha": null
},

View file

@ -1165,6 +1165,20 @@ iris_flush_resource(struct pipe_context *ctx, struct pipe_resource *resource)
0, INTEL_REMAINING_LAYERS,
mod ? mod->aux_usage : ISL_AUX_USAGE_NONE,
mod ? mod->supports_clear_color : false);
if (!res->mod_info && res->aux.usage != ISL_AUX_USAGE_NONE) {
/* flush_resource may be used to prepare an image for sharing external
* to the driver (e.g. via eglCreateImage). To account for this, make
* sure to get rid of any compression that a consumer wouldn't know how
* to handle.
*/
for (int i = 0; i < IRIS_BATCH_COUNT; i++) {
if (iris_batch_references(&ice->batches[i], res->bo))
iris_batch_flush(&ice->batches[i]);
}
iris_resource_disable_aux(res);
}
}
static void