mesa.git
6 years agoradeonsi/nir: gather some missing fs info
Timothy Arceri [Thu, 8 Feb 2018 23:53:00 +0000 (10:53 +1100)]
radeonsi/nir: gather some missing fs info

Fixes some early-z arb_shader_image_load_store piglit tests.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoac: pass struct ac_llvm_context to emit_membar()
Timothy Arceri [Thu, 8 Feb 2018 23:37:25 +0000 (10:37 +1100)]
ac: pass struct ac_llvm_context to emit_membar()

Fixes segfault in piglit test:

./bin/arb_shader_image_load_store-shader-mem-barrier --quick -auto -fbo

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoradeonsi: copy the NIR enablement debug bit to the shader cache flags
Marek Olšák [Fri, 9 Feb 2018 00:47:26 +0000 (01:47 +0100)]
radeonsi: copy the NIR enablement debug bit to the shader cache flags

When NIR is enabled, TGSI must not be used. When NIR is disabled, TGSI

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agointel/blorp: Use isl_aux_op instead of blorp_hiz_op
Jason Ekstrand [Fri, 19 Jan 2018 23:14:37 +0000 (15:14 -0800)]
intel/blorp: Use isl_aux_op instead of blorp_hiz_op

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agointel/blorp: Use isl_aux_op instead of blorp_fast_clear_op
Jason Ekstrand [Fri, 19 Jan 2018 23:02:07 +0000 (15:02 -0800)]
intel/blorp: Use isl_aux_op instead of blorp_fast_clear_op

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv: Allow fast-clearing the first slice of a multi-slice image
Jason Ekstrand [Fri, 19 Jan 2018 20:07:12 +0000 (12:07 -0800)]
anv: Allow fast-clearing the first slice of a multi-slice image

Now that we're tracking aux properly per-slice, we can enable this for
applications which actually care.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/cmd_buffer: Rework aux tracking
Jason Ekstrand [Tue, 21 Nov 2017 16:46:25 +0000 (08:46 -0800)]
anv/cmd_buffer: Rework aux tracking

This commit completely reworks aux tracking.  This includes a number of
somewhat distinct changes:

 1) Since we are no longer fast-clearing multiple slices, we only need
    to track one fast clear color and one fast clear type.

 2) We store two bits for fast clear instead of one to let us
    distinguish between zero and non-zero fast clear colors.  This is
    needed so that we can do full resolves when transitioning to
    PRESENT_SRC_KHR with gen9 CCS images where we allow zero clear
    values in all sorts of places we wouldn't normally.

 3) We now track compression state as a boolean separate from fast clear
    type and this is tracked on a per-slice granularity.

The previous scheme had some issues when it came to individual slices of
a multi-LOD images.  In particular, we only tracked "needs resolve"
per-LOD but you could do a vkCmdPipelineBarrier that would only resolve
a portion of the image and would set "needs resolve" to false anyway.
Also, any transition from an undefined layout would reset the clear
color for the entire LOD regardless of whether or not there was some
clear color on some other slice.

As far as full/partial resolves go, he assumptions of the previous
scheme held because the one case where we do need a full resolve when
CCS_E is enabled is for window-system images.  Since we only ever
allowed X-tiled window-system images, CCS was entirely disabled on gen9+
and we never got CCS_E.  With the advent of Y-tiled window-system
buffers, we now need to properly support doing a full resolve of images
marked CCS_E.

v2 (Jason Ekstrand):
 - Fix an bug in the compressed flag offset calculation
 - Treat 3D images as multi-slice for the purposes of resolve tracking

v3 (Jason Ekstrand):
 - Set the compressed flag whenever we fast-clear
 - Simplify the resolve predicate computation logic

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/cmd_buffer: Move the mi_alu helper higher up
Jason Ekstrand [Fri, 19 Jan 2018 00:08:31 +0000 (16:08 -0800)]
anv/cmd_buffer: Move the mi_alu helper higher up

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/image: Simplify some verbose commennts
Jason Ekstrand [Thu, 18 Jan 2018 17:17:17 +0000 (09:17 -0800)]
anv/image: Simplify some verbose commennts

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv: Use blorp_ccs_ambiguate instead of fast-clears
Jason Ekstrand [Tue, 28 Nov 2017 02:09:48 +0000 (18:09 -0800)]
anv: Use blorp_ccs_ambiguate instead of fast-clears

Even though the blorp pass looks a bit on the sketchy side, the end
result in the Vulkan driver is very nice.  Instead of having this weird
case where you do a fast clear and then maybe have to resolve, we just
do the ambiguate and are done with it.  The ambiguate does exactly what
we want of setting all the CCS values to 0 which puts it into the
pass-through state.

This should also improve performance a bit in certain cases.  For
instance, if we did a transition from UNDEFINED to GENERAL for a surface
that doesn't have CCS enabled all the time, we would end up doing a
fast-clear and then a full resolve which ends up touching every byte in
the main surface as well as the CCS.  With the ambiguate pass, that
transition only touches the CCS.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/cmd_buffer: Re-arrange the logic around UNDEFINED fast-clears
Jason Ekstrand [Tue, 28 Nov 2017 02:07:57 +0000 (18:07 -0800)]
anv/cmd_buffer: Re-arrange the logic around UNDEFINED fast-clears

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/cmd_buffer: Pull the undefined layout condition into the if
Jason Ekstrand [Tue, 28 Nov 2017 02:06:47 +0000 (18:06 -0800)]
anv/cmd_buffer: Pull the undefined layout condition into the if

Now that this isn't a multi-case if and it's just the one case, it's a
bit clearer if the condition is just part of the if instead of being
pulled out into a boolean variable.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agointel/blorp: Add a CCS ambiguation pass
Jason Ekstrand [Thu, 18 May 2017 03:33:21 +0000 (20:33 -0700)]
intel/blorp: Add a CCS ambiguation pass

This pass performs an "ambiguate" operation on a CCS-compressed surface
by manually writing zeros into the CCS.  On gen8+, ISL gives us a fairly
detailed notion of how the CCS is laid out so this is fairly simple to
do.  On gen7, the CCS tiling is quite crazy but that isn't an issue
because we can only do CCS on single-slice images so we can just blast
over the entire CCS buffer if we want to.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv: Only fast clear single-slice images
Jason Ekstrand [Thu, 18 Jan 2018 05:31:09 +0000 (21:31 -0800)]
anv: Only fast clear single-slice images

The current strategy we use for managing resolves has an issues where we
track clear colors and the need for resolves per-LOD but we still allow
resolves of only a subset of the slices in any given LOD and doing so
sets the "needs resolve" flag for that LOD to false while leaving the
remaining layers unresolved.  This patch is only the first step and does
not, by itself fix anything.  However, it's fairly self-contained and
splitting it out means any performance regressions should bisect to this
nice obvious commit rather than to the giant "rework aux tracking"
commit.

Nanley and I did some testing and none of the applications we tested
even tried to fast-clear anything other than the first slice of an
image.  The test was done by adding a printf right before we call
blorp_fast_clear if we were every going to touch any slice other than
the first with a fast-clear.  Due to the way the original code was
structured, this would not have included applications which only cleared
a subset of layers.  The applications tested were:

 * All Sascha Willems demos
 * Aztec Ruins
 * Dota 2
 * The Talos Principle
 * Mad Max
 * Warhammer 40,000: Dawn of War III
 * Serious Sam Fusion 2017: BFE

While not the full list of shipping applications, it's a pretty good
spread and covers most of the engines we've seen running on our driver.
If this is ever shown to be a performance problem in the future, we can
reconsider our strategy.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/cmd_buffer: Add a mark_image_written helper
Jason Ekstrand [Mon, 27 Nov 2017 16:35:12 +0000 (08:35 -0800)]
anv/cmd_buffer: Add a mark_image_written helper

Currently, this helper does nothing but we call it every place where an
image is written through the render pipeline.  This will allow us to
properly mark the aux state so that we can handle resolves correctly.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/blorp: Add src/dst_level helper variables in CmdCopyImage
Jason Ekstrand [Fri, 19 Jan 2018 17:12:17 +0000 (09:12 -0800)]
anv/blorp: Add src/dst_level helper variables in CmdCopyImage

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/cmd_buffer: Add an anv_genX_call macro
Jason Ekstrand [Mon, 27 Nov 2017 16:29:34 +0000 (08:29 -0800)]
anv/cmd_buffer: Add an anv_genX_call macro

This is copied and pasted from the similar macro we added to ISL.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/cmd_buffer: Generalize transition_color_buffer
Jason Ekstrand [Mon, 20 Nov 2017 18:12:37 +0000 (10:12 -0800)]
anv/cmd_buffer: Generalize transition_color_buffer

This moves it to being based on layout_to_aux_usage instead of being
hard-coded based on bits of a priori knowledge of how transitions
interact with layouts.  This conceptually simplifies things because
we're now using layout_to_aux_usage and layout_supports_fast_clear to
make resolve decisions so changes to those functions will do what one
expects.

There is a potential bug with window system integration on gen9+ where
we wouldn't do a resolve when transitioning to the PRESENT_SRC layout
because we just assume that everything that handles CCS_E can handle it
all the time.  When handing a CCS_E image off to the window system, we
may need to do a full resolve if the window system does not support the
CCS_E modifier.  The only reason why this hasn't been a problem yet is
because we don't support modifiers in Vulkan WSI and so we always get X
tiling which implies no CCS on gen9+.  This patch doesn't actually fix
that bug yet but it takes us the first step in that direction by making
us actually pick the correct resolve op.  In order to handle all of the
cases, we need more detailed aux tracking.

v2 (Jason Ekstrand):
 - Make a few more things const
 - Use the anv_fast_clear_support enum

v3 (Jason Ekstrand):
 - Move an assert and add a better comment

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/cmd_buffer: Recurse in transition_color_buffer instead of falling through
Jason Ekstrand [Mon, 20 Nov 2017 18:05:54 +0000 (10:05 -0800)]
anv/cmd_buffer: Recurse in transition_color_buffer instead of falling through

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/image: Support color aspects in layout_to_aux_usage
Jason Ekstrand [Mon, 20 Nov 2017 20:05:20 +0000 (12:05 -0800)]
anv/image: Support color aspects in layout_to_aux_usage

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/image: Add a helper for determining when fast clears are supported
Jason Ekstrand [Mon, 20 Nov 2017 17:48:39 +0000 (09:48 -0800)]
anv/image: Add a helper for determining when fast clears are supported

v2 (Jason Ekstrand):
 - Return an enum instead of a boolean

v3 (Jason Ekstrand):
 - Return ANV_FAST_CLEAR_NONE instead of false (Topi)
 - Rename ANV_FAST_CLEAR_ANY to ANV_FAST_CLEAR_DEFAULT_VALUE
 - Add documentation for the enum values

v4 (Jason Ekstrand):
 - Remove a dead comment

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/image: Update a comment
Jason Ekstrand [Mon, 20 Nov 2017 17:47:47 +0000 (09:47 -0800)]
anv/image: Update a comment

This got lost in all of the aspect vs. plane rebasing of YCBCR.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/blorp: Rework HiZ ops to look like MCS and CCS
Jason Ekstrand [Tue, 21 Nov 2017 18:20:57 +0000 (10:20 -0800)]
anv/blorp: Rework HiZ ops to look like MCS and CCS

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/blorp: Support ISL_AUX_USAGE_HIZ in surf_for_anv_image
Jason Ekstrand [Tue, 21 Nov 2017 20:10:30 +0000 (12:10 -0800)]
anv/blorp: Support ISL_AUX_USAGE_HIZ in surf_for_anv_image

If the function gets passed ANV_AUX_USAGE_DEFAULT, it still has the old
behavior of setting ISL_AUX_USAGE_NONE for depth/stencil which is what
we want for blits/copies.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agoanv/blorp: Rework image clear/resolve helpers
Jason Ekstrand [Tue, 21 Nov 2017 17:56:41 +0000 (09:56 -0800)]
anv/blorp: Rework image clear/resolve helpers

This replaces image_fast_clear and ccs_resolve with two new helpers that
simply perform an isl_aux_op whatever that may be on CCS or MCS.  This
is a bit cleaner as it separates performing the aux operation from which
blorp helper we have to call to do it.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agointel/isl: Codify AUX operations in an enum
Jason Ekstrand [Tue, 21 Nov 2017 17:16:18 +0000 (09:16 -0800)]
intel/isl: Codify AUX operations in an enum

Right now, we have different entrypoints and enums in blorp for these
different operations.  This provides us a central enum which we can
begin to transition to.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
6 years agor600/sb: Check whether optimizations would result in reladdr conflict
Gert Wollny [Thu, 8 Feb 2018 14:11:58 +0000 (15:11 +0100)]
r600/sb: Check whether optimizations would result in reladdr conflict

v2: * Check whether the node src and dst registers are NULL before using
      them.
    * fix a type in the commit message.

Two cases are handled with this patch:

1. If copy propagation tries to eliminated a move from a relative
   array access then it could optimize

     MOV R1, ARRAY[RELADDR_1]
     MOV R2, ARRAY[RELADDR_2]
     OP2 R3, R1 R2

   into

     OP2 R3, ARRAY[RELADDR_1], ARRAY[RELADDR_2]

   which is forbidden, because there is only one address register available.

2. When MULADD(x,a,MUL(x,c)) is handled

      MUL TMP, R1, ARRAY[RELADDR_1]
      MULLADD R3, R1, ARRAY[RELADDR_2], TMP

   by folding this into

      ADD TMP, ARRAY[RELADDR_2], ARRAY[RELADDR_1]
      MUL R3, R1, TMP

   which is also forbidden.

Test for these cases and reject the optimization if a forbidden combination
of relative access would be created.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103142
Signed-off-by: Gert Wollny <gw.fossdev@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agor600g: Implement spilling of temp arrays (v2)
Glenn Kennard [Sun, 5 Mar 2017 17:26:54 +0000 (18:26 +0100)]
r600g: Implement spilling of temp arrays (v2)

Pessimistically spills arrays if GPR limit is exceeded.

v2: fix r600 support [airlied]

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agor600/sb: handle scratch mem reads on r600
Dave Airlie [Tue, 6 Feb 2018 04:17:46 +0000 (14:17 +1000)]
r600/sb: handle scratch mem reads on r600

On r600 we use the scratch mem with read/read_ind, in that case
sb should track the rw_gpr as a dst instead of a src.

This stops the whole shader being optimised out.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agor600g/sb: Add dependency tracking for scratch ops
Glenn Kennard [Sun, 5 Mar 2017 17:26:53 +0000 (18:26 +0100)]
r600g/sb: Add dependency tracking for scratch ops

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agor600g/sb: Support scratch ops
Glenn Kennard [Sun, 5 Mar 2017 17:26:52 +0000 (18:26 +0100)]
r600g/sb: Support scratch ops

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agor600g: Implement scratch buffer state management (v2)
Glenn Kennard [Sun, 5 Mar 2017 17:26:51 +0000 (18:26 +0100)]
r600g: Implement scratch buffer state management (v2)

v2: add Glenn's fixes

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agor600g: Add pending output function
Glenn Kennard [Sun, 5 Mar 2017 17:26:50 +0000 (18:26 +0100)]
r600g: Add pending output function

Spills have to happen after the VLIW bundle currently
processed, so defer emitting the spill op.

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agor600g: Support emitting scratch ops
Glenn Kennard [Sun, 5 Mar 2017 17:26:49 +0000 (18:26 +0100)]
r600g: Support emitting scratch ops

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agor600: fix texture gather swizzling.
Dave Airlie [Thu, 8 Feb 2018 06:19:28 +0000 (16:19 +1000)]
r600: fix texture gather swizzling.

This fixes:
KHR-GL45.texture_gather.swizzle
on cayman and redwood.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac: add 64bit support to ac_find_lsb()
Timothy Arceri [Tue, 6 Feb 2018 03:38:57 +0000 (14:38 +1100)]
ac: add 64bit support to ac_find_lsb()

v2: use LLVMBuildTrunc()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoac: move get_elem_bits() to ac_llvm_build.c
Timothy Arceri [Tue, 6 Feb 2018 03:38:19 +0000 (14:38 +1100)]
ac: move get_elem_bits() to ac_llvm_build.c

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoac: add 64bit bitCount support
Timothy Arceri [Tue, 6 Feb 2018 03:34:55 +0000 (14:34 +1100)]
ac: add 64bit bitCount support

v2: use LLVMBuildTrunc()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoac/nir: clean up handle_fs_outputs_post()
Samuel Pitoiset [Thu, 8 Feb 2018 13:56:48 +0000 (14:56 +0100)]
ac/nir: clean up handle_fs_outputs_post()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac/nir: add radv_load_output() helper
Samuel Pitoiset [Thu, 8 Feb 2018 13:56:47 +0000 (14:56 +0100)]
ac/nir: add radv_load_output() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac/shader: scan info about output PS declarations
Samuel Pitoiset [Thu, 8 Feb 2018 13:56:46 +0000 (14:56 +0100)]
ac/shader: scan info about output PS declarations

NIR->LLVM should only be a translation pass, and all scan stuff
should be done before.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac/nir: add radv_export_param() helper
Samuel Pitoiset [Thu, 8 Feb 2018 13:56:45 +0000 (14:56 +0100)]
ac/nir: add radv_export_param() helper

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac/nir: remove set but unused export_mask
Samuel Pitoiset [Thu, 8 Feb 2018 13:56:44 +0000 (14:56 +0100)]
ac/nir: remove set but unused export_mask

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac/nir: remove dead code in handle_vs_outputs_post()
Samuel Pitoiset [Thu, 8 Feb 2018 13:56:43 +0000 (14:56 +0100)]
ac/nir: remove dead code in handle_vs_outputs_post()

The memcpy can't be reached because the condition is always false.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac/nir: remove useless check in si_llvm_init_export_args()
Samuel Pitoiset [Thu, 8 Feb 2018 13:56:42 +0000 (14:56 +0100)]
ac/nir: remove useless check in si_llvm_init_export_args()

values can't be NULL because we use ac_build_export_null() now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac/nir: use ac_build_export_null()
Samuel Pitoiset [Wed, 7 Feb 2018 18:09:13 +0000 (19:09 +0100)]
ac/nir: use ac_build_export_null()

The number of enabled channels should be 0 when exporting null.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac: add ac_build_export_null() helper
Samuel Pitoiset [Wed, 7 Feb 2018 18:09:12 +0000 (19:09 +0100)]
ac: add ac_build_export_null() helper

Imported from RadeonSI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agomeson: Add build option for tools
Scott D Phillips [Thu, 8 Feb 2018 00:55:24 +0000 (16:55 -0800)]
meson: Add build option for tools

Add a build option to control building some of the misc tools we
have. Also set the executables to install, presumably you want
that if you're asking for the build.

v2: set 'install:' to the with_tools value, not true (Jordan)
    handle 'all' in a the comma list (Dylan)
    Add freedreno's tools (Dylan)

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agointel: Add Coffee Lake brand strings
Anuj Phogat [Mon, 29 Jan 2018 18:42:17 +0000 (10:42 -0800)]
intel: Add Coffee Lake brand strings

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agogallium/util: silence clang warning in blitter code
Brian Paul [Thu, 8 Feb 2018 17:00:21 +0000 (10:00 -0700)]
gallium/util: silence clang warning in blitter code

Silence "warning: comparison of constant 4294967295 with expression
of type 'ubyte'".

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agotgsi: s/unsigned/enum tgsi_semantic/ in ureg_DECL_output()
Brian Paul [Thu, 8 Feb 2018 16:54:52 +0000 (09:54 -0700)]
tgsi: s/unsigned/enum tgsi_semantic/ in ureg_DECL_output()

So the function matches the prototype.  Found with clang.
v2: fix copy&paste error

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agotgsi: use TGSI_INTERPOLATE_x arguments instead of zeros in ureg code
Brian Paul [Thu, 8 Feb 2018 01:29:12 +0000 (18:29 -0700)]
tgsi: use TGSI_INTERPOLATE_x arguments instead of zeros in ureg code

TGSI_INTERPOLATE_CONSTANT and TGSI_INTERPOLATE_LOC_CENTER have the
value zero so there's no change in behavior.  It seems funny to
declare these fs input registers with constant interpolation.  But
it looks like ureg_DECL_input_layout() is not called anywhere and
ureg_DECL_input() is only called from
util_make_geometry_passthrough_shader().

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agogallium/util: s/uint/enum tgsi_semantic/ in simple shader code
Brian Paul [Thu, 8 Feb 2018 01:28:34 +0000 (18:28 -0700)]
gallium/util: s/uint/enum tgsi_semantic/ in simple shader code

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agotgsi: s/unsigned/enum pipe_shader_type/ in ureg code
Brian Paul [Thu, 8 Feb 2018 01:18:39 +0000 (18:18 -0700)]
tgsi: s/unsigned/enum pipe_shader_type/ in ureg code

And add a default switch case to silence a compiler warning.

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agogallium/util: s/uint/enum tgsi_semantic/ in u_blitter.c
Brian Paul [Wed, 7 Feb 2018 23:14:11 +0000 (16:14 -0700)]
gallium/util: s/uint/enum tgsi_semantic/ in u_blitter.c

And put static qualifier on const arrays.

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agost/mesa: s/unsigned/enum tgsi_semantic/ st_cb_drawpixels.c
Brian Paul [Wed, 7 Feb 2018 23:12:59 +0000 (16:12 -0700)]
st/mesa: s/unsigned/enum tgsi_semantic/ st_cb_drawpixels.c

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agovbo: add a comment on vbo_draw_transform_feedback()
Brian Paul [Wed, 7 Feb 2018 23:12:35 +0000 (16:12 -0700)]
vbo: add a comment on vbo_draw_transform_feedback()

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agogallium/util: trivial whitespace/formatting fixes in u_blit.c
Brian Paul [Wed, 7 Feb 2018 16:28:16 +0000 (09:28 -0700)]
gallium/util: trivial whitespace/formatting fixes in u_blit.c

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agovbo: improve comments on vbo_draw_func()
Brian Paul [Tue, 6 Feb 2018 22:35:30 +0000 (15:35 -0700)]
vbo: improve comments on vbo_draw_func()

And rename a parameter name.

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agocso: add a couple sanity check assertions in cso_draw_vbo()
Brian Paul [Tue, 6 Feb 2018 22:33:37 +0000 (15:33 -0700)]
cso: add a couple sanity check assertions in cso_draw_vbo()

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agost/mesa: rename some vars related to indirect draw count
Brian Paul [Wed, 31 Jan 2018 22:01:09 +0000 (15:01 -0700)]
st/mesa: rename some vars related to indirect draw count

'indirect_params' was a bit vague.  Use the names that we use in
gallium's pipe_draw_indirect_info.

Reviewed-by: Mathias Fröhlich <mathias.froehlich@web.de>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agost/mesa: remove out_num_textures from update_textures
Marek Olšák [Thu, 16 Nov 2017 15:01:11 +0000 (16:01 +0100)]
st/mesa: remove out_num_textures from update_textures

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agost/mesa: don't store non-fragment sampler states and views in st_context
Marek Olšák [Wed, 15 Nov 2017 23:32:22 +0000 (00:32 +0100)]
st/mesa: don't store non-fragment sampler states and views in st_context

those are unused.

st_context: 10120 -> 3704 bytes

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoi965: perf: cleanup detection of kernel support for loadable configs
Lionel Landwerlin [Tue, 6 Feb 2018 23:28:24 +0000 (23:28 +0000)]
i965: perf: cleanup detection of kernel support for loadable configs

The initial revision of the patch adding loadable configs was testing
the feature's availability by adding a new config successfully and
then removing it.

A second version tested the availability just by exercising the
removal. But some unused code remained.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agoi965: perf: use drmIoctl() instead of ioctl()
Lionel Landwerlin [Tue, 6 Feb 2018 23:23:22 +0000 (23:23 +0000)]
i965: perf: use drmIoctl() instead of ioctl()

ioctl() might be interrupted, use drmIoctl() instead as it'll retry
automatically.

Fixes: 27ee83eaf7e "i965: perf: add support for userspace configurations"
Cc: "18.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
6 years agoi965: perf: add debug messages for loaded configs
Lionel Landwerlin [Tue, 6 Feb 2018 17:00:58 +0000 (17:00 +0000)]
i965: perf: add debug messages for loaded configs

This helps figuring out potential problems when metrics don't show up
on frameretrace for example.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agor600: implement tg4 integer workaround. (v2)
Dave Airlie [Thu, 8 Feb 2018 02:35:46 +0000 (12:35 +1000)]
r600: implement tg4 integer workaround. (v2)

This ports the texture gather integer workaround from radeonsi.

This fixes:
KHR-GL45.texture_gather.plain-gather-uint/int*

v2: add rect support, fix 2d array shadow
Reviewed-by: Roland Scheidegger <sroland@vmware.com> (on irc)
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: clean up initial shader register setup
Glenn Kennard [Tue, 6 Feb 2018 20:24:07 +0000 (06:24 +1000)]
r600: clean up initial shader register setup

This is taken from Glenn Kennards scratch series, but separated
out as a cleanup by me.

Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agor600: partly fix sampleMaskIn value
Roland Scheidegger [Sun, 4 Feb 2018 22:54:26 +0000 (23:54 +0100)]
r600: partly fix sampleMaskIn value

The hw gives us coverage for pixel, not for individual fragment shader
invocations, in case execution isn't per pixel (eg, unlike cm, actually
cannot do "real" minSampleShading, it's either per-pixel or per-fragment,
but it doesn't really make a difference here).
Also, with msaa disabled, the hw still gives us a mask corresponding to
the number of samples, where GL requires this to be 1.
Fix this up by masking the sampleMaskIn bits with the bit corresponding to
the sampleID, if we know this shader is always executed at per-sample
granularity. (In case of a per-sample frequency shader and msaa disabled,
the sampleID will always be 0, so this works just fine there.)
Fixing this for the minSampleShading case will need a shader key (radeonsi
uses the prolog part for) (for eg, could get away with a single bit, cm
would need more bits depending on sample/invocation ratio, or read the
bits from a uniform), unless we'd want to always use a sample mask uniform
(which is probably not a good idea, as it would make the ordinary common
msaa case slower for no good reason).
This fixes some parts of piglit arb_sample_shading-samplemask (with fixed
test), in particular those which use a sampleID, still failing others
as expected.

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agor600: clean up fragment shader input scan code
Roland Scheidegger [Sun, 4 Feb 2018 22:38:28 +0000 (23:38 +0100)]
r600: clean up fragment shader input scan code

For some reason, we were iterating through the code twice (first just for
instructions needing barycentrics, then for instructions and input dcls).
Move things around slightly so this is no longer necessary.
There also was a unnedeed enabling of the fixed_pt_position_gpr - this is only
needed if the per-sample interpolation comes from an input, not from an
instruction (just move the assert where it belongs) (since the sample id to
sample from comes from a tgsi src in this case, and isn't sampleID).
Otherwise there should be no functional change.

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agomesa: (trivial) remove unused ignore_sample_qualifier_parameter
Roland Scheidegger [Sat, 3 Feb 2018 23:32:05 +0000 (00:32 +0100)]
mesa: (trivial) remove unused ignore_sample_qualifier_parameter

This parameter for _mesa_get_min_incations_per_fragment() was once used
by the intel driver, but it's long gone.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Dave Airlie <airlied@vmware.com>
6 years agor600/cm: (trivial) code cleanup for emitting msaa state
Roland Scheidegger [Sat, 3 Feb 2018 19:11:35 +0000 (20:11 +0100)]
r600/cm: (trivial) code cleanup for emitting msaa state

No functional change (compile tested only).

Reviewed-by: Dave Airlie <airlied@redhate.com>
6 years agotgsi: use tgsi_semantic enum type in ureg code
Brian Paul [Wed, 7 Feb 2018 05:17:10 +0000 (22:17 -0700)]
tgsi: use tgsi_semantic enum type in ureg code

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agost/mesa: use tgsi_semantic enum type
Brian Paul [Wed, 7 Feb 2018 05:16:41 +0000 (22:16 -0700)]
st/mesa: use tgsi_semantic enum type

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agotgsi: use TGSI enum types in ureg code
Brian Paul [Wed, 7 Feb 2018 05:11:41 +0000 (22:11 -0700)]
tgsi: use TGSI enum types in ureg code

v2: fix enum tgsi_interpolate_mode/loc typo.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agost/mesa: use TGSI enum types in st_glsl_to_tgsi.cpp
Brian Paul [Wed, 7 Feb 2018 05:10:59 +0000 (22:10 -0700)]
st/mesa: use TGSI enum types in st_glsl_to_tgsi.cpp

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agogallium/util: replace uint with tgsi enum types
Brian Paul [Wed, 7 Feb 2018 04:55:10 +0000 (21:55 -0700)]
gallium/util: replace uint with tgsi enum types

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agogallium/util: replace unsigned with tgsi enum types
Brian Paul [Wed, 7 Feb 2018 04:54:38 +0000 (21:54 -0700)]
gallium/util: replace unsigned with tgsi enum types

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agoradv: implement VK_EXT_external_memory_host
Fredrik Höglund [Thu, 25 Jan 2018 17:12:14 +0000 (18:12 +0100)]
radv: implement VK_EXT_external_memory_host

Ported from the radeonsi GL_AMD_pinned_memory implementation.

Signed-off-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agor600: fix rendering regression on r6/7 gpus
Dave Airlie [Wed, 7 Feb 2018 22:12:36 +0000 (08:12 +1000)]
r600: fix rendering regression on r6/7 gpus

Fixes: 2d5b5d267e (r600: work out target mask at framebuffer bind.)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104989

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradeonsi: avoid int-to-pointer-cast warnings on 32bit
Grazvydas Ignotas [Sat, 3 Feb 2018 21:54:28 +0000 (23:54 +0200)]
radeonsi: avoid int-to-pointer-cast warnings on 32bit

I hope the actual dropping of MSB is ok, but that's what's already
happened before this change.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agogallium/hud: update some query functions
Grazvydas Ignotas [Sat, 3 Feb 2018 21:42:28 +0000 (23:42 +0200)]
gallium/hud: update some query functions

It seems these were missed when struct pipe_context * argument was
added to hud_graph::query_new_value.

Fixes: 3132afdf4c "gallium/hud: pass pipe_context explicitly to most functions"
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoRevert "gallium: build ddebug, noop, rbug, trace as part of auxiliary"
Roland Scheidegger [Wed, 7 Feb 2018 22:47:39 +0000 (23:47 +0100)]
Revert "gallium: build ddebug, noop, rbug, trace as part of auxiliary"

This reverts commit 6f82b8d8d0a986aac28e7bec47fc313fb950475c.

This broke scons build, and reportedly clover with autotools/meson too.

6 years agogallium: build ddebug, noop, rbug, trace as part of auxiliary
Marek Olšák [Mon, 4 Sep 2017 20:36:34 +0000 (22:36 +0200)]
gallium: build ddebug, noop, rbug, trace as part of auxiliary

Building gallium is faster by 7.5 seconds on a 4core/8thread 3GHz CPU.
(gallium build time is reduced by 15% when building only radeonsi)

Non-recursive makefiles are great!

6 years agou_blit: (trivial) fix bogus argument order for set_fragment_shader
Roland Scheidegger [Wed, 7 Feb 2018 21:02:54 +0000 (22:02 +0100)]
u_blit: (trivial) fix bogus argument order for set_fragment_shader

Amazingly this still worked sometimes, albeit I'm not even sure why...
This fixes d7bec6f7a6a2a35c80be939db8532011af1e9b67.

6 years agomesa: fix incorrect type when allocating arrays
Andres Rodriguez [Wed, 7 Feb 2018 19:38:52 +0000 (14:38 -0500)]
mesa: fix incorrect type when allocating arrays

The array members are have type 'struct gl_buffer_object *'

Found by coverity.

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agou_blit,u_simple_shaders: add shader to convert from xrbias format
Roland Scheidegger [Wed, 7 Feb 2018 04:18:17 +0000 (05:18 +0100)]
u_blit,u_simple_shaders: add shader to convert from xrbias format

We need this to handle some oddball dx10 format
(DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM). What you can do with this
format is very limited, hence we don't want to add it as a gallium
format (we could not express the properties of this format as
ordinary format properties neither, so like all special formats
it would need specific code for handling it in any case).
While here, also nuke the array for different shaders for different
writemasks, as it was not actually used (always full masks are
passed in for generating shaders).

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agou_simple_shaders: fix mask handling in util_make_fragment_tex_shader_writemask
Roland Scheidegger [Wed, 7 Feb 2018 04:03:42 +0000 (05:03 +0100)]
u_simple_shaders: fix mask handling in util_make_fragment_tex_shader_writemask

The writemask handling was busted, since writing defaults to output
meant they got overwritten by the tex sampling anyway. Albeit the
affected components were undefined, so maybe with some luck it
still would have worked with some drivers - if not could as well
kill it... (This would have affected u_blitter but not u_blit since
the latter always used xyzw mask.)

Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agoautotools: Only build libmesa-st-tests-common.a for tests.
Bas Nieuwenhuizen [Fri, 2 Feb 2018 15:59:23 +0000 (16:59 +0100)]
autotools: Only build libmesa-st-tests-common.a for tests.

We don't need the library if we don't build tests, and building
it adds a dependency on gtest which adds a dependency on cxxabi.h.

Fixes: 6569b33b6e "mesa/st/tests: unify MockCodeLine* classes"
Reviewed-By: Gert Wollny <gw.fossdev@gmail.com>
6 years agoi965: add __DRI2_BLOB support and set cache functions
Tapani Pälli [Wed, 17 Jan 2018 09:43:59 +0000 (11:43 +0200)]
i965: add __DRI2_BLOB support and set cache functions

v2: adjust to change that moved cache from ctx to screen

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agodisk cache: add callback functionality
Tapani Pälli [Wed, 7 Feb 2018 06:13:00 +0000 (08:13 +0200)]
disk cache: add callback functionality

v2: add disk_cache_has_key, disk_cache_put_key support
    using blob cache (Nicolai, Jordan)

v3: rename set_cb as put_cb to match existing naming (Timothy)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agodisk cache: initialize cache path and index only when used
Tapani Pälli [Mon, 22 Jan 2018 09:55:06 +0000 (11:55 +0200)]
disk cache: initialize cache path and index only when used

This patch makes disk_cache initialize path and index lazily so
that we can utilize disk_cache without a path using callback
functionality introduced by next patch.

v2: unmap mmap and destroy queue only if index_mmap exists

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoglsl/tests: changes to test_disk_cache_create test
Tapani Pälli [Thu, 1 Feb 2018 07:08:52 +0000 (09:08 +0200)]
glsl/tests: changes to test_disk_cache_create test

Next patch will allow disk_cache instance to be created without
path set for it, modify some test cases that assume disk_cache
creation to fail with invalid path. Creation should succeed but
simple put/get test fail.

v2: leave tests as is but check that both cache struct exists
    and try simple put/get that should fail with invalid path set
    (Emil)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> (v1)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoglsl/tests: move utility functions in cache_test
Tapani Pälli [Tue, 30 Jan 2018 09:42:55 +0000 (11:42 +0200)]
glsl/tests: move utility functions in cache_test

Patch moves functions higher so that we can utilize them from
test_disk_cache_create which is modified by next patch.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoegl: add support for EGL_ANDROID_blob_cache
Tapani Pälli [Thu, 28 Dec 2017 08:51:11 +0000 (10:51 +0200)]
egl: add support for EGL_ANDROID_blob_cache

v2: cleanup, move callbacks to _egl_display struct (Emil Velikov)
    adapt to earlier ctx->screen changes

v3: remove useless checking, add _eglSetFuncName (Emil Velikov)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com> (v2)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agodri: add interface for EGL_ANDROID_blob_cache extension
Tapani Pälli [Thu, 28 Dec 2017 07:27:24 +0000 (09:27 +0200)]
dri: add interface for EGL_ANDROID_blob_cache extension

v2: move from __DRIcontext to __DRIscreen (Emil Velikov)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoac/nir: use new pknorm_i16/u16 and pk_i16/u16 LLVM intrinsics
Samuel Pitoiset [Tue, 6 Feb 2018 21:06:11 +0000 (22:06 +0100)]
ac/nir: use new pknorm_i16/u16 and pk_i16/u16 LLVM intrinsics

Ported from RadeonSI.

Only one F1 2017 shader is affected, code size decreased
from 532 to 488 on both Polaris10 and Vega10.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac/nir: avoid loading unused VS input components
Samuel Pitoiset [Thu, 1 Feb 2018 10:35:06 +0000 (11:35 +0100)]
ac/nir: avoid loading unused VS input components

Polaris10:
Totals from affected shaders:
SGPRS: 122840 -> 120984 (-1.51 %)
VGPRS: 78812 -> 78440 (-0.47 %)
Spilled SGPRs: 177 -> 129 (-27.12 %)
Code Size: 2950028 -> 2941276 (-0.30 %) bytes
Max Waves: 17899 -> 17976 (0.43 %)

Vega10:
Totals from affected shaders:
SGPRS: 117144 -> 115776 (-1.17 %)
VGPRS: 77580 -> 77532 (-0.06 %)
Spilled SGPRs: 0 -> 152 (0.00 %)
Code Size: 3352656 -> 3347860 (-0.14 %) bytes
Max Waves: 19756 -> 19866 (0.56 %)

This increases SGPRs spilling a bit with Talos, but I have
some other ideas that might reduce it.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac/shader: scan vertex inputs usage mask
Samuel Pitoiset [Thu, 1 Feb 2018 10:32:32 +0000 (11:32 +0100)]
ac/shader: scan vertex inputs usage mask

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoi965: allocate a SGVS element when VertexID or InstanceID are read
Iago Toral Quiroga [Thu, 4 Jan 2018 02:55:13 +0000 (03:55 +0100)]
i965: allocate a SGVS element when VertexID or InstanceID are read

Although on gen8+ platforms we can in theory use 3DSTATE_VF_SGVS
to put these beyond the last vertex element it seems that we still
need to allocate the SVGS element, otherwise we have observed cases
where we end up reading garbage. Specifically, the CTS test mentioned
below was flaky with a fail rate of ~1% on some gen9+ platforms caused
by reading garbage for the gl_InstanceID value. The flakyness goes
away as soon as we start allocating the SVGS element.

v2:
  - Do this for gen8+, not just gen9+, and pull the boolean
    outside the #if block (Jason)

Fixes flaky test:
KHR-GL45.vertex_attrib_64bit.limits_test

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104335
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>