mesa.git
3 years agomesa|mapi: replace _mesa_[v]snprintf with [v]snprintf
Dylan Baker [Mon, 9 Dec 2019 18:54:16 +0000 (10:54 -0800)]
mesa|mapi: replace _mesa_[v]snprintf with [v]snprintf

MSVC 2015 and newer has perfectly valid snprintf and vsnprintf
implementations, let's just use those.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agoreplace imports memory functions with utils memory functions
Dylan Baker [Wed, 12 Sep 2018 23:31:13 +0000 (16:31 -0700)]
replace imports memory functions with utils memory functions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agoutil: Add an aligned realloc function
Dylan Baker [Wed, 12 Sep 2018 23:26:38 +0000 (16:26 -0700)]
util: Add an aligned realloc function

Mesa has one of these in imports.h, so u_memory needs one as well. This
is the version from mesa ported.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agoreplace malloc macros in imports.h with u_memory.h versions
Dylan Baker [Wed, 12 Sep 2018 22:56:30 +0000 (15:56 -0700)]
replace malloc macros in imports.h with u_memory.h versions

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agoReplace IS_INF_OR_NAN with util_is_inf_or_nan
Dylan Baker [Mon, 10 Sep 2018 18:31:49 +0000 (11:31 -0700)]
Replace IS_INF_OR_NAN with util_is_inf_or_nan

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agomove windows strtok_r define to u_string
Dylan Baker [Mon, 10 Sep 2018 17:26:26 +0000 (10:26 -0700)]
move windows strtok_r define to u_string

This makes more sense for it, it's only used in the glsl compiler
currently, so we could probably move it there, but this seems fine for a
header only #define.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agoreplace IROUND with util functions
Dylan Baker [Mon, 10 Sep 2018 17:22:42 +0000 (10:22 -0700)]
replace IROUND with util functions

This adds two new util functions to rounding.h, _mesa_iroundf and
mesa_lround, which are just wrappers around roundf and round, that cast
to int and long int respectively. This is possible since mesa recently
dropped support for VC2013, since 2015 and 2017 support roundf.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agomesa/main: remove unused IROUNDD
Dylan Baker [Fri, 7 Sep 2018 22:04:40 +0000 (15:04 -0700)]
mesa/main: remove unused IROUNDD

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agoReplace IROUND_POS with _mesa_roundevenf
Dylan Baker [Fri, 7 Sep 2018 21:44:05 +0000 (14:44 -0700)]
Replace IROUND_POS with _mesa_roundevenf

Which has the same behavior as long as you don't change the FPU rounding
mode. Other code in mesa makes the same assumption so it should be safe
to make that assumption more generally.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agoreplace IFLOOR with util_ifloor
Dylan Baker [Thu, 6 Sep 2018 22:49:35 +0000 (15:49 -0700)]
replace IFLOOR with util_ifloor

which are exactly the same function with exactly the same implementation

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agou_math: add x86 optimized version of ifloor
Dylan Baker [Thu, 6 Sep 2018 22:30:15 +0000 (15:30 -0700)]
u_math: add x86 optimized version of ifloor

This is copied from the one in src/mesa/main/imports.h, which is the
same otherwise.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agoreplace LOG2 with util_fast_log2
Dylan Baker [Thu, 6 Sep 2018 22:26:19 +0000 (15:26 -0700)]
replace LOG2 with util_fast_log2

The implementation is somewhat different, although if you go back in
time far enough they're the same, but the one in u_math was changed a
long time back to be faster.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agoreplace _mesa_logbase2 with util_logbase2
Dylan Baker [Fri, 6 Dec 2019 17:20:09 +0000 (09:20 -0800)]
replace _mesa_logbase2 with util_logbase2

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agoreplace _mesa_next_pow_two_* with util_next_power_of_two_*
Dylan Baker [Thu, 6 Sep 2018 20:24:18 +0000 (13:24 -0700)]
replace _mesa_next_pow_two_* with util_next_power_of_two_*

The 64 bit variant in imports.h isn't even used.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agoreplace _mesa_is_pow_two with util_is_power_of_two_*
Dylan Baker [Thu, 6 Sep 2018 18:36:19 +0000 (11:36 -0700)]
replace _mesa_is_pow_two with util_is_power_of_two_*

Mostly this uses util_is_power_of_two_or_zero, which has the same
behavior as _mesa_is_pow_two when the input is zero. In cases where the
value is known to be != 0 ahead of time I used the _nonzero variant as
it may be faster on some platforms.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>

3 years agofreedreno/drm-shim: Add support for faking other adreno chips.
Eric Anholt [Sat, 18 Apr 2020 00:18:25 +0000 (17:18 -0700)]
freedreno/drm-shim: Add support for faking other adreno chips.

I wanted to look at the effect of a core NIR change on a2xx codegen, but I
don't have any of those boards.  This could also prove useful for quickly
sanity-checking the compiler by running shader-db on it -- a2xx fails in a
few ways on glmark2, and a3xx-a5xx fails on glmark2 in a debug_assert
(which we don't have enabled in our dEQP runs).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4652>

3 years agor600/sfn: use new temp register allocation when loading single value temporaries
Gert Wollny [Sun, 12 Apr 2020 14:54:03 +0000 (16:54 +0200)]
r600/sfn: use new temp register allocation when loading single value temporaries

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

3 years agor600/sfn: Count only literals that are not inline to split instruction groups
Gert Wollny [Sun, 12 Apr 2020 14:52:57 +0000 (16:52 +0200)]
r600/sfn: Count only literals that are not inline to split instruction groups

An instruction group can only support 4 distinct literals, but inline
constants count into this number, so skip them when counting.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

3 years agor600/sfn: Fix using the result of a fetch instruction in next fetch
Gert Wollny [Sun, 12 Apr 2020 14:51:07 +0000 (16:51 +0200)]
r600/sfn: Fix using the result of a fetch instruction in next fetch

The result of a fetch instruction can't be used as source in the same CF
block, so force a new CF block when the result would be used in the same
vertex fetch block.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

3 years agor600/sfn: Fix handling of GS inputs
Gert Wollny [Sun, 12 Apr 2020 14:47:31 +0000 (16:47 +0200)]
r600/sfn: Fix handling of GS inputs

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

3 years agor600/sfn: Handle b2b1 like it was a mov
Gert Wollny [Sun, 12 Apr 2020 14:43:56 +0000 (16:43 +0200)]
r600/sfn: Handle b2b1 like it was a mov

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

3 years agor600/sfn: Fix null pointer deref in live range evalation
Gert Wollny [Sun, 12 Apr 2020 14:43:23 +0000 (16:43 +0200)]
r600/sfn: Fix null pointer deref in live range evalation

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

3 years agor600/nir: Pin interpolation results to channel
Gert Wollny [Sat, 15 Feb 2020 10:14:31 +0000 (11:14 +0100)]
r600/nir: Pin interpolation results to channel

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

3 years agor600/sfn: Implementing instructions blocks
Gert Wollny [Sun, 19 Jan 2020 17:09:05 +0000 (18:09 +0100)]
r600/sfn: Implementing instructions blocks

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

3 years agor600/sfn: Fix setting alignments when lowering UBOs
Gert Wollny [Wed, 15 Apr 2020 15:03:31 +0000 (17:03 +0200)]
r600/sfn: Fix setting alignments when lowering UBOs

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

3 years agor600/sfn: Reduce array limit for scratch usage
Gert Wollny [Wed, 15 Apr 2020 15:00:54 +0000 (17:00 +0200)]
r600/sfn: Reduce array limit for scratch usage

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

3 years agor600: Dump a few more variables when requested
Gert Wollny [Wed, 15 Apr 2020 15:04:41 +0000 (17:04 +0200)]
r600: Dump a few more variables when requested

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4609>

3 years agoanv/android: fix assert in anv_import_ahw_memory
Abhishek Kumar [Tue, 21 Apr 2020 06:28:31 +0000 (06:28 +0000)]
anv/android: fix assert in anv_import_ahw_memory

Commit fixes assert that triggers when running
   dEQP-VK.api.external.memory.android_hardware_buffer.dedicated.buffer#bind_export_import_bind

on a debug build of Mesa.

Fixes: c79a528d ("anv/android: support import/export of AHardwareBuffer objects")
Signed-off-by: Abhishek Kumar <abhishek4.kumar@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4655>

3 years agost/mesa: Re-assign vs in locations after updating nir info for ffvp/ARB_vp
Danylo Piliaiev [Mon, 20 Apr 2020 14:17:53 +0000 (17:17 +0300)]
st/mesa: Re-assign vs in locations after updating nir info for ffvp/ARB_vp

After call to nir_shader_gather_info - inputs_read may have changed so
st_nir_assign_vs_in_locations should be called for shader to remain in
sync with vbo state.

Fixes piglit tests:
  gl-1.0-fpexceptions
  gl-1.1-color-material-unused-normal-array
  arb_vertex_program-unused-attributes
regression on several gallium drivers.

Fixes: d684fb37bfbc47d098158cb03c0672119a4469fe
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4645>

3 years agotu: Fix the advertised maxFragmentInputComponents
Connor Abbott [Mon, 20 Apr 2020 11:41:42 +0000 (13:41 +0200)]
tu: Fix the advertised maxFragmentInputComponents

This appears to be limited by VPC_CNTL_0::NUMNONPOSVAR, which is an
8-bit bitfield with no possibility for expansion. Also, in practice
we'll be limited by the vertex shader output maximum, which includes
gl_Position, of 128, so that users won't be able to use more than 124
components anyways. Lower it to match the GL blob.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4641>

3 years agofreedreno/a6xx: Expand various varying-count bitfields
Connor Abbott [Mon, 20 Apr 2020 11:37:33 +0000 (13:37 +0200)]
freedreno/a6xx: Expand various varying-count bitfields

The extra bit needs to be used when using the maximum of 128 varying
components. I confirmed that PC_PRIMITIVE_CNTL_1 and SP_PRIMITIVE_CNTL
are expanded using a trace of the Vulkan blob with the maximum number of
varyings, and changed the others by analogy.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4641>

3 years agodocs: remove outdated sentence
Erik Faye-Lund [Mon, 20 Apr 2020 21:08:14 +0000 (23:08 +0200)]
docs: remove outdated sentence

The releasing documentation no longer contains this step, so this seems
out of date. The anchor for this link is also removed, making it point
nowhere.

Fixes: d4cb9ef8260 ("docs: Update release notes with current process")
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4654>

3 years agost/omx: fix gcc warnings
Pierre-Eric Pelloux-Prayer [Thu, 16 Apr 2020 12:38:06 +0000 (14:38 +0200)]
st/omx: fix gcc warnings

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4584>

3 years agogallium/utils: silence strncpy warning
Pierre-Eric Pelloux-Prayer [Thu, 16 Apr 2020 08:24:24 +0000 (10:24 +0200)]
gallium/utils: silence strncpy warning

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4584>

3 years agomesa: fix crash in find_value
Pierre-Eric Pelloux-Prayer [Tue, 7 Apr 2020 07:42:39 +0000 (09:42 +0200)]
mesa: fix crash in find_value

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4584>

3 years agonir: Delete the fnoise opcodes
Jason Ekstrand [Sat, 18 Apr 2020 16:52:20 +0000 (11:52 -0500)]
nir: Delete the fnoise opcodes

As of the previous commit, they are never used.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4624>

3 years agoglsl: Hard-code noise to zero in builtin_functions.cpp
Jason Ekstrand [Mon, 20 Apr 2020 17:06:15 +0000 (12:06 -0500)]
glsl: Hard-code noise to zero in builtin_functions.cpp

Version 4.4 of the GLSL spec changed the definition of noise*() to
always return zero and earlier versions of the spec allowed zero as a
valid implementation.

All drivers, as far as I can tell, unconditionally call lower_noise()
today which turns ir_unop_noise into zero.  We've got a 10-year-old
comment in there saying "In the future, ir_unop_noise may be replaced by
a call to a function that implements noise."  Well, it's the future now
and we've not yet gotten around to that.  In the mean time, the GLSL
spec has made doing so illegal.

To make things worse, we then pretend to handle the opcode in
glsl_to_nir, ir_to_mesa, and st_glsl_to_tgsi even though it should never
get there given the lowering.  The lowering in st_glsl_to_tgsi defines
noise*() to be 0.5 which is an illegal implementation of the noise
functions according to pre-4.4 specs.  We also have opcodes for this in
NIR which are never used because, again, we always call lower_noise().

Let's just kill the whole opcode and make builtin_builder.cpp build a
bunch of functions that just return zero.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4624>

3 years agost/glsl_to_nir: make use of nir linker for linking uniforms
Timothy Arceri [Tue, 7 Jan 2020 03:38:14 +0000 (14:38 +1100)]
st/glsl_to_nir: make use of nir linker for linking uniforms

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4395>

3 years agoglsl: fix gl_nir_set_uniform_initializers() for bindless textures
Timothy Arceri [Tue, 24 Mar 2020 03:17:35 +0000 (14:17 +1100)]
glsl: fix gl_nir_set_uniform_initializers() for bindless textures

We need to skip opaque variables inside blocks, this is handled
elsewhere and will cause a crash here.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4395>

3 years agoglsl: add bindless support to nir uniform linker
Timothy Arceri [Tue, 24 Mar 2020 00:51:37 +0000 (11:51 +1100)]
glsl: add bindless support to nir uniform linker

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4395>

3 years agopick-ui: show commit sha in the pick list
Eric Engestrom [Wed, 11 Mar 2020 14:18:00 +0000 (15:18 +0100)]
pick-ui: show commit sha in the pick list

Useful to get more context when a manual merge is needed, for instance.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4651>

3 years agopick-ui: make .pick_status.json path relative to the git root instead of the script
Eric Engestrom [Tue, 10 Mar 2020 10:12:58 +0000 (11:12 +0100)]
pick-ui: make .pick_status.json path relative to the git root instead of the script

This allows the script to be called from another git worktree for instance,
which I need for my workflow :)

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4649>

3 years agopick-ui: compute .pick_status.json path only once
Eric Engestrom [Tue, 10 Mar 2020 10:10:08 +0000 (11:10 +0100)]
pick-ui: compute .pick_status.json path only once

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4649>

3 years agointel/fs: Coalesce when the src live range is contained in the dst
Jason Ekstrand [Sat, 18 Apr 2020 14:30:05 +0000 (09:30 -0500)]
intel/fs: Coalesce when the src live range is contained in the dst

Consider the following case:

    // g119-123 are written somewhere above
    mul.sat(16)   g67<1>F    g6.4<0,1,0>F   g125<8,8,1>F
    mul.sat(16)   g69<1>F    g6.5<0,1,0>F   g125<8,8,1>F
    mul.sat(16)   g71<1>F    g6.6<0,1,0>F   g125<8,8,1>F
    mov(16)       g119<1>F   g67<8,8,1>F
    mov(16)       g121<1>F   g69<8,8,1>F
    mov(16)       g123<1>F   g71<8,8,1>F

We should be able to coalesce it into

    mul.sat(16)   g119<1>F   g6.4<0,1,0>F   g125<8,8,1>F
    mul.sat(16)   g121<1>F   g6.5<0,1,0>F   g125<8,8,1>F
    mul.sat(16)   g123<1>F   g6.6<0,1,0>F   g125<8,8,1>F

What's stopping us is an overly conservative check for writes to the two
registers being coalesced.  The check walks over the intersection of
their live ranges and checks for no writes to either one.  However,
because the register which starts the live range (the mul.sat in this
case) is inside that intersection, we flag it as a write in the
intersection and don't coalesce.  However, this case is safe because the
destination register of the copy is never read after the source is
written.

Shader-db changes on ICL:

    total instructions in shared programs: 16043613 -> 16042610 (<.01%)
    instructions in affected programs: 43036 -> 42033 (-2.33%)
    helped: 226
    HURT: 0
    helped stats (abs) min: 1 max: 30 x̄: 4.44 x̃: 4
    helped stats (rel) min: 0.09% max: 26.67% x̄: 4.89% x̃: 3.43%
    95% mean confidence interval for instructions value: -4.86 -4.02
    95% mean confidence interval for instructions %-change: -5.57% -4.22%
    Instructions are helped.

    total cycles in shared programs: 334766372 -> 334710124 (-0.02%)
    cycles in affected programs: 617548 -> 561300 (-9.11%)
    helped: 214
    HURT: 2
    helped stats (abs) min: 15 max: 1512 x̄: 263.21 x̃: 212
    helped stats (rel) min: 0.30% max: 75.36% x̄: 25.30% x̃: 21.58%
    HURT stats (abs)   min: 40 max: 40 x̄: 40.00 x̃: 40
    HURT stats (rel)   min: 0.15% max: 0.15% x̄: 0.15% x̃: 0.15%
    95% mean confidence interval for cycles value: -277.91 -242.90
    95% mean confidence interval for cycles %-change: -27.58% -22.55%
    Cycles are helped.

No spill/fill changes or gained/lost

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4627>

3 years agointel/fs: Rename block to scan_block in can_coalesce_vars
Jason Ekstrand [Sat, 18 Apr 2020 22:22:01 +0000 (17:22 -0500)]
intel/fs: Rename block to scan_block in can_coalesce_vars

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4627>

3 years agoradv: use common nir_convert_ycbcr
Jonathan Marek [Sun, 12 Apr 2020 14:53:07 +0000 (10:53 -0400)]
radv: use common nir_convert_ycbcr

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: D Scott Phillips <d.scott.phillips@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4528>

3 years agoanv: use common nir_convert_ycbcr
Jonathan Marek [Sun, 12 Apr 2020 14:52:34 +0000 (10:52 -0400)]
anv: use common nir_convert_ycbcr

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: D Scott Phillips <d.scott.phillips@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4528>

3 years agonir: convert_ycbcr: preserve alpha channel
Jonathan Marek [Fri, 10 Apr 2020 12:37:48 +0000 (08:37 -0400)]
nir: convert_ycbcr: preserve alpha channel

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: D Scott Phillips <d.scott.phillips@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4528>

3 years agonir: add common convert_ycbcr for vulkan csc
Jonathan Marek [Fri, 10 Apr 2020 12:34:53 +0000 (08:34 -0400)]
nir: add common convert_ycbcr for vulkan csc

Copied from anv, replaced state with passing model/range directly.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: D Scott Phillips <d.scott.phillips@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4528>

3 years agonir/linking: fix issue with two compact variables in a row. (v2)
Dave Airlie [Mon, 20 Apr 2020 01:23:45 +0000 (11:23 +1000)]
nir/linking: fix issue with two compact variables in a row. (v2)

If we have a clip dist float[1] compact followed by a tess factor
float[2] we don't want to overlap them, but the partial check
only happens for non-compact vars.

This fixes some issues seen with my sw vulkan layer with
dEQP-VK.clipping.user_defined.clip_distance*

v2: v1 failed with clip/cull mixtures, since in that
case the cull has a location_frac to follow after the clip
so only reset if we get a location_frac of 0 in a subsequent
clip var

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4635>

3 years agopick-ui: auto-scroll the feedback window
Eric Engestrom [Wed, 11 Mar 2020 13:39:48 +0000 (14:39 +0100)]
pick-ui: auto-scroll the feedback window

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4650>

3 years agobin/pick-ui: Add a new maintainer script for picking patches
Dylan Baker [Wed, 16 Oct 2019 18:32:49 +0000 (11:32 -0700)]
bin/pick-ui: Add a new maintainer script for picking patches

In the long term the goal of this script is to nearly completely
automate the process of picking stable nominations, in a well tested
way.

In the short term the goal is to provide a better, faster UI to interact
with stable nominations.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3608>

3 years agobin/gen_release_notes.py: Fix version detection for .0 release
Dylan Baker [Thu, 5 Mar 2020 22:04:04 +0000 (14:04 -0800)]
bin/gen_release_notes.py: Fix version detection for .0 release

The previous version is being calculated incorrectly, resulting in
20.0.0 deciding it's version is 19.3.x+1. This fixes that.

Fixes: 3226b12a09bbcbd25526fd6da6257057d26ddb31
       ("release: Add an update_release_calendar.py script")

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4070>

3 years agoanv: Add support for new MMAP_OFFSET ioctl.
Rafael Antognolli [Fri, 18 Jan 2019 23:05:55 +0000 (15:05 -0800)]
anv: Add support for new MMAP_OFFSET ioctl.

v2: Update getparam check (Ken).

[jordan.l.justen@intel.com: use 0 offset for MMAP_OFFSET]

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1675>

3 years agoanv: Add anv_device parameter to anv_gem_munmap.
Rafael Antognolli [Wed, 20 Feb 2019 23:26:43 +0000 (15:26 -0800)]
anv: Add anv_device parameter to anv_gem_munmap.

Also update all of its callers.

On the next commit, the device will be used by anv_gem_munmap to choose
whether we need to call the valgrind code or not, depending on which
type of mmap we are using.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1675>

3 years agoiris/bufmgr: Add support for MMAP_OFFSET ioctl.
Rafael Antognolli [Wed, 13 Feb 2019 19:51:50 +0000 (11:51 -0800)]
iris/bufmgr: Add support for MMAP_OFFSET ioctl.

Use the new DRM_IOCTL_I915_GEM_MMAP_OFFSET ioctl when available.

[jordan.l.justen@intel.com: iris port]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
v2: Update getparam check (Ken).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1675>

3 years agoi965/bufmgr: Add support for MMAP_OFFSET ioctl.
Rafael Antognolli [Fri, 14 Dec 2018 22:02:04 +0000 (14:02 -0800)]
i965/bufmgr: Add support for MMAP_OFFSET ioctl.

Use the new DRM_IOCTL_I915_GEM_MMAP_OFFSET ioctl when available.

v2: update getparam check (Ken).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1675>

3 years agoiris/bufmgr: Factor out GEM_MMAP ioctl from mmap_cpu and mmap_wc.
Rafael Antognolli [Wed, 13 Feb 2019 19:32:17 +0000 (11:32 -0800)]
iris/bufmgr: Factor out GEM_MMAP ioctl from mmap_cpu and mmap_wc.

We want to add a new ioctl for mmap'ing buffers, so let's avoid
duplicating that code on both functions by extracting it from them
first.

[jordan.l.justen@intel.com: iris port]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
v2: Rename helper function names (Ken).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1675>

3 years agoi965/bufmgr: Factor out GEM_MMAP ioctl from mmap_cpu and mmap_wc.
Rafael Antognolli [Fri, 14 Dec 2018 21:20:45 +0000 (13:20 -0800)]
i965/bufmgr: Factor out GEM_MMAP ioctl from mmap_cpu and mmap_wc.

We want to add a new ioctl for mmap'ing buffers, so let's avoid
duplicating that code on both functions by extracting it from them
first.

v2: Update helper function names (Ken).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1675>

3 years agodrm-uapi: Update headers from Linux 5.7-rc1.
Rafael Antognolli [Mon, 13 Apr 2020 17:26:14 +0000 (10:26 -0700)]
drm-uapi: Update headers from Linux 5.7-rc1.

commit 8f3d9f354286745c751374f5f1fcafee6b3f3136
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date:   Sun Apr 12 12:35:55 2020 -0700

    Linux 5.7-rc1

Acked-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1675>

3 years agospirv: Fix propagation of OpVariable access flags
Caio Marcelo de Oliveira Filho [Fri, 17 Apr 2020 21:44:12 +0000 (14:44 -0700)]
spirv: Fix propagation of OpVariable access flags

After the decorations of a variable are evaluated, propagate the
access flag to the associated vtn_pointer.  This was done when
creating the pointer but at that point there was no access flags for
the variable.

Inline the pointer creation to make this point clearer, in isolation
the helper made the impression that the value was being propagated.

Issue found by Ken.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4620>

3 years agointel/fs,vec4: Properly account SENDs in IVB memory fence
Caio Marcelo de Oliveira Filho [Fri, 3 Jan 2020 18:05:39 +0000 (10:05 -0800)]
intel/fs,vec4: Properly account SENDs in IVB memory fence

Change brw_memory_fence to return the number of messages emitted, and
use that to update the send_count statistic in code generation.

This will fix the book-keeping for IVB since the memory fences will
result in two SEND messages.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4646>

3 years agoaco: move src1 to vgpr instead of using VOP3 for VOP2 instructions during isel
Daniel Schürmann [Mon, 20 Apr 2020 12:02:26 +0000 (13:02 +0100)]
aco: move src1 to vgpr instead of using VOP3 for VOP2 instructions during isel

Is simpler and helps a couple of shaders.
Totals from affected shaders: (Vega)
Code Size: 16341296 -> 16335460 (-0.04 %) bytes

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4642>

3 years agoaco: fix 64bit fsub
Daniel Schürmann [Mon, 20 Apr 2020 11:59:21 +0000 (12:59 +0100)]
aco: fix 64bit fsub

Fixes: 425558bfd595ed3a7a049ad0f47a46b8b3c4691e ('aco: use v_subrev_f32 for fsub with an sgpr operand in src1')
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4642>

3 years agogitlab-ci: Test virgl driver
Tomeu Vizoso [Wed, 1 Apr 2020 07:17:25 +0000 (09:17 +0200)]
gitlab-ci: Test virgl driver

Add virglrenderer to the container and use the vtest transport to test
the Gallium driver. On the "host", llvmpipe is used.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4433>

3 years agomeson: do not disable incremental linking for debug-builds
Erik Faye-Lund [Wed, 15 Apr 2020 18:35:46 +0000 (20:35 +0200)]
meson: do not disable incremental linking for debug-builds

Meson specifies /EDITANDCONTINUE for MSVC projects when using the debug
build-type. This collides with our across-the-board disabling of
incremental linking.

It's clear that we don't want to do incremental linking for
release-builds; it increase the code-size, and adds some needless jumps
to be able to patch in new code. But for debug-builds this seems like a
good thing; we can now debug and on-the-fly recompile changes if we want
to.

This flag seems to have been simply forwarded from the SCons build
system, where it makes a bit more sense; SCons doesn't really integrate
with visual studio, so you can't properly debug with it. But Meson does,
so let's keep some bells-and-whistles here.

So let's avoid disabling incremental linking for debug-builds. For other
builds we still want to do this, because Meson only disables it
automatically for minsize-builds.

This avoids a boat-loads of warnings on the form:

warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification

Acked-by: Jose Fonseca <jfonseca@vmware.com>
Acked-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4572>

3 years agogtest: Update to 1.10.0
Erik Faye-Lund [Wed, 15 Apr 2020 20:36:04 +0000 (22:36 +0200)]
gtest: Update to 1.10.0

Acked-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4576>

3 years agonir/opt_algebraic: lower 64-bit fmin3/fmax3/fmed3
Samuel Pitoiset [Wed, 15 Apr 2020 14:55:31 +0000 (16:55 +0200)]
nir/opt_algebraic: lower 64-bit fmin3/fmax3/fmed3

This unconditionally lowers 64-bit fmin3/fmax3/fmed3 because
AMD hardware doesn't have native instructions, and no drivers
except RADV uses these instructions.

Fixes dEQP-VK.spirv_assembly.instruction.amd_trinary_minmax.*.f64.*
with ACO.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4570>

3 years agonir/lower_int64: lower imin3/imax3/umin3/umax3/imed3/umed3
Samuel Pitoiset [Wed, 15 Apr 2020 14:15:11 +0000 (16:15 +0200)]
nir/lower_int64: lower imin3/imax3/umin3/umax3/imed3/umed3

Fixes dEQP-VK.spirv_assembly.instruction.amd_trinary_minmax.*.i64.*
with ACO because this backend compiler expects most of the 64-bit
operations to be lowered.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4570>

3 years agoradeonsi: skip vs output optimizations for some outputs
Pierre-Eric Pelloux-Prayer [Tue, 14 Apr 2020 16:04:35 +0000 (18:04 +0200)]
radeonsi: skip vs output optimizations for some outputs

If PT_SPRITE_TEX is enabled, PS inputs are overriden at runtime so
we can't apply the vs output optim.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2747
Fixes: 3ec9975555d ("radeonsi: eliminate trivial constant VS outputs")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4559>

3 years agonir/gcm: dont move movs unless we can replace them later with their src
Timothy Arceri [Fri, 22 Mar 2019 02:01:03 +0000 (13:01 +1100)]
nir/gcm: dont move movs unless we can replace them later with their src

This helps us avoid moving the movs outside if branches when there
src can't be scalarized.

For example it avoids:

   vec4 32 ssa_7 = tex ssa_6 (coord), 0 (texture), 0 (sampler),
   if ... {
      r0 = imov ssa_7.z
      r1 = imov ssa_7.y
      r2 = imov ssa_7.x
      r3 = imov ssa_7.w
      ...
   } else {
      ...
      if ... {
         r0 = imov ssa_7.x
         r1 = imov ssa_7.w
         ...
      else {
         r0 = imov ssa_7.z
         r1 = imov ssa_7.y
         ...
      }
      r2 = imov ssa_7.x
      r3 = imov ssa_7.w
   }
   ...
   vec4 32 ssa_36 = vec4 r0, r1, r2, r3

Becoming something like:

   vec4 32 ssa_7 = tex ssa_6 (coord), 0 (texture), 0 (sampler),
   r0 = imov ssa_7.z
   r1 = imov ssa_7.y
   r2 = imov ssa_7.x
   r3 = imov ssa_7.w

   if ... {
      ...
   } else {
      if ... {
         r0 = imov r2
         r1 = imov r3
         ...
      else {
         ...
      }
      ...
   }

While this is has a smaller instruction count it requires more work
for the same result. With more complex examples we can also end up
shuffling the registers around in a way that requires more registers
to use as temps so that we don't overwrite our original values along
the way.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4636>

3 years agonir/gcm: be more conservative about moving instructions from loops
Timothy Arceri [Mon, 25 Mar 2019 08:38:54 +0000 (19:38 +1100)]
nir/gcm: be more conservative about moving instructions from loops

Here we only pull instructions further up control flow if they are
constant or texture instructions. See the code comment for more
information.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4636>

3 years agonir/gcm: allow derivative dependent intrinisics to be moved earlier
Timothy Arceri [Fri, 22 Mar 2019 04:32:22 +0000 (15:32 +1100)]
nir/gcm: allow derivative dependent intrinisics to be moved earlier

We can't move them later as we could move them into non-uniform
control flow, but moving them earlier should be fine.

This helps avoid a bunch of spilling in unigine shaders due to
moving the tex instructions sources earlier (outside if branches)
but not the instruction itself.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4636>

3 years agonir/gcm: Prefer the instruction's original block
Jason Ekstrand [Wed, 18 Jan 2017 02:38:41 +0000 (18:38 -0800)]
nir/gcm: Prefer the instruction's original block

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4636>

3 years agonir/gcm: Delete dead instructions
Jason Ekstrand [Wed, 18 Jan 2017 02:38:40 +0000 (18:38 -0800)]
nir/gcm: Delete dead instructions

Classically, global code motion is also a dead code pass.  However, in
the initial implementation, the decision was made to place every
instruction and let conventional DCE clean up the dead ones.  Because
any uses of a dead instruction are unreachable, we have no late block
and the dead instructions are always scheduled early.  The problem is
that, because we place the dead instruction early, it  pushes the
placement of any dependencies of the dead instruction earlier than they
may need to be placed.  In order prevent dead instructions from
affecting the placement of live ones, we need to delete them.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4636>

3 years agonir/gcm: Add a real concept of "progress"
Jason Ekstrand [Wed, 18 Jan 2017 02:38:39 +0000 (18:38 -0800)]
nir/gcm: Add a real concept of "progress"

Now that the GCM pass is more conservative and only moves instructions
to different blocks when it's advantageous to do so, we can have a
proper notion of what it means to make progress.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4636>

3 years agonir/gcm: Move block choosing into a helper function
Jason Ekstrand [Wed, 18 Jan 2017 02:38:38 +0000 (18:38 -0800)]
nir/gcm: Move block choosing into a helper function

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4636>

3 years agonir/gcm: Use an array for storing the early block
Jason Ekstrand [Wed, 18 Jan 2017 02:38:37 +0000 (18:38 -0800)]
nir/gcm: Use an array for storing the early block

We are about to adjust our instruction block assignment algorithm and we
will want to know the current block that the instruction lives in.  In
order to allow for this, we can't overwrite nir_instr::block in the
early scheduling pass.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4636>

3 years agonir/gcm: Loop over blocks in pin_instructions
Jason Ekstrand [Wed, 18 Jan 2017 02:38:36 +0000 (18:38 -0800)]
nir/gcm: Loop over blocks in pin_instructions

Now that we have the new block iterators, we can simplify things a bit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4636>

3 years agonir/dominance: Better handle unreachable blocks
Jason Ekstrand [Wed, 18 Jan 2017 02:38:35 +0000 (18:38 -0800)]
nir/dominance: Better handle unreachable blocks

v2: Fix minor comments (Ken)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4636>

3 years agoaco: use v_subrev_f32 for fsub with an sgpr operand in src1
Daniel Schürmann [Sun, 19 Apr 2020 15:17:04 +0000 (16:17 +0100)]
aco: use v_subrev_f32 for fsub with an sgpr operand in src1

This fixes an accidentally introduced regression.

Fixes: 9be4be515f2a08b9c9e5ae1fc4c5dc9a830c2337 ('aco: implement 16-bit nir_op_fsub/nir_op_fadd')
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4633>

3 years agoCI: Disable Lima jobs due to lab unhealthiness
Daniel Stone [Sun, 19 Apr 2020 11:57:04 +0000 (12:57 +0100)]
CI: Disable Lima jobs due to lab unhealthiness

The BayLibre LAVA host appears to be down.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4631>

3 years agoci/windows: Make Chocolatey installs more reliable
Daniel Stone [Thu, 16 Apr 2020 22:31:47 +0000 (23:31 +0100)]
ci/windows: Make Chocolatey installs more reliable

Chocolatey installs depend on downloading binaries from SourceForge,
which is an unreliable host: container builds often fail because it
cannot pick up winflexbison.

Add a loop to retry chocolatey installs if any installs have failed, and
ensure Python is in the accessible PowerShell path rather than relying
on the path being externally refreshed.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4631>

4 years agonir: Lower returns correctly inside nested loops
Arcady Goldmints-Orlov [Thu, 16 Apr 2020 21:28:12 +0000 (16:28 -0500)]
nir: Lower returns correctly inside nested loops

Inside nested flow control, nir_lower_returns inserts predicated breaks
in the outer block. However, it would omit doing this if the remainder
of the outer block (after the inner block) was empty. This is not
correct in the case of loops, as execution just wraps back around to the
start of the loop, so this change doesn't skip the predication inside
loops.

Fixes: 79dec93ead6e (nir: Add return lowering pass)
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2724
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4603>

4 years agoanv: Apply any needed PIPE_CONTROLs before emitting state
Jason Ekstrand [Thu, 16 Apr 2020 20:33:43 +0000 (15:33 -0500)]
anv: Apply any needed PIPE_CONTROLs before emitting state

Push constants in particular can get picked up by the hardware at weird
times that happen *before* 3DPRIMITIVE.  Therefore, we need to flush
before we emit all our state to ensure that any data they may pick up is
in memory in time.  This fixes an app which does vkCmdCopyBuffers
immediately followed by a vkCmdBeginRenderPass and vkCmdDraw which uses
the destination of the copy as a UBO which we push.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4601>

4 years agoanv: Move vb_emit setup closer to where it's used in flush_state
Jason Ekstrand [Thu, 16 Apr 2020 20:31:15 +0000 (15:31 -0500)]
anv: Move vb_emit setup closer to where it's used in flush_state

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4601>

4 years agoFix promotion of floats to doubles
Albert Astals Cid [Wed, 26 Feb 2020 22:05:51 +0000 (23:05 +0100)]
Fix promotion of floats to doubles

Use the f variants of the math functions if the input parameter is a
float, saves converting from float to double and running the double
variant of the math function for gaining no precision at all

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3969>

4 years agoir3/ra: Fix off-by-one issues with live-range extension
Connor Abbott [Fri, 17 Apr 2020 17:31:56 +0000 (19:31 +0200)]
ir3/ra: Fix off-by-one issues with live-range extension

The intersects() function assumes that inside each instruction values
always die before they are defined, so that if the end of one range is
the same instruction as the beginning of the next then they don't
intersect. However, this isn't the case for values that become live at
the beginning of a basic block, which become live *before* the first
instruction, or instructions that die at the end of a basic block which
die after the last instruction.

For example, imagine that we have two values, A which is defined earlier
in the block and B which is defined in the last instruction of the block
and both die at the end of the basic block (e.g. are used in the next
iteration of a loop). We would compute a range for A of, say, (10, 20)
and for B of (20, 20) since each block's end_ip is the same as the ip of
the last instruction, and RA would consider them to not interfere.
There's a similar problem with values that become live at the beginning.

The fix is to offset the block's start_ip and end_ip by one so that they
don't correspond to any actual instruction. One way to think about this
is that we're adding fake instructions at the beginning and end of a
block where values become live & die. We could invert the order, so that
values consumed by each instruction are considered dead at the end of
the previous instruction, but then values that become dead at the
beginning of the basic block would incorrectly have an empty live range,
with a similar problem at the end of the basic block if we try to say
that values are defined at the beginning of the next instruction. So
the extra padding instructions are unavoidable.

This fixes an accidental infinite loop in the shader for
dEQP-VK.spirv_assembly.type.scalar.u32.switch_vert.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4614>

4 years agoutil/sparse_free_list: manipulate node pointers using atomic primitives
Lionel Landwerlin [Fri, 17 Apr 2020 17:42:41 +0000 (20:42 +0300)]
util/sparse_free_list: manipulate node pointers using atomic primitives

Probably doesn't fix anything but those should be accessed in an
atomic way just like the head pointer.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: e4f01eca3b3cd1 ("util: Add a free list structure for use with util_sparse_array")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4613>

4 years agoglsl: only set stage ref when uniforms referenced in stage
Timothy Arceri [Thu, 12 Mar 2020 23:17:08 +0000 (10:17 +1100)]
glsl: only set stage ref when uniforms referenced in stage

This updates the NIR uniform linker to behave like the GLSL IR
linker and fixes a number of CTS tests once we enable the NIR
linker for glsl.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4623>

4 years agoglsl: pull mark_array_elements_referenced() out into common helper
Timothy Arceri [Tue, 31 Mar 2020 02:49:30 +0000 (13:49 +1100)]
glsl: pull mark_array_elements_referenced() out into common helper

We will reuse this helper in the NIR linker in the following
patches.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4623>

4 years agoglsl: fix block index in NIR uniform linker
Timothy Arceri [Tue, 10 Mar 2020 01:55:53 +0000 (12:55 +1100)]
glsl: fix block index in NIR uniform linker

We only want to set the index for the first block of an array. Also
add a comment about why we do not break here.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4623>

4 years agoglsl: error check max user assignable uniform locations
Timothy Arceri [Thu, 5 Mar 2020 23:27:44 +0000 (10:27 +1100)]
glsl: error check max user assignable uniform locations

This adds the error check to the NIR uniform linker.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4623>

4 years agoglsl: fix explicit locations for the glsl linker
Timothy Arceri [Thu, 5 Mar 2020 03:46:26 +0000 (14:46 +1100)]
glsl: fix explicit locations for the glsl linker

We already reserved explicit locations in the GLSL linker.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4623>

4 years agoRevert "glsl: fix resizing of the uniform remap table"
Timothy Arceri [Thu, 5 Mar 2020 03:51:20 +0000 (14:51 +1100)]
Revert "glsl: fix resizing of the uniform remap table"

This reverts commit e0aa0a839f9c168784a1f50013c83877cc876094.

Instead we fix it correctly in the following patch.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4623>

4 years agoglsl: tidy up uniform storage value count code in NIR linker
Timothy Arceri [Wed, 26 Feb 2020 02:17:02 +0000 (13:17 +1100)]
glsl: tidy up uniform storage value count code in NIR linker

This makes the code cleaner and better reflects what the existing
glsl IR  linker does possibly fixing subtle bugs.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4623>

4 years agoglsl: fix struct offsets in the nir uniform linker
Timothy Arceri [Thu, 6 Feb 2020 23:55:03 +0000 (10:55 +1100)]
glsl: fix struct offsets in the nir uniform linker

This change properly applies layouts to structs of uniforms in a
similar way to the GLSL IR linker.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4623>

4 years agonir: add matrix_layout to nir_variable data
Timothy Arceri [Fri, 13 Mar 2020 03:18:27 +0000 (14:18 +1100)]
nir: add matrix_layout to nir_variable data

This will be used by the following patch.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4623>

4 years agoanv: skip writing perfcntr in results on Gen12+
Lionel Landwerlin [Fri, 17 Apr 2020 06:51:22 +0000 (09:51 +0300)]
anv: skip writing perfcntr in results on Gen12+

We were not capturing the register already so don't bother writing the
delta in the results (we were previously doing a delta between two 0
values).

v2: Fix unused function warning

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4586>

4 years agointel/perf: Enable MDAPI queries for Gen12
Lionel Landwerlin [Thu, 16 Apr 2020 10:03:47 +0000 (13:03 +0300)]
intel/perf: Enable MDAPI queries for Gen12

We're missing the cases for gen12 leading to those metrics going
missing.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 15b7b56eb2fb41 ("intel/perf: add TGL support")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4586>