platform/upstream/mesa.git
2 years agodocs: update trademark disclaimer
Erik Faye-Lund [Wed, 17 Nov 2021 10:47:26 +0000 (11:47 +0100)]
docs: update trademark disclaimer

It's a *long* time since SGI was the copyright holder for the OpenGL
trademark. And we implement more APIs by now, so let's update the
disclaimer to instead redirect to the Khronos licensing page for
details.

While we're at it, soften the language on legal status as a formal
implementation, as we currently have conformant drivers for most of the
APIs by now. But refer to the Khronos website for details, as
conformance status for drivers are subject to change.

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

2 years agomesa: update or remove out of date references to ir_to_mesa
Timothy Arceri [Sun, 5 Dec 2021 11:35:13 +0000 (22:35 +1100)]
mesa: update or remove out of date references to ir_to_mesa

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

2 years agomesa: rename ir_to_mesa.{cpp,h} -> link_program.{cpp,h}
Timothy Arceri [Sun, 5 Dec 2021 02:55:59 +0000 (13:55 +1100)]
mesa: rename ir_to_mesa.{cpp,h} -> link_program.{cpp,h}

The only code now left in this file is the linking function.

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

2 years agomesa: tidy up ir_to_mesa.{cpp,h} includes, comments, etc
Timothy Arceri [Sun, 5 Dec 2021 02:49:43 +0000 (13:49 +1100)]
mesa: tidy up ir_to_mesa.{cpp,h} includes, comments, etc

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

2 years agomesa: move _mesa_ensure_and_associate_uniform_storage() to uniform_query.cpp
Timothy Arceri [Sun, 5 Dec 2021 02:40:30 +0000 (13:40 +1100)]
mesa: move _mesa_ensure_and_associate_uniform_storage() to uniform_query.cpp

This is where all the other functions that handle uniform storage live.

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

2 years agomesa/st: move _mesa_generate_parameters_list_for_uniforms() code to st
Timothy Arceri [Sun, 5 Dec 2021 02:32:07 +0000 (13:32 +1100)]
mesa/st: move _mesa_generate_parameters_list_for_uniforms() code to st

The classic drivers that shared the code are now gone and the only user
is the tgsi linker so here we move the code to where it is used.

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

2 years agomesa: remove GLSL IR to Mesa IR code
Timothy Arceri [Sun, 5 Dec 2021 02:21:07 +0000 (13:21 +1100)]
mesa: remove GLSL IR to Mesa IR code

The last user of this was dropped with the classic drivers.

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

2 years agomesa: make _mesa_associate_uniform_storage() static
Timothy Arceri [Sun, 5 Dec 2021 02:01:26 +0000 (13:01 +1100)]
mesa: make _mesa_associate_uniform_storage() static

The function is no longer called directly outside of this file.

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

2 years agomesa: remove _mesa_ir_link_shader()
Timothy Arceri [Sun, 5 Dec 2021 01:58:18 +0000 (12:58 +1100)]
mesa: remove _mesa_ir_link_shader()

The final use of this was removed when the classic drivers were
dropped.

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

2 years agogenxml: protect _length defines in genX_bits.h
Lionel Landwerlin [Tue, 23 Nov 2021 12:58:05 +0000 (14:58 +0200)]
genxml: protect _length defines in genX_bits.h

Those defines exist in the packing headers too and some parts of the
code (like mi_builder.h) include both.

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

2 years agogenxml: fix compilation with P/I defines
Lionel Landwerlin [Tue, 23 Nov 2021 12:57:21 +0000 (14:57 +0200)]
genxml: fix compilation with P/I defines

Those names are a bit too common and sometimes clash variables.

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

2 years agointel/debug: reclaim 7 unused bits from classic driver
Lionel Landwerlin [Sat, 4 Dec 2021 12:25:32 +0000 (14:25 +0200)]
intel/debug: reclaim 7 unused bits from classic driver

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14060>

2 years agomesa/light: make _mesa_light static do_light.
Dave Airlie [Mon, 6 Dec 2021 06:02:02 +0000 (16:02 +1000)]
mesa/light: make _mesa_light static do_light.

This is unused outside this now.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14074>

2 years agomesa/dd: remove NewSamplerObject
Dave Airlie [Mon, 6 Dec 2021 05:49:49 +0000 (15:49 +1000)]
mesa/dd: remove NewSamplerObject

This was always calling directly into the mesa version now

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14074>

2 years agomesa/dd: remove some fbo driver hooks.
Dave Airlie [Mon, 6 Dec 2021 05:43:57 +0000 (15:43 +1000)]
mesa/dd: remove some fbo driver hooks.

These are assign to core mesa functions by st, so just direct call

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14074>

2 years agomesa/dd: burn a bunch of legacy driver interfaces down
Dave Airlie [Mon, 6 Dec 2021 04:31:44 +0000 (14:31 +1000)]
mesa/dd: burn a bunch of legacy driver interfaces down

None of these are used anymore in the gallium world, there
are some more to get rid off but this is a good start.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14074>

2 years agomesa: drop unused sw extensions init
Dave Airlie [Mon, 6 Dec 2021 04:35:51 +0000 (14:35 +1000)]
mesa: drop unused sw extensions init

This isn't used since swrast went away.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14072>

2 years agomtypes: drop some context pointers that are unused now
Dave Airlie [Mon, 6 Dec 2021 03:33:28 +0000 (13:33 +1000)]
mtypes: drop some context pointers that are unused now

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14072>

2 years agomesa: remove old tnl device driver header files
Timothy Arceri [Mon, 6 Dec 2021 00:28:34 +0000 (11:28 +1100)]
mesa: remove old tnl device driver header files

The last users of these were removed when the classic drivers were
dropped.

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

2 years agoradv: Expose the VK_KHR_dynamic_rendering extension.
Bas Nieuwenhuizen [Mon, 1 Nov 2021 15:36:44 +0000 (16:36 +0100)]
radv: Expose the VK_KHR_dynamic_rendering extension.

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

2 years agoradv: Support dynamic rendering inheritance info.
Bas Nieuwenhuizen [Mon, 8 Nov 2021 17:23:47 +0000 (18:23 +0100)]
radv: Support dynamic rendering inheritance info.

Straightforward, just converting to a renderpass as well. Note that
we now own the renderpass so I also added a bool to check if we own
it so we can destroy it after recording.

Doing the destruction at destroy & reset time, as reset can be called
during recording, and destroy all the time.

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

2 years agoradv: Support Begin/EndRendering.
Bas Nieuwenhuizen [Mon, 8 Nov 2021 17:24:06 +0000 (18:24 +0100)]
radv: Support Begin/EndRendering.

This is just the naive implementation that create a new renderpass
and then destroys it at the end.

I do it this way because in meta operations we are still creating
temporary subpasses for a renderpass for e.g. the resolve.

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

2 years agoradv: Support VK_KHR_dynamic_rendering for pipeline creation.
Bas Nieuwenhuizen [Sun, 31 Oct 2021 12:55:58 +0000 (13:55 +0100)]
radv: Support VK_KHR_dynamic_rendering for pipeline creation.

The approach here is to include a wrapper converting the legacy
renderpass info to the new structures.

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

2 years agoradv: Do not use VK_FORMAT_UNDEFINED in meta passes.
Bas Nieuwenhuizen [Sun, 7 Nov 2021 14:00:13 +0000 (15:00 +0100)]
radv: Do not use VK_FORMAT_UNDEFINED in meta passes.

Is used in VK_KHR_dynamic_rendering to indicate non-presence of
color attachments. Wasn't really valid Vulkan so we otherwise don't
need a workaround in the renderpass->dynamic rendering conversion.

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

2 years agoradv: Add named constants for max framebuffer width/height.
Bas Nieuwenhuizen [Sun, 21 Nov 2021 01:01:46 +0000 (02:01 +0100)]
radv: Add named constants for max framebuffer width/height.

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

2 years agospirv: handle ray query intrinsics
Lionel Landwerlin [Mon, 7 Jun 2021 14:06:14 +0000 (17:06 +0300)]
spirv: handle ray query intrinsics

v2: Fixup comment (Caio)
    Use generated builders (Caio)

v3: Update spirv2dxil CI expectations

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13718>

2 years agonir: add a ray query optimization pass
Lionel Landwerlin [Tue, 19 Oct 2021 11:14:20 +0000 (14:14 +0300)]
nir: add a ray query optimization pass

Just remove queries that are never used or proceeded with. The latter
case leading to undefined values.

v2: Don't use nir_shader_instructions_pass() to find variables (Caio)
    Simplify replacement (Caio)

v3: Don't track all the queries intrinsic effects (Caio)
    Rename things to represent only read queries (Caio)
    Use set instead of hash_table (Caio)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13718>

2 years agonir: track variables representing ray queries
Lionel Landwerlin [Wed, 20 Oct 2021 12:51:43 +0000 (15:51 +0300)]
nir: track variables representing ray queries

v2: Fix missing ray_query variable check (Caio)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13718>

2 years agonir: add intrinsics for ray queries
Lionel Landwerlin [Mon, 7 Jun 2021 13:20:28 +0000 (16:20 +0300)]
nir: add intrinsics for ray queries

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13718>

2 years agonir: add a new access flag to allow access in helper invocations
Lionel Landwerlin [Fri, 29 Oct 2021 15:04:55 +0000 (18:04 +0300)]
nir: add a new access flag to allow access in helper invocations

v2: Add nir_print support

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13718>

2 years agonir/print: printout ACCESS_STREAM_CACHE_POLICY
Lionel Landwerlin [Wed, 10 Nov 2021 09:25:05 +0000 (11:25 +0200)]
nir/print: printout ACCESS_STREAM_CACHE_POLICY

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13718>

2 years agonir/lower_io: include the variable access in the lowered intrinsic
Lionel Landwerlin [Thu, 28 Oct 2021 10:47:41 +0000 (13:47 +0300)]
nir/lower_io: include the variable access in the lowered intrinsic

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13718>

2 years agointel/nir: preserve access value when duping intrinsic
Lionel Landwerlin [Wed, 27 Oct 2021 16:02:38 +0000 (19:02 +0300)]
intel/nir: preserve access value when duping intrinsic

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 6339aba775ecdc ("intel/compiler: Lower SSBO and shared loads/stores in NIR")
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13718>

2 years agovulkan: Open registry XML files as UTF-8
Yonggang Luo [Thu, 2 Dec 2021 15:39:20 +0000 (23:39 +0800)]
vulkan: Open registry XML files as UTF-8

"C:\CI-Tools\msys64\mingw64\bin/python3.EXE" "../../src/vulkan/util/gen_enum_to_str.py" "--xml" "../../src/vulkan/registry/vk.xml" "--outdir" "C:/work/xemu/xemu-opengl/mesa/build/windows-mingw64/src/vulkan/util"
Traceback (most recent call last):
  File "C:\work\xemu\xemu-opengl\mesa\src\vulkan\util\gen_enum_to_str.py", line 473, in <module>
    main()
  File "C:\work\xemu\xemu-opengl\mesa\src\vulkan\util\gen_enum_to_str.py", line 462, in main
    f.write(template.render(
UnicodeEncodeError: 'gbk' codec can't encode character '\xa9' in position 107: illegal multibyte sequence

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14015>

2 years agovenus: move bo allocation for mappable memory to vn_MapMemory
Yiwei Zhang [Fri, 19 Nov 2021 07:15:48 +0000 (07:15 +0000)]
venus: move bo allocation for mappable memory to vn_MapMemory

This change defers the bo allocation for non-external mappable memory
direct allocation.

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

2 years agovenus: track memory type property flags in vn_device_memory
Yiwei Zhang [Fri, 19 Nov 2021 06:27:13 +0000 (06:27 +0000)]
venus: track memory type property flags in vn_device_memory

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

2 years agovenus: defer roundtrip waiting to vkFreeMemory time
Yiwei Zhang [Sun, 28 Nov 2021 00:04:11 +0000 (00:04 +0000)]
venus: defer roundtrip waiting to vkFreeMemory time

bo allocations for the below cases are after device memory allocation:

1. direct non-external mappable memory allocation
2. pool grow
3. exportable memory allocation

For (1) and (2), the bo is for mapping, which is a pure kernel operation
to happen later. So roundtrip waiting can be deferred until free memory.

For (3), the bo is for either fd export or mapping, which are both pure
kernel operations. So roundtrip waiting can also be deferred until free
memory.

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

2 years agovenus: simplify device memory pool alloc and refcount
Yiwei Zhang [Thu, 2 Dec 2021 21:46:38 +0000 (21:46 +0000)]
venus: simplify device memory pool alloc and refcount

The behavior we stick to is that the base_bo is always created for pool
memory so that to keep it alive during suballocates and frees.

This CL does the below:
1. rename pool_alloc to pool_suballocate and align the api interface
2. rename simple_alloc to pool_grow_alloc to make it pool specific
3. refactor pool_free and simple_free into a pair of pool_ref and
   pool_unref to simplify that vkFreeMemory is only called after the
   pool bo gets destroyed.

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

2 years agovenus: refactor vn_device_memory_simple_alloc
Yiwei Zhang [Thu, 2 Dec 2021 23:47:39 +0000 (23:47 +0000)]
venus: refactor vn_device_memory_simple_alloc

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

2 years agonv50: don't claim support for format-less stores
Ilia Mirkin [Fri, 3 Dec 2021 18:23:29 +0000 (13:23 -0500)]
nv50: don't claim support for format-less stores

This is not supported, nor is there any need to support it -- ES 3.1
doesn't need it, and we're in no danger of supporting
ARB_shader_image_load_store (among other things, it requires frag
images).

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14050>

2 years agonv50,nvc0: add new caps to list
Ilia Mirkin [Fri, 3 Dec 2021 18:00:43 +0000 (13:00 -0500)]
nv50,nvc0: add new caps to list

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14050>

2 years agointel/compiler: Load draw_id from XP0 in Task/Mesh shaders
Marcin Ślusarz [Fri, 16 Jul 2021 13:03:20 +0000 (15:03 +0200)]
intel/compiler: Load draw_id from XP0 in Task/Mesh shaders

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

2 years agointel/compiler: Get mesh_global_addr from the Inline Parameter for Task/Mesh
Marcin Ślusarz [Mon, 12 Jul 2021 11:43:03 +0000 (13:43 +0200)]
intel/compiler: Get mesh_global_addr from the Inline Parameter for Task/Mesh

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

2 years agointel/compiler: extract brw_nir_load_global_const out of rt code
Marcin Ślusarz [Mon, 12 Jul 2021 11:20:22 +0000 (13:20 +0200)]
intel/compiler: extract brw_nir_load_global_const out of rt code

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

2 years agointel/compiler: Implement Mesh Output
Caio Oliveira [Fri, 29 Oct 2021 19:56:22 +0000 (12:56 -0700)]
intel/compiler: Implement Mesh Output

Use the same URB access helpers that were added for Task Output.  The
Arrayed I/O (per-primitive and per-vertex) is handled by applying the
pitch from the MUE layout into the NIR intrinsics and including the
non-arrayed offset on top of it.  After that, the index src can be
used directly for lowering.

Because we keep around the non-arrayed offset AND the pitch is
aligned, we can identify cases where the access is indirect but
guaranteed to be aligned, and dispatch a single message.  Added a TODO
to explore that later.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agointel/compiler: Implement Task Output and Mesh Input
Caio Oliveira [Fri, 29 Oct 2021 19:45:17 +0000 (12:45 -0700)]
intel/compiler: Implement Task Output and Mesh Input

Implement the output written by the task *workgroup* and available to
all the mesh *workgroups* dispatched from that task.  We currently
ignore any layout annotations (since they are not really testable) and
produce a (packed) layout ourselves.

The URB messages are only SIMD8, so for larger SIMDs, the functions
will produce multiple messages.  Making this lowering here instead of
the generic lower_simd_width() since it is not just a matter of
zip/unzip, e.g. the offset must be adjusted.

Indirect writes/reads are implemented by handling one component at a
time and using the PER_SLOT variant of the messages.

Note that VK_NV_mesh_shader allows reading outputs, so add support for
that as well.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agointel/compiler: Lower Task/Mesh local_invocation_{id,index}
Caio Oliveira [Fri, 29 Oct 2021 19:48:54 +0000 (12:48 -0700)]
intel/compiler: Lower Task/Mesh local_invocation_{id,index}

The Invocation index is provided by the payload, so we can skip the
usual math done to get to it.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agointel/compiler: Add backend compiler basics for Task/Mesh
Caio Oliveira [Fri, 29 Oct 2021 19:27:45 +0000 (12:27 -0700)]
intel/compiler: Add backend compiler basics for Task/Mesh

Task/Mesh stages are CS-like stages, and include many
builtins (e.g. workgroup ID/index) and intrinsics (e.g. workgroup
memory primitives) originally present only in CS.

This commit add two new stages (task and mesh) that 'inherit' from CS
by embedding a brw_cs_prog_data in their own prog_data structure, so
that CS functionality can be easily reused.  They also currently use
the same helpers to select the SIMD variant to use -- that was
recently added for CS.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agointel/compiler: Export brw_nir_lower_simd
Caio Oliveira [Tue, 18 May 2021 17:37:36 +0000 (10:37 -0700)]
intel/compiler: Export brw_nir_lower_simd

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agointel/compiler: Make MUE available when setting up FS URB access
Caio Oliveira [Tue, 18 May 2021 18:05:33 +0000 (11:05 -0700)]
intel/compiler: Make MUE available when setting up FS URB access

Allows to assert its existence for per-primitive variables and will
later be useful to implement the "more than 16 attributes" case for
Mesh.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agointel/compiler: Add structs to hold TUE/MUE
Caio Oliveira [Tue, 18 May 2021 18:06:59 +0000 (11:06 -0700)]
intel/compiler: Add structs to hold TUE/MUE

Used to specify the layout of 'Task URB Entry' and 'Mesh URB Entry'.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agointel/compiler: Don't lower Mesh/Task I/O to temporaries
Caio Oliveira [Fri, 29 Oct 2021 19:10:00 +0000 (12:10 -0700)]
intel/compiler: Don't lower Mesh/Task I/O to temporaries

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agointel/compiler: Don't stage Task/Mesh outputs in registers
Caio Oliveira [Tue, 18 May 2021 17:58:26 +0000 (10:58 -0700)]
intel/compiler: Don't stage Task/Mesh outputs in registers

Since the outputs are shared among the whole workgroup, these can't be
staged in registers as they will not be always visible for all the
invocations (to read/flush).  If they ever need to be staged, we
should use SLM for that.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agointel/compiler: Handle per-primitive inputs in FS
Caio Oliveira [Tue, 18 May 2021 17:17:43 +0000 (10:17 -0700)]
intel/compiler: Handle per-primitive inputs in FS

In Fragment Shader, regular inputs are laid out in the thread payload
in a one dword per each half-GRF, that gives room for having the two
delta dwords needed for interpolation.

Per-primitive inputs are laid out before the regular inputs, and since
there's no need to have delta information, they are packed.  So
half-GRF will be fully filled with 4 dwords of input.

When num_per_primitive_inputs is zero (the default case), behavior
should be the same as before.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agointel/compiler: Properly lower WorkgroupId for Task/Mesh
Caio Oliveira [Tue, 18 May 2021 17:11:42 +0000 (10:11 -0700)]
intel/compiler: Properly lower WorkgroupId for Task/Mesh

Task/Mesh currently only support a single dimension (both in NV API
and HW), so make Y and Z be zero.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agointel: Add INTEL_DEBUG=task,mesh
Caio Oliveira [Wed, 10 Feb 2021 04:07:22 +0000 (20:07 -0800)]
intel: Add INTEL_DEBUG=task,mesh

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13661>

2 years agomesa: move common/dri into gallium
Dylan Baker [Thu, 5 Aug 2021 18:10:31 +0000 (11:10 -0700)]
mesa: move common/dri into gallium

There are no other consumers, so we can just move this into gallium and
out of mesa.

Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agomesa: Merge libmesa_gallium and libmesa_common
Dylan Baker [Thu, 5 Aug 2021 18:00:01 +0000 (11:00 -0700)]
mesa: Merge libmesa_gallium and libmesa_common

Since we don't have libmesa_classic anymore, we don't nee to split
these, and can save a target/ar invocation by not having two targets.
Plus it's just conceptually simpler

Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agomesa: Delete libmesa_classic
Dylan Baker [Thu, 5 Aug 2021 17:48:28 +0000 (10:48 -0700)]
mesa: Delete libmesa_classic

We no longer have any classic drivers, so we no longer need
libmesa_classic

Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agomesa/main/tests: remove dispatch sanity
Dylan Baker [Fri, 9 Apr 2021 19:21:33 +0000 (12:21 -0700)]
mesa/main/tests: remove dispatch sanity

Thsi test uses a bunch of the classic infastructure, which is about to
be deleted. Since gallium will be the sole user, it will likely be
refactored out anyway.

Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agoinclude/pci_ids: Move PCI ids supported by both i965 and iris to iris
Dylan Baker [Fri, 9 Apr 2021 19:15:01 +0000 (12:15 -0700)]
include/pci_ids: Move PCI ids supported by both i965 and iris to iris

As crocus won't support any of these (BDW+) they should go into iris.
This also allows us to remove the "prefer_iris" option, as iris is now
the only option

Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agomesa/dri: remove mega driver stub
Dylan Baker [Wed, 17 Nov 2021 22:46:57 +0000 (14:46 -0800)]
mesa/dri: remove mega driver stub

As it is now unused.

Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agoclassic/i965: Remove driver
Dylan Baker [Mon, 12 Apr 2021 18:26:45 +0000 (11:26 -0700)]
classic/i965: Remove driver

Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agoclassic/i915: Remove driver
Dylan Baker [Fri, 9 Apr 2021 17:00:44 +0000 (10:00 -0700)]
classic/i915: Remove driver

This is only going to be supported in the Amber branch

Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agoclassic/nouveau: Remove driver
Dylan Baker [Fri, 9 Apr 2021 16:51:38 +0000 (09:51 -0700)]
classic/nouveau: Remove driver

This will now only be available in the Amber branch

Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agoclassic/r200: Delete driver
Dylan Baker [Fri, 9 Apr 2021 16:49:49 +0000 (09:49 -0700)]
classic/r200: Delete driver

This will now only be available on the Amber branch

Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agoclassic/r100: Delete driver
Dylan Baker [Fri, 9 Apr 2021 16:48:36 +0000 (09:48 -0700)]
classic/r100: Delete driver

This is now only going to be available in the Amber branch

Reviewed-by: Emma Anholt <emma@anholt.net>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agomesa/x11: Remove the swrast-classic-based fake libGL
Adam Jackson [Thu, 15 Apr 2021 17:07:40 +0000 (10:07 -0700)]
mesa/x11: Remove the swrast-classic-based fake libGL

If you want this you will almost certainly be happier with the gallium
version, giving you llvmpipe instead of swrast-classic.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10153>

2 years agomesa/tests: ensure that util_cpu_detect has been called
Dylan Baker [Fri, 3 Dec 2021 20:54:26 +0000 (12:54 -0800)]
mesa/tests: ensure that util_cpu_detect has been called

I think that this test was passing in some cases because of loader side
effects, that stop happening after classic is removed.

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

2 years agogitlab-ci: detect a3xx gpu hang recovery failure
Ilia Mirkin [Wed, 1 Dec 2021 03:52:49 +0000 (22:52 -0500)]
gitlab-ci: detect a3xx gpu hang recovery failure

But don't bail immediately, instead print out some more lines after the
hang, hopefully catching info about the cause of the hang.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14033>

2 years agogitlab-ci: serial close can leave an active read
Ilia Mirkin [Thu, 2 Dec 2021 06:30:45 +0000 (01:30 -0500)]
gitlab-ci: serial close can leave an active read

So instead cancel the read first, and then close. Make sure the
serial-reading properly detects this cancelled condition under all
circumstances and exits.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14033>

2 years agod3d12: Handle depth readback on drivers that require full-resource copies for depth
Jesse Natalie [Fri, 3 Dec 2021 18:45:20 +0000 (10:45 -0800)]
d3d12: Handle depth readback on drivers that require full-resource copies for depth

Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14051>

2 years agonir: Print task and mesh shader I/O variable names.
Timur Kristóf [Wed, 1 Dec 2021 18:05:12 +0000 (19:05 +0100)]
nir: Print task and mesh shader I/O variable names.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Caio Oliveira <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14007>

2 years agofreedreno/a5xx: enable OES_gpu_shader5
Ilia Mirkin [Fri, 3 Dec 2021 05:45:43 +0000 (00:45 -0500)]
freedreno/a5xx: enable OES_gpu_shader5

This extension is controlled by the ESSL feature level. Bump it up since
all parts of OES_gpu_shader5 should be supported.

This also avoids lowering all of the "advanced" functions (which should
probably not be lowered in the first place since they're part of ES
3.1...)

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14035>

2 years agoradv: Use util_widen_mask.
Timur Kristóf [Thu, 2 Dec 2021 08:27:41 +0000 (09:27 +0100)]
radv: Use util_widen_mask.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14005>

2 years agoaco: Use util_widen_mask.
Timur Kristóf [Thu, 2 Dec 2021 08:26:42 +0000 (09:26 +0100)]
aco: Use util_widen_mask.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14005>

2 years agoutil: Add util_widen_mask function.
Timur Kristóf [Wed, 1 Dec 2021 18:37:02 +0000 (19:37 +0100)]
util: Add util_widen_mask function.

Widens the given bit mask by a multiplier, meaning that it will
replicate each bit by that amount.
For example: 0b101 widened by 2 will become: 0b110011

This is typically used in shader I/O to transform a 64-bit
writemask to a 32-bit writemask.

Moving this function here because it is used in multiple places.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14005>

2 years agonir: Fix sorting per-primitive outputs.
Timur Kristóf [Wed, 1 Dec 2021 15:24:43 +0000 (16:24 +0100)]
nir: Fix sorting per-primitive outputs.

Fixes: 59860d487368e18a1d85ea96988c5f4c904879b0
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14006>

2 years agoCI: Don't stream wget directly into bash
Daniel Stone [Fri, 3 Dec 2021 07:07:47 +0000 (07:07 +0000)]
CI: Don't stream wget directly into bash

If our environment has pipefail set, bash could exit early before wget
has completed, and we will die with a broken pipe. Work around this by
first downloading from wget, and then executing from bash.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14036>

2 years agov3d: enable ARB_texture_view
Juan A. Suarez Romero [Fri, 15 Oct 2021 16:20:05 +0000 (18:20 +0200)]
v3d: enable ARB_texture_view

v2 (Iago):
 - Add comments to failing tests

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agov3d: enable ARB_texture_buffer_object and ARB_texture_buffer_range
Alejandro Piñeiro [Mon, 16 Sep 2019 12:23:07 +0000 (14:23 +0200)]
v3d: enable ARB_texture_buffer_object and ARB_texture_buffer_range

Through their specific PIPE_CAP.

v2 (Iago)
 - Add comment in test failure

Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agost/pbo: set layer coord for array textures
Juan A. Suarez Romero [Thu, 14 Oct 2021 16:40:13 +0000 (18:40 +0200)]
st/pbo: set layer coord for array textures

Even for drivers not supporting layers, we need to include the layer
coordinate (zero in this case) when using array textures in the
download/upload FS.

Otherwise we are missing a component to get the texture, which ends up
in a malformed NIR shader.

v5 (Ilia):
 - Do not emit needless layer code.

v6 (Ilia):
 - Add comment clarifying the code logic behind.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agost/pbo: add the image format in the download FS
Juan A. Suarez Romero [Wed, 13 Oct 2021 10:56:15 +0000 (12:56 +0200)]
st/pbo: add the image format in the download FS

In the V3D driver there is a NIR lowering step for `image_store`
intrinsic, where the image store format is required for doing the proper
lowering.

Thus, let's define it for the download FS instead of
keeping it as NONE.

v2 (Illia)
 - Use format only for drivers not supporting format-less writing.

v4 (Illia):
 - Use PIPE_CAP_IMAGE_STORE_FORMATTED to reduce combinations.

v5 (Ilia):
 - Use indirect array for download FS in not formatless-store support
   drivers.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agogallium: add new PIPE_CAP_IMAGE_STORE_FORMATTED
Juan A. Suarez Romero [Thu, 25 Nov 2021 11:09:50 +0000 (12:09 +0100)]
gallium: add new PIPE_CAP_IMAGE_STORE_FORMATTED

This capability is enabled for drivers supporting formatless image
writing in shader.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agov3d: clamp clear color
Juan A. Suarez Romero [Wed, 22 Sep 2021 07:10:53 +0000 (09:10 +0200)]
v3d: clamp clear color

On clearing a color buffer, clamp the passed color values to the allowed
ones.

Hardware do clamping for TLB values, but not for clear values.

v2 (Iago)
 - Add comment about hardware-based clamping on clear values.

v3 (Iago):
 - Use format utils to simplify clamping
 - Move clamp color function as utility

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agogallium/util: add helper to clamp colors to valid range
Juan A. Suarez Romero [Fri, 29 Oct 2021 14:04:47 +0000 (16:04 +0200)]
gallium/util: add helper to clamp colors to valid range

v3 (Iago):
 - Fix comment.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agost/pbo: do not use GS for NIR preferred shaders
Juan A. Suarez Romero [Wed, 15 Sep 2021 13:51:37 +0000 (15:51 +0200)]
st/pbo: do not use GS for NIR preferred shaders

If PBO require to use a GS, this is created with TGSI.

For drivers preferring NIR shaders, they need to translate it from TGSI
to NIR. But unfortunately TGSI to NIR for GS is not implemented, which
makes it crash.

So let's use a GS only for drivers preferring TGSI.

v3:
 - Add comment (Iago and Alejandro)

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agomesa: allow TEXTURE_BUFFER target for ARB_texture_buffer_range
Juan A. Suarez Romero [Tue, 14 Sep 2021 07:37:16 +0000 (09:37 +0200)]
mesa: allow TEXTURE_BUFFER target for ARB_texture_buffer_range

While TEXTURE_BUFFER do not support texture parameters in
ARB_texture_buffer_object specification, it does in
ARB_texture_buffer_range, specifically TEXTURE_BUFFER_OFFSET and
TEXTURE_BUFFER_SIZE.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agov3d: restrict formats supported for PIPE_BIND_SHADER_IMAGE
Alejandro Piñeiro [Sun, 5 Sep 2021 23:12:52 +0000 (01:12 +0200)]
v3d: restrict formats supported for PIPE_BIND_SHADER_IMAGE

So far we were relying on the supported formats filtering when
creating images from the user API.

But for some other (internal) uses, some of the formats that pass the
filter need to be restricted when binding them as shader images, as they
are not supported for this case.

v3 (Iago):
 - Change commit message.

Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agov3d: add support for no buffer object bound
Alejandro Piñeiro [Thu, 26 Aug 2021 00:01:28 +0000 (02:01 +0200)]
v3d: add support for no buffer object bound

From the GL_OES_texture_buffer spec:

      "If no buffer object is bound to the buffer texture, the results
       of the texel access are undefined."

this can be interpreted as allowing any result to come back, but not
terminate the program.

The current solution is not entirely complete, as it could still try to
get a wrong address for the shader state address.

This can be checked with piglit test
arb_texture_buffer_object-render-no-bo; the test is skip because it
requires OpenGL 3.1, but if overriding the version then it will crash.

Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agov3d: support for texture buffer objects
Alejandro Piñeiro [Thu, 17 Oct 2019 13:27:07 +0000 (15:27 +0200)]
v3d: support for texture buffer objects

This commit handles the support for texture buffer objects. In general
it is mostly about using the buffer info from the pipe_image_view
instead of the texture info.

v2:
 - Rework some assertions (Iago)
 - Remove needless comment (Alejandro)
 - Fix comment typos (Iago)

v3:
 - Fix typos (Iago)

Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13409>

2 years agonir/algebraic: optimize a*#b & -4
Rhys Perry [Thu, 11 Nov 2021 11:16:06 +0000 (11:16 +0000)]
nir/algebraic: optimize a*#b & -4

fossil-db (Sienna Cichlid):
Totals from 611 (0.47% of 128647) affected shaders:
CodeSize: 3096680 -> 3090976 (-0.18%)
Instrs: 570494 -> 569249 (-0.22%)
Latency: 5765865 -> 5759619 (-0.11%)
InvThroughput: 969840 -> 967608 (-0.23%)
VClause: 9690 -> 9688 (-0.02%)
Copies: 42884 -> 42894 (+0.02%); split: -0.01%, +0.03%
PreVGPRs: 28290 -> 28288 (-0.01%)

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

2 years agonir/opt_offsets: remove need to loop try_extract_const_addition
Rhys Perry [Thu, 2 Dec 2021 13:51:24 +0000 (13:51 +0000)]
nir/opt_offsets: remove need to loop try_extract_const_addition

fossil-db (Sienna Cichlid):
Totals from 1 (0.00% of 134572) affected shaders:
no stat changes

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14009>

2 years agonir/opt_offsets: fix try_extract_const_addition recursion
Rhys Perry [Thu, 2 Dec 2021 13:14:22 +0000 (13:14 +0000)]
nir/opt_offsets: fix try_extract_const_addition recursion

This initially looks like a miscompilation bug, but I don't think it's
actually possible for it to create incorrect code.

fossil-db (Sienna Cichlid):
Totals from 32 (0.02% of 134572) affected shaders:
VGPRs: 1336 -> 1320 (-1.20%)
CodeSize: 90552 -> 89468 (-1.20%)
Instrs: 17007 -> 16852 (-0.91%); split: -0.92%, +0.01%
Latency: 429040 -> 428136 (-0.21%); split: -0.21%, +0.00%
InvThroughput: 84966 -> 84572 (-0.46%); split: -0.47%, +0.00%
Copies: 1458 -> 1468 (+0.69%); split: -0.07%, +0.75%
Branches: 382 -> 384 (+0.52%)
PreSGPRs: 970 -> 968 (-0.21%)
PreVGPRs: 1029 -> 1011 (-1.75%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14009>

2 years agonir: add NIR_DEBUG envvar
Juan A. Suarez Romero [Wed, 17 Nov 2021 15:10:52 +0000 (16:10 +0100)]
nir: add NIR_DEBUG envvar

Move all the NIR related debug environmental variables in a single
NIR_DEBUG one.

Use NIR_DEBUG=help to print all the available options.

v2:
 - Use a macro to simplify (Marcin, Jason)
 - Remove wrong changes (Marcin)

v3 (Marcin):
 - Remove rendundant NIR mentioning in option descriptions.
 - Unwrap option descriptions.
 - Ensure the constant is unsigned.
 - Use extern array to remove switch.

v4:
 - Add missing kernel shader (Jason).
 - Add unlikely() (Marcin).

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13840>

2 years agobroadcom/compiler: improve documentation for Z writes
Iago Toral Quiroga [Fri, 3 Dec 2021 09:44:14 +0000 (10:44 +0100)]
broadcom/compiler: improve documentation for Z writes

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

2 years agov3d,v3dv: don't disable EZ for passthrough Z writes
Iago Toral Quiroga [Fri, 3 Dec 2021 09:29:16 +0000 (10:29 +0100)]
v3d,v3dv: don't disable EZ for passthrough Z writes

The early-Z test uses Z values produced from FEP, so when
we write Z from a shader we need to disable EZ. However, there
are some instances where want to write the FEP-Z from the shader,
in which case we would not need to disable EZ.

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

2 years agobroadcom/compiler: track passthrough Z writes
Iago Toral Quiroga [Fri, 3 Dec 2021 09:22:45 +0000 (10:22 +0100)]
broadcom/compiler: track passthrough Z writes

In some cases we need to make the shaders write the Z value produced
from rasterization (FEP). Track these instances because they are relevant
to early EZ setup.

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

2 years agobroadcom/compiler: emit passthrough Z write if shader reads Z
Iago Toral Quiroga [Thu, 2 Dec 2021 10:18:13 +0000 (11:18 +0100)]
broadcom/compiler: emit passthrough Z write if shader reads Z

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

2 years agoanv: allow VK_IMAGE_LAYOUT_UNDEFINED as final layout
Tapani Pälli [Thu, 2 Dec 2021 08:44:10 +0000 (10:44 +0200)]
anv: allow VK_IMAGE_LAYOUT_UNDEFINED as final layout

From VK_KHR_synchronization2:
   "Image memory barriers that do not perform an image layout
    transition can be specified by setting oldLayout equal to
    newLayout.

    E.g. the old and new layout can both be set to
    VK_IMAGE_LAYOUT_UNDEFINED, without discarding data in the
    image."

v2: make assert more readable (Lionel Landwerlin)

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