Marek Olšák [Sun, 6 Jun 2021 11:35:00 +0000 (07:35 -0400)]
radeonsi: don't clear register fields in si_set_mutable_tex_desc_fields
They are always initialized to 0.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11340>
Marek Olšák [Sun, 6 Jun 2021 11:17:53 +0000 (07:17 -0400)]
radeonsi: use the restrict keyword to set sampler view descriptors faster
All places must set restrict for the same pointer.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11340>
Marek Olšák [Sun, 6 Jun 2021 10:45:48 +0000 (06:45 -0400)]
radeonsi: check is_buffer once instead of 4 times in si_set_sampler_view_desc
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11340>
Erik Faye-Lund [Wed, 16 Jun 2021 09:29:45 +0000 (02:29 -0700)]
zink: do not check buffer-format for usage-bits
Buffers are created without a format in Vulkan, and we always pass in
R8_UNORM for them in Gallium. It's the view-formats we should have
checked, if anything.
But that's orthogonal to this. We shoudn't keep checking R8_UNORM
capabilities for buffers, all it's going to do is trigger asserts.
Fixes:
00dc0036b ("zink: flatten out buffer creation usage flags codepath")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11416>
Erik Faye-Lund [Wed, 16 Jun 2021 08:51:07 +0000 (01:51 -0700)]
zink: drop repeated usage-bit
We already set this bit unconditionally right before, no point in
repeating it.
Fixes:
00dc0036b ("zink: flatten out buffer creation usage flags codepath")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11416>
Erik Faye-Lund [Wed, 16 Jun 2021 13:13:28 +0000 (15:13 +0200)]
zink: remove unused function
There's no call-sites to this function, so let's drop it.
Fixes:
e4e20556d62 ("zink: switch to memory barriers instead of actual buffer barriers")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11421>
Erik Faye-Lund [Wed, 16 Jun 2021 13:09:09 +0000 (15:09 +0200)]
zink: fixup signedness of subtraction
I'm not even going to pretend that I grok this code, but since we take
the abs value, it's pretty obvious that we meant to use a signed value
here. So let's cast the two operands to int before we subtract.
This was noticed by the following clang warning:
---8<---
../src/gallium/drivers/zink/zink_context.c:3284:14: warning: taking the
absolute value of unsigned type 'unsigned int' has no effect
[-Wabsolute-value]
last = abs(reads - writes) > UINT32_MAX / 2 ? MIN2(reads, writes) : MAX2(reads, writes);
^
---8<---
Fixes:
0c1fe392e8d ("zink: implement a tc is_resource_busy hook")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11421>
Mike Blumenkrantz [Thu, 6 May 2021 20:41:36 +0000 (16:41 -0400)]
zink: move queue init to screen creation
this is a race condition
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11398>
Mike Blumenkrantz [Fri, 7 May 2021 23:08:30 +0000 (19:08 -0400)]
zink: set subdata hook as PIPE_MAP_ONCE
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11401>
Mike Blumenkrantz [Thu, 22 Apr 2021 18:52:58 +0000 (14:52 -0400)]
zink: update pipe_screen::num_contexts
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11394>
Mike Blumenkrantz [Fri, 11 Jun 2021 21:47:53 +0000 (17:47 -0400)]
anv: fix dynamic primitive topology for tess
this needs to use the pre-converted topology using tess state patch control points
Fixes:
f6fa4a80000 ("anv: add support for dynamic primitive topology change")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11332>
Erik Faye-Lund [Wed, 16 Jun 2021 08:49:25 +0000 (01:49 -0700)]
zink: correct type of flags to flush
This type is unsigned in the prototype, so this produces a warning on
MSVC.
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>
Erik Faye-Lund [Wed, 16 Jun 2021 08:15:49 +0000 (01:15 -0700)]
zink: use alloca instead of hard-to-size vlas
These variable-length arrays are hard to size statically, and VLAs
aren't supported by MSVC. So let's use alloca instead.
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>
Erik Faye-Lund [Tue, 15 Jun 2021 15:27:43 +0000 (08:27 -0700)]
zink: use max-descriptor define
This avoids compile errors on MSVC due to VLAs.
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>
Erik Faye-Lund [Tue, 15 Jun 2021 15:25:34 +0000 (08:25 -0700)]
zink: introduce a define for max descriptors per type
We know what this max is in the compiler, let's move that out into
zink_descriptors.h, so we can reuse the constant.
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>
Erik Faye-Lund [Tue, 15 Jun 2021 15:31:21 +0000 (08:31 -0700)]
zink: fix more initializer styles
Empty initializer lists are a GCC extension, let's use the syntax that
compilers like MSVC also supports.
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>
Erik Faye-Lund [Tue, 15 Jun 2021 15:15:42 +0000 (08:15 -0700)]
zink: drop some more vla usage
MSVC doesn't like them, so let's get rid of more of them.
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>
Erik Faye-Lund [Tue, 15 Jun 2021 15:12:38 +0000 (08:12 -0700)]
zink: add missing compiler-dependency
Without this, we depend on something else previously in the build to
have built these.
Fixes:
ed2fb809 ("zink: introduce vk_dispatch_table")
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11380>
Erik Faye-Lund [Wed, 16 Jun 2021 09:36:05 +0000 (02:36 -0700)]
zink: drop paranoid code
If we ever get here, res->dt is non-NULL. No need to assert, and no need
to check twice.
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11414>
Erik Faye-Lund [Wed, 16 Jun 2021 09:34:18 +0000 (02:34 -0700)]
zink: do not unmap dt-buffers twice
Seems I missed that we already did an unconditional unmap here, and
forgot to remove it. Whoops.
Fixes:
5159f406d ("zink: use gallium api to copy to display-target")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11414>
Mike Blumenkrantz [Thu, 6 May 2021 20:09:10 +0000 (16:09 -0400)]
zink: split stencil ref changes to separate dirty flag
the values here are for the cmdbuf, not the pipeline, so they should
always be updated regardless of what the current dsa state uses
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11396>
Mike Blumenkrantz [Thu, 6 May 2021 19:59:14 +0000 (15:59 -0400)]
zink: add update flag for dsa state change
reduce overhead by avoiding unnecessary updates
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11396>
Mike Blumenkrantz [Thu, 6 May 2021 19:58:37 +0000 (15:58 -0400)]
zink: add update flag for rasterizer state change
this can be used to avoid updating related dynamic states too frequently
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11396>
Mike Blumenkrantz [Mon, 5 Apr 2021 16:00:04 +0000 (12:00 -0400)]
zink: handle nir_op_pack_64_2x32
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11392>
Charlie [Mon, 14 Jun 2021 21:54:26 +0000 (22:54 +0100)]
v3dv: remove sRGB blending workaround
This reverts commits
4c15131b1d36874b643aed8407933ccd8675841d and
1cf36797bf9d63b33c405d85ce720dcd5e75a47c.
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11377>
Charlie [Mon, 14 Jun 2021 19:19:40 +0000 (20:19 +0100)]
v3dv: clamp srgb render targets
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11377>
Iago Toral Quiroga [Wed, 16 Jun 2021 09:34:18 +0000 (11:34 +0200)]
Revert "v3dv: allow creating uncompressed views from compressed images and vice versa"
This reverts commit
b32a48c7e26bffdc696d3cceef0305e2c4731c96.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11415>
Iago Toral Quiroga [Wed, 16 Jun 2021 09:23:30 +0000 (11:23 +0200)]
v3dv: don't support VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT
The hardware doesn't support this naturally and we need to do a lot
of nasty stuff in the driver to almost make it work.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11415>
Karol Herbst [Tue, 16 Jun 2020 18:17:55 +0000 (20:17 +0200)]
nv50/ir: fix surface lowering when values get shared accross operations
With nir I encountered the case where the same value can be written to from
multiple surface operations. This caused some weird messups with the unions
as the def.rewrite operations caused unrelated instructions to get new their
value replaced as well.
In order to replace def.rewrite, we have to create a new temp value, write
to that one instead and move to the original value.
Fixes:
869e32593a9 ("gm107/ir: fix loading z offset for layered 3d image bindings")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11053>
Ilia Mirkin [Tue, 15 Jun 2021 04:49:02 +0000 (00:49 -0400)]
st/mesa: always report the max samples as supported
This is required by GL. Doing this even when the backend driver does not
support it leads to creating attachments which are not renderable. This
is not ideal, but does pass tests. This covers scenarios such as missing
MSAA for 128-bit formats on Sandybridge, and missing 8x MSAA on 128-bit
formats on NVIDIA Tesla generation boards.
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11372>
Mike Blumenkrantz [Tue, 11 May 2021 17:50:14 +0000 (13:50 -0400)]
zink: stop sanitizing primitive_restart flag in draw info
this is a 1bit struct member, sanitizing is pointless
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11408>
Mike Blumenkrantz [Tue, 11 May 2021 17:49:42 +0000 (13:49 -0400)]
zink: move batch decl to top of draw_vbo
this may still change during descriptor updating, but having the pointer
earlier is helpful
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11408>
Mike Blumenkrantz [Tue, 11 May 2021 17:49:10 +0000 (13:49 -0400)]
zink: remove unnecessary draw checks
I don't know how/why these got here but they aren't needed
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11408>
Mike Blumenkrantz [Mon, 10 May 2021 10:50:49 +0000 (06:50 -0400)]
zink: use u_live_shader_cache
let the duplicated shader madness end
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11403>
Mike Blumenkrantz [Mon, 10 May 2021 10:30:19 +0000 (06:30 -0400)]
zink: unify gfx shader create callbacks
these are identical
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11403>
Mike Blumenkrantz [Sat, 23 Jan 2021 16:03:52 +0000 (11:03 -0500)]
zink: mark bind_stage() as inline
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11403>
Mike Blumenkrantz [Tue, 11 May 2021 16:58:36 +0000 (12:58 -0400)]
zink: simplify zink_program_has_descriptors()
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11407>
Mike Blumenkrantz [Tue, 11 May 2021 16:21:10 +0000 (12:21 -0400)]
zink: remove return types from program update functions during draw
also remove some null checks; these add overhead and the app is going to
explode anyway if they fail
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11406>
Mike Blumenkrantz [Tue, 11 May 2021 16:18:19 +0000 (12:18 -0400)]
zink: slightly refactor program updating during draw
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11406>
Mike Blumenkrantz [Sun, 9 May 2021 18:14:53 +0000 (14:14 -0400)]
zink: destroy lazy descriptor pools during batch reset when unused
this should keep resource usage a bit lower
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11404>
Mike Blumenkrantz [Sun, 9 May 2021 17:59:06 +0000 (13:59 -0400)]
zink: track active use counts for descriptor layouts
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11404>
Mike Blumenkrantz [Sun, 9 May 2021 17:56:45 +0000 (13:56 -0400)]
zink: cache descriptor update templates along with layout
this simplifies a bunch of code and just makes more sense given that the
lifetimes should match
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11404>
Dave Airlie [Wed, 16 Jun 2021 03:39:39 +0000 (13:39 +1000)]
crocus: disable Z16
This is disabled on i965 for all pre-gen8, so do the same here.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11409>
Dave Airlie [Wed, 16 Jun 2021 03:35:11 +0000 (13:35 +1000)]
crocus: fixup render aux usage function.
This got misaligned somewhere in development, should fix the
regressions vs i965 in tesseract as seen on phoronix benchmarks.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11409>
Mike Blumenkrantz [Fri, 7 May 2021 12:57:12 +0000 (08:57 -0400)]
zink: make batch_usage_matches take a batch state param
no functional changes, just some unwinding in some cases
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>
Mike Blumenkrantz [Fri, 7 May 2021 12:27:02 +0000 (08:27 -0400)]
zink: make batch_usage_set take a batch state param
no functional changes
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>
Mike Blumenkrantz [Fri, 7 May 2021 12:23:04 +0000 (08:23 -0400)]
zink: remove unnecessary conditionals in resource batch tracking
this is no longer an atomic op
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>
Mike Blumenkrantz [Fri, 7 May 2021 12:21:30 +0000 (08:21 -0400)]
zink: unset program batch usage on state reset
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>
Mike Blumenkrantz [Fri, 7 May 2021 12:21:02 +0000 (08:21 -0400)]
zink: make batch_usage_unset take a batch state param
no functional changes
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>
Mike Blumenkrantz [Fri, 7 May 2021 12:15:43 +0000 (08:15 -0400)]
zink: remove atomic from batch usage setting
this shouldn't be necessary since usage can only be set from the context thread
and only needs to be accessed atomically for the cmpxchg when unsetting
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>
Mike Blumenkrantz [Fri, 7 May 2021 12:14:53 +0000 (08:14 -0400)]
zink: move batch usage functions to static inlines
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399>
Mike Blumenkrantz [Fri, 7 May 2021 13:38:45 +0000 (09:38 -0400)]
zink: optimize zink_tc_fence struct packing
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>
Mike Blumenkrantz [Fri, 7 May 2021 13:37:20 +0000 (09:37 -0400)]
zink: reorder has_barriers flag in batch state struct
better struct packing
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>
Mike Blumenkrantz [Fri, 7 May 2021 13:37:04 +0000 (09:37 -0400)]
zink: split batch state work_count into separate vars
this has better struct packing
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>
Mike Blumenkrantz [Fri, 7 May 2021 13:31:45 +0000 (09:31 -0400)]
zink: remove zink_batch_state::descs_used
this is no longer used or needed
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11400>
Dave Airlie [Wed, 16 Jun 2021 00:34:05 +0000 (10:34 +1000)]
crocus: fixed some missing WM dirtys.
This fixes misrendering in ET: legacy.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11390>
Mike Blumenkrantz [Mon, 29 Mar 2021 21:22:49 +0000 (17:22 -0400)]
zink: add ZINK_DESCRIPTORS env var to explicitly set a mode
currently this supports 3 modes, with the default being a hybrid between
caching and lazy
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Mon, 29 Mar 2021 20:40:52 +0000 (16:40 -0400)]
zink: unblock last_set cached descriptor reuse when safe to do so
if no changes at all have occurred to a given set since the last use,
and if the program hasn't changed, then there is no possiblility for
the set to have been invalidated, and so it can immediately be reused
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Mon, 29 Mar 2021 19:51:08 +0000 (15:51 -0400)]
zink: skip hash updates for descriptor types which aren't used
this is pointless and hurts drawoverhead perf
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Mon, 29 Mar 2021 19:22:19 +0000 (15:22 -0400)]
zink: add oob asserts for descriptor set ref setting
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Sun, 28 Mar 2021 16:31:11 +0000 (12:31 -0400)]
zink: enable templated descriptor updates in cache mode
this leverages the template infrastructure from the lazy manager for the
cached mode, alternatively generating a pseudo-template for updates
if real templates aren't available in order to retain 1.0 compatibility
Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Sun, 28 Mar 2021 16:50:05 +0000 (12:50 -0400)]
zink: move samplerview descset refs to base objects
this further extends the lifetimes for sets
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Sun, 28 Mar 2021 16:42:08 +0000 (12:42 -0400)]
zink: add funcs for descriptor_surface refs
this abstracts more code for the cache backend
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Sun, 28 Mar 2021 15:31:56 +0000 (11:31 -0400)]
zink: move shader image descriptor set refs to underlying type
this was kinda useless since it meant that the set was invalidated any
time the shader image was unbound
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Mon, 29 Mar 2021 19:24:40 +0000 (15:24 -0400)]
zink: update null sampler/image descriptor surface with is_buffer during hashing
this is the only time it might need to be used, so it can be updated naturally here
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Sun, 28 Mar 2021 15:31:06 +0000 (11:31 -0400)]
zink: add is_buffer flag to union zink_descriptor_surface
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Sat, 27 Mar 2021 17:19:27 +0000 (13:19 -0400)]
zink: run lazy batch descriptor functions in cache mode
Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Thu, 25 Mar 2021 15:26:43 +0000 (11:26 -0400)]
zink: unify cached descriptor update code
this is all pretty much standardized now, so it can be combined into something
simpler
Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Thu, 25 Mar 2021 13:25:31 +0000 (09:25 -0400)]
zink: move ubo range assert to update_descriptor_state()
Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Thu, 25 Mar 2021 13:19:21 +0000 (09:19 -0400)]
zink: remove sorting for dynamic ubo offset updating
if the offsets are assigned in the right order, they don't need to be
ordered later
Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Thu, 25 Mar 2021 13:08:13 +0000 (09:08 -0400)]
zink: modernize cached image descriptor updating
use the auto-updated descriptor info
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Thu, 25 Mar 2021 12:50:12 +0000 (08:50 -0400)]
zink: modernize cached ssbo descriptor updating
use the already-updated bufferinfo structs
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Thu, 25 Mar 2021 12:50:12 +0000 (08:50 -0400)]
zink: modernize cached ubo descriptor updating
use the already-updated bufferinfo structs
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Thu, 25 Mar 2021 12:50:12 +0000 (08:50 -0400)]
zink: modernize cached push ubo descriptor updating
use the already-updated bufferinfo structs
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Wed, 24 Mar 2021 13:02:52 +0000 (09:02 -0400)]
zink: match lazy descriptor set layout in cache mode
now cached descriptors also use a push set for ubo0, also reusing the
ZINK_DESCRIPTOR_TYPES for this set for enum purposes
Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Tue, 23 Mar 2021 20:12:42 +0000 (16:12 -0400)]
zink: split lazy sets based on descriptor type
this is now closer to the cached descriptor set layout, but with
the push set as the zero-indexed set (passed as ZINK_DESCRIPTOR_TYPES
for enum purposes)
Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Mike Blumenkrantz [Wed, 24 Mar 2021 13:02:09 +0000 (09:02 -0400)]
zink: add a function for creating descriptor layouts for push sets
push sets contain a single ubo at index 0 per shader stage in the set
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11188>
Ian Romanick [Tue, 15 Jun 2021 19:34:01 +0000 (12:34 -0700)]
v3d: ci: Add KHR-GLES31.core.shader_image_load_store.basic-glsl-earlyFragTests to flakes
Closes: #4934
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11386>
Yiwei Zhang [Tue, 15 Jun 2021 20:06:35 +0000 (20:06 +0000)]
venus: add debug info for experimental features during init
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11387>
Jason Ekstrand [Mon, 14 Jun 2021 20:10:17 +0000 (15:10 -0500)]
anv: Agressively no-op Flush/InvalidateMappedMemoryRanges
This has two steps. First, for each range we look at the memory object
and see if it actually needs flushing before we start throwing CLFLUSH
instructions. Second, we look at the whole list of types on device
initialization and decide whether or not we need CLFLUSH at all. The
first part should speed up atom chips a bit since we're currently
CLFLUSHing everything even when we don't need to. The second isn't
needed on most of today's parts because we base it on !has_llc but it is
needed for discrete parts. It's also over-all cleaner.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Felix DeGrood <felix.j.degrood@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11364>
Emma Anholt [Mon, 14 Jun 2021 21:13:45 +0000 (14:13 -0700)]
freedreno: Be more strict about QUERY_AVAILABLE to simplify the code.
ARB_oq doesn't just say "polling in a loop will make it complete
eventually", it says "querying will make it complete in finite time."
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11368>
Emma Anholt [Mon, 14 Jun 2021 19:02:26 +0000 (12:02 -0700)]
freedreno: Drop a bit of indirection around the batch cache flush path.
Checking the flag to call separate functions which then call the same
helper with the flag is a bit silly.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11368>
Emma Anholt [Mon, 14 Jun 2021 18:48:14 +0000 (11:48 -0700)]
freedreno: Make a bunch of the batch cache take ctx as the arg.
As we move the batch cache from screen to context, it cleans up the diff a
ton to separate this mechanical change out, and makes the API generally
more consistent (since you usually have to pass the ctx anyway).
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11368>
Emma Anholt [Mon, 14 Jun 2021 18:42:43 +0000 (11:42 -0700)]
freedreno: Drop batch-cache orphan tracking.
Let's let valgrind/asan handle leak detection. This means you can use the
flag even on non-DEBUG builds.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11368>
Alyssa Rosenzweig [Fri, 11 Jun 2021 16:43:41 +0000 (12:43 -0400)]
pan/bi: Fuse abs into FCMP/FMIN/FMAX.v2f16
Needs to be aware of an encoding restriction here.
No shader-db changes.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
Alyssa Rosenzweig [Fri, 11 Jun 2021 16:43:21 +0000 (12:43 -0400)]
pan/bi: Schedule FCMP.v2f16 with abs modifier
So many encoding restrictions, because Bifrost.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
Alyssa Rosenzweig [Fri, 11 Jun 2021 00:37:35 +0000 (20:37 -0400)]
pan/bi: Fuse fclamp_pos and fsat_signed
Mostly interesting now that we fuse clamps.
total instructions in shared programs: 149562 -> 148927 (-0.42%)
instructions in affected programs: 37195 -> 36560 (-1.71%)
helped: 233
HURT: 0
helped stats (abs) min: 1 max: 10 x̄: 2.73 x̃: 2
helped stats (rel) min: 0.22% max: 17.39% x̄: 2.19% x̃: 1.72%
95% mean confidence interval for instructions value: -2.97 -2.48
95% mean confidence interval for instructions %-change: -2.44% -1.94%
Instructions are helped.
total tuples in shared programs: 130487 -> 130122 (-0.28%)
tuples in affected programs: 25693 -> 25328 (-1.42%)
helped: 179
HURT: 12
helped stats (abs) min: 1 max: 10 x̄: 2.11 x̃: 2
helped stats (rel) min: 0.26% max: 25.00% x̄: 2.52% x̃: 1.70%
HURT stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel) min: 0.61% max: 0.68% x̄: 0.65% x̃: 0.66%
95% mean confidence interval for tuples value: -2.15 -1.68
95% mean confidence interval for tuples %-change: -2.74% -1.91%
Tuples are helped.
total clauses in shared programs: 27827 -> 27761 (-0.24%)
clauses in affected programs: 1407 -> 1341 (-4.69%)
helped: 56
HURT: 0
helped stats (abs) min: 1 max: 4 x̄: 1.18 x̃: 1
helped stats (rel) min: 1.79% max: 14.29% x̄: 6.11% x̃: 5.26%
95% mean confidence interval for clauses value: -1.32 -1.03
95% mean confidence interval for clauses %-change: -7.00% -5.23%
Clauses are helped.
total quadwords in shared programs: 118563 -> 118248 (-0.27%)
quadwords in affected programs: 19859 -> 19544 (-1.59%)
helped: 144
HURT: 16
helped stats (abs) min: 1 max: 10 x̄: 2.30 x̃: 2
helped stats (rel) min: 0.29% max: 16.00% x̄: 2.65% x̃: 2.13%
HURT stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel) min: 0.47% max: 2.00% x̄: 0.80% x̃: 0.76%
95% mean confidence interval for quadwords value: -2.27 -1.66
95% mean confidence interval for quadwords %-change: -2.67% -1.93%
Quadwords are helped.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
Alyssa Rosenzweig [Fri, 11 Jun 2021 00:21:28 +0000 (20:21 -0400)]
pan/bi: Add back custom algebraic opts
Right now just do a trivial one to test the infrastructure. In the next
commit we'll use this for a more interesting optimization that's a bit
painful in BIR but trivial with nir_search.
total instructions in shared programs: 149566 -> 149562 (<.01%)
instructions in affected programs: 502 -> 498 (-0.80%)
helped: 3
HURT: 0
helped stats (abs) min: 1 max: 2 x̄: 1.33 x̃: 1
helped stats (rel) min: 0.38% max: 1.30% x̄: 0.97% x̃: 1.21%
total tuples in shared programs: 130957 -> 130487 (-0.36%)
tuples in affected programs: 54752 -> 54282 (-0.86%)
helped: 303
HURT: 2
helped stats (abs) min: 1 max: 29 x̄: 1.56 x̃: 1
helped stats (rel) min: 0.13% max: 7.14% x̄: 1.08% x̃: 0.92%
HURT stats (abs) min: 1 max: 2 x̄: 1.50 x̃: 1
HURT stats (rel) min: 1.89% max: 2.99% x̄: 2.44% x̃: 2.44%
95% mean confidence interval for tuples value: -1.79 -1.30
95% mean confidence interval for tuples %-change: -1.17% -0.95%
Tuples are helped.
total clauses in shared programs: 27877 -> 27827 (-0.18%)
clauses in affected programs: 1556 -> 1506 (-3.21%)
helped: 45
HURT: 0
helped stats (abs) min: 1 max: 2 x̄: 1.11 x̃: 1
helped stats (rel) min: 1.43% max: 9.52% x̄: 3.88% x̃: 3.57%
95% mean confidence interval for clauses value: -1.21 -1.02
95% mean confidence interval for clauses %-change: -4.38% -3.39%
Clauses are helped.
total quadwords in shared programs: 119058 -> 118563 (-0.42%)
quadwords in affected programs: 33777 -> 33282 (-1.47%)
helped: 250
HURT: 2
helped stats (abs) min: 1 max: 29 x̄: 1.99 x̃: 1
helped stats (rel) min: 0.23% max: 11.11% x̄: 1.67% x̃: 1.40%
HURT stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel) min: 1.64% max: 2.00% x̄: 1.82% x̃: 1.82%
95% mean confidence interval for quadwords value: -2.27 -1.66
95% mean confidence interval for quadwords %-change: -1.80% -1.49%
Quadwords are helped.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
Alyssa Rosenzweig [Thu, 10 Jun 2021 23:05:29 +0000 (19:05 -0400)]
pan/bi: Propagate fabs/neg/sat
Initial support for modifier propagation. Bifrost makes this
unreasonably hard.
total instructions in shared programs: 151604 -> 150761 (-0.56%)
instructions in affected programs: 48773 -> 47930 (-1.73%)
helped: 212
HURT: 0
helped stats (abs) min: 1 max: 28 x̄: 3.98 x̃: 1
helped stats (rel) min: 0.29% max: 12.70% x̄: 1.75% x̃: 1.26%
95% mean confidence interval for instructions value: -4.71 -3.25
95% mean confidence interval for instructions %-change: -1.97% -1.53%
Instructions are helped.
total tuples in shared programs: 131876 -> 131560 (-0.24%)
tuples in affected programs: 25393 -> 25077 (-1.24%)
helped: 104
HURT: 3
helped stats (abs) min: 1 max: 28 x̄: 3.08 x̃: 2
helped stats (rel) min: 0.34% max: 8.57% x̄: 1.55% x̃: 1.04%
HURT stats (abs) min: 1 max: 2 x̄: 1.33 x̃: 1
HURT stats (rel) min: 0.51% max: 2.86% x̄: 1.30% x̃: 0.53%
95% mean confidence interval for tuples value: -3.63 -2.28
95% mean confidence interval for tuples %-change: -1.73% -1.21%
Tuples are helped.
total clauses in shared programs: 28122 -> 28032 (-0.32%)
clauses in affected programs: 2720 -> 2630 (-3.31%)
helped: 58
HURT: 1
helped stats (abs) min: 1 max: 6 x̄: 1.57 x̃: 1
helped stats (rel) min: 0.88% max: 14.29% x̄: 4.06% x̃: 3.67%
HURT stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
HURT stats (rel) min: 7.69% max: 7.69% x̄: 7.69% x̃: 7.69%
95% mean confidence interval for clauses value: -1.85 -1.20
95% mean confidence interval for clauses %-change: -4.60% -3.13%
Clauses are helped.
total quadwords in shared programs: 119778 -> 119509 (-0.22%)
quadwords in affected programs: 20698 -> 20429 (-1.30%)
helped: 95
HURT: 1
helped stats (abs) min: 1 max: 28 x̄: 2.85 x̃: 2
helped stats (rel) min: 0.38% max: 7.14% x̄: 1.50% x̃: 1.13%
HURT stats (abs) min: 2 max: 2 x̄: 2.00 x̃: 2
HURT stats (rel) min: 3.23% max: 3.23% x̄: 3.23% x̃: 3.23%
95% mean confidence interval for quadwords value: -3.49 -2.11
95% mean confidence interval for quadwords %-change: -1.71% -1.20%
Quadwords are helped.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
Alyssa Rosenzweig [Thu, 10 Jun 2021 23:28:05 +0000 (19:28 -0400)]
pan/bi: Report tuples, not nops, in shader-db
More useful in practice, I find.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
Alyssa Rosenzweig [Fri, 11 Jun 2021 00:37:12 +0000 (20:37 -0400)]
pan/bi: Handle fsat_signed and fclamp_pos
Translates to Mali-specific clamps.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
Alyssa Rosenzweig [Fri, 11 Jun 2021 00:08:18 +0000 (20:08 -0400)]
pan/bi: Track instruction size in opcode table
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
Alyssa Rosenzweig [Fri, 11 Jun 2021 00:07:50 +0000 (20:07 -0400)]
pan/bi: Move typesize to common code
Useful for the opcode table.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
Alyssa Rosenzweig [Thu, 10 Jun 2021 23:05:14 +0000 (19:05 -0400)]
pan/bi: Move bi_word_node to common code
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
Alyssa Rosenzweig [Fri, 5 Mar 2021 23:10:39 +0000 (23:10 +0000)]
pan/bi: Include modifier info in opcode table
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11327>
Ian Romanick [Mon, 7 Jun 2021 20:06:22 +0000 (13:06 -0700)]
util: Consider CPU affinity when detecting number of CPUs
A similar path can be used on at least FreeBSD using cpuset_getaffinity.
This is how Ninja determines the number of available CPUs on that
platform. See the GetProcessorCount function in util.cc:
https://github.com/ninja-build/ninja/blob/master/src/util.cc
v2: Fix counting the number of available CPUs. The CPU_COUNT API does
not work the way I thought it did. :face_palm: Noticed by Marek.
Reviewed-by: Adam Jackson <ajax@redhat.com> [v1]
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> [v1]
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11228>
Ian Romanick [Wed, 9 Jun 2021 16:24:45 +0000 (09:24 -0700)]
util: Use maximum number of CPUs for determining cache topology
This prevents problems when some CPUs are offline. In a four CPU
system, if CPUs 1 and 2 are offline, the cache topology code would
only examine CPUs 0 and 1... giving incorrect information.
The types are changed to int16_t so that the offset of num_L3_caches
does not change. This triggered a STATIC_ASSERT failure:
STATIC_ASSERT(offsetof(struct util_cpu_caps_t, num_L3_caches) == 5 * sizeof(uint32_t));
I'm assuming there's some assembly code or something that depends on
this offset, and I don't feel like messing with it.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11228>
Ian Romanick [Tue, 8 Jun 2021 23:36:32 +0000 (16:36 -0700)]
util: Set util_cpu_caps.num_cpu_mask_bits based on total CPUs in the system
In the current code, this prevents a very unlikely corner case. More
importantly, it should prevent the next commit from breaking the
universe.
Imagine a system with 64 CPUs configured, but first 32 CPUs are offline.
_SC_NPROCESSORS_CONF will return 32. All of the surrounding code will
interpret this as meaning CPUs 0 through 31, but all of those CPUs are
offline. Nothing good can happen then.
The problem cases require systems with more than 32 CPUs because
util_cpu_caps.num_cpu_mask_bits is always rounded up to a multiple of
32.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11228>
Ian Romanick [Tue, 8 Jun 2021 22:39:20 +0000 (15:39 -0700)]
util: Fix setting nr_cpus on some BSD variants
Linux, FreeBSD, and DragonFly should have _SC_NOPROCESSORS_ONLN. NetBSD
and OpenBSD should have HW_NCPUONLINE. This is what FFmpeg uses on
those platforms.
FreeBSD sysconf(3) manual page:
https://www.freebsd.org/cgi/man.cgi?query=sysconf&sektion=3&apropos=0&manpath=freebsd
The FFmpeg patch is at:
https://patchwork.ffmpeg.org/project/ffmpeg/patch/YGi4sJx3trG3Yn7c@humpty.home.comstyle.com/
OpenBSD sysctl(2) manual page:
https://man.openbsd.org/sysctl.2
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11228>
Ian Romanick [Tue, 8 Jun 2021 22:33:39 +0000 (15:33 -0700)]
util: Trivial cleanup in the BSD code of util_cpu_detect_once
This code is going to be replicated in future commits, so tidy up a bit
first.
Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11228>