From: Kenneth Graunke Date: Tue, 1 Jan 2019 06:03:35 +0000 (-0800) Subject: iris: Handle PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE somewhat X-Git-Tag: upstream/19.3.0~8893 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8eda6f22885e7af66affec83a94ba5a087180842;p=platform%2Fupstream%2Fmesa.git iris: Handle PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE somewhat Various places in the transfer code need to know whether they must read the existing resource's values. Rather than checking both flags everywhere, just make PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE also flag PIPE_TRANSFER_DISCARD_RANGE - if we can discard everything, we can discard a subrange, too. Obviously, we can do better for PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE, but eventually u_threaded_context should handle swapping out buffers for new idle buffers, anyway. In the meantime, this is at least better. --- diff --git a/src/gallium/drivers/iris/iris_resource.c b/src/gallium/drivers/iris/iris_resource.c index 48f348b..ca8832c 100644 --- a/src/gallium/drivers/iris/iris_resource.c +++ b/src/gallium/drivers/iris/iris_resource.c @@ -824,6 +824,12 @@ iris_transfer_map(struct pipe_context *ctx, struct iris_resource *res = (struct iris_resource *)resource; struct isl_surf *surf = &res->surf; + /* If we can discard the whole resource, we can also discard the + * subrange being accessed. + */ + if (usage & PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE) + usage |= PIPE_TRANSFER_DISCARD_RANGE; + if (surf->tiling != ISL_TILING_LINEAR && (usage & PIPE_TRANSFER_MAP_DIRECTLY)) return NULL; @@ -841,9 +847,6 @@ iris_transfer_map(struct pipe_context *ctx, struct iris_transfer *map = slab_alloc(&ice->transfer_pool); struct pipe_transfer *xfer = &map->base; - // PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE - // PIPE_TRANSFER_DISCARD_RANGE - if (!map) return NULL;