platform/upstream/mesa.git
22 months agoci/docs: Always expose the built docs.
Emma Anholt [Mon, 14 Nov 2022 21:22:53 +0000 (13:22 -0800)]
ci/docs: Always expose the built docs.

When testing my docs changes outside of an MR, there was no way to look at
the result.

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

22 months agointel: Fix crashes for importing drm buffer
Peng Huang [Sun, 11 Dec 2022 21:07:06 +0000 (16:07 -0500)]
intel: Fix crashes for importing drm buffer

image_aspect_to_binding() converts aspect to index by subrracting
VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT, however these enum values
are bitfields, not consecutive numbers, so comparing and subtracting
them won't work.

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

22 months agohasvk: pipelineStageCreationFeedbackCount is allowed to be 0
Iván Briano [Tue, 6 Sep 2022 22:28:26 +0000 (15:28 -0700)]
hasvk: pipelineStageCreationFeedbackCount is allowed to be 0

Fixes: 6601e5d6fc6 ("anv: implement VK_EXT_pipeline_creation_feedback")

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

22 months agovdpau: allow building vdpau st with virgl only
Jan Palus [Thu, 1 Dec 2022 17:32:53 +0000 (18:32 +0100)]
vdpau: allow building vdpau st with virgl only

Fixes: 6b5aecb1955 ("virgl: add support for hardware video acceleration")

Signed-off-by: Jan Palus <jpalus@fastmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20108>

22 months agoglsl: fix function inlining for images
Timothy Arceri [Mon, 12 Dec 2022 02:06:54 +0000 (13:06 +1100)]
glsl: fix function inlining for images

Here we skip replacing parameters with their actual values for
images as glsl_to_nir() expects them to be copied to temps first.
Tree grafting has a similiar rule to avoid this happening also.

Fixes: 8d10a6835f32 ("glsl: dont create temps for builtin function inputs")

Tested-by: Martin Roukala <martin.roukala@mupuf.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20274>

22 months agoradv: Improved export conflict bug workaround.
Bas Nieuwenhuizen [Mon, 12 Dec 2022 01:29:34 +0000 (02:29 +0100)]
radv: Improved export conflict bug workaround.

Based on f129db911bd ("radeonsi/gfx11: use a better workaround for the export conflict bug")
which claims better performance.

I couldn't be bothered to do the refactor to check the sample count with
dynamic sample counts, so this is just conservative there.

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

22 months agomesa: move the _mesa_set_varying_vp_inputs call to where the state changes
Marek Olšák [Wed, 23 Nov 2022 10:08:07 +0000 (05:08 -0500)]
mesa: move the _mesa_set_varying_vp_inputs call to where the state changes

This removes the _mesa_update_vao_state() call from all glDraw* functions
where it was executed unconditionally.

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

22 months agomesa: move _DrawVAOEnabledAttribs determination into st_update_array
Marek Olšák [Tue, 22 Nov 2022 11:57:43 +0000 (06:57 -0500)]
mesa: move _DrawVAOEnabledAttribs determination into st_update_array

This can just be computed where it's used.

Now the non-glDraw paths like glRasterPos, glBegin/End, and the slow
display list path have to save and restore _VPModeInputFilter, which
is the only field that's different from the glDraw* path.

_VPModeInputFilter is a bitmask of VP inputs that might have to be bound.
The only difference with glBegin/End and the slow display list path is
that they also add VERT_BIT_MAT_ALL to the bitmask, whereas the glDraw* path
doesn't have that.

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

22 months agomesa: inline _mesa_draw_array_bits & _mesa_draw_current_bits
Marek Olšák [Tue, 22 Nov 2022 09:37:31 +0000 (04:37 -0500)]
mesa: inline _mesa_draw_array_bits & _mesa_draw_current_bits

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

22 months agomesa: don't AND with VERT_BIT_ALL because it's ~0u
Marek Olšák [Tue, 22 Nov 2022 09:34:04 +0000 (04:34 -0500)]
mesa: don't AND with VERT_BIT_ALL because it's ~0u

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

22 months agomesa: simplify VBO state flagging in _mesa_update_vao_state
Marek Olšák [Tue, 22 Nov 2022 09:30:46 +0000 (04:30 -0500)]
mesa: simplify VBO state flagging in _mesa_update_vao_state

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

22 months agomesa: remove VAO::NewVertexBuffers/Elements, set the dirty flags directly
Marek Olšák [Tue, 22 Nov 2022 09:25:42 +0000 (04:25 -0500)]
mesa: remove VAO::NewVertexBuffers/Elements, set the dirty flags directly

These intermediate dirty flags are unnecessary now.

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

22 months agomesa: move calling _mesa_update_vao_derived_arrays into st_update_array
Marek Olšák [Mon, 21 Nov 2022 13:24:17 +0000 (08:24 -0500)]
mesa: move calling _mesa_update_vao_derived_arrays into st_update_array

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

22 months agomesa: remove the NewVAO flag, set directly what we need to set
Marek Olšák [Mon, 21 Nov 2022 13:20:24 +0000 (08:20 -0500)]
mesa: remove the NewVAO flag, set directly what we need to set

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

22 months agost/mesa: move st_atom.c contents into st_context.c
Marek Olšák [Mon, 21 Nov 2022 13:03:23 +0000 (08:03 -0500)]
st/mesa: move st_atom.c contents into st_context.c

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

22 months agost/mesa: inline st_validate_state and remove redundant checking in callers
Marek Olšák [Mon, 21 Nov 2022 12:59:14 +0000 (07:59 -0500)]
st/mesa: inline st_validate_state and remove redundant checking in callers

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

22 months agost/mesa: remove the switch from st_validate_state by passing state mask directly
Marek Olšák [Mon, 21 Nov 2022 12:47:59 +0000 (07:47 -0500)]
st/mesa: remove the switch from st_validate_state by passing state mask directly

Instead of passing the enum that represents which states should be updated
to st_validate_state, pass the state bitmask to st_validate_state directly.
This removes the switch statement over the enums.

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

22 months agost/mesa: remove st_context::dirty, use gl_context::NewDirtyState instead
Marek Olšák [Mon, 21 Nov 2022 12:37:45 +0000 (07:37 -0500)]
st/mesa: remove st_context::dirty, use gl_context::NewDirtyState instead

We stored the same state in 2 different variables, and then we OR'd them.

This changes the st_validate_state logic slightly, but should be identical.

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

22 months agomesa: remove per_vertex_edgeflags parameter from DrawGalliumVertexState
Marek Olšák [Mon, 21 Nov 2022 12:15:03 +0000 (07:15 -0500)]
mesa: remove per_vertex_edgeflags parameter from DrawGalliumVertexState

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

22 months agomesa: completely rewrite the edge flag state update logic
Marek Olšák [Mon, 21 Nov 2022 09:53:39 +0000 (04:53 -0500)]
mesa: completely rewrite the edge flag state update logic

This removes the edge flag logic from st_validate_state, which was always
executed and added overhead there. Now it's done only when needed.

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

22 months agomesa: don't call _mesa_set_varying_vp_inputs in set_vertex_processing_mode
Marek Olšák [Fri, 18 Nov 2022 23:59:46 +0000 (18:59 -0500)]
mesa: don't call _mesa_set_varying_vp_inputs in set_vertex_processing_mode

It's redundant because it's always called in _mesa_update_draw_vao.

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

22 months agomesa: don't call _mesa_update_vao_derived_arrays for dynamic VAOs
Marek Olšák [Fri, 18 Nov 2022 23:43:19 +0000 (18:43 -0500)]
mesa: don't call _mesa_update_vao_derived_arrays for dynamic VAOs

This just moves the exit into the caller. There is nothing else in
_mesa_update_vao_derived_arrays that dynamic VAOs care about.

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

22 months agomesa: merge 2 switch statements into one in _mesa_get_derived_vao_masks
Marek Olšák [Fri, 18 Nov 2022 23:38:39 +0000 (18:38 -0500)]
mesa: merge 2 switch statements into one in _mesa_get_derived_vao_masks

_mesa_vao_enable_to_vp_inputs has a switch statement and we call it twice.
Let's inline it.

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

22 months agomesa: remove derived _EffEnabled* fields and compute them at their only use
Marek Olšák [Fri, 18 Nov 2022 23:18:33 +0000 (18:18 -0500)]
mesa: remove derived _EffEnabled* fields and compute them at their only use

We were passing the fields to their only use and used them only once,
so let's just compute them there.

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

22 months agomesa: merge _mesa_draw_(user_array,nonzero_divisor)_bits into one helper
Marek Olšák [Fri, 18 Nov 2022 23:06:55 +0000 (18:06 -0500)]
mesa: merge _mesa_draw_(user_array,nonzero_divisor)_bits into one helper

preparation for the next change

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

22 months agomesa: remove unused inline functions from arrayobj.h
Marek Olšák [Fri, 18 Nov 2022 22:40:38 +0000 (17:40 -0500)]
mesa: remove unused inline functions from arrayobj.h

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

22 months agomesa: keep the current VAO also set as _DrawVAO
Marek Olšák [Fri, 18 Nov 2022 22:04:50 +0000 (17:04 -0500)]
mesa: keep the current VAO also set as _DrawVAO

This removes setting _DrawVAO from all glDraw* functions that draw
primitives because now _DrawVAO is always equal to the current VAO.

glEnd, glRasterPos, and the slow display list path now have to save
_DrawVAO before changing it, and restore it after they are done.

This also removes _EmptyVAO, which becomes unused because we no longer
bind "no VAO" into _DrawVAO.

Rules:
- only glBindVertexArray and non-glDraw* paths should call
  _mesa_set_draw_vao, other places shouldn't
- only draws should call _mesa_update_vao_state, other places shouldn't

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

22 months agomesa: split _mesa_set_draw_vao into set and update functions
Marek Olšák [Fri, 18 Nov 2022 21:27:36 +0000 (16:27 -0500)]
mesa: split _mesa_set_draw_vao into set and update functions

This is the beginning of splitting _mesa_set_draw_vao and moving pieces
of it out of draw functions.

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

22 months agoradv: Handle NULL miss shaders
Friedrich Vock [Sun, 11 Dec 2022 21:49:18 +0000 (22:49 +0100)]
radv: Handle NULL miss shaders

Fixes reflections in DOOM Eternal.

Fixes: 85580faa ("radv: Add ray traversal loop.")
Closes: #6210
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20270>

22 months agoradv: Change shaderGroupBaseAlignment to RADV_RT_HANDLE_SIZE
Friedrich Vock [Tue, 29 Nov 2022 00:25:31 +0000 (01:25 +0100)]
radv: Change shaderGroupBaseAlignment to RADV_RT_HANDLE_SIZE

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

22 months agoradv: Force non uniform texture sampling with NV Remix
Konstantin Seurer [Sat, 10 Dec 2022 11:38:24 +0000 (12:38 +0100)]
radv: Force non uniform texture sampling with NV Remix

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20243>

22 months agoradv: Add a driconf option to force non uniform texture sampling
Konstantin Seurer [Sat, 10 Dec 2022 11:37:56 +0000 (12:37 +0100)]
radv: Add a driconf option to force non uniform texture sampling

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20243>

22 months agospirv: Add a debug option to force non uniform texture sampling
Konstantin Seurer [Sat, 10 Dec 2022 11:36:57 +0000 (12:36 +0100)]
spirv: Add a debug option to force non uniform texture sampling

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20243>

22 months agoradv/rt: Hash the pipeline key
Konstantin Seurer [Sat, 10 Dec 2022 12:13:09 +0000 (13:13 +0100)]
radv/rt: Hash the pipeline key

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20243>

22 months agoradv/rt: Propagate radv_pipeline_key
Konstantin Seurer [Sat, 10 Dec 2022 11:36:13 +0000 (12:36 +0100)]
radv/rt: Propagate radv_pipeline_key

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20243>

22 months agoradv/rt: Work around incorrect NOT_DEFERRED handling in Portal RTX
Konstantin Seurer [Fri, 9 Dec 2022 07:16:34 +0000 (08:16 +0100)]
radv/rt: Work around incorrect NOT_DEFERRED handling in Portal RTX

Allows Portal RTX to reach the main menu.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20243>

22 months agotu: Implement VK_EXT_descriptor_buffer
Connor Abbott [Mon, 19 Sep 2022 14:59:53 +0000 (16:59 +0200)]
tu: Implement VK_EXT_descriptor_buffer

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

22 months agovk/descriptor_set_layout: Add optional destructor
Connor Abbott [Thu, 6 Oct 2022 14:46:19 +0000 (16:46 +0200)]
vk/descriptor_set_layout: Add optional destructor

Drivers implementing descriptor buffers will want to allocate and free
descriptors with the layout for embedded samplers, so we need a hook to
allow them to free any GPU buffers.

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

22 months agotu: Fall back to ldg for variable-size inline uniform blocks
Connor Abbott [Wed, 30 Nov 2022 16:43:15 +0000 (17:43 +0100)]
tu: Fall back to ldg for variable-size inline uniform blocks

With descriptor buffers, we have no way to know how big the descriptor
set actually is, so we have no idea how many constants we can safely
push. If we use a UBO then it will still get pushed, because we normally
assume that we can freely access UBOs without any fear of faults due to
the range checking. This does the easiest thing of using raw pointer
loads, although performance will fall off a cliff, because we don't have
many better options.

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

22 months agoir3/a6xx: Fix immediate offset stg/ldg path
Connor Abbott [Wed, 30 Nov 2022 16:40:47 +0000 (17:40 +0100)]
ir3/a6xx: Fix immediate offset stg/ldg path

The immediate offset is in units of bytes, whereas the register offset
is in dwords. We need to compensate for that.

Also, fix an off-by-one when checking the range - the offset field is 13
bits, but the sign bit means we can only represent up to 1 << 12 in
bytes or 1 << 10 in dwords.

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

22 months agomicrosoft/compiler: Fix codegen when a loop ends in a jump
Jesse Natalie [Fri, 9 Dec 2022 19:29:02 +0000 (11:29 -0800)]
microsoft/compiler: Fix codegen when a loop ends in a jump

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7792
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20255>

22 months agomicrosoft/compiler: Handle holes in driver_location when adding sysvals
Jesse Natalie [Fri, 9 Dec 2022 18:48:13 +0000 (10:48 -0800)]
microsoft/compiler: Handle holes in driver_location when adding sysvals

All of the full runtime+compiler stacks reassign these driver_location
values to compact them and sort between shader stages, but for the
spirv2dxil tool, we leave the original shader's "location" intact. That
means that there can be holes in the driver_location space, and simply
counting how many inputs there are can lead to collisions. So instead
place all sysvals after the last-used driver_location.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7811
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20253>

22 months agoci: Bump virglrenderer version
Corentin Noël [Mon, 5 Dec 2022 14:51:00 +0000 (15:51 +0100)]
ci: Bump virglrenderer version

Update virglrenderer to the latest version on time.

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20277>

22 months agoir3/freedreno: Find regs for FS inputs when printing info
Danylo Piliaiev [Fri, 9 Dec 2022 11:31:56 +0000 (12:31 +0100)]
ir3/freedreno: Find regs for FS inputs when printing info

FS inputs are not directly loaded into regs, but require additional
instruction to do so. So in order to print in which reg the input
is loaded we have to scan the shader for the instruction
which loads the input.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20247>

22 months agoradv: fix assertion on gpu hang detection
Mikhail Korolev [Mon, 12 Dec 2022 08:02:43 +0000 (09:02 +0100)]
radv: fix assertion on gpu hang detection

fixes assert in RADV_DECL_PIPELINE_DOWNCAST when bound pipline is a compute
pipeline

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

22 months agointel/compiler: Remove leftover declarations of old NIR passes
Caio Oliveira [Sat, 12 Nov 2022 06:33:31 +0000 (22:33 -0800)]
intel/compiler: Remove leftover declarations of old NIR passes

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

22 months agointel/nir/rt: fixup primitive id
Lionel Landwerlin [Thu, 27 Oct 2022 13:56:38 +0000 (16:56 +0300)]
intel/nir/rt: fixup primitive id

There is a delta index value in the hit structure, we forgot to add it
to the base value.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Fixes: 046571479028 ("intel/nir/rt: add more helpers for ray queries")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7565
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19346>

22 months agoradv: fix hashing descriptor set layout
Samuel Pitoiset [Fri, 9 Dec 2022 14:59:52 +0000 (15:59 +0100)]
radv: fix hashing descriptor set layout

Shouldn't have pointers.

Fixes: 19f8d338761 ("radv: Use vk_descriptor_set_layout")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20250>

22 months agonir/lower_shader_calls: Remove phis after dead control flow
Friedrich Vock [Thu, 8 Dec 2022 20:37:06 +0000 (21:37 +0100)]
nir/lower_shader_calls: Remove phis after dead control flow

This potentially gets rid of some more phis without sources.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19960>

22 months agonir: Do not consider phis with incompatible dests equal
Friedrich Vock [Thu, 8 Dec 2022 20:26:28 +0000 (21:26 +0100)]
nir: Do not consider phis with incompatible dests equal

CSE tries to collapse equal instructions, and collapsing two phis with incompatible dests is illegal.

Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Fixes: 6bdce55c ("nir: Add a basic CSE pass")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19960>

22 months agodocs/release-calendar: add 22.3.x dates
Eric Engestrom [Fri, 2 Dec 2022 12:45:24 +0000 (12:45 +0000)]
docs/release-calendar: add 22.3.x dates

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20131>

22 months agozink: Don't set dynamic color attachment state for 0 attachments.
Emma Anholt [Tue, 6 Dec 2022 17:46:25 +0000 (09:46 -0800)]
zink: Don't set dynamic color attachment state for 0 attachments.

Fixes some validation failures like:

VUID-vkCmdSetColorBlendEquationEXT-attachmentCount-arraylength(ERROR / SPEC): msgNum: -175001922 - Validation Error: [ VUID-vkCmdSetColorBlendEquationEXT-attachmentCount-arraylength ] Object 0: handle = 0xaaaae7632fa0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xf591aebe | vkCmdSetColorBlendEquationEXT: parameter attachmentCount must be greater than 0. The Vulkan spec states: attachmentCount must be greater than 0 (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdSetColorBlendEquationEXT-attachmentCount-arraylength)

However, we still have some around dynamic color attachment state:

    Objects: 1
        [0] 0xaaaafcab4150, type: 6, name: NULL
VUID_Undefined(ERROR / SPEC): msgNum: 2044605652 - Validation Error: [ VUID_Undefined ] Object 0: handle = 0xaaaafcab4150, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x79de34d4 | VkCommandBuffer 0xaaaafcab4150[]: Dynamic color blend enable state not set for this command buffer.
    Objects: 1
        [0] 0xaaaafcab4150, type: 6, name: NULL
VUID_Undefined(ERROR / SPEC): msgNum: 2044605652 - Validation Error: [ VUID_Undefined ] Object 0: handle = 0xaaaafcab4150, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x79de34d4 | VkCommandBuffer 0xaaaafcab4150[]: Dynamic color blend equation state not set for this command buffer.
    Objects: 1
        [0] 0xaaaafcab4150, type: 6, name: NULL
VUID_Undefined(ERROR / SPEC): msgNum: 2044605652 - Validation Error: [ VUID_Undefined ] Object 0: handle = 0xaaaafcab4150, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x79de34d4 | VkCommandBuffer 0xaaaafcab4150[]: Dynamic color write mask state not set for this command buffer.

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

22 months agoradv: Use correct watermark for early loop exit.
Bas Nieuwenhuizen [Sun, 11 Dec 2022 02:08:55 +0000 (03:08 +0100)]
radv: Use correct watermark for early loop exit.

The previous check assumed the stack starts at offset=0, which isn't
necessarily true for ray queries.

Note that this didn't cause correctness issues, just made an optimization
not apply. Found when I accidentally made this load-bearing in a
refactor.

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

22 months agoradv: Rename stack_base to stack_low_watermark.
Bas Nieuwenhuizen [Sun, 11 Dec 2022 15:10:17 +0000 (16:10 +0100)]
radv: Rename stack_base to stack_low_watermark.

Better covers the purpose.

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

22 months agoRevert "r600/sfn: Make use of variable length DOT"
Gert Wollny [Sun, 11 Dec 2022 17:10:27 +0000 (18:10 +0100)]
Revert "r600/sfn: Make use of variable length DOT"

This reverts commit fcafe1ffc85573b6a0df2d64a438f1bac2bae3a2.

Variable length DOT products are not supported for pre EG
cards, and the read port evaluation is not correctly
checked, so that scheduling might fail. Revert for now to
fix the issues below and get gack with a better implementation
later.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7876
Related: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7878

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20268>

22 months agocso: remove cso_draw_vbo from all draws, call the driver or u_vbuf directly
Marek Olšák [Sun, 27 Nov 2022 16:28:45 +0000 (11:28 -0500)]
cso: remove cso_draw_vbo from all draws, call the driver or u_vbuf directly

Instead of calling like this:
    st_draw_gallium -> cso_draw_vbo -> driver_draw_vbo

Do it like this:
    st_draw_gallium -> driver_draw_vbo
OR
    st_draw_gallium -> u_vbuf_draw_vbo

It's accomplished by adding a draw_vbo function pointer into cso_context.
The pointer is equal to pipe_context::draw_vbo when needed, so there is
no call overhead from this if cso's draw_vbo callback is indeed equal to
driver_draw_vbo. We just call cso_context_base::draw_vbo to jump into
the driver directly, or u_vbuf if needed.

The cso function with the indirect function call is inlined, so draws
don't actually visit any cso_context function.

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

22 months agocso: add a base class cso_context_base holding pipe_context*
Marek Olšák [Sun, 27 Nov 2022 16:01:58 +0000 (11:01 -0500)]
cso: add a base class cso_context_base holding pipe_context*

We'll add more stuff there. The first change is that we need pipe_context*
there.

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

22 months agocso: unify cso_draw_vbo and cso_multi_draw
Marek Olšák [Sun, 27 Nov 2022 15:56:52 +0000 (10:56 -0500)]
cso: unify cso_draw_vbo and cso_multi_draw

This is going to be inlined.

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

22 months agogallium/u_vbuf: change u_vbuf_draw_vbo to accept pipe_context as first param
Marek Olšák [Sun, 27 Nov 2022 15:44:29 +0000 (10:44 -0500)]
gallium/u_vbuf: change u_vbuf_draw_vbo to accept pipe_context as first param

This makes the parameters equal to pipe_context::draw_vbo.

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

22 months agogallium: add the u_vbuf pointer into pipe_context
Marek Olšák [Sun, 27 Nov 2022 15:39:49 +0000 (10:39 -0500)]
gallium: add the u_vbuf pointer into pipe_context

This will allow removing the draw_vbo wrapping in cso_context.

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

22 months agoasahi: Implement occlusion queries
Alyssa Rosenzweig [Wed, 23 Nov 2022 19:32:35 +0000 (14:32 -0500)]
asahi: Implement occlusion queries

While the hardware supports both counter and boolean occlusion queries, the
programming model is quite different from OpenGL. In AGX (and in Metal),
there is a single "visibility result buffer" associated with the render pass.
Each draw that uses occlusion queries writes into this render pass global
visibility result buffer at a particular index. By contrast, the OpenGL
occlusion query model supposes that each query has independent state that can be
mixed and matched within a render pass. We can't simply allocate backing memory
for a query and write to it from a job. We can't allocate visibility result
buffers for each batch up front and statically assign OpenGL queries to indices,
because the OpenGL query can span multiple batches. Finally we can't use a
global visibility result buffer without introducing additional synchronization,
given that we now support multiple batches in-flight at once.

In this patch, I've elected to use a simple solution: allocate visibility result
buffers and indices on the fly as needed, and accumulate the results on the CPU
at the end of the render pass. When we have proper synchronization we'll want to
revisit this, but as everything is stalling at submit time now, I'm not inclined
to "optimize" something I can't test.

Passes dEQP-GLES3.functional.occlusion_query.* and the relevant piglit tests.
The piglits are considerably more thorough, checking lots of "we hate tilers"
conditions that dEQP skips over.

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

22 months agoasahi: Move query functions to agx_query.c
Alyssa Rosenzweig [Wed, 23 Nov 2022 18:15:43 +0000 (13:15 -0500)]
asahi: Move query functions to agx_query.c

New file. They're just stubs now but will get nontrivial in a moment.

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

22 months agoasahi: Don't upload samplers for clears/stores
Alyssa Rosenzweig [Fri, 2 Dec 2022 14:53:28 +0000 (09:53 -0500)]
asahi: Don't upload samplers for clears/stores

Unlikely to help but makes the traces neater.

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

22 months agoasahi: Avoid reloads with staging blits
Alyssa Rosenzweig [Fri, 2 Dec 2022 14:48:21 +0000 (09:48 -0500)]
asahi: Avoid reloads with staging blits

Noticed by inspection. Not likely to matter unless these staging blits are in a
hot path, but it's an easy win.

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

22 months agoasahi: Don't reload uninitialized surfaces
Alyssa Rosenzweig [Fri, 2 Dec 2022 03:42:47 +0000 (22:42 -0500)]
asahi: Don't reload uninitialized surfaces

Pointless. This should save some bandwidth in some cases (possibly mipmap
generation?)

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

22 months agoasahi: Fix Z32S8 harder
Alyssa Rosenzweig [Tue, 29 Nov 2022 02:30:49 +0000 (21:30 -0500)]
asahi: Fix Z32S8 harder

Fixes dEQP-GLES3.functional.texture.format.sized.2d.depth32f_stencil8_pot after
stencil texturing broke it.

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

22 months agoasahi: Don't shadow idle resources
Alyssa Rosenzweig [Tue, 29 Nov 2022 01:35:38 +0000 (20:35 -0500)]
asahi: Don't shadow idle resources

Pointless allocation+memcpy.

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

22 months agoasahi: Model alignment of occlusion query indices
Alyssa Rosenzweig [Wed, 23 Nov 2022 19:32:10 +0000 (14:32 -0500)]
asahi: Model alignment of occlusion query indices

8-byte offsets.

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

22 months agoasahi: Identify some more fields used with layered
Alyssa Rosenzweig [Mon, 28 Nov 2022 04:55:55 +0000 (23:55 -0500)]
asahi: Identify some more fields used with layered

These values depend on the framebuffer width/height and maybe other
stuff. Maybe strides.

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

22 months agoasahi: Identify XML for anisotropic filtering
Alyssa Rosenzweig [Wed, 23 Nov 2022 20:24:05 +0000 (15:24 -0500)]
asahi: Identify XML for anisotropic filtering

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

22 months agoasahi: Check-box implement rasterizer discard
Alyssa Rosenzweig [Wed, 23 Nov 2022 19:46:22 +0000 (14:46 -0500)]
asahi: Check-box implement rasterizer discard

Passes dEQP-GLES3.functional.rasterizer_discard.*

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

22 months agoasahi: Wire in 1D (array) textures
Alyssa Rosenzweig [Sat, 26 Nov 2022 03:39:48 +0000 (22:39 -0500)]
asahi: Wire in 1D (array) textures

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

22 months agoasahi: Dirty track VS/FS key updates
Alyssa Rosenzweig [Thu, 24 Nov 2022 17:22:05 +0000 (12:22 -0500)]
asahi: Dirty track VS/FS key updates

drawoverhead 1 score doubled to 7668.

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

22 months agoasahi: Separate VS/FS shader keys
Alyssa Rosenzweig [Thu, 24 Nov 2022 17:05:09 +0000 (12:05 -0500)]
asahi: Separate VS/FS shader keys

First remove agx_shader_key from asahi_shader_key. It's trivial. agx_shader_key
is going to go away soon now that we lower everything in NIR.

Then everything else is mutually exclusive between stages. That means much
less to hash. drawoverhead test 1 from 2331 to 3443.

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

22 months agoasahi: Implement invalidate_resource
Alyssa Rosenzweig [Thu, 24 Nov 2022 16:15:44 +0000 (11:15 -0500)]
asahi: Implement invalidate_resource

From Panfrost. This lets us avoid storing depth/stencil attachments at the end
of the frame in GLES.

On my 4K monitor, glmark2 -btexture at fullscreen goes from 705fps to 1150fps. I
assume gains on real workloads will be smaller.

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

22 months agoasahi: Track batch masks on ZS/blend CSO
Alyssa Rosenzweig [Thu, 24 Nov 2022 15:55:52 +0000 (10:55 -0500)]
asahi: Track batch masks on ZS/blend CSO

Adapted from panfrost, with the work happening at CSO create time instead of
draw time allowing us to do more sophisticated analysis. We'll use these for
accurate masks in a moment.

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

22 months agoasahi: Dirty track blend state
Alyssa Rosenzweig [Thu, 24 Nov 2022 15:57:24 +0000 (10:57 -0500)]
asahi: Dirty track blend state

We'll want this to reduce variant lookups eventually.

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

22 months agoasahi: Enable dirty tracking
Alyssa Rosenzweig [Thu, 24 Nov 2022 16:29:39 +0000 (11:29 -0500)]
asahi: Enable dirty tracking

Whoops. drawoverhead test 1 score from 496 -> 2377.

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

22 months agoail: Save level_offsets_compressed_B
Alyssa Rosenzweig [Tue, 29 Nov 2022 00:21:21 +0000 (19:21 -0500)]
ail: Save level_offsets_compressed_B

So we can bind specific mip levels for rendering into compressed Z/S.

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

22 months agopanfrost: implement clear_depth_stencil
Aleksey Komarov [Fri, 9 Dec 2022 18:17:42 +0000 (21:17 +0300)]
panfrost: implement clear_depth_stencil

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20238>

22 months agonine: enable on panfrost
David Heidelberg [Fri, 9 Dec 2022 11:50:19 +0000 (12:50 +0100)]
nine: enable on panfrost

Also, enable required kmsro dependencies.

Tested-by: Aleksey Komarov <q4arus@ya.ru>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20238>

22 months agopanfrost: implement clear_render_target
David Heidelberg [Fri, 9 Dec 2022 11:06:52 +0000 (12:06 +0100)]
panfrost: implement clear_render_target

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Co-authored-by: Aleksey Komarov <q4arus@ya.ru>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Aleksey Komarov <q4arus@ya.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20238>

22 months agopanfrost: Handle resources without depth in batch_to_fb_info
David Heidelberg [Fri, 9 Dec 2022 11:06:39 +0000 (12:06 +0100)]
panfrost: Handle resources without depth in batch_to_fb_info

Prevent preloading data from resources which doesn't exist.

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Aleksey Komarov <q4arus@ya.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20238>

22 months agopanfrost: Implement GL_EXT_clip_control
David Heidelberg [Fri, 9 Dec 2022 11:06:33 +0000 (12:06 +0100)]
panfrost: Implement GL_EXT_clip_control

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Co-authored-by: Aleksey Komarov <q4arus@ya.ru>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Aleksey Komarov <q4arus@ya.ru>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20238>

22 months agointel: add devinfo->has_64bit_float_via_math_pipe
Paulo Zanoni [Fri, 2 Dec 2022 18:55:48 +0000 (10:55 -0800)]
intel: add devinfo->has_64bit_float_via_math_pipe

Unusual hardware features that require special hanlding usually get a
devinfo field, so do this for MTL's unordered DF types. This will
guarantee that any platform based on MTL (thus inheriting from
MTL_FEATURES) will automatically be handled in these special cases.

v2: s/has_unordered_64bit_float/has_64bit_float_via_math_pipe/ (Curro).

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20072>

22 months agointel/compiler: fix intel_swsb_decode for newer platforms
Paulo Zanoni [Tue, 29 Nov 2022 01:44:38 +0000 (17:44 -0800)]
intel/compiler: fix intel_swsb_decode for newer platforms

In the previous patch we adjusted the scoreboard pass to take into
consideration a new case of unordered operations for TGL. Fix the
decoding as well.

v2: use intel_device_info_is_mtl()  (Curro, Jordan)
v3: the part where we export num_sources_from_inst() is now a separate patch
    (Curro).
v4: Work around false positive maybe-unitialized warning since Marge
    uses -Werror=maybe-uninitialized (Marge).

Reviewed-by: Francisco Jerez <currojerez@riseup.net> (v3)
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20072>

22 months agointel/compiler: export brw_num_sources_from_inst
Paulo Zanoni [Thu, 8 Dec 2022 23:39:01 +0000 (15:39 -0800)]
intel/compiler: export brw_num_sources_from_inst

We want to call this from brw_disasm.c, so move it out to brw_eu.c
since it's about to become more of a shared utility function than
something specific to the EU validator.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20072>

22 months agointel/compiler: avoid 64bit SEL_EXEC on MTL
Paulo Zanoni [Sat, 3 Dec 2022 00:36:21 +0000 (16:36 -0800)]
intel/compiler: avoid 64bit SEL_EXEC on MTL

On MTL, instructions with DF type are unordered, executed in the math
pipe. This means that they require different SWSB dependency handling,
and also that in some cases such as MOVs it's generally faster to
simply use 2 smaller ordered moves than a single unordered MOV.

One problem we have with the current code is that generate_code() is
not setting the proper SWSB dependencies for the generated DF MOVs,
causing some tests to fail.

One solution would be to fix generate_code() by making it set the
appropriate dependencies. This was the first patch I wrote. Another
solution to this problem, pointed to us by Curro, is to change
required_exec_type() so we use UD instructions instead of DF, just
like we do with platforms that don't have 64 bit instructions, which
means there won't be anything to fix in generate_code(). The second
solution is what this patch implements.

This fixes at least:
 - dEQP-VK.subgroups.arithmetic.framebuffer.subgroupmin_double_vertex

Thanks to Francisco Jerez for all the major help provided with this
problem.

Credits-to: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20072>

22 months agointel/compiler: avoid (RegDist, SBID) on DF instructions on MTL
Paulo Zanoni [Thu, 21 Apr 2022 23:29:56 +0000 (16:29 -0700)]
intel/compiler: avoid (RegDist, SBID) on DF instructions on MTL

When we use this form there's no way to specify which pipe RegDist
refers to, so there are a few rules to figure this out, which is what
inferred_sync_pipe() implements. But for MTL there's no long pipe and
the documentation does not explicitly explain what should be the
inferred type for its long (DF) instructions - which are out-of-order,
by the way.  One way to interpret this is that such case should be
avoided.  So add the extra check to entirely avoid this case.

Notice that this is not actually fixing any bug, since returning
TGL_PIPE_LONG (what we do today) will actually make these DF
instructions incompatible with every in-order instruction, so we'll
never opt to use the (RegDist, SBID) form anyway. But still, it's
better to have this case explicitly documented instead of having it
covered by a semi coincidence.

v2: use intel_device_info_is_mtl()  (Curro, Jordan)

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20072>

22 months agointel/compiler: on MTL, DF instructions run in the math pipe
Paulo Zanoni [Fri, 1 Apr 2022 22:06:36 +0000 (15:06 -0700)]
intel/compiler: on MTL, DF instructions run in the math pipe

Adjust the scoreboard code to take that into account.

Fixes at least:
  - dEQP-VK.glsl.builtin.precision_double.refract.compute.vec3
  - dEQP-VK.glsl.builtin.precision_double.matrixcompmult.compute.mat4

v2: use intel_device_info_is_mtl()  (Curro, Jordan)

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20072>

22 months agointel/fs: Make the result of is_unordered() dependent on devinfo.
Francisco Jerez [Sat, 19 Feb 2022 05:58:24 +0000 (21:58 -0800)]
intel/fs: Make the result of is_unordered() dependent on devinfo.

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

22 months agoRevert "anv: compile anv_acceleration_structure.c"
Lionel Landwerlin [Fri, 9 Dec 2022 13:54:57 +0000 (15:54 +0200)]
Revert "anv: compile anv_acceleration_structure.c"

This reverts commit 74d0be27ae9eb666df948874a20a3b4464df7db1.

Also remove anv_acceleration_structure.c, it was meant to be removed
earlier. There was probably a rebase issue somewhere.

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

22 months agofreedreno/a6xx: fix blend all_mrt_write_mask
Chia-I Wu [Fri, 9 Dec 2022 19:07:50 +0000 (11:07 -0800)]
freedreno/a6xx: fix blend all_mrt_write_mask

Fix all_mrt_write_mask when independent_blend_enable is false.
Otherwise, lrz write is always diabled with MRT when
independent_blend_enable is false.  This fixes a 2% perf regression for
multiple gfxbench benchmarks.

Fixes: 0132c22de75 ("freedreno/a6xx: Don't disable LRZ for invalid channels")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20254>

22 months agoiris: Improve direct CPU map heuristics
Kenneth Graunke [Thu, 29 Sep 2022 18:24:14 +0000 (11:24 -0700)]
iris: Improve direct CPU map heuristics

We were promoting reads with a valid primary to direct CPU maps even
if the mmap mode was IRIS_MMAP_WC, which would mean uncached reads from
VRAM.  In that case, GPU blits are in fact useful!

We were also only checking for !DISCARD_RANGE rather than MAP_READ,
which isn't a great idea for image maps, given the discussion in the
previous commit about image map semantics.

The original code was also just confusingly structured.  Make a helper
function with clearly defined cases where we want to bail on CPU maps.

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

22 months agoiris: Only copy existing data into staging images with PIPE_MAP_READ
Kenneth Graunke [Tue, 4 Oct 2022 21:01:27 +0000 (14:01 -0700)]
iris: Only copy existing data into staging images with PIPE_MAP_READ

When performing transfer maps on images that require staging buffers
(say, for presenting a linear view of tiled memory), we were reading
the existing contents of the buffer into the staging resource on map
unless PIPE_MAP_DISCARD_RANGE was set.

The thinking was to support partial writes.  If you map a subrectangle
of an image, but then only write selective pixels - should it preserve
the existing contents of the mapped region?  I believed that it should,
unless you pass PIPE_MAP_DISCARD_RANGE to explicitly say that that it's
okay to invalidate the destination region.

However, that does not appear to be the interpretation favored by other
Mesa developers (in particular Michel Dänzer and Marek Olšák).  The
radeonsi driver does not do this readback from the destination region
to the staging buffer unless you pass PIPE_MAP_READ.  If you want to
do a partial write and preserve contents, you need to pass both flags:
(PIPE_MAP_READ | PIPE_MAP_WRITE).  Passing READ is expected to come
with an associated cost.

OpenGL defines GL_MAP_INVALIDATE_RANGE_BIT for mapping buffer objects,
which is translated to PIPE_MAP_DISCARD_RANGE.  However, unextended
OpenGL doesn't define mapping textures.  There are two main sources of
image maps: our internal MapTextureImage() hook, and gbm_bo_map().

I've audited our internal MapTextureImage() calls, and while some do
pass PIPE_MAP_DISCARD_RANGE, almost all of them wholly overwrite the
mapped region, and those that care about combining with existing image
contents all pass PIPE_MAP_READ.  So this should work there.

GBM defines three flags: GBM_BO_TRANSFER_READ, WRITE, and READ_WRITE.
There is no defined "invalidate range" bit.  In issue #6020, Matthias
Treydte notes that this extra readback can cause performance problems,
and with iris's current interpretation, there's no way to avoid it.
During that discussion, Michel and Matthias both argued that
GBM_BO_TRANSFER_WRITE should invalidate the destination contents and
avoid the readback, while GBM_BO_TRANSFER_READ_WRITE would preserve it.

This patch makes iris follow that model for image mappings, removing
readback on staging maps for both detiling and stall avoidance, unless
PIPE_MAP_READ is passed.  I believe we can change this with impunity.

For buffer objects, Ian Romanick and I both agree that partial writes
should be supported, and GL_MAP_INVALIDATE_RANGE_BIT exists precisely
to indicate that you should spend effort preserving existing contents.
So we continue doing readback for buffers unless PIPE_MAP_DISCARD_RANGE
is flagged, for now.  While I think this is work, it also seems to be
undertested in the CTS and Piglit.

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

22 months agoiris: Return idle status from iris_invalidate_buffer, skip busy checks
Kenneth Graunke [Fri, 30 Sep 2022 00:56:29 +0000 (17:56 -0700)]
iris: Return idle status from iris_invalidate_buffer, skip busy checks

If we successfully replace the backing storage for a buffer, we know
that it's idle, and the transfer map code can mark it unsynchronized
right away, letting us skip redundant resource_is_busy() checks.

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

22 months agoiris: Don't replace backing storage for exported buffers.
Kenneth Graunke [Fri, 30 Sep 2022 01:06:42 +0000 (18:06 -0700)]
iris: Don't replace backing storage for exported buffers.

We already gave out the old BO...or acquired it from somewhere which
may be affecting it.  We simply can't replace the backing store.

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

22 months agoiris: Promote DISCARD_RANGE to DISCARD_WHOLE_RESOURCE where possible
Kenneth Graunke [Fri, 30 Sep 2022 00:38:53 +0000 (17:38 -0700)]
iris: Promote DISCARD_RANGE to DISCARD_WHOLE_RESOURCE where possible

This allows us to replace the backing storage for a buffer, which
means we'd have an idle buffer and thus could do an unsynchronized
mapping where we otherwise wouldn't.

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

22 months agoiris: Use persistent mappings for pinned memory (userptr)
Kenneth Graunke [Thu, 29 Sep 2022 23:12:07 +0000 (16:12 -0700)]
iris: Use persistent mappings for pinned memory (userptr)

This is a port of Nicolai's b52721e3b693e113aa537d163c8a855169e7b75d
from radeonsi.  Because GL_AMD_pinned_memory guarantees that mappings
will refer to the same underlying page, we need to avoid using staging
maps.  Using a persistent map is a reasonable way to accomplish this.

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

22 months agoiris: Delete map->dest_had_defined_contents
Kenneth Graunke [Thu, 29 Sep 2022 23:36:01 +0000 (16:36 -0700)]
iris: Delete map->dest_had_defined_contents

Dead since commit 6cc09699cd77286f7601a1afab60dc9fa0bafd48.

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