mesa/src
Kenneth Graunke 38e2142f39 i965/bufmgr: Explicitly wait instead of using I915_GEM_SET_DOMAIN.
With the advent of asynchronous maps, domain tracking doesn't make a
whole lot of sense.  Buffers can be in use on both the CPU and GPU at
the same time.  In order to avoid blocking, we stopped using set_domain
for asynchronous mappings, which means that the kernel's tracking has
lies.  We can't properly track it in userspace either, as the kernel
can change domains on us spontaneously (for example, when un-swapping).

According to Chris Wilson, I915_GEM_SET_DOMAIN does the following:

1. pins the backing storage (acquiring pages outside of the
   struct_mutex)

2. waits either for read/write access, including inter-device waits

3. updates the domain, clflushing as required

4. marks the object as used (for swapping)

5. turns off FBC/PSR/fancy scanout caching

Item (1) is not terribly important.  Most BOs are recycled via the
BO cache, so they already have pages.  Regardless, we fixed this
via an initial set_domain in the previous patch.

We implement item (2) with I915_GEM_WAIT.  This has one downside:
we'll stall unnecessarily if we do a read-only mapping of a buffer
that the GPU is reading.  I believe this is pretty uncommon.  We
may want to extend the wait ioctl at some point.

Mesa already does item (3) itself.  For cache-coherent buffers (most on
LLC systems), we don't need to do any clflushing - the CPU and GPU views
are coherent.  For non-coherent buffers (most on non-LLC systems), we
currently only use the CPU for read-only maps, and we explicitly clflush
when necessary.

We don't care about item (4)...swapping has already killed performance.
Plus, with async maps, the kernel's domain tracking is already bogus,
so it can't do this accurately regardless.

Item (5) should be okay because we avoid cached maps of scanout buffers.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2017-07-22 19:34:42 -07:00
..
amd radv: reset non-syncobj semaphore context after wait. 2017-07-22 00:03:26 +01:00
broadcom broadcom/vc4: Add more packets to the v2.1 XML. 2017-07-13 11:30:42 -07:00
compiler glsl: rework misleading block layout code 2017-07-23 10:06:01 +10:00
egl egl: fix line continuation 2017-07-19 15:51:54 +01:00
gallium svga: Limit number of immediates in shader 2017-07-22 13:18:56 -06:00
gbm gbm: fix typo 2017-07-19 15:51:54 +01:00
getopt
glx egl: turn one more boolean int into a bool 2017-06-21 21:42:14 +01:00
gtest gtest: Update to 1.8.0. 2017-01-20 11:40:52 -08:00
hgl
intel anv/blorp: Assert isl_surf_init success in do_buffer_copy 2017-07-22 08:21:27 -07:00
loader loader/dri3: Use dri3_find_back in loader_dri3_swap_buffers_msc 2017-07-13 16:49:28 +09:00
mapi mapi: add missing no_error tag to glBlitNamedFramebuffer() 2017-07-18 10:07:34 +02:00
mesa i965/bufmgr: Explicitly wait instead of using I915_GEM_SET_DOMAIN. 2017-07-22 19:34:42 -07:00
util util: Make CLAMP turn NaN into MIN. 2017-07-18 23:48:46 -07:00
vulkan vulkan/util: fix typo in comment 2017-07-18 13:56:04 +01:00
Makefile.am build systems: move git_sha1_gen.sh to bin/ 2017-07-06 22:59:39 +01:00
SConscript build systems: move git_sha1_gen.sh to bin/ 2017-07-06 22:59:39 +01:00