iris: Use staging blits for transfers involving imported BOs
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 20 May 2021 18:22:22 +0000 (11:22 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 2 Jun 2021 21:18:00 +0000 (21:18 +0000)
commit3319ab0db9b56007135ca093e70803af46aa4427
treee17eac64a5b050e28c9e08c8d425857c07d16228
parent643c4ade4c39c8ba8c63651ee4a1549eeb96fdec
iris: Use staging blits for transfers involving imported BOs

Direct mappings of imported DMABUFs can be tricky.  If they're allocated
from our own device, then we can probably mmap them and it'd be fine.
But they may come from a different device (such as a discrete GPU), in
which case I915_GEM_MMAP wouldn't work, I915_GEM_MMAP_GTT would require
a working IOMMU, and directly mmap'ing the DMABUF fd would come with a
bunch of rules and restrictions which are hard to get right.

CPU mapping an imported DMABUF image for writes seems very uncommon,
solidly in the "what are you even doing?" realm.  Mapping an imported
DMABUF for reading might be a thing, in case someone wanted to do
glReadPixels on it.  But in that case, the cost of doing a staging
blit is probably acceptable.

Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10941>
src/gallium/drivers/iris/iris_resource.c