platform/upstream/mesa.git
2 years agointel/compiler: Convert to LCSSA and use divergence analysis.
Kenneth Graunke [Tue, 15 Mar 2022 23:25:55 +0000 (16:25 -0700)]
intel/compiler: Convert to LCSSA and use divergence analysis.

We'll use this more shortly.  For now, enable it to separately in case
anything bisects to this.

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

2 years agointel/compiler: Set divergence analysis options
Kenneth Graunke [Fri, 16 Oct 2020 23:05:52 +0000 (16:05 -0700)]
intel/compiler: Set divergence analysis options

Although we don't use divergence analysis yet, we've had several
work-in-progress series that make use of it.  We may as well set
our options so that those series can assume they're in place.

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

2 years agointel/compiler: Implement nir_intrinsic_last_invocation
Kenneth Graunke [Thu, 17 Mar 2022 07:46:21 +0000 (00:46 -0700)]
intel/compiler: Implement nir_intrinsic_last_invocation

We haven't exposed this intrinsic as it doesn't directly correspond to
anything in SPIR-V.  However, it's used internally by some NIR passes,
namely nir_opt_uniform_atomics().

We reuse most of the infrastructure in brw_find_live_channel, but with
LZD/ADD instead of FBL.  A new SHADER_OPCODE_FIND_LAST_LIVE_CHANNEL is
like SHADER_OPCODE_FIND_LIVE_CHANNEL but from the other side.

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

2 years agonir: Teach nir_divergence_analysis about Intel-specific intrinsics
Kenneth Graunke [Wed, 16 Mar 2022 09:14:52 +0000 (02:14 -0700)]
nir: Teach nir_divergence_analysis about Intel-specific intrinsics

- load_reloc_const is just an immediate constant load, it's convergent.

- nir_intrinsic_load_global_const_block_intel should be convergent,
  it says the address must be uniform, and we uniformize the predicate

- Lowered image intrinsics: image_deref_load_param_intel just reads
  information about an image, as long as the image variable is
  convergent it should be too.  load_raw_intel...if the address we
  come up with is convergent, it ought to be as well.

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

2 years agozink: add another radv flake
Mike Blumenkrantz [Fri, 25 Mar 2022 22:41:16 +0000 (18:41 -0400)]
zink: add another radv flake

literally no idea

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

2 years agointel/compiler: Inline TUE map computation into TUE Input lowering
Caio Oliveira [Tue, 15 Feb 2022 00:40:54 +0000 (16:40 -0800)]
intel/compiler: Inline TUE map computation into TUE Input lowering

Refactor since the TUE compute function is simpler now and the
comments make sense being near the lowering.

Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15022>

2 years agointel/compiler: Use nir_var_mem_task_payload
Caio Oliveira [Tue, 15 Feb 2022 00:36:32 +0000 (16:36 -0800)]
intel/compiler: Use nir_var_mem_task_payload

Instead of reusing the in/out slot mechanism, use a separated NIR
variable mode.  This will make easier later to implement staging the
output in shared memory (and storing all at the end to the URB).

Note to get 64-bit type support we currently rely on the
brw_nir_lower_mem_access_bit_sizes() pass.

Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15022>

2 years agoaco: remove 'high' parameter from can_use_opsel()
Daniel Schürmann [Wed, 23 Mar 2022 17:23:29 +0000 (18:23 +0100)]
aco: remove 'high' parameter from can_use_opsel()

No fossil-db changes.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15551>

2 years agoaco/optimizer: fix call to can_use_opsel() in apply_insert()
Daniel Schürmann [Wed, 23 Mar 2022 14:12:09 +0000 (15:12 +0100)]
aco/optimizer: fix call to can_use_opsel() in apply_insert()

The definition index is -1.

Fixes: 54292e99c7844500314bfd623469c65adef954c5 ('aco: optimize 32-bit extracts and inserts using SDWA ')
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15551>

2 years agowsi/x11: xcb_wait_for_special_event failure is an error
Adam Jackson [Thu, 24 Mar 2022 14:49:16 +0000 (10:49 -0400)]
wsi/x11: xcb_wait_for_special_event failure is an error

The only ways that function can return NULL are:

- the xcb connection was closed
- the window for the swapchain was destroyed
- the special event listener was unregistered from another thread
- malloc failure

All of these are permanent errors, the swapchain is no longer in a
usable state, so we should treat this as VK_ERROR_SURFACE_LOST_KHR.

Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15558>

2 years agopan/va: Lower BLEND to call blend shaders
Alyssa Rosenzweig [Thu, 17 Mar 2022 15:47:47 +0000 (11:47 -0400)]
pan/va: Lower BLEND to call blend shaders

Do this as late as possible.

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

2 years agopan/va: Add packing unit tests
Alyssa Rosenzweig [Fri, 19 Nov 2021 20:38:04 +0000 (15:38 -0500)]
pan/va: Add packing unit tests

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

2 years agopan/va: Add shader-db support
Alyssa Rosenzweig [Mon, 2 Aug 2021 16:30:54 +0000 (12:30 -0400)]
pan/va: Add shader-db support

Reports the common subset from Bifrost, as well as Mali offline compiler
style normalized cycle counts.

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

2 years agopan/va: Implement the cycle model
Alyssa Rosenzweig [Mon, 2 Aug 2021 21:11:03 +0000 (17:11 -0400)]
pan/va: Implement the cycle model

Will feed into shader-db reporting, and maybe other things eventually.

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

2 years agopan/va: Test instruction selection lowerings
Alyssa Rosenzweig [Fri, 23 Jul 2021 20:36:04 +0000 (16:36 -0400)]
pan/va: Test instruction selection lowerings

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

2 years agopan/va: Lower branch offsets
Alyssa Rosenzweig [Mon, 26 Jul 2021 22:05:39 +0000 (18:05 -0400)]
pan/va: Lower branch offsets

Logic is lifted from bi_layout.c, adapted to work on instructions (not
clauses) and for Valhall's off-by-one semantic which is annoyingly
different than Bifrost. (But the same as Midgard -- Bifrost was
annoyingly different than Midgard!)

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

2 years agopan/va: Add instruction selection lowering pass
Alyssa Rosenzweig [Fri, 23 Jul 2021 20:35:06 +0000 (16:35 -0400)]
pan/va: Add instruction selection lowering pass

Valhall removes certain instructions from Bifrost, requiring a canonical
lowering.

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

2 years agopan/va: Add constant lowering pass
Alyssa Rosenzweig [Tue, 27 Jul 2021 18:17:14 +0000 (14:17 -0400)]
pan/va: Add constant lowering pass

Valhall has a lookup table for common constants. Add a pass to take
advantage of it, lowering away immediate indices.

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

2 years agopan/va: Validate FAU before packing
Alyssa Rosenzweig [Fri, 23 Jul 2021 15:21:35 +0000 (11:21 -0400)]
pan/va: Validate FAU before packing

These are pre-conditions required for packing.

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

2 years agopan/va: Add FAU validation
Alyssa Rosenzweig [Fri, 23 Jul 2021 15:21:29 +0000 (11:21 -0400)]
pan/va: Add FAU validation

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

2 years agopan/va: Add unit tests for ADD_IMM optimizations
Alyssa Rosenzweig [Thu, 22 Jul 2021 15:59:09 +0000 (11:59 -0400)]
pan/va: Add unit tests for ADD_IMM optimizations

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

2 years agopan/va: Optimize add with imm to ADD_IMM
Alyssa Rosenzweig [Thu, 22 Jul 2021 00:29:54 +0000 (20:29 -0400)]
pan/va: Optimize add with imm to ADD_IMM

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

2 years agopan/va: Add packing routines
Alyssa Rosenzweig [Mon, 19 Jul 2021 19:51:52 +0000 (15:51 -0400)]
pan/va: Add packing routines

Mostly manual since Valhall is regular.

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

2 years agopan/va: Add helpers for swapping bitwise sources
Alyssa Rosenzweig [Tue, 27 Jul 2021 17:24:22 +0000 (13:24 -0400)]
pan/va: Add helpers for swapping bitwise sources

Annoyingly different from Bifrost.

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

2 years agopan/va: Generate header containing enums
Alyssa Rosenzweig [Thu, 24 Mar 2022 21:13:24 +0000 (17:13 -0400)]
pan/va: Generate header containing enums

We already collect enums in the ISA description XML. Export them for use in the
compiler backend, particularly the packing code.

Usually we'd use Mako for templating. In this case, the script is so trivial a
template engine didn't seem worth it. (The obvious version with Mako was about
10 lines longer than just prints and f-strings used here.)

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Suggested-by: Icecream95 <ixn@disroot.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15223>

2 years agopan/va: Build opcode info structures
Alyssa Rosenzweig [Fri, 23 Jul 2021 16:04:13 +0000 (12:04 -0400)]
pan/va: Build opcode info structures

Filled out the new structures from XML.

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

2 years agopan/va: Permit encoding more flags
Alyssa Rosenzweig [Fri, 25 Feb 2022 16:52:41 +0000 (11:52 -0500)]
pan/va: Permit encoding more flags

Missed the first time around.

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

2 years agopan/va: Unify flow control
Alyssa Rosenzweig [Thu, 24 Mar 2022 22:08:27 +0000 (18:08 -0400)]
pan/va: Unify flow control

Group together dependency waits and flow control into a single enum. This
simplifies the code, clarifies some detail, and ensures consistency moving
forward.

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

2 years agopan/va: Add Bifrost-style LD_VAR instructions
Alyssa Rosenzweig [Thu, 24 Mar 2022 00:29:08 +0000 (20:29 -0400)]
pan/va: Add Bifrost-style LD_VAR instructions

For use in the legacy non-MALLOC_IDVS flow. Especially useful in blit shaders.

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

2 years agopan/va: Add LD_VAR_BUF instructions
Alyssa Rosenzweig [Wed, 23 Mar 2022 15:57:52 +0000 (11:57 -0400)]
pan/va: Add LD_VAR_BUF instructions

Like LD_VAR_BUF_IMM but indirect.

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

2 years agopan/va: Add ST_TILE instruction
Alyssa Rosenzweig [Wed, 23 Mar 2022 20:45:35 +0000 (16:45 -0400)]
pan/va: Add ST_TILE instruction

Encoded like LD_TILE, required for some MSAA blend shaders.

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

2 years agopan/bi: Rename I->action to I->flow
Alyssa Rosenzweig [Thu, 24 Mar 2022 22:10:23 +0000 (18:10 -0400)]
pan/bi: Rename I->action to I->flow

For consistency with the Valhall ISA.

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

2 years agopan/bi: Model LD_VAR_BUF instructions
Alyssa Rosenzweig [Wed, 23 Mar 2022 15:57:11 +0000 (11:57 -0400)]
pan/bi: Model LD_VAR_BUF instructions

These are indirect versions of LD_VAR_BUF_IMM, taking their index in bytes. Used
for indirect varying loads (the NIR lowering is inefficient).

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

2 years agopan/bi: Augment ST_TILE with register format
Alyssa Rosenzweig [Wed, 23 Mar 2022 21:20:33 +0000 (17:20 -0400)]
pan/bi: Augment ST_TILE with register format

To model its Valhall incarnation.

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

2 years agopan/bi: Check return addresses in blend shaders
Alyssa Rosenzweig [Thu, 17 Mar 2022 16:31:28 +0000 (12:31 -0400)]
pan/bi: Check return addresses in blend shaders

Required on Valhall, where jumping to 0x0 doesn't automatically terminate the
program. Luckily the check is free there too.

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

2 years agopan/bi: Allow branch_offset on BLEND
Alyssa Rosenzweig [Thu, 17 Mar 2022 16:15:37 +0000 (12:15 -0400)]
pan/bi: Allow branch_offset on BLEND

Required to model BLEND accurately on Valhall, where it encodes a special
relative branch... Midgard style!

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

2 years agopan/bi: Model Valhall-style A(CMP)XCHG
Alyssa Rosenzweig [Wed, 23 Mar 2022 02:30:11 +0000 (22:30 -0400)]
pan/bi: Model Valhall-style A(CMP)XCHG

Handled consistently with computational atomics.

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

2 years agopan/bi: Add ATOM_RETURN pseudo-instruction
Alyssa Rosenzweig [Wed, 23 Mar 2022 01:53:04 +0000 (21:53 -0400)]
pan/bi: Add ATOM_RETURN pseudo-instruction

Allows modeling Valhall's atomics better.

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

2 years agopan/bi: Rename PATOM_C to ATOM
Alyssa Rosenzweig [Wed, 23 Mar 2022 01:47:27 +0000 (21:47 -0400)]
pan/bi: Rename PATOM_C to ATOM

This is basically what's native on Valhall. Use the Valhall naming for the
pseudo-instruction on Bifrost for consistency.

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

2 years agopan/bi: Gate late DCE/CSE on "optimize"
Alyssa Rosenzweig [Wed, 23 Mar 2022 13:22:40 +0000 (09:22 -0400)]
pan/bi: Gate late DCE/CSE on "optimize"

Otherwise we can end up with unlowered ATOM.i32 on Valhall.

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

2 years agopan/bi: Use consistent modifier lists in packing
Alyssa Rosenzweig [Wed, 23 Mar 2022 22:12:31 +0000 (18:12 -0400)]
pan/bi: Use consistent modifier lists in packing

If there are modifiers only used by pseudo instructions, not the real
instructions, bi_packer can get out-of-sync with bi_opcodes, causing
hard-to-debug issues. Do the stupid-simple thing to ensure this doesn't happen.

This may be a temporary issue, depending whether ISA.xml and the IR get split
out for better Valhall support.

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

2 years agonouveau/nir: Enable nir_opt_move/sink.
Emma Anholt [Thu, 24 Mar 2022 05:13:20 +0000 (22:13 -0700)]
nouveau/nir: Enable nir_opt_move/sink.

NIR load_consts/inputs tend to happen together at the top of the program.
In the TGSI backend the loads got emitted at use time, while the NIR
backend was emitting the loads at load intrinsic time.  By sinking the
intrinsics, we can greatly reduce register pressure.

nv92 NIR results:

total local in shared programs: 2024 -> 2020 (-0.20%)
local in affected programs: 4 -> 0
total gpr in shared programs: 790424 -> 735455 (-6.95%)
gpr in affected programs: 215968 -> 160999 (-25.45%)
total instructions in shared programs: 6058339 -> 6051208 (-0.12%)
instructions in affected programs: 410795 -> 403664 (-1.74%)
total bytes in shared programs: 41820104 -> 41660304 (-0.38%)
bytes in affected programs: 7147296 -> 6987496 (-2.24%)

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

2 years agopvr: Use vk_common_GetDeviceQueue API.
Rajnesh Kanwal [Thu, 10 Mar 2022 13:01:27 +0000 (13:01 +0000)]
pvr: Use vk_common_GetDeviceQueue API.

Removes pvr_GetDeviceQueue implementation. As we are now
using the common vk_queue structure as a base for pvr_queue,
we can use vk_common_GetDeviceQueue implementation instead.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15574>

2 years agodzn: Compile-test the driver
Boris Brezillon [Fri, 28 Jan 2022 12:32:46 +0000 (04:32 -0800)]
dzn: Compile-test the driver

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14766>

2 years agomicrosoft: Initial vulkan-on-12 driver
Erik Faye-Lund [Thu, 24 Jun 2021 11:09:35 +0000 (13:09 +0200)]
microsoft: Initial vulkan-on-12 driver

This is Dozen, the Vulkan on DirectX 12 driver. Not to be confused with
DirectEggs.

This is an early prototype, and not meant to be upstreamed as-is.

Co-Authored-by: Boris Brezillon <boris.brezillon@collabora.com>
Co-Authored-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Co-Authored-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Co-Authored-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14766>

2 years agomicrosoft/spirv_to_dxil: Add missing ralloc_free
Enrico Galli [Tue, 8 Feb 2022 23:08:01 +0000 (15:08 -0800)]
microsoft/spirv_to_dxil: Add missing ralloc_free

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14766>

2 years agovulkan/util: Make STACK_ARRAY() work for arrays of pointers
Boris Brezillon [Wed, 16 Mar 2022 09:21:39 +0000 (02:21 -0700)]
vulkan/util: Make STACK_ARRAY() work for arrays of pointers

And add an explicit cast on the pointer returned by malloc() to
make C++ happy.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14766>

2 years agovulkan/image: Make MSVC C++ compiler happy
Boris Brezillon [Fri, 25 Mar 2022 12:17:21 +0000 (05:17 -0700)]
vulkan/image: Make MSVC C++ compiler happy

Fix 'error C4576: a parenthesized type followed by an initializer
list is a non-standard explicit type conversion syntax' errors by
declaring an actual variable and returning it in
vk_image_view_subresource_range().

All those MSVC/c++ related-constraints are quite annoying to be honest,
but it looks like the D3D12 headers have been updated to plain C
recently, which will allow us to write the driver in C, and hopefully
get all this sort of issues behind us.

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14766>

2 years agozink: add anv cts skips from waiver
Mike Blumenkrantz [Fri, 25 Mar 2022 14:15:48 +0000 (10:15 -0400)]
zink: add anv cts skips from waiver

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

2 years agozink: update radv fails
Mike Blumenkrantz [Fri, 25 Mar 2022 12:58:15 +0000 (08:58 -0400)]
zink: update radv fails

this should be the exact current baseline

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

2 years agopvr: Implement vkCreateSampler and vkDestroySampler APIs.
Rajnesh Kanwal [Thu, 17 Feb 2022 09:45:18 +0000 (09:45 +0000)]
pvr: Implement vkCreateSampler and vkDestroySampler APIs.

Implements vkCreateSampler and vkDestroySampler APIs.

Also fixes maxSamplerLodBias value from 15.0f to 16.0f
as it's the max supported by our hardware.

Also changing maxSamplerAnisotropy from 16.0f to 1.0f to
temporarily disable anisotropy as we are missing software
support for it.

Signed-off-by: Rajnesh Kanwal <rajnesh.kanwal@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15557>

2 years agovulkan/util: Get rid of VK_OUTARRAY_MAKE()
Boris Brezillon [Wed, 23 Mar 2022 13:09:50 +0000 (14:09 +0100)]
vulkan/util: Get rid of VK_OUTARRAY_MAKE()

Get rid of VK_OUTARRAY_MAKE() so people don't get tempted to
use it and produce code that doesn't compile with MSVC, which
doesn't support typeof().

Suggested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15522>

2 years agovulkan/wsi: Stop using VK_OUTARRAY_MAKE()
Boris Brezillon [Wed, 23 Mar 2022 13:06:00 +0000 (14:06 +0100)]
vulkan/wsi: Stop using VK_OUTARRAY_MAKE()

We're trying to replace VK_OUTARRAY_MAKE() by VK_OUTARRAY_MAKE_TYPED()
so people don't get tempted to use it and make things incompatible with
MSVC (which doesn't support typeof()).

Suggested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15522>

2 years agovulkan/device_select: Stop using VK_OUTARRAY_MAKE()
Boris Brezillon [Wed, 23 Mar 2022 12:59:40 +0000 (13:59 +0100)]
vulkan/device_select: Stop using VK_OUTARRAY_MAKE()

We're trying to replace VK_OUTARRAY_MAKE() by VK_OUTARRAY_MAKE_TYPED()
so people don't get tempted to use it and make things incompatible with
MSVC (which doesn't support typeof()).

Suggested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15522>

2 years agovenus: Stop using VK_OUTARRAY_MAKE()
Boris Brezillon [Wed, 23 Mar 2022 12:57:41 +0000 (13:57 +0100)]
venus: Stop using VK_OUTARRAY_MAKE()

We're trying to replace VK_OUTARRAY_MAKE() by VK_OUTARRAY_MAKE_TYPED()
so people don't get tempted to use it and make things incompatible with
MSVC (which doesn't support typeof()).

Suggested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15522>

2 years agopanvk: Stop using VK_OUTARRAY_MAKE()
Boris Brezillon [Wed, 23 Mar 2022 12:54:26 +0000 (13:54 +0100)]
panvk: Stop using VK_OUTARRAY_MAKE()

We're trying to replace VK_OUTARRAY_MAKE() by VK_OUTARRAY_MAKE_TYPED()
so people don't get tempted to use it and make things incompatible with
MSVC (which doesn't support typeof()).

Suggested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15522>

2 years agoanv: Stop using VK_OUTARRAY_MAKE()
Boris Brezillon [Wed, 23 Mar 2022 12:50:34 +0000 (13:50 +0100)]
anv: Stop using VK_OUTARRAY_MAKE()

We're trying to replace VK_OUTARRAY_MAKE() by VK_OUTARRAY_MAKE_TYPED()
so people don't get tempted to use it and make things incompatible with
MSVC (which doesn't support typeof()).

Suggested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15522>

2 years agopvr: Stop using VK_OUTARRAY_MAKE()
Boris Brezillon [Wed, 23 Mar 2022 12:40:46 +0000 (13:40 +0100)]
pvr: Stop using VK_OUTARRAY_MAKE()

We're trying to replace VK_OUTARRAY_MAKE() by VK_OUTARRAY_MAKE_TYPED()
so people don't get tempted to use it and make things incompatible with
MSVC (which doesn't support typeof()).

Suggested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15522>

2 years agoturnip: Stop using VK_OUTARRAY_MAKE()
Boris Brezillon [Wed, 23 Mar 2022 12:37:47 +0000 (13:37 +0100)]
turnip: Stop using VK_OUTARRAY_MAKE()

We're trying to replace VK_OUTARRAY_MAKE() by VK_OUTARRAY_MAKE_TYPED()
so people don't get tempted to use it and make things incompatible with
MSVC (which doesn't support typeof()).

Suggested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15522>

2 years agov3dv: Stop using VK_OUTARRAY_MAKE()
Boris Brezillon [Wed, 23 Mar 2022 12:28:36 +0000 (13:28 +0100)]
v3dv: Stop using VK_OUTARRAY_MAKE()

We're trying to replace VK_OUTARRAY_MAKE() by VK_OUTARRAY_MAKE_TYPED()
so people don't get tempted to use it and make things incompatible with
MSVC (which doesn't support typeof()).

Suggested-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15522>

2 years agointel/fs: Fix IsHelperInvocation for the case no discard/demote are used
Caio Oliveira [Wed, 16 Mar 2022 00:04:04 +0000 (17:04 -0700)]
intel/fs: Fix IsHelperInvocation for the case no discard/demote are used

Use emit_predicate_on_sample_mask() helper that does check where to
get the correct mask depending on whether discard/demote was used or
not.

Fixes: 45f5db5a84a ("intel/fs: Implement "demote to helper invocation"")
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15400>

2 years agointel/fs: Initialize the sample mask in flags register when using demote
Caio Oliveira [Wed, 16 Mar 2022 00:15:17 +0000 (17:15 -0700)]
intel/fs: Initialize the sample mask in flags register when using demote

Without this change, a check for "is helper invocation" could read
uninitialized values.

Fixes: 45f5db5a84a ("intel/fs: Implement "demote to helper invocation"")
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15400>

2 years agonir: Use const for nir_shader_get_entrypoint(..)
Christian Gmeiner [Sun, 13 Mar 2022 11:40:24 +0000 (12:40 +0100)]
nir: Use const for nir_shader_get_entrypoint(..)

nir_shader_get_entrypoint(..) should not modify the passed nir_shader
object. Enforce this by marking shader paramenter as const.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15362>

2 years agomesa/st: add special casing for pointsize constant updating during validate
Mike Blumenkrantz [Fri, 25 Mar 2022 01:45:32 +0000 (21:45 -0400)]
mesa/st: add special casing for pointsize constant updating during validate

the previous method of using affected_states to trigger constant updates
was ineffectual in the scenario where a ubo pointsize was needed on
the first time a non-precompiled shader was used after being the not-last
vertex stage:

* have vs+gs -> gs precompiles with pointsize lowering -> gs constants get updated
* remove gs -> vs was precompiled without pointsize lowering -> vs constants broken

now just do a quick check as in st_atom_shader.c and set the flag manually to
ensure the update is done correctly every time

cc: mesa-stable

fixes #6207

fixes (radv):
KHR-GL46.texture_cube_map_array.image_op_fragment_sh
KHR-GL46.texture_cube_map_array.sampling
KHR-GL46.texture_cube_map_array.texture_size_fragment_sh
KHR-GL46.constant_expressions*

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15570>

2 years agozink: update anv icl ci list
Mike Blumenkrantz [Fri, 25 Mar 2022 01:22:09 +0000 (21:22 -0400)]
zink: update anv icl ci list

praise be to dynamic state fixes!

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

2 years agozink: flush clears before toggling color write
Mike Blumenkrantz [Thu, 24 Mar 2022 21:31:36 +0000 (17:31 -0400)]
zink: flush clears before toggling color write

ensure these sync up onto the expected buffers

Fixes: 3892c133811 ("zink: add an alternate path for EXT_color_write_enable usage")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15568>

2 years agozink: fix up color_write_enable workaround
Mike Blumenkrantz [Thu, 24 Mar 2022 19:44:02 +0000 (15:44 -0400)]
zink: fix up color_write_enable workaround

this needs to only swizzle to dummy surfaces if it's the workaround,
not just if color_write_enable is active

Fixes: 3892c133811 ("zink: add an alternate path for EXT_color_write_enable usage")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15568>

2 years agofreedreno/ci: Update a306 expectations
Rob Clark [Fri, 25 Mar 2022 00:11:44 +0000 (17:11 -0700)]
freedreno/ci: Update a306 expectations

These have started to flakey UnexpectedPass somewhere along the way.

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

2 years agopipe-loader: Try loading freedreno for virtgpu device
Rob Clark [Wed, 2 Feb 2022 19:53:36 +0000 (11:53 -0800)]
pipe-loader: Try loading freedreno for virtgpu device

Freedreno will check if the virtgpu supports the pass-thru context, and
if not will bail, falling back to virgl.

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

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14900>

2 years agofreedreno/drm: Add virtio backend
Rob Clark [Wed, 2 Feb 2022 18:56:26 +0000 (10:56 -0800)]
freedreno/drm: Add virtio backend

Add a new backend to enable using native driver in a VM guest, via a new
virtgpu context type which (indirectly) makes host kernel interface
available in guest and handles the details of mapping buffers to guest,
etc.

Note that fence-fd's are currently a bit awkward, in that they get
signaled by the guest kernel driver (drm/virtio) once virglrenderer in
the host has processed the execbuf, not when host kernel has signaled
the submit fence.  For passing buffers to the host (virtio-wl) the egl
context in virglrenderer is used to create a fence on the host side.
But use of out-fence-fd's in guest could have slightly unexpected
results.  For this reason we limit all submitqueues to default priority
(so they cannot be preepmted by host egl context).  AFAICT virgl and
venus have a similar problem, which will eventually be solveable once we
have RESOURCE_CREATE_SYNC.

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

2 years agofreedreno/drm: Reorder device destroy
Rob Clark [Fri, 18 Mar 2022 21:34:21 +0000 (14:34 -0700)]
freedreno/drm: Reorder device destroy

Call backend specific cleanup fxn earlier.  This is needed if the
backend has things like bo's to delete, otherwise the handle_table
will already be destroyed causing problems in bo_del()

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

2 years agofreedreno/drm: Extract out "softpin" submit/ringbuffer base class
Rob Clark [Tue, 15 Mar 2022 00:14:59 +0000 (17:14 -0700)]
freedreno/drm: Extract out "softpin" submit/ringbuffer base class

We are going to want basically the identical thing, other than
flush_submit_list, for virtio backend.  Now that we've moved various
other dependencies into the base classes, extract out an abstract base
class for submit/ringbuffer.

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

2 years agofreedreno/drm: Move ring_pool slab parent to base
Rob Clark [Mon, 14 Mar 2022 23:56:55 +0000 (16:56 -0700)]
freedreno/drm: Move ring_pool slab parent to base

Prep to move most of sp submit/ringbuffer to something that can be
re-used by virtio backend.

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

2 years agofreedreno/drm: Move bo idx to base
Rob Clark [Mon, 14 Mar 2022 23:31:00 +0000 (16:31 -0700)]
freedreno/drm: Move bo idx to base

The virtio backend will want this too, and it will make it easier to
share most of the submit/ringbuffer implementation with the virtio
backend.

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

2 years agofreedreno/drm: Move submit_queue to base
Rob Clark [Mon, 14 Mar 2022 23:23:08 +0000 (16:23 -0700)]
freedreno/drm: Move submit_queue to base

The virtio backend will want this too.

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

2 years agofreedreno/drm: Avoid CPU_PREP ioctl if bo is idle
Rob Clark [Thu, 10 Feb 2022 17:31:16 +0000 (09:31 -0800)]
freedreno/drm: Avoid CPU_PREP ioctl if bo is idle

With userspace fences, if we know definitely that the buffer is idle
(which implies that it is not shared with other processes, etc), then
skip the ioctl.

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

2 years agofreedreno/drm: Add fd_bo_upload()
Rob Clark [Wed, 9 Feb 2022 19:02:21 +0000 (11:02 -0800)]
freedreno/drm: Add fd_bo_upload()

There are some buffers that we mmap just to write to them a single time.
Add the possibility of the drm backend to provide an alternate upload
path to avoid these mmap's.

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

2 years agofreedreno/drm: Add FD_BO_SHARED hint
Rob Clark [Sun, 6 Feb 2022 17:22:59 +0000 (09:22 -0800)]
freedreno/drm: Add FD_BO_SHARED hint

With the virtio backend we will need to pass an extra flag when
allocating buffers that will be shared cross-device (such as with
virtio-wl for passing between host and guest)

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

2 years agofreedreno/drm: Add FD_BO_NOMAP hint
Rob Clark [Fri, 4 Feb 2022 19:36:40 +0000 (11:36 -0800)]
freedreno/drm: Add FD_BO_NOMAP hint

Add a hint for buffers that we won't need to mmap.  With the virtio
backend, virglrenderer needs to create a dmabuf fd for mapping into
the host, which we want to avoid when possible.

Low hanging fruit is to use this hint for anything tiled/ubwc.  There
are probably more bo's that can be flagged as such.

TODO add fd_bo_upload() for memcpy to bo.. this would be useful for
uploads, for example, shaders which we just write once and never touch
again.. for virtio this could be implemented with a TRANSFER_TO_HOST
ioctl.

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

2 years agofreedreno/drm: Rework bo creation path
Rob Clark [Fri, 4 Feb 2022 00:00:09 +0000 (16:00 -0800)]
freedreno/drm: Rework bo creation path

Decoupling handle and fd_bo creation simplifies things for "normal" drm
drivers, avoiding duplication for the create vs import paths.  But this
is awkward for the virtio backend when wants to do multiple things in
the same guest<->host round trip.

So instead, split the paths in the interface backend and move the code
sharing for the two different paths into the msm backend itself.

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

2 years agofreedreno/drm: Add fd_device_open() helper
Rob Clark [Wed, 2 Feb 2022 17:46:55 +0000 (09:46 -0800)]
freedreno/drm: Add fd_device_open() helper

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

2 years agofreedreno/drm: Split msm backend into subdir
Rob Clark [Wed, 2 Feb 2022 17:45:57 +0000 (09:45 -0800)]
freedreno/drm: Split msm backend into subdir

Let's keep things a bit better organized when we add a new backend.

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

2 years agozink: update radv ci
Mike Blumenkrantz [Thu, 24 Mar 2022 21:32:25 +0000 (17:32 -0400)]
zink: update radv ci

bunch of these I just removed by mistake

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

2 years agovenus: update protocol to remove redundant decoders
Yiwei Zhang [Wed, 23 Mar 2022 22:32:11 +0000 (22:32 +0000)]
venus: update protocol to remove redundant decoders

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

2 years agovenus: Increase the base sleep of vn_relax
Renato Pereyra [Thu, 24 Mar 2022 23:12:43 +0000 (16:12 -0700)]
venus: Increase the base sleep of vn_relax

Based on profiling, these 10us sleeps are behaving closer to ~60us
and causing higher-than-necessary CPU overhead. 120us seems like a
good balance between latency management and overhead.

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

2 years agolavapipe: Delete render passes
Jason Ekstrand [Wed, 16 Mar 2022 19:31:20 +0000 (14:31 -0500)]
lavapipe: Delete render passes

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

2 years agoc11: Fixes unused parameter warnings
Yonggang Luo [Thu, 24 Mar 2022 16:59:24 +0000 (00:59 +0800)]
c11: Fixes unused parameter warnings

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15553>

2 years agoutil: Fixes unused parameter warnings
Yonggang Luo [Fri, 18 Feb 2022 19:38:29 +0000 (03:38 +0800)]
util: Fixes unused parameter warnings

The compiler warning:
```
../src/mesa/util/u_thread.h: In function 'util_thread_get_time_nano':
../src/mesa/util/u_thread.h:239:34: warning: unused parameter 'thread' [-Wunused-parameter]
  239 | util_thread_get_time_nano(thrd_t thread)
      |                           ~~~~~~~^~~~~~
```

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15553>

2 years agozink: update resource layout in copy_scanout
Dave Airlie [Thu, 24 Mar 2022 06:43:57 +0000 (16:43 +1000)]
zink: update resource layout in copy_scanout

This transitions the resource to TRANSFER_SRC_OPTIMAL, but
never updates the res->layout field, so subsequent transitions
are wrong and throw validation errors.

UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout(ERROR / SPEC): msgNum: 1303270965 - Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout ] Object 0: handle = 0x6660f60, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x4dae5635 | vkQueueSubmit(): pSubmits[0].pCommandBuffers[0] command buffer VkCommandBuffer 0x6660f60[] expects VkImage 0x2f000000002f[] (subresource: aspectMask 0x1 array layer 0, mip level 0) to be in layout VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL--instead, current layout is VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL.

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

2 years agolavapipe: Use vk_image_subresource_layer/level_count
Jason Ekstrand [Thu, 17 Mar 2022 18:10:06 +0000 (13:10 -0500)]
lavapipe: Use vk_image_subresource_layer/level_count

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

2 years agolavapipe: Use vk_image_view
Jason Ekstrand [Thu, 17 Mar 2022 18:07:22 +0000 (13:07 -0500)]
lavapipe: Use vk_image_view

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

2 years agovulkan: Add a vk_image_view_subresource_range helper
Jason Ekstrand [Wed, 23 Mar 2022 22:52:55 +0000 (17:52 -0500)]
vulkan: Add a vk_image_view_subresource_range helper

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

2 years agovulkan/runtime: Add vk_cmd_queue.h to idep_vulkan_runtime_headers
Boris Brezillon [Thu, 24 Mar 2022 09:11:56 +0000 (10:11 +0100)]
vulkan/runtime: Add vk_cmd_queue.h to idep_vulkan_runtime_headers

If we don't do that, meson might start compiling source files
including vk_command_buffer.h which in turn includes vk_cmd_queue.h
before this file is even generated, and we end up with errors like
that https://gitlab.freedesktop.org/mesa/mesa/-/jobs/20157936#L1119.

Fixes: 6bd8a3c7e434 ("vulkan/runtime: Add a vk_cmd_queue object to vk_command_buffer")
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15546>

2 years agovenus: add VK_EXT_extended_dynamic_state2 extension
Igor Torrente [Thu, 17 Mar 2022 13:30:03 +0000 (10:30 -0300)]
venus: add VK_EXT_extended_dynamic_state2 extension

Implements all the necessary code in the device initialization
and extension functions.

Signed-off-by: Igor Torrente <igor.torrente@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15428>

2 years agopvr: ci: Initial freedesktop CI integration
Matt Coster [Mon, 7 Mar 2022 11:25:17 +0000 (11:25 +0000)]
pvr: ci: Initial freedesktop CI integration

This patch adds the PowerVR driver to the following shared builds:

 * debian-arm64
 * debian-clang
 * debian-release
 * debian-vulkan
 * fedora-release

It also adds the associated "tools" to these builds:

 * debian-arm64-build-test
 * debian-release (already uses -Dtools=all)
 * fedora-release

And removes them from these builds by expanding -Dtools=all:

 * debian-gallium

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15284>

2 years agopvr: Gate offline compiler build behind -Dtools=imagination
Matt Coster [Mon, 7 Mar 2022 14:45:51 +0000 (14:45 +0000)]
pvr: Gate offline compiler build behind -Dtools=imagination

This matches the behavior of e.g. panfrost's bifrost_compiler target.

Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15284>

2 years agopvr: do not use fallthrough for unreachable code
Erik Faye-Lund [Wed, 23 Mar 2022 17:34:26 +0000 (18:34 +0100)]
pvr: do not use fallthrough for unreachable code

unreachable() doesn't lead to executing the code that follows it,
neither in debug nor release builds. So falling through doesn't make any
sense.

This fixes a compile-error on clang.

Let's move the default-block to the end to make it clearer that there's
no intended fallthrough.

Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15531>

2 years agopvr: do not use fallthrough for unreachable code
Erik Faye-Lund [Wed, 23 Mar 2022 17:34:26 +0000 (18:34 +0100)]
pvr: do not use fallthrough for unreachable code

unreachable() doesn't lead to executing the code that follows it,
neither in debug nor release builds. So falling through doesn't make any
sense.

This fixes a compile-error on clang.

Let's move the default-block to the end to make it clearer that there's
no intended fallthrough.

Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15531>

2 years agoanv: don't store sample location sample count
Lionel Landwerlin [Tue, 15 Mar 2022 21:35:24 +0000 (23:35 +0200)]
anv: don't store sample location sample count

This information should match the current pipeline sample count.

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

2 years agoanv: fix dynamic sample locations on Gen7/7.5
Lionel Landwerlin [Tue, 15 Mar 2022 22:25:17 +0000 (00:25 +0200)]
anv: fix dynamic sample locations on Gen7/7.5

3DSTATE_MULTISAMPLE should be baked into the pipeline if not dynamic.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 27ee40f4c9d8 ("anv: Add support for sample locations")
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15310>