Commit Graph

144186 Commits

Author SHA1 Message Date
Erik Faye-Lund
3e22fc27af zink: remove incorrect ASSERTED macro
The documentation for ASSERTED in macros.h says:

> Use ASSERTED to indicate that an identifier is unused outside of an `assert()`,
> so that assert-free builds don't get "unused variable" warnings.

We're using this variable outside of assert, so this shouldn't apply
here.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12594>
2021-08-27 18:43:31 +00:00
Erik Faye-Lund
a3092bc719 zink: remove needless scope
There's no variables declared in here, so there's no point in having
this slightly awkward scope here.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12594>
2021-08-27 18:43:31 +00:00
Erik Faye-Lund
f417a4c1ba zink: give each major intrinsic it's own emit function
It's so much easier to follow this code if there's not any big blocks of
emitting in the middle of the code that figures out exactly what to do.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12594>
2021-08-27 18:43:31 +00:00
Erik Faye-Lund
55e8857a80 zink: avoid checking if src is const twice
nir_src_as_const_value also checks if the src is const, and not
checking that it returned null makes Coverity go paranoid thinking we
could dereference a null-pointer. But because it's slightly better to
check once than to check twice, let's rewrite this to avoid the
double-check, making it obvious what's going on here.

CID: 1485624

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12594>
2021-08-27 18:43:31 +00:00
Erik Faye-Lund
75b5f12407 zink: avoid memcmping null pointers
memcmping NULL pointers is not allowed, and would lead to a crash here.
So let's check that the first isn't NULL; we've already checked that
they're not *both* NULL, so checking one is enough.

CID: 1484801, 1484810

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559>
2021-08-27 18:32:03 +00:00
Erik Faye-Lund
d3a795b528 zink: remove needless NULL-check
This NULL-check makes Coverity paranoid because we just dereferenced the
pointer a few lines above.

But we never call this function with a NULL-pointer here, so the NULL
check isn't needed. Let's just remove it, to calm Coverity down a bit.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559>
2021-08-27 18:32:03 +00:00
Erik Faye-Lund
077a9c7478 zink: return false on failure
We do this in the other pipe_buffer_map_range failure case, so it makes
sense that we need to do it here as well. If we don't, we'll end up
taking a crash in the check_query_results function, which will
dereference that pointer.

We also need to unmap the buffer if we fail, otherwise we'll leak.

CID: 1475925

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559>
2021-08-27 18:32:03 +00:00
Erik Faye-Lund
40f704f2f3 zink: pctx can't be null here
We're checking if pctx is null here, but that can't be true. If it
could, then the code that follows would have immediately crashed.

A quick peek at other drivers seems to indicate that this is a safe
assumption.

CID: 1474410, 1474554

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559>
2021-08-27 18:32:03 +00:00
Erik Faye-Lund
4cc3554d85 zink: do not dereference null-pointer
The "locations" pointer can be null here, and memcpying from a null
pointer is not okay.

CID: 1485978

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559>
2021-08-27 18:32:03 +00:00
Erik Faye-Lund
3fde1c4242 zink: do not try to dereference null-key
We can't do any of this logic if key is NULL, because that means we'll
dereference memory close to a NULL-pointer.

While we're at it, add some asserts to the zink_fs_key and zink_vs_key
functions who would otherwise be responsible for giving us invalid
non-null pointers out of null-pointers.

CID: 1475973, 1475983

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559>
2021-08-27 18:32:03 +00:00
Erik Faye-Lund
e3239dff05 zink: avoid overflow when calculating size
If we multiply before we (implicitly) cast the result to the target
type, we needlessly risk overflowing the result.

CID: 1490790, 1475922

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559>
2021-08-27 18:32:03 +00:00
Erik Faye-Lund
c96afa9fc8 zink: initialize pQueueFamilyIndices
This silences a Coverity warning about an uninitialized variable.

CID: 1490800

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559>
2021-08-27 18:32:03 +00:00
Erik Faye-Lund
64c558ab83 zink: do not warn about rare features until used
We currently cause the following scary warning to be printed on
start-up for *every* application regardless if that feature is being
used or not when run on top of ANV:

> WARNING: Some incorrect rendering might occur because the selected
> Vulkan device (Intel(R) UHD Graphics 620 (KBL GT2)) doesn't support
> base Zink requirements: line_rast_feats.stippledRectangularLines
> line_rast_feats.stippledSmoothLines

There's no need to scare the users about this, as most applications
don't care about these combinational features. So let's instead emit a
warning when these features are attempted (but failed) to be used
instead.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12587>
2021-08-27 18:21:08 +00:00
Erik Faye-Lund
28b3563a95 Revert "zink: always init bordercolor value for sampler"
This reverts commit 336dea90f0.

This change was incorrect for two reasons:

1. We already initialize this field on line 334
2. Unconditionally setting this to
   VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK breaks rendering with e.g
   opaque white borders, because we've already matched those to a
   non-custom enum value first.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12591>
2021-08-27 18:09:51 +00:00
Lepton Wu
bcd9db327d i965: Enable RGBX8888_SRGB format.
This is required by Android. Some Android games like nier reincarnation
show a black screen without this.

Signed-off-by: Lepton Wu <lepton@chromium.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12393>
2021-08-27 17:00:34 +00:00
Timur Kristóf
589ccf3d77 aco: Consider maximum number of workgroups per CU/WGP on Navi.
No Fossil DB changes.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12517>
2021-08-27 16:41:08 +00:00
Timur Kristóf
c8698199a1 aco: Consider LDS usage by PS inputs in MaxWaves calculation.
Before PS waves are launched, PS inputs are moved from PC to LDS
and the corresponding part of the PC is deallocated.
Each PS input occupies 3 * vec4 (3 * 16 = 48 bytes) of LDS space.
See Figure 10.3 in the GCN3 ISA manual.

These limit occupancy the same way as other stages' LDS usage does.
Note that PS can request additional LDS space via EXTRA_LDS_SIZE,
so that also must be taken into account here.

No Fossil DB changes.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12517>
2021-08-27 16:41:08 +00:00
Mike Blumenkrantz
9bc61108d7 zink: remove extra program ref from cached descriptor updates
this happens in draw/compute now

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12582>
2021-08-27 16:30:08 +00:00
Mike Blumenkrantz
5c3db42d1d zink: avoid pulling in unused push descriptors for cached ubo0
instead of just reading the template bufferinfo data, ensure that only
buffers which will be read are added to the set to avoid stale cache entries

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12582>
2021-08-27 16:30:08 +00:00
Tomeu Vizoso
9e314a6822 iris/ci: Correctly set freq governors to max
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12598>
2021-08-27 17:34:01 +02:00
Tomeu Vizoso
1f1dc49531 freedreno/ci: Correctly set freq governors to max
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12598>
2021-08-27 17:34:01 +02:00
Boris Brezillon
5a4fcb42f7 panvk: Fix panvk_copy_fb_desc()
We should not skip the copy when the batch is attached a framebuffer
descriptor, quite the opposite. Let's drop the check instead of reversing
it since we are guaranteed to have an FB attached when
panvk_copy_fb_desc() is called.

Fixes: 792a0ab0b1 ("panvk: Prepare per-gen split")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12590>
2021-08-27 16:38:45 +02:00
Boris Brezillon
d84dedc48f panvk: Make the per-arch static lib depend on panvk_entrypoints.h
The panvk_entrypoints.h header is included by all panvk_vX_xxx.c
source files, without this dependency the build can fail.

Fixes: 792a0ab0b1 ("panvk: Prepare per-gen split")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Tested-by: Fabio Pedretti <pedretti.fabio@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12590>
2021-08-27 16:37:36 +02:00
Mike Blumenkrantz
3990f95822 zink: more effectively utilize batch_usage for query destruction
there's no need to track the number of batches that a query is referenced on,
as all the tracking is already done by the batch_usage mechanism, so this
can be simplified to manage destruction based on whether batch_usage exists

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12578>
2021-08-27 14:26:50 +00:00
Mike Blumenkrantz
0f40ac286b zink: don't try to sync previous timestamp query qbo values
this makes no sense, so don't explode the qbo by trying

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12578>
2021-08-27 14:26:50 +00:00
Mike Blumenkrantz
4421180fe3 zink: move time query ending out to zink_end_query
time queries only need to be ended when the api ends them, not per-cmdbuf

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12578>
2021-08-27 14:26:50 +00:00
Mike Blumenkrantz
68c1b1b0e3 zink: improve threadsafe qbo access
these should be staging resources since they're being read from often,
and this allows dropping the UNSYNCHRONIZED flag from map since it should
be inferred

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12578>
2021-08-27 14:26:50 +00:00
Mike Blumenkrantz
4a5dfabb12 zink: make zink_gfx_pipeline_state::vertices_per_patch a bitfield
this is clamped to MAX_PATCH_VERTICES

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12586>
2021-08-27 10:52:59 +00:00
Mike Blumenkrantz
7b3dfea6c1 zink: repack zink_gfx_pipeline_state
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12586>
2021-08-27 10:52:59 +00:00
Mike Blumenkrantz
9c5a2ab6a9 zink: convert rasterizer pipeline components to bitfield
this reduces the hashed pipeline key size by 53 bits

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12586>
2021-08-27 10:52:59 +00:00
Mike Blumenkrantz
c73adf8c90 zink: steal a bit from rast_samples in pipeline state
zink only handles values up to 64, so this still has an extra bit

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12586>
2021-08-27 10:52:59 +00:00
Mike Blumenkrantz
9260b86905 zink: add clip_halfz to rasterizer hw state
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12586>
2021-08-27 10:52:59 +00:00
Mike Blumenkrantz
0e5ba2a508 zink: repack zink_rasterizer_hw_state
this is now 11 bits

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12586>
2021-08-27 10:52:59 +00:00
Mike Blumenkrantz
827fcb7e32 zink: zero viewport and scissor count in pipeline with dynamic state1
this is illegal

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12586>
2021-08-27 10:52:59 +00:00
Mike Blumenkrantz
cab68281ba zink: move viewport count into dynamic state1 part of pipeline hash
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12586>
2021-08-27 10:52:59 +00:00
Mike Blumenkrantz
94e9091ba2 zink: move dynamic state1 pipeline members into substruct
this is a bit easier to manage

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12586>
2021-08-27 10:52:59 +00:00
Boris Brezillon
19e29960e9 panfrost: v7 does not support RGB32_UNORM textures
Cc: mesa-stable
Fixes: c6bdd976e6 ("panfrost: Split out v6/v7 format tables")
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12588>
2021-08-27 08:21:14 +00:00
Yevhenii Kharchenko
b945262773 iris: fix layer calculation for TEXTURE_3D ReadPixels() on mip-level>0
Fixes assert when ReadPixels() called to read from FBO to
GL_PIXEL_PACK_BUFFER, on mip-level > 0, since num_layers
wasn't properly calculated with mip-level.

v2: patched 'iris_create_sampler_view' function instead of
'resolve_sampler_views'. Just like it was suggested in this
function's comment.
The logic of fix is similar to one in 'update_image_surface' function
of i965 driver, which is introduced in commit
f9fd0cf479.
With a slight change: setting array_len=1, like it was done in
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5808 ,
since minifying depth fails KHR-GLES2.texture_3d.filtering tests.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4145
Fixes: 3c979b0e ('iris: add some draw resolve hooks')

Signed-off-by: Yevhenii Kharchenko <yevhenii.kharchenko@globallogic.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9253>
2021-08-27 08:07:10 +00:00
Samuel Pitoiset
d90a8c79df radv: remove unecessary radv_finishme() for invalid color formats
Something really bad happen (likely driver bug) if this is triggered.
Replace with some assertions to catch an eventual issue in debug build.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12556>
2021-08-27 07:29:17 +00:00
Samuel Pitoiset
df90bb3f88 radv: remove useless check about number of samples in the HW resolve path
Although this can likely hang, this is invalid and should be caught
by the validation layers. There is many ways to hang the GPU with VK,
this check alone is useless.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12556>
2021-08-27 07:29:17 +00:00
Samuel Pitoiset
b05c2023cc radv: remove outdated radv_finishme() in the HW resolve path
Resolving layered MSAA images is actually implemented by the HW
resolve path but never used because the driver uses the compute path.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12556>
2021-08-27 07:29:17 +00:00
Mike Blumenkrantz
aab95f1bdf zink: set primitive restart with extended dynamic state2
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12585>
2021-08-27 03:31:25 +00:00
Mike Blumenkrantz
9c2fe8e621 zink: bump dynamic pipeline state count
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12585>
2021-08-27 03:31:25 +00:00
Mike Blumenkrantz
53da55ac87 zink: template for VK_EXT_extended_dynamic_state2
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12585>
2021-08-27 03:31:25 +00:00
Mike Blumenkrantz
7811037de5 zink: hook up VK_EXT_extended_dynamic_state2
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12585>
2021-08-27 03:31:25 +00:00
Mike Blumenkrantz
5b5201f0fd zink: no-op prim changes for pipeline recalc
this is no longer part of pipeline hash since we're using dynamic state

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12585>
2021-08-27 03:31:25 +00:00
Mike Blumenkrantz
0cec4d581c zink: consolidate pipeline hash tables
with dynamic prim type, pipelines can now be grouped by base prim type
instead of requiring a different pipeline for overall prim type

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12585>
2021-08-27 03:31:25 +00:00
Mike Blumenkrantz
305966ca75 zink: use dynamic prim type
this is part of dynamic state but wasn't used since it required
actual work to effectively make use of it

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12585>
2021-08-27 03:31:25 +00:00
Mike Blumenkrantz
3674839d11 zink: batch mem barrier hooks
memory barriers are redundant, so batch them and apply based on actual
usage to be slightly more efficient

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12576>
2021-08-27 02:59:24 +00:00
Mike Blumenkrantz
115935cc53 zink: slim down streamout component of mem barrier hook
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12576>
2021-08-27 02:59:24 +00:00