platform/upstream/mesa.git
4 years agoaco/isel: Simplify nested branching code
Tony Wasserka [Sat, 29 Aug 2020 11:14:23 +0000 (13:14 +0200)]
aco/isel: Simplify nested branching code

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6504>

4 years agoaco/isel: Turn the function template emit_load into a proper function
Tony Wasserka [Mon, 17 Aug 2020 15:07:53 +0000 (17:07 +0200)]
aco/isel: Turn the function template emit_load into a proper function

Statically known values were encoded using template parameters previously,
causing specializations for each of the 5 sets of template arguments to be
generated. Since emit_load is not performance critical (the inner loop
never runs more often than twice), it's better for build time to use
runtime arguments everywhere.

Reduces build time of this file by 9% (17.3s -> 15.7s on my machine) and
reduces libaco's size by 2.6%.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6504>

4 years agointel/nir: Call validate_ssa_dominance at both ends of the NIR compile
Jason Ekstrand [Mon, 1 Jun 2020 20:43:53 +0000 (15:43 -0500)]
intel/nir: Call validate_ssa_dominance at both ends of the NIR compile

This invokes it before we go into the optimization/lowering pass and
then right before we go out of SSA.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5288>

4 years agospirv: Run repair_ssa if there are discard instructions
Jason Ekstrand [Mon, 1 Jun 2020 23:01:05 +0000 (18:01 -0500)]
spirv: Run repair_ssa if there are discard instructions

SPIR-V's OpKill is a control-flow instruction but NIR's discard is not.
Therefore, it can be valid SPIR-V to have

    if (...) {
        foo = /* something */
    } else {
        discard;
    }
    use(foo);

without any phi between the definition of foo and its use.  This is not
true in NIR, however, because NIR's discard isn't considered
control-flow.  Arguably, this is a NIR bug but making discard control-
flow is a very deep change that can have serious ans subtle
side-effects.   The easier thing to do is just fix up the SSA in case we
have an OpKill which might have gotten us into the above case.

Fixes dEQP-VK.graphicsfuzz.vectors-and-discard-in-function with the new
NIR dominance validation pass enabled.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5288>

4 years agonir: Add a dominance validation pass
Jason Ekstrand [Mon, 1 Jun 2020 20:39:31 +0000 (15:39 -0500)]
nir: Add a dominance validation pass

We don't do full dominance validation of SSA values in nir_validate
because it requires generating valid dominance information and, while
that's not extremely expensive, it's probably more than we want to do on
every pass.  Also, dominance information is generated through the
metadata system so if we ran it by default in nir_validate, we would get
different beavior of the metadata system based on whether or not you
have a debug build and metadata bugs would be very hard to find.

However, having a pass for it that can be run occasionally, should help
detect and expose bugs.  For ease of use, we add a NIR_VALIDATE_SSA_DOMINANCE
environment variable which can be set to manually enable dominance
validation as a standard part of nir_validate.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5288>

4 years agonir/opt_if: fix opt_if_merge when destination branch has a jump
Rhys Perry [Mon, 7 Sep 2020 10:33:44 +0000 (11:33 +0100)]
nir/opt_if: fix opt_if_merge when destination branch has a jump

Fixes a case where opt_if_merge created code like:
if (...) {
   break;
   loop {
      ...
   }
}
which caused opt_peel_loop_initial_if to complain that the loop pre-header
wasn't a predecessor of the loop header. This patch prevents this
(invalid, I think) unreachable code from being created.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3496
Fixes: 4d3f6cb9739 ('nir: merge some basic consecutive ifs')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6633>

4 years agonir: Use explicit deref information to provide real UBO ranges.
Eric Anholt [Fri, 4 Sep 2020 20:25:05 +0000 (13:25 -0700)]
nir: Use explicit deref information to provide real UBO ranges.

freedreno results (note that cat6 is loads from memory as opposed to
pushed constants from the constant file):

total instructions in shared programs: 8044344 -> 8022085 (-0.28%)
total constlen in shared programs: 1411384 -> 1461964 (3.58%)
total cat6 in shared programs: 89983 -> 87065 (-3.24%)

Over the last 3 commits, we increased Manhattan31 performance by ~10%

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6359>

4 years agofreedreno/ir3: Apply the max upload limit to initial range setup
Eric Anholt [Fri, 4 Sep 2020 17:59:37 +0000 (10:59 -0700)]
freedreno/ir3: Apply the max upload limit to initial range setup

There's no sense in planning out an upload that we won't be able to
actually upload due to the limit.  This means that we can keep making
other loads pushable, even after we find one that wouldn't be, and we
don't fill the const file with UBO data for a load we couldn't promote.

total instructions in shared programs: 8096655 -> 8044344 (-0.65%)
total constlen in shared programs: 1447824 -> 1411384 (-2.52%)
total cat6 in shared programs: 97824 -> 89983 (-8.02%)

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

4 years agofreedreno/ir3: Use the new NIR UBO ranges in UBO analysis.
Eric Anholt [Fri, 14 Aug 2020 23:11:06 +0000 (16:11 -0700)]
freedreno/ir3: Use the new NIR UBO ranges in UBO analysis.

Now that NIR doesn't lose the original base/range on the
nir_lower_uniforms_to_ubo() path, we get a lot more indirect arrays
uploaded in shader-db.

total instructions in shared programs: 8125988 -> 8103788 (-0.27%)
total constlen in shared programs: 1313096 -> 1448864 (10.34%)
total cat6 in shared programs: 104089 -> 97824 (-6.02%)

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

4 years agonir: Add a range_base+range to nir_intrinsic_load_ubo().
Eric Anholt [Fri, 14 Aug 2020 20:10:02 +0000 (13:10 -0700)]
nir: Add a range_base+range to nir_intrinsic_load_ubo().

For UBO accesses to be the same performance as classic GL default uniform
block uniforms, we need to be able to push them through the same path.  On
freedreno, we haven't been uploading UBOs as push constants when they're
used for indirect array access, because we don't know what range of the
UBO is needed for an access.

I believe we won't be able to calculate the range in general in spirv
given casts that can happen, so we define a [0, ~0] range to be "We don't
know anything".  We use that at the moment for all UBO loads except for
nir_lower_uniforms_to_ubo, where we now avoid losing the range information
that default uniform block loads come with.

In a departure from other NIR intrinsics with a "base", I didn't make the
base an be something you have to add to the src[1] offset.  This keeps us
from needing to modify all drivers (particularly since the base+offset
thing can mean needing to do addition in the backend), makes backend
tracking of ranges easy, and makes the range calculations in
load_store_vectorizer reasonable.  However, this could definitely cause
some confusion for people used to the normal NIR base.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6359>

4 years agonir: Update the comment about nir_lower_uniforms_to_ubo()'s multiplier.
Eric Anholt [Fri, 14 Aug 2020 20:22:27 +0000 (13:22 -0700)]
nir: Update the comment about nir_lower_uniforms_to_ubo()'s multiplier.

I remembered doing this analysis and was arguing in another MR that this
pass didn't have any driver dependency, but it actually does based on
PIPE_CAP_PACKED_UNIFORMS.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6359>

4 years agoradeonsi: inline trivial PS functions
Marek Olšák [Sun, 6 Sep 2020 14:54:53 +0000 (10:54 -0400)]
radeonsi: inline trivial PS functions

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6623>

4 years agoac,radeonsi: lower 64-bit IO to 32 bits and remove all dead code
Marek Olšák [Tue, 1 Sep 2020 21:02:52 +0000 (17:02 -0400)]
ac,radeonsi: lower 64-bit IO to 32 bits and remove all dead code

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6623>

4 years agoradeonsi: remove swizzle == ~0 dead code in si_llvm_load_input_gs
Marek Olšák [Tue, 1 Sep 2020 21:04:24 +0000 (17:04 -0400)]
radeonsi: remove swizzle == ~0 dead code in si_llvm_load_input_gs

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6623>

4 years agoradeonsi: eliminate unused shader outputs for separate NGG geometry shaders
Marek Olšák [Mon, 7 Sep 2020 10:29:45 +0000 (06:29 -0400)]
radeonsi: eliminate unused shader outputs for separate NGG geometry shaders

This just works because the same output export code is used for VS too.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6634>

4 years agoradeonsi: set outputs_written_before_ps for geometry shaders too
Marek Olšák [Mon, 7 Sep 2020 10:23:33 +0000 (06:23 -0400)]
radeonsi: set outputs_written_before_ps for geometry shaders too

it will be used in following commit

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6634>

4 years agoaco/isel: refactor emit_vop3a_instruction() to handle 2 operand instructions
Daniel Schürmann [Fri, 4 Sep 2020 23:47:30 +0000 (00:47 +0100)]
aco/isel: refactor emit_vop3a_instruction() to handle 2 operand instructions

Only AC:O has been affected.

Totals from 4 (0.00% of 136546) affected shaders (RAVEN):
CodeSize: 16428 -> 16420 (-0.05%)
Instrs: 3294 -> 3292 (-0.06%)
Cycles: 14208 -> 14200 (-0.06%)
VMEM: 936 -> 978 (+4.49%)
VClause: 80 -> 77 (-3.75%)
Copies: 211 -> 209 (-0.95%)
PreVGPRs: 127 -> 126 (-0.79%)

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

4 years agoaco/isel: refactor code and remove unnecessary v_mov
Daniel Schürmann [Fri, 4 Sep 2020 21:01:26 +0000 (22:01 +0100)]
aco/isel: refactor code and remove unnecessary v_mov

Changes mainly due to avoided v_movs for fmin/fmax/fadd/fmul.

Totals from 12783 (9.36% of 136546) affected shaders (RAVEN):
SGPRs: 1097752 -> 1098264 (+0.05%); split: -0.09%, +0.14%
VGPRs: 856920 -> 850800 (-0.71%); split: -0.82%, +0.11%
SpillSGPRs: 49494 -> 49496 (+0.00%); split: -0.00%, +0.01%
CodeSize: 99997916 -> 99989948 (-0.01%); split: -0.04%, +0.03%
MaxWaves: 53895 -> 54448 (+1.03%)
Instrs: 19634960 -> 19632626 (-0.01%); split: -0.05%, +0.04%
Cycles: 1620601696 -> 1620900712 (+0.02%); split: -0.02%, +0.04%
VMEM: 3334181 -> 3299626 (-1.04%); split: +1.62%, -2.66%
SMEM: 865573 -> 865876 (+0.04%); split: +0.84%, -0.81%
VClause: 337100 -> 335224 (-0.56%); split: -0.88%, +0.32%
SClause: 696813 -> 697267 (+0.07%); split: -0.14%, +0.21%
Copies: 1549897 -> 1548023 (-0.12%); split: -0.52%, +0.40%
Branches: 682118 -> 682108 (-0.00%); split: -0.01%, +0.00%
PreSGPRs: 893524 -> 895129 (+0.18%); split: -0.00%, +0.18%
PreVGPRs: 790180 -> 783036 (-0.90%)

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

4 years agoswr: Use ElemenCount constructor for LLVM 11
jzielins [Mon, 7 Sep 2020 14:49:35 +0000 (16:49 +0200)]
swr: Use ElemenCount constructor for LLVM 11

In LLVM 12 ElementCount constructor is private
and instead of using it explicitly, ::get function
should be used, but in LLVM 11, the constructor
is still the way to go.

Reviewed-by: Krzysztof Raszkowski <krzysztof.raszkowski@intel.com>
Closes: #3490
Fixes: 639605e5ba947bb947313a6584ef7fbb8619e9c2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6648>

4 years agoaco: improve fsign selection
Rhys Perry [Thu, 3 Sep 2020 13:56:26 +0000 (14:56 +0100)]
aco: improve fsign selection

Idea from https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284

fossil-db (Navi):
Totals from 4053 (2.95% of 137413) affected shaders:
SGPRs: 305810 -> 305906 (+0.03%); split: -0.01%, +0.04%
VGPRs: 249000 -> 249144 (+0.06%); split: -0.01%, +0.07%
CodeSize: 29967092 -> 29885768 (-0.27%); split: -0.27%, +0.00%
Instrs: 5749494 -> 5737971 (-0.20%); split: -0.20%, +0.00%
Cycles: 255028584 -> 254955444 (-0.03%); split: -0.04%, +0.01%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6583>

4 years agoaco: fix one-off error in Operand(uint16_t)
Rhys Perry [Thu, 3 Sep 2020 14:41:32 +0000 (15:41 +0100)]
aco: fix one-off error in Operand(uint16_t)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 3d6f67950d9 ('aco: improve 8/16-bit constants')
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6583>

4 years agogitlab-ci: Enable unit test report for arm64_a630_traces
Alexandros Frantzis [Fri, 4 Sep 2020 11:20:39 +0000 (14:20 +0300)]
gitlab-ci: Enable unit test report for arm64_a630_traces

Inform gitlab about the JUnit XML file that tracie produces, so that the
pipeline page can present more detailed information about tracie test
results.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6598>

4 years agogitlab-ci: Enable unit test reports for lava traces jobs
Alexandros Frantzis [Fri, 4 Sep 2020 10:53:41 +0000 (13:53 +0300)]
gitlab-ci: Enable unit test reports for lava traces jobs

Download from minio the JUnit XML file that tracie produces and inform
gitlab about it, so that the pipeline page can present more detailed
information about tracie test results.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6598>

4 years agogitlab-ci: Enable unit test reports for normal runner traces jobs
Alexandros Frantzis [Fri, 4 Sep 2020 09:44:53 +0000 (12:44 +0300)]
gitlab-ci: Enable unit test reports for normal runner traces jobs

Inform gitlab about the JUnit XML file that tracie produces, so that the
pipeline page can present more detailed information about tracie test
results.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6598>

4 years agotracie: Produce JUnit XML results
Alexandros Frantzis [Thu, 3 Sep 2020 13:29:05 +0000 (16:29 +0300)]
tracie: Produce JUnit XML results

Write tracie results to the 'results/junit.xml' file using the JUnit XML
format. Among other uses, this file can be picked up by gitlab to
display more useful information to the user.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6598>

4 years agotracie: Make tests independent of environment
Alexandros Frantzis [Thu, 3 Sep 2020 11:22:40 +0000 (14:22 +0300)]
tracie: Make tests independent of environment

Provide some sensible values for required environment variables to allow
tests to run properly in any environment.

Signed-off-by: Alexandros Frantzis <alexandros.frantzis@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6598>

4 years agomesa/st: enable EXT_color_buffer_half_float when formats supported
Tapani Pälli [Tue, 1 Sep 2020 11:21:03 +0000 (14:21 +0300)]
mesa/st: enable EXT_color_buffer_half_float when formats supported

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6491>

4 years agomesa: add EXT_color_buffer_half_float plumbing
Tapani Pälli [Tue, 1 Sep 2020 11:20:27 +0000 (14:20 +0300)]
mesa: add EXT_color_buffer_half_float plumbing

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6491>

4 years agomesa: refactor floating point texture fbo completeness check on gles
Tapani Pälli [Fri, 28 Aug 2020 10:04:21 +0000 (13:04 +0300)]
mesa: refactor floating point texture fbo completeness check on gles

Patch introduces a helper function for checking the completeness and
fixes some of the existing checking in is_format_color_renderable. This
is done as preparation for EXT_color_buffer_half_float support.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6491>

4 years agoegl/android: HAVE_DRM_GRALLOC path fixes (v2)
Mauro Rossi [Mon, 7 Sep 2020 20:02:08 +0000 (22:02 +0200)]
egl/android: HAVE_DRM_GRALLOC path fixes (v2)

Fixes the following building errors:

external/mesa/src/egl/drivers/dri2/platform_android.c:1001:9: error: use of undeclared identifier 'dri2_img'
                                           dri2_img);
                                           ^
external/mesa/src/egl/drivers/dri2/platform_android.c:1059:17: error: incompatible pointer types assigning to '__DRIimage *' (aka 'struct __DRIimageRec *') from '_EGLImage *' (aka 'struct _egl_image *') [-Werror,-Wincompatible-pointer-types]
      dri_image = droid_create_image_from_name(disp, buf);
                ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

(v2) Changelog:
- Pass NULL instead of dri_image as argument of createImageFromName()
- Delete the unused dri_image variable

Fixes: 5c8b67ed ("egl/android: Simplify droid_create_image_from_name() path")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6626>

4 years agoandroid: freedreno/common: add libmesa_git_sha1 static dependency
Mauro Rossi [Sat, 5 Sep 2020 21:31:28 +0000 (23:31 +0200)]
android: freedreno/common: add libmesa_git_sha1 static dependency

Fixes the following building error:

external/mesa/src/freedreno/common/freedreno_uuid.c:30:10: fatal error: 'git_sha1.h' file not found
         ^~~~~~~~~~~~
1 error generated.

Fixes: e7458f19e ("freedreno/uuid: Generate meaningful device and driver UUID")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6625>

4 years agoandroid: freedreno: Implement pipe screen's get_device/driver_uuid()
Mauro Rossi [Sat, 5 Sep 2020 21:23:14 +0000 (23:23 +0200)]
android: freedreno: Implement pipe screen's get_device/driver_uuid()

libfreedreno_common static dependency is need for gallium_dri target

Fixes the following building error:

ld.lld: error: undefined symbol: fd_get_device_uuid
>>> referenced by freedreno_screen.c:836 (external/mesa/src/gallium/drivers/freedreno/freedreno_screen.c:836)
>>>               freedreno_screen.o:(fd_screen_get_device_uuid) in archive out/target/product/x86_64/obj/STATIC_LIBRARIES/libmesa_pipe_freedreno_intermediates/libmesa_pipe_freedreno.a

ld.lld: error: undefined symbol: fd_get_driver_uuid
>>> referenced by freedreno_screen.c:842 (external/mesa/src/gallium/drivers/freedreno/freedreno_screen.c:842)
>>>               freedreno_screen.o:(fd_screen_get_driver_uuid) in archive out/target/product/x86_64/obj/STATIC_LIBRARIES/libmesa_pipe_freedreno_intermediates/libmesa_pipe_freedreno.a

Fixes: e3c39e505 "freedreno: Implement pipe screen's get_device/driver_uuid()"
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6625>

4 years agoradeonsi: Work around Wasteland 2 bug.
Bas Nieuwenhuizen [Mon, 7 Sep 2020 19:06:52 +0000 (21:06 +0200)]
radeonsi: Work around Wasteland 2 bug.

Confirmed by an user on AMD HW that this driconf flag works
around the issue.

Gitlab: https://gitlab.freedesktop.org/mesa/mesa/-/issues/1535
CC: mesa-stable
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6637>

4 years agonir/opt_shrink_vectors: shrink image stores using the format
Rhys Perry [Mon, 24 Aug 2020 12:58:49 +0000 (13:58 +0100)]
nir/opt_shrink_vectors: shrink image stores using the format

fossil-db (Navi):
Totals from 657 (0.48% of 135946) affected shaders:
VGPRs: 26076 -> 25520 (-2.13%); split: -2.15%, +0.02%
CodeSize: 3033016 -> 3014472 (-0.61%); split: -0.64%, +0.03%
MaxWaves: 9386 -> 9420 (+0.36%)
Instrs: 590109 -> 585502 (-0.78%); split: -0.82%, +0.04%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5772>

4 years agonir/lower_io: Fix the unknown-array-index case in get_deref_align
Jason Ekstrand [Mon, 7 Sep 2020 01:09:01 +0000 (20:09 -0500)]
nir/lower_io: Fix the unknown-array-index case in get_deref_align

The current align_mul calculation in the unknown-array-index
calculation is

    align_mul = MIN3(parent_mul,
                     min_pow2_divisor(parent_offset),
                     min_pow2_divisor(stride))

which is certainly correct if parent_offset > 0.  However, when
parent_offset = 0, min_pow2_divisor(parent_offset) isn't well-defined
and our calculation for it is 1 << -1 which isn't well-defined.  That
said.... it's not actually needed.

The offset to the base of the array is

    array_base = parent_mul * k + parent_offset

for some integer k.  When we throw in an unknown array index i, we get

    elem = parent_mul * k + parent_offset + stride * i.

If we set new_align = MIN2(parent_mul, min_pow2_divisor(stride)), then
both parent_mul and stride are divisible by new_align and

    elem = (parent_mul / new_alig) * new_align * k +
           (stride / new_align) * new_align * i + parent_offset

         = new_align * ((parent_mul / new_alig) * k +
                        (stride / new_align) * i) + parent_offset

so elem = new_align * j + parent_offset where

    j = (parent_mul / new_alig) * k + (stride / new_align) * i.

That's a very long-winded way of saying that we can delete one parameter
from the align_mul calculation and it's still fine. :-)

Fixes: 480329cf8b31 "nir: Add a helper for getting the alignment of a deref"
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Tested-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6628>

4 years agoci: Remove any existing results directory before running piglit
Michel Dänzer [Fri, 4 Sep 2020 15:31:00 +0000 (17:31 +0200)]
ci: Remove any existing results directory before running piglit

A pre-existing results directory (from a previous job) could cause a
spurious failure, see e.g.
https://gitlab.freedesktop.org/mesa/mesa/-/jobs/4410206

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6601>

4 years agospirv2nir: Rework argument handling
Jason Ekstrand [Fri, 4 Sep 2020 22:14:39 +0000 (17:14 -0500)]
spirv2nir: Rework argument handling

The argument handling of this little tool was pretty rubbish.  It had no
help and it required the filename to come first which is just strange.
This reworks it and makes things much nicer.  It's still rubbish but at
least there's a chance people can figure out how to use it now.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6607>

4 years agospirv: Improve the "Entry point not found" error message
Jason Ekstrand [Fri, 4 Sep 2020 21:50:09 +0000 (16:50 -0500)]
spirv: Improve the "Entry point not found" error message

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6607>

4 years agoswr: fix build with mingw
Michel Zou [Tue, 1 Sep 2020 07:22:27 +0000 (09:22 +0200)]
swr: fix build with mingw

Reviewed-by: Jan Zielinski <jan.zielinski@intel.com>
Tested-by: Prodea Alexandru-Liviu <liviuprodea@yahoo.com>
Cc: mesa-stable
closes #3454

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

4 years agoradeonsi: kill point size VS output if it's not used by the rasterizer
Marek Olšák [Sun, 6 Sep 2020 05:22:01 +0000 (01:22 -0400)]
radeonsi: kill point size VS output if it's not used by the rasterizer

Fixed-func shaders can contain the output, because their generator
doesn't consider the current primitive type into account.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6620>

4 years agoradeonsi: deduplicate setting key.mono.u.vs_export_prim_id
Marek Olšák [Sun, 6 Sep 2020 04:55:57 +0000 (00:55 -0400)]
radeonsi: deduplicate setting key.mono.u.vs_export_prim_id

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6620>

4 years agoradeonsi: use shader_info::cs::local_size_variable to clean up some code
Marek Olšák [Sun, 6 Sep 2020 15:38:53 +0000 (11:38 -0400)]
radeonsi: use shader_info::cs::local_size_variable to clean up some code

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: remove redundant si_shader_info::uses_derivatives
Marek Olšák [Sun, 6 Sep 2020 15:31:18 +0000 (11:31 -0400)]
radeonsi: remove redundant si_shader_info::uses_derivatives

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: remove redundant si_shader_selector::max_gs_stream
Marek Olšák [Sun, 6 Sep 2020 15:26:16 +0000 (11:26 -0400)]
radeonsi: remove redundant si_shader_selector::max_gs_stream

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: remove redundant GS variables in si_shader_selector
Marek Olšák [Sun, 6 Sep 2020 15:23:13 +0000 (11:23 -0400)]
radeonsi: remove redundant GS variables in si_shader_selector

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: remove redundant si_shader_info::writes_memory
Marek Olšák [Sun, 6 Sep 2020 15:19:58 +0000 (11:19 -0400)]
radeonsi: remove redundant si_shader_info::writes_memory

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: rename num_memory_instructions -> num_memory_stores
Marek Olšák [Sun, 6 Sep 2020 15:18:39 +0000 (11:18 -0400)]
radeonsi: rename num_memory_instructions -> num_memory_stores

it only counts stores

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: reduce type sizes in si_shader_selector
Marek Olšák [Sun, 6 Sep 2020 06:50:44 +0000 (02:50 -0400)]
radeonsi: reduce type sizes in si_shader_selector

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: remove redundant si_shader_info::uses_kill
Marek Olšák [Sun, 6 Sep 2020 06:40:58 +0000 (02:40 -0400)]
radeonsi: remove redundant si_shader_info::uses_kill

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: merge uses_persp_opcode_interp_sample/uses_linear_opcode_interp_sample
Marek Olšák [Sun, 6 Sep 2020 06:38:09 +0000 (02:38 -0400)]
radeonsi: merge uses_persp_opcode_interp_sample/uses_linear_opcode_interp_sample

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: remove unused si_shader_info::uses_(vertexid|basevertex)
Marek Olšák [Sun, 6 Sep 2020 06:36:34 +0000 (02:36 -0400)]
radeonsi: remove unused si_shader_info::uses_(vertexid|basevertex)

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: remove redundant si_shader_info:*(clip|cull)* fields
Marek Olšák [Sun, 6 Sep 2020 06:30:54 +0000 (02:30 -0400)]
radeonsi: remove redundant si_shader_info:*(clip|cull)* fields

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: remove redundant si_shader_info::const_buffers_declared
Marek Olšák [Sun, 6 Sep 2020 06:15:51 +0000 (02:15 -0400)]
radeonsi: remove redundant si_shader_info::const_buffers_declared

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: remove redundant si_shader_info::images_declared
Marek Olšák [Sun, 6 Sep 2020 06:15:51 +0000 (02:15 -0400)]
radeonsi: remove redundant si_shader_info::images_declared

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: remove redundant si_shader_info::shader_buffers_declared
Marek Olšák [Sun, 6 Sep 2020 06:15:51 +0000 (02:15 -0400)]
radeonsi: remove redundant si_shader_info::shader_buffers_declared

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: remove info::samplers_declared, image_buffers, msaa_images_declared
Marek Olšák [Sun, 6 Sep 2020 06:10:33 +0000 (02:10 -0400)]
radeonsi: remove info::samplers_declared, image_buffers, msaa_images_declared

They are redundant with shader_info.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS
Marek Olšák [Tue, 1 Sep 2020 22:41:36 +0000 (18:41 -0400)]
radeonsi: stop using TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_CS_LOCAL_SIZE
Marek Olšák [Tue, 1 Sep 2020 22:38:37 +0000 (18:38 -0400)]
radeonsi: stop using TGSI_PROPERTY_CS_LOCAL_SIZE

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_FS_DEPTH_LAYOUT
Marek Olšák [Tue, 1 Sep 2020 22:27:11 +0000 (18:27 -0400)]
radeonsi: stop using TGSI_PROPERTY_FS_DEPTH_LAYOUT

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_FS_COORD_PIXEL_CENTER
Marek Olšák [Tue, 1 Sep 2020 22:22:24 +0000 (18:22 -0400)]
radeonsi: stop using TGSI_PROPERTY_FS_COORD_PIXEL_CENTER

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_FS_POST_DEPTH_COVERAGE
Marek Olšák [Tue, 1 Sep 2020 22:20:09 +0000 (18:20 -0400)]
radeonsi: stop using TGSI_PROPERTY_FS_POST_DEPTH_COVERAGE

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL
Marek Olšák [Tue, 1 Sep 2020 22:17:41 +0000 (18:17 -0400)]
radeonsi: stop using TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_CS_*
Marek Olšák [Tue, 1 Sep 2020 22:14:57 +0000 (18:14 -0400)]
radeonsi: stop using TGSI_PROPERTY_CS_*

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_GS_*
Marek Olšák [Tue, 1 Sep 2020 22:08:05 +0000 (18:08 -0400)]
radeonsi: stop using TGSI_PROPERTY_GS_*

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_TES_VERTEX_ORDER_CW
Marek Olšák [Tue, 1 Sep 2020 22:05:52 +0000 (18:05 -0400)]
radeonsi: stop using TGSI_PROPERTY_TES_VERTEX_ORDER_CW

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_TES_SPACING
Marek Olšák [Tue, 1 Sep 2020 22:04:57 +0000 (18:04 -0400)]
radeonsi: stop using TGSI_PROPERTY_TES_SPACING

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_TES_POINT_MODE / TES_PRIM_MODE
Marek Olšák [Tue, 1 Sep 2020 21:54:47 +0000 (17:54 -0400)]
radeonsi: stop using TGSI_PROPERTY_TES_POINT_MODE / TES_PRIM_MODE

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_TCS_VERTICES_OUT
Marek Olšák [Tue, 1 Sep 2020 21:53:10 +0000 (17:53 -0400)]
radeonsi: stop using TGSI_PROPERTY_TCS_VERTICES_OUT

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION / VS_BLIT_SGPRS_AMD
Marek Olšák [Tue, 1 Sep 2020 21:50:59 +0000 (17:50 -0400)]
radeonsi: stop using TGSI_PROPERTY_VS_WINDOW_SPACE_POSITION / VS_BLIT_SGPRS_AMD

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agoradeonsi: stop using TGSI_PROPERTY_NEXT_SHADER
Marek Olšák [Tue, 1 Sep 2020 21:48:44 +0000 (17:48 -0400)]
radeonsi: stop using TGSI_PROPERTY_NEXT_SHADER

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6624>

4 years agolima/ppir: Skip instruction merge when having more than one successor
Andreas Baierl [Wed, 2 Sep 2020 09:27:10 +0000 (11:27 +0200)]
lima/ppir: Skip instruction merge when having more than one successor

ppir_do_one_node_to_instr merges instructions and uses a pipeline reg
to save a reg. It tests if ppir_node_has_single_src_succ, but it should
check if ppir_node_has_single_succ.

The following deqp tests run into this issue because they have a node
with 2 successors in different blocks, where one was merged into the same
instruction and the second one is pointing to a missing predecessor then.

Fixes the following deqp tests:
dEQP-GLES2.functional.shaders.loops.do_while_dynamic_iterations.vector_counter_fragment
dEQP-GLES2.functional.shaders.loops.for_dynamic_iterations.vector_counter_fragment
dEQP-GLES2.functional.shaders.loops.while_dynamic_iterations.vector_counter_fragment

Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Andreas Baierl <ichgeh@imkreisrum.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6555>

4 years agoswr: Fix crashes on non-AVX hardware
jzielins [Wed, 2 Sep 2020 17:55:29 +0000 (19:55 +0200)]
swr: Fix crashes on non-AVX hardware

Compilers may use vector instructions in calculating
hash values of std::string. This happens usualy when
high optimalization level is enabled. SWR had two
static std::map<std::string, T> variables which
lead to crashes on non-AVX systems during the initialization
of those variables. This commit makes those variables
dynamically allocated and fixes this AVX instruction
leak.

Closes: #3077
Closes: #198
Reviewed-by: Krzysztof Raszkowski <krzysztof.raszkowski@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6565>

4 years agoamd/common: switch to 3-spaces style
Pierre-Eric Pelloux-Prayer [Mon, 7 Sep 2020 07:58:36 +0000 (09:58 +0200)]
amd/common: switch to 3-spaces style

Follow-up of !4319 using the same clang-format config.

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5310>

4 years agoamd/llvm: switch to 3-spaces style
Pierre-Eric Pelloux-Prayer [Mon, 7 Sep 2020 07:56:01 +0000 (09:56 +0200)]
amd/llvm: switch to 3-spaces style

Follow-up of !4319 using the same clang-format config.

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5310>

4 years agovulkan/device_select: don't pick a cpu driver as the default
Dave Airlie [Tue, 1 Sep 2020 23:08:52 +0000 (09:08 +1000)]
vulkan/device_select: don't pick a cpu driver as the default

This should stop apps using vallium by accident, when there
are better options.

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

4 years agoandroid: nv50/ir: Add nv50_ir_prog_info_out serialize and deserialize
Mauro Rossi [Sat, 5 Sep 2020 21:35:28 +0000 (23:35 +0200)]
android: nv50/ir: Add nv50_ir_prog_info_out serialize and deserialize

Fixes the following building errors:

ld.lld: error: undefined symbol: nv50_ir_prog_info_serialize
>>> referenced by nvc0_program.c:647 (external/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_program.c:647)
>>>               nvc0_program.o:(nvc0_program_translate) in archive out/target/product/x86_64/obj/STATIC_LIBRARIES/libmesa_pipe_nouveau_intermediates/libmesa_pipe_nouveau.a

ld.lld: error: undefined symbol: nv50_ir_prog_info_out_deserialize
>>> referenced by nvc0_program.c:656 (external/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_program.c:656)
>>>               nvc0_program.o:(nvc0_program_translate) in archive out/target/product/x86_64/obj/STATIC_LIBRARIES/libmesa_pipe_nouveau_intermediates/libmesa_pipe_nouveau.a

ld.lld: error: undefined symbol: nv50_ir_prog_info_out_serialize
>>> referenced by nvc0_program.c:674 (external/mesa/src/gallium/drivers/nouveau/nvc0/nvc0_program.c:674)
>>>               nvc0_program.o:(nvc0_program_translate) in archive out/target/product/x86_64/obj/STATIC_LIBRARIES/libmesa_pipe_nouveau_intermediates/libmesa_pipe_nouveau.a

Fixes: f20a210dc ("nv50/ir: Add nv50_ir_prog_info_out serialize and deserialize")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6627>

4 years agoci: Run deqp-gles3 and deqp-gles31 on RadeonSI
Tomeu Vizoso [Fri, 21 Aug 2020 08:49:51 +0000 (10:49 +0200)]
ci: Run deqp-gles3 and deqp-gles31 on RadeonSI

Only a fourth of the GLES3 tests and a fifth of the GLES31 tests for
now, as the machine is quite slow and there's a problem with dEQP
calling fesetround all the time and that being very expensive on x86_64.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6580>

4 years agoradeonsi: fix user fence space when MCBP is enabled
Qiang Yu [Thu, 3 Sep 2020 03:30:28 +0000 (11:30 +0800)]
radeonsi: fix user fence space when MCBP is enabled

When MCBP is enabled, IB maybe preempted which will also update
the preempted fence field of the user fence. So we need to reserve
enough space for each user fence.

Fixes: 89d2dac5548 "radeonsi: enable preemption if the kernel enabled it"
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6577>

4 years agoradeonsi: fix syncobj wait timeout
Qiang Yu [Thu, 3 Sep 2020 09:39:41 +0000 (17:39 +0800)]
radeonsi: fix syncobj wait timeout

syncobj wait takes absolute timeout value.

Fixes: 162502370c7 "winsys/amdgpu: implement sync_file import/export"
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6579>

4 years agoandroid: util: fix missing include path
Mauro Rossi [Sat, 5 Sep 2020 16:49:19 +0000 (18:49 +0200)]
android: util: fix missing include path

Fixes the following building error:

external/mesa/src/util/format/u_format_bptc.c:28:10:
fatal error: 'u_format_pack.h' file not found
         ^~~~~~~~~~~~~~~~~
1 error generated.

Fixes: 8d38b2578 ("util: Explicitly call the unpack functions from inside bptc pack/unpack.")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6619>

4 years agoandroid: amd/registers: switch to new generated register definitions
Mauro Rossi [Sat, 5 Sep 2020 15:59:48 +0000 (17:59 +0200)]
android: amd/registers: switch to new generated register definitions

Android building rules are aligned to meson ones

Fixes the following building error:

FAILED: ninja: 'external/mesa/src/amd/registers/amdgfxregs.json',
needed by 'out/target/product/x86_64/gen/STATIC_LIBRARIES/libmesa_amd_common_intermediates/common/sid_tables.h',
missing and no known rule to make it

Fixes: b7a6333ee ("amd/registers: switch to new generated register definitions")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6618>

4 years agoac/llvm: fix b2f for v2f16
Marek Olšák [Sun, 6 Sep 2020 07:46:59 +0000 (03:46 -0400)]
ac/llvm: fix b2f for v2f16

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoac/llvm: add better code for fsign
Marek Olšák [Thu, 3 Sep 2020 09:31:36 +0000 (05:31 -0400)]
ac/llvm: add better code for fsign

There are 2 improvements:
- better code for 16, 32, and 64 bits
- vector support for 16 and 32 bits

Totals:
SGPRS: 2639738 -> 2625882 (-0.52 %)
VGPRS: 1534120 -> 1533916 (-0.01 %)
Spilled SGPRs: 3541 -> 3557 (0.45 %)
Spilled VGPRs: 33 -> 33 (0.00 %)
Private memory VGPRs: 256 -> 256 (0.00 %)
Scratch size: 292 -> 292 (0.00 %) dwords per thread
Code Size: 55640332 -> 55384892 (-0.46 %) bytes
Max Waves: 964785 -> 964857 (0.01 %)

Totals from affected shaders:
SGPRS: 377352 -> 363496 (-3.67 %)
VGPRS: 209800 -> 209596 (-0.10 %)
Spilled SGPRs: 1979 -> 1995 (0.81 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 256 -> 256 (0.00 %)
Scratch size: 256 -> 256 (0.00 %) dwords per thread
Code Size: 12549300 -> 12293860 (-2.04 %) bytes
Max Waves: 105762 -> 105834 (0.07 %)

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoac/llvm: add better code for isign
Marek Olšák [Thu, 3 Sep 2020 09:51:17 +0000 (05:51 -0400)]
ac/llvm: add better code for isign

There are 2 improvements:
- select v_med3_i32
- support vectors

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoac/llvm: remove dead code handling for fmod
Marek Olšák [Thu, 23 Jul 2020 02:05:45 +0000 (22:05 -0400)]
ac/llvm: remove dead code handling for fmod

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoac/llvm: fix bcsel for v2*16
Marek Olšák [Sat, 4 Jul 2020 20:49:52 +0000 (16:49 -0400)]
ac/llvm: fix bcsel for v2*16

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoac/llvm: fix amdgcn.rsq for v2f16
Marek Olšák [Thu, 23 Jul 2020 03:03:39 +0000 (23:03 -0400)]
ac/llvm: fix amdgcn.rsq for v2f16

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoac/llvm: fix amdgcn.fract for v2f16
Marek Olšák [Sat, 4 Jul 2020 20:50:06 +0000 (16:50 -0400)]
ac/llvm: fix amdgcn.fract for v2f16

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoac/llvm: fix amdgcn.rcp for v2f16
Marek Olšák [Sat, 4 Jul 2020 20:17:28 +0000 (16:17 -0400)]
ac/llvm: fix amdgcn.rcp for v2f16

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoac/llvm: remove stub prototype for fmed3
Marek Olšák [Thu, 3 Sep 2020 10:18:18 +0000 (06:18 -0400)]
ac/llvm: remove stub prototype for fmed3

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoRevert "ac: generate FMA for inexact instructions for radeonsi"
Marek Olšák [Tue, 1 Sep 2020 03:37:37 +0000 (23:37 -0400)]
Revert "ac: generate FMA for inexact instructions for radeonsi"

This reverts commit 4b9370cb0f3a2d9030e827f847f66bdefeaf08fd.

Fixes: 4b9370cb0f3a2d9030e827f847f66bdefeaf08fd
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3429

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoradeonsi: move nir_shader_compiler_options into si_screen
Marek Olšák [Sun, 3 May 2020 23:38:51 +0000 (19:38 -0400)]
radeonsi: move nir_shader_compiler_options into si_screen

so that they can be different depending on the GPU (for 16-bit support)

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoradeonsi: remove redundant no-signed-zero-fp-math LLVM attribute
Marek Olšák [Thu, 3 Sep 2020 08:42:38 +0000 (04:42 -0400)]
radeonsi: remove redundant no-signed-zero-fp-math LLVM attribute

Already set by AC_FLOAT_MODE_DEFAULT_OPENGL.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6284>

4 years agoegl/x11: Free memory allocated for reply structures on error
Andrey Vostrikov [Thu, 27 Aug 2020 06:32:48 +0000 (09:32 +0300)]
egl/x11: Free memory allocated for reply structures on error

This patch fixes memory leaks when reply is allocated and is not freed
on error execution path.

Found by enabling address sanitizer on simple EGL app.

```c

int main()
{
    EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
    EGLint major;
    EGLint minor;

    if (!eglInitialize(display, &major, &minor))
    {
        return 1;
    }
    eglTerminate(display);
    return 0;
}
```

Compiled with: `gcc testme.c -o testme -fsanitize=address -lasan -lEGL`

Execution environment:
- Windows 10, VMWare Player 15.5.2 build-15785246 without 3D accelaration
- Guest OS: OpenSUSE Leap 15.2
- Mesa 19.3.4

Program output:

```sh
ASAN_OPTIONS=fast_unwind_on_malloc=0 ./testme

libEGL warning: DRI2: failed to authenticate
==52510==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 32 byte(s) in 1 object(s) allocated from:
    #0 0x7fa62315f500 in malloc (/usr/lib64/libasan.so.4+0xdc500)
    #1 0x7fa61e12d86b  (/usr/lib64/libxcb.so.1+0xf86b)
    #2 0x7fa61e12b5c7  (/usr/lib64/libxcb.so.1+0xd5c7)
    #3 0x7fa61e12cc3e  (/usr/lib64/libxcb.so.1+0xec3e)
    #4 0x7fa61e12cd4f in xcb_wait_for_reply (/usr/lib64/libxcb.so.1+0xed4f)
    #5 0x7fa61ebe02a5  (/usr/lib64/libEGL_mesa.so.0+0x202a5)
    #6 0x7fa61ebdb5ca  (/usr/lib64/libEGL_mesa.so.0+0x1b5ca)
    #7 0x7fa61ebd750c  (/usr/lib64/libEGL_mesa.so.0+0x1750c)
    #8 0x7fa61ebd7554  (/usr/lib64/libEGL_mesa.so.0+0x17554)
    #9 0x7fa61ebd1107  (/usr/lib64/libEGL_mesa.so.0+0x11107)
    #10 0x400856 in main (/home/user/testme+0x400856)
    #11 0x7fa622ad8349 in __libc_start_main (/lib64/libc.so.6+0x24349)
    #12 0x4006e9 in _start (/home/user/testme+0x4006e9)

SUMMARY: AddressSanitizer: 32 byte(s) leaked in 1 allocation(s).
```

Signed-off-by: Andrey Vostrikov <av.linux.dev@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6611>

4 years agoglsl_to_nir: fix crashes with int16 shifts
Marek Olšák [Thu, 3 Sep 2020 13:27:58 +0000 (09:27 -0400)]
glsl_to_nir: fix crashes with int16 shifts

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6613>

4 years agospirv: fix emitting switch cases that directly jump to the merge block
Samuel Pitoiset [Thu, 3 Sep 2020 20:02:01 +0000 (22:02 +0200)]
spirv: fix emitting switch cases that directly jump to the merge block

As shown in the valid SPIR-V below, if one switch case statement
directly jumps to the merge block, it has no branches at all and
we have to reset the fall variable. Otherwise, it creates an
unintentional fallthrough.

       OpSelectionMerge %97 None
       OpSwitch %96 %97 1 %99 2 %100
%100 = OpLabel
%102 = OpAccessChain %_ptr_StorageBuffer_v4float %86 %uint_0 %uint_37
%103 = OpLoad %v4float %102
%104 = OpBitcast %v4uint %103
%105 = OpCompositeExtract %uint %104 0
%106 = OpShiftLeftLogical %uint %105 %uint_1
       OpBranch %97
 %99 = OpLabel
       OpBranch %97
 %97 = OpLabel
%107 = OpPhi %uint %uint_4 %75 %uint_5 %99 %106 %100

This fixes serious corruption in Horizon Zero Dawn.

v2: Changed the code to skip the entire if-block instead of resetting
    the fallthrough variable.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3460
Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6590>

4 years agocompiler/types: Fix deserializing structs with >= 15 members
Jason Ekstrand [Fri, 4 Sep 2020 19:06:29 +0000 (14:06 -0500)]
compiler/types: Fix deserializing structs with >= 15 members

This was a typo in a0b82c24b6d08c where we used the wrong struct member
to decide whether or not to read the explicit_alignment.

Fixes: a0b82c24b6d08c "nir/glsl: Add an explicit_alignment field to glsl_type"
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3487
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6605>

4 years agofreedreno/regs: add 7nm DSI PHY/PLL regs
Jonathan Marek [Fri, 4 Sep 2020 17:36:22 +0000 (13:36 -0400)]
freedreno/regs: add 7nm DSI PHY/PLL regs

This is for the kernel driver.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6603>

4 years agogallivm: add InstSimplify pass
Roland Scheidegger [Wed, 2 Sep 2020 02:04:50 +0000 (04:04 +0200)]
gallivm: add InstSimplify pass

This is the recommended replacement for the removed ConstantPropagation
pass, and llvm now added c binding for it.

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

4 years agointel/compiler: fix typo in a comment
Marcin Ślusarz [Thu, 2 Jul 2020 16:57:08 +0000 (18:57 +0200)]
intel/compiler: fix typo in a comment

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6602>