summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanley Chery <nanley.g.chery@intel.com>2021-01-13 14:34:13 -0800
committerDylan Baker <dylan.c.baker@intel.com>2021-02-23 08:32:42 -0800
commit47049b920b1aa27690e1abd62e23a7c368e7c7c6 (patch)
treed1bc80296df04a0d05024a7ba1f021e9e2d7e70a
parent102bd9aa7cb0357aab147115ef11968277eb2f5f (diff)
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 40d6b92de9432137db4799d482afe7ae5ad52ae8)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/drivers/iris/iris_resource.c14
2 files changed, 15 insertions, 1 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 141e02e00da..b5d427b5381 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -13900,7 +13900,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
},
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index 8747ef4aa8a..3b34e32cd21 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -1125,6 +1125,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