platform/upstream/mesa.git
2 years agointel: Add intel_gem_count_engines
Jordan Justen [Tue, 31 Aug 2021 09:22:44 +0000 (02:22 -0700)]
intel: Add intel_gem_count_engines

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

2 years agodocs: Add calendar entries for 22.0 release candidates.
Dylan Baker [Thu, 2 Dec 2021 23:53:58 +0000 (15:53 -0800)]
docs: Add calendar entries for 22.0 release candidates.

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

2 years agovenus: fix vn_instance_wait_roundtrip when seqno wraps
Chia-I Wu [Thu, 2 Dec 2021 23:01:09 +0000 (15:01 -0800)]
venus: fix vn_instance_wait_roundtrip when seqno wraps

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14026>

2 years agozink/ci: Add GL4.6 tessellation flake
Daniel Stone [Thu, 2 Dec 2021 14:57:02 +0000 (14:57 +0000)]
zink/ci: Add GL4.6 tessellation flake

Seen in https://gitlab.freedesktop.org/mesa/mesa/-/jobs/16318152#L636
which is extremely unrelated.

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

2 years agoci: Use ci-fairy minio login via token file
Guilherme Gallo [Thu, 2 Dec 2021 13:13:10 +0000 (10:13 -0300)]
ci: Use ci-fairy minio login via token file

For every CI job, put JWT content into a file and unset CI_JOB_JWT
environment var
=======

* virgl jobs:
- Share JWT token file to crosvm instance
- Keep using `export -p` due to high complexity in the scripts
  of these jobs. At least, the CI_JOB_JWT will not be leaked,
  since it is being unset at the `before_script` phase of each
  Mesa CI job.

* iris jobs: Update lava_job_submitter to take token file as argument
- generate-env with CI_JOB_JWT_TOKEN_FILE
- create token file during baremetal init stage

* baremetal jobs: Copy token file to bare-metal NFS

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14004>

2 years agoci: Uprev piglit
Guilherme Gallo [Thu, 2 Dec 2021 13:10:26 +0000 (10:10 -0300)]
ci: Uprev piglit

Bring up the piglit replay jwt-file argument feature.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14004>

2 years agoci: Update ci-fairy to version with --token-file support
Guilherme Gallo [Fri, 5 Nov 2021 03:13:01 +0000 (00:13 -0300)]
ci: Update ci-fairy to version with --token-file support

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Reviewed-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14004>

2 years agomeson: check for lld split TLSDESC bug (fixes #5665)
Alex Xu (Hello71) [Tue, 23 Nov 2021 20:05:01 +0000 (15:05 -0500)]
meson: check for lld split TLSDESC bug (fixes #5665)

Reviewed-by: Emma Anholt <emma@anholt.net>
Tested-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13934>

2 years agoegl/wayland: fix surface dma-buf feedback error exits
Leandro Ribeiro [Tue, 30 Nov 2021 16:40:26 +0000 (13:40 -0300)]
egl/wayland: fix surface dma-buf feedback error exits

This fixes a leak that was introduced in 89d15b9a "egl/wayland: add
initial dma-buf feedback support".

Do not leak dri2_surf->wl_dmabuf_feedback when we have to bail out
because of allocation issues.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13985>

2 years agoegl/wayland: do not try to bind to wl_drm if not advertised
Leandro Ribeiro [Tue, 30 Nov 2021 15:00:51 +0000 (12:00 -0300)]
egl/wayland: do not try to bind to wl_drm if not advertised

This fixes a bug that was introduced in 89d15b9a "egl/wayland: add
initial dma-buf feedback support".

Sometimes we have to fallback to wl_drm. But do not try to bind to it
when it is not advertised by the compositor.

This issue was found by n3rdopolis and reported here:
https://gitlab.freedesktop.org/mesa/mesa/-/issues/5697

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13985>

2 years agoradv: upload shader binaries of a pipeline contiguously in memory
Samuel Pitoiset [Fri, 5 Nov 2021 12:58:12 +0000 (13:58 +0100)]
radv: upload shader binaries of a pipeline contiguously in memory

RGP expects shaders to be contiguous in memory, otherwise it explodes
because we have to generate huge captures with lot of holes.

This reduces capture sizes of Cyberpunk 2077 from ~3.5GiB to ~180MiB.

This should also help for future pipeline libraries.

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/13690>

2 years agoradv: pass a pointer to a pipeline for the create/insert cache functions
Samuel Pitoiset [Fri, 5 Nov 2021 12:57:35 +0000 (13:57 +0100)]
radv: pass a pointer to a pipeline for the create/insert cache functions

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/13690>

2 years agoradv: upload shader binaries after they are all compiled
Samuel Pitoiset [Fri, 5 Nov 2021 12:30:28 +0000 (13:30 +0100)]
radv: upload shader binaries after they are all compiled

Instead of mixing compilation and upload. This will allow us to
upload all shader binaries contiguously in memory and also for future
pipeline libraries work.

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/13690>

2 years agoradv: add a helper function to upload a shader binary
Samuel Pitoiset [Fri, 5 Nov 2021 12:30:06 +0000 (13:30 +0100)]
radv: add a helper function to upload a shader binary

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/13690>

2 years agoradv: remove never reached free() when compiling shaders
Samuel Pitoiset [Fri, 5 Nov 2021 12:30:44 +0000 (13:30 +0100)]
radv: remove never reached free() when compiling shaders

binary_out is never NULL and binaries are freed from the pipeline
after they are added to the cache.

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/13690>

2 years agofreedreno/ci/a306: split off snorm blending failures
Ilia Mirkin [Wed, 1 Dec 2021 05:17:26 +0000 (00:17 -0500)]
freedreno/ci/a306: split off snorm blending failures

The hardware doesn't support this.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13990>

2 years agofreedreno/ci/a306: split off the f32 blend / texturing failures
Ilia Mirkin [Wed, 1 Dec 2021 05:11:30 +0000 (00:11 -0500)]
freedreno/ci/a306: split off the f32 blend / texturing failures

The hardware doesn't support this.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13990>

2 years agofreedreno/ci/a306: separate msaa fails
Ilia Mirkin [Wed, 1 Dec 2021 05:04:59 +0000 (00:04 -0500)]
freedreno/ci/a306: separate msaa fails

The driver does not implement MSAA. When that happens these can be split
up further.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13990>

2 years agowindows: Use TLS context/dispatch with shared-glapi
Jesse Natalie [Tue, 2 Nov 2021 18:38:02 +0000 (11:38 -0700)]
windows: Use TLS context/dispatch with shared-glapi

However they have to be called via _glapi_get_dispatch/context. This
would be safe to do on any platform, but the extra indirection is only
necessary on Windows since TLS vars can't be exported from a DLL.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13634>

2 years agofreedreno/a3xx: add some legacy formats
Ilia Mirkin [Wed, 1 Dec 2021 03:53:15 +0000 (22:53 -0500)]
freedreno/a3xx: add some legacy formats

These can be used in "legacy" buffer textures.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13989>

2 years agofreedreno/ci/a306: add additional skip which hangchecks
Ilia Mirkin [Wed, 1 Dec 2021 04:33:23 +0000 (23:33 -0500)]
freedreno/ci/a306: add additional skip which hangchecks

I was having trouble getting a run to complete without this. Was working
earlier, not sure what changed.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13989>

2 years agofreedreno/a6xx: Set the tess BO ptrs in the program stateobj.
Emma Anholt [Wed, 17 Nov 2021 22:45:03 +0000 (14:45 -0800)]
freedreno/a6xx: Set the tess BO ptrs in the program stateobj.

Saves some draw-time work for tess.

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

2 years agofreedreno/a6xx: Skip emitting tess BO pointers past the shader's constlen.
Emma Anholt [Wed, 17 Nov 2021 22:37:29 +0000 (14:37 -0800)]
freedreno/a6xx: Skip emitting tess BO pointers past the shader's constlen.

Some shaders don't want these pointers, and going past the constlen would
potentially overwrite consts from other draws.  This is a port of a fix
from turnip.

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

2 years agofreedreno/a6xx: Allocate a fixed-size tess factor BO.
Emma Anholt [Wed, 17 Nov 2021 22:10:41 +0000 (14:10 -0800)]
freedreno/a6xx: Allocate a fixed-size tess factor BO.

Saves per-batch allocations, avoids reallocation for various vertex
counts, and avoids needing the indirect tess addrs constobj so that we
could emit the relocs to the tess BO after we'd emitted all the draws.

Also apparently it fixes one of our CTS fails.

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

2 years agoradv: Don't emit framebuffer state if there is no renderpass active.
Bas Nieuwenhuizen [Sun, 28 Nov 2021 12:09:57 +0000 (13:09 +0100)]
radv: Don't emit framebuffer state if there is no renderpass active.

The framebuffer state could still be dirty from when the previous
renderpass was bound.

Fixes: 5632359959f ("radv: Remove the skipping of framebuffer emission if we don't have a framebuffer.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5702
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13969>

2 years agod3d12: Support compat level 330
Jesse Natalie [Sat, 20 Nov 2021 04:07:30 +0000 (20:07 -0800)]
d3d12: Support compat level 330

Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14001>

2 years agovenus: ignore framebuffer for VkCommandBuffer executed outside of render pass
Ryan Neph [Tue, 30 Nov 2021 23:39:17 +0000 (15:39 -0800)]
venus: ignore framebuffer for VkCommandBuffer executed outside of render pass

The vulkan spec states[1]:
> If the VkCommandBuffer will not be executed within a render pass instance,
> or if the render pass instance was begun with vkCmdBeginRenderingKHR,
> renderPass, subpass, and framebuffer are ignored.

but venus will still try to encode them, resulting in a guest-side
assert or host-side command stream error.

[1]: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkCommandBufferInheritanceInfo.html#_description

Signed-off-by: Ryan Neph <ryanneph@google.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13988>

2 years agonir: Make nir_build_alu() variants per 1-4 arg count.
Emma Anholt [Mon, 22 Nov 2021 19:45:23 +0000 (11:45 -0800)]
nir: Make nir_build_alu() variants per 1-4 arg count.

This saves a bunch of generated code to pack up the extra NULLs to get to
4 args, and saves executing the conditions in nir_build_alu() to then skip
those NULLs.

Saves another 27kb on disk.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13916>

2 years agonir: Uninline a bunch of nir.h functions.
Emma Anholt [Mon, 22 Nov 2021 19:11:16 +0000 (11:11 -0800)]
nir: Uninline a bunch of nir.h functions.

I aimed for "things that look like big switch statements, or cases where
the compiler is unlikely to be able to constant-propagate an argument into
something useful."

Saves another 80kb on disk.  No perf difference on iris shader-db, n=23.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13916>

2 years agoiris: Drop redundant iris_resource_disable_aux call
Nanley Chery [Mon, 16 Aug 2021 16:08:24 +0000 (09:08 -0700)]
iris: Drop redundant iris_resource_disable_aux call

Drop the call to iris_resource_disable_aux in
iris_resource_configure_aux. With the previous patches, we no longer
create CCS surfaces and pick the AUX_NONE usage. As a result, if the aux
usage is NONE, all iris_resource fields already indicate that aux is
disabled.

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

2 years agoiris: Enable CCS_E on 32-bpc float formats on TGL+
Nanley Chery [Mon, 16 Aug 2021 15:57:35 +0000 (08:57 -0700)]
iris: Enable CCS_E on 32-bpc float formats on TGL+

Allow CCS_E on these formats on TGL+ for a couple reasons:

1) TGL doesn't have the option to fall back to CCS_D/fast-clears like
   prior platforms do.

2) The CCS compression scheme on TGL improves to encode more than 3
   levels of compression. This should help floating point formats.

In my measurements, enabling this on TGL results in a minor performance
improvement on Paraview (+0.06%) rather than a major regression like on
prior platforms. The improvement was measured by taking the average of 3
runs of: waveletvolume.py -d 256 -f 600.

Also, the Intel performance CI reports a 3.81% ±0.12% FPS improvement in
Bioshock Infinite.

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

2 years agointel/isl: Unify fmt checks in isl_surf_supports_ccs
Nanley Chery [Mon, 16 Aug 2021 15:48:31 +0000 (08:48 -0700)]
intel/isl: Unify fmt checks in isl_surf_supports_ccs

On TGL+, require that the surface format supports CCS_E in order to
support CCS. This aligns with the ISL code that pads the primary
surface for CCS on this platform.

Pre-TGL, require support for either CCS_D or CCS_E.

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

2 years agodocs: update calendar and link releases notes for 21.3.1
Eric Engestrom [Wed, 1 Dec 2021 19:08:02 +0000 (19:08 +0000)]
docs: update calendar and link releases notes for 21.3.1

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

2 years agodocs: add release notes for 21.3.1
Eric Engestrom [Wed, 1 Dec 2021 18:56:57 +0000 (18:56 +0000)]
docs: add release notes for 21.3.1

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

2 years agoCI/d3d12: Add a quick_shader run
Jesse Natalie [Sun, 21 Nov 2021 15:33:16 +0000 (07:33 -0800)]
CI/d3d12: Add a quick_shader run

Refactor the YML for some DRY, and rename the existing pass from
"-windows" to "-quick_gl" to disambiguate it.

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13902>

2 years agoCI/windows: Move reference files to relevant ci subdirectories
Jesse Natalie [Sun, 21 Nov 2021 15:22:59 +0000 (07:22 -0800)]
CI/windows: Move reference files to relevant ci subdirectories

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13902>

2 years agoCI/windows: Move SPIRV-to-DXIL test YML to microsoft folder
Jesse Natalie [Sun, 21 Nov 2021 14:41:37 +0000 (06:41 -0800)]
CI/windows: Move SPIRV-to-DXIL test YML to microsoft folder

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13902>

2 years agoCI/windows: Move D3D12 test YML to D3D12 driver folder
Jesse Natalie [Sun, 21 Nov 2021 14:38:20 +0000 (06:38 -0800)]
CI/windows: Move D3D12 test YML to D3D12 driver folder

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13902>

2 years agofreedreno/crashdec: Basing GMU log decoding
Rob Clark [Sun, 28 Nov 2021 16:58:45 +0000 (08:58 -0800)]
freedreno/crashdec: Basing GMU log decoding

Looks like each entry is four dwords, with the second dword being a
timestamp.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13937>

2 years agofreedreno/crashdec: Fallback to chip_id for GPU id
Rob Clark [Wed, 24 Nov 2021 23:03:20 +0000 (15:03 -0800)]
freedreno/crashdec: Fallback to chip_id for GPU id

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13937>

2 years agofreedreno/crashdec: HFI queue decoding
Rob Clark [Mon, 22 Nov 2021 23:21:08 +0000 (15:21 -0800)]
freedreno/crashdec: HFI queue decoding

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13937>

2 years agofreedreno/crashdec: Split out mempool decoding
Rob Clark [Tue, 23 Nov 2021 17:40:15 +0000 (09:40 -0800)]
freedreno/crashdec: Split out mempool decoding

Before we start adding GMU HFI decoding, lets split the other big
section specific decoding (mempool) out into it's own file.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13937>

2 years agoturnip: Move CP_SET_SUBDRAW_SIZE to vkCmdBindPipeline() time.
Emma Anholt [Wed, 17 Nov 2021 21:26:06 +0000 (13:26 -0800)]
turnip: Move CP_SET_SUBDRAW_SIZE to vkCmdBindPipeline() time.

Now that the subdraw size is constant for a pipeline, this lets tess draws
avoid the slow path in vkCmdDraw*().

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

2 years agoturnip: use SUBDRAW_SIZE and constant sized tess bos
Jonathan Marek [Mon, 27 Jul 2020 14:06:46 +0000 (10:06 -0400)]
turnip: use SUBDRAW_SIZE and constant sized tess bos

This fixes the problem of large indirect draws, and at the same time avoids
allocating too large buffers for tessellation.

Reworked by @anholt to use a separate tess factor BO so we can skip the
WFIs to set the TESSFACTOR_ADDR.

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

2 years agofreedreno/ir3: Make a shared helper for the tess factor stride.
Emma Anholt [Wed, 17 Nov 2021 19:07:42 +0000 (11:07 -0800)]
freedreno/ir3: Make a shared helper for the tess factor stride.

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

2 years agonouveau/nir: Use natural alignment for scalars
M Henning [Thu, 18 Nov 2021 06:08:43 +0000 (01:08 -0500)]
nouveau/nir: Use natural alignment for scalars

We used to request vec4 alignment for everything on the nir codepath,
but this triggers an assertion failure since a0b82c24b6, which prohibits
vec4 alignment on scalars. Since requiring vec4 alignment on scalars is a
little silly anyway, this patch relaxes the alignment to naturally aligned
for scalars.

Fixes about 27 crashing tests in piglit and deqp on kepler, including eg
piglit/tests/spec/glsl-1.30/execution/fs-large-local-array.shader_test

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13883>

2 years agoutil/u_trace/perfetto: add new env variable to enable perfetto
Lionel Landwerlin [Mon, 22 Nov 2021 10:56:20 +0000 (12:56 +0200)]
util/u_trace/perfetto: add new env variable to enable perfetto

When using the Vulkan API, command buffers can be recorded way before
perfetto is enabled. This can be problematic if you want already
recorded command buffers to produce traces.

This new environment variable makes perfetto enabled internally so
that command buffers are recorded with timestamps, even though no
perfetto recording happens.

v2: rename to GPU_TRACE_INSTRUMENT (Rob)

v3: Move instrumentation check to generated headers (Danylo)
    Decouple instrumentation enabling from tracing (Danylo)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13911>

2 years agoutil/u_trace: add end_of_pipe property to tracepoints
Lionel Landwerlin [Mon, 22 Nov 2021 09:30:50 +0000 (11:30 +0200)]
util/u_trace: add end_of_pipe property to tracepoints

In order to capture the timestamp when things actually end on Intel
GPU HW, we need to know whether the timestamp should be capture at the
top or end of pipeline.

v2: use one line python if/else (Danylo)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13911>

2 years agoglsl: fix for unused variable in glsl_types.cpp
Viktoriia Palianytsia [Tue, 9 Nov 2021 12:49:45 +0000 (14:49 +0200)]
glsl: fix for unused variable in glsl_types.cpp

Unused variable vector_elements is now used in return from
function decode_type_from_blob instead of encoded.basic.vector_elements.
In the code we can see how those variables were equated
and then the operations were made exactly to vector_elements.
But variable didn't pass into any other variables or functions.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5536
Signed-off-by: Viktoriia Palianytsia <v.palianytsia@globallogic.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13725>

2 years agospirv: handle SpvOpMemberName
Marcin Ślusarz [Wed, 24 Nov 2021 11:09:51 +0000 (12:09 +0100)]
spirv: handle SpvOpMemberName

Now we can see field names in structs instead of generic
"fieldN" with NIR_PRINT=1.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13941>

2 years agonir/opt_deref: don't try to cast empty structures
Lionel Landwerlin [Tue, 16 Nov 2021 12:25:08 +0000 (14:25 +0200)]
nir/opt_deref: don't try to cast empty structures

Found while running valgrind :

==3583454== Invalid read of size 4
==3583454==    at 0xF48336: glsl_get_struct_field_offset (nir_types.cpp:84)
==3583454==    by 0xC7CD0D: opt_replace_struct_wrapper_cast (nir_deref.c:1068)
==3583454==    by 0xC7CDD9: opt_deref_cast (nir_deref.c:1087)
==3583454==    by 0xC7DD8E: nir_opt_deref_impl (nir_deref.c:1369)
==3583454==    by 0xC7DF4E: nir_opt_deref (nir_deref.c:1428)
==3583454==    by 0xA63F3C: brw_kernel_from_spirv (brw_kernel.c:325)
==3583454==    by 0xA3BC2C: main (intel_clc.c:481)
==3583454==  Address 0xe4f7e88 is 24 bytes after a block of size 48 in arena "client"

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13952>

2 years agogallium/d3d12: Don't use designated initializers
Boris Brezillon [Mon, 22 Nov 2021 13:41:35 +0000 (05:41 -0800)]
gallium/d3d12: Don't use designated initializers

Use of designated initializers requires at least '/std:c++20', and
mesa is using c++14 by default.

Fixes: 8d3a3e7a00b ("microsoft/compiler: Use textures for SRVs")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13912>

2 years agomicrosoft/compiler: Fix dxil_nir_create_bare_samplers()
Boris Brezillon [Mon, 22 Nov 2021 15:31:00 +0000 (07:31 -0800)]
microsoft/compiler: Fix dxil_nir_create_bare_samplers()

_mesa_hash_table_u64_search() returns the data directly, not an
hash_entry object. We also need to take the descriptor set into account
for this pass to work properly on Vulkan shaders.

Fixes: 46bc7cf6783 ("microsoft/compiler: Rewrite sampler splitting pass to be smarter and handle derefs")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13912>

2 years agofreedreno/ci: add piglit runs for a306
Ilia Mirkin [Tue, 23 Nov 2021 03:57:40 +0000 (22:57 -0500)]
freedreno/ci: add piglit runs for a306

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13920>

2 years agoandroid: define cpp_rtti=false because libLLVM is built w/o RTTI (v2)
Mauro Rossi [Fri, 19 Nov 2021 23:47:18 +0000 (00:47 +0100)]
android: define cpp_rtti=false because libLLVM is built w/o RTTI (v2)

libLLVM for Android is built without RTTI, but after commit ad86267
mesa inherits meson default RTTI enabled state.

cpp_rtti=false is added to meson options in android/mesa3d_cross.mk

(v2) Add Fixes tag and use spaces instead of tabs for aligning the trailing \

Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Fixes: ad862674 ("meson: Don't override built-in cpp_rtti option, error if it's invalid")
Cc: "21.3" "21.2" mesa-stable
Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13901>

2 years agoRevert "android: define cpp_rtti=false because libLLVM is built w/o RTTI"
Mauro Rossi [Mon, 29 Nov 2021 20:45:09 +0000 (21:45 +0100)]
Revert "android: define cpp_rtti=false because libLLVM is built w/o RTTI"

This reverts commit f659d00000a1a3667f9861d01d5828dd12ec6857.
The revert is done because essential Fixes tag was missing
and to apply a better version that could be picked for mesa-stable.

Acked-by: Marijn Suijten <marijn.suijten@somainline.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13901>

2 years agoaco: don't create DPP instructions with SGPR operands
Rhys Perry [Mon, 29 Nov 2021 16:34:15 +0000 (16:34 +0000)]
aco: don't create DPP instructions with SGPR operands

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 2e6834d4f6c ("aco: combine DPP into VALU before RA")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13976>

2 years agopanfrost: Add empty tile flags to GenXML
Alyssa Rosenzweig [Mon, 29 Nov 2021 19:28:45 +0000 (14:28 -0500)]
panfrost: Add empty tile flags to GenXML

These flags control special CRC handling for empty tiles using the CRC
clear colour field added on Bifrost. Their use depends on CRC being
used. We missed these flags earlier; let's add them since they are used
by the Valhall DDK but are not new to Valhall.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13982>

2 years agoradv: fix resetting the entire vertex input dynamic state
Samuel Pitoiset [Thu, 18 Nov 2021 11:19:53 +0000 (12:19 +0100)]
radv: fix resetting the entire vertex input dynamic state

If there is holes, eg. the application firsts set vertex attributes
0 and 1, then vertex attributes 0 and 7, the format of vertex attribute
1 is still the previous one, while it should be FORMAT_INVALID to avoid
a GPU hang.

This fixes a GPU hang with Yuzu.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5627
Cc: 21.3 mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13856>

2 years agoanv: Drop code from get_blorp_surf_for_anv_buffer
Nanley Chery [Fri, 12 Nov 2021 20:04:04 +0000 (15:04 -0500)]
anv: Drop code from get_blorp_surf_for_anv_buffer

The code to handle ASTC surfaces hasn't been needed since commit
dd92179a72 ("anv: Canonicalize buffer formats for image/buffer copies").

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13881>

2 years agoanv: Allow transfer-only linear ASTC images
Nanley Chery [Fri, 12 Nov 2021 18:37:32 +0000 (13:37 -0500)]
anv: Allow transfer-only linear ASTC images

Some apps depend on this to run.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2397

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13881>

2 years agoanv: Require transfer features for transfer usages
Nanley Chery [Fri, 12 Nov 2021 18:36:20 +0000 (13:36 -0500)]
anv: Require transfer features for transfer usages

In order for an image to support the transfer usage, require that its
format can be used for blits or copies.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13881>

2 years agoiris: Allow GPU-based uploads of ASTC textures
Nanley Chery [Fri, 12 Nov 2021 14:45:02 +0000 (09:45 -0500)]
iris: Allow GPU-based uploads of ASTC textures

ISL recently started allowing linear ASTC surfaces to be created. With
that in place, iris can perform GPU-based uploads to ASTC textures in
the same way it does so with other compressed surfaces.

We're not aware of any reason to continue special-casing ASTC texture
uploads, so we get rid of the code which does so.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13881>

2 years agointel/isl: Allow creating non-Y-tiled ASTC surfaces
Nanley Chery [Fri, 12 Nov 2021 14:42:22 +0000 (09:42 -0500)]
intel/isl: Allow creating non-Y-tiled ASTC surfaces

The sampler can only decode ASTC surfaces that are Y-tiled. ISL has
been asserting this restriction at surface creation time.

However, some drivers want to create a surface that is only used for
copying compressed data. And during the copy, the surface won't have a
compressed format.

To enable this behavior, we choose to move the tiling assertion to the
moment a surface state is created for the sampler.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13881>

2 years agoblorp: Disallow multisampling for BLORP compute blits and copies.
Kenneth Graunke [Mon, 4 Oct 2021 23:17:18 +0000 (16:17 -0700)]
blorp: Disallow multisampling for BLORP compute blits and copies.

We don't support typed image writes for multisampling, so we can't
handle multisampled destinations.  We also usually handle MSAA by
running the fragment shader per-sample, which we aren't accounting
for in our compute shaders, so we can't handle MSAA sources either.

We could do both of these things if we really wanted to, but we don't.

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

2 years agoblorp: Assert that BLORP_BATCH_PREDICATE_ENABLE isn't set for compute
Kenneth Graunke [Mon, 4 Oct 2021 23:06:05 +0000 (16:06 -0700)]
blorp: Assert that BLORP_BATCH_PREDICATE_ENABLE isn't set for compute

We don't support this, so make sure it isn't happening.

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

2 years agoblorp: Don't try to use the 3D stencil write hardware for compute
Kenneth Graunke [Mon, 4 Oct 2021 18:27:19 +0000 (11:27 -0700)]
blorp: Don't try to use the 3D stencil write hardware for compute

When we're doing a stencil blit via a fragment shader, we can avoid
W-tiling shenanigans by using the stencil write hardware on Skylake
and later.

Of course, the compute engine doesn't have stencil fragment writes,
so it can't do that.  Just fall back to the detiling shenanigans.

Caught by Piglit's arb_copy_image-formats when forcing iris to use
BLOCS for resource_copy_region on Icelake.

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

2 years agoblorp: Fix compute-blits for rectangles not aligned to the workgroup
Kenneth Graunke [Sat, 2 Oct 2021 08:31:35 +0000 (01:31 -0700)]
blorp: Fix compute-blits for rectangles not aligned to the workgroup

When dispatching compute shaders to do a blit, our destination rectangle
may not line up perfectly with the workgroup size.  For example, we may
round the left x0 coordinate down to a multiple of the workgroup width,
and the right x1 coordinate up to the next multiple of the workgroup
width.  Similarly for y0/y1 and workgroup height.  This means that we
may dispatch additional invocations which should not actually do any
blitting.  We need to set key->uses_kill to bounds check and drop those.

Caught by Piglit's arb_copy_image-simple when forcing iris to perform
resource_copy_region via BLOCS and running with INTEL_DEBUG=norbc on
Icelake.

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

2 years agoiris: fix mapping compressed textures
Filip Gawin [Wed, 18 Aug 2021 07:57:09 +0000 (09:57 +0200)]
iris: fix mapping compressed textures

This code was originally made for crocus by Dave Airlie.
Iris is also affected, so this commit ports the fix.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12993>

2 years agoci: remove egl-copy-buffers from fail list
Qiang Yu [Fri, 26 Nov 2021 02:59:01 +0000 (10:59 +0800)]
ci: remove egl-copy-buffers from fail list

egl-copy-buffers test has been fixed for dri3. So remove
it from broadcom and freedreno ci fail list to prevent the
gitlab ci test fail:

  spec@egl 1.4@egl-copy-buffers,UnexpectedPass

Also remove it from radeonsi ci fail list since I verified
on radeonsi.

Acked-by: Daniel Stone <daniels@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13868>

2 years agoloader/dri3: fix piglit egl-copy-buffer test
Qiang Yu [Fri, 19 Nov 2021 01:24:38 +0000 (09:24 +0800)]
loader/dri3: fix piglit egl-copy-buffer test

In the test no front buffer has been allocated on the client
side, so we get a segfault when access it directly.

eglCopyBuffers() just need to do server side copy, so we don't
really need to create a client side front buffer to perform
the copy.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13868>

2 years agonir: Fix read depth for predecessors
Mykhailo Skorokhodov [Mon, 1 Nov 2021 15:15:00 +0000 (17:15 +0200)]
nir: Fix read depth for predecessors

In some non-trivial cases (the amber script file in the merge
request description) phi instruction has more than 32 elements
in predecessors tree and that isn't recursion, just large tree.
In that case, phis not fully converted into a register or mov,
but successfully removed.

The fix removes the counter and adds container of visited blocks.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3690
Cc: mesa-stable
Signed-off-by: Mykhailo Skorokhodov <mykhailo.skorokhodov@globallogic.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13710>

2 years agoci: move windowoverlap exclusion to all-skips
Ilia Mirkin [Tue, 23 Nov 2021 03:34:47 +0000 (22:34 -0500)]
ci: move windowoverlap exclusion to all-skips

The test is just plain not built by our containers. Skip it everywhere.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13919>

2 years agonir/tests: add DCE test for loops following a jump
Rhys Perry [Tue, 20 Apr 2021 08:57:56 +0000 (09:57 +0100)]
nir/tests: add DCE test for loops following a jump

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10284>

2 years agonir/cf: fix insertion of loops/ifs after jumps
Rhys Perry [Tue, 20 Apr 2021 08:57:04 +0000 (09:57 +0100)]
nir/cf: fix insertion of loops/ifs after jumps

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10284>

2 years agonir/dce: fix DCE of loops with a halt or return instruction in the pre-header
Rhys Perry [Fri, 16 Apr 2021 12:18:33 +0000 (13:18 +0100)]
nir/dce: fix DCE of loops with a halt or return instruction in the pre-header

If there is a halt or return instruction right before a loop with a single
continue, we would have taken the fast path intended for loops without
continues.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 71a985d80b1 ("nir/dce: perform DCE for unlooped instructions in a single pass")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10284>

2 years agolima: fix blending with min/max ops
Vasily Khoruzhick [Wed, 24 Nov 2021 02:10:19 +0000 (18:10 -0800)]
lima: fix blending with min/max ops

It turns out that BLEND_MIN and BLEND_MAX in Utgard take blend factors
into account. My guess is that actual equation looks like:

OP(As * S + Ad * D, Ad) for alpha, and
OP(Cs * S + Cd * D, Cd) for color.

So we have to set S factor to 1 and D factor to 0 to be compliant with
GL spec.

Fixes following piglit tests:
spec@!opengl 1.4@blendminmax
spec@arb_blend_func_extended@arb_blend_func_extended-fbo-extended-blend
(with patch my for ES2_compatibility and EXT_blend_func_extended)

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

2 years agolima: use 1 as blend factor for dst_alpha for SRC_ALPHA_SATURATE
Vasily Khoruzhick [Wed, 24 Nov 2021 06:31:04 +0000 (22:31 -0800)]
lima: use 1 as blend factor for dst_alpha for SRC_ALPHA_SATURATE

As per [1] alpha blend factors for Sa and Da should be 1 for
SRC_ALPHA_SATURATE

[1] https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_blend_func_extended.txt

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

2 years agolima: implement dual source blend
Vasily Khoruzhick [Fri, 19 Nov 2021 04:53:18 +0000 (20:53 -0800)]
lima: implement dual source blend

It was a bit trickier to RE, since blob doesn't expose this
functionality at all, however we had a clue from the very beginning:
lima_blend_factor is 3 bits, i.e. 8 values, but only 5 of them were
used, it just waited till someone tried what 3 unused values do.

Interestingly enough, it turns out "5" works just as "0" (which is
PIPE_BLENDFACTOR_*SRC_*), but only if output register for gl_FragColor
is $0, So it looks suspiciously similar with PIPE_BLENDFACTOR_*SRC1_*
behavior, and looks like secondary output is taken from $0.

Since output regs for all other outputs are configured via RSW, there
must be a field in RSW for output register for secondary color, it's
likely 4 bits and it's currently set to 0 for reg $0.

Then it was just a matter of brute-forcing various consecutive 4 bits
in RSW - and indeed, setting top 4 bits of rsw->aux0 to the index of
gl_FragColor output register fixes blending tests when we use "5"
blend factor instead of "0".

So it must be a register number for gl_SecondaryFragColor. Unlike
gl_FragColor, the field is only repeated once in RSW.

Wire it up in compiler, and piglit arb_blend_func_extended now passes.

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

2 years agoaco: properly update use counts if a extract is still used
Rhys Perry [Mon, 22 Nov 2021 11:03:03 +0000 (11:03 +0000)]
aco: properly update use counts if a extract is still used

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13909>

2 years agolima: disasm: call util_cpu_detect() to init CPU caps
Vasily Khoruzhick [Sat, 27 Nov 2021 02:04:51 +0000 (18:04 -0800)]
lima: disasm: call util_cpu_detect() to init CPU caps

It's needed by _mesa_half_to_float(), without this change it hits
assertion failure in util_get_cpu_caps().

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13968>

2 years agolima: disasm: use last argument as a filename
Vasily Khoruzhick [Sat, 27 Nov 2021 02:02:59 +0000 (18:02 -0800)]
lima: disasm: use last argument as a filename

Otherwise it fails to open a file.

Fixes: 9660427ab7b3 ("lima: Print usage if --help is any of the arguments.")
Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13968>

2 years agolima: fix crash with sparse samplers
Vasily Khoruzhick [Wed, 24 Nov 2021 02:02:33 +0000 (18:02 -0800)]
lima: fix crash with sparse samplers

Fixes following piglit tests:
spec@arb_fragment_program@fp-fragment-position
spec@arb_fragment_program@sparse-samplers

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13939>

2 years agoglthread: don't sync for more glGetIntegerv enums for glretrace
Marek Olšák [Sun, 28 Nov 2021 13:09:15 +0000 (08:09 -0500)]
glthread: don't sync for more glGetIntegerv enums for glretrace

This makes glretrace faster with glthread.

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

2 years agobroadcom/compiler: relax restriction on VPM inst in last thread end slot
Iago Toral Quiroga [Mon, 29 Nov 2021 11:39:24 +0000 (12:39 +0100)]
broadcom/compiler: relax restriction on VPM inst in last thread end slot

According to the documentation, only vpmwt is disallowed in the last delay
slot of the thread end.

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

2 years agoradv: dont call calloc when BVH is empty
Filip Gawin [Sat, 23 Oct 2021 14:59:13 +0000 (16:59 +0200)]
radv: dont call calloc when BVH is empty

Usage of pointer returned by calloc(0) is UB.

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

2 years agoradv/llvm: constify radv_shader_info
Samuel Pitoiset [Wed, 27 Oct 2021 09:20:15 +0000 (11:20 +0200)]
radv/llvm: constify radv_shader_info

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/13542>

2 years agoradv/llvm: stop trying to eliminate VS outputs
Samuel Pitoiset [Wed, 27 Oct 2021 09:13:30 +0000 (11:13 +0200)]
radv/llvm: stop trying to eliminate VS outputs

This has no effects, except for XFB but that shouldn't really matter.

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/13542>

2 years agoradv: constify radv_shader_info in radv_declare_shader_args()
Samuel Pitoiset [Mon, 29 Nov 2021 08:29:58 +0000 (09:29 +0100)]
radv: constify radv_shader_info in radv_declare_shader_args()

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/13542>

2 years agoradv: copy the user SGPRs locations outside of radv_declare_shader_args()
Samuel Pitoiset [Mon, 29 Nov 2021 08:29:22 +0000 (09:29 +0100)]
radv: copy the user SGPRs locations outside of radv_declare_shader_args()

The shader locations are now directly stored in radv_shader_args which
makes sense because they are tied to the arguments. The locations are
then copied to radv_shader_info but they will be moved into a new
radv_shader_binary_info with upcoming changes.

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/13542>

2 years agoradv: configure the number of SGPRs/VGPRs directly from the arguments
Samuel Pitoiset [Wed, 27 Oct 2021 08:20:24 +0000 (10:20 +0200)]
radv: configure the number of SGPRs/VGPRs directly from the arguments

Instead of copying the values to radv_shader_info.

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/13542>

2 years agoradv: add a workaround to fix a segfault with Metro Exodus (Linux native)
Samuel Pitoiset [Wed, 24 Nov 2021 17:22:23 +0000 (18:22 +0100)]
radv: add a workaround to fix a segfault with Metro Exodus (Linux native)

The game calls vkGetSemaphoreCounterValue() with an invalid semaphore
handle and it crashes. This is an invalid Vulkan usage and it should
be fixed in the game. I reported the issue to the developers.

Workaround this temporarily (hopefully) by ignoring
vkGetSemaphoreCounterValue() if the semaphore is NULL from an internal
RADV layer.

Cc: 21.3 mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5119
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/13956>

2 years agoradv: fix accessing NULL pointers when destroy the VRS image
Samuel Pitoiset [Fri, 26 Nov 2021 15:14:30 +0000 (16:14 +0100)]
radv: fix accessing NULL pointers when destroy the VRS image

Detected by UBSAN.

../src/amd/vulkan/radv_private.h:2939:1: runtime error: member access
within null pointer of type 'struct radv_device_memory'

../src/amd/vulkan/radv_private.h:2926:1: runtime error: member access
within null pointer of type 'struct radv_buffer'

../src/amd/vulkan/radv_private.h:2945:1: runtime error: member access
within null pointer of type 'struct radv_image'

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/13965>

2 years agobroadcom/compiler: allow color TLB writes in last instruction
Iago Toral Quiroga [Thu, 25 Nov 2021 10:59:48 +0000 (11:59 +0100)]
broadcom/compiler: allow color TLB writes in last instruction

Only Z writes are disallowed.

total instructions in shared programs: 11578449 -> 11577369 (<.01%)
instructions in affected programs: 38132 -> 37052 (-2.83%)
helped: 1080
HURT: 0
Instructions are helped.

total max-temps in shared programs: 2334416 -> 2334395 (<.01%)
max-temps in affected programs: 218 -> 197 (-9.63%)
helped: 21
HURT: 0
Max-temps are helped.

total inst-and-stalls in shared programs: 11607890 -> 11606810 (<.01%)
inst-and-stalls in affected programs: 38265 -> 37185 (-2.82%)
helped: 1080
HURT: 0
Inst-and-stalls are helped.

total nops in shared programs: 338316 -> 337236 (-0.32%)
nops in affected programs: 2625 -> 1545 (-41.14%)
helped: 1080
HURT: 0
Nops are helped.

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

2 years agofreedreno/ir3: get the post-lowering clip/cull mask
Ilia Mirkin [Sun, 21 Nov 2021 00:17:43 +0000 (19:17 -0500)]
freedreno/ir3: get the post-lowering clip/cull mask

The variant may include a lowered gl_Clip/CullDistance array. So we have
to use the variant's info (which is not available). However we save off
the clip/cull masks already, so just reuse those.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13891>

2 years agofreedreno/ir3: indicate that clipdist arrays are in use
Ilia Mirkin [Sat, 20 Nov 2021 08:42:03 +0000 (03:42 -0500)]
freedreno/ir3: indicate that clipdist arrays are in use

We expose the compact array cap, which means that we get compact
clipdist arrays. Indicate this to the lowering pass so that it works for
gl_ClipDistance from fs, among others.

Fixes, among others, on a420,

tests/spec/glsl-1.30/execution/clipping/fs-clip-distance-interpolated.shader_test

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13891>

2 years agonir/lower_clip: support clipdist array + no vars
Ilia Mirkin [Tue, 23 Nov 2021 00:06:52 +0000 (19:06 -0500)]
nir/lower_clip: support clipdist array + no vars

This runs after the "to io" lowering on freedreno. Support this case.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>

2 years agonir/lower_clip: increment num_inputs/outputs by appropriate amount
Ilia Mirkin [Mon, 22 Nov 2021 22:54:50 +0000 (17:54 -0500)]
nir/lower_clip: increment num_inputs/outputs by appropriate amount

The inputs/outputs are meant to be in vec4 units.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>

2 years agonir/lower_clip: location offset goes into offset, not base
Ilia Mirkin [Mon, 22 Nov 2021 22:54:09 +0000 (17:54 -0500)]
nir/lower_clip: location offset goes into offset, not base

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>

2 years agonir/lower_clip: replace bogus comment about gl_ClipDistance reading in GL
Ilia Mirkin [Sun, 21 Nov 2021 08:18:25 +0000 (03:18 -0500)]
nir/lower_clip: replace bogus comment about gl_ClipDistance reading in GL

gl_ClipDistance most definitely can be read in fragment shaders since
GLSL 1.30. This is also accessible in ES with EXT_clip_cull_distance.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13917>