Commit Graph

102 Commits

Author SHA1 Message Date
Kenneth Graunke 0f3dc832bc iris: Fix FLUSH_EXPLICIT handling with staging buffers.
I neglected to blit the staging buffer back to the real one at
transfer_flush_region (FlushMappedBufferRange) time.
2019-04-15 14:51:01 -07:00
Kenneth Graunke 62b2ce0592 iris: Preserve all PIPE_TRANSFER flags in xfer->usage
We need to preserve PIPE_TRANSFER_FLUSH_EXPLICIT, DISCARD_RANGE, and
so on, but don't want to pass them to iris_bo_map().  So, keep them all,
but mask them off when calling map.

Chris Wilson told me to do this a long time ago and he was right.
2019-04-15 14:51:01 -07:00
Mark Janes 2393cc7f00 intel/common: move gen_debug to intel/dev
libintel_common depends on libintel_compiler, but it contains debug
functionality that is needed by libintel_compiler.  Break the circular
dependency by moving gen_debug files to libintel_dev.

Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-04-10 13:15:33 -07:00
Tapani Pälli 361f3d19f1 iris: handle aux properly in iris_resource_get_handle
Disable aux when resource seen the first time and EXPLICIT_FLUSH
not being set. This fixes issues seen when launching Xorg and
CCS_E getting utilized.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-04-04 23:35:24 -07:00
Tapani Pälli 61cc379371 iris: move iris_flush_resource so we can call it from get_handle
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-04-04 13:36:51 -07:00
Rafael Antognolli 7339660e80 iris: Add aux.sampler_usages.
We want to skip some types of aux usages (for instance,
ISL_AUX_USAGE_HIZ when the hardware doesn't support it, or when we have
multisampling) when sampling from the surface.

Instead of checking for those cases while filling the surface state and
leaving it blank, let's have a version of aux.possible_usages for
sampling. This way we can also avoid allocating surface state for the
cases we don't use.

Fixes: a8b5ea8ef0 "iris: Add function to update clear color in surface state."
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-04-02 15:26:45 -07:00
Rafael Antognolli dfc5620a41 iris: Do not allocate clear_color_bo for gen8.
Since we are not using it for the clear color, there's no need to
allocate it.

Fixes: a8b5ea8ef0 "iris: Add function to update clear color in surface state."
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-04-02 15:26:41 -07:00
Kenneth Graunke de783a6897 iris: Actually advertise some modifiers
I neglected to fill out this driver function, causing us to advertise
0 modifiers.  Now we advertise the various tilings and let the driver
pick them.  I've verified that X tiling works with Weston (by hacking
the list to skip Y tiling).

Y+CCS doesn't work yet because it's multiplane and the Gallium dri
state tracker isn't really prepared for that.  Leave it off for now.
2019-03-27 21:27:54 -07:00
Rafael Antognolli e7c8402163 iris: Let blorp update the clear color for us.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-03-20 16:46:26 -07:00
Rafael Antognolli 37f2692591 iris: Allocate buffer space for the fast clear color.
Also store clear color in the iris_resource.

Always allocate clear color state buffer.

v2:
 - Make clear_color_offset be 64 bits (Ken).
 - Simplify the logic to decide when to memset the aux buffer (Ken).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-03-20 16:46:25 -07:00
Rafael Antognolli 9c63ec26ea iris: Enable HiZ for multisampled depth surfaces.
Fix this check so that we can get a HiZ aux buffer for multisampled
surfaces as well. Also make sure we don't try to emit a sampler view
surface state for multisampled depth sufaces with HiZ enabled, as
the sampler can't HiZ for multisampled buffers and isl would assert.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-03-18 22:21:30 -07:00
Kenneth Graunke 836b47ca4e iris: Don't flush the batch for unsynchronized mappings
I messed this up when adding the GPU copy path.
2019-03-18 01:02:18 -07:00
Kenneth Graunke 0c3adaad22 iris: Don't mutate box in transfer map code
Not mutating the boxes is arguably cleaner.

Split from a patch by Chris Wilson but reworked to use a pointer to the
original box rather than making a copy at all.
2019-03-13 23:31:51 -07:00
Rafael Antognolli 2b2b449dd1 iris: Enable auxiliary buffer support again
Now that we are properly resolving buffers before giving them to the
window system, let's enable aux support again.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-03-13 14:45:13 -07:00
Rafael Antognolli 9159a5bbf8 iris: Add resolve on iris_flush_resource.
The flush_resource hook is supposedly called when the resource content
needs to be made visible to external (okay, that's pretty vague). For
instance, it gets called before a surface gets handled to the window
system. So we need to resolve it if it's not resolved yet.

v2 (Ken):
 - Check mod_info in iris_flush_resource instead of ISL_AUX_USAGE_NONE
 - Drop my old broken resolve code from iris_resource_get_handle() now
   that Rafael's got it hooked up in the right place.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-03-13 14:45:13 -07:00
Chris Wilson 97ad0efba0 iris: Use streaming loads to read from tiled surfaces
Always use the streaming load (since we know we have Broadwell+, all of
our target CPU support sse41) for reading back form the tiled surface
for mapping the resource. This means we hit the fast WC handling paths
on Atoms (without LLC), and for big Core (with LLC) using the streaming
load is no less efficient as we do not require the tiled buffer to be
pulled into the CPU cache.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-03-13 10:54:16 -07:00
Chris Wilson 797fb6c6ac iris: Use coherent allocation for PIPE_RESOURCE_STAGING
On !llc machines (Atoms), reading from a linear buffers is slow and so
copying from one resource into the linear staging buffer is still slow.
However, we can tell the GPU to snoop the CPU cache when reading from and
writing to the staging buffer eliminating the slow uncached reads.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2019-03-13 10:54:16 -07:00
Kenneth Graunke 9d1334d2a0 iris: Use copy_region and staging resources to avoid transfer stalls
This is similar to intel_miptree_map_blit and intel_buffer_object.c's
temporary blits in i965.

Improves performance of DiRT Rally by 20-25% by eliminating stalls.

Breaks piglit's spec/arb_shader_image_load_store/host-mem-barrier,
by using the GPU to do uploads, exposing a st/mesa issue where it
doesn't give us memory_barrier() calls.  This is a pre-existing issue
and will be fixed by a later patch (currently out for review).
2019-03-08 13:29:39 -08:00
Kenneth Graunke 335726fdac iris: Spruce up "are we using this engine?" checks for flushing
We were using batch->contains_draw as a proxy for "are we even using
this engine?"  That isn't quite right, because it only counts regular
draws.  BLORP operations may have also rendered to a resource, which
needs to trigger flushing.  To check for this, we also see if the
render and sometimes depth caches are non-empty.

We can also drop the "but there might already be stale data in the
cache even if we haven't emitted any commands yet" concern in the
comments.  The kernel flushes caches between batches.

This may not be great but it's at least better than what was there.
2019-03-07 17:08:07 -08:00
Kenneth Graunke b21de090d6 Revert "iris: Enable auxiliary buffer support"
This reverts commit cd0ced49e7.

It breaks glxgears rendering.
2019-02-21 15:50:46 -08:00
Kenneth Graunke cd0ced49e7 iris: Enable auxiliary buffer support
This currently regresses KHR-GL4x.compute_shader.resource-texture,
but that's a pre-existing bug (https://bugs.freedesktop.org/109113)
which should be fixed up once we have fast clear support.
2019-02-21 10:26:12 -08:00
Rafael Antognolli db81445837 iris: Flag ALL_DIRTY_BINDINGS on aux state change.
If we change the aux state for a given resource, we need to re-emit the
binding table pointers for any stage that has such resource bound. Since
we don't track that, flag IRIS_ALL_DIRTY_BINDINGS and emit all of them.
2019-02-21 10:26:12 -08:00
Rafael Antognolli 95589652a1 iris: Skip resolve if there's no context.
If iris_resource_get_handle() gets called without a context, we can't
resolve the resource. Hopefully it shouldn't be compressed anyway, so
let's just add an assert to ensure it's correct.
2019-02-21 10:26:12 -08:00
Rafael Antognolli 8190165d13 iris: Avoid leaking if we fail to allocate the aux buffer.
Otherwise we could leak the aux state map or the aux BO.
2019-02-21 10:26:12 -08:00
Kenneth Graunke f3f7d45a63 iris: Allow disabling aux via INTEL_DEBUG options 2019-02-21 10:26:12 -08:00
Kenneth Graunke 15822f33ad iris: make surface states for CCS_D too
CCS_E can fall back to CCS_D with incompatible format views

CCS_D is pretty useless without fast clears and we may as well use NONE,
but we're surely going to hook those up at some point, so may as well
just go ahead and do it now...
2019-02-21 10:26:12 -08:00
Kenneth Graunke 92c310fd3f iris: don't use hiz for MSAA buffers 2019-02-21 10:26:12 -08:00
Kenneth Graunke 2cddc953cd iris: some initial HiZ bits 2019-02-21 10:26:12 -08:00
Kenneth Graunke 9b1126c990 iris: disable aux for external things 2019-02-21 10:26:12 -08:00
Kenneth Graunke bfc76d3525 iris: store modifier info in res 2019-02-21 10:26:12 -08:00
Kenneth Graunke f8aa9aa353 iris: resolve before transfer maps 2019-02-21 10:26:12 -08:00
Kenneth Graunke 77a1070d36 iris: Initial import of resolve code 2019-02-21 10:26:12 -08:00
Kenneth Graunke f879349398 iris: create aux surface if needed 2019-02-21 10:26:12 -08:00
Kenneth Graunke 3cfc6a207b iris: Fill out res->aux.possible_usages 2019-02-21 10:26:12 -08:00
Kenneth Graunke a7bc4d6074 iris: Add iris_resource fields for aux surfaces
But without fast clears or HiZ per-level tracking just yet.
2019-02-21 10:26:12 -08:00
Kenneth Graunke 1b5c342f33 iris: Simplify iris_get_depth_stencil_resources
We can safely assume that the given resource is depth, depth/stencil,
or stencil already.  The stencil-only case is easily detectable with
a single format check, and all other cases are handled identically.

This saves some CPU overhead.
2019-02-21 10:26:12 -08:00
Rafael Antognolli 455c959689 iris: Store internal_format when getting resource from handle. 2019-02-21 10:26:12 -08:00
Kenneth Graunke 8eda6f2288 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.
2019-02-21 10:26:11 -08:00
Kenneth Graunke bacc722d13 iris: Flush the render cache in flush_and_dirty_for_history
BLORP uses the render engine to write to buffers, and we need to flush
that data out to the actual surface (finishing the write).  Then, the
rest of this function invalidates any caches that might have stale data
which needs to be refetched.
2019-02-21 10:26:11 -08:00
Kenneth Graunke 5be72d9a20 iris: Delete bogus comment about cube array counting.
Both 'z' and 'depth' are counted in slices, according to the Gallium
docs (context.rst).  In our temporary memory, we allocate `box.depth`
slices, so we need to rebase the starting slice (box.z) down to 0,
and back again when writing on unmap.

There's nothing strange about cubes here.
2019-02-21 10:26:11 -08:00
Rhys Kidd 6c17e7d95f iris: Fix assertion in iris_resource_from_handle() tiling usage
Assertion error:

  iris_resource_from_handle: Assertion `res->bo->tiling_mode ==
      isl_tiling_to_i915_tiling(res->surf.tiling)' failed.

This patch fixes 16 piglit tests on KBL:
glx/glx-multithread-texture
glx/glx-query-drawable-glx_fbconfig_id-glxpbuffer
glx/glx-query-drawable-glx_fbconfig_id-glxpixmap
glx/glx-query-drawable-glx_preserved_contents
glx/glx-query-drawable-glxpbuffer-glx_height
glx/glx-query-drawable-glxpbuffer-glx_width
glx/glx-query-drawable-glxpixmap-glx_height
glx/glx-query-drawable-glxpixmap-glx_width
glx/glx-swap-pixmap
glx/glx-swap-pixmap-bad
glx/glx-tfp
glx/glx-visuals-depth -pixmap
glx/glx-visuals-stencil -pixmap
spec/egl 1.4/eglcreatepbuffersurface and then glclear
spec/egl 1.4/largest possible eglcreatepbuffersurface and then glclear
spec/egl_nok_texture_from_pixmap/basic

Cc: Kenneth Graunke <kenneth@whitecape.org>
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Signed-off-by: Rhys Kidd <rhyskidd@gmail.com>
2019-02-21 10:26:11 -08:00
Kenneth Graunke 5481887ca8 iris: whitespace fixes 2019-02-21 10:26:11 -08:00
Kenneth Graunke c03fbb41aa iris: fix dma buf import strides 2019-02-21 10:26:10 -08:00
Jason Ekstrand 47d4ea1a16 iris: Allocate buffer resources separately
(cleaned up by Ken - make sure a bunch of things were more obviously
not using res->surf, do allow checking res->surf.tiling == LINEAR,
drop format cpp checks that aren't needed, drop memzone handling for
images, assume buffers / non-buffers in a few places...)
2019-02-21 10:26:10 -08:00
Kenneth Graunke 773adeb9e9 iris: move some non-buffer case code in a bit 2019-02-21 10:26:10 -08:00
Kenneth Graunke fbf3124771 iris: Rework tiling/modifiers handling
We were being very picky about things being Y tiled.  But, not
everything can be - for example, > 16382 surfaces on SKL GT1-3
have to fall back to linear.

Instead, give ISL options and let it pick.
2019-02-21 10:26:10 -08:00
Kenneth Graunke 415ede346d iris: Flush for history at various moments
When we blit, transfer, or copy_resource to a buffer, we need to flush
to ensure any stale data for that buffer is invalidated in the caches.

bind_history will inform us which caches need to be flushed.

Also, for any push constant buffers, we need to flag those dirty so
that we re-emit 3DSTATE_CONSTANT_*, causing the data to be re-pushed.
2019-02-21 10:26:10 -08:00
Kenneth Graunke c8579e708e iris: add iris_flush_and_dirty_for_history 2019-02-21 10:26:10 -08:00
Kenneth Graunke f49f506b13 iris: drop long dead XXX comment 2019-02-21 10:26:10 -08:00
Kenneth Graunke f1a7392be1 iris: Put batches in an array
We keep re-making this array all over the place
2019-02-21 10:26:10 -08:00