platform/upstream/mesa.git
3 years agofreedreno: Use Android's libsync instead of libdrm's.
Eric Anholt [Mon, 19 Oct 2020 21:19:27 +0000 (14:19 -0700)]
freedreno: Use Android's libsync instead of libdrm's.

This should be equivalent, given that we only support the DRM backend so
far, but we'll want to have the compatibility for future KGSL freedreno.

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

3 years agomeson: Only require libexpat when a part of the build needs it.
Eric Anholt [Mon, 19 Oct 2020 19:28:17 +0000 (12:28 -0700)]
meson: Only require libexpat when a part of the build needs it.

Now that xmlconfig can be built without libexpat on Android, we can make
android builds not require the presence of libexpat for many drivers.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7223>

3 years agomeson.build: xxf86vm is not needed for -Dglx-direct=false
Michael Olbrich [Sun, 8 Sep 2019 11:14:40 +0000 (13:14 +0200)]
meson.build: xxf86vm is not needed for -Dglx-direct=false

It is only used in src/glx/glxcmds.c and when GLX_DIRECT_RENDERING is
defined.
So only depend on it if GLX direct rendering is actually enabled.

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

3 years agosoftpipe: Switch to using NIR as the shader format from mesa/st.
Eric Anholt [Wed, 1 Jan 2020 00:20:52 +0000 (16:20 -0800)]
softpipe: Switch to using NIR as the shader format from mesa/st.

This causes our TGSI to use far more temps, since NTT is currently not
releasing temps from registers.  On the other hand, this interpreter is
already spectacularly slow, and if we wanted to go fast we should probably
write a scalar NIR intrepeter.

For now, using NTT means that we test that codepath in preparation for
switching TGSI-consuming HW drivers over, so that we can eventually
garbage collect st_glsl_to_tgsi.

As this is a major restructuring, there are some impacts on piglit:

- Several tests start assert failing about 64-bit NIR registers for temp
  arrays not getting split to vec2s:
  - fs-frexp-dvec4-variable-index.shader_test
  - arb_gpu_shader_fp64/uniform_buffers/{vs,fs,gs}-array-copy.shader_test
  - arb_gpu_shader_int64/execution/indirect-array-two-accesses.shader_test
- dEQP-GLES31.functional.primitive_bounding_box.wide_points.global_state.vertex_geometry_fragment.fbo_bbox_larger
  starts crashing depending on various bits of state (previous tests run
  before it, presence of valgrind, presence of glib's memcheck).  Doesn't
  seem really NTT-specific, added to flakes list with other GS flakes.
- Almost 200 fp64/int64-related tests start passing, mostly around i/o loayout.

shader-db:
total instructions in shared programs: 3492656 -> 3081674 (-11.77%)
total loops in shared programs: 1418 -> 1387 (-2.19%)
total temps in shared programs: 340041 -> 615527 (81.02%)
total const in shared programs: 3158970 -> 1528630 (-51.61%)
total imm in shared programs: 117586 -> 101349 (-13.81%)
Total CPU time (seconds): 430.36 -> 900.94 (109.35%)

FPS results:
glmark2 texture               +7.32484% +/- 3.76528% (n=10)
glmark2 desktop:effect=shadow +20%      +/- 0% (n=10)
glmark2 shadow                +6.49351% +/- 3.65335% (n=7)
glmark2 conditionals          +18.75%   +/- 2.74658% (n=9)

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

3 years agosoftpipe: Fix buffer overflows in SSBO atomics.
Eric Anholt [Wed, 26 Aug 2020 03:58:27 +0000 (20:58 -0700)]
softpipe: Fix buffer overflows in SSBO atomics.

SSBO atomics are always to the .x channel, but we were doing reads on
.xyzw and writes to whatever the writemask was.

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

3 years agogallium: Add a nir-to-TGSI pass.
Eric Anholt [Wed, 5 Nov 2014 20:41:08 +0000 (12:41 -0800)]
gallium: Add a nir-to-TGSI pass.

The goal is to replace glsl_to_tgsi.cpp and its supporting code (~10k
LOC).  This code ends up being smaller because NIR has many lowering
passes that help it map better to TGSI than GLSL IR does.

As a benefit, this brings NIR optimizations to TGSI-only drivers.
Many of the softpipe shaders I've looked at end up being significantly
shorter.  Some potentially relevant changes to TGSI consumers:

- All immediates are now UINT typed.  This means they're less legible
  in printouts, but means that they get deduplicated better (no more
  multiple copies of 0x0!)
- Sampler views are not currently declared.
- nir_registers don't have their live ranges tracked, so TGSI temp usage
  may go up with a lot of control flow.
- nir_lower_vec_to_mov naively inserts movs instead of trying to coalesce
  the movs with the generators of the ssa values, sometimes increasing
  instruction count.

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

3 years agonir: Add an option to not lower source mods for f64/u64/i64.
Eric Anholt [Fri, 24 Jul 2020 22:13:40 +0000 (15:13 -0700)]
nir: Add an option to not lower source mods for f64/u64/i64.

TGSI can't handle them, but we want to use this pass for nir-to-tgsi.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3395>

3 years agonir: Add a call to get a struct describing SSA liveness per instruction.
Eric Anholt [Wed, 22 Jul 2020 16:06:48 +0000 (09:06 -0700)]
nir: Add a call to get a struct describing SSA liveness per instruction.

nir-to-tgsi will use this to release release temporaries for SSA storage
back to ureg's linear register allocation once they're dead.

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

3 years agonir: Add a block start/end ip to live instr index metadata.
Eric Anholt [Wed, 14 Oct 2020 19:11:20 +0000 (12:11 -0700)]
nir: Add a block start/end ip to live instr index metadata.

I wanted it for the per-instruction live intervals metadata, and it's not
much to store in general.  Make the ip explicitly 32-bit, on suggestion by
jekstrand.

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

3 years agonir: Replace nir_ssa_def->live_index with nir_instr->index.
Eric Anholt [Tue, 29 Sep 2020 22:44:57 +0000 (15:44 -0700)]
nir: Replace nir_ssa_def->live_index with nir_instr->index.

live_index had two things going on: 0 meant the instr was an undef and
always dead, and otherwise ssa defs had increasing numbers by instruction
order.  We already have a field in the instruction for storing instruction
order, and ssa defs don't need that number to be contiguous (if you want a
compact per-ssa-def number, use ssa->index after reindexing).

We don't use ssa->index for this, because reindexing those would change
nir_print, and that would be rude to people trying to track what's
happening in optimization passes.

This openend up a hole in nir_ssa_def, so we move nir_ssa_def->index
toward the end to shrink the struct from 64 bytes to 56.

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

3 years agonir: Introduce nir_metadata_instr_index for nir_index_instr() being current.
Eric Anholt [Tue, 29 Sep 2020 22:33:39 +0000 (15:33 -0700)]
nir: Introduce nir_metadata_instr_index for nir_index_instr() being current.

This will be useful to remove the live_index field from nir_ssa_def.

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

3 years agoci: Enable NIR_VALIDATE everywhere.
Eric Anholt [Sat, 17 Oct 2020 00:20:11 +0000 (17:20 -0700)]
ci: Enable NIR_VALIDATE everywhere.

I wasted a bunch of time today tracking down a spurious test results
change due to a driver invoking UB by running tests where NIR validation
had failed (instruction reading from components beyond vector size).  If
we need to shrink our coverage to get runtimes down, it will still be
better to be catching validation errors in CI.

To keep the test jobs runtime under 10 minutes, I've split a530's gles2 to
two different jobs.

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

3 years agoradv: move all NIR pass outside of ACO
Samuel Pitoiset [Thu, 8 Oct 2020 06:11:30 +0000 (08:11 +0200)]
radv: move all NIR pass outside of ACO

This has several advantages:
- it generates roughly the same NIR for both compiler backends
  (this might help for debugging purposes)
- it might allow to move around some NIR pass to improve compile time
- it might help for RadeonSI support
- it improves fossils-db stats for RADV/LLVM (this shouldn't matter
  much but it's a win for free)

fossil-db (Navi/LLVM):
Totals from 80732 (59.18% of 136420) affected shaders:
SGPRs: 5390036 -> 5382843 (-0.13%); split: -3.38%, +3.24%
VGPRs: 3910932 -> 3890320 (-0.53%); split: -2.38%, +1.85%
SpillSGPRs: 319212 -> 283149 (-11.30%); split: -17.69%, +6.39%
SpillVGPRs: 14668 -> 14324 (-2.35%); split: -7.53%, +5.18%
CodeSize: 265360860 -> 267572132 (+0.83%); split: -0.47%, +1.30%
Scratch: 5338112 -> 6134784 (+14.92%); split: -2.65%, +17.57%
MaxWaves: 1077230 -> 1086902 (+0.90%); split: +2.79%, -1.90%

No fossils-db changes on RADV/ACO.

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

3 years agoac/nir: handle non-const offset with txf/txf_ms
Samuel Pitoiset [Fri, 9 Oct 2020 06:43:46 +0000 (08:43 +0200)]
ac/nir: handle non-const offset with txf/txf_ms

It might be a vec2. If it's a constant, LLVM will fold it.

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

3 years agoac/llvm: don't lower bool to int32, switch to native i1 bool
Marek Olšák [Tue, 8 Sep 2020 08:40:02 +0000 (04:40 -0400)]
ac/llvm: don't lower bool to int32, switch to native i1 bool

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7077>

3 years agoutil: Fix rwlock Windows include for MinGW
James Park [Mon, 19 Oct 2020 10:51:46 +0000 (03:51 -0700)]
util: Fix rwlock Windows include for MinGW

MinGW uses windows.h, and not Windows.h.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7215>

3 years agogenxml: drop gen10
Lionel Landwerlin [Fri, 16 Oct 2020 09:46:26 +0000 (12:46 +0300)]
genxml: drop gen10

Finishing off the job started in !6899

v2: Remove remaining gen10_pack.h include (Sagar)

v3: Forgot isl gen10 removal (Lionel)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7185>

3 years agoRevert "radv/aco: disable NGG GS support because it randomly hangs the GPU"
Samuel Pitoiset [Fri, 16 Oct 2020 08:41:49 +0000 (10:41 +0200)]
Revert "radv/aco: disable NGG GS support because it randomly hangs the GPU"

This reverts commit b84d1a0c42c5a1973ebc53a49fd941590e540a82.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7213>

3 years agoaco/ngg: Add assertion to make sure we always know the vertex count.
Timur Kristóf [Mon, 19 Oct 2020 09:49:05 +0000 (11:49 +0200)]
aco/ngg: Add assertion to make sure we always know the vertex count.

Just a sanity check to avoid hangs caused by missing this
in the future.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7213>

3 years agonir: Emit set_vertex_and_primitive_count for inactive streams.
Timur Kristóf [Mon, 19 Oct 2020 09:45:35 +0000 (11:45 +0200)]
nir: Emit set_vertex_and_primitive_count for inactive streams.

This fixes issues in backends such as ACO which rely on always
getting this intrinsic to know the correct vertex and primitive
count.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7213>

3 years agoradv: add missing 'discardtodemote' option in the debug list
Samuel Pitoiset [Mon, 19 Oct 2020 16:42:22 +0000 (18:42 +0200)]
radv: add missing 'discardtodemote' option in the debug list

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

3 years agovulkan/wsi: fix possible random stalls in wsi_display_wait_for_event
Marcin Ślusarz [Fri, 16 Oct 2020 18:07:28 +0000 (20:07 +0200)]
vulkan/wsi: fix possible random stalls in wsi_display_wait_for_event

pthread_cond_broadcast man page says this:
"The pthread_cond_broadcast() or pthread_cond_signal() functions may
 be called by a thread whether or not it currently owns the mutex that
 threads calling pthread_cond_wait() or pthread_cond_timedwait() have
 associated with the condition variable during their waits; however,
 if predictable scheduling behavior is required, then that mutex shall
 be locked by the thread calling pthread_cond_broadcast() or
 pthread_cond_signal()."

Found by reading the code.
Compile tested only.

Fixes: da997ebec92 ("vulkan: Add KHR_display extension using DRM [v10]")

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7197>

3 years agopanfrost: Fix stride for AFBC_FORMAT_MOD_BLOCK_SIZE_32x8.
Vinson Lee [Thu, 15 Oct 2020 23:14:16 +0000 (16:14 -0700)]
panfrost: Fix stride for AFBC_FORMAT_MOD_BLOCK_SIZE_32x8.

Fix defect reported by Coverity Scan.

Identical code for different branches (IDENTICAL_BRANCHES)
identical_branches: Ternary expression on condition width has
identical then and else expressions: 32. Should one of the
expressions be modified, or the entire ternary expression
replaced?

Fixes: 8bb1d61f276c ("panfrost: Add panfrost_block_dim helper")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7177>

3 years agoanv: Advertise VK_KHR_shader_terminate_invocation
Caio Marcelo de Oliveira Filho [Thu, 7 May 2020 04:56:29 +0000 (21:56 -0700)]
anv: Advertise VK_KHR_shader_terminate_invocation

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

3 years agovulkan: Update XML and headers to 1.2.158
Caio Marcelo de Oliveira Filho [Mon, 19 Oct 2020 17:04:32 +0000 (10:04 -0700)]
vulkan: Update XML and headers to 1.2.158

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

3 years agoclover/nir: add a constant folding pass before lowering mem const
Dave Airlie [Mon, 19 Oct 2020 00:38:16 +0000 (10:38 +1000)]
clover/nir: add a constant folding pass before lowering mem const

If we lower mem constants first, then direct array accesses to
constants never get lowered, so do a constant fold pass first to
remove direct const array accesses.

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

3 years agoisl: Enable Tigerlake HDC:L1 caches via MOCS in various cases.
Kenneth Graunke [Wed, 7 Oct 2020 16:45:35 +0000 (09:45 -0700)]
isl: Enable Tigerlake HDC:L1 caches via MOCS in various cases.

Thanks to Felix Degrood for discovering that we missed enabling this
additional caching on Tigerlake!  Felix also benchmarked the changes.

We now use MOCS 48 (HDC:L1 + L3 + LLC) for render targets, textures,
and pull constant buffers.  We leave storage buffers & images, as well
as stateless messages, using the previous MOCS 2 value.  We can't use
HDC:L1 with atomics, and we don't know a priori whether storage buffers
will be used with atomics or not.  Similarly, the Vulkan buffer device
address feature allows atomics to be performed on buffers via stateless
messages, and we only can control MOCS at the base address level, so
we can't do much there.

This is closer to what the Windows Vulkan and OpenGL drivers do,
though it isn't quite the same - they also disable LLC in some cases,
but we observed this to have noticable performance regressions when
we tried (though a couple titles benefited).  We may try experiment
with that in the future.

Improves performance in a number of titles:

- Unreal Engine 4 Shooter Demo   [VK]: 11.8%
- Witcher 3                    [DXVK]:  3.9%
- Rise of the Tomb Raider        [VK]:  1.5%
- Shadow of the Tomb Raider      [VK]:  1.0%
- Grand Theft Auto V           [DXVK]:  0.8%

We did not observe any performance regressions.

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

3 years agoisl, anv, iris: Add a centralized helper to select MOCS based on usage
Kenneth Graunke [Wed, 7 Oct 2020 14:44:56 +0000 (07:44 -0700)]
isl, anv, iris: Add a centralized helper to select MOCS based on usage

On Gen12+, we can enable additional caches in certain usage situations.
This routes that decision making to a central place in ISL, based on
surface usage flags, and updates both drivers to use it.  (i965 doesn't
need to change because it doesn't support Gen12.)

We continue handling the "external" decision via an anv_mocs() wrapper
for now, since we store that flag in anv_bo, which isl doesn't know
about.  (We could introduce an ISL_SURF_USAGE_EXTERNAL, but I'm not
actually sure that would be cleaner.)

This patch should not have any functional nor performance effects, as
we continue selecting the exact same MOCS values for now.

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

3 years agoanv: Set only one ISL usage bit (RT/texture) for CopyBuffer sources
Kenneth Graunke [Wed, 30 Sep 2020 22:05:54 +0000 (15:05 -0700)]
anv: Set only one ISL usage bit (RT/texture) for CopyBuffer sources

Most uses of this function deal with destination buffers, but for
copy_buffer_to_image, the buffer is the source, and isn't rendered
to.  We should avoid setting ISL_SURF_USAGE_RENDER_TARGET_BIT.
Also, we should avoid setting ISL_SURF_USAGE_TEXTURE_BIT for the
destination, which isn't sampled from.

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

3 years agoturnip: Only link libdrm in the DRM case, not KGSL.
Eric Anholt [Fri, 18 Sep 2020 19:43:18 +0000 (12:43 -0700)]
turnip: Only link libdrm in the DRM case, not KGSL.

libvulkan's not a fan of opening my libdrm.so.2 from /vendor/lib64 or
/vendor/lib64/hw, but then we shouldn't need it, anyway.

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

3 years agoturnip: Don't link the WSI code if we don't have a WSI extension.
Eric Anholt [Fri, 18 Sep 2020 21:36:36 +0000 (14:36 -0700)]
turnip: Don't link the WSI code if we don't have a WSI extension.

I don't like the TU_HAS_SURFACE duplication, but this is a step to having
a non-libdrm-dependent turnip on Android with KGSL (which doesn't have
drm for rendering).

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

3 years agoturnip: Use Mesa's libsync.h instead of libdrm's libsync.h.
Eric Anholt [Fri, 18 Sep 2020 20:16:23 +0000 (13:16 -0700)]
turnip: Use Mesa's libsync.h instead of libdrm's libsync.h.

Given that we already link to Android's libsync, use it instead of using a
build-time dependency on libdrm for the KGSL path.  This also would help
for older kernel compat with KGSL.

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

3 years agoturnip: Drop a dead error checking path in device init.
Eric Anholt [Wed, 16 Sep 2020 02:18:12 +0000 (19:18 -0700)]
turnip: Drop a dead error checking path in device init.

The only result != SUCCESS setters above all jump across to the fail
label.

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

3 years agoandroid: Add pre-4.7 Android kernel compatibility to our libsync header.
Eric Anholt [Tue, 22 Sep 2020 20:02:37 +0000 (13:02 -0700)]
android: Add pre-4.7 Android kernel compatibility to our libsync header.

The downstream Android kernels had a different API than was merged
upstream, and libsync on Android abstracts over that for us.  Use their
sync_merge() and sync_wait(), at the cost of linking against libsync
(which Android.mk and meson both do).

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6821>

3 years agoutil: Import a copy of drm's libsync.h
Eric Anholt [Tue, 22 Sep 2020 19:59:24 +0000 (12:59 -0700)]
util: Import a copy of drm's libsync.h

libsync.h is one of the common dependencies on libdrm from drivers that
otherwise don't want libdrm.  Given that it's header-only code, just
import it to Mesa instead of forcing library dependencies on our users.

Copied from libdrm commit a84caff71be9 (" intel: Add PCI ID support to RKL
platform")

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6821>

3 years agoci/android: Switch build to using platform SDK version 26.
Eric Anholt [Thu, 24 Sep 2020 23:44:50 +0000 (16:44 -0700)]
ci/android: Switch build to using platform SDK version 26.

In SDK 25 (Android 7, 2016), the kernel only went up to around 4.4, so
the upstreamed sync API didn't exist, and libsync didn't expose
sync_merge().

In SDK 26 (Android 8, 2017), the kernel is sometimes bumped to 4.9 or
4.14, but libsync has a sync_merge() that operates on either the
downstream or the upstream API.

Since our android-targeting drivers in general use sync objects (requiring
a kernel newer than 7 got) and sync_merge() (suggesting interaction with
external fencing that started in Android 8), make CI build against an SDK
version with the sync API.  I think really doing SDK 25 right at this
point would involve backporting mesa with some #ifdefs to not expose sync
APIs that wouldn't work.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6821>

3 years agoandroid_stub: Update platform headers to include gralloc1.h.
Eric Anholt [Tue, 22 Sep 2020 17:55:53 +0000 (10:55 -0700)]
android_stub: Update platform headers to include gralloc1.h.

This header is used in anv and radv, and soon turnip.  Since the script
just checks out master, this also bumps the headers to upstream
02dfcc7c1562 ("Merge "Merge Android R"")

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6821>

3 years agoradv: report latest extension spec versions
Samuel Pitoiset [Thu, 15 Oct 2020 09:08:26 +0000 (11:08 +0200)]
radv: report latest extension spec versions

Found with the vulkan extension checker tool.

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

3 years agomeson: Add xcb-fixes to loader when using x11 and dri3. Fixes undefined symbol for...
Duncan Hopkins [Thu, 15 Oct 2020 11:14:57 +0000 (12:14 +0100)]
meson: Add xcb-fixes to loader when using x11 and dri3. Fixes undefined symbol for xcb_xfixes_create_region in loader_dri3_helper.c

loader_dr3_helper.c uses xcb_xfixes_create_region() that requires dep_xcb_xfixes to link. This is dependent on with_platform_x11 and with_dri3.
But the source meson file does not set this up dependent on with_dri3.
The build was initialsed using platforms=x11 and gallium-drivers=zink,swrast.

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

3 years agomesa: Pass the correct caller string to _mesa_lookup_or_create_texture
Ian Romanick [Mon, 12 Oct 2020 23:53:37 +0000 (16:53 -0700)]
mesa: Pass the correct caller string to _mesa_lookup_or_create_texture

An actual bug found by the 'unused parameter' warning. :D

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7167>

3 years agomesa/st: Silence unused parameter warnings in st_context.c
Ian Romanick [Mon, 12 Oct 2020 23:18:13 +0000 (16:18 -0700)]
mesa/st: Silence unused parameter warnings in st_context.c

src/mesa/state_tracker/st_context.c: In function ‘st_Enable’:
src/mesa/state_tracker/st_context.c:101:57: warning: unused parameter ‘state’ [-Wunused-parameter]
  101 | st_Enable(struct gl_context *ctx, GLenum cap, GLboolean state)
      |                                               ~~~~~~~~~~^~~~~

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7167>

3 years agoi965: Silence unused parameter warnings
Ian Romanick [Mon, 12 Oct 2020 23:16:34 +0000 (16:16 -0700)]
i965: Silence unused parameter warnings

src/mesa/drivers/dri/i965/intel_screen.c: In function ‘brw_driconf_get_xml’:
src/mesa/drivers/dri/i965/intel_screen.c:103:33: warning: unused parameter ‘driver_name’ [-Wunused-parameter]
  103 | brw_driconf_get_xml(const char *driver_name)
      |                     ~~~~~~~~~~~~^~~~~~~~~~~
src/mesa/drivers/dri/i965/intel_screen.c: In function ‘intel_unmap_image’:
src/mesa/drivers/dri/i965/intel_screen.c:882:33: warning: unused parameter ‘context’ [-Wunused-parameter]
  882 | intel_unmap_image(__DRIcontext *context, __DRIimage *image, void *map_info)
      |                   ~~~~~~~~~~~~~~^~~~~~~
src/mesa/drivers/dri/i965/intel_screen.c:882:54: warning: unused parameter ‘image’ [-Wunused-parameter]
  882 | intel_unmap_image(__DRIcontext *context, __DRIimage *image, void *map_info)
      |                                          ~~~~~~~~~~~~^~~~~
src/mesa/drivers/dri/i965/intel_screen.c: In function ‘intelReleaseBuffer’:
src/mesa/drivers/dri/i965/intel_screen.c:2904:33: warning: unused parameter ‘dri_screen’ [-Wunused-parameter]
 2904 | intelReleaseBuffer(__DRIscreen *dri_screen, __DRIbuffer *buffer)
      |                    ~~~~~~~~~~~~~^~~~~~~~~~

src/mesa/drivers/dri/i965/brw_context.c: In function ‘brw_set_background_context’:
src/mesa/drivers/dri/i965/brw_context.c:144:58: warning: unused parameter ‘queue_info’ [-Wunused-parameter]
  144 |                            struct util_queue_monitoring *queue_info)
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7167>

3 years agoisl: Fix the aux-map encoding for D24_UNORM_X8
Nanley Chery [Fri, 16 Oct 2020 17:49:48 +0000 (10:49 -0700)]
isl: Fix the aux-map encoding for D24_UNORM_X8

Bspec: 53911 now defines the encoding for this format.

Cc: mesa-stable
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7198>

3 years agoanv: Implement VariableDescriptorCount
Jason Ekstrand [Fri, 16 Oct 2020 03:56:09 +0000 (22:56 -0500)]
anv: Implement VariableDescriptorCount

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

3 years agoanv: Add a descriptor_count to descriptor sets
Jason Ekstrand [Fri, 16 Oct 2020 17:52:46 +0000 (12:52 -0500)]
anv: Add a descriptor_count to descriptor sets

This is useful for asserting in-bounds descriptor set access.

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

3 years agoanv: Bump the number of update-after-bind descriptors to 1M
Jason Ekstrand [Fri, 16 Oct 2020 01:33:12 +0000 (20:33 -0500)]
anv: Bump the number of update-after-bind descriptors to 1M

It's a bit hard to exactly map our implementation to the limits
described by Vulkan.  The bindless surface handle in the extended
message descriptors is 20 bits and it's an index into the table of
RENDER_SURFACE_STATE structs that starts at bindless surface base
address.  This means that we can have at must 1M surface states
allocated at any given time.  Since most image views take two
descriptors, this means we have a limit of about 500K image views.

However, since we allocate surface states at vkCreateImageView time,
this means our limit is actually something on the order of 500K image
views allocated at any time.  The actual limit describe by Vulkan, on
the other hand, is a limit of how many you can have in a descriptor set.
Assuming anyone using 1M descriptors will be using the same image view
twice a bunch of times (or a bunch of null descriptors), we can safely
advertise a larger limit.  1M is what's required by D3D12, so let's
advertise that.

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

3 years agozink: reject resource-imports with modifiers
Erik Faye-Lund [Mon, 19 Oct 2020 09:17:30 +0000 (11:17 +0200)]
zink: reject resource-imports with modifiers

Zink doesn't support forwarding DRM modifiers yet, so whenever those are
used, we end up ignoring them. That's not going to do the right thing in
most cases, so let's reject them instead.

Since d686835171c, the dri2 code tries to create a 0x0 surface without
any format when trying to import. This makes this go from
rendering-issues to asserting in debug builds, making things even worse.

Fixes: d686835171c ("gallium/dri2: Support I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS import")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3654
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7214>

3 years agodoc/features: remove zink entries for GL 3.3 items
Mike Blumenkrantz [Sat, 17 Oct 2020 13:40:18 +0000 (09:40 -0400)]
doc/features: remove zink entries for GL 3.3 items

zink fully supports 3.3, so we don't need to be listed for these

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7204>

3 years agoutil,ac,aco,radv: Cross-platform memstream API
James Park [Tue, 4 Aug 2020 17:58:11 +0000 (10:58 -0700)]
util,ac,aco,radv: Cross-platform memstream API

POSIX memstream is not available on Windows.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7143>

3 years agoutil,radv,radv/winsys: Cross-platform rwlock API
James Park [Wed, 14 Oct 2020 04:06:21 +0000 (21:06 -0700)]
util,radv,radv/winsys: Cross-platform rwlock API

POSIX rwlock is not available on Windows.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7144>

3 years agoanv: Ignore continue flag in primary cmd buffers
Ricardo Garcia [Thu, 15 Oct 2020 16:14:52 +0000 (18:14 +0200)]
anv: Ignore continue flag in primary cmd buffers

According to the Vulkan specification, the
VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT flag will be ignored if
included in a VkCommandBufferBeginInfo for a primary command buffer.
This also implies pBeginInfo->pInheritanceInfo should not be read even
if the flag is present, and makes it legal to include the flag knowing
it will be ignored.

Signed-off-by: Ricardo Garcia <rgarcia@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7128>

3 years agoac/nir: implement missing nir_op_pack_half_2x16_split
Samuel Pitoiset [Fri, 16 Oct 2020 11:46:08 +0000 (13:46 +0200)]
ac/nir: implement missing nir_op_pack_half_2x16_split

RADV now lowers lower_pack_half_2x16.

Fixes: 2f125908b35 ("radv,aco: lower_pack_half_2x16")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7187>

3 years agoradeonsi: enable NGG culling by default on Navi1x PRO cards
Marek Olšák [Fri, 16 Oct 2020 09:17:30 +0000 (05:17 -0400)]
radeonsi: enable NGG culling by default on Navi1x PRO cards

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

3 years agoradeonsi: enable NGG on Navi14 PRO cards
Marek Olšák [Fri, 16 Oct 2020 09:15:36 +0000 (05:15 -0400)]
radeonsi: enable NGG on Navi14 PRO cards

These are the only cards where it works.

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

3 years agoradeonsi: tweak LATE_ALLOC_GS numbers for faster NGG culling
Marek Olšák [Fri, 16 Oct 2020 09:02:58 +0000 (05:02 -0400)]
radeonsi: tweak LATE_ALLOC_GS numbers for faster NGG culling

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

3 years agoradeonsi: pack LDS better for NGG culling
Marek Olšák [Thu, 15 Oct 2020 19:17:04 +0000 (15:17 -0400)]
radeonsi: pack LDS better for NGG culling

There is a barrier between lds_pos_cull_* use and lds_pos_* use, so they
can occupy the same LDS space.

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

3 years agoradeonsi: write VS/TES system values into LDS after culling
Marek Olšák [Thu, 15 Oct 2020 18:52:16 +0000 (14:52 -0400)]
radeonsi: write VS/TES system values into LDS after culling

The system values are written into LDS after the new thread ID is known,
so it removes pointer indirection with the old thread ID.

Also, the LDS stores are skipped entirely if vertices are culled.

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

3 years agoradeonsi: remove indirection when loading position at the end for NGG culling
Marek Olšák [Thu, 15 Oct 2020 18:21:37 +0000 (14:21 -0400)]
radeonsi: remove indirection when loading position at the end for NGG culling

If we store the position into LDS after we know the new thread ID,
we don't need to remember the old thread ID.

The culling code only needs W, X/W, Y/W, so we have to keep those.

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

3 years agoradeonsi: optimize out LDS bank conflicts in the NGG culling shader
Marek Olšák [Thu, 15 Oct 2020 12:10:46 +0000 (08:10 -0400)]
radeonsi: optimize out LDS bank conflicts in the NGG culling shader

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

3 years agoradeonsi: enable NGG culling by default on gfx10.3 dGPUs
Marek Olšák [Tue, 13 Oct 2020 14:33:40 +0000 (10:33 -0400)]
radeonsi: enable NGG culling by default on gfx10.3 dGPUs

for better performance

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

3 years agoradeonsi: don't disable NGG culling on gfx10.3
Marek Olšák [Tue, 13 Oct 2020 14:30:38 +0000 (10:30 -0400)]
radeonsi: don't disable NGG culling on gfx10.3

This was causing the hangs:
    42f921387b9 - radeonsi/gfx10: disable vertex grouping

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

3 years agoRevert "radeonsi/gfx10: disable vertex grouping"
Marek Olšák [Wed, 14 Oct 2020 18:46:48 +0000 (14:46 -0400)]
Revert "radeonsi/gfx10: disable vertex grouping"

This reverts commit 42f921387b9c939cf1d809fa447d7980f73aa591.

It causes GPU hangs on gfx10.3.

Fixes: a23802bcb9a - ac,radeonsi: start adding support for gfx10.3

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

3 years agov3dv: Initialize time before usage by free_stale_bos.
Vinson Lee [Wed, 14 Oct 2020 23:55:12 +0000 (16:55 -0700)]
v3dv: Initialize time before usage by free_stale_bos.

Fix defect reported by Coverity Scan.

Uninitialized scalar variable (UNINIT)
uninit_use_in_call: Using uninitialized value time.tv_sec when calling free_stale_bos.

Fixes: f78c99f357ee ("v3dv/bo: add a maximum size for the bo_cache and a envvar to configure it")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7154>

3 years agov3dv: Remove unsigned comparison to zero.
Vinson Lee [Wed, 14 Oct 2020 23:25:31 +0000 (16:25 -0700)]
v3dv: Remove unsigned comparison to zero.

index is of type uint32_t.

Fix defect reported by Coverity Scan.

Macro compares unsigned to 0 (NO_EFFECT)
unsigned_compare: This greater-than-or-equal-to-zero comparison of
an unsigned value is always true. index >= 0U.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7153>

3 years agointel/isl: Drop redundant unpack of unorm channels
Nanley Chery [Thu, 15 Oct 2020 17:11:57 +0000 (10:11 -0700)]
intel/isl: Drop redundant unpack of unorm channels

Fixes: 09ced654204 ("intel/isl: Add format conversion code")
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7168>

3 years agost/mesa: Add missing sentinels in format_map[]
Nanley Chery [Thu, 15 Oct 2020 16:25:23 +0000 (09:25 -0700)]
st/mesa: Add missing sentinels in format_map[]

Cc: mesa-stable
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7169>

3 years agozink: mark ARB_sample_shading as supported
Mike Blumenkrantz [Fri, 16 Oct 2020 16:19:34 +0000 (12:19 -0400)]
zink: mark ARB_sample_shading as supported

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

3 years agozink: add a pipe_context::get_sample_position hook
Mike Blumenkrantz [Fri, 16 Oct 2020 16:18:59 +0000 (12:18 -0400)]
zink: add a pipe_context::get_sample_position hook

standard for most gallium drivers, not sure why it's not a util function

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

3 years agozink: add ntv handling for ARB_sample_shading
Mike Blumenkrantz [Fri, 16 Oct 2020 16:18:05 +0000 (12:18 -0400)]
zink: add ntv handling for ARB_sample_shading

this involves variable handling and decorations as well as a weird bitcast
for the array[1] gl_SampleMask in spirv

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

3 years agozink: add helper for vec-type input variables in ntv
Mike Blumenkrantz [Fri, 16 Oct 2020 14:21:26 +0000 (10:21 -0400)]
zink: add helper for vec-type input variables in ntv

we'll see a lot of reuse of this type of thing, so we can avoid duplicating
it later

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

3 years agozink: implement ARB_draw_indirect
Mike Blumenkrantz [Sat, 11 Jul 2020 15:46:21 +0000 (11:46 -0400)]
zink: implement ARB_draw_indirect

other than the vaguely gross case of primitive restart with incompatible
draw modes and/or restart index, this is no trouble since the buffer formats
are compatible

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

3 years agozink: set 3.3 complete in features.txt
Mike Blumenkrantz [Fri, 10 Jul 2020 19:07:17 +0000 (15:07 -0400)]
zink: set 3.3 complete in features.txt

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

3 years agozink: bump GLSL to 3.30
Mike Blumenkrantz [Fri, 10 Jul 2020 19:02:24 +0000 (15:02 -0400)]
zink: bump GLSL to 3.30

somehow all these tests Just Pass™

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

3 years agozink: set 3.2 complete in features.txt
Mike Blumenkrantz [Fri, 10 Jul 2020 19:06:11 +0000 (15:06 -0400)]
zink: set 3.2 complete in features.txt

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

3 years agozink: GLSL 1.50
Mike Blumenkrantz [Mon, 6 Jul 2020 13:18:07 +0000 (09:18 -0400)]
zink: GLSL 1.50

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

3 years agozink: mark off GL 3.1 as done in features.txt
Mike Blumenkrantz [Fri, 3 Jul 2020 20:16:17 +0000 (16:16 -0400)]
zink: mark off GL 3.1 as done in features.txt

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

3 years agozink: bump to glsl 1.40
Mike Blumenkrantz [Wed, 1 Jul 2020 19:51:14 +0000 (15:51 -0400)]
zink: bump to glsl 1.40

but leaving compat mode at 1.30 for now

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

3 years agozink: enable gs pipe caps
Mike Blumenkrantz [Wed, 14 Oct 2020 14:42:17 +0000 (10:42 -0400)]
zink: enable gs pipe caps

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

3 years agozink: add gallium handling for geometry shaders
Mike Blumenkrantz [Wed, 14 Oct 2020 14:41:29 +0000 (10:41 -0400)]
zink: add gallium handling for geometry shaders

this is the create/bind/destroy hooks as well as the u_blitter shader
save during blit setup

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

3 years agozink: round out handling for streamout buffer stride setting during draw
Mike Blumenkrantz [Wed, 14 Oct 2020 14:40:14 +0000 (10:40 -0400)]
zink: round out handling for streamout buffer stride setting during draw

this adds cases for tess and geometry shaders in the xfb path for grabbing
stride off the shader

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

3 years agozink: remove ADJACENCY prim types from primconvert path
Mike Blumenkrantz [Wed, 14 Oct 2020 14:39:24 +0000 (10:39 -0400)]
zink: remove ADJACENCY prim types from primconvert path

we can (and do) actually handle these natively

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

3 years agozink: add handling for gs in ntv
Mike Blumenkrantz [Wed, 14 Oct 2020 14:38:02 +0000 (10:38 -0400)]
zink: add handling for gs in ntv

this hooks up execution modes and the gs-specific instructions

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

3 years agozink: re-transform gl_Position for gs input
Mike Blumenkrantz [Wed, 14 Oct 2020 14:34:06 +0000 (10:34 -0400)]
zink: re-transform gl_Position for gs input

we've transformed this in the vertex output, so we need to undo that here

ideally we'd only be performing this transform once, but that's going to get
complicated later with the halfz extension which requires shader keys on top
of this, so we can get around to simplifying things at that stage

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

3 years agozink: add ntv handling for geometry shader variables
Mike Blumenkrantz [Wed, 14 Oct 2020 14:32:36 +0000 (10:32 -0400)]
zink: add ntv handling for geometry shader variables

these can reuse the unified loader codepath

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

3 years agozink: handle shader io vars more generically for use with gs
Mike Blumenkrantz [Wed, 14 Oct 2020 14:29:30 +0000 (10:29 -0400)]
zink: handle shader io vars more generically for use with gs

geometry shaders have more inputs and use a lot of the same codepaths as
vertex shaders, so these changes add the inputs and remove checks for vertex-only
shaders

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

3 years agozink: add some spirv_builder functions we'll be using for geometry shaders
Mike Blumenkrantz [Wed, 14 Oct 2020 14:27:56 +0000 (10:27 -0400)]
zink: add some spirv_builder functions we'll be using for geometry shaders

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

3 years agor600/sfn: Update state docu
Gert Wollny [Wed, 14 Oct 2020 17:47:32 +0000 (19:47 +0200)]
r600/sfn: Update state docu

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

3 years agor600/sfn: Fix the parameter component type
Gert Wollny [Wed, 14 Oct 2020 12:58:00 +0000 (14:58 +0200)]
r600/sfn: Fix the parameter component type

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

3 years agor600/sfn: Use register keep-alive also when scanning the shader
Gert Wollny [Wed, 14 Oct 2020 12:57:38 +0000 (14:57 +0200)]
r600/sfn: Use register keep-alive also when scanning the shader

Temporaries don't appear in the mapping, so they are not in the initial
register list.

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

3 years agor600/sfn: fix remapping of deleted attributes
Gert Wollny [Mon, 12 Oct 2020 20:12:55 +0000 (22:12 +0200)]
r600/sfn: fix remapping of deleted attributes

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

3 years agor600/sfn: use 32 bit bools
Gert Wollny [Mon, 12 Oct 2020 15:51:46 +0000 (17:51 +0200)]
r600/sfn: use 32 bit bools

That's closer to what the driver actually does.

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

3 years agor600/sfn: use cacheless op for coherent image write
Gert Wollny [Wed, 7 Oct 2020 12:06:43 +0000 (14:06 +0200)]
r600/sfn: use cacheless op for coherent image write

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

3 years agor600/sfn: Handle mem barrier and image barrier by using ACK
Gert Wollny [Wed, 7 Oct 2020 08:42:17 +0000 (10:42 +0200)]
r600/sfn: Handle mem barrier and image barrier by using ACK

When reading from and writing to the same image in a shader the
memory_barrier can possibly be handled by emitting an ack-write and then
wait for the ack when the memory barrier is set.

Not sure whow well this goes with the syncronization across all shader
invocations though.

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

3 years agor600/sfn: use shared pointer to GPR for FS sysvalues
Gert Wollny [Tue, 6 Oct 2020 18:21:23 +0000 (20:21 +0200)]
r600/sfn: use shared pointer to GPR for FS sysvalues

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

3 years agor600/sfn: Rework get_temp_register to return a smart pointer to GPRValue
Gert Wollny [Tue, 6 Oct 2020 17:50:52 +0000 (19:50 +0200)]
r600/sfn: Rework get_temp_register to return a smart pointer to GPRValue

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

3 years agor600/sfn: fix mega fetch count for SSBO/Image atomics result fetch
Gert Wollny [Tue, 6 Oct 2020 16:46:09 +0000 (18:46 +0200)]
r600/sfn: fix mega fetch count for SSBO/Image atomics result fetch

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

3 years agor600/sfn: Fix keepalive patch
Gert Wollny [Tue, 6 Oct 2020 16:45:33 +0000 (18:45 +0200)]
r600/sfn: Fix keepalive patch

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

3 years agor600/sfn: Fix ssbo resource offset for buffer loads
Gert Wollny [Wed, 30 Sep 2020 18:28:10 +0000 (20:28 +0200)]
r600/sfn: Fix ssbo resource offset for buffer loads

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

3 years agor600/sfn: Don't reuse registers for workgroup ID and local invocation ID
Gert Wollny [Wed, 30 Sep 2020 18:14:39 +0000 (20:14 +0200)]
r600/sfn: Don't reuse registers for workgroup ID and local invocation ID

This fixes a number of compute shader tests. I'm not sure why though.

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

3 years agoglsl: Initialize add_uniform_to_shader member var in constructor.
Vinson Lee [Wed, 14 Oct 2020 01:17:10 +0000 (18:17 -0700)]
glsl: Initialize add_uniform_to_shader member var in constructor.

Fix defect reported by Coverity Scan.

Uninitialized pointer field (UNINIT_CTOR)
uninit_member: Non-static class member var is not initialized in
this constructor nor in any functions that it calls.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7121>