platform/upstream/mesa.git
20 months agoasahi: Flush USC caches on the first draw
Asahi Lina [Wed, 22 Feb 2023 11:16:01 +0000 (20:16 +0900)]
asahi: Flush USC caches on the first draw

It seems that when batches are submitted back to back, the USC can
retain cache contents between them. This causes a problem when the CPU
updates a VBO between batches, since some of those updates might not be
visible to the USC.

Looks like the VDM barrier command with one magic bit set fixes this, so
let's try that.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21538>

20 months agoasahi: Identify USC cache invalidate
Asahi Lina [Wed, 22 Feb 2023 11:15:12 +0000 (20:15 +0900)]
asahi: Identify USC cache invalidate

Signed-off-by: Asahi Lina <lina@asahilina.net>
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21538>

20 months agoasahi: Add readonly BO flag
Asahi Lina [Sat, 25 Feb 2023 17:16:00 +0000 (12:16 -0500)]
asahi: Add readonly BO flag

Signed-off-by: Asahi Lina <lina@asahilina.net>
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21538>

20 months agoasahi: Add BO_SHAREABLE flag
Asahi Lina [Sat, 25 Feb 2023 16:49:20 +0000 (11:49 -0500)]
asahi: Add BO_SHAREABLE flag

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21538>

20 months agoanv: remove more Gfx7 code
Lionel Landwerlin [Fri, 16 Dec 2022 11:07:28 +0000 (13:07 +0200)]
anv: remove more Gfx7 code

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21599>

20 months agoiris: fix Wa_16011107343 for Gfx12
Lionel Landwerlin [Tue, 28 Feb 2023 19:05:03 +0000 (21:05 +0200)]
iris: fix Wa_16011107343 for Gfx12

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: df9f71d79574 ("iris: emit 3DSTATE_HS for each primitive on gfx12")
Acked-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21605>

20 months agoanv: fixup Wa_16011107343 for Gfx12 only
Lionel Landwerlin [Tue, 28 Feb 2023 19:03:07 +0000 (21:03 +0200)]
anv: fixup Wa_16011107343 for Gfx12 only

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 75968398f37c ("anv: emit 3DSTATE_HS for each primitive on gfx12")
Acked-by: Ivan Briano <ivan.briano@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21605>

20 months agoci: Reuse MESA_CI_PERFORMANCE_ENABLED in performance-rules
Guilherme Gallo [Mon, 27 Feb 2023 11:29:47 +0000 (08:29 -0300)]
ci: Reuse MESA_CI_PERFORMANCE_ENABLED in performance-rules

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21492>

20 months agoci: Use workflow to make CI aware of performance jobs
Guilherme Gallo [Mon, 27 Feb 2023 02:05:59 +0000 (23:05 -0300)]
ci: Use workflow to make CI aware of performance jobs

With the workflow keyword, we can have more control over how pipelines
are created.

One of the features is to set a variable for the entire pipeline
depending on the rule. These variables would be available for all jobs
manifest and can be used inside job rules, for example.

We can use that to set a variable to enable performance jobs in the
pipeline, both at the YAML and script levels.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21492>

20 months agoci: Use release builds in perf jobs
Guilherme Gallo [Thu, 23 Feb 2023 14:05:46 +0000 (11:05 -0300)]
ci: Use release builds in perf jobs

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21492>

20 months agoci: Create debian-arm64-release job
Guilherme Gallo [Thu, 23 Feb 2023 13:46:29 +0000 (10:46 -0300)]
ci: Create debian-arm64-release job

To be able to upload the mesa's release build for arm64 to S3 and use it
in performance jobs.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21492>

20 months agoci: Upload debian-release artifact to S3
Guilherme Gallo [Thu, 23 Feb 2023 13:43:30 +0000 (10:43 -0300)]
ci: Upload debian-release artifact to S3

This will enable performance jobs to use release versions for
performance tracking, since they download the artifacts from S3.

We were using debugoptimized versions, which are not the most performant
ones.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21492>

20 months agollvmpipe: fix compute address bits to return native pointer size.
Dave Airlie [Tue, 28 Feb 2023 18:17:22 +0000 (04:17 +1000)]
llvmpipe: fix compute address bits to return native pointer size.

On 32-bit systems llvm will only be dealing with 32-bit ptrs

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

20 months agopvr: Don't update fragment signal sync when fragment stage is disabled
Jarred Davies [Wed, 25 Jan 2023 20:14:40 +0000 (20:14 +0000)]
pvr: Don't update fragment signal sync when fragment stage is disabled

Signed-off-by: Jarred Davies <jarred.davies@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21577>

20 months agopvr: Clear wait syncs after job submission
Jarred Davies [Wed, 25 Jan 2023 20:02:39 +0000 (20:02 +0000)]
pvr: Clear wait syncs after job submission

Avoids the fw having to process redundant waits.

Signed-off-by: Jarred Davies <jarred.davies@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21577>

20 months agopvr: Enable threaded submit when supported
Jarred Davies [Tue, 31 Jan 2023 07:18:59 +0000 (07:18 +0000)]
pvr: Enable threaded submit when supported

Adds a winsys feature flag to enable threaded submit.

Currently pvrsrvkm can't support threaded submit as pvrsrvkm syncs don't
support VK_SYNC_FEATURE_WAIT_PENDING.

Signed-off-by: Jarred Davies <jarred.davies@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21577>

20 months agopvr: Add support for VK_KHR_timeline_semaphore
Jarred Davies [Tue, 31 Jan 2023 08:06:25 +0000 (08:06 +0000)]
pvr: Add support for VK_KHR_timeline_semaphore

pvrsrvkm will run with VK_DEVICE_TIMELINE_MODE_EMULATED and
powervr will run with VK_DEVICE_TIMELINE_MODE_ASSISTED.

Signed-off-by: Jarred Davies <jarred.davies@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21577>

20 months agopvr: Use common queue submit implementation
Jarred Davies [Tue, 17 Jan 2023 21:43:42 +0000 (21:43 +0000)]
pvr: Use common queue submit implementation

A simplification of the synchronization code is also undertaken as part
of this commit to account for the implicit guarantee the FW gives the driver
that jobs submitted to the same context will be run in submission order.

Signed-off-by: Jarred Davies <jarred.davies@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21577>

20 months agoradv: Only init geometry infos if RRA is enabled
Konstantin Seurer [Sat, 25 Feb 2023 15:36:41 +0000 (16:36 +0100)]
radv: Only init geometry infos if RRA is enabled

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

20 months agoradv: Move header and geometry info init into separate functions
Konstantin Seurer [Sat, 25 Feb 2023 15:32:15 +0000 (16:32 +0100)]
radv: Move header and geometry info init into separate functions

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

20 months agoanv: halve the push constants space in mesh pipelines
Marcin Ślusarz [Mon, 27 Feb 2023 15:33:46 +0000 (16:33 +0100)]
anv: halve the push constants space in mesh pipelines

It's only used by fragment shaders, so halving it matches the size
used in the most optimal primitive pipeline (VS + FS).

This change frees some URB space for mesh and task shaders and as
a result improves vk_meshlet_cadscene performance by up to 2%,
depending on the model.

Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21559>

20 months agoiris: consider bufmgr creation to have failed if `dup`ing of the fd fails
Dylan Baker [Mon, 27 Feb 2023 18:55:25 +0000 (10:55 -0800)]
iris: consider bufmgr creation to have failed if `dup`ing of the fd fails

Coverity points out that we can pass a negative value to `close()`,
which results in an unchecked error. While this is technically true, it
really isn't a problem as `close()` is speced to return -1 in that case
(which we ignore). However, what is true is that if we fail to dup the
fd (the only case where we could end up with a negative value), then
we're in an unrecoverable error state anyway, and should go to the error
cleanup code.

CID: 1521539
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21568>

20 months agoci/freedreno: add flaking KHR-GL45.buffer_storage.map_persistent_flush
David Heidelberg [Tue, 28 Feb 2023 16:16:28 +0000 (17:16 +0100)]
ci/freedreno: add flaking KHR-GL45.buffer_storage.map_persistent_flush

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21598>

20 months agointel/vulkan: add missing dependency on generated headers
David Heidelberg [Tue, 28 Feb 2023 13:39:26 +0000 (14:39 +0100)]
intel/vulkan: add missing dependency on generated headers

Adding correct dependencies prevents occasional build flakes with parallel builds.

```
FAILED: src/intel/vulkan/libanv_common.a.p/anv_generated_indirect_draws.c.o
ccache cc -Isrc/intel/vulkan/libanv_common.a.p -Isrc/intel/vulkan -I../src/intel/vulkan -Iinclude -I../include -Isrc -I../src -Isrc/mapi -I../src/mapi -Isrc/mesa -I../src/mesa -I../src/gallium/include -Isrc/intel -I../src/intel -Isrc/compiler -I../src/compiler -Isrc/compiler/nir -I../src/compiler/nir -Isrc/vulkan/util -I../src/vulkan/util -Isrc/vulkan/runtime -I../src/vulkan/runtime -Isrc/vulkan/wsi -I../src/vulkan/wsi -Isrc/intel/genxml -Isrc/intel/vulkan/shaders -Isrc/intel/ds -I/usr/local/include -I/usr/local/include/libdrm -fvisibility=hidden -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -std=c11 -O2 -g -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="23.1.0-devel"' '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"' -DHAVE_OPENGL=1 -DHAVE_OPENGL_ES_1=1 -DHAVE_OPENGL_ES_2=1 -DHAVE_SWRAST -DHAVE_VIRGL -DHAVE_RADEONSI -DHAVE_ZINK -DHAVE_CROCUS -DHAVE_IRIS -DHAVE_I915 -DVIDEO_CODEC_VC1DEC=1 -DVIDEO_CODEC_H264DEC=1 -DVIDEO_CODEC_H264ENC=1 -DVIDEO_CODEC_H265DEC=1 -DVIDEO_CODEC_H265ENC=1 -DHAVE_X11_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DHAVE_DRM_PLATFORM -DHAVE_XCB_PLATFORM -DHAVE_ST_VDPAU -DENABLE_ST_OMX_BELLAGIO=0 -DENABLE_ST_OMX_TIZONIA=0 -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DALLOW_KCMP -DENABLE_SHADER_CACHE -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 -DHAVE_REALLOCARRAY -D_GNU_SOURCE -DUSE_SSE41 -DUSE_GCC_ATOMIC_BUILTINS -DUSE_X86_64_ASM -DMAJOR_IN_SYSMACROS -DHAS_SCHED_H -DHAS_SCHED_GETAFFINITY -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_SYS_SHM_H -DHAVE_CET_H -DHAVE_SYS_INOTIFY_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_TIMESPEC_GET -DHAVE_MEMFD_CREATE -DHAVE_RANDOM_R -DHAVE_FLOCK -DHAVE_STRTOK_R -DHAVE_GETRANDOM -DHAVE_GNU_QSORT_R -DHAVE_STRUCT_TIMESPEC -DHAVE_PROGRAM_INVOCATION_NAME -DHAVE_ISSIGNALING -DHAVE_POSIX_MEMALIGN -DHAVE_DIRENT_D_TYPE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DSUPPORT_INTEL_INTEGRATED_GPUS -DHAVE_ZLIB -DHAVE_COMPRESSION -DHAVE_PTHREAD -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LIBDRM -DLLVM_AVAILABLE '-DMESA_LLVM_VERSION_STRING="13.0.1"' -DLLVM_IS_SHARED=1 -DDRAW_LLVM_AVAILABLE -DUSE_LIBELF -DMESA_EXECMEM -DHAVE_LIBUNWIND -DHAVE_OPENMP -DHAVE_DRI -DHAVE_DRI2 -DHAVE_DRI3 -DHAVE_DRI3_MODIFIERS -DHAVE_DRISW_KMS -DHAVE_PERFETTO -mtls-dialect=gnu2 -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=return-type -Werror=empty-body -Werror=incompatible-pointer-types -Werror=int-conversion -Wimplicit-fallthrough -Wmisleading-indentation -Wno-missing-field-initializers -Wno-format-truncation -Wno-nonnull-compare -fno-math-errno -fno-trapping-math -fno-common -Wno-unused-function -Werror=format -Wformat-security -ffunction-sections -fdata-sections -fPIC -DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_XLIB_KHR -DVK_USE_PLATFORM_DISPLAY_KHR -DVK_USE_PLATFORM_XLIB_XRANDR_EXT -Wno-override-init -DANV_SUPPORT_RT=0 -MD -MQ src/intel/vulkan/libanv_common.a.p/anv_generated_indirect_draws.c.o -MF src/intel/vulkan/libanv_common.a.p/anv_generated_indirect_draws.c.o.d -o src/intel/vulkan/libanv_common.a.p/anv_generated_indirect_draws.c.o -c ../src/intel/vulkan/anv_generated_indirect_draws.c
../src/intel/vulkan/anv_generated_indirect_draws.c:34:10: fatal error: shaders/generated_draws_spv.h: No such file or directory
   34 | #include "shaders/generated_draws_spv.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
```

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21592>

20 months agoradv: fix draw calls with 0-sized index buffers and robustness on NAVI10
Samuel Pitoiset [Wed, 22 Feb 2023 16:56:03 +0000 (17:56 +0100)]
radv: fix draw calls with 0-sized index buffers and robustness on NAVI10

The correct workaround is to bind an internal index buffer to handle
robustness2 correctly.

Fixes dEQP-VK.robustness.index_access.* in CTS 1.3.5.0 on NAVI10.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21471>

20 months agopvr: replace nop binary shader with run-time compiled shader
Frank Binns [Thu, 23 Feb 2023 22:15:35 +0000 (22:15 +0000)]
pvr: replace nop binary shader with run-time compiled shader

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Matt Coster <matt.coster@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21536>

20 months agomeson: allow checking for null pointers even if they're supposed to be non-null
Eric Engestrom [Fri, 24 Feb 2023 11:23:02 +0000 (11:23 +0000)]
meson: allow checking for null pointers even if they're supposed to be non-null

    ../src/c11/impl/time.c: In function 'timespec_get':
    ../src/c11/impl/time.c:71:8: error: 'nonnull' argument 'ts' compared to NULL [-Werror=nonnull-compare]
       71 |     if (!ts)
          |        ^
    cc1: all warnings being treated as errors

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21558>

20 months agov3dv: Enable (leased) direct display extensions.
Mario Kleiner [Sat, 25 Feb 2023 10:44:34 +0000 (11:44 +0100)]
v3dv: Enable (leased) direct display extensions.

Enable support for the following extensions, which are already supported
by the driver and shared wsi code, and were just missing enables inside
v3dv_device:

VK_EXT_direct_mode_display, VK_EXT_acquire_drm_display,
VK_EXT_acquire_xlib_display.

Successfully tested on RPi 400, RaspberryPi OS 11, with X11 RandR output
leasing to lease a RandR output and use it for direct display mode.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21529>

20 months agopvr: initialise size for placeholder "zeroed" shaders
Frank Binns [Fri, 24 Feb 2023 22:28:18 +0000 (22:28 +0000)]
pvr: initialise size for placeholder "zeroed" shaders

Fixes an assert() in pvr_gpu_upload_usc().

Signed-off-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21537>

20 months agoglapi/meson: drop duplicate line in deps
Eric Engestrom [Mon, 27 Feb 2023 16:50:50 +0000 (16:50 +0000)]
glapi/meson: drop duplicate line in deps

Fixes: 0842bc879b34414de54b ("meson: wire the new generator for es1 and es2")
Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21562>

20 months agoradv: fix flushing non-coherent images in EndCommandBuffer()
Samuel Pitoiset [Mon, 27 Feb 2023 09:49:16 +0000 (10:49 +0100)]
radv: fix flushing non-coherent images in EndCommandBuffer()

The condition was inverted.

This doesn't fix anything known.

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21549>

20 months agoradv: fix flushing non-coherent images inside secondaries on GFX9+
Samuel Pitoiset [Mon, 27 Feb 2023 09:45:08 +0000 (10:45 +0100)]
radv: fix flushing non-coherent images inside secondaries on GFX9+

Fixes
dEQP-VK.draw.dynamic_rendering.complete_secondary_cmd_buff.multi_draw.mosaic.*
on VEGA10 (related to the use of HTILE).

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21549>

20 months agoglsl: align definition of _mesa_problem with the one in main/error.h
Eric Engestrom [Mon, 27 Feb 2023 15:24:36 +0000 (15:24 +0000)]
glsl: align definition of _mesa_problem with the one in main/error.h

The ctx pointer not used by that function anyway, so const'ing it makes
no difference.

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21557>

20 months agoutil: rzalloc and free hash_table_u64
Dylan Baker [Thu, 23 Feb 2023 17:50:33 +0000 (09:50 -0800)]
util: rzalloc and free hash_table_u64

Otherwise we're prone to leaking the table itself, since it's not freed
in the destroy function

CID: 1516552
fixes: 6649b840c34016b4753e69d4513a8d09da9febb2
       ("mesa/util: add a hash table wrapper which support 64-bit keys")

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21499>

20 months agoanv: emit 3DSTATE_HS for each primitive on gfx12
Tapani Pälli [Mon, 27 Feb 2023 11:19:26 +0000 (13:19 +0200)]
anv: emit 3DSTATE_HS for each primitive on gfx12

This is Wa_16011107343, same workaround as commit 880a3efe6c2
but for gfx12.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21551>

20 months agoiris: emit 3DSTATE_HS for each primitive on gfx12
Tapani Pälli [Mon, 27 Feb 2023 11:13:20 +0000 (13:13 +0200)]
iris: emit 3DSTATE_HS for each primitive on gfx12

This is Wa_16011107343, same workaround as commit a043ae8e249
but for gfx12.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21551>

20 months agoaco: only ls and ps use store output now
Qiang Yu [Mon, 26 Dec 2022 05:01:03 +0000 (13:01 +0800)]
aco: only ls and ps use store output now

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21435>

20 months agoac/llvm: only init outputs when fragment shader for radv
Qiang Yu [Mon, 26 Dec 2022 03:38:56 +0000 (11:38 +0800)]
ac/llvm: only init outputs when fragment shader for radv

LS pass output to TCS by reg is not enabled when LLVM.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21435>

20 months agoradeonsi: only init llvm output when needed.
Qiang Yu [Mon, 26 Dec 2022 02:03:59 +0000 (10:03 +0800)]
radeonsi: only init llvm output when needed.

These are the cases which still uses nir_store_output.

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

20 months agoglsl: Move lower_vector_insert to GLSL-to-NIR.
Emma Anholt [Wed, 22 Feb 2023 21:47:37 +0000 (13:47 -0800)]
glsl: Move lower_vector_insert to GLSL-to-NIR.

We already have a nir_builder equivalent for generating this code, just
use that instead of doing it in GLSL.

No change on r300 shader-db.

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

20 months agopanfrost/midgard: Drop redundant arg to emit_explicit_constant.
Emma Anholt [Mon, 27 Feb 2023 23:07:34 +0000 (15:07 -0800)]
panfrost/midgard: Drop redundant arg to emit_explicit_constant.

Every caller passed the same value twice.  Just reuse it?

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

20 months agopanfrost/midgard: Fix handling of csel with a vector constant condition.
Emma Anholt [Mon, 27 Feb 2023 22:24:07 +0000 (14:24 -0800)]
panfrost/midgard: Fix handling of csel with a vector constant condition.

If it's not all true or all false, then you'll have a csel with a vector
constant, and the backend failed to translate appropriately.  Expand the
constant to fix it.

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

20 months agovenus: fix device memory export alloc info
Yiwei Zhang [Fri, 17 Feb 2023 09:35:26 +0000 (01:35 -0800)]
venus: fix device memory export alloc info

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: fix external image creation
Yiwei Zhang [Fri, 17 Feb 2023 04:52:13 +0000 (20:52 -0800)]
venus: fix external image creation

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: simplify support for non-AHB external images
Yiwei Zhang [Fri, 17 Feb 2023 05:29:54 +0000 (21:29 -0800)]
venus: simplify support for non-AHB external images

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: simplify ahb image creation
Yiwei Zhang [Wed, 15 Feb 2023 23:07:01 +0000 (15:07 -0800)]
venus: simplify ahb image creation

Those excessive asserts are only useful when bringing up Android.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: refactor image create info pnext tracking
Yiwei Zhang [Wed, 15 Feb 2023 22:11:02 +0000 (14:11 -0800)]
venus: refactor image create info pnext tracking

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: remove redundant abstractions for wsi struct search
Yiwei Zhang [Wed, 15 Feb 2023 21:44:30 +0000 (13:44 -0800)]
venus: remove redundant abstractions for wsi struct search

Doing that won't avoid linking wsi headers, and in fact we have already
included both android and common wsi headers. For swapchain info, it's
currently disabled by the swapchain spec version advertised on Android.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: fix external buffer creation
Yiwei Zhang [Mon, 13 Feb 2023 00:08:45 +0000 (16:08 -0800)]
venus: fix external buffer creation

Move buffer create info scrub into core venus.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: distinguish external memory from mappable memory support
Yiwei Zhang [Wed, 8 Feb 2023 21:50:23 +0000 (13:50 -0800)]
venus: distinguish external memory from mappable memory support

Mappable memory support is a must for Venus core, but the support of
such can be transparent to the driver. Thus the renderer external memory
type won't expose opaque fd type.

External memory over vtest can be exposed and the wsi support on top can
be made explicit as long as masking out the importable bit.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: tighten up the sync fd requirements for Android wsi
Yiwei Zhang [Wed, 15 Feb 2023 17:48:49 +0000 (09:48 -0800)]
venus: tighten up the sync fd requirements for Android wsi

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: refactor sync fd fence and sempahore features
Yiwei Zhang [Wed, 15 Feb 2023 17:22:29 +0000 (09:22 -0800)]
venus: refactor sync fd fence and sempahore features

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: clean up globalFencing
Yiwei Zhang [Wed, 15 Feb 2023 16:56:00 +0000 (08:56 -0800)]
venus: clean up globalFencing

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: clean up memoryResourceAllocationSize
Yiwei Zhang [Tue, 14 Feb 2023 07:23:28 +0000 (23:23 -0800)]
venus: clean up memoryResourceAllocationSize

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: start requiring all experimental features
Yiwei Zhang [Tue, 14 Feb 2023 07:18:39 +0000 (23:18 -0800)]
venus: start requiring all experimental features

This is to prepare for promoting exp features to core.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: replace binary search with hardcode for max buffer size
Yiwei Zhang [Mon, 13 Feb 2023 04:30:53 +0000 (20:30 -0800)]
venus: replace binary search with hardcode for max buffer size

Avoid the couple test buffer creations without maintenance4.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agovenus: further disallow sparse resource
Yiwei Zhang [Mon, 13 Feb 2023 03:45:28 +0000 (19:45 -0800)]
venus: further disallow sparse resource

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21379>

20 months agoaco/optimizer_postRA: assume all registers are untrackable in loop headers
Georg Lehmann [Sun, 26 Feb 2023 14:54:18 +0000 (15:54 +0100)]
aco/optimizer_postRA: assume all registers are untrackable in loop headers

Register writes from the pre-header might not be correct for any but
the first loop iteration because they can be clobbered inside the loop.

Foz-DB Navi21:
Totals from 18 (0.01% of 134913) affected shaders:
CodeSize: 251384 -> 251508 (+0.05%)
Instrs: 47644 -> 47664 (+0.04%)
Latency: 801801 -> 801852 (+0.01%)
InvThroughput: 177579 -> 177593 (+0.01%)
Copies: 4752 -> 4771 (+0.40%)

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/8376
Fixes: d3b0f781103 ("aco/optimizer_postRA: Initialize loop header with preheader information")

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

20 months agozink: skip buffer barriers for ACCESS_NONE -> ACCESS_READ / ACCESS_WRITE
Mike Blumenkrantz [Mon, 20 Feb 2023 16:40:00 +0000 (11:40 -0500)]
zink: skip buffer barriers for ACCESS_NONE -> ACCESS_READ / ACCESS_WRITE

these do nothing and may cause unnecessary driver flushing

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

20 months agoci: Update traces expectations for gutting glsl opt_algebraic.
Emma Anholt [Wed, 22 Feb 2023 23:13:53 +0000 (15:13 -0800)]
ci: Update traces expectations for gutting glsl opt_algebraic.

All look like harmless changes.

Acked-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/21475>

20 months agoglsl: Remove unused as_rvalue_to_saturate().
Emma Anholt [Wed, 22 Feb 2023 21:12:24 +0000 (13:12 -0800)]
glsl: Remove unused as_rvalue_to_saturate().

This is not where saturate recognition happens.  Dead code since
5598458e6923 ("i965/vec4: Remove try_emit_saturate") in 2014!

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop the flrp recognizer.
Emma Anholt [Wed, 22 Feb 2023 21:16:40 +0000 (13:16 -0800)]
glsl/opt_algebraic: Drop the flrp recognizer.

No change to r300.

freedreno looks mixed but slightly positive in instructions:

total instructions in shared programs: 11012472 -> 11012453 (<.01%)
instructions in affected programs: 8250 -> 8231 (-0.23%)
helped: 16
HURT: 50

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop the ftrunc pattern recognizer.
Emma Anholt [Wed, 22 Feb 2023 21:01:13 +0000 (13:01 -0800)]
glsl/opt_algebraic: Drop the ftrunc pattern recognizer.

Now that it's in NIR, there's no change to r300 or freedreno shader-db
when we do.

Acked-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/21475>

20 months agonir: Port a floor->truncate algebraic opt pattern from GLSL.
Emma Anholt [Wed, 22 Feb 2023 20:59:16 +0000 (12:59 -0800)]
nir: Port a floor->truncate algebraic opt pattern from GLSL.

Prevents regression when dropping code from the GLSL optimizer.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop some fmul simplifications.
Emma Anholt [Wed, 22 Feb 2023 20:44:40 +0000 (12:44 -0800)]
glsl/opt_algebraic: Drop some fmul simplifications.

Looks like mostly noise, trending slightly positively.

freedreno:

total instructions in shared programs: 11012781 -> 11012472 (<.01%)
instructions in affected programs: 114072 -> 113763 (-0.27%)
helped: 123
HURT: 153

r300:

total instructions in shared programs: 1338236 -> 1337897 (-0.03%)
instructions in affected programs: 3460 -> 3121 (-9.80%)
helped: 61
HURT: 11

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop the flrp/ffma simplifiers.
Emma Anholt [Wed, 22 Feb 2023 20:39:41 +0000 (12:39 -0800)]
glsl/opt_algebraic: Drop the flrp/ffma simplifiers.

NIR seems to do a better job.  Freedreno:

total instructions in shared programs: 11013096 -> 11012781 (<.01%)
instructions in affected programs: 258358 -> 258043 (-0.12%)
helped: 470
HURT: 269

r300:

total instructions in shared programs: 1338237 -> 1338236 (<.01%)
instructions in affected programs: 161 -> 160 (-0.62%)
helped: 1
HURT: 0
total presub in shared programs: 45127 -> 44881 (-0.55%)
presub in affected programs: 1719 -> 1473 (-14.31%)
helped: 246
HURT: 0

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop no-op pack/unpack optimization.
Emma Anholt [Wed, 22 Feb 2023 20:29:37 +0000 (12:29 -0800)]
glsl/opt_algebraic: Drop no-op pack/unpack optimization.

No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop the eq/neq add-removal optimization.
Emma Anholt [Wed, 22 Feb 2023 20:27:07 +0000 (12:27 -0800)]
glsl/opt_algebraic: Drop the eq/neq add-removal optimization.

No change on freedreno or r300 shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop scalar all_eq/any_neq -> eq/neq opt.
Emma Anholt [Wed, 22 Feb 2023 20:24:49 +0000 (12:24 -0800)]
glsl/opt_algebraic: Drop scalar all_eq/any_neq -> eq/neq opt.

No change in r300 or freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop fdot 0-channel optimizations.
Emma Anholt [Wed, 22 Feb 2023 20:10:32 +0000 (12:10 -0800)]
glsl/opt_algebraic: Drop fdot 0-channel optimizations.

No change on i915g shader-db.

Acked-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/21475>

20 months agonir: Add optimization for fdot(x, 0) -> 0.
Emma Anholt [Wed, 22 Feb 2023 20:22:03 +0000 (12:22 -0800)]
nir: Add optimization for fdot(x, 0) -> 0.

We had all these nice fdot opts to drop individual channels that were 0,
but nothing handling it being entirely 0!  Avoids r300g regression when
dropping them from GLSL.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop csel(true/false, x, y) optimization.
Emma Anholt [Wed, 22 Feb 2023 20:08:55 +0000 (12:08 -0800)]
glsl/opt_algebraic: Drop csel(true/false, x, y) optimization.

No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop x + -x -> 0 optimization.
Emma Anholt [Wed, 22 Feb 2023 20:04:34 +0000 (12:04 -0800)]
glsl/opt_algebraic: Drop x + -x -> 0 optimization.

No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop add/sub with 0 optimizations.
Emma Anholt [Wed, 22 Feb 2023 20:03:34 +0000 (12:03 -0800)]
glsl/opt_algebraic: Drop add/sub with 0 optimizations.

Looks like minor instruction selection noise in freedreno shader-db:

total instructions in shared programs: 11013100 -> 11013096 (<.01%)
instructions in affected programs: 2714 -> 2710 (-0.15%)
helped: 8
HURT: 6

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop fdiv(1,x) -> frcp(x) and fdiv(x,1) -> x optimizations.
Emma Anholt [Wed, 22 Feb 2023 20:00:24 +0000 (12:00 -0800)]
glsl/opt_algebraic: Drop fdiv(1,x) -> frcp(x) and fdiv(x,1) -> x optimizations.

No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop and/or/xor optimizations.
Emma Anholt [Wed, 22 Feb 2023 19:59:18 +0000 (11:59 -0800)]
glsl/opt_algebraic: Drop and/or/xor optimizations.

NIR has them, and if anything freedreno shader-db prefers that NIR sees them:

total instructions in shared programs: 11013112 -> 11013100 (<.01%)
instructions in affected programs: 26266 -> 26254 (-0.05%)
helped: 4
HURT: 0

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop rcp optimizations.
Emma Anholt [Wed, 22 Feb 2023 19:56:08 +0000 (11:56 -0800)]
glsl/opt_algebraic: Drop rcp optimizations.

No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop pow optimizations.
Emma Anholt [Wed, 22 Feb 2023 19:54:15 +0000 (11:54 -0800)]
glsl/opt_algebraic: Drop pow optimizations.

These should all be covered by NIR.  Minor shader-db changes on freedreno,
which appear to be scheduling noise.

total instructions in shared programs: 11013132 -> 11013112 (<.01%)
instructions in affected programs: 3408 -> 3388 (-0.59%)

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop shifts of 0 optimizations.
Emma Anholt [Wed, 22 Feb 2023 19:48:05 +0000 (11:48 -0800)]
glsl/opt_algebraic: Drop shifts of 0 optimizations.

No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: drop fsat(fadd(b2f(x), b2f(y))) -> b2f(ior(x, y)) opt.
Emma Anholt [Wed, 22 Feb 2023 19:45:20 +0000 (11:45 -0800)]
glsl/opt_algebraic: drop fsat(fadd(b2f(x), b2f(y))) -> b2f(ior(x, y)) opt.

No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop f2i(trunc(x)) -> f2i(x) optimization.
Emma Anholt [Wed, 22 Feb 2023 19:43:23 +0000 (11:43 -0800)]
glsl/opt_algebraic: Drop f2i(trunc(x)) -> f2i(x) optimization.

No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop -(-x) -> x optimization.
Emma Anholt [Wed, 22 Feb 2023 19:39:18 +0000 (11:39 -0800)]
glsl/opt_algebraic: Drop -(-x) -> x optimization.

No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop abs(-x) -> abs(x) and abs(abs(x)) -> abs(x).
Emma Anholt [Wed, 22 Feb 2023 19:38:14 +0000 (11:38 -0800)]
glsl/opt_algebraic: Drop abs(-x) -> abs(x) and abs(abs(x)) -> abs(x).

NIR does this.  No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop pow-recognizer.
Emma Anholt [Wed, 22 Feb 2023 19:36:24 +0000 (11:36 -0800)]
glsl/opt_algebraic: Drop pow-recognizer.

NIR handles pow recognizing, too.  No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop log(exp(x)) -> x and exp(log(x)) -> x optimisations.
Emma Anholt [Wed, 22 Feb 2023 19:34:57 +0000 (11:34 -0800)]
glsl/opt_algebraic: Drop log(exp(x)) -> x and exp(log(x)) -> x optimisations.

No change on freedreno shader-db.

Acked-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/21475>

20 months agoglsl/opt_algebraic: Drop ~~x == x transformation.
Emma Anholt [Wed, 22 Feb 2023 19:33:06 +0000 (11:33 -0800)]
glsl/opt_algebraic: Drop ~~x == x transformation.

No change on freedreno shader-db.

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

20 months agozink: use tc renderpass optimizing to more optimally start queries
Mike Blumenkrantz [Wed, 22 Feb 2023 20:20:15 +0000 (15:20 -0500)]
zink: use tc renderpass optimizing to more optimally start queries

if tc has determined that no queries are ended inside a renderpass,
it becomes possible to start queries outside of a renderpass, which
is more performant on some hw

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

20 months agozink: always start/stop/resume queries inside renderpasses
Mike Blumenkrantz [Wed, 22 Feb 2023 20:19:33 +0000 (15:19 -0500)]
zink: always start/stop/resume queries inside renderpasses

this avoids potentially splitting renderpasses by ensuring that
all (non-cs) query operations always occur inside renderpasses

zink_query_update_gs_states() now has to be called inside renderpass
to catch the active queries

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

20 months agozink: pull 'was_line_loop' into ctx for query updating
Mike Blumenkrantz [Wed, 22 Feb 2023 22:44:15 +0000 (17:44 -0500)]
zink: pull 'was_line_loop' into ctx for query updating

make this a bit more flexible

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

20 months agozink: use more consistent check for deleting zink_query::stats_list links
Mike Blumenkrantz [Wed, 22 Feb 2023 21:05:15 +0000 (16:05 -0500)]
zink: use more consistent check for deleting zink_query::stats_list links

the linkage of this may vary depending on the query's active state,
so avoid issues by just checking the linkage directly

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

20 months agozink: break out query suspend functionality for reuse
Mike Blumenkrantz [Wed, 22 Feb 2023 20:18:01 +0000 (15:18 -0500)]
zink: break out query suspend functionality for reuse

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

20 months agozink: track whether queries were started in a renderpass
Mike Blumenkrantz [Wed, 22 Feb 2023 20:17:16 +0000 (15:17 -0500)]
zink: track whether queries were started in a renderpass

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

20 months agozink: rework query pool overflow
Mike Blumenkrantz [Wed, 22 Feb 2023 18:03:47 +0000 (13:03 -0500)]
zink: rework query pool overflow

now when a query pool is full, a new query pool can be created and the
previous one can be dropped from reuse to be freed at a later time

this has the added benefit of avoiding yet another place where a renderpass
might get split

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

20 months agozink: create/use query pools dynamically
Mike Blumenkrantz [Wed, 22 Feb 2023 17:59:46 +0000 (12:59 -0500)]
zink: create/use query pools dynamically

this fits the concept of "pools are shared between queries" a bit
better and leaves the pool ownership/destruction to their users

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

20 months agozink: rework find_or_allocate_qp()
Mike Blumenkrantz [Wed, 22 Feb 2023 17:47:29 +0000 (12:47 -0500)]
zink: rework find_or_allocate_qp()

this and its caller are now a bit more streamlined with regards to
functionality of the surrounding code

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

20 months agozink: reorder some query code
Mike Blumenkrantz [Wed, 22 Feb 2023 17:46:52 +0000 (12:46 -0500)]
zink: reorder some query code

no functional changes

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

20 months agozink: try updating qbos on query resume if !in_rp
Mike Blumenkrantz [Wed, 22 Feb 2023 17:28:42 +0000 (12:28 -0500)]
zink: try updating qbos on query resume if !in_rp

this is another logical place to do the update since it won't split
a renderpass

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

20 months agozink: only update qbo for TIME_ELAPSED on start if !in_rp
Mike Blumenkrantz [Thu, 23 Feb 2023 01:24:21 +0000 (20:24 -0500)]
zink: only update qbo for TIME_ELAPSED on start if !in_rp

this otherwise splits the current renderpass for no reason

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

20 months agozink: handle null query results for conditional render
Mike Blumenkrantz [Thu, 23 Feb 2023 01:05:35 +0000 (20:05 -0500)]
zink: handle null query results for conditional render

this just needs to have a zero blasted into the buffer

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

20 months agozink: handle null query results
Mike Blumenkrantz [Wed, 22 Feb 2023 21:27:40 +0000 (16:27 -0500)]
zink: handle null query results

it's possible that a query may have no results at all, so shortcut
everything and return zero as fast as possible for those cases

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