platform/upstream/mesa.git
23 months agoradeonsi/sqtt: set stable pstate if possible
Pierre-Eric Pelloux-Prayer [Thu, 11 Aug 2022 13:05:18 +0000 (15:05 +0200)]
radeonsi/sqtt: set stable pstate if possible

This avoids the need to manually change the power profile.

Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18009>

23 months agowayland: avoid writing interface names as free-form strings
Eric Engestrom [Wed, 31 Aug 2022 09:08:32 +0000 (10:08 +0100)]
wayland: avoid writing interface names as free-form strings

Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Simon Ser <contact@emersion.fr>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18335>

23 months agopvr: Change indentation from tab to spaces for xml files.
Karmjit Mahil [Mon, 22 Aug 2022 13:22:32 +0000 (14:22 +0100)]
pvr: Change indentation from tab to spaces for xml files.

This is done to match other drivers and to use spaces for
indentation throughout the whole of the powervr driver.

Signed-off-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18319>

23 months agopvr: Implement vkResetCommandBuffer
Frank Binns [Wed, 20 Jul 2022 22:35:57 +0000 (23:35 +0100)]
pvr: Implement vkResetCommandBuffer

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

23 months agopvr: reset all command buffer state in pvr_cmd_buffer_reset()
Frank Binns [Tue, 26 Jul 2022 23:07:58 +0000 (00:07 +0100)]
pvr: reset all command buffer state in pvr_cmd_buffer_reset()

Command buffers were only being partially reset. Fix this by factoring out the
common parts of pvr_cmd_buffer_reset() and pvr_cmd_buffer_reset() into a common
function, so there's now only a single place to free command buffer state, and
zeroing out parts of the command buffer that were missed.

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

23 months agovirgl/ci: remove some flakes
Gert Wollny [Thu, 25 Aug 2022 10:49:18 +0000 (12:49 +0200)]
virgl/ci: remove some flakes

With the better synchronization we can now remove some flakes.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18243>

23 months agovirgl: when reading back wait first, then do the transfer
Gert Wollny [Thu, 25 Aug 2022 06:30:53 +0000 (08:30 +0200)]
virgl: when reading back wait first, then do the transfer

Otherwise the transfer from the host might not be finished
when we try to read the data.

v2: always wait before readback, but also keep the wait after
  a possible readback, Itherwise TF fails in the CI.

Fixes: e87186fc679c146c5d521139bb79c8eafa0a22f0
    virgl: add virgl_resource_transfer_prepare

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Ryan Neph <ryanneph@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18243>

23 months agov3dv: expose VK_KHR_synchronization2
Iago Toral Quiroga [Fri, 26 Aug 2022 07:29:37 +0000 (09:29 +0200)]
v3dv: expose VK_KHR_synchronization2

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

23 months agov3dv: use VkPipelineStageFlagBits2 when checking semaphore wait stage
Iago Toral Quiroga [Fri, 26 Aug 2022 11:09:38 +0000 (13:09 +0200)]
v3dv: use VkPipelineStageFlagBits2 when checking semaphore wait stage

This adds extra stages, some of which involve geometry stages that are
relevant to the check we do to check for binning sync.

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

23 months agov3dv: port remaining entry points to KHR_synchronization2
Iago Toral Quiroga [Fri, 26 Aug 2022 07:44:53 +0000 (09:44 +0200)]
v3dv: port remaining entry points to KHR_synchronization2

The common code in Mesa will rewrite the old entry points to these
if available.

Since we implement events and timestamps queries in the driver the
API changes don't quite affect us.

vkQueueSubmit2 is already implemented in the common synchronization
framework and the driver works in terms of a submit hook that is
independent of the actual entry point used by the application.

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

23 months agov3dv: implement vkCmdPipelineBarrier2
Iago Toral Quiroga [Fri, 26 Aug 2022 07:26:41 +0000 (09:26 +0200)]
v3dv: implement vkCmdPipelineBarrier2

Added with KHR_synchronization2. The common code in Mesa will
rewrite vkCmdPipelineBarrier to vkCmdPipelineBarrier2.

With synchronization2 barriers now have a per-barrier stage
and access flags (previously these were shared by all the barriers
in a vkCmdPipelineBarrier commands), so we need to rewrite a bit
the logic to account for this.

Also, stage and access flag bits have been expanded and renamed.
Particularly, some new flags have been added that we need to account
for.

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

23 months agov3dv: also check GS stage on image access for binning barriers
Iago Toral Quiroga [Tue, 30 Aug 2022 06:00:45 +0000 (08:00 +0200)]
v3dv: also check GS stage on image access for binning barriers

For some reason we were only checking the binning VS stage, but we
should also check the GS, like we do for other access types.

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

23 months agozink: request forcing of fp32-samplers to nearest when needed
Erik Faye-Lund [Mon, 29 Aug 2022 09:15:59 +0000 (11:15 +0200)]
zink: request forcing of fp32-samplers to nearest when needed

Setting a linear filtering mode when not supported isn't legal, and can
lead to bad things in the VK driver. Let's ask the state-tracker to fix
this for us!

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

23 months agomesa/st: force nearest-filtering for fp32 textures
Erik Faye-Lund [Mon, 29 Aug 2022 08:38:59 +0000 (10:38 +0200)]
mesa/st: force nearest-filtering for fp32 textures

OpenGL 3.0 requires ARB_texture_float, which technically speaking
requires linear-filtering support for FP32 textures. However, because a
lot of early implementations just ignore this and does nearest filtering
instead due to lack of hardware features for this, this functionality
was never added to the OpenGL CTS.

The result is that FP32 is a feature that is required on paper, but
is unreliable to be used by applications in practice. This is mostly
fine; for most filterable use-cases (e.g colors), FP16 is fine and saves
a bunch of bandwidth, and for cases where you really need the extra bits
(depth-reads etc), filtering is usually not what's wanted.

To save drivers that doesn't support filtering of FP32 filtering from
having to manually whack the state, and get needless CSOs in the CSO
caches, let's force this in early, where we already do the same for
integer textures.

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

23 months agomesa/st: always force integer filtering to nearest
Erik Faye-Lund [Tue, 30 Aug 2022 06:47:57 +0000 (08:47 +0200)]
mesa/st: always force integer filtering to nearest

There's no need to re-check the DRI-config setting here; we either
already got nearest filtering already, or the we applied a work-around
to avoid incomplete textures. In either case, these should be nearest,
no need to check for it again.

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

23 months agomesa/st: also override mip filter for integer textures
Erik Faye-Lund [Tue, 30 Aug 2022 06:42:24 +0000 (08:42 +0200)]
mesa/st: also override mip filter for integer textures

If not, drivers may attempt interpolating these values, which isn't
going to do anything good.

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

23 months agoradv: determine if the topology uses adjacency from the shaders on GFX9+
Samuel Pitoiset [Fri, 26 Aug 2022 15:36:02 +0000 (17:36 +0200)]
radv: determine if the topology uses adjacency from the shaders on GFX9+

From the Vulkan spec says:
    "VUID-VkGraphicsPipelineCreateInfo-pStages-00738
     If the pipeline is being created with pre-rasterization shader
     state and pStages includes a geometry shader stage, and does not
     include any tessellation shader stages, its shader code must
     contain an OpExecutionMode instruction specifying an input
     primitive type that is compatible with the primitive topology
     specified in pInputAssembly"

In other words, the GS input primitive and the topology must match, so
it's possible to get this information directly from the GS instead of
from the pipeline key. Main benefit is that the driver can compile all
pre-rasterization stages without knowing the primitive topology.

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

23 months agoradv: allow null descriptor set layouts in pipeline layouts
Samuel Pitoiset [Tue, 30 Aug 2022 08:25:44 +0000 (10:25 +0200)]
radv: allow null descriptor set layouts in pipeline layouts

This is allowed by the Vulkan spec when GPL is used.

Fixes dEQP-VK.pipeline.pipeline_library.graphics_library.misc.other.null_descriptor_set_in_monolithic_pipeline

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18313>

23 months agov3dv: implement VK_KHR_zero_initialize_workgroup_memory
Iago Toral Quiroga [Tue, 30 Aug 2022 07:12:30 +0000 (09:12 +0200)]
v3dv: implement VK_KHR_zero_initialize_workgroup_memory

This only requires that we call the relevant lowering pass in NIR.

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

23 months agonir/lower_variable_initializers: implement non-scoped barrier path
Iago Toral Quiroga [Tue, 30 Aug 2022 07:23:33 +0000 (09:23 +0200)]
nir/lower_variable_initializers: implement non-scoped barrier path

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

23 months agoradv: Remove redundant radv_QueuePresentKHR.
Bas Nieuwenhuizen [Mon, 29 Aug 2022 11:21:59 +0000 (13:21 +0200)]
radv: Remove redundant radv_QueuePresentKHR.

Does the same thing as the wsi function.

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

23 months agovenus: allow no external memory handle when renderers lacks support
Yiwei Zhang [Tue, 30 Aug 2022 23:20:19 +0000 (23:20 +0000)]
venus: allow no external memory handle when renderers lacks support

This is to make vtest happy.

Fixes: 9c5a7ffbd8a ("venus: fix external memory ext filtering")

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

23 months agonir/lower_mediump: Lower FS outputs to 16-bit when the value was upconverted.
Emma Anholt [Tue, 9 Aug 2022 20:56:50 +0000 (13:56 -0700)]
nir/lower_mediump: Lower FS outputs to 16-bit when the value was upconverted.

Take this real-world (trimmed) shader:

precision highp float;
in lowp vec4 var_varVertexColor;
layout(location = 0) out vec4 out_FragColor0;
void main() {
    vec4 textureColor0 = vec4(1.000000e+00, 0.000000e+00, 0.000000e+00, 1.000000e+00);
    vec3 color = vec3(1.000000e+00, 1.000000e+00, 1.000000e+00);
    vec4 outColor = vec4(vec3((color).rgb), 1.000000e+00);
    (outColor *= vec4(var_varVertexColor));
    (out_FragColor0 = outColor);
}

After opts, it's just a store from input to output.  If we decide to lower
the input to 16-bit, then as long as the driver can handle 16-bit outputs,
it would be a good idea to demote the output and save the conversions.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18003>

23 months agod3d12: Change displayable format logic
Jesse Natalie [Tue, 30 Aug 2022 18:58:06 +0000 (11:58 -0700)]
d3d12: Change displayable format logic

Instead of not reporting support for the pixel format at all, just
disable swapchain creation.

Some apps want to create off-screen contexts targeting these formats,
but since WGL doesn't really have "off-screen," the pixel format
enumeration should return support for these.

Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18326>

23 months agoanv: Drop anv_pipeline::use_primitive_replication
Jason Ekstrand [Mon, 18 Jul 2022 16:34:59 +0000 (11:34 -0500)]
anv: Drop anv_pipeline::use_primitive_replication

Instead of this fragile use_primitive_replication bit which we set
differently depending on whether or not we pulled the shader out of the
cache, compute and use the information up-front during the compile and
then always fetch it from the vue_map after that.  This way, regardless
of whether the shader comes from the cache or not, we have the same flow
and there are no inconsistencies.

Reviewed-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/17602>

23 months agointel/compiler: Store the number of position slots in the VUE map
Jason Ekstrand [Mon, 18 Jul 2022 16:22:54 +0000 (11:22 -0500)]
intel/compiler: Store the number of position slots in the VUE map

Reviewed-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/17602>

23 months agonir: Track per-view outputs in shader_info
Jason Ekstrand [Fri, 15 Jul 2022 20:36:33 +0000 (15:36 -0500)]
nir: Track per-view outputs in shader_info

Reviewed-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/17602>

23 months agoanv: Stop looking at the pipeline in multiview lowering
Jason Ekstrand [Mon, 18 Jul 2022 16:06:41 +0000 (11:06 -0500)]
anv: Stop looking at the pipeline in multiview lowering

Passing all the data we need in directly avoids issues where we might
forget what is and isn't set on the pipeline object at the time the
shader call happens.  This will be especially important once we start
splitting things up for pipeline libraries.

Reviewed-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/17602>

23 months agoanv: Decouple primitive replication check from the fragment shader
Jason Ekstrand [Mon, 18 Jul 2022 15:45:53 +0000 (10:45 -0500)]
anv: Decouple primitive replication check from the fragment shader

Now that we're using nir_intrinsic_load_layer_id for ViewIndex, we can
use primitive replication even when the FS uses ViewIndex.  Also, only
check that active_stages doesn't contain anything other than VS and FS,
not that it's exactly VS | FS.  This both decouples things more and
allows primitive rplication in the depth-only case where we have no
fragment shader at all.

Reviewed-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/17602>

23 months agoanv: Use nir_intrinsic_load_layer_id for ViewId in fragment shaders
Jason Ekstrand [Mon, 18 Jul 2022 15:34:52 +0000 (10:34 -0500)]
anv: Use nir_intrinsic_load_layer_id for ViewId in fragment shaders

Now that fragment shaders are a special case handled up-front, we can
reduce the complexity of some of the logic elsewhere in the pass.

Reviewed-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/17602>

23 months agocrocus: Fix memory leaks on iris_resource_create failure paths
Kenneth Graunke [Wed, 27 Apr 2022 08:35:02 +0000 (01:35 -0700)]
crocus: Fix memory leaks on iris_resource_create failure paths

We've already allocated the pipe resource, so we ought to free it
before returning.

Fixes: d8a38edc48e ("crocus: fail resource allocation properly.")
Fixes: f3630548f1d ("crocus: initial gallium driver for Intel gfx 4-7")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>

23 months agocrocus: Fall back if iris_map_copy_region can't create a staging resource
Kenneth Graunke [Wed, 27 Apr 2022 08:38:10 +0000 (01:38 -0700)]
crocus: Fall back if iris_map_copy_region can't create a staging resource

If we can't create a staging resource, then fall back to direct CPU
mapping (possibly with a stall).  This is a rare case, but it could
happen for very large staging buffers.

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

23 months agocrocus: Don't print out XXX messages if resource creation fails
Kenneth Graunke [Wed, 27 Apr 2022 08:34:25 +0000 (01:34 -0700)]
crocus: Don't print out XXX messages if resource creation fails

Failing to create staging resources isn't necessarily a critical error,
and we probably don't want to be printing out XXX messages.  I mostly
had this here when bringing up iris and resource creation was failing
because I'd done something wrong when writing the code.  Then it got
copied over to crocus.

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

23 months agoiris: don't create staging resources larger than half the aperture
Kenneth Graunke [Wed, 27 Apr 2022 08:15:00 +0000 (01:15 -0700)]
iris: don't create staging resources larger than half the aperture

This is a port of crocus's f1c1fcfd (crocus: don't create staging
resources > half aperture).

I chose to use the whole aperture here rather than 3/4 of it, mostly
to avoid adding another legacy field for aperture stuff.  It's close
enough to work.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2104
Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Mark Janes markjanes@swizzler.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>

23 months agoiris: Fall back if iris_map_copy_region can't create a staging resource
Kenneth Graunke [Wed, 27 Apr 2022 08:30:18 +0000 (01:30 -0700)]
iris: Fall back if iris_map_copy_region can't create a staging resource

If we can't create a staging resource, then fall back to direct CPU
mapping (possibly with a stall).  This is a rare case, but it could
happen for very large staging buffers.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Mark Janes markjanes@swizzler.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>

23 months agoiris: Don't print out XXX messages if resource creation fails
Kenneth Graunke [Wed, 27 Apr 2022 08:32:47 +0000 (01:32 -0700)]
iris: Don't print out XXX messages if resource creation fails

Failing to create staging resources isn't necessarily a critical error,
and we probably don't want to be printing out XXX messages.  I mostly
had this here when bringing up the driver and resource creation was
failing because I'd done something wrong when writing the code.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Mark Janes markjanes@swizzler.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>

23 months agoiris: Delete unused iris_screen::aperture_bytes field
Kenneth Graunke [Wed, 27 Apr 2022 09:08:48 +0000 (02:08 -0700)]
iris: Delete unused iris_screen::aperture_bytes field

This was effectively removed in bb3545a6, but the field wasn't deleted,
leaving it there to troll people.  screen->aperture_bytes is 0?  What?

Fixes: bb3545a6ee4 ("intel: Store the aperture size in devinfo.")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Mark Janes markjanes@swizzler.org
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18311>

23 months agoradeonsi: use nir_opt_large_constants earlier
Pierre-Eric Pelloux-Prayer [Fri, 19 Aug 2022 13:04:19 +0000 (15:04 +0200)]
radeonsi: use nir_opt_large_constants earlier

Calling it before nir_convert_to_lcssa helps in some cases,
because the NIR is simpler and nir_opt_large_constants can
detect that a variable is constant.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7059
CC: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18147>

23 months agoradv: deal with ac_nir_translate failures
Pierre-Eric Pelloux-Prayer [Fri, 19 Aug 2022 13:02:29 +0000 (15:02 +0200)]
radv: deal with ac_nir_translate failures

Now that ac_nir_translate reports failures instead of aborting,
we need to deal with it in the driver.
For now, call abort to keep the existing behavior but this could
be improved.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18147>

23 months agoradeonsi: deal with ac_nir_translate failures
Pierre-Eric Pelloux-Prayer [Fri, 19 Aug 2022 12:59:46 +0000 (14:59 +0200)]
radeonsi: deal with ac_nir_translate failures

ac_nir_translate can fail now so forward the translation result to
si_llvm_compile_shader. If it's a failure, it'll print something like:
  radeonsi: can't compile a main shader part
And the shader won't be used.

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

23 months agoac/llvm: add a return value to ac_nir_translate
Pierre-Eric Pelloux-Prayer [Fri, 19 Aug 2022 12:58:17 +0000 (14:58 +0200)]
ac/llvm: add a return value to ac_nir_translate

Return a boolean instead of aborting when the NIR->LLVM translation fails.
This way, we can deal with the error at the calling site instead of crashing
the whole application.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18147>

23 months agonir: Print selection control for nir_if.
Georg Lehmann [Mon, 29 Aug 2022 15:18:56 +0000 (17:18 +0200)]
nir: Print selection control for nir_if.

It's useful to see this information now that aco is going to use it.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18297>

23 months agonv50: race free state tracking
Karol Herbst [Sun, 15 May 2022 17:20:40 +0000 (19:20 +0200)]
nv50: race free state tracking

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonvc0: make state handling race free
Karol Herbst [Thu, 17 Jun 2021 16:56:24 +0000 (18:56 +0200)]
nvc0: make state handling race free

I am not entirely convinced that contexts can't mess up the state of other
contexts, but with this we at least turn down the amount of races on the
CPU side.

If we hit bugs later we can always look into it then and figure out what
to fix how.

I think we might need a better solution for it in the future as state
tracking might need to become more involved, but for now this should be
good enough.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau: make fencing race free
Karol Herbst [Wed, 30 Jun 2021 08:26:35 +0000 (10:26 +0200)]
nouveau: make fencing race free

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau: per context client and pushbuf
Karol Herbst [Wed, 11 May 2022 00:32:52 +0000 (02:32 +0200)]
nouveau: per context client and pushbuf

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau/fence: per context fence
Karol Herbst [Wed, 9 Jun 2021 19:48:17 +0000 (21:48 +0200)]
nouveau/fence: per context fence

This doesn't add a fence list per pipe context, it simply makes us track
the current fence per context so we can safely modify the fence object
per thread.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonv50: remove nv50_bufctx_fence call in vbo_kick_notify
Karol Herbst [Sat, 3 Jul 2021 08:01:52 +0000 (10:01 +0200)]
nv50: remove nv50_bufctx_fence call in vbo_kick_notify

No idea why it is there. nvc0 doesn't do anything like it and it doesn't
regress any tests. Also removing is easier than handling the fence locking
inside the kick notify handler.

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

23 months agonv50: remove nouveau_fence_signalled prior nouveau_fence_wait
Karol Herbst [Fri, 7 May 2021 16:16:12 +0000 (18:16 +0200)]
nv50: remove nouveau_fence_signalled prior nouveau_fence_wait

nouveau_fence_wait handles signalled fences just as well.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau/fence: make the fence struct part of the fence API
Karol Herbst [Tue, 9 Feb 2021 19:32:15 +0000 (20:32 +0100)]
nouveau/fence: make the fence struct part of the fence API

This makes it easier to implement proper locking of the fence struct as we
can redesign some of the functions to take the list object instead of
fence objects.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau: use PUSH_KICK instead of nouveau_pushbuf_kick
Karol Herbst [Wed, 30 Jun 2021 08:01:29 +0000 (10:01 +0200)]
nouveau: use PUSH_KICK instead of nouveau_pushbuf_kick

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau: wrap nouveau_pushbuf_refn
Karol Herbst [Fri, 13 May 2022 15:36:14 +0000 (17:36 +0200)]
nouveau: wrap nouveau_pushbuf_refn

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau: wrap nouveau_pushbuf_validate
Karol Herbst [Mon, 28 Jun 2021 22:37:39 +0000 (00:37 +0200)]
nouveau: wrap nouveau_pushbuf_validate

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau: wrap all nouveau_pushbuf_space calls
Karol Herbst [Sat, 26 Jun 2021 08:24:45 +0000 (10:24 +0200)]
nouveau: wrap all nouveau_pushbuf_space calls

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau: wrap nouveau_bo_wait
Karol Herbst [Fri, 25 Jun 2021 20:46:10 +0000 (22:46 +0200)]
nouveau: wrap nouveau_bo_wait

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau: wrap nouveau_bo_map
Karol Herbst [Fri, 25 Jun 2021 20:44:26 +0000 (22:44 +0200)]
nouveau: wrap nouveau_bo_map

This makes it easier to insert locking code around libdrm.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau: move nouveau_context initialization to common code
Karol Herbst [Thu, 10 Jun 2021 14:16:24 +0000 (16:16 +0200)]
nouveau: move nouveau_context initialization to common code

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau/fence: rework nouveau_fence_emit so we can call it on emitted fences
Karol Herbst [Fri, 7 May 2021 13:01:18 +0000 (15:01 +0200)]
nouveau/fence: rework nouveau_fence_emit so we can call it on emitted fences

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau/buffer: simplify uses of nouveau_fence_work
Karol Herbst [Fri, 7 May 2021 12:48:42 +0000 (14:48 +0200)]
nouveau/buffer: simplify uses of nouveau_fence_work

nouveau_fence_work already checks the state, so we can just call it
directly.

Strictly speaking, this isn't functional equivalent, but practically it
doesn't matter when we get the callback called.

Main reason for doing this is, that this makes locking way easier as we
can simply lock within nouveau_fence_* functions and callers don't have to
take locks themselves.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau/mm: make code thread safe
Karol Herbst [Wed, 27 Jan 2021 10:11:36 +0000 (11:11 +0100)]
nouveau/mm: make code thread safe

With this helgrind doesn't report any races in this code.

Cc: mesa-stable
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agonouveau: use the contexts pushbuf and client where possible
Karol Herbst [Wed, 16 Jun 2021 17:07:09 +0000 (19:07 +0200)]
nouveau: use the contexts pushbuf and client where possible

At the moment the context uses the screens object, but in order to fix
threading without having to lock too much we will have to allocate those
objects per context later.

Cc: mesa-stable
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>

23 months agomesa/st: Drop st_texture_image_transfer::map
Nanley Chery [Mon, 22 Aug 2022 22:28:54 +0000 (15:28 -0700)]
mesa/st: Drop st_texture_image_transfer::map

It's only used in the scope of a single function, st_UnmapTextureImage. Use
a local variable instead.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

23 months agomesa/st: Fix indentation in st_MapTextureImage
Nanley Chery [Mon, 22 Aug 2022 21:36:38 +0000 (14:36 -0700)]
mesa/st: Fix indentation in st_MapTextureImage

Dedent an if-else block and setup the else braces according to the coding
style.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

23 months agomesa/st: Don't map compressed texture fallbacks for reads
Nanley Chery [Mon, 22 Aug 2022 18:56:43 +0000 (11:56 -0700)]
mesa/st: Don't map compressed texture fallbacks for reads

We don't need to map the compressed texture's fallback resource for operations
which will only read from the texture (e.g., glGetCompressedTexImage2D and
glCopyImageSubData).

For compressed textures using a fallback, delay the map until
st_UnmapTextureImage and only do the map if it's being written to.

To help identify what's being changed, the expected indentation changes are
split out into the next patch.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

23 months agomesa/st: Add and use st_texture_image_transfer::box
Nanley Chery [Mon, 22 Aug 2022 18:56:43 +0000 (11:56 -0700)]
mesa/st: Add and use st_texture_image_transfer::box

Use this field to determine which parts of the compressed texture fallback
resource needs updating. Drops a dependency on the
st_texture_image_transfer::transfer pointer.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

23 months agomesa/st: Add and use st_texture_image_insert_transfer
Nanley Chery [Mon, 22 Aug 2022 16:08:13 +0000 (09:08 -0700)]
mesa/st: Add and use st_texture_image_insert_transfer

Split out the transfer array reallocation and insertion functionality from
st_texture_image_map.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

23 months agomesa/st: Set PIPE_MAP_DISCARD_RANGE in fallback_copy_image
Nanley Chery [Wed, 24 Aug 2022 18:30:14 +0000 (11:30 -0700)]
mesa/st: Set PIPE_MAP_DISCARD_RANGE in fallback_copy_image

Enables some drivers to avoid reading from the destination when mapping it.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18257>

23 months agov3dv: Use the common physical device enumeration
Konstantin Seurer [Sat, 20 Aug 2022 11:19:44 +0000 (13:19 +0200)]
v3dv: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

23 months agopanvk: Use the common physical device enumeration
Konstantin Seurer [Sat, 20 Aug 2022 10:59:37 +0000 (12:59 +0200)]
panvk: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

23 months agolvp: Use the common physical device enumeration
Konstantin Seurer [Wed, 17 Aug 2022 10:11:04 +0000 (12:11 +0200)]
lvp: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

23 months agoturnip: Use the common physical device enumeration
Konstantin Seurer [Wed, 17 Aug 2022 09:52:50 +0000 (11:52 +0200)]
turnip: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

23 months agoanv: Use the common physical device enumeration
Konstantin Seurer [Tue, 26 Jul 2022 09:40:03 +0000 (11:40 +0200)]
anv: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

23 months agoradv: Use the common physical device enumeration
Konstantin Seurer [Tue, 26 Jul 2022 09:16:05 +0000 (11:16 +0200)]
radv: Use the common physical device enumeration

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

23 months agovulkan: Add common physical device management
Konstantin Seurer [Tue, 26 Jul 2022 14:46:49 +0000 (16:46 +0200)]
vulkan: Add common physical device management

Add common entrypoints for enumerating physical devices, based on the RADV implementation.

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17750>

23 months agoradv: enable 64-bit vertex formats
Rhys Perry [Thu, 4 Aug 2022 17:08:38 +0000 (18:08 +0100)]
radv: enable 64-bit vertex formats

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

23 months agoradv,aco: implement 64-bit vertex inputs
Rhys Perry [Tue, 2 Aug 2022 14:10:50 +0000 (15:10 +0100)]
radv,aco: implement 64-bit vertex inputs

Note that, from 22.4.1. Vertex Input Extraction of Vulkan spec:
The input variable in the shader must be declared as a 64-bit data type if
and only if format is a 64-bit data type.

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

23 months agoradv: enable R8G8B8, B8G8R8 and R16G16B16 vertex formats
Rhys Perry [Tue, 2 Aug 2022 13:40:46 +0000 (14:40 +0100)]
radv: enable R8G8B8, B8G8R8 and R16G16B16 vertex formats

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

23 months agoradv: remove radv_translate_vertex_format
Rhys Perry [Wed, 3 Aug 2022 14:56:24 +0000 (15:56 +0100)]
radv: remove radv_translate_vertex_format

This is not used anymore.

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

23 months agoradv,aco: use pipe_format for dynamic vertex input state
Rhys Perry [Wed, 3 Aug 2022 13:38:16 +0000 (14:38 +0100)]
radv,aco: use pipe_format for dynamic vertex input state

Also prepare for 64-bit and R8G8B8/R16G16B16 with the addition of
radv_vs_input_state::nontrivial_formats.

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

23 months agoradv,aco: use pipe_format for static vertex input state
Rhys Perry [Fri, 29 Jul 2022 19:14:59 +0000 (20:14 +0100)]
radv,aco: use pipe_format for static vertex input state

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

23 months agoradv: add radv_is_vertex_buffer_format_supported
Rhys Perry [Wed, 3 Aug 2022 17:03:28 +0000 (18:03 +0100)]
radv: add radv_is_vertex_buffer_format_supported

We will want to support formats which cannot used for texel buffers.

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

23 months agoac: add ac_vtx_format_info
Rhys Perry [Fri, 29 Jul 2022 18:34:47 +0000 (19:34 +0100)]
ac: add ac_vtx_format_info

This will be used by RADV and ACO.

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

23 months agoutil/format,vulkan/format: update p_format for Vulkan vertex buffers
Rhys Perry [Thu, 4 Aug 2022 14:07:09 +0000 (15:07 +0100)]
util/format,vulkan/format: update p_format for Vulkan vertex buffers

We need to move some earlier (so they are <= 255 like the comment says)
and add a few 64-bit ones.

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

23 months agonir: use a GC context for instructions
Rhys Perry [Wed, 8 Sep 2021 14:24:10 +0000 (15:24 +0100)]
nir: use a GC context for instructions

Gives an roughly -15% change in compile-time for RADV/ACO.

Memory usage increase seems to be 5-6%.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5034
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12910>

23 months agonir: adjust nir_src_copy signature to take a nir_instr *
Rhys Perry [Wed, 8 Sep 2021 15:41:00 +0000 (16:41 +0100)]
nir: adjust nir_src_copy signature to take a nir_instr *

This is almost always a nir_instr and updating the src of a nir_if will
have to work slightly differently in the future.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12910>

23 months agoRevert "nir: Drop the unused instr arg for src/dest copy functions."
Rhys Perry [Wed, 8 Sep 2021 10:37:07 +0000 (11:37 +0100)]
Revert "nir: Drop the unused instr arg for src/dest copy functions."

This reverts commit c3a01841184ee8303c0c5ebe58491301622c5ad6.

Acked-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12910>

23 months agonir/serialize: remove unused parameter from read_src()
Rhys Perry [Wed, 8 Sep 2021 14:28:53 +0000 (15:28 +0100)]
nir/serialize: remove unused parameter from read_src()

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12910>

23 months agoutil: add freelist allocator with mark/sweep
Rhys Perry [Wed, 8 Sep 2021 14:21:57 +0000 (15:21 +0100)]
util: add freelist allocator with mark/sweep

Based on the allocator https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/524,
but modified a bit (in particular, it's now separate from ralloc).

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12910>

23 months agoutil/ralloc: add HEADER_ALIGN macro
Rhys Perry [Wed, 8 Sep 2021 15:13:01 +0000 (16:13 +0100)]
util/ralloc: add HEADER_ALIGN macro

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12910>

23 months agonir: Free instructions more often
Connor Abbott [Tue, 19 Mar 2019 13:16:41 +0000 (14:16 +0100)]
nir: Free instructions more often

Soon we'll be allocating instructions out of a per-shader pool, which
means that if we don't free too many instructions during the main
optimization loop, the final nir_sweep() call will create holes which
can't be filled. By freeing instructions more aggressively, we can
allocate more instructions from the freelist which will reduce the final
memory usage.

Modified from Connor Abbott's original patch to rebase on top of
refactored DCE and so that the use-after-free in nir_algebraic_impl() is
fixed.

Co-authored-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12910>

23 months agogallium/u_threaded: buffer sharedness tracking
Jonathan [Wed, 13 Jul 2022 19:11:33 +0000 (21:11 +0200)]
gallium/u_threaded: buffer sharedness tracking

This fixes TC's buffer invalidation code for buffers that are shared
between contexts.

TC is unable to notify other TCs in case it replaces a shared buffer's
underlying storage when invalidating, causing those other TCs to use
wrong buffer IDs for busyness tracking, which leads to corruption due
to invalidation fast-paths being triggered when they shouldn't be.

This patch addresses this issue by tracking if a buffer is shared, and
if it is, disabling buffer storage replacement for the affected buffer.
This is achieved by tracking which TC instance first accessed a certain
buffer. If a second instance then accesses it as well, it will realize
that it isn't the only one working on the buffer and mark the buffer
accordingly.

If TC needs to invalidate a buffer for the correctness of an operation
at any point, it will fall back to doing the operation in a synchronous
fashion with this patch if the buffer is shared and currently busy.

It might be possible to later detect that a buffer has become un-shared;
however, this is outside of the scope of this bugfix patch.

v2: Do not disable buffer busyness tracking for shared buffers.

Fixes: e9c41b32 ("gallium/u_threaded: add buffer lists - tracking of buffers referenced by tc")

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

23 months agogallium/u_threaded: Prepare for buffer sharedness tracking
Jonathan [Wed, 13 Jul 2022 19:00:28 +0000 (21:00 +0200)]
gallium/u_threaded: Prepare for buffer sharedness tracking

tc_add_to_buffer_list and tc_bind_buffer need the tc instance too.

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

23 months agou_atomic: Add a helper for pointer compare-exchange
Jesse Natalie [Tue, 30 Aug 2022 14:16:47 +0000 (07:16 -0700)]
u_atomic: Add a helper for pointer compare-exchange

Notably this helps with MSVC, which complains about compiling the not-taken
branches of the ternary when called with pointer args. Using a version that
doesn't have "runtime" sizeof checks eliminates the warnings.

Reviewed-by: Jonathan Strobl <jonathan.strobl@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17338>

23 months agoRevert "ci: disable the freedreno farm."
Rob Clark [Tue, 30 Aug 2022 14:59:34 +0000 (07:59 -0700)]
Revert "ci: disable the freedreno farm."

It is back again.  Hopefully it stays that way.

This reverts commit ab473a4f486146dcd474d81addc3bfcb136efd9f.

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

23 months agoaco/live_var_analysis: implement faster merging of live_out sets for some cases
Daniel Schürmann [Tue, 16 Aug 2022 22:23:36 +0000 (00:23 +0200)]
aco/live_var_analysis: implement faster merging of live_out sets for some cases

If we know that logical and linear predecessors are the same,
we don't need to check for the register type of each variable.

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

23 months agoaco: use std::vector::reserve() more often
Daniel Schürmann [Tue, 16 Aug 2022 22:18:54 +0000 (00:18 +0200)]
aco: use std::vector::reserve() more often

This removes the majority of vector re-allocations.

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

23 months agolima/ci: Make use of .lava-piglit
Christian Gmeiner [Mon, 29 Aug 2022 15:29:06 +0000 (17:29 +0200)]
lima/ci: Make use of .lava-piglit

This brings back the old CI behaviour.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18299>

23 months agogallium/u_transfer_helper: hide deinterleave helpers
Erik Faye-Lund [Tue, 9 Aug 2022 12:11:46 +0000 (14:11 +0200)]
gallium/u_transfer_helper: hide deinterleave helpers

There's no more callers of these, so let's make them an implementation
detail instead of public API.

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

23 months agozink: use full transfer-helper api
Erik Faye-Lund [Tue, 9 Aug 2022 12:11:22 +0000 (14:11 +0200)]
zink: use full transfer-helper api

This is going to make it easier to maintain u_transfer_helper in the
future.

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

23 months agogallium/u_transfer_helper: add in-place interleave flag
Erik Faye-Lund [Tue, 9 Aug 2022 12:07:03 +0000 (14:07 +0200)]
gallium/u_transfer_helper: add in-place interleave flag

This flag should allow Zink to stop using the interleave-specific API,
and instead just use the normal/full u_transfer_helper API, and start
using some more of these helpers.

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