iris: Improve direct CPU map heuristics
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 29 Sep 2022 18:24:14 +0000 (11:24 -0700)
committerMarge Bot <emma+marge@anholt.net>
Fri, 9 Dec 2022 21:46:03 +0000 (21:46 +0000)
commitbec68a85a2dee6e2031c1eb4b0cc7df007f02d74
treebdac9e666bacb0e73fce8eb7dcf3b6a1000c0ab5
parenteafaac2b1e3c5fa2c347488c2e5c94f895392b81
iris: Improve direct CPU map heuristics

We were promoting reads with a valid primary to direct CPU maps even
if the mmap mode was IRIS_MMAP_WC, which would mean uncached reads from
VRAM.  In that case, GPU blits are in fact useful!

We were also only checking for !DISCARD_RANGE rather than MAP_READ,
which isn't a great idea for image maps, given the discussion in the
previous commit about image map semantics.

The original code was also just confusingly structured.  Make a helper
function with clearly defined cases where we want to bail on CPU maps.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19209>
src/gallium/drivers/iris/iris_resource.c