platform/upstream/mesa.git
3 years agoradv: Add copy/serialization info to accel struct headers.
Bas Nieuwenhuizen [Wed, 1 Sep 2021 10:50:00 +0000 (12:50 +0200)]
radv: Add copy/serialization info to accel struct headers.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12840>

3 years agoradv: Add an indirect dispatch struct to the header.
Bas Nieuwenhuizen [Tue, 31 Aug 2021 00:53:17 +0000 (02:53 +0200)]
radv: Add an indirect dispatch struct to the header.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12840>

3 years agoradv: Add an internal indirect dispatch command.
Bas Nieuwenhuizen [Tue, 31 Aug 2021 23:29:40 +0000 (01:29 +0200)]
radv: Add an internal indirect dispatch command.

Avoiding the entire buffer dance.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12840>

3 years agoradv: Add DMA buffer update function for internal use.
Bas Nieuwenhuizen [Fri, 24 Sep 2021 00:30:38 +0000 (02:30 +0200)]
radv: Add DMA buffer update function for internal use.

Only split out the DMA part because that doesn't need the BO.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12840>

3 years agozink: break out surface info init to helper function
Mike Blumenkrantz [Wed, 29 Sep 2021 17:34:39 +0000 (13:34 -0400)]
zink: break out surface info init to helper function

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13126>

3 years agozink: make a local resource var in fb_clears_apply_internal
Mike Blumenkrantz [Wed, 29 Sep 2021 13:13:56 +0000 (09:13 -0400)]
zink: make a local resource var in fb_clears_apply_internal

no functional changes

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13126>

3 years agopanfrost/ci: Run Piglit's quick_gl tests on G52
Tomeu Vizoso [Fri, 24 Sep 2021 06:21:15 +0000 (08:21 +0200)]
panfrost/ci: Run Piglit's quick_gl tests on G52

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13063>

3 years agoci: Rebuild kernel with Amlogic KMS support
Tomeu Vizoso [Fri, 24 Sep 2021 08:45:38 +0000 (10:45 +0200)]
ci: Rebuild kernel with Amlogic KMS support

So we can run Xorg for Piglit tests.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13063>

3 years agoetnaviv: add etna_lookup_or_create_screen(..)
Christian Gmeiner [Thu, 16 Sep 2021 17:42:58 +0000 (19:42 +0200)]
etnaviv: add etna_lookup_or_create_screen(..)

It is an improved version of etna_drm_screen_create_renderonly(..)
which also needs the gpu fd. Also switch etna_drm_screen_create(..)
and etna_drm_screen_create_renderonly(..) to use the new function.

This follows how other driver's winsys code looks like and fixes a
crash I when running piglit with PIGLIT_PLATFORM="gbm".

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Philipp Zabel p.zabel@pengutronix.de
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12904>

3 years agoetnaviv: extend screen_create(..) with gpu_fd
Christian Gmeiner [Thu, 16 Sep 2021 17:36:05 +0000 (19:36 +0200)]
etnaviv: extend screen_create(..) with gpu_fd

Decouples gpu fd and renderonly object. This opens the door for
some simplifications.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Philipp Zabel p.zabel@pengutronix.de
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12904>

3 years agoetnaviv: allow screen creation with NULL renderonly object
Christian Gmeiner [Thu, 16 Sep 2021 17:08:06 +0000 (19:08 +0200)]
etnaviv: allow screen creation with NULL renderonly object

Prep change for winsys cleanups.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Philipp Zabel p.zabel@pengutronix.de
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12904>

3 years agoetnaviv: move drm version readout to drm layer
Christian Gmeiner [Thu, 16 Sep 2021 18:27:40 +0000 (20:27 +0200)]
etnaviv: move drm version readout to drm layer

It fits here better.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Philipp Zabel p.zabel@pengutronix.de
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12904>

3 years agoetnaviv: fix indentation
Christian Gmeiner [Thu, 16 Sep 2021 17:06:10 +0000 (19:06 +0200)]
etnaviv: fix indentation

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Philipp Zabel p.zabel@pengutronix.de
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12904>

3 years agoetnaviv: fix leak of the screen hash table
Christian Gmeiner [Thu, 16 Sep 2021 16:50:42 +0000 (18:50 +0200)]
etnaviv: fix leak of the screen hash table

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Philipp Zabel p.zabel@pengutronix.de
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12904>

3 years agoetnaviv: use better name for fd hash table
Christian Gmeiner [Thu, 16 Sep 2021 16:55:18 +0000 (18:55 +0200)]
etnaviv: use better name for fd hash table

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Tested-by: Philipp Zabel p.zabel@pengutronix.de
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12904>

3 years agoanv: remove a format assert when setting up attachments
Tapani Pälli [Tue, 28 Sep 2021 10:20:53 +0000 (13:20 +0300)]
anv: remove a format assert when setting up attachments

There are exceptions in spec where the framebuffer image format and
format given for render pass attachment may differ. This happens in
particular when subpass has resolve attachment that might resolve
only depth from a combined depth+stencil format. There the formats do
not need to match but be 'compatible' with each other.

As example using VK_FORMAT_D32_SFLOAT format is considered compatible
when actual framebuffer format is VK_FORMAT_D32_SFLOAT_S8_UINT.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13082>

3 years agoaco/spill: Use std::unordered_map for spills_entry
Tony Wasserka [Fri, 16 Jul 2021 10:19:28 +0000 (12:19 +0200)]
aco/spill: Use std::unordered_map for spills_entry

fossil-db on Navi14:
Totals from 305 (0.20% of 150305) affected shaders:
CodeSize: 5498340 -> 5498328 (-0.00%)
Instrs: 1009992 -> 1009989 (-0.00%)
Latency: 33922644 -> 33923018 (+0.00%)
InvThroughput: 9302963 -> 9303151 (+0.00%)
VClause: 19004 -> 19001 (-0.02%)

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Use unordered_map for spills_exit
Tony Wasserka [Fri, 16 Jul 2021 10:17:29 +0000 (12:17 +0200)]
aco/spill: Use unordered_map for spills_exit

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Clarify use of long-lived references by adding const
Tony Wasserka [Fri, 16 Jul 2021 09:33:32 +0000 (11:33 +0200)]
aco/spill: Clarify use of long-lived references by adding const

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Reduce allocations in next_uses_per_block
Tony Wasserka [Thu, 15 Jul 2021 15:11:24 +0000 (17:11 +0200)]
aco/spill: Reduce allocations in next_uses_per_block

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Change worklist to a single integer
Tony Wasserka [Thu, 15 Jul 2021 14:36:09 +0000 (16:36 +0200)]
aco/spill: Change worklist to a single integer

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Store remat list in an std::unordered_map instead of std::map
Tony Wasserka [Thu, 15 Jul 2021 13:14:41 +0000 (15:14 +0200)]
aco/spill: Store remat list in an std::unordered_map instead of std::map

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Replace an std::map to booleans with std::set
Tony Wasserka [Thu, 15 Jul 2021 13:11:44 +0000 (15:11 +0200)]
aco/spill: Replace an std::map to booleans with std::set

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Reduce redundant std::map lookups
Tony Wasserka [Tue, 13 Jul 2021 10:59:58 +0000 (12:59 +0200)]
aco/spill: Reduce redundant std::map lookups

The previous code checked for element containment first and then performed
another map lookup upon element access. Instead, map::find can be used to
retrieve an iterator usable for element access with no extra lookup needed.

Furthermore, pure containment checks have been simplified using map::count.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Avoid copying current_spills when not needed
Tony Wasserka [Sat, 10 Jul 2021 12:06:50 +0000 (14:06 +0200)]
aco/spill: Avoid copying current_spills when not needed

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Prefer unordered_map over map for next use distances
Tony Wasserka [Tue, 13 Jul 2021 10:31:12 +0000 (12:31 +0200)]
aco/spill: Prefer unordered_map over map for next use distances

This changes the iteration order of next use distances, so some "random"
changes to shader metrics are expected.

fossil-db for Navi14:
Totals from 1239 (0.82% of 150305) affected shaders:
SpillSGPRs: 10559 -> 10562 (+0.03%); split: -0.05%, +0.08%
SpillVGPRs: 1632 -> 1863 (+14.15%)
CodeSize: 19321468 -> 19304164 (-0.09%); split: -0.09%, +0.01%
Instrs: 3593957 -> 3591647 (-0.06%); split: -0.07%, +0.01%
Latency: 103120695 -> 102475647 (-0.63%); split: -0.63%, +0.01%
InvThroughput: 23897614 -> 23575320 (-1.35%); split: -1.36%, +0.02%
VClause: 66406 -> 66943 (+0.81%); split: -0.01%, +0.81%
SClause: 118559 -> 118548 (-0.01%)
Copies: 310871 -> 308950 (-0.62%); split: -0.69%, +0.08%
Branches: 123386 -> 123413 (+0.02%); split: -0.00%, +0.03%

These numbers mostly come from parallel-rdp ubershaders. Small changes are
also found in the rdr2 and rage2 shader metrics, whereas others are not
significantly affected.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Replace vector<map> with vector<vector> for local_next_use
Tony Wasserka [Tue, 20 Jul 2021 09:48:15 +0000 (11:48 +0200)]
aco/spill: Replace vector<map> with vector<vector> for local_next_use

While adding/removing elements is faster with std::map, the cost of container
copies (and the involved memory allocations) vastly outweigh that benefit in
this usage pattern.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Avoid destroying local next use maps over-eagerly
Tony Wasserka [Mon, 19 Jul 2021 17:43:54 +0000 (19:43 +0200)]
aco/spill: Avoid destroying local next use maps over-eagerly

Recreating these maps in a later block requires allocating fresh memory.
Instead, by never shrinking the containing vector in the first place,
previously allocated map memory is now re-used.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Persist memory allocations of local next use maps
Tony Wasserka [Mon, 19 Jul 2021 17:32:38 +0000 (19:32 +0200)]
aco/spill: Persist memory allocations of local next use maps

The function local_next_uses allocated one next-use map per instruction in
the current block. Since the function is called once per block, this caused
an excessive amount of memory allocations to take place.

With this change, the memory for next-use maps is allocated only once and
then reused for later blocks.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Avoid copying next_use maps more often than needed
Tony Wasserka [Sat, 10 Jul 2021 11:59:42 +0000 (13:59 +0200)]
aco/spill: Avoid copying next_use maps more often than needed

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Replace map[] with map::insert
Tony Wasserka [Thu, 15 Jul 2021 14:13:58 +0000 (16:13 +0200)]
aco/spill: Replace map[] with map::insert

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Remove unused container
Tony Wasserka [Sat, 10 Jul 2021 10:25:45 +0000 (12:25 +0200)]
aco/spill: Remove unused container

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco: Use std::vector for the underlying container of std::stack
Tony Wasserka [Sat, 10 Jul 2021 10:20:56 +0000 (12:20 +0200)]
aco: Use std::vector for the underlying container of std::stack

By default, std::stack uses std::deque to allocate its elements, which has
poor cache efficiency. std::vector makes appending elements more expensive
(due to potential reallocations), but in the changed contexts the element
count should always be low anyway.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoaco/spill: Avoid unneeded copies when iterating over maps
Tony Wasserka [Sat, 10 Jul 2021 10:17:37 +0000 (12:17 +0200)]
aco/spill: Avoid unneeded copies when iterating over maps

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11925>

3 years agoradv: Allow building when LLVM isn’t enabled
Emmanuel Gil Peyrot [Fri, 31 Jul 2020 14:39:10 +0000 (16:39 +0200)]
radv: Allow building when LLVM isn’t enabled

Now that ACO is considered feature-complete, it can be nice to avoid the
huge LLVM dependency when one only wants a Vulkan driver.

This patch allows radv to be built without LLVM.  The two features which
get disabled are RADV_DEBUG=llvm and shader disassembly.  The latter
is an issue for debugging, so I added a warning that this configuration
is unsupported.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>

3 years agoaco/tests: Assert that the requested IR is actually provided
Tony Wasserka [Tue, 28 Sep 2021 15:59:43 +0000 (17:59 +0200)]
aco/tests: Assert that the requested IR is actually provided

In particular, assembly will not be provided if no disassembler is available
for the given GPU architecture.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>

3 years agoradv: Disable shader disassembly when no disassembler is available
Tony Wasserka [Fri, 11 Jun 2021 10:37:50 +0000 (12:37 +0200)]
radv: Disable shader disassembly when no disassembler is available

ACO relies on LLVM to disassemble AMD shaders for ISAs newer than GFX7,
so disassembly needs to be skipped when LLVM is not enabled.

For vkGetPipelineExecutableInternalRepresentationsKHR and vkGetShaderInfoAMD,
the disassembly will not be reported anymore if it can't be generated.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>

3 years agoradv: Build code which depends on LLVM only when enabled
Tony Wasserka [Tue, 29 Jun 2021 10:56:37 +0000 (12:56 +0200)]
radv: Build code which depends on LLVM only when enabled

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>

3 years agoradv: Support shader compilation without LLVM dependencies
Emmanuel Gil Peyrot [Thu, 6 Aug 2020 12:16:35 +0000 (14:16 +0200)]
radv: Support shader compilation without LLVM dependencies

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>

3 years agoradv: Support device initialization without LLVM dependencies
Emmanuel Gil Peyrot [Fri, 31 Jul 2020 14:38:56 +0000 (16:38 +0200)]
radv: Support device initialization without LLVM dependencies

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>

3 years agoaco: Extend set of supported GPUs that can be disassembled with CLRX
Tony Wasserka [Tue, 29 Jun 2021 10:28:07 +0000 (12:28 +0200)]
aco: Extend set of supported GPUs that can be disassembled with CLRX

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>

3 years agoaco: Separate LLVM/CLRX asm printers more cleanly
Tony Wasserka [Fri, 25 Jun 2021 17:42:32 +0000 (19:42 +0200)]
aco: Separate LLVM/CLRX asm printers more cleanly

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>

3 years agoradv: Rename radv_shader_helper.h to radv_llvm_helper.h
Tony Wasserka [Fri, 11 Jun 2021 10:20:59 +0000 (12:20 +0200)]
radv: Rename radv_shader_helper.h to radv_llvm_helper.h

This better reflects that the functions declared in this header are only
available with LLVM.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11319>

3 years agoradv/ci: mark some tests as flaky on gfx9
Martin Roukala (néé Peres) [Thu, 30 Sep 2021 12:52:04 +0000 (15:52 +0300)]
radv/ci: mark some tests as flaky on gfx9

These tests have been flaky on vega10/renoir. We don't have time to look
into it just yet, so let's just mark them as such for now!

I am also including raven, as it likely has the same issue!

v2: add dEQP-VK.api.object_management.multithreaded_per_thread_resources.image_2d
v3:
 - don't skip the test, mark them as flakes (Emma Anholt)

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Martin Roukala (néé Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13118>

3 years agoanv: drop redundant unlikely's around INTEL_DEBUG
Marcin Ślusarz [Thu, 30 Sep 2021 11:32:45 +0000 (13:32 +0200)]
anv: drop redundant unlikely's around INTEL_DEBUG

They are not needed since 4015e1876a77162e3444eeaa29a0dfbc47efe90e.

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

3 years agointel/compiler: drop redundant likely's around INTEL_DEBUG
Marcin Ślusarz [Thu, 30 Sep 2021 11:32:20 +0000 (13:32 +0200)]
intel/compiler: drop redundant likely's around INTEL_DEBUG

They are not needed since 4015e1876a77162e3444eeaa29a0dfbc47efe90e.

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

3 years agocrocus: drop redundant unlikely's around INTEL_DEBUG
Marcin Ślusarz [Thu, 30 Sep 2021 11:31:11 +0000 (13:31 +0200)]
crocus: drop redundant unlikely's around INTEL_DEBUG

They are not needed since 4015e1876a77162e3444eeaa29a0dfbc47efe90e.

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

3 years agoradv: fix vk_object_base_init/finish for internal buffers
Samuel Pitoiset [Wed, 29 Sep 2021 13:36:29 +0000 (15:36 +0200)]
radv: fix vk_object_base_init/finish for internal buffers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13102>

3 years agoradv: fix vk_object_base_init/finish for internal image views
Samuel Pitoiset [Wed, 29 Sep 2021 07:46:46 +0000 (09:46 +0200)]
radv: fix vk_object_base_init/finish for internal image views

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13102>

3 years agoradv: fix vk_object_base_init/finish for the internal push descriptors
Samuel Pitoiset [Wed, 29 Sep 2021 07:44:36 +0000 (09:44 +0200)]
radv: fix vk_object_base_init/finish for the internal push descriptors

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13102>

3 years agoradv: fix vk_object_base_init/finish for internal buffer views
Samuel Pitoiset [Wed, 29 Sep 2021 07:40:00 +0000 (09:40 +0200)]
radv: fix vk_object_base_init/finish for internal buffer views

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13102>

3 years agoradv: fix vk_object_base_init/finish for the internal pipeline cache
Samuel Pitoiset [Wed, 29 Sep 2021 07:28:50 +0000 (09:28 +0200)]
radv: fix vk_object_base_init/finish for the internal pipeline cache

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13102>

3 years agoradv: make sure to load the Primitive ID for VS+GS as NGG
Samuel Pitoiset [Thu, 30 Sep 2021 11:24:55 +0000 (13:24 +0200)]
radv: make sure to load the Primitive ID for VS+GS as NGG

When the VS doesn't export the Primitive ID but the FS needs it.

Fixes dEQP-VK.pipeline.framebuffer_attachment.no_attachments*.

Fixes: 7ad69e2f7ee ("radv: stop loading invocation ID for NGG vertex shaders")
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/13116>

3 years agoiris: Suballocate BO using the Gallium pb_slab mechanism
Kenneth Graunke [Sun, 8 Aug 2021 06:00:44 +0000 (23:00 -0700)]
iris: Suballocate BO using the Gallium pb_slab mechanism

With all the preparation in place to handle suballocated BOs at
submission and export, we can now wire up the actual suballocator.
We use Gallium's pb_slab infrastructure for this, which is already
used for this purpose in the amdgpu winsys and now zink as well.

Unlike those drivers, we don't use pb_buffer (it doesn't do much) nor
pb_cache (we already have a buffer cache).  Just pb_slab for now.

We can now suballocate BOs at power-of-two (or 3/4 power-of-two)
granularity, between 256B and 2MB.  Beyond that, we use actual GEM
objects as before.  This should save us some memory on current GPUs
where we previously had a minimum allocation granularity of 4K (page
size), but should save us a /ton/ of memory on future GPUs where the
minimum page size is 64K.  Fewer actual GEM objects should also mean
shorter exec_object2 lists passed to the kernel, which could reduce
CPU overhead a bit.  Using large allocations where the underlying
GEM objects correspond with the PTE fragment size may also allow the
kernel to use a more efficient page table layout, improving memory
access times.

This cuts nearly half of the memory usage in a Unity3D demo on a
GPU that uses 64K pages.

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

Acked-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12623>

3 years agoiris: Move suballocated resources to a dedicated allocation on export
Kenneth Graunke [Thu, 16 Sep 2021 18:38:03 +0000 (11:38 -0700)]
iris: Move suballocated resources to a dedicated allocation on export

We don't want to export suballocated resources to external consumers,
for a variety of reasons.  First of all, it would be exporting random
other pieces of memory which we may not want those external consumers
to have access to.  Secondly, external clients wouldn't be aware of
what buffers are packed together and busy-tracking implications there.
Nor should they be.  And those are just the obvious reasons.

When we allocate a resource with the PIPE_BIND_SHARED flag, indicating
that it's going to be used externally, we avoid suballocation.

However, there are times when the client may suddenly decide to export
a texture or buffer, without any prior warning.  Since we had no idea
this buffer would be exported, we suballocated it.  Unfortunately, this
means we need to transition it to a dedicated allocation on the fly, by
allocating a new buffer and copying the contents over.

Making things worse, this often happens in DRI hooks that don't have an
associated context (which we need to say, run BLORP commands).  We have
to create an temporary context for this purpose, perform our blit, then
destroy it.  The radeonsi driver uses a permanent auxiliary context
stored in the screen for this purpose, but we can't do that because it
causes circular reference counting.  radeonsi doesn't do the reference
counting that we do, but also doesn't use u_transfer_helper, so they
get lucky in avoiding stale resource->screen pointers.  Other drivers
don't create an auxiliary context, so they avoid this problem for now.

For auxiliary data, rather than copying it over bit-for-bit, we simply
copy over the underlying data using iris_copy_region (GPU memcpy), and
take whatever the resulting aux state is from that operation.  Assuming
the copy operation compresses, the result will be compressed.

v2: Stop using a screen->aux_context and just invent one on the fly to
    avoid circular reference counting issues.

Acked-by: Paulo Zanoni <paulo.r.zanoni@intel.com> [v1]
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12623>

3 years agoiris: Change the validation list debug code to print the BO list instead
Kenneth Graunke [Sun, 8 Aug 2021 08:48:27 +0000 (01:48 -0700)]
iris: Change the validation list debug code to print the BO list instead

This code assumed that batch->exec_bos[i] matched validation_list[i],
which won't be true once we start suballocating BOs.  This patch changes
it to print the full exec_bos[i] list instead of the validation list,
as that has the logical list of objects, names, addresses, placement,
whether they are suballocated, and so on.

It may be useful to look at the actual validation list as well; I'm not
sure how common that is.  We may want to add additional debug prints in
the future.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12623>

3 years agoiris: Introduce a BO_ALLOC_NO_SUBALLOC flag and set it in a few places
Kenneth Graunke [Sun, 8 Aug 2021 08:31:30 +0000 (01:31 -0700)]
iris: Introduce a BO_ALLOC_NO_SUBALLOC flag and set it in a few places

We don't want to suballocate some buffers, such as ones that we know
we're intending to export to other clients, or ones with special
semantics (such as the workaround BO not having proper synchronization).

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12623>

3 years agoiris: Begin handling slab-allocated wrapper BOs in various places
Kenneth Graunke [Thu, 5 Aug 2021 06:42:45 +0000 (23:42 -0700)]
iris: Begin handling slab-allocated wrapper BOs in various places

The vast majority of cases need no handling at all, as they simply
read bo->address or similar fields, which works in either case.

Some other cases simply need to unwrap to look at the underlying BO.

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

3 years agoiris: Handle multiple BOs backed by the same GEM object in execbuf code
Kenneth Graunke [Wed, 4 Aug 2021 18:22:45 +0000 (11:22 -0700)]
iris: Handle multiple BOs backed by the same GEM object in execbuf code

With suballocation, our batch BO list may have multiple BOs that are
suballocated from the same GEM object.  We still need to track each of
those buffers for cross-batch write tracking, cache tracking, and busy
tracking.  However, we only want to include underlying GEM objects in
the actual validation list building.  The validation list entry should
have EXEC_OBJECT_WRITE if any of the BOs are marked as writable.

We use a temporary array to map GEM handles to validation list entries
so we can quickly see if we've already emitted one and update the
EXEC_OBJECT_WRITE flag as needed.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12623>

3 years agoiris: Move some iris_bo entries into a union
Kenneth Graunke [Tue, 20 Jul 2021 05:46:45 +0000 (22:46 -0700)]
iris: Move some iris_bo entries into a union

We would like to start performing slab allocation of resources, where
multiple resources can be backed by a single GEM object.

Originally, I had thought to move busy tracking, cache domain tracking,
and so on into resources themselves, instead of having them at the BO
level.  Multiple resources would point at the same BO with an offset.
Unfortunately, this meant adjusting the batch BO pinning code to take
resources rather than BOs.  That cascades into needing iris_address
for genxml packing to store resources, not BOs.  Which means that places
which have use raw BOs would need to start creating resources instead.
Except some places, like aux BO handling, really don't make sense as
pipe resources and really would rather use raw BOs.  So iris_address
would need to store both, which convolutes the genxml field.  And,
having a BO and resource means that every place in the code needs to
handle that offset correctly.  It sounds simple, but is a giant mess.

Instead, we take a different route: adjust iris_bo itself, so that BOs
are either be backed by a GEM object (as is the case today), or backed
by another underlying BO.  "Real" BOs have bo->gem_handle != 0.  "Slab
allocated" or "fake" or "wrapper" BOs have bo->gem_handle == 0.  We move
fields into a union based on these cases.  amdgpu takes this approach.

This sounds complex at first glance---in theory, every place that
interacts with BOs might need to handle the wrapper BO special case.
But in practice, they don't.  For suballocated BOs, we can set the
wrapper's address field to the underlying BO's address plus any offset,
at which point it looks like any other BO.  Most other properties are
easily queried; the main code that needs updating is execbuf handling
and bufmgr internals.

For now, we simply move the fields.  Any code that accesses either
bo->real.* or bo->gem_handle will need updating in future patches to
actually handle the slab-allocated case.

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12623>

3 years agogbm: assume USE_SCANOUT in create_with_modifiers
Simon Ser [Fri, 27 Aug 2021 13:03:39 +0000 (15:03 +0200)]
gbm: assume USE_SCANOUT in create_with_modifiers

gbm_{bo,surface}_create_with_modifiers doesn't allow callers to
pass usage flags. Assume USE_SCANOUT since this is what most
callers want.

Bump the GBM ABI version so that other backends can discover when
the usage flags can be used.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3197>

3 years agogbm: add gbm_{bo,surface}_create_with_modifiers2
Simon Ser [Sun, 22 Dec 2019 20:46:57 +0000 (21:46 +0100)]
gbm: add gbm_{bo,surface}_create_with_modifiers2

gbm_{bo,surface}_create_with_modifiers is missing the usage flags. Add a new
function which lets library users specify it.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3197>

3 years agogbm: consistently use the same name for BO flags
Simon Ser [Mon, 30 Aug 2021 13:43:51 +0000 (15:43 +0200)]
gbm: consistently use the same name for BO flags

We were sometimes using "usage", sometimes using "flags". Let's
just use "flags" everywhere (since the enum is named gbm_bo_flags).

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: James Jones <jajones@nvidia.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3197>

3 years agowsi/x11: fix uninit value by using zalloc for swapchain
Mike Blumenkrantz [Wed, 29 Sep 2021 01:50:51 +0000 (21:50 -0400)]
wsi/x11: fix uninit value by using zalloc for swapchain

==767499== Conditional jump or move depends on uninitialised value(s)
==767499==    at 0xEB8E3ED: x11_image_finish (wsi_common_x11.c:1539)
==767499==    by 0xEB8E768: x11_swapchain_destroy (wsi_common_x11.c:1640)
==767499==    by 0xEB8A8FA: wsi_common_destroy_swapchain (wsi_common.c:505)
==767499==    by 0xDE30BA1: anv_DestroySwapchainKHR (anv_wsi.c:242)
==767499==    by 0x6817A21: copper_displaytarget_destroy (zink_copper.c:192)
==767499==    by 0x6882BE6: zink_destroy_resource_object (zink_resource.c:95)
==767499==    by 0x6882447: zink_resource_object_reference (zink_resource.h:198)
==767499==    by 0x6882D33: zink_resource_destroy (zink_resource.c:123)
==767499==    by 0x688AC97: pipe_resource_destroy (u_inlines.h:145)
==767499==    by 0x688AD2E: pipe_resource_reference (u_inlines.h:162)
==767499==    by 0x688BE1E: zink_destroy_surface (zink_surface.c:319)
==767499==    by 0x688AE0A: zink_surface_reference (zink_surface.h:102)
==767499==    by 0x688BE6D: zink_surface_destroy (zink_surface.c:328)
==767499==    by 0x67F9CA2: pipe_surface_release (u_inlines.h:134)
==767499==    by 0x67FB8AD: zink_context_destroy (zink_context.c:92)
==767499==    by 0x5D47B65: st_destroy_context_priv (st_context.c:475)
==767499==    by 0x5D49AF2: st_destroy_context (st_context.c:1193)
==767499==    by 0x5D5C90F: st_context_destroy (st_manager.c:816)
==767499==    by 0x5CC1FC9: dri_destroy_context (dri_context.c:248)
==767499==    by 0x658DD63: driDestroyContext (dri_util.c:535)
==767499==    by 0x5A30166: drisw_destroy_context (drisw_glx.c:417)
==767499==    by 0x5A32484: glXDestroyContext (glxcmds.c:515)
==767499==    by 0x5315AEB: glXDestroyContext (libglx.c:332)
==767499==    by 0x4AA8E7D: glXDestroyContext (g_libglglxwrapper.c:384)
==767499==    by 0x4D5A3F0: ??? (in /usr/lib64/libwaffle-1.so.0.6.1)
==767499==    by 0x499DDD5: piglit_wfl_framework_teardown (piglit_wfl_framework.c:638)
==767499==    by 0x499E4C5: piglit_winsys_framework_teardown (piglit_winsys_framework.c:238)
==767499==    by 0x499F50C: destroy (piglit_x11_framework.c:212)
==767499==    by 0x498C535: destroy (piglit-framework-gl.c:210)
==767499==    by 0x4F48AF6: __run_exit_handlers (in /usr/lib64/libc-2.33.so)
==767499==    by 0x4F48C9F: exit (in /usr/lib64/libc-2.33.so)
==767499==    by 0x4AEFD71: piglit_report_result (piglit-util.c:245)
==767499==    by 0x499F2CA: process_next_event (piglit_x11_framework.c:139)
==767499==    by 0x499F365: enter_event_loop (piglit_x11_framework.c:153)
==767499==    by 0x499DF88: run_test (piglit_winsys_framework.c:88)
==767499==    by 0x498C5EF: piglit_gl_test_run (piglit-framework-gl.c:229)
==767499==    by 0x4022B4: main (primitive-restart.c:45)
==767499==  Uninitialised value was created by a heap allocation
==767499==    at 0x484086F: malloc (vg_replace_malloc.c:380)
==767499==    by 0xE964E85: vk_default_alloc (vk_alloc.c:26)
==767499==    by 0xEB8B24B: vk_alloc (vk_alloc.h:43)
==767499==    by 0xEB8EAF9: x11_surface_create_swapchain (wsi_common_x11.c:1723)
==767499==    by 0xEB8A82A: wsi_common_create_swapchain (wsi_common.c:476)
==767499==    by 0xDE30B47: anv_CreateSwapchainKHR (anv_wsi.c:225)
==767499==    by 0xE96134F: vk_tramp_CreateSwapchainKHR (vk_dispatch_table.c:6592)
==767499==    by 0xD7B88F0: ??? (in /usr/lib64/libvulkan.so.1.2.162)
==767499==    by 0x6817796: copper_CreateSwapchain (zink_copper.c:123)
==767499==    by 0x6817960: copper_displaytarget_create (zink_copper.c:170)
==767499==    by 0x6884C65: resource_create (zink_resource.c:780)
==767499==    by 0x6884EC5: zink_resource_create_drawable (zink_resource.c:829)
==767499==    by 0x5CC0FE3: copper_allocate_textures (copper.c:199)
==767499==    by 0x5CC28C2: dri_st_framebuffer_validate (dri_drawable.c:82)
==767499==    by 0x5D5B69A: st_framebuffer_validate (st_manager.c:222)
==767499==    by 0x5D5D32D: st_api_make_current (st_manager.c:1102)
==767499==    by 0x5CC220B: dri_make_current (dri_context.c:306)
==767499==    by 0x658DE23: driBindContext (dri_util.c:588)
==767499==    by 0x5A3022A: drisw_bind_context (drisw_glx.c:435)
==767499==    by 0x5A36CC2: MakeContextCurrent (glxcurrent.c:220)
==767499==    by 0x5A36DF9: glXMakeCurrent (glxcurrent.c:253)
==767499==    by 0x531849C: InternalMakeCurrentVendor (libglx.c:875)
==767499==    by 0x53185C3: InternalMakeCurrentDispatch (libglx.c:930)
==767499==    by 0x5318DE5: CommonMakeCurrent (libglx.c:1074)
==767499==    by 0x5318ED5: glXMakeCurrent (libglx.c:1119)
==767499==    by 0x4AA9CFA: glXMakeCurrent (g_libglglxwrapper.c:930)
==767499==    by 0x4D5AA36: ??? (in /usr/lib64/libwaffle-1.so.0.6.1)
==767499==    by 0x4D5E16E: waffle_make_current (in /usr/lib64/libwaffle-1.so.0.6.1)
==767499==    by 0x499C8CD: wfl_checked_make_current (piglit-util-waffle.h:115)
==767499==    by 0x499DA04: make_context_current_singlepass (piglit_wfl_framework.c:488)
==767499==    by 0x499DC43: make_context_current (piglit_wfl_framework.c:565)
==767499==    by 0x499DD88: piglit_wfl_framework_init (piglit_wfl_framework.c:628)
==767499==    by 0x499E3FC: piglit_winsys_framework_init (piglit_winsys_framework.c:209)
==767499==    by 0x499F581: piglit_x11_framework_create (piglit_x11_framework.c:229)
==767499==    by 0x499E361: piglit_winsys_framework_factory (piglit_winsys_framework.c:175)
==767499==    by 0x498CA60: piglit_gl_framework_factory (piglit_gl_framework.c:53)
==767499==    by 0x498C587: piglit_gl_test_run (piglit-framework-gl.c:221)
==767499==    by 0x4022B4: main (primitive-restart.c:45)

Fixes: b5c390c113d ("vulkan/wsi: add support for detecting mit-shm pixmaps.")

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13124>

3 years agogallium/dri: Make YUV formats we're going to emulate external-only.
Emma Anholt [Fri, 24 Sep 2021 17:04:49 +0000 (10:04 -0700)]
gallium/dri: Make YUV formats we're going to emulate external-only.

If we're going to have to bind them as separate planes with colorspace
conversion for sampling on the frontend, then we need to report that
they're only for external-image samplers, otherwise the lowering won't be
applied.

Fixes: 4e3a7dcf ("gallium: enable EGL_EXT_image_dma_buf_import_modifiers unconditionally")
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13038>

3 years agogallium/va: Remove VP9 header parsing for secure playback
Veerabadhran Gopalakrishnan [Tue, 7 Sep 2021 14:42:07 +0000 (20:12 +0530)]
gallium/va: Remove VP9 header parsing for secure playback

Latest VCN FW is capable of parsing the VP9 uncompressed header.
Removing the parsing from gallium.

Signed-off-by: Veerabadhran Gopalakrishnan <veerabadhran.gopalakrishnan@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13106>

3 years agoanv/slice_hash: Don't allocate more than once with multiple queues
Jordan Justen [Thu, 30 Sep 2021 01:49:59 +0000 (18:49 -0700)]
anv/slice_hash: Don't allocate more than once with multiple queues

emit_slice_hashing_state gets called once per queue, meaning
device->slice_hash can get allocated multiple times. This can be
reproduced by setting the env-var ANV_QUEUE_OVERRIDE=gc=2.

Reworks:
 * Only pack the struct once (s-b Lionel, Jason)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13114>

3 years agoci/freedreno: Disable flaky a530 for now.
Emma Anholt [Thu, 30 Sep 2021 16:05:08 +0000 (09:05 -0700)]
ci/freedreno: Disable flaky a530 for now.

This morning saw at least 3 pipelines fail from a530 not responding and
not coming back after we tried to power cycle, and airlied was having some
similar trouble yesterday.  Until I can figure out what's going wrong
(python script failing to set up serial after retry?  relays worn out?
Power supply failing?), just disable the boards.

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

3 years agoanv/blorp: Force compute blorp on compute-only queues
Jordan Justen [Tue, 1 Jan 2019 00:06:47 +0000 (16:06 -0800)]
anv/blorp: Force compute blorp on compute-only queues

Reworks:
 * Set BLORP_BATCH_USE_COMPUTE in anv_blorp_batch_init (s-b Jason)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agoanv/blorp: Add anv_blorp_batch_init, anv_blorp_batch_finish
Jordan Justen [Wed, 15 Sep 2021 19:35:30 +0000 (12:35 -0700)]
anv/blorp: Add anv_blorp_batch_init, anv_blorp_batch_finish

Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agoanv/blorp: Select pipeline based on BLORP_BATCH_USE_COMPUTE
Jordan Justen [Tue, 30 Oct 2018 18:57:33 +0000 (11:57 -0700)]
anv/blorp: Select pipeline based on BLORP_BATCH_USE_COMPUTE

Reworks:
 * Let blorp_clear handle DEBUG_BLOCS
 * Old subject was: "Use compute blorp for vkCmdFillBuffer with
   INTEL_DEBUG=blocs"
 * Old subject was: "anv/blorp: Support params.cs_prog_data being set"

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agoanv/blorp: Make sure blorp type is supported by the queue
Jordan Justen [Wed, 4 Aug 2021 09:40:17 +0000 (02:40 -0700)]
anv/blorp: Make sure blorp type is supported by the queue

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agoanv: Prevent starting a render pass on compute queues
Jordan Justen [Wed, 15 Sep 2021 08:06:25 +0000 (01:06 -0700)]
anv: Prevent starting a render pass on compute queues

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agoanv: Store anv_queue_family type in cmd-pool
Jordan Justen [Tue, 14 Aug 2018 09:34:16 +0000 (02:34 -0700)]
anv: Store anv_queue_family type in cmd-pool

v2 (Jason Ekstrand):
 - Use an anv_queue_family pointer

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Support some image/buffer blit operations using compute
Jordan Justen [Fri, 26 Oct 2018 20:06:03 +0000 (13:06 -0700)]
intel/blorp: Support some image/buffer blit operations using compute

Reworks:
 * Use BLORP_BATCH_USE_COMPUTE flag rather than compute param to
   blorp_copy (s-b Jason)
 * Squash "intel/blorp: Set shader_pipeline for compute"
 * Squash "intel/blorp: Add blorp_copy_supports_compute function"
 * Squash "intel: Support compute for image/buffer copy if INTEL_DEBUG=blocs
           is set"
 * Squash "intel/blorp: Support compute for some blit operations"
 * Use nir_image_store (s-b Jason)
 * Use nir_push_if (s-b Jason)
 * Require gfx12 for ccs in blorp_copy_supports_compute (s-b Jason)
 * Add nir_pop_if (s-b Ken)
 * Fix aux_usage check on gfx12 blorp_copy_supports_compute (s-b Ken)
 * Use blorp_set_cs_dims (s-b Jason)
 * Use dim=2d with array=true for nir_image_store (s-b Jason, Francisco)
 * Restructure gen checks in blorp_copy_supports_compute (s-b Ken)
 * Use nir_load_global_invocation_id (s-b Jason)
 * Fix inefficient calculation of store_pos (s-b Jason)
 * Use bounds_if being NULL/non-NULL for nir_pop_if (s-b Jason)
 * discard => bounds (s-b Ken)
 * Re-add ISL_AUX_USAGE_CCS_E in *_supports_compute (s-b Sagar)
 * Skip duplicated in_bounds calculation (s-b Jason)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp/blit: Rename wm_prog_key and prog_key to key
Jordan Justen [Thu, 16 Sep 2021 20:21:04 +0000 (13:21 -0700)]
intel/blorp/blit: Rename wm_prog_key and prog_key to key

Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Support compute for slow clears
Jordan Justen [Fri, 26 Oct 2018 19:56:20 +0000 (12:56 -0700)]
intel/blorp: Support compute for slow clears

Reworks:
 * Use BLORP_BATCH_USE_COMPUTE flag rather than compute param to
   blorp_clear (s-b Jason)
 * Use nir_load_global_invocation_id (s-b Jason)
 * Use nir_push_if (s-b Jason)
 * Use nir_image_store (s-b Jason)
 * Require gfx12 for ccs in blorp_clear_supports_compute (s-b Jason)
 * Add nir_pop_if (s-b Ken)
 * Fix aux_usage check on gfx12 blorp_clear_supports_compute (s-b Ken)
 * Use blorp_set_cs_dims (s-b Jason)
 * Simplify rgb-as-red calculation (s-b Jason)
 * Use dim=2d with array=true for nir_image_store (s-b Jason, Francisco)
 * discard => bounds (s-b Ken)
 * Re-add ISL_AUX_USAGE_CCS_E in *_supports_compute (s-b Sagar)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Convert blorp_clear color_write_disable to a bitmask
Jordan Justen [Thu, 16 Sep 2021 21:25:42 +0000 (14:25 -0700)]
intel/blorp: Convert blorp_clear color_write_disable to a bitmask

Reworks:
 * Various cleanups adding BITFIELD_* (s-b Jason)
 * Add /* color_write_disable */ comment (s-b Jason)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agoblorp/clear: Simplify rbg-as-red channel packing
Jordan Justen [Wed, 1 Sep 2021 00:45:06 +0000 (17:45 -0700)]
blorp/clear: Simplify rbg-as-red channel packing

Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agoblorp: Set view usage to ISL_SURF_USAGE_STORAGE_BIT for compute
Jordan Justen [Thu, 5 Aug 2021 03:39:58 +0000 (20:39 -0700)]
blorp: Set view usage to ISL_SURF_USAGE_STORAGE_BIT for compute

Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Use blorp_check_in_bounds for discards
Jordan Justen [Fri, 27 Aug 2021 06:46:55 +0000 (23:46 -0700)]
intel/blorp: Use blorp_check_in_bounds for discards

Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Add blorp_check_in_bounds()
Jordan Justen [Wed, 7 Jul 2021 08:51:20 +0000 (01:51 -0700)]
intel/blorp: Add blorp_check_in_bounds()

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Change discard terminology to bounds
Jordan Justen [Thu, 16 Sep 2021 19:52:23 +0000 (12:52 -0700)]
intel/blorp: Change discard terminology to bounds

Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Add blorp_get_cs_local_y, blorp_set_cs_dims
Jordan Justen [Fri, 2 Nov 2018 08:56:52 +0000 (01:56 -0700)]
intel/blorp: Add blorp_get_cs_local_y, blorp_set_cs_dims

Based the blorp_params, blorp_get_cs_local_y returns a recommended
local_y size for a compute shader.

blorp_set_cs_dims sets the compute program dims based on a given
local_y size.

Reworks:
 * Add blorp_set_cs_dims (s-b Jason)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/gfx7: Change GPGPU Mode to bool
Jordan Justen [Tue, 29 Jun 2021 08:52:16 +0000 (01:52 -0700)]
intel/gfx7: Change GPGPU Mode to bool

Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Emit compute program based on BLORP_BATCH_USE_COMPUTE
Jordan Justen [Fri, 26 Oct 2018 19:52:44 +0000 (12:52 -0700)]
intel/blorp: Emit compute program based on BLORP_BATCH_USE_COMPUTE

Reworks:
 * Don't pack params, just memcpy param struct (s-b Jason)
 * Old subject: "intel/blorp: Emit compute program if
   params.cs_prog_data is set"
 * Various cleanups of push-const size/alignment (s-b Jason)
 * Fix subslice count by moving to devinfo (s-b Ken)
 * Simplify cw.InterfaceDescriptor code (s-b Ken)
 * Drop some comments from i965 (s-b Ken)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agoanv,iris,genxml: Use NumberOfBarriers on XeHP
Jason Ekstrand [Fri, 5 Feb 2021 01:11:07 +0000 (19:11 -0600)]
anv,iris,genxml: Use NumberOfBarriers on XeHP

Ref: bspec 55400
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agoblorp: Add blorp_alloc_general_state
Jordan Justen [Mon, 21 Jun 2021 19:45:24 +0000 (12:45 -0700)]
blorp: Add blorp_alloc_general_state

Reworks:
 * Add crocus

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Split out surface setup from state emission
Jordan Justen [Fri, 26 Oct 2018 19:48:40 +0000 (12:48 -0700)]
intel/blorp: Split out surface setup from state emission

Render will use blorp_setup_binding_table and blorp_emit_btp, but
compute will only use blorp_setup_binding_table.

Rework:
 * Use blorp_setup_binding_table, blorp_emit_btp (s-b Jason)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Split out ps specific sampler state into a separate function
Jordan Justen [Fri, 26 Oct 2018 19:45:44 +0000 (12:45 -0700)]
intel/blorp: Split out ps specific sampler state into a separate function

The compute path will use blorp_emit_sampler_state, whereas the render
path will use blorp_emit_sampler_state_ps.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Add blorp_compile_cs
Jordan Justen [Fri, 26 Oct 2018 19:38:57 +0000 (12:38 -0700)]
intel/blorp: Add blorp_compile_cs

Reworks:
 * Don't pack params (s-b Jason)
 * Drop nir_remove_dead_variables (s-b Jason)
 * Fix comment s/render target/destination image/ (s-b Ken)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Add subgroup_id input for compute programs
Jordan Justen [Wed, 18 Aug 2021 00:31:58 +0000 (17:31 -0700)]
intel/blorp: Add subgroup_id input for compute programs

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/compiler: Use INTEL_DEBUG=blorp to dump blorp compute shaders
Jordan Justen [Mon, 29 Mar 2021 23:14:03 +0000 (16:14 -0700)]
intel/compiler: Use INTEL_DEBUG=blorp to dump blorp compute shaders

Make INTEL_DEBUG=blorp dump the blorp compute shaders instead using
the general INTEL_DEBUG=cs which is now reserved for actual compute
programs.

Ref: 05933fb0f7e ("intel/compiler: Use INTEL_DEBUG=blorp to dump blorp shaders")
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Add brw_blorp_init_cs_prog_key
Jordan Justen [Fri, 26 Oct 2018 19:36:00 +0000 (12:36 -0700)]
intel/blorp: Add brw_blorp_init_cs_prog_key

Reworks:
 * Split out blorp_init_base_prog_key to share with fs/cs key init (s-b Jason)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Add shader_pipeline to brw_blorp_base_key
Jordan Justen [Sat, 3 Jul 2021 23:43:05 +0000 (16:43 -0700)]
intel/blorp: Add shader_pipeline to brw_blorp_base_key

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Add compute support to BLORP_CREATE_NIR_INPUT
Jordan Justen [Thu, 25 Oct 2018 23:17:04 +0000 (16:17 -0700)]
intel/blorp: Add compute support to BLORP_CREATE_NIR_INPUT

Reworks:
 * Set driver_location (s-b Jason)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agointel/blorp: Move most of BLORP_CREATE_NIR_INPUT into a function
Jordan Justen [Tue, 16 Oct 2018 22:54:11 +0000 (15:54 -0700)]
intel/blorp: Move most of BLORP_CREATE_NIR_INPUT into a function

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11564>

3 years agofrontends/va: Fix test_va_api VAAPIDisplayAttribs tests
Ed Baker [Thu, 2 Sep 2021 23:03:24 +0000 (16:03 -0700)]
frontends/va: Fix test_va_api VAAPIDisplayAttribs tests

Set max_display_attribs to 0 instead of 1 to match
va[Query,Get,Set]DisplayAttributes implementations [1].

If max_display_attribs is greater than 0 libva-utils tests check
vaQueryDisplayAttributes() accordingly [2].

[1] https://gitlab.freedesktop.org/mesa/mesa/-/blob/2de348cdb01e45/src/gallium/frontends/va/display.c#L32
[2] https://github.com/intel/libva-utils/blob/master/test/test_va_api_display_attribs.cpp#L90

Signed-off-by: Ed Baker <edward.baker@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12941>

3 years agovirgl/drm: explicit context initialization
Gurchetan Singh [Thu, 19 Nov 2020 22:20:55 +0000 (14:20 -0800)]
virgl/drm: explicit context initialization

If the host supports explicit context initialization, try it.
If no capabilitiies associated with virgl are present, return
an error.

Reviewed-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Tested-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7712>

3 years agovirgl/drm: query for context init ioctl and supported capset ids
Gurchetan Singh [Thu, 19 Nov 2020 22:03:41 +0000 (14:03 -0800)]
virgl/drm: query for context init ioctl and supported capset ids

Just add the params to the existing lists.

Reviewed-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Tested-by: Anthoine Bourgeois <anthoine.bourgeois@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7712>