From 97e9de17952d1382512007e4745c25b9c9106a46 Mon Sep 17 00:00:00 2001 From: Kenneth Graunke Date: Mon, 4 Nov 2019 00:21:06 -0800 Subject: [PATCH] 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. -- 2.30.2