mesa/src
Jason Ekstrand 6fce0e2065 i965: Track the depth and render caches separately
Previously, we just had one hash set for tracking depth and render
caches called brw_context::render_cache.  This is less than ideal
because the depth and render caches are separate and we can't track
moves between the depth and the render caches.  This limitation led
to some unnecessary flushing around the depth cache.  There are cases
(mostly with BLORP) where we can end up touching a depth or stencil
buffer through the render cache.  To guard against this, blorp would
unconditionally do a render_cache_set_check_flush on it's destination
which meant that if you did any rendering (including a BLORP operation)
to a given surface and then used it as a blorp destination, you would
end up flushing it out of the render cache before rendering into it.

Things get worse when you dig into the depth/stencil state code for
regular GL draw calls.  Because we may end up rendering to a depth
or stencil buffer via BLORP, we did a render_cache_set_check_flush on
all depth and stencil buffers in brw_emit_depthbuffer to ensure that
they got flushed out of the render cache prior to using them for depth
or stencil testing.  However, because we also need to track dirtiness
for depth and stencil so that we can implement depth and stencil
texturing correctly, we were adding all depth and stencil buffers to the
render cache set in brw_postdraw_set_buffers_need_resolve.  This meant
that, if anything caused 3DSTATE_DEPTH_BUFFER to get re-emitted
(currently _NEW_BUFFERS, BRW_NEW_BATCH, and BRW_NEW_BLORP), we would
almost always do a full pipeline stall and render/depth cache flush.

The root cause of both of these problems is that we can't tell the
difference between the render and depth caches in our tracking.  This
commit splits our cache tracking into two sets, one for render and one
for depth, and properly handles transitioning between the two.  We still
flush all the caches whenever anything needs to be flushed.  The idea is
that if we're going to take the hit of a flush and stall, we may as well
flush everything in the hopes that we can avoid a flush by something
else later.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
(cherry picked from commit fb0e9b5197)
2018-01-24 20:14:47 +00:00
..
amd ac/nir: Sanitize location_frac for local variables. 2018-01-12 21:38:10 +01:00
broadcom broadcom/vc5: Remove unused v3d_compiler.c 2017-11-13 17:17:16 +00:00
compiler glsl: Respect std430 layout in lower_buffer_access 2018-01-12 21:38:10 +01:00
egl egl/android: Fix build break with dri2_initialize_android _EGLDisplay parameter 2018-01-08 20:49:46 +00:00
gallium st/va: release held locks in error paths 2018-01-24 19:27:19 +00:00
gbm meson: build libEGL 2017-10-20 16:46:48 -07:00
getopt
glx glx/dri3: Remove unused deviceName variable 2017-12-14 22:56:46 +00:00
gtest meson: convert gtest to an internal dependency 2017-10-03 10:02:08 -07:00
hgl glapi/hgl: remove the final user of _glapi_check_table() 2016-10-06 15:03:46 +01:00
intel anv: Import mako templates only during execution of anv_extensions 2018-01-12 21:38:10 +01:00
loader loader/dri3: Avoid freeing renderbuffers in use 2018-01-12 21:38:10 +01:00
mapi gl_table.py: add extern C guard for the generated glapitable.h 2017-11-27 19:26:16 +00:00
mesa i965: Track the depth and render caches separately 2018-01-24 20:14:47 +00:00
util drirc: set allow_glsl_cross_stage_interpolation_mismatch for more games 2017-12-27 12:15:13 +00:00
vulkan meson: move wayland_drm_protocol generation to wayland-drm 2017-10-20 16:46:48 -07:00
git_sha1.h.in meson: Build i965 and dri stack 2017-10-09 13:42:44 -07:00
Makefile.am automake: include git_sha1.h.in in release tarball 2017-11-13 17:17:15 +00:00
meson.build meson: build libEGL 2017-10-20 16:46:48 -07:00
SConscript scons: use python3-compatible print() 2017-09-25 11:57:12 +01:00