Commit Graph

133048 Commits

Author SHA1 Message Date
Christian Gmeiner d46a761e9e ir3: use intrinsic builders
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8295>
2021-01-06 14:34:41 +00:00
Christian Gmeiner 172e79d009 v3dv: use intrinsic builders
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8295>
2021-01-06 14:34:41 +00:00
Christian Gmeiner 66d51965af v3d: use intrinsic builders
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8295>
2021-01-06 14:34:41 +00:00
Christian Gmeiner c0fe111d64 nir: use intrinsic builders
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8295>
2021-01-06 14:34:41 +00:00
Christian Gmeiner 02553d96c8 tgsi_to_nir: use intrinsic builders
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8295>
2021-01-06 14:34:41 +00:00
Christian Gmeiner 475f086056 mesa/prog_to_nir: use intrinsic builders
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8295>
2021-01-06 14:34:41 +00:00
Mike Blumenkrantz b5fb66a5ed nir: preserve explicit_binding in lower_atomics_to_ssbo
it's important to be able to tell whether this is explicitly set by the
user

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7489>
2021-01-06 12:56:09 +00:00
Erik Faye-Lund 8553e1cb71 zink: remove support for fcsel
fcsel is only emitted by bool -> float lowering. We used to do that a
long time ago, but no longer. So we don't need to support this opcode
any longer.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8347>
2021-01-06 12:49:48 +00:00
Erik Faye-Lund cfb5ce782c zink: also lower scmp for soft-fp
We recently added two versions of these options, due to soft-fp support.
So let's also add the lowering to the soft-fp version.

Fixes: 43302ead38 ("zink: use lower_scmp instead of open-coding")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8347>
2021-01-06 12:49:48 +00:00
Boris Brezillon 471fd78e3c panfrost: Fix AFBC on Bifrost v6
The AFBC layout of RT/ZS-extension descriptors on Bifrost v6 matches the
v7 one except for the Block Format field. Update the set_buf() functions
accordingly.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8328>
2021-01-06 10:12:51 +01:00
Yogesh mohan marimuthu 8a22fc9502 radeonsi: enable vrs2x2 coarse shading if flat shading (v9)
Enable vrs2x2 coarse shading if flat shading as per
idea and guidance given by Marek.

is_flat_shading variable in struct si_shader_info is set
based on the data from gather_intrinsic_info() function
and struct si_state_rasterizer. If is_flat_shading_variable
is set, then in function si_emit_db_render_state() vrs2x2
shading is enabled in hardware.

v2: Fix review comments from Pierre-Eric. Code optimizations.
v3: Fix indentation style issue.
v4: Fix review comments from Marek. Fixed logical issue pointed
    by Marek where info->is_flat_shading variable can be corrupted
    and other code cleanup.
v5: Make the code compact as suggested by Pierre-Eric.
v6: Fix new review comments from Marek.
v7: use info->uses_interp_color variable fix from Marek.
v8: Fix coding style comment from Marek.
v9: Add uses_fbfetch_output check as suggested by Marek.

Signed-off-by: Yogesh Mohan Marimuthu <yogesh.mohanmarimuthu@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8161>
2021-01-06 10:12:10 +05:30
Eric Anholt 40a554c8dd gallium/ntt: Add support for PIPE_CAP_LOAD_CONSTBUF.
We needed to do this anyway to finish enabling NTT in general, but more
importantly: when we enabled sending NIR to the draw module, that broke
PIPE_CAP_LOAD_CONSTBUF drivers in the select/feedback paths if LLVM was
disabled.

Fixes: 44b7e1497f ("st/mesa: don't generate TGSI for the draw VS because it now supports NIR too")
(along with the rest of this MR)

Closes: #3996
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8196>
2021-01-05 15:05:48 -08:00
Eric Anholt 03c60762f5 gallium/ntt: Fix load_ubo_vec4 buffer index setup.
I had a funny +1 in nir_to_tgsi's load_ubo lowering on the buffer index,
because I hadn't set lower_uniform_to_ubo for softpipe.  This removes that
weirdness in favor of just using lower_uniform_to_ubo, regardless of
driver preference (which matters if a NIR-native driver had it set, and
then the gallium draw module triggered the non-LLVM TGSI fallback path
that hit NTT).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8196>
2021-01-05 15:05:48 -08:00
Eric Anholt 9789417055 gallium/ntt: Fix dynamic indirect indexing of per_vertex_input.
It was off by one due to some copy and paste from UBO handling.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8196>
2021-01-05 15:05:48 -08:00
Eric Anholt ec0bab8ca9 gallium/ntt: Fix emitting UBO declarations.
Fixes: d70fff99c5 ("nir: Use a single list for all shader variables")

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8196>
2021-01-05 15:05:48 -08:00
Eric Anholt e109f5ea0f gallium/tgsi_exec: Add support for PIPE_CAP_LOAD_CONSTBUF.
Now that we can end up in nir-to-tgsi in the draw fallback paths of
drivers with that flag set, we need to support it.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8196>
2021-01-05 15:05:47 -08:00
Eric Anholt 911bb08314 gallium/tgsi_exec: Refactor to fix CS local memory overflow checks.
It was OK because right now we only execute in the first channel of the
CS, but if you wanted to extend that then you'd need to check each
channel.  We already had what we needed for SSBOs, so just reuse it.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8196>
2021-01-05 15:05:47 -08:00
Eric Anholt 671263b5c7 gallium/tgsi_exec: Fix assertion failure about missing constbufs.
GL by default gives you UB when you access a missing constbuf, and we were
crashing on debug builds in that case.  More importantly, we were
assertion failing even under valid circumstances, when a !ExecMask channel
had a bad value for the indirect buffer index and we tried to load from it
anyway.

In removing the assertion, also sink the buf declaration to after we've
done the bounds check that determines that there's a constbuf actually
bound to this index.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8196>
2021-01-05 15:05:47 -08:00
Jesse Natalie 0034f7b209 d3d12: Don't allocate mappable textures
There's not really a reason to directly map textures. Doing so
requires the texture to be allocated in system RAM instead of
video RAM, which means all GPU access to it would be needlessly slow.

Notably, the one texture type that was allocated this way is the
display target texture for the software driver path. Instead, use
pipe_transfer_map to be able to copy the texture to system RAM.

Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8095>
2021-01-05 14:51:00 -08:00
Jesse Natalie 34bae108df d3d12: Use an appropriate pipe resource usage for map intermediates
Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8095>
2021-01-05 14:51:00 -08:00
Jesse Natalie ee1463db3c d3d12: Use buffer pipe usage to inform allocation
For non-CPU-accessible pipe resource types (DEFAULT/IMMUTABLE),
allocate non-CPU-accessible buffers directly from the cache_bufmgr.
Update the d3d12_bo creation to handle nonmappable buffers.

For CPU-write-only (DYNAMIC/STREAM), use the upload slab_bufmgr.
Update this slab manager to use CPU_WRITE | GPU_READ PB usage.

For CPU-read-write (STAGING), use the readback_slab_bufmgr.

Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8095>
2021-01-05 14:51:00 -08:00
Jesse Natalie be19eb771a d3d12: Add a slab bufmgr for readback buffers
Readback (GPU write, CPU read) should use different CPU page
properties compared to upload (write-back vs write-combined).

A future commit will start to respect these PB usage flags.

Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8095>
2021-01-05 22:25:41 +00:00
Jesse Natalie 47125bce8b d3d12: Add a path for mapping of not-directly-mappable buffers
Currently all buffers are allocated as mappable, but a future
commit will change that so that some buffers can be allocated
directly in non-CPU-accessible memory for improved performance.

Note that the returned pointer must be appropriately offset from
a 64-byte-aligned base pointer, so if offsets are used, the data
will be read/written to an offset region in the staging buffer.

Reviewed-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8095>
2021-01-05 22:25:41 +00:00
Jesse Natalie 4d83306a9a nir: Update saturated float->int/uint conversion algorithm
The mantissa for a float doesn't contain enough data to accurately represent
the min/max values for some destination types. Instead of clamping before
converting, clamp after converting when coming from floats. This improves
conformance of CL conversions, specifically for float -> long/ulong with
int64 emulation enabled.

Refactors the limit determination from the clamp, so we can determine
limits for the dest type (int/uint) in both the source (float) and dest
type. The limit as a float is used for comparison, while the limit as a
dest type is used for bcsel.

Important note is that the comparison is inverted to fge instead of flt,
so the bcsel chooses the direct int/uint over the converted float in the
case where the comparison comes up equal, but the conversion can't produce
the exact min/max value.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8256>
2021-01-05 19:46:25 +00:00
Eric Anholt fcecc21832 freedreno/a5xx: Move link_stream_out after VPC_VAR_DISABLE like on a6xx.
Since we've got issues on a5xx xfb that we don't on a6xx, I've been
looking at making them line up a bit better.  No change on tests.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8336>
2021-01-05 18:23:37 +00:00
Eric Anholt 3ca6387379 freedreno/a5xx: Drop redundant stream output linking check.
The link function just loops over the num_outputs.  Brings us closer to
a6xx.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8336>
2021-01-05 18:23:37 +00:00
Eric Anholt 7e1e227694 freedreno/ir3: Deduplicate link_stream_out.
All 3 copies were the same other than style tweaks.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8336>
2021-01-05 18:23:37 +00:00
Erik Faye-Lund 43302ead38 zink: use lower_scmp instead of open-coding
We already have the proper lowering in NIR for this, so there's no point
in doing our own implementations of these. The end result is the same
code anyway.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8335>
2021-01-05 18:13:05 +00:00
Danylo Piliaiev 94b84f1eed freedreno/a5xx: implement transform feedback resuming
Each transform feedback target should have a separate buffer
for an offset from which to resume, instead of just having
one buffer per binding point. Otherwise, if transform feedback
is paused and other tf object is bound - the offset of the
previous tf object would be lost.

Fixes CTS tests:
 dEQP-GLES3.functional.transform_feedback.*triangles*

Fixes Piglit tests:
 gl-3.1-primitive-restart-xfb flush
 gles-3.0-transform-feedback-uniform-buffer-object
 arb_transform_feedback2-change-objects-while-paused
 arb_transform_feedback2-change-objects-while-paused_gles3
 ext_transform_feedback-intervening-read

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8281>
2021-01-05 17:30:01 +00:00
Danylo Piliaiev 49283041e8 freedreno/a6xx: fix transform feedback resuming
Each transform feedback target should have a separate buffer
for an offset from which to resume, instead of just having
one buffer per binding point. Otherwise, if transform feedback
is paused and other tf object is bound - the offset of the
previous tf object would be lost.

Fixes Piglit tests:
 arb_transform_feedback2-change-objects-while-paused
 arb_transform_feedback2-change-objects-while-paused_gles3
 ext_transform_feedback-alignment 4
 ext_transform_feedback-alignment 8
 ext_transform_feedback-alignment 12
 ext_transform_feedback-change-size offset-grow
 ext_transform_feedback-change-size offset-shrink
 ext_transform_feedback-change-size range-grow
 ext_transform_feedback-change-size range-shrink
 ext_transform_feedback-immediate-reuse-uniform-buffer
 ext_transform_feedback-position *

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8281>
2021-01-05 17:30:01 +00:00
Mike Blumenkrantz 4283441cd6 zink: handle non-const offsets for txf/tg4 ops
required for gl_spirv handling and tg4

Fixes: b77f43f253 ("zink: use ConstOffset for nir_tex_src_offset")

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8333>
2021-01-05 12:16:02 -05:00
James Jones 80cfc5350c gallium/dri: Use per-screen DRI extension list
Some DRI extension features are enabled/disabled
based on capabilities of the gallium pipe_screen
associated with the DRI screen. Additionally, the
list of extensions enabled also varied based on
features requested by the screen creator. However,
prior to this change the extension list and
extension definition structures within it were
global variables, meaning the last screen
initialized ended up defining the DRI capabilities
of all screens.

This change instead stores a copy of the
extensions which vary per screen, as well as a
copy of the extension list itself in the gallium
DRI screen structure, allowing them to vary per
screen.

Closes: https://gitlab.freedesktop.org/drm/nouveau/issues/9

Signed-off-by: James Jones <jajones@nvidia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7175>
2021-01-05 16:11:12 +00:00
James Jones 7d4c184ff9 gallium/dri: Factor out DRI extension setup code
Share the DRI extension setup code between
dri2_init_screen and dri_kms_init_screen. There's
currently very little difference, and the sharing
will make a subsequent change to refactor this
code to use per-screen extension lists easier.

Signed-off-by: James Jones <jajones@nvidia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7175>
2021-01-05 16:11:11 +00:00
Erik Faye-Lund b77f43f253 zink: use ConstOffset for nir_tex_src_offset
Quote from the OpenGL Shading Language spec, version 4.40, section 8.9.2
"Texel Lookup Functions":

> The offset value must be a constant expression.

So, until we start consuming SPIR-V shaders, it seems we don't need to
deal with non-constant offsets.

This means we can avoid lowering this away in some cases.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8327>
2021-01-05 15:48:17 +00:00
Erik Faye-Lund 918cb23693 zink: do not reserve or pack fragment outputs
These are completely unrelated to other shader IO variables, so they
don't need this logic.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7986>
2021-01-05 15:42:15 +00:00
Erik Faye-Lund f06f4a595e zink: do not use reservations for stream-out
reservations are accumulated for all shader-stages in a program without
resetting it. But stream-out is completely orthogonal to all other
inputs and outputs, so they don't matter for this stuff at all.

So let's drop considering reservations here, and simply count how many
generic outputs we have here instead.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7986>
2021-01-05 15:42:15 +00:00
Erik Faye-Lund b49cea2e9a zink: destroy device and instance
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099>
2021-01-05 15:36:35 +00:00
Erik Faye-Lund bc1593a9cd zink: destroy transfer-helper
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099>
2021-01-05 15:36:35 +00:00
Erik Faye-Lund 81be8c7049 zink: free sets and hash-tables in context
Up until now, we've simply leaked all of these. Let's try to do better.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099>
2021-01-05 15:36:35 +00:00
Erik Faye-Lund 07d5d911dd zink: dot leak dummy_buffer
Fixes: 8736ffae2e ("zink: replace unset buffer with a dummy-buffer")

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099>
2021-01-05 15:36:35 +00:00
Erik Faye-Lund a118da0371 zink: do not leak vertex element state
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099>
2021-01-05 15:36:35 +00:00
Erik Faye-Lund f70490bf42 zink: release batch memory
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099>
2021-01-05 15:36:35 +00:00
Erik Faye-Lund 5d44a973b5 zink: destroy blitter before destroying batches
Destroying the blitter frees samplers, which pushes the sampler-handles
onto the batches' zombie-sampler lists. So if we want to properly clean
these zombie-samplers up, we need to first get them onto the list so
we'll know about them in time.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099>
2021-01-05 15:36:35 +00:00
Erik Faye-Lund 820d272a21 zink: factor out zink_batch_release-helper
This will be useful for making sure everything has gotten cleaned up
properly.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099>
2021-01-05 15:36:35 +00:00
Erik Faye-Lund cd7d8eade2 zink: do not open-code CALLOC_STRUCT
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8099>
2021-01-05 15:36:35 +00:00
Mike Blumenkrantz 5342dbe96d features: mark off GL 4.1 for zink
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8329>
2021-01-05 08:58:28 -05:00
Mike Blumenkrantz c211f466cc zink: GLSL 410
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8329>
2021-01-05 08:58:27 -05:00
Mike Blumenkrantz 3f640e56c4 features: mark off GL 4.0 for zink
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8329>
2021-01-05 08:58:25 -05:00
Mike Blumenkrantz ae9d6c5620 zink: GLSL 4.00
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8329>
2021-01-05 08:58:24 -05:00
Mike Blumenkrantz 22be7b9674 zink: handle arrays of ubos
with the nir pass removing all dynamic indexing, all that's needed here
is generating extra binding points for each array member, as everything else
is already handled

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8314>
2021-01-05 08:37:03 -05:00