platform/upstream/mesa.git
3 years agospirv: reverse order in matrix multiplication
Rhys Perry [Wed, 17 Jun 2020 12:44:40 +0000 (13:44 +0100)]
spirv: reverse order in matrix multiplication

This will create code that is easier to combine into MADs/FMA when the
last component of the vector is 1.0.

nir_opt_algebraic_late has an optimization to do something similar but it
only works for inexact code, if the multiplication-by-1 optimization is
done before it and if the backend enables fuse_ffma.

fossil-db (Navi):
Totals from 4296 (3.75% of 114665) affected shaders:
SGPRs: 283468 -> 283764 (+0.10%); split: -0.02%, +0.12%
VGPRs: 172868 -> 172904 (+0.02%); split: -0.09%, +0.11%
CodeSize: 14045312 -> 14027128 (-0.13%); split: -0.15%, +0.02%
MaxWaves: 59285 -> 59282 (-0.01%); split: +0.04%, -0.05%
Instrs: 2703507 -> 2683187 (-0.75%); split: -0.76%, +0.00%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5631>

3 years agonir: scalarize fdot in reverse
Rhys Perry [Tue, 16 Jun 2020 15:04:09 +0000 (16:04 +0100)]
nir: scalarize fdot in reverse

This will create code that is easier to combine into MADs/FMA when the
last component is 1.0.

nir_opt_algebraic_late has an optimization to do something similar but it
only works for inexact code, if the multiplication-by-1 optimization is
done before it and if the backend enables fuse_ffma.

fossil-db (Navi):
Totals from 85583 (74.64% of 114665) affected shaders:
SGPRs: 4556060 -> 4558596 (+0.06%); split: -0.07%, +0.12%
VGPRs: 3315060 -> 3312984 (-0.06%); split: -0.23%, +0.17%
SpillSGPRs: 13552 -> 13553 (+0.01%)
CodeSize: 184962756 -> 184431388 (-0.29%); split: -0.32%, +0.03%
MaxWaves: 1208693 -> 1209361 (+0.06%); split: +0.17%, -0.11%
Instrs: 35678819 -> 35361617 (-0.89%); split: -0.91%, +0.02%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5631>

3 years agopanfrost: Set .array_size on Bifrost
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:23:55 +0000 (08:23 -0500)]
panfrost: Set .array_size on Bifrost

Fixes dEQP-GLES2.functional.texture.mipmap.cube.generate.rgba8888_nicest

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Don't emit TEXS for array textures
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:23:32 +0000 (08:23 -0500)]
pan/bi: Don't emit TEXS for array textures

No place for the extra coordinate.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Handle 3D/array coordinates
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:23:22 +0000 (08:23 -0500)]
pan/bi: Handle 3D/array coordinates

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Track tex data register swizzles
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:23:01 +0000 (08:23 -0500)]
pan/bi: Track tex data register swizzles

So we can pass through a .z component.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Add bi_emit_array_index helper
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:22:42 +0000 (08:22 -0500)]
panfrost: Add bi_emit_array_index helper

Need to handle type conversion.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Drop unused swizzles
Alyssa Rosenzweig [Tue, 3 Nov 2020 13:21:12 +0000 (08:21 -0500)]
panfrost: Drop unused swizzles

Missed during format cleanup.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Advertise Bifrost support
Alyssa Rosenzweig [Sun, 1 Nov 2020 14:11:09 +0000 (09:11 -0500)]
panfrost: Advertise Bifrost support

Drop the PAN_MESA_DEBUG=bifrost flag. Load on Bifrost chips by default.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Disable point sprites on Bifrost
Alyssa Rosenzweig [Sat, 31 Oct 2020 14:25:07 +0000 (10:25 -0400)]
panfrost: Disable point sprites on Bifrost

It doesn't look like the lowering in !6473 will land before the branch
point. Let's nop out point sprites in the backend to avoid MMU faults
from creating invalid Midgard-style varyings.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Lower +CUBEFACE2
Alyssa Rosenzweig [Mon, 2 Nov 2020 19:02:06 +0000 (14:02 -0500)]
pan/bi: Lower +CUBEFACE2

We need to inject a *CUBEFACE1 at pack-time so everything works out.
This is a pretty ugly hack but it'll hold us over until we have a real
scheduler, at which point it won't be necessary at all.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Suppress disassembly for internal shaders
Alyssa Rosenzweig [Mon, 2 Nov 2020 18:41:13 +0000 (13:41 -0500)]
pan/bi: Suppress disassembly for internal shaders

Backport of 756441b2979c2664aaa13a67dbdaf5b7e853286e for bifrost.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Lower cube map coordinates
Boris Brezillon [Mon, 2 Nov 2020 18:33:55 +0000 (13:33 -0500)]
pan/bi: Lower cube map coordinates

We need to do the transform specified in the OpenGL spec ourselves, with
some assistance from the hardware.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Hook up cube instructions packing
Boris Brezillon [Wed, 28 Oct 2020 12:27:38 +0000 (13:27 +0100)]
pan/bi: Hook up cube instructions packing

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Split special class in two
Boris Brezillon [Wed, 28 Oct 2020 12:27:07 +0000 (13:27 +0100)]
pan/bi: Split special class in two

Some special instructions are scheduled on the FMA unit, let's add a
new class for this case and rename the old one accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: Move special instruction packing to a separate helper
Boris Brezillon [Wed, 28 Oct 2020 07:56:20 +0000 (08:56 +0100)]
pan/bi: Move special instruction packing to a separate helper

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopan/bi: s/t0/t1/ in bi_disasm_dest_add()
Boris Brezillon [Wed, 28 Oct 2020 08:21:05 +0000 (09:21 +0100)]
pan/bi: s/t0/t1/ in bi_disasm_dest_add()

The ADD unit stores its result in t1 not t0.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Implement v7 texture payloads
Boris Brezillon [Mon, 2 Nov 2020 18:19:23 +0000 (13:19 -0500)]
panfrost: Implement v7 texture payloads

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Add array size to XML
Boris Brezillon [Mon, 2 Nov 2020 18:19:02 +0000 (13:19 -0500)]
panfrost: Add array size to XML

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Suppress Bifrost prefetching
Boris Brezillon [Mon, 2 Nov 2020 18:16:37 +0000 (13:16 -0500)]
panfrost: Suppress Bifrost prefetching

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agopanfrost: Leave push_constants pointer to NULL if there's no uniform
Boris Brezillon [Wed, 28 Oct 2020 08:09:06 +0000 (09:09 +0100)]
panfrost: Leave push_constants pointer to NULL if there's no uniform

This removes a warning in pandecode.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7408>

3 years agomesa: do not throw _mesa_problem when invalid enum is used
Tapani Pälli [Mon, 2 Nov 2020 09:17:56 +0000 (11:17 +0200)]
mesa: do not throw _mesa_problem when invalid enum is used

Like with other getters, invalid enum is dealt in find_value by setting
error to GL_INVALID_ENUM and returning INVALID_TYPE which makes
get_value_size return 0.

Fixes false 'implementation errors' seen with Piglit test:
   ext_external_objects-memory-object-api-errors

   "Mesa 20.3.0-devel implementation error: invalid value type in GetUnsignedBytei_vEXT()
   Please report at https://gitlab.freedesktop.org/mesa/mesa/-/issues"

v2: add assert to get_value_size() (Lionel)

Fixes: e064d660205 ("mesa: implement glGetUnsignedByte{v|i_v}")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eleni Maria Stea <estea@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7403>

3 years agomesa/st: call memobj_destroy only if there is memory imported
Tapani Pälli [Mon, 26 Oct 2020 18:51:25 +0000 (20:51 +0200)]
mesa/st: call memobj_destroy only if there is memory imported

Something may go wrong during import which leaves pointer to null and
when ctx and it's shared state gets destroyed we will attempt to call
memobj_destroy. Instead of forcing every driver to handle it, add check
here.

Fixes crashes with Piglit test:
   ext_external_objects_fd-memory-object-api-errors

Fixes: 99cf9108340 ("mesa/st: Actually free the driver part of memory objects on destruction.")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Eleni Maria Stea <estea@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7403>

3 years agoaco: select v_mul_{hi}_u32_u24 for 24-bit multiplications
Samuel Pitoiset [Mon, 2 Nov 2020 13:29:26 +0000 (14:29 +0100)]
aco: select v_mul_{hi}_u32_u24 for 24-bit multiplications

This is based on the NIR range analysis. v_mul_u32_u24 is VOP2, while
v_mul_lo_u32 is VOP3, so that should reduce codesize.

fossils-db (Vega10):
Totals from 12590 (9.22% of 136546) affected shaders:
SGPRs: 680207 -> 677271 (-0.43%); split: -0.47%, +0.04%
VGPRs: 620840 -> 620856 (+0.00%); split: -0.02%, +0.02%
CodeSize: 37930200 -> 37774088 (-0.41%); split: -0.41%, +0.00%
Instrs: 7463550 -> 7458120 (-0.07%); split: -0.07%, +0.00%
Cycles: 133487628 -> 133427532 (-0.05%); split: -0.05%, +0.00%
VMEM: 2514729 -> 2513426 (-0.05%); split: +0.02%, -0.08%
SMEM: 1533579 -> 1532795 (-0.05%); split: +0.05%, -0.10%
VClause: 231391 -> 231389 (-0.00%); split: -0.01%, +0.00%
SClause: 255352 -> 255294 (-0.02%); split: -0.04%, +0.02%
Copies: 605821 -> 600352 (-0.90%); split: -0.92%, +0.02%
Branches: 133739 -> 133743 (+0.00%); split: -0.00%, +0.00%
PreSGPRs: 351092 -> 348048 (-0.87%)

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7405>

3 years agoaco: store NIR range analysis data to the isel context
Samuel Pitoiset [Mon, 2 Nov 2020 13:01:38 +0000 (14:01 +0100)]
aco: store NIR range analysis data to the isel context

It will be used to optimize some ALU instructions.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7405>

3 years agozink: clamped maxPerStageDescriptorUniformBuffers limits to INT_MAX when stored as...
Duncan Hopkins [Tue, 9 Apr 2019 16:22:53 +0000 (17:22 +0100)]
zink: clamped maxPerStageDescriptorUniformBuffers limits to INT_MAX when stored as uint32_t.

This stops issues if a driver returns a value that is greater than a signed int.
Also make it match many of the other limit versions conversions.
Seen on Radeon drivers, IIRC. gpuinfo.org also reports many GPUs returning 4GB values.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Erik Faye-Lund <erik.faye-lund@collabora.com>

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

3 years agoradv: fix shader caching with NaN fixup workaround
Rhys Perry [Tue, 3 Nov 2020 10:55:14 +0000 (10:55 +0000)]
radv: fix shader caching with NaN fixup workaround

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: 6f21995f986 ("radv: add new drirc option radv_enable_mrt_output_nan_fixup")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7423>

3 years agoradv: fix shader caching with discard->demote workaround
Rhys Perry [Tue, 3 Nov 2020 10:54:59 +0000 (10:54 +0000)]
radv: fix shader caching with discard->demote workaround

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Fixes: bdd75874144 ("radv: use nir_lower_discard_to_demote to work around game bugs")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7423>

3 years agoradv: add some missing radv_{start,stop}_feedback
Rhys Perry [Tue, 27 Oct 2020 14:26:40 +0000 (14:26 +0000)]
radv: add some missing radv_{start,stop}_feedback

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7339>

3 years agoandroid: freedreno: Add freedreno_dev_info.[ch] to Makefile.sources
Marijn Suijten [Mon, 2 Nov 2020 22:13:24 +0000 (23:13 +0100)]
android: freedreno: Add freedreno_dev_info.[ch] to Makefile.sources

Addresses the following linker error when building for Android:

    ld.lld: error: undefined symbol: freedreno_dev_info_init
    >>> referenced by freedreno_screen.c:1001 (external/mesa3d/src/gallium/drivers/freedreno/freedreno_screen.c:1001)
    >>>               freedreno_screen.o:(fd_screen_create) in archive [..]/libmesa_pipe_freedreno_intermediates/libmesa_pipe_freedreno.a

These functions were introduced in a file that was not included in the
Android build yet.  Also sort the list of files alphabetically as
requested in an earlier MR.

Fixes: 4a0bdf47e43 ("freedreno: Introduce common device info struct")
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7411>

3 years agobroadcom/compiler: remove v3d_fs_key depth_enabled field.
Alejandro Piñeiro [Mon, 2 Nov 2020 22:37:54 +0000 (23:37 +0100)]
broadcom/compiler: remove v3d_fs_key depth_enabled field.

It is not used right now, so keeping it adds some noise/confusion.

So far configuring Z test are done through the CFG_BITS. See
v3dX(emit_state) at v3dx_emit.c for v3d, and pack_cfg_bits at
v3dv_pipeline.c for v3dv. There flags like z_updates_enable and others
are filled up.

That key field seems like a leftover coming from using vc4 as
reference, as that driver defines and uses a field with name name.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7421>

3 years agointel/compiler: remove branch weight heuristic
Marcin Ślusarz [Wed, 14 Oct 2020 14:32:55 +0000 (16:32 +0200)]
intel/compiler: remove branch weight heuristic

As a result of this patch, compiler chooses SIMD32 shaders more
frequently.

Current logic is designed to avoid regressions from enabling SIMD32 at
all cost, even though the cases where regression can happen are probably
for smaller draw calls (far away from the camera and though smaller).

In Intel perf CI this patch improves FPS in:
- gfxbench5 alu2:      21.92% (gen9), 23.7%  (gen11)
- synmark OglShMapVsm:  3.26% (gen9),  4.52% (gen11)
- gfxbench5 car chase:  1.34% (gen9),  1.32% (gen11)
No observed regressions there.

In my testing, it also improves FPS in:
- The Talos Principle:   2.9% (gen9)

The other 16 games I tested had very minor changes in performance
(2/3 positive, but not significant enough to list here).

Note: this patch harms synmark OglDrvState (which is not in Intel perf
CI) by ~2.9%, but this benchmark renders multiple scenes from other
workloads (including OglShMapVsm, which is helped in standalone mode)
in tiny rectangles. Rendering so small drastically changes branching
statistics, which favors smaller SIMD modes. I assume this matters
only in micro-benchmarks, as in real workloads more expensive (with
more uniform branching behavior) draw calls dominate.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Acked-by: Francisco Jerez <currojerez@riseup.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7137>

3 years agointel/compiler: use C++ template instead of preprocessor
Marcin Ślusarz [Thu, 29 Oct 2020 19:13:50 +0000 (20:13 +0100)]
intel/compiler: use C++ template instead of preprocessor

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7382>

3 years agoRevert "gallium/dri: fix dri2_from_planar for multiplanar images"
Lucas Stach [Sat, 31 Oct 2020 07:21:15 +0000 (08:21 +0100)]
Revert "gallium/dri: fix dri2_from_planar for multiplanar images"

It breaks some assumptions in the iris driver, leading to crashes.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Tested-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7391>

3 years agotu: Support rasterizerDiscardEnable and RasterizationStreamSelect
Connor Abbott [Wed, 23 Sep 2020 11:36:58 +0000 (13:36 +0200)]
tu: Support rasterizerDiscardEnable and RasterizationStreamSelect

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

3 years agotu: Support geometryStreams
Connor Abbott [Wed, 23 Sep 2020 11:08:37 +0000 (13:08 +0200)]
tu: Support geometryStreams

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

3 years agoutil/bitset: Add a range iterator helper
Connor Abbott [Wed, 23 Sep 2020 11:06:04 +0000 (13:06 +0200)]
util/bitset: Add a range iterator helper

I need this for emitting the SO program for turnip, where we want to
skip over unused slots by manually advancing the counter. freedreno will
also want to use it when it supports multistream streamout.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6962>

3 years agoir3: Support geometry streams
Connor Abbott [Wed, 23 Sep 2020 09:29:28 +0000 (11:29 +0200)]
ir3: Support geometry streams

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

3 years agofreedreno/a6xx: Update SO registers for streams
Connor Abbott [Wed, 23 Sep 2020 08:51:48 +0000 (10:51 +0200)]
freedreno/a6xx: Update SO registers for streams

These seem to be unchanged from a5xx, so a5xx could probably be updated
too.

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

3 years agozink: add VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA for WSI allocations
Iago Toral Quiroga [Fri, 30 Oct 2020 09:44:17 +0000 (10:44 +0100)]
zink: add VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA for WSI allocations

Since Zink doesn't use swapchains to create presentable images, drivers
lose the capacity to identify memory allocations for them, which is a problem
when the underlying platform has special requirements for these, such as
needing to allocate them on a particular device. Including this struct in the
pNext chain, which is the same thing that the Mesa Vulkan WSI code does when
allocating memory for swapchain images, gives drivers a chance to identify
and handle these memory allocations properly.

v2: follow Zink's conventions for pNext chains (Mike)
v3: add scanout parameter for VkImage creation (Daniel)
v4: don't add a dependency on vulkan util (Erik)
v5: include vulkan directory for Zink builds

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> (v2)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7378>

3 years agoetnaviv: move etna_destroy_shader(..) to generic location
Christian Gmeiner [Fri, 30 Oct 2020 18:31:54 +0000 (19:31 +0100)]
etnaviv: move etna_destroy_shader(..) to generic location

Before this change we had two identical etna_destroy_shader
functions - one for tgsi and one for nir.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7397>

3 years agoetnaviv: move etna_dump_shader(..) to generic location
Christian Gmeiner [Fri, 30 Oct 2020 18:26:00 +0000 (19:26 +0100)]
etnaviv: move etna_dump_shader(..) to generic location

Before this change we had two identical etna_dump_shader
functions - one for tgsi and one for nir.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7397>

3 years agoetnaviv: convert from tgsi semantic/index to varying-slot
Christian Gmeiner [Fri, 30 Oct 2020 18:19:31 +0000 (19:19 +0100)]
etnaviv: convert from tgsi semantic/index to varying-slot

Prep work to unify some tgsi and nir compiler functions.
No deqp and piglit regressions.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7397>

3 years agonir: make tgsi_varying_semantic_to_slot(..) public
Christian Gmeiner [Mon, 2 Nov 2020 12:12:11 +0000 (13:12 +0100)]
nir: make tgsi_varying_semantic_to_slot(..) public

I want to use this function for etnaviv's TGSI compiler.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7397>

3 years agoamd/llvm,aco: Replace VLA with alloca
James Park [Tue, 11 Aug 2020 04:00:51 +0000 (21:00 -0700)]
amd/llvm,aco: Replace VLA with alloca

MSVC will never support VLA, so use alloca instead.

Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7157>

3 years agozink: require Vulkan timestamp queries for time query caps
Iago Toral Quiroga [Thu, 29 Oct 2020 10:54:28 +0000 (11:54 +0100)]
zink: require Vulkan timestamp queries for time query caps

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7374>

3 years agotgsi: Initialize tgsi_declaration_dimension padding.
Vinson Lee [Sat, 24 Oct 2020 00:51:47 +0000 (17:51 -0700)]
tgsi: Initialize tgsi_declaration_dimension padding.

Silence this Coverity defect.

Uninitialized scalar variable (UNINIT)
uninit_use: Using uninitialized value dim. Field dim.Padding is uninitialized.

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

3 years agogallium: Remove duplicate resource variable.
Vinson Lee [Tue, 27 Oct 2020 02:55:07 +0000 (19:55 -0700)]
gallium: Remove duplicate resource variable.

Fix defect reported by Coverity Scan.

Evaluation order violation (EVALUATION_ORDER)
write_write_typo: In resource = resource =
ntt_ureg_src_indirect(c, ureg_src_register(TGSI_FILE_IMAGE, 0U),
instr->src[0]), resource is written twice with the same value.

Fixes: 34cc6a804ec9 ("gallium: Add a nir-to-TGSI pass.")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7326>

3 years agonir/validate: Explain why we don't use nir_foreach_block
Jason Ekstrand [Mon, 2 Nov 2020 20:28:01 +0000 (14:28 -0600)]
nir/validate: Explain why we don't use nir_foreach_block

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7409>

3 years agozink: always reset query pools on next query begin
Mike Blumenkrantz [Thu, 10 Sep 2020 20:07:45 +0000 (16:07 -0400)]
zink: always reset query pools on next query begin

this ensures we pull in any flushes that are about to happen if we're
ending the query during a batch flush, which helps us roll over our pending
results

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

3 years agozink: always use query->type for starting/stopping xfb queries
Mike Blumenkrantz [Thu, 20 Aug 2020 14:26:57 +0000 (10:26 -0400)]
zink: always use query->type for starting/stopping xfb queries

we're going to be seeing some overlap here

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

3 years agozink: rework query overflow handling
Mike Blumenkrantz [Tue, 18 Aug 2020 13:07:37 +0000 (09:07 -0400)]
zink: rework query overflow handling

this adds a query field to denote the last point at which a query was api started,
which is then used every time we call in to get_query_result as the starting point

this is important when we want to be able to return the same result set multiple
times

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

3 years agozink: fixup gs/xfb tracking for primitives generated queries
Mike Blumenkrantz [Mon, 17 Aug 2020 17:53:31 +0000 (13:53 -0400)]
zink: fixup gs/xfb tracking for primitives generated queries

need to index by query id here to ensure correct usage

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

3 years agozink: store batch id onto query object at time of start
Mike Blumenkrantz [Mon, 17 Aug 2020 14:58:08 +0000 (10:58 -0400)]
zink: store batch id onto query object at time of start

this is useful for knowing immediately whether a query has results available

for time queries, this ends up being end_query() since that's when the timestamp
is written

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

3 years agozink: also create an xfb query for every primitives generated query
Mike Blumenkrantz [Thu, 30 Jul 2020 18:12:04 +0000 (14:12 -0400)]
zink: also create an xfb query for every primitives generated query

this query behaves differently when xfb is activated, specifically with
regard to vertex streams. it's super clunky, but we need to actually run
both queries and use results based on whether xfb was active during the
query

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

3 years agozink: more correctly handle PIPE_QUERY_PRIMITIVES_GENERATED queries
Mike Blumenkrantz [Tue, 14 Jul 2020 20:11:18 +0000 (16:11 -0400)]
zink: more correctly handle PIPE_QUERY_PRIMITIVES_GENERATED queries

in normal operation we want to be using INPUT_ASSEMBLY_PRIMITIVES_BIT,
but then when we break out the geometry shaders we actually want to
be using GEOMETRY_SHADER_PRIMITIVES_BIT, which means we need to track
whether a query has a gs active for draws

to do this, we keep a list of all these queries with this type and
iterate over it every draw to flag the gs state of the query that's
being drawn to. this works because our ring buffer of batches will
always wait on a fence after a full cycle, meaning there can only ever
be 4 queries with outstanding results

Fixes: e40a77ea5d0 ("zink: use right vulkan type for GL_PRIMITIVES_GENERATED queries")

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

3 years agozink: deduplicate some query result code
Mike Blumenkrantz [Tue, 14 Jul 2020 17:34:09 +0000 (13:34 -0400)]
zink: deduplicate some query result code

no functional changes, just a small simplification

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

3 years agolavapipe: use resource get param.
Dave Airlie [Mon, 7 Sep 2020 23:02:15 +0000 (09:02 +1000)]
lavapipe: use resource get param.

This uses the resource get param to get proper values for image
subresource layouts.

Fixes:
dEQP-VK.image.subresource_layout*

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6639>

3 years agollvmpipe: add resource get param support.
Dave Airlie [Mon, 7 Sep 2020 23:01:45 +0000 (09:01 +1000)]
llvmpipe: add resource get param support.

This implements this resource get param callback and uses it
to return image information for lavapipe.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6639>

3 years agogallium: add a layer stride pipe resource parameter.
Dave Airlie [Mon, 7 Sep 2020 23:01:19 +0000 (09:01 +1000)]
gallium: add a layer stride pipe resource parameter.

This will be used by llvmpipe and lavapipe

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6639>

3 years agogallium: add a level parameter to resource parameter get
Dave Airlie [Mon, 7 Sep 2020 23:00:07 +0000 (09:00 +1000)]
gallium: add a level parameter to resource parameter get

For lavapipe interface to llvmpipe there is a need to retrieve per-level
info, so this seems like the best interface to use for it.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6639>

3 years agozink: call the reset callback not only during a status check
Hoe Hao Cheng [Mon, 2 Nov 2020 17:05:28 +0000 (01:05 +0800)]
zink: call the reset callback not only during a status check

Fixes: 95b9fc41 ("zink: implement pipe_device_reset_callback")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7404>

3 years agoi965: remove prototypes of not-existing functions
Marcin Ślusarz [Wed, 28 Oct 2020 19:19:01 +0000 (20:19 +0100)]
i965: remove prototypes of not-existing functions

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

3 years agointel: remove dead code
Marcin Ślusarz [Wed, 28 Oct 2020 19:17:41 +0000 (20:17 +0100)]
intel: remove dead code

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

3 years agoanv: always annotate memory returned from anv_gem_mmap
Marcin Ślusarz [Wed, 21 Oct 2020 15:51:22 +0000 (17:51 +0200)]
anv: always annotate memory returned from anv_gem_mmap

anv_bo_pool_alloc expects that the memory returned by and_gem_mmap
was annotated using VALGRIND_MALLOCLIKE_BLOCK, but anv_gem_mmap_offset
didn't do that. Move annotation from anv_gem_mmap_legacy to common
code.

Fixes: 4abf0837cdb ("anv: Add support for new MMAP_OFFSET ioctl.")

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

3 years agoturnip: rework android gralloc path so it doesn't call tu_image_create
Jonathan Marek [Wed, 30 Sep 2020 01:27:50 +0000 (21:27 -0400)]
turnip: rework android gralloc path so it doesn't call tu_image_create

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

3 years agoos: Fix open result check.
Vinson Lee [Tue, 27 Oct 2020 23:21:11 +0000 (16:21 -0700)]
os: Fix open result check.

Fix defect reported by Coverity Scan.

Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: f is passed to a parameter that cannot be negative.

CID: 1364709
Fixes: 13fa0513569d ("auxiliary/os: add new os_get_command_line() function")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7344>

3 years agoiris/bufmgr: Handle NULL bufmgr in iris_bufmgr_get_for_fd
Michel Dänzer [Wed, 28 Oct 2020 10:56:27 +0000 (11:56 +0100)]
iris/bufmgr: Handle NULL bufmgr in iris_bufmgr_get_for_fd

iris_bufmgr_create can return NULL, in which case we'd crash in
list_addtail.

Reported by Coverity/clang (for i965, but iris code looks the same).

Fixes: 7557f1605968 ("iris: share buffer managers accross screens")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7335>

3 years agoi965/bufmgr: Handle NULL bufmgr in brw_bufmgr_get_for_fd
Michel Dänzer [Tue, 27 Oct 2020 10:40:05 +0000 (11:40 +0100)]
i965/bufmgr: Handle NULL bufmgr in brw_bufmgr_get_for_fd

brw_bufmgr_create can return NULL, in which case we'd crash in
list_addtail.

Reported by Coverity/clang.

Fixes: 4094558e8643 ("i965: share buffer managers across screens")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7335>

3 years agofreedreno: Use freedreno_dev_info
Connor Abbott [Thu, 29 Oct 2020 10:08:30 +0000 (11:08 +0100)]
freedreno: Use freedreno_dev_info

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

3 years agotu: Use freedreno_dev_info
Connor Abbott [Thu, 29 Oct 2020 10:08:08 +0000 (11:08 +0100)]
tu: Use freedreno_dev_info

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

3 years agofreedreno: Introduce common device info struct
Connor Abbott [Thu, 29 Oct 2020 10:04:22 +0000 (11:04 +0100)]
freedreno: Introduce common device info struct

This will collect all the various alignments, sizes, and magic values
and set them appropriately, replacing the various pieces scattered
throughout the drivers.

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

3 years agonir/large_constants: only search for constant duplicates
Yevhenii Kolesnikov [Wed, 28 Oct 2020 14:56:19 +0000 (16:56 +0200)]
nir/large_constants: only search for constant duplicates

Fixes: b6d47535684 ("nir/large_constants: De-duplicate constants")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3706
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7350>

3 years agonir: Stabilize compact_components sort
James Park [Sun, 1 Nov 2020 23:34:28 +0000 (15:34 -0800)]
nir: Stabilize compact_components sort

Incorporate location_frac into qsort comparison. qsort is not required
to be stable, and MSVC implementation is not.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7399>

3 years agodocs/features: add Vulkan 1.2
Rhys Perry [Mon, 10 Aug 2020 12:31:29 +0000 (13:31 +0100)]
docs/features: add Vulkan 1.2

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6258>

3 years agodocs/features: update unpromoted Vulkan extensions
Rhys Perry [Mon, 10 Aug 2020 12:20:40 +0000 (13:20 +0100)]
docs/features: update unpromoted Vulkan extensions

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6258>

3 years agonir/lower_returns: Append missing phis' sources after "break" insertion
Danylo Piliaiev [Tue, 4 Aug 2020 15:12:47 +0000 (18:12 +0300)]
nir/lower_returns: Append missing phis' sources after "break" insertion

After we lowered `return` into `break` - the control flow is changed and
the block with this change has a new successor, which means that in this
new successor phis should have additional source.

Since the instructions that use phis in the successor are predicated -
it's ok for a new phi source to be undef.

If `return` is lowered in a nested loop, `break` is inserted in the outer
loops, so all new blocks with break require the same changes to phis
described above.

Examples of NIR before lowering:

  block block_0:
  loop {
     block block_1:
     if ssa_2 {
       block block_2:
       return
       // succs: block_6
     } else {
       block block_2:
       break;
       // succs: block_5
     }
     block block_4:
  }
  block block_5:
  // preds: block_3
  vec1 32 ssa_4 = phi block_3: ssa_1
  // succs: block_6
  block block_6:

Here converting return to break should add block_2 to the phis
of block_5.

 block block_0:
 loop {
    block block_1:
    loop {
       block block_2:
       if ssa_2 {
         block block_3:
         return
         // succs: block_8
       } else {
         block block_4:
         break;
         // succs: block_6
       }
       block block_5:
    }
    block block_6:
    break;
    // succs: block_7
 }
 block block_7:
 // preds: block_6
 vec1 32 ssa_4 = phi block_6: ssa_1
 // succs: block_8
 block block_8:

Here converting return to break will insert conditional break in
the outer loop, changing block_6 predcessors.

Cc: <mesa-stable@lists.freedesktop.org>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3322
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3498
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6186>

3 years agozink: implement pipe_device_reset_callback
Hoe Hao Cheng [Tue, 22 Sep 2020 11:50:33 +0000 (19:50 +0800)]
zink: implement pipe_device_reset_callback

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6763>

3 years agov3dv: fix occlusion query inheritance in secondary command buffers
Iago Toral Quiroga [Fri, 30 Oct 2020 08:12:38 +0000 (09:12 +0100)]
v3dv: fix occlusion query inheritance in secondary command buffers

If a secondary command buffer has occlusion query inheritance then
draw calls recorded in it should update an active occlusion query
counter started in the primary command buffer.

If executing the secondary in a primary required to emit jobs and
not just a branch instruction, then we might need to create a new
job for the primary as well, and in that case we would lose the
occlusion query state, so we need to re-emit it at that point so
any additional draw calls recorded into the secondary that is being
executed continue to update the counter.

Fixes:
dEQP-VK.query_pool.concurrent_queries.secondary_command_buffer

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

3 years agov3dv: add support for timestamp queries
Iago Toral Quiroga [Thu, 29 Oct 2020 10:55:23 +0000 (11:55 +0100)]
v3dv: add support for timestamp queries

V3D doesn't provide any means to acquire timestamps from the GPU
so we have to implement these in the CPU.

v2: enable timestampComputeAndGraphics and set timestampPeriod (Piñeiro)

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

3 years agoradeonsi: fix RADEON_FLUSH flags conflicts
Pierre-Eric Pelloux-Prayer [Mon, 26 Oct 2020 16:23:59 +0000 (17:23 +0100)]
radeonsi: fix RADEON_FLUSH flags conflicts

RADEON_FLUSH_TOGGLE_SECURE_SUBMISSION and RADEON_FLUSH_NOOP used the same value.

Fixes: ed3c5fe4694 ("radeonsi: implement GL_INTEL_blackhole_render")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5096>

3 years agodriconf: add disable_protected_content_check option
Pierre-Eric Pelloux-Prayer [Tue, 6 Oct 2020 14:00:55 +0000 (16:00 +0200)]
driconf: add disable_protected_content_check option

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

3 years agoegl/dri2: implement createImageFromDmaBufs3
Pierre-Eric Pelloux-Prayer [Fri, 25 Sep 2020 13:51:06 +0000 (15:51 +0200)]
egl/dri2: implement createImageFromDmaBufs3

And refuse to import image with protected_content enabled.

We don't want a compositor to import an encrypted buffer in a image
without the ProtectedContent attribute enabled, because that will
lead to incorrect display.

Similarly, if the compositor thinks the image is encrypted, we fail
the import if the buffer is not.

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

3 years agodri: introduce createImageFromDmaBufs3
Pierre-Eric Pelloux-Prayer [Fri, 25 Sep 2020 13:49:42 +0000 (15:49 +0200)]
dri: introduce createImageFromDmaBufs3

Extends createImageFromDmaBufs2 with a protected_content flag.

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

3 years agoegl: handle EGL_PROTECTED_CONTENT_EXT for eglImage
Pierre-Eric Pelloux-Prayer [Fri, 12 Jun 2020 13:28:32 +0000 (15:28 +0200)]
egl: handle EGL_PROTECTED_CONTENT_EXT for eglImage

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

3 years agoradeonsi: enable PIPE_CAP_DEVICE_PROTECTED_CONTENT
Pierre-Eric Pelloux-Prayer [Mon, 18 May 2020 15:21:05 +0000 (17:21 +0200)]
radeonsi: enable PIPE_CAP_DEVICE_PROTECTED_CONTENT

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

3 years agoegl: implement EGL_EXT_protected_surface support
Pierre-Eric Pelloux-Prayer [Mon, 11 May 2020 16:26:30 +0000 (18:26 +0200)]
egl: implement EGL_EXT_protected_surface support

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5096>

3 years agoradeonsi: honor PIPE_BIND_PROTECTED
Pierre-Eric Pelloux-Prayer [Tue, 6 Oct 2020 14:21:53 +0000 (16:21 +0200)]
radeonsi: honor PIPE_BIND_PROTECTED

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

3 years agogallium: introduce PIPE_BIND_PROTECTED
Pierre-Eric Pelloux-Prayer [Tue, 6 Oct 2020 14:19:18 +0000 (16:19 +0200)]
gallium: introduce PIPE_BIND_PROTECTED

Resources using this flag will be encrypted (eg using TMZ on radeonsi).

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

3 years agogallium: add new cap PIPE_CAP_DEVICE_PROTECTED_CONTENT
Pierre-Eric Pelloux-Prayer [Mon, 18 May 2020 15:15:55 +0000 (17:15 +0200)]
gallium: add new cap PIPE_CAP_DEVICE_PROTECTED_CONTENT

Will be used to implement EGL_EXT_protected_surface.

Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5096>

3 years agov3dv: expose VK_KHR_maintenance1
Iago Toral Quiroga [Wed, 28 Oct 2020 10:01:40 +0000 (11:01 +0100)]
v3dv: expose VK_KHR_maintenance1

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

3 years agov3dv: implement vkTrimCommandPool
Iago Toral Quiroga [Wed, 28 Oct 2020 09:44:03 +0000 (10:44 +0100)]
v3dv: implement vkTrimCommandPool

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

3 years agov3dv: update assertion to match VK_KHR_maintenance1 semantics
Iago Toral Quiroga [Wed, 28 Oct 2020 08:58:35 +0000 (09:58 +0100)]
v3dv: update assertion to match VK_KHR_maintenance1 semantics

Fixes crashes in:
dEQP-VK.api.copy_and_blit.core.image_to_image.3d_images.*

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

3 years agov3dv: fix base slice selection for copies involving 3D images
Iago Toral Quiroga [Wed, 28 Oct 2020 08:06:02 +0000 (09:06 +0100)]
v3dv: fix base slice selection for copies involving 3D images

For 3D images we should take the slice to copy from or to, from
the Z coordinate of the corresponding offset, not the base array
layer.

Fixes VK_KHR_maintenance1 tests:
dEQP-VK.api.copy_and_blit.core.image_to_image.3d_images.3d_to_2d_by_slices
dEQP-VK.api.copy_and_blit.core.image_to_image.3d_images.2d_to_3d_by_layers

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

3 years agov3dv: add image view debug checks for VK_KHR_maintenance1
Iago Toral Quiroga [Wed, 28 Oct 2020 08:04:42 +0000 (09:04 +0100)]
v3dv: add image view debug checks for VK_KHR_maintenance1

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

3 years agoradv,aco: optimize computing the sample mask for per-sample shading
Samuel Pitoiset [Thu, 29 Oct 2020 15:47:54 +0000 (16:47 +0100)]
radv,aco: optimize computing the sample mask for per-sample shading

I don't know why these values were introduced for but it seems like
we can optimize this by just doing:

gl_SampleMaskIn[0] = (SampleCoverage & (1 << gl_SampleID))

AMDGPU-PRO and AMDVLK apply the same formula to compute the
sample mask when per-sample shading is enabled.

No fossils-db changes.

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

3 years agoradv,aco: adjust the sample mask only if per-sample shading is enabled
Samuel Pitoiset [Thu, 29 Oct 2020 15:39:28 +0000 (16:39 +0100)]
radv,aco: adjust the sample mask only if per-sample shading is enabled

When per-sample shading isn't enabled, we can just load the
samplemask from the hardware which is always the coverage of
the entire pixel/fragment.

fossilds-db (VEGA10):
Totals from 131 (0.10% of 136546) affected shaders:
SGPRs: 5056 -> 5048 (-0.16%)
VGPRs: 2600 -> 2372 (-8.77%)
CodeSize: 115788 -> 112560 (-2.79%)
MaxWaves: 1266 -> 1274 (+0.63%)
Instrs: 20620 -> 20071 (-2.66%)
Cycles: 82416 -> 80220 (-2.66%)
VMEM: 51567 -> 35532 (-31.10%); split: +0.24%, -31.34%
SMEM: 8952 -> 8258 (-7.75%); split: +0.11%, -7.86%
SClause: 1223 -> 1199 (-1.96%); split: -2.62%, +0.65%
Copies: 1247 -> 1124 (-9.86%); split: -10.18%, +0.32%
PreVGPRs: 2112 -> 1981 (-6.20%)

Helps Britannia, Shadow of the Tomb Raider, Warhammer II and Control.

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

3 years agoglsl: drop NMS OpenGL workarounds
Timothy Arceri [Thu, 29 Oct 2020 06:06:44 +0000 (17:06 +1100)]
glsl: drop NMS OpenGL workarounds

No Mans Sky dropped its OpenGL backend on April 16, 2019 in favour
of its Vulkan backend. So here we drop the old OpenGL workarounds.

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

3 years agopanfrost: Add missing alpha-first special formats
Alyssa Rosenzweig [Fri, 30 Oct 2020 18:44:26 +0000 (14:44 -0400)]
panfrost: Add missing alpha-first special formats

Not sure if these come up with OpenGL in practice.

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

3 years agopanfrost: Fix BGR233 component order
Alyssa Rosenzweig [Fri, 30 Oct 2020 18:44:19 +0000 (14:44 -0400)]
panfrost: Fix BGR233 component order

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