Mesa (master): iris: Avoid replacing backing storage for buffers with no contents
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Dec 23 00:19:12 UTC 2019
Module: Mesa
Branch: master
Commit: 97e9de17952d1382512007e4745c25b9c9106a46
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=97e9de17952d1382512007e4745c25b9c9106a46
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Mon Nov 4 00:21:06 2019 -0800
iris: Avoid replacing backing storage for buffers with no contents
We might get asked to pitch the storage on a buffer that already has
no meaningful contents. In this case, the existing buffer is as good
as a new one.
---
src/gallium/drivers/iris/iris_resource.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c
index ed24d629fe5..952d6615584 100644
--- a/src/gallium/drivers/iris/iris_resource.c
+++ b/src/gallium/drivers/iris/iris_resource.c
@@ -1240,6 +1240,10 @@ iris_invalidate_resource(struct pipe_context *ctx,
if (resource->target != PIPE_BUFFER)
return;
+ /* If it's already invalidated, don't bother doing anything. */
+ if (res->valid_buffer_range.start > res->valid_buffer_range.end)
+ return;
+
if (!resource_is_busy(ice, res)) {
/* The resource is idle, so just mark that it contains no data and
* keep using the same underlying buffer object.
More information about the mesa-commit
mailing list