Commit Graph

9204 Commits

Author SHA1 Message Date
Erik Faye-Lund 9b545ea691 gallium: rename continue shader-cap
This is no longer TGSI specific, so let's rename it to reflect
reality.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15922>
2022-04-18 20:43:18 +00:00
Marek Olšák 11c462534b gallium/winsys: move {amdgpu,radeon_drm}_public.h contents into radeon_winsys.h
header file simplification

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15907>
2022-04-17 01:27:34 +00:00
Marek Olšák efac875b66 gallium: move radeon_winsys.h into gallium/include/winsys/
it's used by 3 different drivers, so it shouldn't be in radeonsi

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15907>
2022-04-17 01:27:34 +00:00
Marek Olšák 139f55071b gallium: move drivers/radeon/* into drivers/radeonsi/
this is only used by radeonsi

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15907>
2022-04-17 01:27:34 +00:00
Michel Zou 4c1cb62999 gallium: fix unused symbols warnings
fixes: d760a915

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15840>
2022-04-16 03:29:33 +00:00
Emma Anholt 5fad6bca72 nir_to_tgsi: Do the required cleanup for nir_opt_find_array_copies().
If we made a copy deref, then we need to do dead-write elimination for the
pervious writes or we'll just emit the same copy deref again next time
around.  And, at the end of the opt loop, we need to lower copy derefs
because later passes (locals_to_regs, notably) depend on it.

Fixes infinite opt loop on fs-function-inout-array with virgl on NTT.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15899>
2022-04-13 19:44:39 +00:00
Mike Blumenkrantz 0c0ff57c61 aux/trace: clean up some zink+lavapipe tracing awfulness
now that it's easier to determine whether zink is being used (mostly),
this whole thing can be simplified

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15857>
2022-04-13 00:14:57 +00:00
Gert Wollny c3096e562d ntt: translate nir_intrinsic_shader_clock
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15889>
2022-04-12 18:47:08 +00:00
Dave Airlie 60c61d7b68 draw: handle tess eval shader when getting num outputs
This tripped up some pointsize/prim id interactions with zink.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15872>
2022-04-12 14:21:41 +10:00
Emma Anholt 5a1d19e945 tgsi/transform: Drop a stale comment.
This method returns void.

Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15782>
2022-04-08 21:31:44 +00:00
Emma Anholt ef9f2e8829 tgsi/transform: Make tgsi_transform_shader() manage token allocation.
Previously, the caller allocated storage and tgsi_transform_shader() would
emit into that, returning how many tokens it emitted.  All the callers had
to guess at how much storage was necessary, trying not to over-allocate
but also getting enough that you wouldn't (effectively) silently run out
of space.

Instead, make tgsi_transform_shader() do the allocation for you, taking
just a hint of how much space you think you need, and internally double
size when necessary.  Fixes failures on virgl with fp64 since we've added
more fp64 virglrenderer workarounds and its old "XXX: is this enough?"
allocation wasn't any more.

Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15782>
2022-04-08 21:31:44 +00:00
Emma Anholt e15154a735 nir_to_tgsi: Fix the address reg mapping for images and SSBOs to match G-T-T.
I missed these in the previous fix to mimic GLSL-to-TGSI address reg
behavior, which r600 relies on.

Fixes: 4bb9c0a28a ("nir_to_tgsi: Use the same address reg mappings as GLSL-to-TGSI did.")

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15824>
2022-04-08 21:01:42 +00:00
Emma Anholt 664f69a4d5 nir_to_tgsi: Extract const components of atomic counter offsets into Index.
virglrenderer maps atomic accesses to atomic counter declarations using
the .Index field.  We were previously emitting a .Index of 0 for array
accesses, so virglrenderer would emit
atomicIncrement(first_counter[counter_offset+array_index]).  This would
mostly work because hardware doesn't care about the bounds of counter
declarations, but if the first counter was a non-array, then the [] GLSL
emit gets dropped (can't array access a scalar!) and you'd access the
non-array first_counter instead.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15824>
2022-04-08 21:01:42 +00:00
Emma Anholt 949bc15ea5 nir_to_tgsi: Fix emitting the sample number for non-array MSAA image access.
It's always in .w, rather than being the next component after the
x/y/array index.

Fixes: c6d3fd8c21 ("gallium/ntt: Emit sample index when necessary for image load/store.")

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15825>
2022-04-08 17:17:16 +00:00
Mike Blumenkrantz 7f56fd9655 zink: it's kopperin' time
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14541>
2022-04-07 00:17:40 +00:00
Adam Jackson d760a9151b gallium: Learn about kopper
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14541>
2022-04-07 00:17:40 +00:00
Emma Anholt 591899eedd gallivm/nir: Add a short circuit uniform-offset mode for load_ssbo/load_shared.
dEQP-VK.binding_model.buffer_device_address.set3.depth3.basessbo.convertuvec2.nostore.multi.scalar.vert
runtime -24.4002% +/- 1.94375% (n=7).  The win (I think) is in LLVM not
having to chew through handling the extra loops on every constant-offset
SSBO load, not in actual rendering time.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14999>
2022-04-06 00:04:14 +00:00
Emma Anholt 181f25aff4 gallivm/nir: Add a short circuit uniform-offset mode for load_global.
If we know the offset is constant, we don't have ask LLVM to loop over the
elements pulling the same value out over and over.

This doesn't seem to have produced a win in the testcase I was looking at,
but it was an easier entrypoint to figuring out how to do scalar memory
access than load_memory, and will probably affect some workload.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14999>
2022-04-06 00:04:14 +00:00
Emma Anholt d74606d440 gallivm/nir: Refactor out some repeated code to generate 0 values.
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14999>
2022-04-06 00:04:14 +00:00
Emma Anholt 4fad4c1d79 gallivm/nir: Refactor out some repeated logic for SSBO/shared access.
I needed to be able to get these pointers/limits from another location,
and missing some of the repeated steps was giving me bugs.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14999>
2022-04-06 00:04:14 +00:00
Emma Anholt 21b3db7d17 gallivm/nir: Pull some repeated exec_mask computation out of loops.
If the exec mask hasn't changed, don't hassle LLVM to set it up

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14999>
2022-04-06 00:04:14 +00:00
Emma Anholt 9ab4ecb1ae gallivm/nir: Don't do uniform-and-broadcast access on inactive invocations.
In a fragment shader or inside of control flow, invocation 0 might be
inactive, and so our use-first-invocation-and-broadcast optimizations
would be invalid, and the loop logic of an emit_read_invocation would
defeat the point of these optimized paths.

For load_kernel_input, I didn't guard the uniform path with the check
because some CL tests that are currently passing are doing the
load_kernel_input under (presumably) uniform control flow.  Instead, I
dropped in a once warning for the next person to be debugging CL.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14999>
2022-04-06 00:04:14 +00:00
Mike Blumenkrantz bbe15d99e2 aux/trace: dump format in set_shader_images
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15323>
2022-04-04 13:16:16 +00:00
Emma Anholt 44aff2beec nir_to_tgsi: Add support for nir_intrinsic_image_samples.
Found in 1 piglit test on r600.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15627>
2022-04-02 15:17:01 +00:00
Corentin Noël 23f5e2edbd nir_to_tgsi: Handle blocks defined as arrays of arrays
Make sure to take all the array sizes into account when generating the TGSI.

Makes the `piglit.spec@arb_arrays_of_arrays@execution@ubo@fs-const-explicit-binding`
test pass

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15713>
2022-04-01 15:41:36 +00:00
Yonggang Luo ab225a1e36 util: Rename pipe_debug_type to util_debug_type
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15657>
2022-04-01 01:52:43 +00:00
Yonggang Luo 2ca6ef22f7 util: Rename pipe_debug_callback to util_debug_callback
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15657>
2022-04-01 01:52:43 +00:00
Yonggang Luo 523675e995 util: Rename pipe_debug_message to util_debug_message
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15657>
2022-04-01 01:52:43 +00:00
Corentin Noël f86bc873ff nir_to_tgsi: Require the block index to always be populated
In some cases like when using `NIR_DEBUG=serialize`, impl->num_blocks is 0
which leads to assertions error in the blocklist. Make sure to require the
num_blocks to be populated.

Fixes: 74c02d99b2

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15640>
2022-03-30 04:19:14 +00:00
Dave Airlie 24a6693ece u_transfer_helper: add a new option for handling z24 stored in z32
It might be possible to combine this with the other merge to avoid
the overheads of making a temp copy.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15516>
2022-03-26 01:22:15 +00:00
Dave Airlie 90a6947632 u_transfer: refactor out code to check interleave/deinterleave path.
The checks were reproduced making adding another one not so fun.

rework the deinterleave path code to match the interleave path code.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15516>
2022-03-26 01:22:15 +00:00
Rob Clark 03a70f554a pipe-loader: Try loading freedreno for virtgpu device
Freedreno will check if the virtgpu supports the pass-thru context, and
if not will bail, falling back to virgl.

TODO this requires that virgl is also enabled in the mesa build, even if
it is not needed.. maybe there is a better way to handle this?

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14900>
2022-03-25 02:03:30 +00:00
Yonggang Luo 55a5635fb2 llvmpipe: Revise u_sse.h to remove unused _mm_shuffle_epi8 inline function
error log:
```
[2/43] Compiling C object src/gallium/drivers/llvmpipe/libllvmpipe.a.p/lp_setup_tri.c.obj
FAILED: src/gallium/drivers/llvmpipe/libllvmpipe.a.p/lp_setup_tri.c.obj
"cc" "-Isrc/gallium/drivers/llvmpipe/libllvmpipe.a.p" "-Isrc/gallium/drivers/llvmpipe" "-I../../src/gallium/drivers/llvmpipe" "-I../../src/gallium/include" "-Isrc/gallium/auxiliary" "-I../../src/gallium/auxiliary" "-Iinclude" "-I../../include" "-Isrc" "-I../../src" "-Isrc/compiler/nir" "-I../../src/compiler/nir" "-Isrc/util" "-I../../src/util" "-IC:/CI-Tools/msys64/clang64/include" "-fvisibility=hidden" "-fcolor-diagnostics" "-Wall" "-Winvalid-pch" "-std=c11" "-O0" "-g" "-DPACKAGE_VERSION=\"22.0.0-devel\"" "-DPACKAGE_BUGREPORT=\"https://gitlab.freedesktop.org/mesa/mesa/-/issues\"" "-DHAVE_WINDOWS_PLATFORM" "-DHAVE_SURFACELESS_PLATFORM" "-DUSE_ELF_TLS" "-DUSE_TLS_BEHIND_FUNCTIONS" "-DENABLE_ST_OMX_BELLAGIO=0" "-DENABLE_ST_OMX_TIZONIA=0" "-DEGL_NO_X11" "-DDEBUG" "-DHAVE___BUILTIN_BSWAP32" "-DHAVE___BUILTIN_BSWAP64" "-DHAVE___BUILTIN_CLZ" "-DHAVE___BUILTIN_CLZLL" "-DHAVE___BUILTIN_CTZ" "-DHAVE___BUILTIN_EXPECT" "-DHAVE___BUILTIN_FFS" "-DHAVE___BUILTIN_FFSLL" "-DHAVE___BUILTIN_POPCOUNT" "-DHAVE___BUILTIN_POPCOUNTLL" "-DHAVE___BUILTIN_UNREACHABLE" "-DHAVE___BUILTIN_TYPES_COMPATIBLE_P" "-DHAVE_FUNC_ATTRIBUTE_CONST" "-DHAVE_FUNC_ATTRIBUTE_FLATTEN" "-DHAVE_FUNC_ATTRIBUTE_MALLOC" "-DHAVE_FUNC_ATTRIBUTE_PURE" "-DHAVE_FUNC_ATTRIBUTE_UNUSED" "-DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT" "-DHAVE_FUNC_ATTRIBUTE_WEAK" "-DHAVE_FUNC_ATTRIBUTE_FORMAT" "-DHAVE_FUNC_ATTRIBUTE_PACKED" "-DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL" "-DHAVE_FUNC_ATTRIBUTE_ALIAS" "-DHAVE_FUNC_ATTRIBUTE_NORETURN" "-DHAVE_FUNC_ATTRIBUTE_VISIBILITY" "-DHAVE_UINT128" "-D_WINDOWS" "-D_WIN32_WINNT=0x0A00" "-DWINVER=0x0A00" "-DPIPE_SUBSYSTEM_WINDOWS_USER" "-D_USE_MATH_DEFINES" "-DUSE_SSE41" "-DUSE_GCC_ATOMIC_BUILTINS" "-DHAS_SCHED_H" "-DHAVE_CET_H" "-DHAVE_STRTOF" "-DHAVE_STRTOK_R" "-DHAVE_QSORT_S" "-DHAVE_ZLIB" "-DHAVE_ZSTD" "-DHAVE_COMPRESSION" "-DLLVM_AVAILABLE" "-DMESA_LLVM_VERSION_STRING=\"13.0.0\"" "-DLLVM_IS_SHARED=1" "-DDRAW_LLVM_AVAILABLE" "-DMESA_EXECMEM" "-DVK_USE_PLATFORM_WIN32_KHR" "-Werror=implicit-function-declaration" "-Werror=missing-prototypes" "-Werror=return-type" "-Werror=empty-body" "-Werror=incompatible-pointer-types" "-Werror=int-conversion" "-Wimplicit-fallthrough" "-Wno-missing-field-initializers" "-fno-math-errno" "-fno-trapping-math" "-Qunused-arguments" "-fno-common" "-Wno-microsoft-enum-value" "-Werror=format" "-Wformat-security" "-Werror=thread-safety" "-ffunction-sections" "-fdata-sections" "-pthread" "-D_FILE_OFFSET_BITS=64" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-Werror=pointer-arith" "-Werror=gnu-empty-initializer" -MD -MQ src/gallium/drivers/llvmpipe/libllvmpipe.a.p/lp_setup_tri.c.obj -MF "src/gallium/drivers/llvmpipe/libllvmpipe.a.p/lp_setup_tri.c.obj.d" -o src/gallium/drivers/llvmpipe/libllvmpipe.a.p/lp_setup_tri.c.obj "-c" ../../src/gallium/drivers/llvmpipe/lp_setup_tri.c
In file included from ../../src/gallium/drivers/llvmpipe/lp_setup_tri.c:37:
In file included from ../../src/gallium/drivers/llvmpipe/lp_setup_context.h:38:
In file included from ../../src/gallium/drivers/llvmpipe/lp_setup.h:31:
In file included from ../../src/gallium/drivers/llvmpipe/lp_jit.h:40:
In file included from ../../src/gallium/auxiliary/gallivm/lp_bld_limits.h:37:
In file included from ../../src/util/u_cpu_detect.h:41:
In file included from ../../src/util/u_thread.h:35:
In file included from ../../include/c11/threads.h:64:
In file included from ../../include/c11/threads_win32.h:58:
In file included from C:/CI-Tools/msys64/clang64/x86_64-w64-mingw32/include/windows.h:69:
In file included from C:/CI-Tools/msys64/clang64/x86_64-w64-mingw32/include/windef.h:9:
In file included from C:/CI-Tools/msys64/clang64/x86_64-w64-mingw32/include/minwindef.h:163:
In file included from C:/CI-Tools/msys64/clang64/x86_64-w64-mingw32/include/winnt.h:1555:
In file included from C:/CI-Tools/msys64/clang64/lib/clang/13.0.0/include/x86intrin.h:15:
In file included from C:/CI-Tools/msys64/clang64/lib/clang/13.0.0/include/immintrin.h:37:
C:/CI-Tools/msys64/clang64/lib/clang/13.0.0/include/tmmintrin.h:582:1: error: redefinition of '_mm_shuffle_epi8'
_mm_shuffle_epi8(__m128i __a, __m128i __b)
^
../../src/gallium/auxiliary/util/u_sse.h:159:1: note: previous definition is here
_mm_shuffle_epi8(__m128i a, __m128i mask)
^
1 error generated.

```

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14077>
2022-03-23 21:44:04 +00:00
Daniel Schürmann 832d67e99d nir: rename nir_src_is_dynamically_uniform to nir_src_is_always_uniform
As this function doesn't check for any control-flow
dependence, it only returns true for statically
(or globally) uniform values.
The same holds true for is_binding_dynamically_uniform()
in nir_opt_gcm().
Rename to better reflect that property.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14994>
2022-03-23 14:02:08 +00:00
Erik Faye-Lund d5ed8d4126 gallium: rename image atomic inc-wrap cap
This cap is no longer TGSI specific, so let's rename it to reflect
reality.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15448>
2022-03-23 08:54:06 +00:00
Erik Faye-Lund 880d848b7d gallium: rename image atomic float-add cap
This cap is no longer TGSI specific, so let's rename it to reflect
reality.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15448>
2022-03-23 08:54:06 +00:00
Erik Faye-Lund ab26020017 gallium: rename window-space position cap
This cap is no longer TGSI specific, so let's rename it to reflect
reality.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15448>
2022-03-23 08:54:06 +00:00
Mike Blumenkrantz 36373e8e1e draw: fix nonzero stream primitives generated queries
the fastpath here can only be taken if there is exactly one stream active,
as this will otherwise break nonzero stream primitives generated queries

in truth, this num_vertex_streams thing should be a bitmask so that the case
of num_streams=1,stream_id!=0 could also be fastpathed, but the complexity
probably isn't worth it given the infrequency of use

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15506>
2022-03-23 04:08:14 +00:00
Mike Blumenkrantz 32f117f5f8 draw: fix gs vertex stream counting
this can't be determined from pipe_shader_state::stream_output,
as this only contains xfb info, which is not the same as the vertex
stream info, and may break primitives generated queries

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15506>
2022-03-23 04:08:14 +00:00
Dave Airlie 3bbd404457 gallivm/sample: detect if rho is inf or nan and flush to zero.
When using cubemaps and the u/v values are 0, then this point
can be arrived at with rho = nan, and if rho is NaN, then lod
calculations end up at the max lod, whereas the spec suggests
they should end up at the most negative lod.

This fixes
dEQP-VK.glsl.texture_functions.query.texturequerylod.samplercube_float_zero_uv_width_fragment

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15335>
2022-03-23 10:21:12 +10:00
Erik Faye-Lund 115298b71e gallium: rename ballot cap
This cap is no longer TGSI specific, so let's rename it to reflect
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund b3ce733da9 gallium: rename clock cap
This cap is no longer TGSI specific, so let's rename it to reflect
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 7984c5884c gallium: rename group-vote cap
This cap is no longer TGSI specific, so let's rename it to reflect
reality.

Because the name got a bit vague when removing the TGSI-bits, let's add
some more details to the name.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund a6d7ead686 gallium: rename texture query samples cap
This isn't specific to TGSI, so let's update the name to reflect
reality.

Because the name of the opcode was TGSI specific, let's pick a new one,
based on the naming of the PIPE_CAP_TEXTURE_QUERY_LOD cap.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 930b38e7cd gallium: rename read-outputs cap
This cap is no longer TGSI-specific, so let's update the name to reflect
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 2dff9bea4f gallium: rename array-components cap
This cap is no longer TGSI specific, so let's update the name to reflect
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 350329feb1 gallium: rename sysval caps
These aren't spiecic to TGSI any more, so let's rename them to reflect
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund df40de91d9 gallium: rename fine derivative cap
This is no longer TGSI specific, so let's rename it to reflect the
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 2a8e11e101 gallium: rename pixel-coord caps
These aren't specific to TGSI, so let's rename them to reflect the
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 89797fac56 gallium: rename layer-viewport caps
Similar to the previous commits, these aren't TGSI specific, so let's
drop TGSI from their name.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:41 +00:00
Erik Faye-Lund 8ac7dc9cf6 gallium: rename vs instance id cap
This cap is no longer specific to TGSI, so let's rename it and update
the documentation to reflect that.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:41 +00:00
Erik Faye-Lund f8809fbdb8 gallium: rename pack half-float cap
This cap no longer has anything to do with TGSI, as the lowering happens
on GLSL IR, and applies just as much to NIR drivers. So let's rename
this cap and update the docs to reflect the current situation.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:41 +00:00
Mike Blumenkrantz 6345575f8a gallivm: fix oob image detection for cube/1dArray/2dArray/cubeArray
these all need to check for z coord oob to avoid crashing

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15388>
2022-03-16 04:58:41 +00:00
Mike Blumenkrantz 13d900de0d llvmpipe: set nir_shader_compiler_options::use_scoped_barrier
required for vk memory model

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15377>
2022-03-15 22:17:43 +00:00
Mike Blumenkrantz 4cf9e24039 gallivm: implement nir_op_pack_32_4x8_split
just reusing existing helpers and llvm can optimize it for us

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15384>
2022-03-15 18:07:47 +00:00
Pierre-Eric Pelloux-Prayer 3c3a8f853d gallium/tc: zero alloc transfers
Otherwise this causes trouble with unitialized memory, eg with:
   struct si_transfer {
      struct threaded_transfer b;
      struct si_resource *staging;
   };
'staging' will not be initialized and this causes #6109.

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

Cc: mesa-stable
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15298>
2022-03-09 08:48:59 +00:00
Mike Blumenkrantz 6ab720f1f4 aux/cso: stop tracing during cso_unbind()
this unnecessarily bloats lavapipe traces

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14854>
2022-03-09 03:54:37 +00:00
Mike Blumenkrantz 0e51c47816 aux/trace: dump more rasterizer state members
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14854>
2022-03-09 03:54:37 +00:00
Mike Blumenkrantz ec45b7ed32 aux/trace: dump clear_texture colors
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14854>
2022-03-09 03:54:37 +00:00
Mike Blumenkrantz 296e26eec8 aux/trace: dump clear colors as uints
dumping as float is nice if the clear color is a float, but if it isn't
then the value is useless

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14854>
2022-03-09 03:54:37 +00:00
Mike Blumenkrantz 8142fc5a45 aux/trace: rzalloc the context struct
this has problems if pointers are garbage

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14854>
2022-03-09 03:54:37 +00:00
Mike Blumenkrantz f1cdaf36df aux/trace: more screen methods
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14854>
2022-03-09 03:54:37 +00:00
Dave Airlie 8346983775 gallivm/nir: extract a valid texture index according to exec_mask.
When using indirect textures, some lanes may not be active,
particularly in a loop, so as with some other areas, extracting
the correct lane is needed here. This extracts the last valid one.

KHR-GL45.texture_barrier.* on zink.

Fixes: e168d148d7 ("gallivm/nir: handle non-uniform texture offsets")

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15259>
2022-03-08 08:42:06 +00:00
Pierre-Eric Pelloux-Prayer 52ceb9dcb6 gallium/tc: warn if an app is incompatible with cpu_storage
Instead of silently ignoring unmap calls.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15074>
2022-03-07 14:51:16 +01:00
Pierre-Eric Pelloux-Prayer cd0ef9b3f4 gallium/u_threaded: late alloc cpu_storage
Instead of allocating cpu_storage in threaded_resource_init, defer the
allocation to first use (in tc_buffer_map).
This avoids needless memory allocation if tc_buffer_disable_cpu_storage is
called before tc_buffer_map.

map_buffer_alignment is stored and serves as a "can cpu_storage be used" flag.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15074>
2022-03-07 14:51:15 +01:00
Mike Blumenkrantz c82dcdf598 gallivm: avoid division by zero when computing cube face
this is illegal and produces NaNs which blow up the sample instr

cc: mesa-stable

fixes (llvmpipe and zink):
KHR-GL45.incomplete_texture_access.sampler
dEQP-GLES31.functional.program_uniform.by_pointer.render.array_in_struct.sampler2D_samplerCube_both
dEQP-GLES31.functional.program_uniform.by_pointer.render.array_in_struct.sampler2D_samplerCube_fragment
dEQP-GLES31.functional.program_uniform.by_pointer.render.array_in_struct.sampler2D_samplerCube_vertex
dEQP-GLES31.functional.program_uniform.by_pointer.render.basic.samplerCube_both
dEQP-GLES31.functional.program_uniform.by_pointer.render.basic.samplerCube_fragment
dEQP-GLES31.functional.program_uniform.by_pointer.render.basic.samplerCube_vertex
dEQP-GLES31.functional.program_uniform.by_pointer.render.basic_struct.sampler2D_samplerCube_both
dEQP-GLES31.functional.program_uniform.by_pointer.render.basic_struct.sampler2D_samplerCube_fragment
dEQP-GLES31.functional.program_uniform.by_pointer.render.nested_structs_arrays.sampler2D_samplerCube_both
dEQP-GLES31.functional.program_uniform.by_pointer.render.nested_structs_arrays.sampler2D_samplerCube_fragment
dEQP-GLES31.functional.program_uniform.by_pointer.render.nested_structs_arrays.sampler2D_samplerCube_vertex
dEQP-GLES31.functional.program_uniform.by_pointer.render.struct_in_array.sampler2D_samplerCube_both
dEQP-GLES31.functional.program_uniform.by_pointer.render.struct_in_array.sampler2D_samplerCube_fragment
dEQP-GLES31.functional.program_uniform.by_pointer.render.struct_in_array.sampler2D_samplerCube_vertex
dEQP-GLES31.functional.program_uniform.by_value.render.array_in_struct.sampler2D_samplerCube_both
dEQP-GLES31.functional.program_uniform.by_value.render.array_in_struct.sampler2D_samplerCube_fragment
dEQP-GLES31.functional.program_uniform.by_value.render.array_in_struct.sampler2D_samplerCube_vertex
dEQP-GLES31.functional.program_uniform.by_value.render.basic.samplerCube_both
dEQP-GLES31.functional.program_uniform.by_value.render.basic.samplerCube_fragment
dEQP-GLES31.functional.program_uniform.by_value.render.basic.samplerCube_vertex
dEQP-GLES31.functional.program_uniform.by_value.render.basic_struct.sampler2D_samplerCube_both
dEQP-GLES31.functional.program_uniform.by_value.render.basic_struct.sampler2D_samplerCube_fragment
dEQP-GLES31.functional.program_uniform.by_value.render.nested_structs_arrays.sampler2D_samplerCube_both
dEQP-GLES31.functional.program_uniform.by_value.render.nested_structs_arrays.sampler2D_samplerCube_fragment
dEQP-GLES31.functional.program_uniform.by_value.render.nested_structs_arrays.sampler2D_samplerCube_vertex
dEQP-GLES31.functional.program_uniform.by_value.render.struct_in_array.sampler2D_samplerCube_both
dEQP-GLES31.functional.program_uniform.by_value.render.struct_in_array.sampler2D_samplerCube_fragment
dEQP-GLES31.functional.program_uniform.by_value.render.struct_in_array.sampler2D_samplerCube_vertex

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15246>
2022-03-06 02:44:17 +00:00
Mike Blumenkrantz cf9454bb2a gallivm: fix debug prints for halfs
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15246>
2022-03-06 02:44:17 +00:00
Dave Airlie 34379a937f gallivm/llvmpipe: add support for NIR to the linear/aos paths.
When the AOS/linear code was added it only worked with TGSI which
meant nothing in mesa upstream was really using it.

This adds support to analyse NIR shaders, and adds aos support
to the backend.

AOS support is limited to mov,vec,fmul,tex sampling in order to
accelerate mostly compositing operations. I've tested weston uses
the fast path. gnome-shell can't use it yet as we can't optimise
the depth test paths.

Acked-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15140>
2022-03-03 01:39:39 +00:00
Dave Airlie 6efd489ac9 gallivm/nir: split load_const out into backend helper.
This just makes adding aos support easier.

Acked-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15140>
2022-03-03 01:39:39 +00:00
Emma Anholt d506d910e4 nir: Switch to using nir_vec_scalars() for things that used nir_channel().
This should reduce follow-on optimization work to copy-propagate and
dead-code away the movs generated in construction of vectors.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14865>
2022-03-02 22:28:58 +00:00
Marek Olšák ee4c5b1699 gallium/aux: add helper nir_gather_stream_output_info
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14388>
2022-03-01 21:59:55 +00:00
Marek Olšák 2a708efec3 gallium/util: add util_dump_stream_output_info
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14388>
2022-03-01 21:59:55 +00:00
Dave Airlie b77ef4dd60 draw/so: don't use pre clip pos if we have a tes either.
This check for geom shader needed to be expanded for tess support.

dEQP-VK.transform_feedback.simple.depth_clip_control_tese with lvp

Fixes: dacf8f5f5c ("draw: hook up final bits of tessellation")

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15128>
2022-02-23 20:56:42 +00:00
Qiang Yu 100c80392a util/util_vertex_state_cache: remove error check when deinit
Application may exit without freeing created display list, this
may leave the cache not empty.

This is triggered by Abaqus which just close X11 display without
calling any of GLX cleanup functions like glXDestroyContext. But
GLX hook to X11 display close function to free GLX screen resource.
So display list as a context resource has not been freed, but
cache as a screen resource is freed.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14926>
2022-02-22 07:10:40 +00:00
Qiang Yu 1dac5454ea glx: keep native window glx drawable by driconf option
DRI3 window back buffer is a client resource, so it's destroyed
when context switch drawable for native window.

But some application like Abaqus may leave a dirty back buffer
and reuse it when switch back. So add a driconf option for these
kind of app to keep the entire GLX drawable for native window.

Reviewed-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/14926>
2022-02-22 07:10:40 +00:00
Marek Olšák 7ec8a3205e gallivm: fix build with LLVM 15
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15095>
2022-02-22 01:28:11 +00:00
Marek Olšák eb4bd06ef4 gallium: add PIPE_RESOURCE_FLAG_UNMAPPABLE for shared unmappable buffers
We need to handle this in u_threaded_context for GL-VK interop.

Drivers should set this when importing buffers if needed.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14750>
2022-02-21 21:42:04 +00:00
Alyssa Rosenzweig 7ec1d96e5e nir: Set internal=true in nir_builder_init_simple_shader
Matches the expected use by callers. We do need to fix up a few callers which
use this call for external shaders.

v2: Fix up a radv call site (Rhys).

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net> [v1]
Acked-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14936>
2022-02-17 23:30:46 +00:00
Matti Hamalainen 4e252cbc7d aux/trace: fix dumping of pipe_texture_target
I had missed a int -> enum conversion in one recently added function and
it's probably nice to also dump the target value also in
trace_dump_resource_template() so let's do just that.

Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14980>
2022-02-16 14:06:16 +00:00
Emma Anholt 3652ff2fa1 draw: Don't look at .nir if !IR_NIR.
I suspect this double-check and comment was due to originally using ir.nir
as the condition, which might be uninitialized if !IR_NIR.  You could only
take the branch if IR_NIR was set, and you should always not take if it
!IR_NIR, so it worked out in the end, but it would cause spurious valgrind
warnings if you hadn't zeroed out your TGSI shader's struct.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14896>
2022-02-15 18:15:29 +00:00
Dave Airlie 127bcbed18 gallivm/st/lvp: add flags arg to get_query_result_resource api.
Currently this just has wait, but in order to get the right answer
for vulkan partial, lavapipe/llvmpipe need to pass a partial flag
through here in the future.

This just changes the API so that's possible.

v2: use an enum (zmike)

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15009>
2022-02-15 10:12:01 +10:00
Emma Anholt b995a8eba4 nir_to_tgsi: Add support for FBFETCH.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15014>
2022-02-14 22:06:37 +00:00
Emma Anholt eaf6e3d3af nir_to_tgsi: Don't vectorize 64-bit instructions, to keep virgl happy.
virglrenderer makes invalid shaders when faced with vector 64-bit
instructions, which GLSL-to-TGSI never produced.  While this doesn't fix
everything, it does get more tests running, and virgl probably the primary
consumer of 64-bit TGSI.  virgl may be deprecating its host 64-bit
support, at which point we can drop this workaround.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15014>
2022-02-14 22:06:37 +00:00
Emma Anholt af19774dd4 tgsi_translate: Make the procType public when translating.
This means that tgsi_translate users can check the PIPE_SHADER stage
without having to separately tgsi_scan().

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15014>
2022-02-14 22:06:37 +00:00
Daniel Schürmann 2a92452a0e nir/opt_shrink_vectors: Remove shrinking of store intrinsics data source
This is done via nir_opt_shrink_stores.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14480>
2022-02-11 11:50:47 +01:00
Christian Gmeiner b07372312d Revert "nir: make tgsi_varying_semantic_to_slot(..) public"
This reverts commit edbdd97723.

As etnaviv's TGSI compiler is gone we make that function
private again.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12889>
2022-02-11 08:48:10 +00:00
Dave Airlie da0e00e0b9 gallivm: add coroutine attribute that llvm requires.
Running llvm in debug mode asserts on this being missing.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14963>
2022-02-11 00:32:21 +00:00
Mike Blumenkrantz 68c1b50e48 aux/draw: fix llvm tcs lane vec generation
the idx param for LLVMBuildInsertElement is zero-indexed based on the
value of 'vector_length' (always 4), and the vector length is (obviously)
sized to 'vector_length', so this should be the member of the vec that is being
inserted, not the invocation index

cc: mesa-stable

fixes (zink, but only on my one machine):
KHR-GL46.tessellation_shader.single.max_patch_vertices
KHR-GL46.tessellation_shader.tessellation_shader_tc_barriers.barrier_guarded_read_write_calls
dEQP-GLES31.functional.tessellation.shader_input_output.barrier
dEQP-GLES31.functional.tessellation.shader_input_output.patch_vertices_5_in_10_out
dEQP-GLES31.functional.tessellation_geometry_interaction.feedback.tessellation_output_isolines_geometry_output_points
dEQP-GLES31.functional.tessellation_geometry_interaction.feedback.tessellation_output_isolines_point_mode_geometry_output_triangles
dEQP-GLES31.functional.tessellation_geometry_interaction.feedback.tessellation_output_quads_geometry_output_points
dEQP-GLES31.functional.tessellation_geometry_interaction.feedback.tessellation_output_quads_point_mode_geometry_output_lines
dEQP-GLES31.functional.tessellation_geometry_interaction.feedback.tessellation_output_triangles_geometry_output_points
dEQP-GLES31.functional.tessellation_geometry_interaction.feedback.tessellation_output_triangles_point_mode_geometry_output_lines

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14949>
2022-02-10 04:14:28 +00:00
Ian Romanick e3cbc328e0 gallivm/nir: Call nir_lower_bool_to_int32 after nir_opt_algebraic_late
All of the opcodes in nir_opt_algebraic_late are the unsized (1-bit)
versions.  If the lowering to int32 happens first, many of the
optimizations and lowerings won't happen.

Of particular importance is the lowering of fisfinite.  If a shader
happens to contain fisfinite of an fp16 value, it will assert later
during compliation.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Fixes: 78b4e417d4 ("gallivm: handle fisfinite/fisnormal")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14942>
2022-02-10 03:12:46 +00:00
Emma Anholt 74c02d99b2 nir_to_tgsi: Replace the NIR SSA liveness with TGSI reg-level liveness.
Allocating NIR registers ends up being required for drivers like r600 and
nv30, which don't do their own allocation (except in some cases on r600
where sb is used).

Rather than add a NIR register liveness impl
(https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14158), switch
from NIR-based liveness to just doing the same channel-based liveness
logic that the NIR registers needed at the TGSI level.  The actual
liveness code here basically comes straight out of
brw_vec4_live_variables.cpp.

Since we do the liveness in TGSI now, it also means we don't need to be
careful about not reading SSA values from later TGSI instructions (which
may be useful for doing some greedy instruction selection in generating
TGSI instructions).

i915g:
total instructions in shared programs: 400719 -> 380730 (-4.99%)
instructions in affected programs: 284760 -> 264771 (-7.02%)
total tex_indirect in shared programs: 12289 -> 12290 (<.01%)
tex_indirect in affected programs: 4 -> 5 (25.00%)
total temps in shared programs: 32172 -> 22086 (-31.35%)
temps in affected programs: 30647 -> 20561 (-32.91%)
LOST:   0
GAINED: 148

r300:
total instructions in shared programs: 1472463 -> 1459286 (-0.89%)
instructions in affected programs: 507009 -> 493832 (-2.60%)
total temps in shared programs: 212143 -> 201678 (-4.93%)
temps in affected programs: 78007 -> 67542 (-13.42%)

softpipe:
total temps in shared programs: 517071 -> 294387 (-43.07%)
temps in affected programs: 509324 -> 286640 (-43.72%)

Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14404>
2022-02-10 00:36:57 +00:00
Emma Anholt f4ce3178d9 nir_to_tgsi: Track our TGSI insns in blocks before emitting tokens.
To do register allocation well, we want to have a point before
ureg_insn_emit() to look at the liveness of the values and allocate them
to TGSI temporaries.  In order to do that, we have to switch from
ureg_OPCODE() emitting TGSI tokens directly to a new ntt_OPCODE() that
stores the ureg args in a block structure.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14404>
2022-02-10 00:36:57 +00:00
Emma Anholt 3f84c67af8 tgsi: Refactor out a tgsi_util_get_src_usage_mask().
The function operated on a tgsi_full_instruction, but for code generation
in NIR-to-TGSI I want to reuse this logic using pieces of tgsi_ureg
structs.

Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14404>
2022-02-10 00:36:57 +00:00
Ilia Mirkin 5200e1c212 translate: improve sse2 32-bit unsigned -> float conversion
The existing logic would drop the low bit. Instead, let's drop the high
bit, do the conversion, and then add the fixed constant back in if the
value had the high bit set originally.

Fixes KHR-GL45.direct_state_access.vertex_arrays_attribute_format on
drivers that use this module to handle the format conversion.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Emma Anholt <emma@anholt.net>
Tested-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14922>
2022-02-09 06:04:25 +00:00
Ilia Mirkin 0b69f7b15d rtasm: add pcmpgtd operation
This will be used shortly by the translate code. Available in SSE2.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Emma Anholt <emma@anholt.net>
Tested-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14922>
2022-02-09 06:04:25 +00:00
Ilia Mirkin 55b735c51a rtasm: fix printf specifier for ptrdiff_t
In practice it's a small number, but new gcc versions complain.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-by: Emma Anholt <emma@anholt.net>
Tested-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14922>
2022-02-09 06:04:25 +00:00
Emma Anholt 2883e8f33d nir_to_tgsi: Add a flag for lowering fabs, and use it in r300/i915.
Saves instructions if the same fabs value is used multiple times.

i915g:
total instructions in shared programs: 397005 -> 396525 (-0.12%)
instructions in affected programs: 11061 -> 10581 (-4.34%)
LOST:   0
GAINED: 22

r300 (not r500):
total instructions in shared programs: 180286 -> 179767 (-0.29%)
instructions in affected programs: 27102 -> 26583 (-1.91%)
total temps in shared programs: 29692 -> 29638 (-0.18%)
temps in affected programs: 356 -> 302 (-15.17%)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14938>
2022-02-08 18:50:01 -08:00
Emma Anholt d52d500f17 r300: Request that nir-to-tgsi avoid generating TGSI_OPCODE_CMP.
Given that our fcsels are on float-bools, we can emit the LRP directly and
save the backend having to emit a SLT to turn the CMP src[0] into a bool.

This required passing a codegen flags struct for nir-to-tgsi.  I think
this is a good way forward for it, as the alternative I think has mostly
been adding flags to nir_shader_compiler_options (since adding
PIPE_SHADER_CAPs is an unreasonable amount of pain).

r300 shader-db:
total instructions in shared programs: 1484320 -> 1472463 (-0.80%)
instructions in affected programs: 243588 -> 231731 (-4.87%)
total temps in shared programs: 212485 -> 212143 (-0.16%)
temps in affected programs: 3845 -> 3503 (-8.89%)

Acked-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14886>
2022-02-09 01:19:13 +00:00
Jesse Natalie 7ec0e2b893 tc: CPU storage needs to be freed with align_free
Cc: mesa-stable
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14933>
2022-02-08 20:36:29 +00:00
Mike Blumenkrantz 7e9481eaac gallium: add PIPE_CAP_CULL_DISTANCE_NOCOMBINE
for drivers where separate cull distance variables are required, this
lets them avoid having to write yet another pass to undo gallium's mangling
of shader info

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14878>
2022-02-08 14:03:09 +00:00
Mike Blumenkrantz 9a75392cd8 llvmpipe: disable PIPE_SHADER_CAP_FP16_CONST_BUFFERS
this cap is broken

cc: mesa-stable

fixes:
GTF-GL46.gtf21.GL2Tests.glGetUniform.glGetUnifor

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14835>
2022-02-02 23:03:40 +00:00
Qiang Yu d68087a1d9 gallium: add PIPE_CAP_CLAMP_SPARSE_TEXTURE_LOD
For ARB_sparse_texture_clamp.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>
2022-02-01 10:28:05 +00:00
Mike Blumenkrantz b1b8b712c1 aux/vbuf: add fastpath for skipping identical vbuf updates
the overhead of comparing these is MUCH less than the overhead of queuing a
driver method and performing the update

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14640>
2022-02-01 01:17:09 +00:00
Mike Blumenkrantz b733a22636 aux/vbuf: move mask-clearing for vbuf updates after buffer scanning
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14640>
2022-02-01 01:17:09 +00:00
Mike Blumenkrantz cf6a616122 aux/vbuf: use local var for modifying unaligned_vb_mask during update
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14640>
2022-02-01 01:17:09 +00:00
Mike Blumenkrantz 143c156409 aux/tc: add tc_buffer_write to replace pipe_buffer_write usage
tc_buffer_write is the tc-safe version of this function which will
avoid accidental invalidations that break behavior

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14770>
2022-01-28 14:58:20 +00:00
Emma Anholt 13b57a8cad tgsi_exec: Fix shared var stores for >1 real invocation, and overflow checks.
The shared var store overflow checks left a lot of overflowing
opportunities available, while the buffer storage path did proper
checking.  But, more importantly for this branch, it always used the first
invocation's offset for each invocation in the quad (which only worked so
far because softpipe only dispatched a single non-helper invocation
per quad).

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14728>
2022-01-26 22:52:19 +00:00
Ian Romanick 926d78a645 ntt: Extend ntt_compile::addr_declared and ntt_compile::addr_reg
This was identified by Coverity.  4bb9c0a28a added uses of a third
address register, but the arrays for tracking address registers only
have two slots.

Add back a version of the assertion from before 4bb9c0a28a to help
prevent future problems.  I don't think any drivers that would hit
this path use NIR-to-TGSI yet, so it may be moot.

Reviewed-by: Matt Turner <mattst88@gmail.com>
CID: 1496942
CID: 1496944
Fixes: 4bb9c0a28a ("nir_to_tgsi: Use the same address reg mappings as GLSL-to-TGSI did.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14487>
2022-01-21 00:25:38 +00:00
Emma Anholt 1048e6113e nir_to_tgsi: Use nir_opt_offsets for load_ubo_vec4.
This helps non-native-integers hardware where relative addressing of UBOs
has a constant offset field, and having addressing math (particularly for
D3D9) emitted as ALU ops ends up running us out of constants.  For
native-integers drivers (such as softpipe), the possible-overflow check
typically triggers and we end up not folding.

r300:
total instructions in shared programs: 1279167 -> 1278731 (-0.03%)
instructions in affected programs: 50834 -> 50398 (-0.86%)
total temps in shared programs: 213736 -> 213687 (-0.02%)
temps in affected programs: 598 -> 549 (-8.19%)
total consts in shared programs: 952973 -> 952850 (-0.01%)
consts in affected programs: 26776 -> 26653 (-0.46%)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14309>
2022-01-19 22:28:34 +00:00
Emma Anholt 700d2fbd0a nir: Add a .base field to nir_load_ubo_vec4.
This lets nir-to-tgsi fold the constant offset of addressing calculations
into the CONST[] reference, which is important for D3D9-era compatibility:
HW of that age has limited uniform space, and if we do the addressing math
as math in the shader for dynamic indexing, the nir_load_consts end up
taking up uniforms we don't have available.

r300:
total instructions in shared programs: 1279699 -> 1279167 (-0.04%)
instructions in affected programs: 134796 -> 134264 (-0.39%)
total instructions in shared programs: 1279699 -> 1279167 (-0.04%)
instructions in affected programs: 134796 -> 134264 (-0.39%)
total temps in shared programs: 213912 -> 213736 (-0.08%)
temps in affected programs: 2166 -> 1990 (-8.13%)
total consts in shared programs: 953237 -> 952973 (-0.03%)
consts in affected programs: 45980 -> 45716 (-0.57%)

Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14309>
2022-01-19 22:28:34 +00:00
Dave Airlie d54c07b4c4 mesa/*: use an internal enum for tessellation primitive types.
To avoid dragging gl.h into places it has no business being,
defined tessellation primitive mode to an enum.

This has a lot of fallout all over the place.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605>
2022-01-19 21:54:58 +00:00
Matti Hamalainen bbc4ca5d7d aux/trace: cosmetic cleanup
Fix up some function argument indentation alignments and
adjust few other small cosmetics.

Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14398>
2022-01-19 11:57:17 +00:00
Matti Hamalainen 85a75e42db aux/trace: implement missing trace calls
Some call traces (resource_from_handle, resource_get_handle and
resource_get_param) were TODO, so implement them while we are here.

Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14398>
2022-01-19 11:57:17 +00:00
Matti Hamalainen 32d40f7c80 aux/trace: print enum names instead of integer values in gallium traces
Having only magic constants instead of human-readable strings in
traces not only hinders readability, but also may affect trace
comparision of old and new traces if new enums have been added
or modified (thus possibly changing the values of existing ones.)

So we implement printing of enum names as strings instead.
In order to have those strings, we need to add some new helper
functions, which we will automatically generate from header file
src/gallium/include/pipe/p_defines.h via a new Python script
enums2names.py.

We also bolt this all into the Meson build system.

Link: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4609
Signed-off-by: Matti Hamalainen <ccr@tnsp.org>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14398>
2022-01-19 11:57:17 +00:00
Neha Bhende 533a09541d tgsi: Add hw_atomic_declared in tgsi_info
This patch also adds hw_atomic_declared info in tgsi_info.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14270>
2022-01-18 23:50:36 +00:00
Qiang Yu 485ceb5c51 gallium: add multi_sample parameter to get_sparse_texture_virtual_page_size
Instead of using actual sample count as parameter, we only use a bool
to indicate if the target is multi sample. This is because we don't
know the sample count when glGetInternalformativ() case.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362>
2022-01-18 16:10:36 +08:00
Qiang Yu fef018c307 gallium: add PIPE_CAP_QUERY_SPARSE_TEXTURE_RESIDENCY
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362>
2022-01-18 16:10:35 +08:00
Qiang Yu 5dd9cb1069 gallium/dd_debug: add get_sparse_texture_virtual_page_size
Otherwise GALLIUM_DDEBUG=always crash when sparse texture is used.

Fixes: eed8421bba ("gallium: add screen get_sparse_texture_virtual_page_size callback")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Sigend-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362>
2022-01-18 16:10:35 +08:00
Mike Blumenkrantz 5f1ca03c45 aux/trace: add pipe_context::fence_server_signal tracing
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14539>
2022-01-14 14:21:36 +00:00
Mike Blumenkrantz 596d2ab0ad util/vbuf: fix buffer translation sizing
the original change here attempted to fix calculating the maximum bound for the
mapped readback buffer by adding the maximum attribute size to the final element
used by readback

the calculation was erroneous, however, because it instead calculated the maximum
offset instead of the size, which would cause a different kind of overrun

Fixes: 3c5b7dca30 ("util/vbuf: fix buffer overrun in attribute conversions")

fixes #5846

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14479>
2022-01-13 14:28:23 +00:00
Mike Blumenkrantz 01709464a4 aux/trace: copy over stream_output_target_offset method from context
this can't be traced, so don't crash

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14481>
2022-01-13 06:09:22 +00:00
Emma Anholt 3563ae4b2d nir_to_tgsi: Fix a bug in TXP detection after backend lowering.
TGSI reserves 2 components for the coord in the first operand vector, even
for 1D.  Fixes r600 failure with shadow1d.

Fixes: 390a3fcdc4 ("nir_to_tgsi: Add support for TXP.")
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14322>
2022-01-11 00:53:39 +00:00
Alyssa Rosenzweig 26c533f167 gallium/util: Add pixel->blocks box helper
There is a lot of unit confusion in Gallium due to pixels versus blocks
matching only with uncompressed textures. Add a helper to do a common
pixels->blocks unit conversion required in multiple drivers.

v2: Rename dst->blocks, src->pixels to avoid confusion about the units
to casual readers (Mike).

Note to mesa-stable maintainers: this is marked as Cc: mesa-stable so
the next patch (a set of bug fixes for Lima and Panfrost) can be
backported. It's not a bug fix in its own right, of course.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net> [v1]
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14370>
2022-01-10 23:16:56 +00:00
Thomas H.P. Andersen 7daba1fe65 replace 0 with NULL for NULL pointers
This updates many places where 0 is used as NULL pointer.

There are a few warnings left when I build the default
configuration but they either relate to code
outside of mesa or where "None" is used instead.

Found with static analysis (smatch)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12174>
2022-01-10 22:53:32 +00:00
Gert Wollny 8685a505e7 ntt: Set the output invariant flag according to the semantics
This is used by virglrenderer to create the correct shaders on the
host. Fixes:

dEQP-GLES31.functional.primitive_bounding_box.triangles.tessellation_set_per_primitive.vertex_tessellation_fragment.fbo

when using ntt with virgl.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14423>
2022-01-07 16:35:43 +00:00
Emma Anholt 558a600629 nir_to_tgsi: Enable fdot_replicates flag.
That's how the TGSI math opcodes work.

This lets lower_vec_to_regs coalesce the DP output into the .yzw channels,
giving an impressive shader-db win on softpipe:

total instructions in shared programs: 2929840 -> 2794036 (-4.64%)
instructions in affected programs: 1651438 -> 1515634 (-8.22%)
total temps in shared programs: 372730 -> 332744 (-10.73%)
temps in affected programs: 118151 -> 78165 (-33.84%)

and a minor one on r300:

total instructions in shared programs: 51238 -> 51149 (-0.17%)
instructions in affected programs: 2621 -> 2532 (-3.40%)
total vinst in shared programs: 15655 -> 15618 (-0.24%)
vinst in affected programs: 468 -> 431 (-7.91%)
total temps in shared programs: 9838 -> 9828 (-0.10%)
temps in affected programs: 59 -> 49 (-16.95%)

and a bigger one on i915g:
total instructions in shared programs: 398064 -> 395901 (-0.54%)
instructions in affected programs: 29271 -> 27108 (-7.39%)
total tex_indirect in shared programs: 12261 -> 12233 (-0.23%)
tex_indirect in affected programs: 98 -> 70 (-28.57%)
LOST:   0
GAINED: 5

The r300 change is less impressive because it does some backend copy-prop,
but also because intermediate storage of DPs now takes a vec4 instead of a
scalar.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14200>
2022-01-07 09:58:24 +00:00
Emma Anholt 4dc6cd5933 tgsi/exec: Simplify indirects now that they always use the ADDR file.
This was a lot of extra code in the hot path of getting though
fetch_src_file_channel().  No significant perf difference in softpipe,
though.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14360>
2022-01-04 23:05:41 +00:00
Emma Anholt c00db99e0e gallium: Delete PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS
Softpipe was the only driver still using this feature.  I had enabled it
in ba22f014f9 ("softpipe: Enable PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS;") for
an instr count win, but it's really not important to that driver and it's
not worth keeping the knob around just for that.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14360>
2022-01-04 23:05:41 +00:00
Emma Anholt 4bb9c0a28a nir_to_tgsi: Use the same address reg mappings as GLSL-to-TGSI did.
It turns out r600 has a bunch of expectations about the Dimension being in
ADDR[1].x, and sampler or atomic indirects being in ADDR[2].x.  It's
simpler to just use this static assignment than our dynamic one, anyway.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14360>
2022-01-04 23:05:41 +00:00
Jesse Natalie 5c3dfb4ef5 gallium/aux: Move index offsetting from prim restart to primconvert
Fixes: b34fed64 ("u_prim_restart: Fix index scanning with start offset")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5799
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14346>
2021-12-31 17:29:46 +00:00
Qiang Yu 1a616c4b29 gallium: add get_sparse_texture_virtual_page_size for noop/rbug/trace
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14223>
2021-12-30 16:11:19 +08:00
Qiang Yu 7f48aba641 gallium: add caps for sparse texture support
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14223>
2021-12-30 16:11:19 +08:00
Thomas H.P. Andersen c8c00fc6c3 draw: drop unused function
Introduced in 381e9fe6. Never used.

Fixes a compile warning with clang

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14252>
2021-12-22 17:02:00 +00:00
Thomas H.P. Andersen a7c5645dd3 gallium/tgsi_exec: drop unused function
Introduced in 9ca6cf0f and last usage
dropped in 31369987

Fixes a compile warning with clang

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14252>
2021-12-22 17:02:00 +00:00
Thomas H.P. Andersen 887b838632 gallium/u_threaded: drop unused function
tc_drop_sampler_view_reference is unused. It was introduced
in 340703e0 and its last usage was dropped in bb89cf4bf3

Fixes a compile warning with clang

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14252>
2021-12-22 17:02:00 +00:00
Thomas H.P. Andersen f1dfc6a780 gallivm: avoid a self-assign warning
Fixes a clang warning

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14272>
2021-12-22 03:34:23 +00:00
Simon Ser 0a9886cc45 renderonly: write down usage rules
The renderonly helpers are extremely easy to mis-use. Write down
the expectations.

I've seen *many* mistakes in the past, including:

- Forgetting to create the scanout resource on import [1] [2], causing
  bugs such as [3].
- Assuming the scanout resource always exists [4].
- Returning a GEM handle valid for the driver's internal DRM FD, but
  invalid for the caller's DRM FD [5].
- Not implementing resource_get_param, breaking stride/offset/modifier
  queries when no scanout resource is available [6] [7].

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Daniel Stone <daniels@collabora.com>

[1]: 4aac98f8a6
[2]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12018
[3]: https://github.com/swaywm/wlroots/issues/2795
[4]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12081
[5]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12074
[6]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12362
[7]: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12370

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12418>
2021-12-20 12:42:03 +01:00
Emma Anholt 3ffd6f3fa6 nir_to_tgsi: Set the TGSI Precise flag for exact ALU instructions.
This flag is used by the nv50, r600, and svga backends for instruction
exactness.  It was easier to plumb it in as an override in tgsi_ureg than
to make all of ALU instruction emit do it.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14201>
2021-12-15 21:58:04 +00:00
Juan A. Suarez Romero 18c039b2e1 tgsi-to-nir: initialize NIR_DEBUG envvar
This envvar is initialized when creating a NIR shader, but it needs to
be used before. So initialize it here.

v2 (Juan):
 - Use static variable for first initialization.

Fixes: f77ccdfb4a ("nir: add NIR_DEBUG envvar")
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14057>
2021-12-14 08:01:17 +00:00
Emma Anholt 5887768f48 nir_to_tgsi: Enable nir_opt_move.
This moves some ops down to when they're needed, generally reducing the
number of temps in use.  It's not always a win -- sometimes you can end up
moving a generator of a component used by a nir_op_vec down, which means
that op's sources stay live while the vec (whose register likely gets
coalesced with the ops creating it) is also live.  But it's generally
good.

softpipe results:

temps in affected programs: 18115 -> 18026 (-0.49%)
imm in affected programs: 19 -> 22 (15.79%)

r300 results:

instructions in affected programs: 174 -> 178 (2.30%)
vinst in affected programs: 156 -> 160 (2.56%)
sinst in affected programs: 54 -> 50 (-7.41%)
temps in affected programs: 2634 -> 2169 (-17.65%)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14096>
2021-12-09 22:15:53 +00:00
Emma Anholt 495a4cfbc3 nir_to_tgsi: Make !native_integers front face input match glsl_to_tgsi.
Avoids regression on r300, which has 0.0 vs 1.0 frontface despite what
tgsi.rst says.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14096>
2021-12-09 22:15:53 +00:00
Emma Anholt f1647525ab nir/nir_to_tgsi: Add support for "if" statements with !native_integers
Previously we've only used this on HW that had all ifs lowered.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14096>
2021-12-09 22:15:53 +00:00
Timothy Arceri f225e0679a util: add dri config option force_compat_shaders
This allows us to force all shaders to offer shader features only
provided to compatibility shaders.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14040>
2021-12-07 02:53:04 +00:00
Jan Zielinski e2de00876a gallium/swr: Remove common code and build options
This commit removes all OpenSWR references from common Mesa code
and build system.

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11264>
2021-12-06 23:37:50 +00:00
Juan A. Suarez Romero 38c953e287 gallium: add new PIPE_CAP_IMAGE_STORE_FORMATTED
This capability is enabled for drivers supporting formatless image
writing in shader.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>
2021-12-03 15:32:36 +00:00
Juan A. Suarez Romero fa1cd83fef gallium/util: add helper to clamp colors to valid range
v3 (Iago):
 - Fix comment.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>
2021-12-03 15:32:36 +00:00
Juan A. Suarez Romero f77ccdfb4a nir: add NIR_DEBUG envvar
Move all the NIR related debug environmental variables in a single
NIR_DEBUG one.

Use NIR_DEBUG=help to print all the available options.

v2:
 - Use a macro to simplify (Marcin, Jason)
 - Remove wrong changes (Marcin)

v3 (Marcin):
 - Remove rendundant NIR mentioning in option descriptions.
 - Unwrap option descriptions.
 - Ensure the constant is unsigned.
 - Use extern array to remove switch.

v4:
 - Add missing kernel shader (Jason).
 - Add unlikely() (Marcin).

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13840>
2021-12-03 11:15:29 +00:00
Marius Hillenbrand a46d155329 util/cpu_detect, gallium: use cpu_family CPU_S390X instead of separate flag
to also get rid of the additional function that I introduced before.

Fixes: 82b261417e ("util/cpu_detect: Add flag for IBM Z (s390x)")

Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13958>
2021-11-25 12:57:20 +00:00
Marek Olšák 6c78ec4eac mesa: add allow_glsl_compat_shaders for shader-db
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13870>
2021-11-24 10:28:15 +00:00
Marius Hillenbrand c5d6e57e42 llvmpipe: Use lp_build_round_arch on IBM Z (s390x)
LLVM has all the required intrinsics available on IBM Z, so use them for
rounding operations (they will be implemented as a single instruction).
This change makes the test case lp_test_arit pass, because it avoids
using the buggy generic code.

v2: update .gitlab-ci/cross-xfail-s390x to reflect passing lp_test_arit

Signed-off-by: Marius Hillenbrand <mhillen@linux.ibm.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13927>
2021-11-23 17:49:02 +00:00
Mike Blumenkrantz da9acf7088 aux/pb: add a new slab alloc function for reclaiming all bo objects
sometimes a driver might want to always reclaim all bo objects in the course
of allocating a new bo. this is useful when it's known that a given memory
heap is very small and will likely need to keep its usage minimized

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13850>
2021-11-18 21:22:30 +00:00
Mike Blumenkrantz c9a47c85da gallium: rename PIPE_CAP_PREFER_BLIT_BASED_TEXTURE_TRANSFER
this is now a bitfield enum for more functionality

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11984>
2021-11-18 07:58:29 -05:00
Marek Olšák 83278b5661 glx: add a workaround to glXDestroyWindow for Viewperf2020/Sw
This fixes:
    X Error of failed request:  GLXBadWindow
      Major opcode of failed request:  152 (GLX)
      Minor opcode of failed request:  32 (X_GLXDestroyWindow)
      Serial number of failed request:  9667
      Current serial number in output stream:  9674

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13611>
2021-11-17 21:26:54 +00:00
Pavel Asyutchenko b1de61dd38 llvmpipe: fix wrong assumption on FB fetch shader opacity
In certain cases variant->opaque could be set to true, which
reset command list for tiles fully covered by a triangle
with this shader. This is obviously wrong in presence of
framebuffer fetch.

Signed-off-by: Pavel Asyutchenko <sventeam@yandex.ru>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13252>
2021-11-17 04:08:54 +00:00
Mike Blumenkrantz 97ba2f2fd4 move util/indices to core util
these are useful tools to have outside of gallium

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13741>
2021-11-16 14:12:03 +00:00
Alejandro Piñeiro fef9ef48dd gallium/u_blitter: clean up texcoords ZW when filling up just XY
To avoid a scenario like this:
  * One blit needed the four components => XYZW filled up with 4 values
  * Following blit needing two components => ZW uses the previous values

We detected this using the v3d driver with the
arb_framebuffer_srgb-blit test, specifically:

  ./bin/arb_framebuffer_srgb-blit texture linear_to_srgb msaa enabled render -auto -fbo

The main linear to srgb with msaa (not doing the resolve yet) blit
requires the four components.

At the end (after a resolve copy), the test uses glReadPixels, and
internally it uses the blitter with two components, but the shader
still uses lod on the texel fetch, so it gets the one used for the
main blit, when it should be zero.

Right now v3d works fine even with that wrong value, and I assume that
any other driver too. But we can't ensure that would keep happening on
the future, so let's use correct values.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13753>
2021-11-16 10:17:18 +01:00
Vasily Khoruzhick 3bb192a15b gallium: add PIPE_CAP_PREFER_POT_ALIGNED_VARYINGS
Driver should enable this cap if it prefers varyings to be aligned
to power of two in a slot, i.e. vec4 in .xyzw, vec3 in .xyz, vec2 in .xy
or .zw

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13151>
2021-11-15 22:52:55 +00:00
Dave Airlie 4b27ebee7f util/vl: move gallium vl_vlc.h and vl_rbsp.h to shared code.
For vulkan video I need these to parse slice headers, so move
them somewhere easier to get at them.

drops pointer_to_uintptr in favour of a cast.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13768>
2021-11-15 21:57:28 +00:00
Mike Blumenkrantz 34c5ba8850 aux/primconvert: support pipe_context::draw_vertex_state
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13742>
2021-11-12 02:43:14 +00:00
Mike Blumenkrantz e1948c9a71 aux/primconvert: break out primconvert internals into util function
this should (ideally) be no functional changes

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13742>
2021-11-12 02:43:14 +00:00
Jesse Natalie 00016b4251 u_threaded_context: Support including from C++
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed By: Bill Kristiansen <billkris@microsoft.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13670>
2021-11-09 00:44:52 +00:00
Mike Blumenkrantz c4d904101c aux/trace: add pipe_context::render_condition_mem
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13582>
2021-11-05 14:37:25 -04:00
Mike Blumenkrantz f579401099 aux/trace: fix vertex state tracing
Fixes: e8cad57aa7 ("gallium/trace: add pipe_vertex_state support")

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13582>
2021-11-05 14:37:25 -04:00
Mike Blumenkrantz 810305fbed aux/trace: trace pipe_screen::is_format_supported better
storage_sample_count is important

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13582>
2021-11-05 14:37:25 -04:00
Mike Blumenkrantz d2f3aba5f0 aux/trace: support pipe_context::get_query_result_resource
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13582>
2021-11-05 14:37:24 -04:00
Mike Blumenkrantz 58ba18474b aux/trace: fix PIPE_QUERY_PIPELINE_STATISTICS_SINGLE tracing
don't just crash, dump!

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13582>
2021-11-05 14:36:54 -04:00
Mike Blumenkrantz 833c0394e0 Revert "gallium/u_blitter: work around broken sample shading in llvmpipe and zink"
This reverts commit 8b287c3f92.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13679>
2021-11-05 02:36:32 +00:00
Mike Blumenkrantz 60a8d68285 gallivm: handle TGSI SampleId sysval
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13679>
2021-11-05 02:36:32 +00:00
Jesse Natalie b34fed64fa u_prim_restart: Fix index scanning with start offset
Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13681>
2021-11-04 20:39:25 +00:00
Mike Blumenkrantz bc345281ab aux/primconvert: handle singular incomplete restarts
if no restart indices are found, this draw must be discarded to avoid
crashing later on

Fixes: 583070748c ("util/primconvert: handle rewriting of prim-restart draws with unsupported primtype")

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13630>
2021-11-04 20:12:32 +00:00
Marek Olšák 8b287c3f92 gallium/u_blitter: work around broken sample shading in llvmpipe and zink
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13602>
2021-11-04 15:06:09 +00:00
Marek Olšák eb34716c1f gallium/u_blitter: do MSAA copies in 1 pass using sample shading
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13602>
2021-11-04 15:06:09 +00:00
Marek Olšák 6d483fed85 gallium/u_blitter: disable sample shading for all blits
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13602>
2021-11-04 15:06:09 +00:00
Marek Olšák 7ce3f8e639 gallium/util: fix util_can_blit_via_copy_region with unbound render condition
It returned false when a render condition was not bound, but it should
have returned true.

The bool stuff is random and incomplete, but that's life.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13602>
2021-11-04 15:06:09 +00:00
Pierre-Eric Pelloux-Prayer f5dc334b6d drirc: add mesa_extension_override option
This allows specific per-application override.
The existing MESA_EXTENSION_OVERRIDE env variable is kept.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13364>
2021-11-04 14:16:55 +00:00
Pierre-Eric Pelloux-Prayer cd6e9ad36a llvmpipe: add missing NIR alu-op handling
nir_op_bcsel implemented based on ac_nir_to_llvm.c emit_bcsel function.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13246>
2021-11-04 13:59:00 +01:00
Pierre-Eric Pelloux-Prayer fc3ef76eec glx/drirc: add a force_direct_glx_context option
Some applications may request an indirect context but this feature is
disabled by default on Xorg and thus context creation will fail.

This commit adds a drirc setting to force the creation of direct glx
context, regardless of what the app is requesting.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13246>
2021-11-04 13:59:00 +01:00
Marek Olšák 69ee132b86 cso: add missing parameters into cso_set_vertex_buffers
they will be used later

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13512>
2021-11-03 23:22:31 +00:00
Mike Blumenkrantz 8297d243fb gallium: add PIPE_CAP_VERTEX_ATTRIB_ELEMENT_ALIGNED_ONLY
vulkan requires that vertex attribute access be aligned to the size of
a component for the attribute, but GL has no such requirements

the existing alignment caps are unnecessarily restrictive for applying
this limitation, so this cap now pre-calculates the masks for elements
and vertex buffers in vbuf to enable rewriting misaligned buffers

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13556>
2021-11-03 20:03:55 +00:00
Pierre-Eric Pelloux-Prayer 95ded68984 glsl/drirc: add an option for gl_ClipVertex / gl_CullDistance checks
The GLSL spec says it's an error if a shader statically writes to these
2 variables.

Until this commit, Mesa refused to link a shader if it had an unused
function writing to one of these variables while another (used) function
wrote to the other.

This commit adds an option to perform dead function elimination after
the intra-stage linking step but before performing these checks.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12897>
2021-10-28 18:01:04 +00:00
Marek Olšák c14d755f3d glthread: add an option to make glCheckFramebufferStatus a no-op
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13403>
2021-10-27 01:24:03 +00:00
Emma Anholt 8ccf672fa3 gallium/u_blitter: Read MSAA z/s from sampler's .x instead of .y or .z.
u_format defines depth formats as having depth in .x, mesa/st samples for
depth or stencil in .x (not making use of any other channels).
util_make_fs_blit_zs() looks for depth or stencil in .x.  The MSAA path
was the exception looking for it in .z or .y, which was causing drivers to
need to splat their values out to the other channels.  This should be
better on hardware that can emit shorter messages for sampling just the
first channels.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13446>
2021-10-22 18:31:20 +00:00
Marek Olšák 3df9d8ed80 gallium/u_threaded: implement pipelined partial buffer uploads using CPU storage
This removes resource_copy_region for BufferSubData. Drivers have to opt in
to use this.

See the comment in the header file.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13399>
2021-10-19 13:12:37 +00:00
Dave Airlie 37d6ce4ebb llvmpipe: swizzle image stores for CL BGRA
OpenCL requires image stores to BGRA to work, so add the swizzle
code here.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13404>
2021-10-19 03:11:08 +00:00
Marek Olšák 8a42ea69a6 gallium/util: add some extern "C" guards
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13285>
2021-10-16 10:41:51 +00:00
Jason Ekstrand 3c398139e1 lavapipe: Allow for texture types
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13389>
2021-10-16 05:49:34 +00:00
Jason Ekstrand 956199e870 nir: s/nir_var_mem_image/nir_var_image/g
We typically use nir_var_mem_* for stuff that has an explicit byte-based
memory layout.  Images are opaque.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13386>
2021-10-16 03:47:10 +00:00
Mike Blumenkrantz fe2674dd52 aux/pb: more correctly check number of reclaims
the increment needs to happen before the comparison here

Fixes: 3d6c8829f5 ("aux/pb: add a tolerance for reclaim failure")

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13388>
2021-10-15 23:36:48 +00:00
Mike Blumenkrantz 3d6c8829f5 aux/pb: add a tolerance for reclaim failure
originally, a slab attempts to reclaim a single bo. there are two outcomes
to this which can occur:
* the bo is reclaimed
* the bo is not reclaimed

if the bo is reclaimed, great.

if the bo is not reclaimed, it remains at the head of the list until it can
be reclaimed. this means that any bo with a "long" work queue which makes it
into a slab will effectively kill the entire slab. in a benchmarking scenario,
this can occur in rapid succession, and every slab will get 1-2 suballocations
before it reaches a bo that blocks long enough for a new slab to be needed.

the inevitable result of this scenario is that all memory is depleted almost instantly,
all because pb assumes that if the first bo in the reclaim list isn't ready, none of them
can be ready

for drivers like radeonsi, this happens to be a fine assumption

for drivers like zink, this is entirely not workable and explodes the gpu

Cc: mesa-stable

Reviewed-by: Witold Baryluk <witold.baryluk@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Tested-by: Witold Baryluk <witold.baryluk@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13345>
2021-10-15 17:46:51 +00:00
Jason Ekstrand 9f51fda92c ttn: Use nir_var_mem_image
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4743>
2021-10-15 14:58:56 +00:00
Jason Ekstrand d84fd86af1 ntt: Separate image and sampler handling
Use nir_foreach_image_variable for images so we survive the coming
refactor where they get their own mode.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4743>
2021-10-15 14:58:56 +00:00
Adam Jackson ea038747df dri: Remove the allow_fp16_configs option, always allow them
There's no danger of accidentally using these, the default pixel format
is integer and if you want float you need to have explicitly asked for
it in eglChooseConfig.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13182>
2021-10-13 16:36:27 +00:00
Marek Olšák 8c6e18bc51 util,gallium: put count in pipe_resource & sampler_view on its own cache line
This adds 60 bytes to both structures. It eliminates "False Sharing"
for atomic operations (see wikipedia).

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11618>
2021-10-13 03:26:20 +00:00
Marek Olšák 1fe24983e7 gallium/u_threaded: fix draw_vertex_state with multi draws
It caused an assertion failure in debug builds and a GPU hang in release
builds.

Fixes: 0842488859 - gallium/u_threaded: implement draw_vertex_state
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5457

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13235>
2021-10-08 02:31:30 +00:00
Rob Clark 1c1c43fbab gallium/u_threaded: Split out options struct
Rather than having an ever increasing list of parameters to
threaded_context_create(), split out a struct for optional
flags and parameters.  This should reduce churn in adding
new options.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13207>
2021-10-07 17:32:25 +00:00
Emma Anholt 4e3e149ffd nir_to_tgsi: Force the TXQ LOD argument to be scalar.
Otherwise, older virglrenderer fails all the texturesize tests.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
2021-10-06 03:44:17 +00:00
Emma Anholt 469f0345ac nir_to_tgsi: Add a workaround for virgl UBO array dynamic indexing.
virgl makes one array of UBOs starting from the first non-CB0 UBO used,
and does dynamic indexing off of that.  It requires that the dynamic
indexing be CONST[ADDR[0]+base], rather than having the base be loaded in
addr0.

If we had a nir_intrinsic_base() on load_ubo, this would be easy.  As we
don't, emit a subtract at address deref time.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
2021-10-06 03:44:17 +00:00
Emma Anholt a292268cd5 nir_to_tgsi: Sort FS output declarations to avoid virglrenderer bugs.
The TGSI debug output is a lot more readable if it's in location order,
anyway.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
2021-10-06 03:44:17 +00:00
Emma Anholt 7dde279db5 nir-to-tgsi: Avoid emitting TXL just for lod 0 on non-vertex shaders.
Prompted by comparing virgl fails and finding that it has issues with
immediate args to TXL/TXB, at least.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
2021-10-06 03:44:17 +00:00
Emma Anholt c3c560089e nir_to_tgsi: Turn GS PRIMID into an input instead of a sysval.
While TGSI can represent it either way, virgl and r600 at least demand an
input.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
2021-10-06 03:44:17 +00:00
Emma Anholt 91a5a18dbf nir_to_tgsi: Add support for nir_intrinsic_load_barycentric_at_sample.
It doesn't have to be a constant sample, so we need to store it at load
time and use the load's dest at interpolate_at time.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
2021-10-06 03:44:17 +00:00
Emma Anholt 15aabcd806 nir_to_tgsi: Add support for load_barycentric_sample.
This is used for var->data.sample inputs, which are already declared to be
TGSI_INTERPOLATE_LOC_SAMPLE, so we can just use the interpolated inputs.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
2021-10-06 03:44:17 +00:00
Emma Anholt 80c007a4dd nir_to_tgsi: Add support for declaring image arrays.
Required for virgl.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
2021-10-06 03:44:17 +00:00
Emma Anholt 8d6f738007 gallium/ureg: Sort the input decls, too.
Just like outputs, virglrenderer needs its inputs sorted.  Should be
harmless for other TGSI producers, and makes the declarations more
readable.

Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
2021-10-06 03:44:17 +00:00
Emma Anholt 441643b105 nir_to_tgsi: Add support for load_output/load_per_vertex_output.
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
2021-10-06 03:44:17 +00:00
Emma Anholt 96cf3b3595 nir_to_tgsi: Include txf_ms's sample index.
Acked-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12800>
2021-10-06 03:44:17 +00:00
Marek Olšák 826e03e6e5 gallium/pb_slab: use simple_mtx_t
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13152>
2021-10-05 23:46:14 +00:00
Marek Olšák 5a5637d6ae gallium/pb_cache: use simple_mtx_t
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13152>
2021-10-05 23:46:14 +00:00
Dave Airlie 1d48022dab gallivm/format: clamp SINT conversion rather than truncate.
KHR-GL32.packed_pixels.pbo_rectangle.r16i on zink on lavapipe
ends up using a pbo that does an SINT image write. This was producing
truncated rather than clamped values.

Fix the calculations for 8/16-bit signed ints to clamp not truncate.

Fixes: 13e5f331db ("gallivm/nir: fix image store conversions")

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13187>
2021-10-05 23:11:57 +00:00
Pavel Asyutchenko 7ffb152276 llvmpipe: fix crash when doing FB fetch + gl_FragDepth write in one shader
Reproducible by piglit test from this MR:
https://gitlab.freedesktop.org/mesa/piglit/-/merge_requests/576

Signed-off-by: Pavel Asyutchenko <sventeam@yandex.ru>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12705>
2021-10-05 20:45:38 +00:00
Rob Clark 75808934f8 gallium/u_threaded: Get reset status without sync
GPU hangs are asynchronous already, there should not be an expectation
that this is synchronized with driver thread.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Mike Blumenkrantz <michael.blumenkrantz@gmail.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13163>
2021-10-04 19:45:28 +00:00
Marek Olšák 7a2458f4bd gallium/util: add util_vertex_state_cache for deduplicating the states
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13050>
2021-10-01 14:51:23 +00:00
Marek Olšák e8cad57aa7 gallium/trace: add pipe_vertex_state support
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13050>
2021-10-01 14:51:23 +00:00
Marek Olšák 0842488859 gallium/u_threaded: implement draw_vertex_state
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13050>
2021-10-01 14:51:23 +00:00
Marek Olšák 1c66de3239 gallium: add pipe_vertex_state and draw_vertex_state for display lists
The main motivation is to improve the score of viewperf13/snx.

This new interface is designed to be optimal for display lists as implemented
by the vbo module. It has much lower CPU overhead in the frontend, threaded
context, and the driver.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13050>
2021-10-01 14:51:23 +00:00
Marek Olšák d5218f0889 gallium/util: make pipe_vertex_buffer_reference safe for hashing dst
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13050>
2021-10-01 14:51:23 +00:00
Marek Olšák 6e69acad82 util: import u_debug_refcnt, u_hash_table, u_debug_describe from gallium
to allow pipe_*_reference to be called in src/mesa/vbo.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13050>
2021-10-01 14:51:23 +00:00
Vadym Shovkoplias 36c241be01 driconf, glsl: Add a vs_position_always_precise option
This is basically the same workaround as in 9b577f2a88 (driconf, glsl: Add a
vs_position_always_invariant option) commit but for tesselation evaluation
shaders. Some applications do not mark outputs as precise in tesselation
evaluation shaders which can lead to different results in case some
optimizations were applied.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Vadym Shovkoplias <vadym.shovkoplias@globallogic.com>
Fixes: 09705747d7 ("nir/algebraic: Reassociate fadd into fmul in DPH-like pattern")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13027>
2021-09-30 10:46:39 +00:00
Dave Airlie b9aee98912 gallivm: use pmulhrsw to make aos sampling more accurate.
This uses pmulhrsw avx2 and ssse3 variants. It fixes the
precision of texture filtering calculations.

However it does leave these paths inaccurate on platforms
that don't support it.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13075>
2021-09-29 21:55:23 +00:00
Pierre-Eric Pelloux-Prayer e67083caf4 gallium: add PIPE_CAP_PREFER_BACK_BUFFER_REUSE
This will be used in the next commit.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12788>
2021-09-29 08:14:57 +00:00
Dave Airlie 6f6f7d2680 gallivm/nir: fix subgroup invocation read.
Again if you get passed an invoc but the exec mask has the
active lane somewhere other than at 0, then if we have an
invoc we should find the active lane and extract the value
from invoc rather than using the idx.

This fixes a bunch of VK 1.2 subgroup tests once 1.2 is enabled:
dEQP-VK.subgroups.ballot_broadcast.compute.subgroupbroadcast_nonconst*

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12953>
2021-09-27 16:35:45 +10:00
Emma Anholt ae01d856de nir_to_tgsi: Remove the abs on fcsel's bool src.
While the nir fcsel opcode specifies src0 != 0.0, as the comment says,
it's only ever used on bools-as-floats, so we know that src0 is
non-negative.  This saves an instruction per CMP on i915.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12921>
2021-09-20 20:20:54 +00:00
Mike Blumenkrantz 5eb59a03ec util/tc: rename tc_replace_buffer_storage_func::num_rebinds and document
this parameter is only a hint, as tc provides no method for tracking cases
when a buffer is bound multiple times to the same site (e.g., multiple vertex
buffer slots will be counted as 1 bind), so rename to "minimum" to be more clear

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12898>
2021-09-17 12:32:29 +00:00
Neha Bhende f2b08decf7 auxiliary/indices: convert primitive type PIPE_PRIM_PATCHES
Few tessellation related piglit test are crashing. This patch
fixes unhandled case

Tested with piglit

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
(cherry picked from commit 0e1c962cc105a9330caf22266e1962b049c13454)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12882>
2021-09-16 21:45:43 +00:00
Dave Airlie 143167f2a0 gallivm/nir: handle subgroup reduction across all types
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie f814a2449e llvmpipe: enable FP16 and update CL + traces piglit results.
The fails will be addressed later.

This adds a fail in GLSL compiler that is due to a workaround
that fails when fp16 constants are lowered

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie 0d3b285360 gallivm: use llvm intrinsics for 16-bit round/trunc/roundeven
Otherwise the inf translations don't seem to work, and the VK CTS
fails

Fixes VK CTS dEQP-VK.spirv_assembly.instruction.graphics.float16.arithmetic*

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie 2277386565 gallivm: increase tgsi nesting call stack size
Some VK CTS tests are topping this out around 76, increase it to 80 for now.

Fixes:
dEQP-VK.spirv_assembly.instruction.graphics.float16.opvectorshuffle.*44*

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie c118888f92 gallivm/nir: pass the correct float builder to ddx/y
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie bceae73b3f gallivm/nir: call pow with correct flt builder
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie 836b0ace10 gallivm/nir: handle 16-bit exp/lod using intrinsics.
This just passes the 16-bit float versions to the llvm intrinsics

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie 6decb1b896 gallivm: add 16-bit sin/cos via llvm intrinsic
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie af49f9697a gallivvm/nir: handle non-32bit mask scatter stores
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie 0d4f17fe1f gallivm/nir: fix f2b32
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie 0776628d1d gallivm/nir: handle conversion to 16-bit texel fetch
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie c396067366 gallivm: add initial support for 16-bit float builder.
This is an initial patch that is needed for OpenCL and Vulkan
support for proper 16-bit floats.

This doesn't enable the cap bit yet

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11816>
2021-09-16 04:15:41 +00:00
Dave Airlie 259e26e5e3 llvmpipe/cs: rework coroutine context handling (v2)
Get comfy.

llvmpipe coroutines have a stack frame. This is created by hooking
in malloc and coro.alloc and coro.size intrinsics.

LLVM has an CoroElide pass that is meant to allow that stack frame
to be done as an alloca in the caller instead of using the malloc path.

The CoroElide pass relies on the coroutine being inlined (fixed that).

The CoroElide pass relies on there being a direct connect between
coro.destroy(i8 *arg) and arg = coro.begin(id). However due to the
way the compute shaders are launched, there is no way to ensure that
link. Fixing the CoroElide pass seems quite difficult, I considered
having a force CoroElide always flag to make it dtrt, however I'm not
sure how ugly that would end up.

My first attempt tried to preallocate the stacks at a fixed size,
this turned out to be naive as the stack frame size was not sized
like I expected. Instead the first coro to run allocs enough for
everyone, so avoid the massive amounts of small allocations.

This remove coro malloc from a lot of profiles and shaves another 30s
or so from OpenCL ./conversions/test_conversions uchar_uin
(from 4.40m to just under 4m on my ryzen 7 1800x)

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12432>
2021-09-16 13:21:34 +10:00
Dave Airlie 4ccee031e9 gallivm/coro: use a phi instead of alloca
this just matches what the docs recommend

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12432>
2021-09-16 13:21:27 +10:00
Dave Airlie fc0bf57632 gallivm/ssbo: cast ssbo index to int type.
Since these can be loaded from ubos or other places now.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12689>
2021-09-16 08:05:56 +10:00
Dave Airlie 1ccac4abff gallivm/ssbo: fix up dynamic indexed ssbo load/stores/atomics
Although the index has to be dynamically uniform, if we don't ever
execute a few lanes then we'll have 0, so it important to read the
ssbo index from the first active lane.

Just loop over them all.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12689>
2021-09-16 08:05:51 +10:00
Emma Anholt 879a569884 nir: Switch from ralloc to malloc for NIR instructions.
By replacing the 48-byte ralloc header with our exec_node gc_node (16
bytes), runtime of shader-db on my system across this series drops
-4.21738% +/- 1.47757% (n=5).

Inspired by discussion on #5034.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11776>
2021-09-14 17:53:06 +00:00
Marek Olšák 921c770d49 driconf: remove leftover code for allow_incorrect_primitive_id
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12809>
2021-09-13 22:23:27 +00:00
Emma Anholt 91dc863921 mesa: Move the advanced blend bitmask to shader_info.
For drivers that don't lower advanced blend to FBFETCH, we need the
bitmask to be in the NIR shader so that it gets carried over to TGSI
successfully.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12813>
2021-09-13 18:36:58 +00:00
Danylo Piliaiev 4092d5f0d8 u_trace: pass command stream through tracing functions
Allows writing timestamps into different command streams.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10969>
2021-09-10 14:58:28 +03:00
Danylo Piliaiev cefaa73909 util/u_trace: auto-generation of serialization funcs for tracepoints
Add ability to auto-generate:
- printing of args for "GPU_TRACE=1", still could be overriden with
  tp_print.
- population of extra data for perfetto event.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10969>
2021-09-10 14:58:28 +03:00
Danylo Piliaiev e14f525280 util/u_trace: make u_trace usable for other than gallium drivers
With little modifications u_trace could be usable for Vulkan drivers.

Beside removing dependencies on gallium, the other notable change is
the passing of opaque flush_data pointer via u_trace_flush. There
is data which becomes available only at this point which other drivers
may want to pass.

For example Vulkan drivers would want to pass at least submission id
(for perfetto) and a sync object to wait on in u_trace_read_ts.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10969>
2021-09-10 14:58:28 +03:00
Emma Anholt db930bd91b nir_to_tgsi: Allow SSA defs to include swizzles, abs, and neg.
This will let some copy prop happen automatically, avoiding MOVs to temps.
Most importantly, though, it means that virgl won't see (unused channel)
swizzles from channels beyond the bounds of sysvals, which trigger shader
compile failures on the host.

softpipe shader-db:

total instructions in shared programs: 2946336 -> 2934777 (-0.39%)
instructions in affected programs: 374676 -> 363117 (-3.09%)
total temps in shared programs: 565552 -> 564139 (-0.25%)
temps in affected programs: 18138 -> 16725 (-7.79%)

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12781>
2021-09-09 22:02:52 +00:00
Emma Anholt bd8de16803 nir_to_tgsi: Switch ssa_temp[] to be a ureg_src.
After ntt_store_def(), all uses want it to be a ureg_src.  This will let
us fold abs/neg/swizzles in.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12781>
2021-09-09 22:02:52 +00:00
Emma Anholt ed1fb1f03b nir_to_tgsi: Clean up some unnecessary pointers-to-uregs.
This was used at one point to do ntt_store_def() or something I think.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12781>
2021-09-09 22:02:52 +00:00
Emma Anholt d24893e735 nir_to_tgsi: Add support for memory_barrier_tcs_patch.
glsl_to_tgsi translated both cases of ir_barrier to TGSI's BARRIER, so map
both of glsl_to_nir's ir_barrier outputs to the same.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12781>
2021-09-09 22:02:52 +00:00
Emma Anholt 4a4a889de3 nir_to_tgsi: Don't forget to add sampler views with our samplers.
While softpipe and i915 didn't really care, virgl very much does.
tgsi_scan also insisted that the texture ops and the decls matched, which
led to deduplicating the switch statemnts.

Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12781>
2021-09-09 22:02:52 +00:00