platform/upstream/mesa.git
3 years agoir3/delay: Support multi-mov instructions
Connor Abbott [Thu, 22 Apr 2021 17:06:54 +0000 (19:06 +0200)]
ir3/delay: Support multi-mov instructions

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

3 years agoir3: Support multi-mov instructions
Connor Abbott [Fri, 25 Jun 2021 09:34:53 +0000 (11:34 +0200)]
ir3: Support multi-mov instructions

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

3 years agoir3: Add foreach_dst/foreach_dst_n
Connor Abbott [Mon, 21 Jun 2021 15:46:33 +0000 (17:46 +0200)]
ir3: Add foreach_dst/foreach_dst_n

And cleanup a few places I know of that are open-coding it

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

3 years agoir3: Prepare dest helpers for multi-dst instructions
Connor Abbott [Fri, 25 Jun 2021 09:06:35 +0000 (11:06 +0200)]
ir3: Prepare dest helpers for multi-dst instructions

Assert in dest_regs() that dst_count == 1, since most users of it will
blow up if they encounter multiple destinations, and split out the core
of writes_gpr() so that we can easily make code using it multi-dst
aware.

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

3 years agoir3: Stop creating dummy dest registers
Connor Abbott [Fri, 25 Jun 2021 08:51:25 +0000 (10:51 +0200)]
ir3: Stop creating dummy dest registers

These were a holdover from before the src/dst split and are no longer
necessary. Just don't create any dest registers for instructions that
never have a destination.

This has the side-effect that it becomes easier to replace uses of
dest_regs() with a per-register thing, once we start adding support for
multiple destinations.

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

3 years agov3dv: expose support for basic subgroup operations
Iago Toral Quiroga [Tue, 22 Jun 2021 10:13:56 +0000 (12:13 +0200)]
v3dv: expose support for basic subgroup operations

Relevant CTS tests (requires Vulkan 1.1):
dEQP-VK.subgroups.builtin_var.compute.*
dEQP-VK.subgroups.basic.compute.*

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

3 years agov3dv: expose correct subgroup size
Iago Toral Quiroga [Tue, 22 Jun 2021 09:30:11 +0000 (11:30 +0200)]
v3dv: expose correct subgroup size

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

3 years agobroadcom/util: don't use compute supergroup packing with subgroups
Iago Toral Quiroga [Tue, 22 Jun 2021 10:34:02 +0000 (12:34 +0200)]
broadcom/util: don't use compute supergroup packing with subgroups

When using subgroups there are additional restrictions to consider,
so for now we keep it simple and disable supergroup packing in that
scenario.

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

3 years agobroadcom/compiler: track if a compute shader uses subgroup functionality
Iago Toral Quiroga [Tue, 22 Jun 2021 10:33:23 +0000 (12:33 +0200)]
broadcom/compiler: track if a compute shader uses subgroup functionality

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

3 years agobroadcom/compiler: add a set_a_flags_for_subgroup helper
Iago Toral Quiroga [Mon, 28 Jun 2021 07:45:18 +0000 (09:45 +0200)]
broadcom/compiler: add a set_a_flags_for_subgroup helper

We will need this in the future to implement more subgroup operations,
so make this code available in a helper.

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

3 years agobroadcom/compiler: add a ntq_emit_cond_to_bool helper
Iago Toral Quiroga [Mon, 28 Jun 2021 07:44:49 +0000 (09:44 +0200)]
broadcom/compiler: add a ntq_emit_cond_to_bool helper

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

3 years agobroadcom/compiler: implement more subgroup intrinsics
Iago Toral Quiroga [Tue, 22 Jun 2021 09:04:06 +0000 (11:04 +0200)]
broadcom/compiler: implement more subgroup intrinsics

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

3 years agobroadcom/compiler: add FLAFIRST and FLNAFIRST opcodes
Iago Toral Quiroga [Wed, 23 Jun 2021 09:18:50 +0000 (11:18 +0200)]
broadcom/compiler: add FLAFIRST and FLNAFIRST opcodes

We will at least need the former to implement subgroupElect()

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

3 years agobroadcom/compiler: lower nir_intrinsic_load_num_subgroups
Iago Toral Quiroga [Tue, 22 Jun 2021 10:00:55 +0000 (12:00 +0200)]
broadcom/compiler: lower nir_intrinsic_load_num_subgroups

The number of subgroups is the local workgroup size divided by the
dispatch width.

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

3 years agobroadcom/compiler: implement nir_intrinsic_load_subgroup_id correctly
Iago Toral Quiroga [Tue, 22 Jun 2021 08:55:04 +0000 (10:55 +0200)]
broadcom/compiler: implement nir_intrinsic_load_subgroup_id correctly

For some reason, this was implemented with the bulk of the compute
shader enablement, but this intrinsic is specific to subgroups and
thus was not really used. Also, its implementation was not correct,
since it was returning the element index within the subgroup, not
the subgroup index itself, which is the index of the batch in the
dispatch.

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

3 years agointel/perf: use the right popcount for 64bits
Lionel Landwerlin [Fri, 25 Jun 2021 10:54:51 +0000 (13:54 +0300)]
intel/perf: use the right popcount for 64bits

We're currently using the 32bit version which is dropping half the
bits of the 64bits values.

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

3 years agoutil: add some workarounds for the game Luna Sky
Timothy Arceri [Fri, 25 Jun 2021 11:31:16 +0000 (21:31 +1000)]
util: add some workarounds for the game Luna Sky

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4948

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11602>

3 years agoutil/driconf: add new ignore_write_to_readonly_var workaround
Timothy Arceri [Fri, 25 Jun 2021 11:29:31 +0000 (21:29 +1000)]
util/driconf: add new ignore_write_to_readonly_var workaround

This forces the GLSL compiler to ignore writes to readonly vars
rather than throwing an error.

Cc: mesa-stable
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11602>

3 years agoglsl: force_glsl_version to shaders with no defined version
Timothy Arceri [Fri, 25 Jun 2021 10:30:32 +0000 (20:30 +1000)]
glsl: force_glsl_version to shaders with no defined version

If a shader has no defined version force_glsl_version was
previous ignored and the shader would default to 110. This updates
the code so that those shaders are forced to a new level also.

We reused the existing code to make sure a sensible value is set
for the version.

Cc: mesa-stable
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11602>

3 years agoi965: don't crash on incorrect texture use
Timothy Arceri [Mon, 28 Jun 2021 04:26:54 +0000 (14:26 +1000)]
i965: don't crash on incorrect texture use

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4995

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11603>

3 years agomesa: don't crash on incorrect texture use
Timothy Arceri [Fri, 25 Jun 2021 12:33:22 +0000 (22:33 +1000)]
mesa: don't crash on incorrect texture use

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4995

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

3 years agoutil/tests: initialise key in cache_test
Timothy Arceri [Mon, 28 Jun 2021 10:31:46 +0000 (20:31 +1000)]
util/tests: initialise key in cache_test

Fixes: e8495646afb0 ("glsl/tests: changes to test_disk_cache_create test")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2631

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

3 years agovenus: resolve AHB external format with DRM format
Yiwei Zhang [Fri, 18 Jun 2021 21:45:28 +0000 (21:45 +0000)]
venus: resolve AHB external format with DRM format

AHardwareBuffer_Format is lossier than DRM_FORMAT_*, which ends up with
unable to resolve implementation defined format upon creating sampler
ycbcr conversion. So we now use DRM format as AHB external format.

An external format error return in vkCreateSamplerYcbcrConversion is
also removed here since that is already an invalid usage per spec
(partly because there is no proper error code to return here).

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

3 years agovenus: remove unsupported AHB formats
Yiwei Zhang [Sat, 19 Jun 2021 05:30:43 +0000 (05:30 +0000)]
venus: remove unsupported AHB formats

Likely not going to support them either.

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

3 years agovenus: use the mesa "drm-uapi/drm_fourcc.h" header
Yiwei Zhang [Thu, 17 Jun 2021 22:03:02 +0000 (22:03 +0000)]
venus: use the mesa "drm-uapi/drm_fourcc.h" header

Prepare for later CI integration.

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

3 years agoi915g: Fix off-by-one in constant count assertion.
Emma Anholt [Mon, 28 Jun 2021 03:30:27 +0000 (20:30 -0700)]
i915g: Fix off-by-one in constant count assertion.

You can have up to C[31].

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

3 years agoi915g: Mark program errors on setting up temps, constants, and immediates.
Emma Anholt [Sun, 27 Jun 2021 22:00:59 +0000 (15:00 -0700)]
i915g: Mark program errors on setting up temps, constants, and immediates.

We would proceed through the compiler, and usually fail for some other
reason (ALU ops, etc.), but best to be sure.

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

3 years agoi915g: Remove redundant p->error setting.
Emma Anholt [Sun, 27 Jun 2021 21:51:53 +0000 (14:51 -0700)]
i915g: Remove redundant p->error setting.

i915_program_error() already does it.

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

3 years agoi915g: Use stdbool.h instead of custom bools.
Emma Anholt [Sun, 27 Jun 2021 21:47:02 +0000 (14:47 -0700)]
i915g: Use stdbool.h instead of custom bools.

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

3 years agoi915g: replace "uint" with normal uint32_t.
Emma Anholt [Sun, 27 Jun 2021 21:43:58 +0000 (14:43 -0700)]
i915g: replace "uint" with normal uint32_t.

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

3 years agoi915g: Improve logging of unsupported opcodes.
Emma Anholt [Sun, 27 Jun 2021 21:35:32 +0000 (14:35 -0700)]
i915g: Improve logging of unsupported opcodes.

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

3 years agoi915g: Stop translating the fragment program on the first error.
Emma Anholt [Sun, 27 Jun 2021 21:36:46 +0000 (14:36 -0700)]
i915g: Stop translating the fragment program on the first error.

It would proceed through printing errors for each of the unsupported loop
opcodes in the program.

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

3 years agoi915g: Log program compile errors to mesa_loge().
Emma Anholt [Sun, 27 Jun 2021 21:15:41 +0000 (14:15 -0700)]
i915g: Log program compile errors to mesa_loge().

Now these major driver failures are no longer hidden under -DDEBUG, and
would also work on android (you know, if you cared).  We do want to
suppress logging for u_blitter shaders that fail to compile during
util_blitter_cache_all_shaders().

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

3 years agoi915g: Use the normal compile error path for empty FSes.
Emma Anholt [Sun, 27 Jun 2021 21:10:47 +0000 (14:10 -0700)]
i915g: Use the normal compile error path for empty FSes.

This means they'll get dumped and you'll see the passthrough FS.

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

3 years agoi915g: Enable dumping of fragment shaders under I915_DEBUG=fs.
Emma Anholt [Sun, 27 Jun 2021 20:47:51 +0000 (13:47 -0700)]
i915g: Enable dumping of fragment shaders under I915_DEBUG=fs.

Probably the most common thing I want to debug in this driver, and we
didn't have a good option for it.

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

3 years agoi915g: Allow use of I915_DEBUG= options on non-DEBUG builds.
Emma Anholt [Sun, 27 Jun 2021 20:46:24 +0000 (13:46 -0700)]
i915g: Allow use of I915_DEBUG= options on non-DEBUG builds.

All the checks should be cheap, no need making things harder to debug.

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

3 years agoi915g: Bake the decls and program together.
Emma Anholt [Sun, 27 Jun 2021 04:31:00 +0000 (21:31 -0700)]
i915g: Bake the decls and program together.

Simplifies program upload a bunch, and will let us disasm the program
independently of the whole cmd buffer.

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

3 years agoi915g: Apply clang-format.
Emma Anholt [Fri, 25 Jun 2021 16:53:33 +0000 (09:53 -0700)]
i915g: Apply clang-format.

Add the format file copied from freedreno, and run clang-format
--style=file -i src/gallium/drivers/i915/*.[ch] (with clang-format 11).

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

3 years agovenus: properly support GPU_DATA_BUFFER for AHB
Yiwei Zhang [Sun, 20 Jun 2021 17:05:41 +0000 (17:05 +0000)]
venus: properly support GPU_DATA_BUFFER for AHB

CrOS gralloc was missing support for GPU_DATA_BUFFER, which was only
fixed until recently. Now we can allcate properly.

This patch also removes a redundant TODO regarding image format list
support for AHB. vkGetPhysicalDeviceImageFormatProperties2 has already
checked the support for such though it only checks whether the optimal
tiling and the associated drm format modifier for the AHB image format
itself applies to the entire format list or not. Given the use case for
such combination is quite limited, we choose not to add new gralloc
support to force linear modifier as a fallback for wider coverage.

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

3 years agointel: PAGE_SIZE used in allocators shouldn't be defined on FreeBSD
Eleni Maria Stea [Mon, 7 Jun 2021 06:22:20 +0000 (09:22 +0300)]
intel: PAGE_SIZE used in allocators shouldn't be defined on FreeBSD

iris, i965, and anv define the PAGE_SIZE in anv_allocator and bufmgr
files. As on FreeBSD the page size is defined in machine/param.h that is
indirectly included by those files, we'd rather define it only when the
system is not FreeBSD to avoid compile errors.

v2: Changed the path in the comment to make clear that machine/params.h
is a FreeBSD system file.

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11203>

3 years agointel: struct bitset is renamed to brw_bitset
Eleni Maria Stea [Sun, 27 Jun 2021 11:31:08 +0000 (14:31 +0300)]
intel: struct bitset is renamed to brw_bitset

Static struct bitset was renamed to brw_bitset as a struct bitset
is defined in sys/_bitset.h included by pthread_np.h on FreeBSD that
is indirectly included by src/intel/compiler/brw_nir_lower_shader_calls.c

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11203>

3 years agoutil: Removed unused statement from FreeBSD build
Eleni Maria Stea [Mon, 7 Jun 2021 06:13:34 +0000 (09:13 +0300)]
util: Removed unused statement from FreeBSD build

Statement (void*)debug_name when FreeBSD is defined has no use. Removed
it to fix compiler warnings.

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11203>

3 years agoutil: replaced ENODATA with ENOATTR for non-Linux systems
Eleni Maria Stea [Mon, 7 Jun 2021 06:10:30 +0000 (09:10 +0300)]
util: replaced ENODATA with ENOATTR for non-Linux systems

On Linux ENODATA is defined but on BSD, and MacOSX ENOATTR is used
instead. Defined ENODATA to be ENOATTR when the system is not Linux.

v2: Replaced ENODATA and ENOATTR with -EFAULT that is exists everywhere
and added a comment (Ian Romanick)

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11203>

3 years agoutil/vbuf: flag fallback_always if any prim types are missing from restart modes
Mike Blumenkrantz [Fri, 25 Jun 2021 14:45:31 +0000 (10:45 -0400)]
util/vbuf: flag fallback_always if any prim types are missing from restart modes

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

3 years agoutil/vbuf: always claim support for PATCHES in restart modes
Mike Blumenkrantz [Fri, 25 Jun 2021 14:44:25 +0000 (10:44 -0400)]
util/vbuf: always claim support for PATCHES in restart modes

this avoids forcing rewrites for patch mode which break tessellation

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

3 years agoturnip: Short-circuit if ladder generation for constant index SSBO/UBOs.
Emma Anholt [Fri, 25 Jun 2021 21:02:07 +0000 (14:02 -0700)]
turnip: Short-circuit if ladder generation for constant index SSBO/UBOs.

The compiler *can* eventually chew through all the copy prop, constant
folding, and dead_cf necessary to use just our constant index, but we can
save a whole lot of hassle by chasing the MOVs up front and finding the
constant.

dEQP-VK.ubo.3_level_array.scalar.row_major_mat4.both goes from 2.0s to
1.6s on a release build (3.1s to 2.1s for a debug build like we use in CI).

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

3 years agonir: Add a helper for chasing movs with nir_ssa_scalar().
Emma Anholt [Fri, 25 Jun 2021 20:58:04 +0000 (13:58 -0700)]
nir: Add a helper for chasing movs with nir_ssa_scalar().

Sometimes you might want to find a constant source without going through
all the copy prop and constant folding to make your source be a
load_const.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11613>

3 years agoir3/sched: Speed up live_effect
Connor Abbott [Tue, 1 Jun 2021 16:18:14 +0000 (18:18 +0200)]
ir3/sched: Speed up live_effect

If we've identified another use that isn't scheduled yet, we can break
right away rather than iterating through all the other uses. While this
could be optimized further, this simple change makes
dEQP-VK.subgroups.ballot_broadcast.compute.subgroupbroadcast_ivec4 go
from 40 seconds to 1.9 seconds on a release build according to my
unscientific testing.

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

3 years agofreedreno/computerator: Fix local_size typo
Connor Abbott [Mon, 28 Jun 2021 08:48:53 +0000 (10:48 +0200)]
freedreno/computerator: Fix local_size typo

Fixes: cbc68c79a51 ("freedreno: Add local_size to ir3_shader_variant")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11622>

3 years agonir/opt_load_store_vectorize: fix check_for_robustness() with deref access
Rhys Perry [Tue, 15 Jun 2021 16:50:57 +0000 (17:50 +0100)]
nir/opt_load_store_vectorize: fix check_for_robustness() with deref access

We could do better if we knew the nir_address_format to obtain
addition_bits, but the only affected driver (Turnip) probably won't
benefit because it doesn't vectorize across vec4.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: 2e7bceb2204 ("nir/load_store_vectorizer: fix check_for_robustness() with indirect loads")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4922
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11382>

3 years agoanv: expose primary node to VK_EXT_physical_device_drm even when VK_KHR_display is...
Ella-0 [Sun, 27 Jun 2021 19:29:08 +0000 (19:29 +0000)]
anv: expose primary node to VK_EXT_physical_device_drm even when VK_KHR_display is not enabled

Fixes: e9e1e0362b6c2d ("anv: implement VK_EXT_physical_device_drm")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11616>

3 years agoradeonsi: move the accepting code into the bbox cull branch in prim discard CS
Marek Olšák [Tue, 1 Jun 2021 05:40:37 +0000 (01:40 -0400)]
radeonsi: move the accepting code into the bbox cull branch in prim discard CS

This reduces the number of jumps. No change in behavior.

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

3 years agoradeonsi: add optimal multi draws and draw-level splitting for prim discard CS
Marek Olšák [Tue, 1 Jun 2021 01:59:28 +0000 (21:59 -0400)]
radeonsi: add optimal multi draws and draw-level splitting for prim discard CS

This is a partial rewrite of some parts of the code.

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

3 years agoradeonsi: fix issues with draw-level splitting for the prim discard CS
Marek Olšák [Tue, 1 Jun 2021 01:58:37 +0000 (21:58 -0400)]
radeonsi: fix issues with draw-level splitting for the prim discard CS

- move the unreachable statement up by inlining u_decomposed_prims_for_vertices
- the last draw was not submitted after splitting
- move "count" to the non-multi draw path

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

3 years agoradeonsi: change how the prim discard CS is enabled and splitting limits
Marek Olšák [Tue, 1 Jun 2021 01:48:28 +0000 (21:48 -0400)]
radeonsi: change how the prim discard CS is enabled and splitting limits

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

3 years agoradeonsi: remove the GDS variants of compute-based primitive discard
Marek Olšák [Mon, 31 May 2021 01:28:53 +0000 (21:28 -0400)]
radeonsi: remove the GDS variants of compute-based primitive discard

The GDS ordered append variant is unstable due to kernel and firmware bugs.
The unordered GDS variant isn't faster than the memory-based variant.

Only the memory-based variant is kept.

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

3 years agointel/fs: use stack for temporary array
Marcin Ślusarz [Thu, 6 May 2021 12:24:03 +0000 (14:24 +0200)]
intel/fs: use stack for temporary array

"regs" is an array of 2 ->
  "m" must be <= 2 ->
  "components" array can be allocated on the stack

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

3 years agointel/blorp: initialize BLEND_STATE using braced initializer list
Marcin Ślusarz [Thu, 24 Jun 2021 15:01:43 +0000 (17:01 +0200)]
intel/blorp: initialize BLEND_STATE using braced initializer list

Coverity complains that memset has no effect, because of size 0.
Size of BLEND_STATE struct is 0 on gfx [6, 7.5], so memset has
nothing to do there. This is of course harmless, but we can make
code simpler by replacing memset with an empty initializer list
and at the same time avoid a warning from Coverity.

CID: 1486015

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

3 years agointel/tools: fix potential memory leaks
Marcin Ślusarz [Thu, 24 Jun 2021 11:40:11 +0000 (13:40 +0200)]
intel/tools: fix potential memory leaks

CID: 1444041
CID: 1444104

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

3 years agointel/tools: fix invalid type in argument to printf format specifier
Marcin Ślusarz [Thu, 24 Jun 2021 11:22:42 +0000 (13:22 +0200)]
intel/tools: fix invalid type in argument to printf format specifier

Also mark parse_error as printf-like to catch such errors with gcc.

CID: 1473100
CID: 1473101

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

3 years agointel/tools: fix int-to-pointer/pointer-to-int cast warnings on 32-bit
Marcin Ślusarz [Thu, 24 Jun 2021 11:18:35 +0000 (13:18 +0200)]
intel/tools: fix int-to-pointer/pointer-to-int cast warnings on 32-bit

gcc complains:
../src/intel/tools/aub_write.c: In function ‘populate_ppgtt_table’:
../src/intel/tools/aub_write.c:254:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  254 |                (void *)(aub->phys_addrs_allocator++ << 12);
      |                ^
../src/intel/tools/aub_write.c:258:27: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  258 |                        i, (uint64_t)table->subtables[i]);
      |                           ^
../src/intel/tools/aub_write.c:273:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  273 |          (level == 1 ? (uint64_t)table->subtables[i] :
      |                        ^
../src/intel/tools/aub_write.c: In function ‘ppgtt_lookup’:
../src/intel/tools/aub_write.c:346:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  346 |    return (uint64_t)L1_table(ppgtt_addr)->subtables[L1_index(ppgtt_addr)];
      |           ^
../src/intel/tools/intel_sanitize_gpu.c: In function ‘bo_size’:
../src/intel/tools/intel_sanitize_gpu.c:99:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   99 |    return e ? (uint64_t)e->data : UINT64_MAX;
      |               ^

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

3 years agointel/tools: fix left shift overflow on 32-bit
Marcin Ślusarz [Thu, 24 Jun 2021 11:15:55 +0000 (13:15 +0200)]
intel/tools: fix left shift overflow on 32-bit

gcc complains:
../src/intel/tools/aub_write.c:394:53: warning: left shift count >= width of type [-Wshift-count-overflow]
  394 |    assert((aub->phys_addrs_allocator + size) < (1UL << 32));
      |                                                     ^~

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

3 years agoanv: fix potential integer overflows
Marcin Ślusarz [Thu, 24 Jun 2021 10:20:33 +0000 (12:20 +0200)]
anv: fix potential integer overflows

In all cases both variables has a type of uint32_t, so multiplying
them will also generate uint32_t. The results of those multiplications
are used as uint64_t's, so Coverity thinks there might be integer
overflows here.
I don't think it's possible to hit them (query BOs should be relatively
small), but let's avoid those overflows.

CID: 1472820
CID: 1472821
CID: 1472822
CID: 1472824
CID: 1475934
CID: 1475927

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

3 years agointel/decoder: add assert for register size
Marcin Ślusarz [Thu, 24 Jun 2021 09:30:03 +0000 (11:30 +0200)]
intel/decoder: add assert for register size

Coverity complains about out-of-bounds access in
intel_field_iterator_init, because it doesn't know that the GT_MODE
register has a size of 4 bytes. Add an assertion to verify that.

CID: 1474552

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

3 years agomesa/shaderapi: add an optional shader override mechanism
Pierre-Eric Pelloux-Prayer [Thu, 27 May 2021 14:06:15 +0000 (16:06 +0200)]
mesa/shaderapi: add an optional shader override mechanism

MESA_SHADER_READ_PATH is handy but it's not usable in
all cases.

This commit allows to implement an alternative mechanism
without assuming too much about how it's done, nor where/how
the shaders are stored.

When this is enabled MESA_SHADER_DUMP_PATH,
MESA_SHADER_CAPTURE_PATH and MESA_GLSL env var handling is
disabled.

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

3 years agomesa/shaderapi: change construct_name signature
Pierre-Eric Pelloux-Prayer [Thu, 27 May 2021 13:38:04 +0000 (15:38 +0200)]
mesa/shaderapi: change construct_name signature

Pass the sha1 as an argument.
This will be used by the next commit.

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

3 years agoUpdate libva requirement
Jeremy Newton [Mon, 21 Jun 2021 20:24:03 +0000 (16:24 -0400)]
Update libva requirement

Bump libva requirement since mesa references API not present prior to
libva API version 1.1.0 (libva 2.1.0 release).

See fbf6511e35, which added VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2
requiring API version 1.1.0 or later.

Signed-off-by: Jeremy Newton <Jeremy.Newton@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11508>

3 years agomesa: lower GL_CLAMP in texture and sampler functions instead of st/mesa
Marek Olšák [Mon, 7 Jun 2021 11:34:45 +0000 (07:34 -0400)]
mesa: lower GL_CLAMP in texture and sampler functions instead of st/mesa

This moves the GL_CLAMP translation out of st/mesa.
This should be faster assuming constant sampler states.

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

3 years agomesa: add IsBorderColorNonZero to skip border color update for st/mesa faster
Marek Olšák [Sun, 6 Jun 2021 18:23:49 +0000 (14:23 -0400)]
mesa: add IsBorderColorNonZero to skip border color update for st/mesa faster

0.8% less overhead.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: add LodBias quantization from st/mesa
Marek Olšák [Sun, 6 Jun 2021 18:08:33 +0000 (14:08 -0400)]
mesa: add LodBias quantization from st/mesa

Apparently the quantization math isn't cheap.

This further reduces overhead by 2% for drawoverhead/8 textures.
The improvement is measured by looking at the sysprof percentage delta and
multiplying by 2 (because we have the frontend and gallium threads with
equal overhead, so the benefit is doubled compared to 1 thread).

Both per-sampler and per-unit lod bias values are quantized.

The difference in behavior is that both values are quantized separately
and then added up, instead of first added up and then quantized.
The worst case error is +- 1/256 in the reduced precision, i.e. off by one
in a fixed-point representation, which should be fine.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: translate into pipe_sampler_state in GL functions
Marek Olšák [Sun, 6 Jun 2021 17:37:38 +0000 (13:37 -0400)]
mesa: translate into pipe_sampler_state in GL functions

- pipe_sampler_state is added into gl_sampler_attrib.
- The border color field is redundant, so the non-gallium field is removed.
- Other GL fields are still tracked because of glGet.
- Some fields are not set by GL functions because they are always derived
  from multiple states.
- The behavior in GL functions is the same as st_convert_sampler.

This reduces overhead by 2% for drawoverhead/8 textures, and more is going
to be done.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: remove mutex locking from a glBindTexture early out path
Marek Olšák [Mon, 7 Jun 2021 15:03:10 +0000 (11:03 -0400)]
mesa: remove mutex locking from a glBindTexture early out path

The locking doesn't seem to be needed. This removes large locking
overhead.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: use atomics instead of mutexes for refcounting renderbuffers
Marek Olšák [Mon, 7 Jun 2021 13:26:55 +0000 (09:26 -0400)]
mesa: use atomics instead of mutexes for refcounting renderbuffers

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: use atomics instead of mutexes for refcounting sampler objects
Marek Olšák [Mon, 7 Jun 2021 13:26:55 +0000 (09:26 -0400)]
mesa: use atomics instead of mutexes for refcounting sampler objects

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agomesa: use atomics instead of mutexes for refcounting texture objects
Marek Olšák [Mon, 7 Jun 2021 13:26:55 +0000 (09:26 -0400)]
mesa: use atomics instead of mutexes for refcounting texture objects

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11339>

3 years agocso: don't look up a sampler CSO if the last one is identical
Marek Olšák [Mon, 7 Jun 2021 13:58:48 +0000 (09:58 -0400)]
cso: don't look up a sampler CSO if the last one is identical

This is benefical when sampler states are identical often, and detrimental
if they are not. The average case seems to be in favor of this.

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

3 years agocso: update max_sampler_seen only once in cso_set_samplers
Marek Olšák [Mon, 7 Jun 2021 13:58:05 +0000 (09:58 -0400)]
cso: update max_sampler_seen only once in cso_set_samplers

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

3 years agocso: disallow NULL sampler state templates in cso_single_sampler
Marek Olšák [Sun, 6 Jun 2021 20:27:36 +0000 (16:27 -0400)]
cso: disallow NULL sampler state templates in cso_single_sampler

No code passes NULL into this except the single place that is updated.
Let's remove the if. The next commit depends on this.

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

3 years agost/mesa: remove the sampler min_lod/max_lod value swap
Marek Olšák [Mon, 7 Jun 2021 10:55:12 +0000 (06:55 -0400)]
st/mesa: remove the sampler min_lod/max_lod value swap

It might not be needed at all.

v2: fix v3d assertion failure

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11428>

3 years agost/mesa: add a mechanism to bypass atomics when binding sampler views
Marek Olšák [Sun, 6 Jun 2021 10:08:07 +0000 (06:08 -0400)]
st/mesa: add a mechanism to bypass atomics when binding sampler views

This is the same mechanism we already use for buffers. The code is mostly
copied from there. See the big comment for explanation.

This will be very effective when take_ownership is added into pipe_context
::set_sampler_views because that and this commit together will eliminate
atomics for sample views almost entirely.

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

3 years agost/mesa: sink refcounting from st_get_sampler_views into st_sampler_view.c
Marek Olšák [Sun, 6 Jun 2021 09:23:30 +0000 (05:23 -0400)]
st/mesa: sink refcounting from st_get_sampler_views into st_sampler_view.c

Do it deeper in the sampler view return path. It minimizes the deltas
for the next commit.

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

3 years agost/mesa: remove the const qualifier for a few st_sampler_view instances
Marek Olšák [Sun, 6 Jun 2021 09:35:31 +0000 (05:35 -0400)]
st/mesa: remove the const qualifier for a few st_sampler_view instances

It will be needed by following commits.

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

3 years agost/mesa: return sview from st_update_single_texture via return value, not param
Marek Olšák [Sun, 6 Jun 2021 08:48:47 +0000 (04:48 -0400)]
st/mesa: return sview from st_update_single_texture via return value, not param

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

3 years agost/mesa: read Target only once in st_update_single_texture
Marek Olšák [Sun, 6 Jun 2021 08:42:17 +0000 (04:42 -0400)]
st/mesa: read Target only once in st_update_single_texture

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

3 years agost/mesa: sink _mesa_get_samplerobj into st_update_single_texture
Marek Olšák [Sun, 6 Jun 2021 08:42:03 +0000 (04:42 -0400)]
st/mesa: sink _mesa_get_samplerobj into st_update_single_texture

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

3 years agost/mesa: don't memset the sampler view array, don't init trailing slots to NULL
Marek Olšák [Sun, 6 Jun 2021 02:35:09 +0000 (22:35 -0400)]
st/mesa: don't memset the sampler view array, don't init trailing slots to NULL

No functional change.

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

3 years agost/mesa: don't track FS sampler views for bitmap/drawpix in st_context
Marek Olšák [Sun, 6 Jun 2021 02:10:12 +0000 (22:10 -0400)]
st/mesa: don't track FS sampler views for bitmap/drawpix in st_context

Just query the sampler views from the update function. This will help
optimize sampler view updates.

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

3 years agost/mesa: don't track VS sampler views for st_draw_feedback in st_context
Marek Olšák [Sun, 6 Jun 2021 02:10:12 +0000 (22:10 -0400)]
st/mesa: don't track VS sampler views for st_draw_feedback in st_context

Just query the sampler views from the update function. This will help
optimize sampler view updates.

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

3 years agoturnip: Add CrOS Gralloc support
Rob Clark [Fri, 25 Jun 2021 19:45:03 +0000 (12:45 -0700)]
turnip: Add CrOS Gralloc support

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

3 years agoturnip: Fix AcquireImageANDROID() handle type
Rob Clark [Fri, 25 Jun 2021 18:24:59 +0000 (11:24 -0700)]
turnip: Fix AcquireImageANDROID() handle type

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

3 years agoturnip: Use drmIoctl()
Rob Clark [Thu, 24 Jun 2021 18:11:08 +0000 (11:11 -0700)]
turnip: Use drmIoctl()

Replace open-coded ioctl with drmIoctl() to get restart on interrupted
system calls.

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

3 years agoanv: allocate bigger batches as we grow command buffers
Lionel Landwerlin [Sat, 19 Jun 2021 10:14:16 +0000 (13:14 +0300)]
anv: allocate bigger batches as we grow command buffers

This is the first time we see an application running out of mmap().

We essentially allocate too many batches (+65k) and end up not being
able to mmap them, at which point we can't mmap anything anymore and
things go sideways.

This change allocates bigger batch BOs as we grow an existing command
buffer. This drastically reduces the number of BOs we need to allocate
(the benchmark that reported the issue now reaches a max of ~630 BOs,
instead of reaching 65k and failing previously).

v2: Track the total batch size of command buffers (Jason)
    Just give 0 for batch_len to i915 (Jason)

v3: Fix indentation (Jason)

v4: Drop uncessary reshuffling of error labels (Jason)

v5: Remove empty lines (Marcin)

v6: Limit BO growing to chunks of 16Mb (Jason)

v7: Add assert on initial size (Jason)

v8: Add define for max size (Jason)

v9: Fixup v7 assert for non softpin platforms (Lionel)

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

3 years agoanv: Advertise VK_KHR_shader_subgroup_uniform_control_flow
Caio Marcelo de Oliveira Filho [Wed, 23 Jun 2021 22:58:40 +0000 (15:58 -0700)]
anv: Advertise VK_KHR_shader_subgroup_uniform_control_flow

This is always valid for Intel, so we don't need to do anything
different if the Execution Mode is being used.

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

3 years agospirv: Support SPV_KHR_subgroup_uniform_control_flow
Caio Marcelo de Oliveira Filho [Wed, 23 Jun 2021 22:57:31 +0000 (15:57 -0700)]
spirv: Support SPV_KHR_subgroup_uniform_control_flow

There's no SPIR-V Capability associated, so check in the Execution
Mode.  For now, don't keep track of whether a shader uses uniform
control flow in the shader_info, we can add that when/if a driver
actually need that information.

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

3 years agospirv: Update headers and metadata from latest Khronos commit
Caio Marcelo de Oliveira Filho [Wed, 9 Jun 2021 22:13:06 +0000 (15:13 -0700)]
spirv: Update headers and metadata from latest Khronos commit

This corresponds to f95c3b3761ee1b1903f54ae69b526ed6f0edc3b9
("Merge pull request #219 from cmarcelo/SPV_EXT_shader_atomic_float16_add")
in https://github.com/KhronosGroup/SPIRV-Headers.

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

3 years agonir: Add test to check edge case in Split ALU optimization
Caio Marcelo de Oliveira Filho [Wed, 23 Jun 2021 22:28:40 +0000 (15:28 -0700)]
nir: Add test to check edge case in Split ALU optimization

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

3 years agonir/opt_if: Don't split ALU for single block infinite loops
Caio Marcelo de Oliveira Filho [Fri, 18 Jun 2021 19:24:11 +0000 (12:24 -0700)]
nir/opt_if: Don't split ALU for single block infinite loops

Some infinite loop cases were already covered by other
restrictions (e.g. if the loop had a body), but the case with a single
block in the loop body wasn't yet.

This prevents an infinite loop when optimizing the shader in
dEQP-VK.reconvergence.subgroup_uniform_control_flow_ballot.compute.nesting2.3.2
and various others reconvergence tests.

Fixes: 0881e90c099 ("nir: Split ALU instructions in loops that read phis")
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> [v1]
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11476>

3 years agoi965: Prevent invalid framebuffer usage
Miguel Gomez [Thu, 3 Jun 2021 14:44:30 +0000 (16:44 +0200)]
i965: Prevent invalid framebuffer usage

When a surfaceless context is in use, driDrawablePriv might be NULL, so needs to
be checked before calling dri2InvalidateDrawable. Same for read calls.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eleni Maria Stea <estea@igalia.com>
See https://gitlab.freedesktop.org/mesa/mesa/-/issues/778

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

3 years agoi915: Prevent invalid framebuffer usage
Philippe Normand [Sun, 11 Apr 2021 12:27:56 +0000 (13:27 +0100)]
i915: Prevent invalid framebuffer usage

When a surfaceless context is in use, driDrawablePriv might be NULL, so needs to
be checked before calling dri2InvalidateDrawable. Same for read calls.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eleni Maria Stea <estea@igalia.com>
Closes https://gitlab.freedesktop.org/mesa/mesa/-/issues/778

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

3 years agoamd/ci: Use MESA_VK_IGNORE_CONFORMANCE_WARNING to reduce warnings
Matt Turner [Wed, 23 Jun 2021 20:19:14 +0000 (13:19 -0700)]
amd/ci: Use MESA_VK_IGNORE_CONFORMANCE_WARNING to reduce warnings

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