From: Kenneth Graunke Date: Mon, 4 Nov 2019 08:21:06 +0000 (-0800) Subject: iris: Avoid replacing backing storage for buffers with no contents X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=97e9de17952d1382512007e4745c25b9c9106a46;p=mesa.git 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. --- 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.