mesa.git
7 years agomesa: fix empty program log length
Tapani Pälli [Wed, 17 Aug 2016 07:37:45 +0000 (10:37 +0300)]
mesa: fix empty program log length

In case we have empty log (""), we should return 0. This fixes
Khronos WebGL conformance test 'program-infolog'.

From OpenGL ES 3.1 (and OpenGL 4.5 Core) spec:
   "If pname is INFO_LOG_LENGTH , the length of the info log, including
    a null terminator, is returned. If there is no info log, zero is
    returned."

v2: apply same fix for get_shaderiv and _mesa_GetProgramPipelineiv (Ian)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> (v1)
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=97321
Cc: "13.0" <mesa-stable@lists.freedesktop.org>
7 years agodraw: finally optimize bool clip mask generation
Roland Scheidegger [Sat, 12 Nov 2016 21:46:58 +0000 (22:46 +0100)]
draw: finally optimize bool clip mask generation

lp_build_any_true_range is just what we need, though it will only produce
optimal code with sse41 (ptest + set) - but even without it on 64bit x86
the code is still better (1 unpack, 2 movq + or + set), on 32bit x86 it's
going to be roughly the same as before.
While here also make it a "real" 8bit boolean - cuts one instruction but
more importantly similar to ordinary booleans.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
7 years agodraw: use vectorized calculations for fetch (v2)
Roland Scheidegger [Sat, 12 Nov 2016 21:46:32 +0000 (22:46 +0100)]
draw: use vectorized calculations for fetch (v2)

Instead of doing all the math with scalars, use vectors. This means the
overflow math needs to be done manually, albeit that's only really
problematic for the stride/index mul, the rest has been pretty much
moved outside the shader loop (albeit the mul could actually be optimized
away too), where things are still scalar.
To eliminate control flow in the main shader loop fetch, provide fake
buffers (so index 0 is always valid to fetch).
Still uses aos fetch though in the end - mostly because some more code
would be needed to handle unaligned fetches in that path, and because for
most formats it won't make a difference anyway (we generate some truly
horrendous code for things like R16G16_something for instance).

Instanced fetch however stays roughly the same as before, except that
no longer the same element is fetched multiple times (I've seen a reduction
of ~3 times in main shader loop size due to llvm not recognizing it's all
the same fetch, since it would have been possible some of the fetches
getting replaced with zeros in case vector size exceeds remaining fetch
count - the values of such fetches don't matter at all though).

Also, for elts gathering, use vectorized code as well.

The generated shaders are smaller and faster to compile (not entirely sure
about execution speed, but generally unless there's just single vertices
to handle I would expect it to be faster - there's more opportunities
for future improvements by using soa fetch).

v3: skip the fake index buffer, not needed due to the jit code never seeing
the real index buffer in the first place.
Fix a bug with mask expansion (needs SExt, not ZExt).
Also, be really really careful to keep the behavior the same, even in cases
where it looks wrong, and add comments why the code is doing the seemingly
wrong stuff... Fortunately it's not actually more complex in the end...
Also change function order slightly just to make the diff more readable.

No piglit change. Passes some internal testing with another api too...

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
7 years agoi965/gen7: Minify blit size for stencil tree copy
Jordan Justen [Wed, 16 Nov 2016 01:55:41 +0000 (17:55 -0800)]
i965/gen7: Minify blit size for stencil tree copy

Found by the piglit 'fbo-depth-array stencil-clear' test when
implementing blorp blit splitting for gen7.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agomesa: Drop PATH_MAX usage.
Kenneth Graunke [Tue, 15 Nov 2016 19:53:33 +0000 (11:53 -0800)]
mesa: Drop PATH_MAX usage.

GNU/Hurd does not define PATH_MAX since it doesn't have such arbitrary
limitation, so this failed to compile.  Apparently glibc does not
enforce PATH_MAX restrictions anyway, so it's kind of a hoax:

https://www.gnu.org/software/libc/manual/html_node/Limits-for-Files.html

MSVC uses a different name (_MAX_PATH) as well, which is annoying.

We don't really need it.  We can simply asprintf() the filenames.
If the filename exceeds an OS path limit, presumably fopen() will
fail, and we already check that.  (We actually use ralloc_asprintf
because Mesa provides that everywhere, and it doesn't look like we've
provided an implementation of GNU's asprintf() for all platforms.)

Fixes the build on GNU/Hurd.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=98632
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965: Fix compute shader crash.
Kenneth Graunke [Thu, 17 Nov 2016 04:24:25 +0000 (20:24 -0800)]
i965: Fix compute shader crash.

Fixes crashes when starting Deus Ex: Mankind Divided.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agoanv/TODO: Check off render buffer compression
Jason Ekstrand [Fri, 28 Oct 2016 09:03:36 +0000 (02:03 -0700)]
anv/TODO: Check off render buffer compression

There's still a tiny bit of work to do for storage images but it's
otherwise pretty much done at this point.

7 years agoanv: Enable "permanent" compression for immutable format images
Jason Ekstrand [Tue, 25 Oct 2016 17:59:03 +0000 (10:59 -0700)]
anv: Enable "permanent" compression for immutable format images

This commit extends our support of color compression to surfaces without
the VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT set.  These images will never have
an image view created with a different format then the one set at image
creation time so it's safe to always use compression.  We still bail if the
image is used as a storage image because that sometimes ends up using a
different format.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Properly handle color compression in blorp_copy
Jason Ekstrand [Wed, 26 Oct 2016 09:27:01 +0000 (02:27 -0700)]
intel/blorp: Properly handle color compression in blorp_copy

Previously, blorp copy operations were CCS-unaware so you had to perform
resolves on the source and destination before performing the copy.  This
commit makes blorp_copy capable of handling CCS-compressed images without
any resolves.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Always use UINT formats on SKL+
Jason Ekstrand [Wed, 26 Oct 2016 08:58:16 +0000 (01:58 -0700)]
intel/blorp: Always use UINT formats on SKL+

Many of these UINT formats aren't available prior to Sky Lake so we used
UNORM formats.  Using UINT formats is a bit nicer because it guarantees we
don't run into rounding issues.  Also, we will need it in the next commit
for handling copies with CCS enabled.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoi965/blorp: Rework resolve handling
Jason Ekstrand [Wed, 16 Nov 2016 21:47:13 +0000 (13:47 -0800)]
i965/blorp: Rework resolve handling

This commit moves the handling of resolves into blorp_surf_for_miptree().
Instead of each helper doing resolves and checks itself, it simply tells
blorp_surf_for_miptree which aux modes are supported by the given blorp
operation and blorp_surf_for_miptree will resolve as-needed.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/image: Add an aux_usage field for "default" aux
Jason Ekstrand [Tue, 25 Oct 2016 17:32:18 +0000 (10:32 -0700)]
anv/image: Add an aux_usage field for "default" aux

Initially, the field is set to ISL_AUX_USAGE_NONE so this commit shouldn't
bring any functional changes.  Setting this field to something else will
cause all sampled and storage image views to be created with AUX and blorp
will start trying to respect it so set with care.

7 years agoanv: Add initial support for Sky Lake color compression
Jason Ekstrand [Tue, 25 Oct 2016 05:03:45 +0000 (22:03 -0700)]
anv: Add initial support for Sky Lake color compression

This commit adds basic support for color compression.  For the moment,
color compression is only enabled within a render pass and a full resolve
is done before the render pass finishes.  All texturing operations still
happen with CCS disabled.

7 years agoanv/pass: Precompute some subpass usage information
Jason Ekstrand [Thu, 27 Oct 2016 09:11:56 +0000 (02:11 -0700)]
anv/pass: Precompute some subpass usage information

7 years agoutil/vk_alloc: Add a vk_zalloc2 helper
Jason Ekstrand [Thu, 27 Oct 2016 08:33:39 +0000 (01:33 -0700)]
util/vk_alloc: Add a vk_zalloc2 helper

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/image: Memset all aux surfaces (not just HiZ) to 0
Jason Ekstrand [Tue, 25 Oct 2016 02:35:34 +0000 (19:35 -0700)]
anv/image: Memset all aux surfaces (not just HiZ) to 0

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/image: Rename hiz_surface to aux_surface
Jason Ekstrand [Tue, 25 Oct 2016 02:31:36 +0000 (19:31 -0700)]
anv/image: Rename hiz_surface to aux_surface

7 years agoanv/blorp: Ignore clears for attachments first used as resolve destinations
Jason Ekstrand [Fri, 28 Oct 2016 05:42:02 +0000 (22:42 -0700)]
anv/blorp: Ignore clears for attachments first used as resolve destinations

Otherwise, we'll try to clear it the first time it's used as a draw so if
you do some multisampled rendering, resolve to an attachment, and then draw
on top of the single-sampled attachment, we might accidentally clear it.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
7 years agointel/blorp: Take a fast_clear_op in ccs_resolve
Jason Ekstrand [Tue, 25 Oct 2016 17:48:12 +0000 (10:48 -0700)]
intel/blorp: Take a fast_clear_op in ccs_resolve

Eventually, we may want to just have a single blorp_ccs_op function that
does both clears and resolves.  For now we'll stick to just making the
ccs_resolve function we have now a bit more configurable.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Add plumbing for color resolve slice details
Pohjolainen, Topi [Tue, 11 Oct 2016 19:26:35 +0000 (22:26 +0300)]
intel/blorp: Add plumbing for color resolve slice details

Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/isl: Allow non-2D CCS surfaces
Jason Ekstrand [Thu, 27 Oct 2016 05:56:53 +0000 (22:56 -0700)]
intel/isl: Allow non-2D CCS surfaces

The CCS calculations in ISL are already correct for 1-D and 3-D CCS
surfaces since they have exactly the same layout as 2-D array surfaces (at
least on Sky Lake).  The only problem was that we weren't passing in the
right dimensionality and we weren't passing in the depth.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/isl: Rework the asserts and fails in isl_surf_get_ccs
Jason Ekstrand [Wed, 21 Sep 2016 11:03:27 +0000 (04:03 -0700)]
intel/isl: Rework the asserts and fails in isl_surf_get_ccs

There are some invariants such as number of samples on which we should
assert.  However, most other things should silently return false since
they're much easier for isl_surf_get_ccs to check than the caller.  We also
update the checking to be a bit more complete.

7 years agoanv/cmd_buffer: Refactor surface state relocation handling
Jason Ekstrand [Tue, 25 Oct 2016 02:25:20 +0000 (19:25 -0700)]
anv/cmd_buffer: Refactor surface state relocation handling

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: Pull add_surface_state_reloc into genX_cmd_buffer.c
Jason Ekstrand [Tue, 25 Oct 2016 02:50:20 +0000 (19:50 -0700)]
anv/cmd_buffer: Pull add_surface_state_reloc into genX_cmd_buffer.c

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/image: Stop force-disabling AUX
Jason Ekstrand [Wed, 21 Sep 2016 07:05:58 +0000 (00:05 -0700)]
anv/image: Stop force-disabling AUX

Auxiliary surfaces have to be created manually anyway so force-disabling it
does nothing whatsoever at the moment.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agomesa: Add missing call to _mesa_unlock_debug_state(ctx); v2
Tom Stellard [Wed, 16 Nov 2016 21:21:15 +0000 (21:21 +0000)]
mesa: Add missing call to _mesa_unlock_debug_state(ctx); v2

cd724208d3e1e3307f84a794f2c1fc83b69ccf8a added a call to
_mesa_lock_debug_state(ctx) but wasn't unlocking the debug state.

This fixes a hang in glsl-fs-loop piglit test with MESA_DEBUG=context.

v2:
  - Remove unrelated changes.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agoegl: fix helper function name
Eric Engestrom [Wed, 16 Nov 2016 22:29:53 +0000 (22:29 +0000)]
egl: fix helper function name

I introduced this code last month, but didn't follow the naming
convention. Fix this.

Fixes: 0a606a400fe382a9bc72 ("egl: add eglSwapBuffersWithDamageKHR")
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
7 years agoegl/x11: misc style fixes
Eric Engestrom [Tue, 15 Nov 2016 23:48:52 +0000 (23:48 +0000)]
egl/x11: misc style fixes

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agoegl: fix function name in debug string
Eric Engestrom [Tue, 15 Nov 2016 23:41:38 +0000 (23:41 +0000)]
egl: fix function name in debug string

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
7 years agonir/spirv: Fix handling of gl_PrimitiveId
Jason Ekstrand [Fri, 11 Nov 2016 06:31:32 +0000 (22:31 -0800)]
nir/spirv: Fix handling of gl_PrimitiveId

Before, we were always treating it as an output which bogus.  The only
stage in which this it can be an output is the geometry stage.  In all
other stages, it's an input which, in the back-end, we actually want to be
a system value.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoanv/fence: Handle ANV_FENCE_CREATE_SIGNALED_BIT
Jason Ekstrand [Fri, 11 Nov 2016 05:46:13 +0000 (21:46 -0800)]
anv/fence: Handle ANV_FENCE_CREATE_SIGNALED_BIT

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoanv: Handle null in all destructors
Jason Ekstrand [Fri, 11 Nov 2016 05:32:32 +0000 (21:32 -0800)]
anv: Handle null in all destructors

This fixes a bunch of new CTS tests which look for exactly this.  Even in
the cases where we just call vk_free to free a CPU data structure, we still
handle NULL explicitly.  This way we're less likely to forget to handle
NULL later should we actually do something less trivial.

Cc: "13.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoutil/vk_alloc: Ensure NULL is handled correctly in vk_free
Jason Ekstrand [Fri, 11 Nov 2016 05:12:16 +0000 (21:12 -0800)]
util/vk_alloc: Ensure NULL is handled correctly in vk_free

Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoanv/device: Silence a 32-bit warning
Jason Ekstrand [Thu, 10 Nov 2016 02:45:21 +0000 (18:45 -0800)]
anv/device: Silence a 32-bit warning

7 years agonir: Avoid an extra NIR op in integer divide lowering.
Eric Anholt [Mon, 7 Nov 2016 18:34:01 +0000 (10:34 -0800)]
nir: Avoid an extra NIR op in integer divide lowering.

NIR bools are ~0 for true, so ((unsigned)a >> 31) != 0 -> ((int)a >> 31).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agovc4: Try compiling our FSes in multithreaded mode on new kernels.
Eric Anholt [Fri, 11 Nov 2016 01:47:34 +0000 (17:47 -0800)]
vc4: Try compiling our FSes in multithreaded mode on new kernels.

Multithreaded fragment shaders let us hide texturing latency by a
hyperthreading-style switch to another fragment shader.  This gets us up
to 20% framerate improvements on glmark2 tests.

7 years agovc4: Add support for ETC1 textures if the kernel is new enough.
Eric Anholt [Thu, 17 Nov 2016 00:57:45 +0000 (16:57 -0800)]
vc4: Add support for ETC1 textures if the kernel is new enough.

The kernel changes for exposing the param have now been merged, so we can
expose it here.

7 years agovc4: Fix simulator mode missing-GETPARAM debug info.
Eric Anholt [Thu, 17 Nov 2016 01:22:35 +0000 (17:22 -0800)]
vc4: Fix simulator mode missing-GETPARAM debug info.

The value is 0 since we didn't set it, we wanted to see the param.

7 years agovc4: Fix resource leak in register allocation failure path.
Mun Gwan-gyeong [Wed, 16 Nov 2016 19:17:39 +0000 (04:17 +0900)]
vc4: Fix resource leak in register allocation failure path.

CID 1394322

Signed-off-by: Mun Gwan-gyeong <elongbug@gmail.com>
7 years agoglsl: stub out _mesa_reference_program() in standalone compiler
Timothy Arceri [Mon, 3 Oct 2016 06:04:26 +0000 (17:04 +1100)]
glsl: stub out _mesa_reference_program() in standalone compiler

The follow patch will call this directly from the linker, the
shader cache will also start calling these from the compiler.

7 years agost/mesa/r200/i915/i965: move ARB program fields into a union
Timothy Arceri [Wed, 16 Nov 2016 23:52:28 +0000 (10:52 +1100)]
st/mesa/r200/i915/i965: move ARB program fields into a union

It's common for games to compile 2000 programs or more so at

32bits x 2000 programs x 22 fields x 2 (at least) stages

This should give us something like 352 kilobytes in savings
once we add some more glsl only fields.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agost/mesa: stop initialing Instructions and NumInstructions
Timothy Arceri [Wed, 16 Nov 2016 23:51:19 +0000 (10:51 +1100)]
st/mesa: stop initialing Instructions and NumInstructions

Since gl_program is now created with rzalloc() they should
already be initialised.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa: make use of ralloc when creating ARB asm gl_program fields
Timothy Arceri [Sat, 5 Nov 2016 11:35:41 +0000 (22:35 +1100)]
mesa: make use of ralloc when creating ARB asm gl_program fields

This will allow us to move the ARB asm fields in gl_program into
a union as we will be able call ralloc_free() on the entire struct
when destroying the context.

In this change we switch over to using ralloc for the Instructions,
String and LocalParams fields of gl_program.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa: remove unused Comment field in prog_instruction
Timothy Arceri [Sat, 5 Nov 2016 11:27:22 +0000 (22:27 +1100)]
mesa: remove unused Comment field in prog_instruction

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965: get num_abos from shader_info rather than gl_linked_shader
Timothy Arceri [Thu, 27 Oct 2016 08:15:19 +0000 (19:15 +1100)]
i965: get num_abos from shader_info rather than gl_linked_shader

This is a step towards freeing gl_linked_shader after linking.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa/glsl: copy num_abos to gl_program
Timothy Arceri [Thu, 27 Oct 2016 05:17:19 +0000 (16:17 +1100)]
mesa/glsl: copy num_abos to gl_program

We should be able to free gl_linked_shader after linking in order to
do so we need to switch to getting values from gl_program instead.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965: get num_images from shader_info rather than gl_linked_shader
Timothy Arceri [Thu, 27 Oct 2016 04:59:46 +0000 (15:59 +1100)]
i965: get num_images from shader_info rather than gl_linked_shader

This is a step towards freeing gl_linked_shader after linking.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa/glsl: copy num_images to gl_program
Timothy Arceri [Thu, 27 Oct 2016 03:47:09 +0000 (14:47 +1100)]
mesa/glsl: copy num_images to gl_program

We should be able to free gl_linked_shader after linking in order to
do so we need to switch to getting values from gl_program instead.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agonir: add support for counting AoA uniforms in nir_shader_gather_info()
Timothy Arceri [Thu, 27 Oct 2016 08:13:05 +0000 (19:13 +1100)]
nir: add support for counting AoA uniforms in nir_shader_gather_info()

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965: only try print GLSL IR once when using INTEL_DEBUG to dump ir
Timothy Arceri [Thu, 3 Nov 2016 10:47:04 +0000 (21:47 +1100)]
i965: only try print GLSL IR once when using INTEL_DEBUG to dump ir

Since we started releasing GLSL IR after linking the only time we can
print GLSL IR is during linking. When regenerating variants only NIR
will be available.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoanv/descriptor_set: Put the whole state in the state free list
Jason Ekstrand [Fri, 11 Nov 2016 00:27:47 +0000 (16:27 -0800)]
anv/descriptor_set: Put the whole state in the state free list

We're not really saving much by just putting the offset in there.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agoanv/descriptor_set: Write the state offset in the surface state free list.
Jason Ekstrand [Fri, 11 Nov 2016 00:43:35 +0000 (16:43 -0800)]
anv/descriptor_set: Write the state offset in the surface state free list.

When Kristian reworked descriptor set allocation, somehow he forgot to
actually store the offset in the free list.  Somehow, this completely
missed CTS testing until now... This fixes all 2744 of the new
'dEQP-VK.texture.filtering.* tests in the latest CTS.

Cc: "12.0 13.0" <mesa-dev@lists.freedesktop.org>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
7 years agocompiler: remove now unused copy_shader_info() declaration
Timothy Arceri [Wed, 16 Nov 2016 03:02:12 +0000 (14:02 +1100)]
compiler: remove now unused copy_shader_info() declaration

Left over from 4ac66861

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agocompiler: include shader_enums.h in shader_info.h
Timothy Arceri [Wed, 16 Nov 2016 03:02:11 +0000 (14:02 +1100)]
compiler: include shader_enums.h in shader_info.h

We make use of some enums here.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoswr: [rasterizer core] fix clear with multiple color attachments
Tim Rowley [Wed, 16 Nov 2016 01:44:45 +0000 (19:44 -0600)]
swr: [rasterizer core] fix clear with multiple color attachments

Fixes fbo-mrt-alphatest

v2: styling fixes

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agoPartial revert "i965: "Fix" aux offsets"
Ben Widawsky [Wed, 16 Nov 2016 19:39:29 +0000 (11:39 -0800)]
Partial revert "i965: "Fix" aux offsets"

This partially reverts commit 0d241085f723402120b4b47e939fe77020a16d80.

HiZ buffer cannot do this properly now, and it's not required, so remove
it.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: "Fix" aux offsets
Ben Widawsky [Wed, 16 Nov 2016 01:35:37 +0000 (17:35 -0800)]
i965: "Fix" aux offsets

When 1 BO is used for aux data, it needs to point to the correct offset,
which will not be the BOs offset but instead an offset from the BOs
offset. Since today there are always multiple BOs for aux, this doesn't
actually change anything.

Cc: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoanv/blorp: Handle VK_ATTACHMENT_UNUSED in CmdClearAttachments
Jason Ekstrand [Sat, 22 Oct 2016 06:19:44 +0000 (23:19 -0700)]
anv/blorp: Handle VK_ATTACHMENT_UNUSED in CmdClearAttachments

From the Vulkan 1.0.29 spec for vkCmdClearAttachments:

   "If the subpass’s depth/stencil attachment is VK_ATTACHMENT_UNUSED,
   then the clear has no effect."

and

   "If colorAttachment is VK_ATTACHMENT_UNUSED then the clear has no
   effect."

I have no idea why it's spec'd this way; it seems very anti-Vulkan to me,
but that's what it says and it's really not much work to support.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
7 years agoAllocate a null state whenever there is depth/stencil
Jason Ekstrand [Sat, 22 Oct 2016 01:11:42 +0000 (18:11 -0700)]
Allocate a null state whenever there is depth/stencil

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: Set framebuffer to NULL in secondary command buffers
Jason Ekstrand [Sat, 22 Oct 2016 00:46:17 +0000 (17:46 -0700)]
anv: Set framebuffer to NULL in secondary command buffers

Nothing that is allowed to be called within a secondary now relies on the
framebuffer.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
7 years agoanv/blorp: Use the new clear_attachments entrypoint for attachment clears
Jason Ekstrand [Sat, 22 Oct 2016 00:13:51 +0000 (17:13 -0700)]
anv/blorp: Use the new clear_attachments entrypoint for attachment clears

This allows us to re-use the surface states emitted from the Vulkan driver
instead of blorp creating its own.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/blorp: Break the guts of alloc_binding_table into a shared helper
Jason Ekstrand [Sat, 22 Oct 2016 00:01:17 +0000 (17:01 -0700)]
anv/blorp: Break the guts of alloc_binding_table into a shared helper

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: Bring back anv_cmd_buffer_emit_state_base_address
Jason Ekstrand [Fri, 21 Oct 2016 23:53:46 +0000 (16:53 -0700)]
anv: Bring back anv_cmd_buffer_emit_state_base_address

This reverts most of commit 52904ba85c7e1e3092601e3497bfbc246b00b84a.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Add a clear_attachments entrypoint
Jason Ekstrand [Fri, 21 Oct 2016 21:50:20 +0000 (14:50 -0700)]
intel/blorp: Add a clear_attachments entrypoint

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Add capability to use pre-baked binding tables
Jason Ekstrand [Sat, 22 Oct 2016 00:15:49 +0000 (17:15 -0700)]
intel/blorp: Add capability to use pre-baked binding tables

When a pre-baked binding table is requested, no binding table is created,
instead the binding table offset (relative to surface state base address)
provided by the user is used verbatim.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Add support for vertex shaders
Jason Ekstrand [Fri, 21 Oct 2016 20:10:52 +0000 (13:10 -0700)]
intel/blorp: Add support for vertex shaders

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Use an actual chunk of vertex buffer for the VUE header
Jason Ekstrand [Fri, 21 Oct 2016 21:32:03 +0000 (14:32 -0700)]
intel/blorp: Use an actual chunk of vertex buffer for the VUE header

We're about to start passing other things in as a sort of "VS header" for
vertex shaders and we need a place to put them.  Since we want the instance
id to be one of them, it makes sense to have one vec4 that's either VUE
header or VS header.  Always uploading some handy zeros makes the code a
bit simpler.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoblorp/exec: Use uint32_t for copying varying data
Jason Ekstrand [Fri, 21 Oct 2016 21:22:10 +0000 (14:22 -0700)]
blorp/exec: Use uint32_t for copying varying data

Some things may not be floats and intel CPUs are known for mangling bits
when a float type is used for copying integers.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Handle NIR clear inputs the same way as blit inputs
Jason Ekstrand [Fri, 21 Oct 2016 21:15:03 +0000 (14:15 -0700)]
intel/blorp: Handle NIR clear inputs the same way as blit inputs

By using offsetof() we can ensure that adding fiels to wm_inputs is always
safe as long as we maintain alignment.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Remove NIR support for uniforms
Jason Ekstrand [Fri, 21 Oct 2016 19:01:37 +0000 (12:01 -0700)]
intel/blorp: Remove NIR support for uniforms

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Add a shader type to make keys more unique
Jason Ekstrand [Fri, 21 Oct 2016 18:30:05 +0000 (11:30 -0700)]
intel/blorp: Add a shader type to make keys more unique

Depending on how the driver using blorp implements its shader caching,
there is a small chance of shader collisions due to identical keys between
blit and clear programs.  Adding a small shader type at the top of the key
alleviates this problem.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/blorp: Make the number of samples an explicit parameter
Jason Ekstrand [Fri, 21 Oct 2016 17:40:58 +0000 (10:40 -0700)]
intel/blorp: Make the number of samples an explicit parameter

Previously, we always inferred it from params->dst which meant that
references to params->dst were scattered all throughout the state upload
code.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: Stop relying on the framebuffer for 3DSTATE_SF on gen7
Jason Ekstrand [Wed, 19 Oct 2016 23:37:03 +0000 (16:37 -0700)]
anv/cmd_buffer: Stop relying on the framebuffer for 3DSTATE_SF on gen7

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: Rework the way render target surfaces are allocated
Jason Ekstrand [Wed, 19 Oct 2016 18:33:55 +0000 (11:33 -0700)]
anv: Rework the way render target surfaces are allocated

This commit moves the allocation and filling out of surface state from
CreateImageView time to BeginRenderPass time.  Instead of allocating the
render target surface state as part of the image view, we allocate it in
the command buffer state at the same time that we set up clears.  For
secondary command buffers, we allocate memory for the surface states in
BeginCommandBuffer but don't fill them out; instead, we use our new
SOL-based memcpy function to copy the surface states from the primary
command buffer.  This allows us to handle secondary command buffers without
the user specifying the framebuffer ahead-of-time.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: Expose add_surface_state_reloc as an inline helper
Jason Ekstrand [Wed, 19 Oct 2016 17:29:30 +0000 (10:29 -0700)]
anv/cmd_buffer: Expose add_surface_state_reloc as an inline helper

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/cmd_buffer: Use the surface state alloc helper in null_surface_state
Jason Ekstrand [Wed, 19 Oct 2016 17:15:27 +0000 (10:15 -0700)]
anv/cmd_buffer: Use the surface state alloc helper in null_surface_state

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv: Add a helper for doing buffer copies with nothing but VF and SOL.
Jason Ekstrand [Mon, 26 Sep 2016 19:10:11 +0000 (12:10 -0700)]
anv: Add a helper for doing buffer copies with nothing but VF and SOL.

This method of doing copies has the advantage of touching very little of
the GPU state.  While it does disable all the shader stages, it doesn't
have to blow away binding tables, viewports, scissors, or any other bits of
dynamic state other than VBO 32 which is already reserved.  All of the
state that it does touch is contained within a pipeline anyway so that's
the only thing that has to be dirtied.

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/genxml: Add SO_WRITE_OFFSET registers for gen7-9
Jason Ekstrand [Wed, 19 Oct 2016 02:02:07 +0000 (19:02 -0700)]
intel/genxml: Add SO_WRITE_OFFSET registers for gen7-9

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agointel/isl: Add some basic info about RENDER_SURFACE_STATE to isl_device
Jason Ekstrand [Tue, 20 Sep 2016 05:04:40 +0000 (22:04 -0700)]
intel/isl: Add some basic info about RENDER_SURFACE_STATE to isl_device

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
7 years agoanv/pipeline: Use get_scratch_space/address for compute shaders
Jason Ekstrand [Sat, 12 Nov 2016 21:33:16 +0000 (13:33 -0800)]
anv/pipeline: Use get_scratch_space/address for compute shaders

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agoanv: Move INTERFACE_DESCRIPTOR_DATA setup to the pipeline
Jason Ekstrand [Sat, 12 Nov 2016 20:13:17 +0000 (12:13 -0800)]
anv: Move INTERFACE_DESCRIPTOR_DATA setup to the pipeline

There are a few dynamic bits, namely binding table and sampler addresses,
but most of it is static and really belongs in the pipeline.  It certainly
doesn't belong in flush_compute_descriptor_set.  We'll use the same state
merging trick we use for gen7 DEPTH_STENCIL.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agoanv/pipeline: Roll genX_pipeline_util.h into genX_pipeline.c
Jason Ekstrand [Sat, 12 Nov 2016 19:42:09 +0000 (11:42 -0800)]
anv/pipeline: Roll genX_pipeline_util.h into genX_pipeline.c

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agoanv/pipeline: Unify graphics_pipeline_create
Jason Ekstrand [Sat, 12 Nov 2016 19:39:07 +0000 (11:39 -0800)]
anv/pipeline: Unify graphics_pipeline_create

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agoanv/pipline: Re-order state emission and make it consistent
Jason Ekstrand [Sat, 12 Nov 2016 19:28:17 +0000 (11:28 -0800)]
anv/pipline: Re-order state emission and make it consistent

This commit makes both gen7 and gen8 pipeline setup emit state packets
in exactly the same order.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agoanv/pipeline: Rework the 3DSTATE_VF_TOPOLOGY helper
Jason Ekstrand [Sat, 12 Nov 2016 19:26:05 +0000 (11:26 -0800)]
anv/pipeline: Rework the 3DSTATE_VF_TOPOLOGY helper

It gets a new name and moved to genX_pipeline_util.h.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agoanv/pipeline: Move 3DSTATE_PS_EXTRA setup into a helper
Jason Ekstrand [Sat, 12 Nov 2016 19:14:53 +0000 (11:14 -0800)]
anv/pipeline: Move 3DSTATE_PS_EXTRA setup into a helper

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agoanv/pipeline: Unify 3DSTATE_WM emission
Jason Ekstrand [Sat, 12 Nov 2016 19:11:37 +0000 (11:11 -0800)]
anv/pipeline: Unify 3DSTATE_WM emission

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agointel/genxml: Make 3DSTATE_WM more consistent across gens
Jason Ekstrand [Sat, 12 Nov 2016 18:46:02 +0000 (10:46 -0800)]
intel/genxml: Make 3DSTATE_WM more consistent across gens

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agoanv/pipeline: Unify 3DSTATE_PS emission
Jason Ekstrand [Sat, 12 Nov 2016 17:42:58 +0000 (09:42 -0800)]
anv/pipeline: Unify 3DSTATE_PS emission

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agoanv/pipeline/gen7: Properly set 3DSTATE_PS::DualSourceBlendEnable
Jason Ekstrand [Mon, 14 Nov 2016 17:17:20 +0000 (09:17 -0800)]
anv/pipeline/gen7: Properly set 3DSTATE_PS::DualSourceBlendEnable

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agointel/genxml: Make some 3DSTATE_PS fields more consistent
Jason Ekstrand [Sat, 12 Nov 2016 17:35:37 +0000 (09:35 -0800)]
intel/genxml: Make some 3DSTATE_PS fields more consistent

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agoanv/pipeline: Make emit_3dstate_sbe safe to call without a FS
Jason Ekstrand [Sat, 12 Nov 2016 18:58:48 +0000 (10:58 -0800)]
anv/pipeline: Make emit_3dstate_sbe safe to call without a FS

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agoanv/pipeline: Unify 3DSTATE_GS emission
Jason Ekstrand [Sat, 12 Nov 2016 17:18:52 +0000 (09:18 -0800)]
anv/pipeline: Unify 3DSTATE_GS emission

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agoanv/pipeline/gen8: Set 3DSTATE_GS::InstanceControl
Jason Ekstrand [Mon, 14 Nov 2016 16:42:22 +0000 (08:42 -0800)]
anv/pipeline/gen8: Set 3DSTATE_GS::InstanceControl

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agointel/genxml: Make some 3DSTATE_GS fields more consistent
Jason Ekstrand [Sat, 12 Nov 2016 17:05:59 +0000 (09:05 -0800)]
intel/genxml: Make some 3DSTATE_GS fields more consistent

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agoanv/pipeline: Unify 3DSTATE_VS emission
Jason Ekstrand [Sat, 12 Nov 2016 16:43:54 +0000 (08:43 -0800)]
anv/pipeline: Unify 3DSTATE_VS emission

With this commit, a few fields are now specified on gen7 which weren't
before.  However, the values specified are zero which is the default so the
final hardware packet remains the same.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agoanv/pipeline/gen8: Enable VS statistics
Jason Ekstrand [Sat, 12 Nov 2016 16:40:25 +0000 (08:40 -0800)]
anv/pipeline/gen8: Enable VS statistics

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agoanv/pipeline: Stop claiming to support running without a vertex shader
Jason Ekstrand [Sat, 12 Nov 2016 16:34:33 +0000 (08:34 -0800)]
anv/pipeline: Stop claiming to support running without a vertex shader

From the Vulkan spec version 1.0.32 docs for vkCreateGraphicsPipelines:

    The stage member of one element of pStages must be
    VK_SHADER_STAGE_VERTEX_BIT

Since a vertex shader is always required, this hasn't been used since we
deleted meta.  Let's get rid of the complexity.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agointel/genxml: Make some VS/GS fields consistent across gens
Jason Ekstrand [Fri, 21 Oct 2016 20:08:48 +0000 (13:08 -0700)]
intel/genxml: Make some VS/GS fields consistent across gens

We use the names from gen8+

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
7 years agoanv/pipeline: Get rid of the kernel pointer fields
Jason Ekstrand [Sat, 12 Nov 2016 16:07:54 +0000 (08:07 -0800)]
anv/pipeline: Get rid of the kernel pointer fields

Now that we have anv_shader_bin, they're completely redundant with other
information we have in the pipeline.  For vertex shaders, we also go
through way too much work to put the offset in one or the other field and
then look at which one we put it in later.

Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>