platform/upstream/mesa.git
3 years agoamd/llvm: fix C++ compile failures
Marek Olšák [Wed, 26 Aug 2020 02:29:15 +0000 (22:29 -0400)]
amd/llvm: fix C++ compile failures

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

3 years agogallium/util: allow including a few files in C++
Marek Olšák [Wed, 26 Aug 2020 02:49:31 +0000 (22:49 -0400)]
gallium/util: allow including a few files in C++

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

3 years agocompiler: fix glsl_types.h compile failures when including as C++ in drivers
Marek Olšák [Wed, 26 Aug 2020 02:28:23 +0000 (22:28 -0400)]
compiler: fix glsl_types.h compile failures when including as C++ in drivers

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

3 years agoac/llvm: handle no_(un)signed_wrap NIR flags
Marek Olšák [Wed, 9 Dec 2020 00:25:51 +0000 (19:25 -0500)]
ac/llvm: handle no_(un)signed_wrap NIR flags

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7939>

3 years agoac: unify shader arguments that are duplicated
Marek Olšák [Tue, 8 Dec 2020 23:51:57 +0000 (18:51 -0500)]
ac: unify shader arguments that are duplicated

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7939>

3 years agoradeonsi: move si_llvm_compiler_shader and deps into si_shader_llvm.c
Marek Olšák [Fri, 4 Dec 2020 17:34:55 +0000 (12:34 -0500)]
radeonsi: move si_llvm_compiler_shader and deps into si_shader_llvm.c

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

3 years agoradeonsi: move si_build_main_function into si_shader_llvm.c
Marek Olšák [Fri, 4 Dec 2020 17:17:45 +0000 (12:17 -0500)]
radeonsi: move si_build_main_function into si_shader_llvm.c

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

3 years agoradeonsi: move si_create_function into si_shader_llvm.c
Marek Olšák [Fri, 4 Dec 2020 17:17:45 +0000 (12:17 -0500)]
radeonsi: move si_create_function into si_shader_llvm.c

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

3 years agoradeonsi: split ac_shader_args initialization from LLVM code
Marek Olšák [Fri, 4 Dec 2020 16:22:14 +0000 (11:22 -0500)]
radeonsi: split ac_shader_args initialization from LLVM code

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

3 years agoac: add shader return values into ac_shader_args
Marek Olšák [Fri, 4 Dec 2020 16:19:16 +0000 (11:19 -0500)]
ac: add shader return values into ac_shader_args

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7939>

3 years agoac: correct ac_shader_args types, remove sgpr_count
Marek Olšák [Fri, 4 Dec 2020 16:17:58 +0000 (11:17 -0500)]
ac: correct ac_shader_args types, remove sgpr_count

sgpr_count is unused. The size of the others is too small.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7939>

3 years agoradeonsi: fix a crash in si_fence_server_sync
Marek Olšák [Wed, 9 Dec 2020 19:41:13 +0000 (14:41 -0500)]
radeonsi: fix a crash in si_fence_server_sync

Fixes: 1f31a216640 - radeonsi: remove SDMA support

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

3 years agoaco: rename s_subb_u32 operands to borrow
Rhys Perry [Wed, 9 Dec 2020 15:40:40 +0000 (15:40 +0000)]
aco: rename s_subb_u32 operands to borrow

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8007>

3 years agoaco: fix various s_subb_u32 operands to SCC
Rhys Perry [Wed, 9 Dec 2020 15:28:46 +0000 (15:28 +0000)]
aco: fix various s_subb_u32 operands to SCC

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8007>

3 years agov3d: use job's nr_cbufs field
Juan A. Suarez Romero [Wed, 9 Dec 2020 13:41:32 +0000 (14:41 +0100)]
v3d: use job's nr_cbufs field

Instead of computing the number of color buffers in the start binning
function, just use the job's nr_cbufs, which already contains that
value.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8006>

3 years agopanfrost: Fix provoking vertex selection for lines
Boris Brezillon [Tue, 1 Dec 2020 08:18:18 +0000 (09:18 +0100)]
panfrost: Fix provoking vertex selection for lines

For line primitives, the provoking vertex selection is done through the
DRAW.flat_shading_vertex field and PRIMITIVE.first_provoking_vertex must
be set to true.

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

3 years agopanfrost: Preload SampleID when reloading multisample FBs
Boris Brezillon [Mon, 30 Nov 2020 13:38:30 +0000 (14:38 +0100)]
panfrost: Preload SampleID when reloading multisample FBs

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

3 years agopanfrost: Take the number of samples into account in blend shaders
Boris Brezillon [Tue, 8 Dec 2020 10:42:15 +0000 (11:42 +0100)]
panfrost: Take the number of samples into account in blend shaders

Midgard has to split the writeout instruction if the number of bits per
pixel exceeds 128. We thus need to take the number of samples into
account when creating blend shaders.

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

3 years agopan/mdg: Add support for multi sample iteration writeout
Boris Brezillon [Tue, 8 Dec 2020 10:38:50 +0000 (11:38 +0100)]
pan/mdg: Add support for multi sample iteration writeout

Some MSAA+fmt combination require writeout to be split. Right now, it
only impacts blend shaders since we only support MSAA 4x, and the only
formats that could exceed the 128bit/pixel limit in MSAA 4x are
not supported by the fixed-function blend unit. We thus rely on the
blend shader to split things properly. Things will change once we add
MSAA 8x/16x to the mix, since even the blendable formats will exceed
the 128b/pixel limit in that case.

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

3 years agopanfrost: Fix fencing
Boris Brezillon [Mon, 30 Nov 2020 10:07:33 +0000 (11:07 +0100)]
panfrost: Fix fencing

Commit 64d6f56ad26f ("panfrost: Allocate syncobjs in panfrost_flush")
aimed at optimizing the fencing logic but it looks it also broke the
fence-based synchronization in subtle ways.

Indeed, now that the fence only waits on a single syncobj, we're not
guaranteed that all jobs queued in panfrost_flush_all_batches() will
be done when the fence is signaled, because jobs at the top level
(those stored in the batches hashmap) have not inter-dependencies.

Commit 9e397956b092 ("panfrost: signal syncobj if nothing is going to
be flushed") made this even more apparent by signaling the fence right
away if nothing was left to be drawn in the current context, thus
ignoring any of the batches left to flushed in the ->batches map.

If we want to keep relying the existing kernel APIs there's clearly no
ideal solution here. We can either go back to the original fencing
mechanism where each fence contained an array of syncobjs to be tested
or serialize jobs that have no explicit dependencies so we know the last
submitted job will also be the last one to return. The orginal approach
has proven to add quite a significant overhead (caused by the amount of
ioctls and the time spent in kernel space to gather dma fences attached
to those syncobjs and test them). So let's go for the simple solution
where we have a single syncobj bound to the context which we update to
point to the last job out_sync every time we submit a top-level job.

This approach implies reworking the way we create fences since we
need to capture the syncobj state at the time the fence is created.
Unfortunately, there's not SYNCOBJ_CLONE ioctl, which forces us to
export/create/import a fence so we have a new object that's not
subject to changes done to the context syncobj.

If we want to further optimize the logic, we should probably explore
some of those options:

1/ Adding array based SYNCOBJ ioctls (SYNCOBJ_{CREATE,DESTROY,CLONE}_ARRAY)
   so we can mitigate the cost of ioctls when we need to manipulate
   arrays of syncobjs
2/ Support synchronization jobs. That is, jobs that have a NULL job chain
   but an array of sync_in and a sync_out to allow creating
   synchronization points
3/ Add syncobj aggregators so we only have to wait on one syncobj from
   userspace. The syncobj aggregator would wait for all sub syncobjs to
   be signaled before signaling the top-level one.

Fixes: 64d6f56ad26f ("panfrost: Allocate syncobjs in panfrost_flush")
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/7831>

3 years agopanfrost: Make sure we always add a reader -> write dependency when needed
Boris Brezillon [Mon, 30 Nov 2020 09:23:32 +0000 (10:23 +0100)]
panfrost: Make sure we always add a reader -> write dependency when needed

We shouldn't reset the ->writer field when a reader comes in because we
want subsequent readers to have a dependency on the writer too. Let's
add a new field encoding the last access type and use it to replace the
writer != NULL test.

Reported-by: Roman Elshin
Fixes: c6ebff3ecdde ("panfrost: Remove panfrost_bo_access type")
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/7831>

3 years agost/mesa: enable compute shader derivatives in SPIR-V
Marek Olšák [Mon, 21 Sep 2020 13:08:31 +0000 (09:08 -0400)]
st/mesa: enable compute shader derivatives in SPIR-V

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

3 years agoac,radeonsi: implement GL_NV_compute_shader_derivatives
Marek Olšák [Mon, 21 Sep 2020 11:54:12 +0000 (07:54 -0400)]
ac,radeonsi: implement GL_NV_compute_shader_derivatives

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

3 years agowinsys/amdgpu: use VRAM for command buffers if all VRAM is visible
Marek Olšák [Tue, 8 Dec 2020 19:43:07 +0000 (14:43 -0500)]
winsys/amdgpu: use VRAM for command buffers if all VRAM is visible

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

3 years agoradeonsi: map PIPE_USAGE_STREAM to VRAM if all VRAM is visible
Marek Olšák [Sun, 6 Dec 2020 19:49:28 +0000 (14:49 -0500)]
radeonsi: map PIPE_USAGE_STREAM to VRAM if all VRAM is visible

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

3 years agoradeonsi: unify uploaders and upload to VRAM if all VRAM is visible
Marek Olšák [Sun, 6 Dec 2020 19:46:20 +0000 (14:46 -0500)]
radeonsi: unify uploaders and upload to VRAM if all VRAM is visible

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

3 years agoradeonsi: only use staging for linear textures when all VRAM is not visible
Marek Olšák [Sun, 6 Dec 2020 19:03:46 +0000 (14:03 -0500)]
radeonsi: only use staging for linear textures when all VRAM is not visible

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

3 years agoradeons: only force staging uploads for VRAM when all VRAM is not visible
Marek Olšák [Sun, 6 Dec 2020 19:01:15 +0000 (14:01 -0500)]
radeons: only force staging uploads for VRAM when all VRAM is not visible

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

3 years agoac: add radeon_info::all_vram_visible for Smart Access Memory
Marek Olšák [Sun, 6 Dec 2020 18:59:53 +0000 (13:59 -0500)]
ac: add radeon_info::all_vram_visible for Smart Access Memory

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

3 years agoradeonsi: initialize ctx and gfx_cs first, then allocators
Marek Olšák [Sun, 6 Dec 2020 18:49:21 +0000 (13:49 -0500)]
radeonsi: initialize ctx and gfx_cs first, then allocators

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

3 years agocompiler: update gl_access_qualifier comments
Rhys Perry [Tue, 1 Dec 2020 14:24:53 +0000 (14:24 +0000)]
compiler: update gl_access_qualifier comments

Clarify ACCESS_NON_{READABLE,WRITEABLE} and update ACCESS_CAN_REORDER.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>

3 years agonir/opt_access: infer writeonly
Rhys Perry [Tue, 25 Aug 2020 16:36:14 +0000 (17:36 +0100)]
nir/opt_access: infer writeonly

This isn't always done for GL because it could cause ImageAccess to be
incorrect: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3278

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>

3 years agonir/opt_access: consider global stores
Rhys Perry [Tue, 25 Aug 2020 15:35:44 +0000 (16:35 +0100)]
nir/opt_access: consider global stores

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>

3 years agonir/opt_access: handle variable pointers
Rhys Perry [Tue, 25 Aug 2020 15:50:24 +0000 (16:50 +0100)]
nir/opt_access: handle variable pointers

We might not be able to determine what variable a instruction accesses.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>

3 years agonir/opt_access: add basic Vulkan support
Rhys Perry [Tue, 25 Aug 2020 16:03:03 +0000 (17:03 +0100)]
nir/opt_access: add basic Vulkan support

This involves determining the variables referenced by intrinsics, setting and
using the access qualifier correctly and considering that images and buffers
can alias.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>

3 years agonir/opt_access: rename can_reorder() and set ACCESS_NON_WRITEABLE in it
Rhys Perry [Tue, 25 Aug 2020 13:30:52 +0000 (14:30 +0100)]
nir/opt_access: rename can_reorder() and set ACCESS_NON_WRITEABLE in it

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>

3 years agonir/opt_access: don't check restrict in can_reorder()
Rhys Perry [Tue, 1 Dec 2020 14:38:32 +0000 (14:38 +0000)]
nir/opt_access: don't check restrict in can_reorder()

ACCESS_NON_WRITEABLE means that the memory is read-only, not the variable,
so we don't have to check for aliasing.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>

3 years agonir/opt_access: check restrict before marking a variable as readonly
Rhys Perry [Tue, 1 Dec 2020 14:34:48 +0000 (14:34 +0000)]
nir/opt_access: check restrict before marking a variable as readonly

ACCESS_NON_WRITEABLE means that the memory is read-only, not the variable,
so we have to check for aliasing first.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>

3 years agonir/opt_access: ignore barriers and coherent qualifier
Rhys Perry [Tue, 1 Dec 2020 14:30:22 +0000 (14:30 +0000)]
nir/opt_access: ignore barriers and coherent qualifier

It shouldn't matter whether an access/variable is coherent or not, just
that it's not written. The coherent qualifier doesn't mean anything with
read-only memory.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>

3 years agonir/opt_access: don't ignore image arrays in process_variable()
Rhys Perry [Tue, 1 Dec 2020 14:26:40 +0000 (14:26 +0000)]
nir/opt_access: don't ignore image arrays in process_variable()

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6483>

3 years agoiris: update depth value for stages after fast clear depth
Andrii Simiklit [Mon, 30 Nov 2020 18:15:10 +0000 (20:15 +0200)]
iris: update depth value for stages after fast clear depth

This should fix an outdated depth value visible from the shader side.

v1: (Nanley Chery)
- fix commit message

v2: (Nanley Chery)
- replace `fixes` tag by `mesa-stable`

Closes: #3883
Cc: 20.3 20.2 <mesa-stable>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Signed-off-by: Andrii Simiklit <andrii.simiklit@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7838>

3 years agov3d: remove old tile blit code
Juan A. Suarez Romero [Tue, 1 Dec 2020 08:45:39 +0000 (09:45 +0100)]
v3d: remove old tile blit code

This code was a direct copy from VC4, and it was disabled, as it did not
work.

Now that we have an implementation, let's remove it.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7816>

3 years agov3d: implement tile-based blit operation
Juan A. Suarez Romero [Tue, 1 Dec 2020 08:39:52 +0000 (09:39 +0100)]
v3d: implement tile-based blit operation

This implements fast-path blit using the TLB to blit from one buffer to
another, if conditions for allowing this are met.

v1:
 - Move checks in the code (Iago)

v2:
 - Use function to compute tile width and height (Iago)
 - Fix commit message (Iago)
 - Use surface size to compute draw_tiles_{x,y} (Iago)
 - Move checks (Iago)
 - Fix tile draw parameters (Iago)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7816>

3 years agov3d: refactor set tile buffer size function
Juan A. Suarez Romero [Thu, 3 Dec 2020 10:32:40 +0000 (11:32 +0100)]
v3d: refactor set tile buffer size function

Change it to not require a v3d job to compute the tile buffer
parameters.

v1:
 - Pass nr_cbufs parameter to get tile buffer size function (Iago)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7816>

3 years agov3d: implement tile buffer blits
Juan A. Suarez Romero [Fri, 27 Nov 2020 13:23:43 +0000 (14:23 +0100)]
v3d: implement tile buffer blits

This implements blit operation using the TLB.

It uses a source color buffer (bbuf) which will be blitted to color
buffer 0.

It also takes in account the number of samples for the input and output
so it can perform multisample resolve.

v1:
 - Fix comment (Iago)
 - Removed needless brackets (Iago)
 - Ensure msaa is correctly set (Iago)
 - Get rid of job->resolve (Iago)
 - Add rbuf as part of job's key (Iago)
 - Rename rbuf/rsurf by bbuf/bsurf (Iago)
 - Revert needless change (Iago)

v2:
 - Remove spurious change (Iago)
 - Add assert for safety reasons (Iago)
 - Add brackets in condition (Iago)
 - Fix commit message and title (Iago)
 - Do tile blit only for version >=4.0 (Iago)

v3:
 - Add assertion (Iago)
 - Fix comment (Iago)
 - Change commit title (Iago)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7816>

3 years agov3d: add helper to check if format supports TLB resolve
Juan A. Suarez Romero [Fri, 27 Nov 2020 13:17:59 +0000 (14:17 +0100)]
v3d: add helper to check if format supports TLB resolve

It checks if the TLB can perform multisample resolve for the specified
format.

v1:
 - Fix commit title (Iago)

v2:
 - Fix identation (Iago)
 - Fix prototype style (Iago)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7816>

3 years agov3d: split binning start from draw
Juan A. Suarez Romero [Fri, 27 Nov 2020 13:14:00 +0000 (14:14 +0100)]
v3d: split binning start from draw

Separate the binning part in the draw and make it public, so we can
invoke it later from a different part.

v1:
 - Ensure the job needs flush (Iago)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7816>

3 years agov3d: store number of color buffers in job
Juan A. Suarez Romero [Wed, 2 Dec 2020 12:53:17 +0000 (13:53 +0100)]
v3d: store number of color buffers in job

Avoids requiring to calculate in other places.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7816>

3 years agov3d: make set tile buffer size function public
Juan A. Suarez Romero [Fri, 27 Nov 2020 13:10:18 +0000 (14:10 +0100)]
v3d: make set tile buffer size function public

This will be used later when implementing Tile-based blit function.

v1:
 - Fix commit title (Iago)

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7816>

3 years agov3d: force alpha to 1 when rendering RGBX formats
Juan A. Suarez Romero [Fri, 27 Nov 2020 12:07:43 +0000 (13:07 +0100)]
v3d: force alpha to 1 when rendering RGBX formats

This adds an enum to the load tile buffer that forces the alpha channel
to be set to 1. This will be required later to load RGBX formats.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7816>

3 years agoutil: function to check for rgbX format
Juan A. Suarez Romero [Fri, 27 Nov 2020 12:03:16 +0000 (13:03 +0100)]
util: function to check for rgbX format

Function that checks if the format has its alpha component forced to 1.

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7816>

3 years agointel/tools/aubinator_error_decode: fix small memory leaks
Marcin Ślusarz [Tue, 8 Dec 2020 18:38:01 +0000 (19:38 +0100)]
intel/tools/aubinator_error_decode: fix small memory leaks

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7994>

3 years agointel/tools/aubinator_error_decode: cleanup path/file handling
Marcin Ślusarz [Tue, 8 Dec 2020 18:27:43 +0000 (19:27 +0100)]
intel/tools/aubinator_error_decode: cleanup path/file handling

Should help some compilers/static analyzers understand this code and avoid
things like this:

../src/intel/tools/aubinator_error_decode.c:850:19: warning: "path" may be used uninitialized in this function [-Wmaybe-uninitialized]
  850 |             ret = asprintf(&filename, "%s/%d/i915_error_state", path, minor);

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7994>

3 years agor600/sfn: Initialize ShaderInputVarying members in constructors.
Vinson Lee [Thu, 3 Dec 2020 23:12:07 +0000 (15:12 -0800)]
r600/sfn: Initialize ShaderInputVarying members in constructors.

Fix defects reported by Coverity Scan.

uninit_member: Non-static class member m_interpolate is not initialized in this constructor nor in any functions that it calls.
uninit_member: Non-static class member m_lds_pos is not initialized in this constructor nor in any functions that it calls.
uninit_member: Non-static class member m_mask is not initialized in this constructor nor in any functions that it calls.

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

3 years agomeson: Fix build with llvm-12.
Vinson Lee [Wed, 25 Nov 2020 21:18:03 +0000 (13:18 -0800)]
meson: Fix build with llvm-12.

This patch fixes this Meson build error.

$ meson builddir \
-Dshared-llvm=disabled
-Ddri-drivers=''
-Dbuild-tests=true \
-Dgallium-drivers=swrast \
-Dvulkan-drivers=''
[...]
/usr/bin/ld: src/gallium/auxiliary/libgallium.a(gallivm_lp_bld_misc.cpp.o): in function `llvm::InitializeNativeTarget()':
llvm/Support/TargetSelect.h:118: undefined reference to `LLVMInitializeX86TargetInfo'
/usr/bin/ld: llvm/Support/TargetSelect.h:119: undefined reference to `LLVMInitializeX86Target'
/usr/bin/ld: llvm/Support/TargetSelect.h:120: undefined reference to `LLVMInitializeX86TargetMC'
/usr/bin/ld: src/gallium/auxiliary/libgallium.a(gallivm_lp_bld_misc.cpp.o): in function `llvm::InitializeNativeTargetAsmPrinter()':
llvm/Support/TargetSelect.h:132: undefined reference to `LLVMInitializeX86AsmPrinter'
/usr/bin/ld: src/gallium/auxiliary/libgallium.a(gallivm_lp_bld_misc.cpp.o): in function `llvm::InitializeNativeTargetDisassembler()':
llvm/Support/TargetSelect.h:156: undefined reference to `LLVMInitializeX86Disassembler'

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7777>

3 years agoci/vc4: Skip VS dynamic loops tests that cause GPU hangs.
Eric Anholt [Tue, 8 Dec 2020 23:18:34 +0000 (15:18 -0800)]
ci/vc4: Skip VS dynamic loops tests that cause GPU hangs.

We've been getting spurious failures from the new VC4 CI, which I believe
are due to this set of tests (which have been showing up along with a GPU
hang report in the list of flaky tests in the failing jobs).  This was a
known issue I had in vc4.

Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7998>

3 years agoradeonsi: fix the blit test for SW_64KB_R_X
Marek Olšák [Tue, 8 Dec 2020 21:58:29 +0000 (16:58 -0500)]
radeonsi: fix the blit test for SW_64KB_R_X

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

3 years agoradeonsi: rename SI_TEST_DMA to SI_TEST_BLIT
Marek Olšák [Tue, 8 Dec 2020 21:50:03 +0000 (16:50 -0500)]
radeonsi: rename SI_TEST_DMA to SI_TEST_BLIT

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

3 years agoradeonsi: remove SDMA support
Marek Olšák [Thu, 3 Dec 2020 22:57:45 +0000 (17:57 -0500)]
radeonsi: remove SDMA support

There are many issues with SDMA across many generations of hardware.
A recent example is that gfx10.3 suffers from random GPU hangs if
userspace uses SDMA.

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

3 years agoradeonsi: rename buffer functions so as not to reference rings
Marek Olšák [Thu, 3 Dec 2020 23:01:11 +0000 (18:01 -0500)]
radeonsi: rename buffer functions so as not to reference rings

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

3 years agoradeonsi: move si_screen_clear_buffer into si_compute_blit.c w/o SDMA option
Marek Olšák [Thu, 3 Dec 2020 22:10:06 +0000 (17:10 -0500)]
radeonsi: move si_screen_clear_buffer into si_compute_blit.c w/o SDMA option

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

3 years agoci/freedreno: Detect the cheza power management bus error and restart.
Eric Anholt [Tue, 8 Dec 2020 18:29:06 +0000 (10:29 -0800)]
ci/freedreno: Detect the cheza power management bus error and restart.

This is an issue on the cheza platform, the theory is due to some old
firmware bug that will be fixed in future platforms.  Given that cheza was
a target that didn't get released and we expect future platforms to be
fixed, just detect the issue and restart.

I've noticed this error in my CI monitoring less than once a week.

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

3 years agoandroid: spirv: fix '::' typo in gen rules
Mauro Rossi [Mon, 7 Dec 2020 22:26:30 +0000 (23:26 +0100)]
android: spirv: fix '::' typo in gen rules

among all Android gen rules '::' was used only here to declare dependencies;
mesa development and stable branch are worth receiving the fix

Fixes the following building errors with Android 7:

obj/STATIC_LIBRARIES/libmesa_nir_intermediates/spirv/gl_spirv.P:184: *** target file
gen/STATIC_LIBRARIES/libmesa_nir_intermediates/spirv/vtn_generator_ids.h' has both : and :: entries.  Stop.

Cc: "20.3" <mesa-stable@lists.freedesktop.org>
Fixes: 1070bba19e26 ("android: fix SPIR-V -> NIR build")
Reported-by: youling257 <youling257@gmail.com>
3 years agomesa/st: set reserved storage for params+values to 16
Mike Blumenkrantz [Sat, 5 Dec 2020 16:42:54 +0000 (11:42 -0500)]
mesa/st: set reserved storage for params+values to 16

zink apparently has a lot of uniform data, and 8x8 isn't enough to avoid realloc

fixes mesa/mesa#3930

Fixes: eda37fb2 ("mesa: properly disallow param list reallocation")

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

3 years agomeson: fix multiline string warning
Michel Zou [Sun, 6 Dec 2020 11:35:42 +0000 (12:35 +0100)]
meson: fix multiline string warning

gets rid of: WARNING: Newline character in a string detected, use '''
(three single quotes) for multiline strings instead.

Reviewed-by: Yevhenii Kharchenko <yevhenii.kharchenko@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7946>

3 years agoutil: Add cnd_monotonic to Makefile.sources
Ian Romanick [Tue, 8 Dec 2020 03:39:57 +0000 (19:39 -0800)]
util: Add cnd_monotonic to Makefile.sources

Fixes: 33a78948283 ("util,radv: Cross-platform monotonic condition variable")
Acked-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7980>

3 years agomesa: remove MAX_3D_TEXTURE_LEVELS, MAX_CUBE_TEXTURE_LEVELS
Marek Olšák [Sat, 5 Dec 2020 17:20:07 +0000 (12:20 -0500)]
mesa: remove MAX_3D_TEXTURE_LEVELS, MAX_CUBE_TEXTURE_LEVELS

they are redundant with MAX_TEXTURE_LEVELS

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7956>

3 years agomesa: remove code for old (mostly unsupported) GL_NV_point_sprite
Marek Olšák [Sat, 5 Dec 2020 17:03:42 +0000 (12:03 -0500)]
mesa: remove code for old (mostly unsupported) GL_NV_point_sprite

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7956>

3 years agomesa: fix glPopAttrib for GL_COORD_REPLACE for r200
Marek Olšák [Sat, 5 Dec 2020 16:47:50 +0000 (11:47 -0500)]
mesa: fix glPopAttrib for GL_COORD_REPLACE for r200

Fixes: 959380dc "mesa: more optimizations in glPopAttrib (colormask, drawbuffers, coord replace)"

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7956>

3 years agoturnip: always set LRZ registers to zero for 3d clear/blit
Jonathan Marek [Thu, 3 Dec 2020 05:05:37 +0000 (00:05 -0500)]
turnip: always set LRZ registers to zero for 3d clear/blit

Apparently LRZ will be read/written regardless of depth being enabled or
not, so we have to make sure these registers are zero.

Fixes: 1d83f5ae8435 ("turnip: disable LRZ on vkCmdClearattachments() 3D fallback path")

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>

3 years agoturnip: move up LRZ invalidate in CmdClearAttachments
Jonathan Marek [Thu, 3 Dec 2020 05:03:14 +0000 (00:03 -0500)]
turnip: move up LRZ invalidate in CmdClearAttachments

There is an early return if cmd->state.predication_active is true, so do
the LRZ invalidate before that.

Fixes: 2f79e0066405 ("turnip: disable LRZ on vkCmdClearAttachments()")

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>

3 years agoturnip: do not emit draw states in draw_cs outside of renderpass
Jonathan Marek [Thu, 3 Dec 2020 04:59:24 +0000 (23:59 -0500)]
turnip: do not emit draw states in draw_cs outside of renderpass

This avoids a possible issue with MSAA sysmem clears, which use a 3D clear
path which assumes draw states are disabled, and are emitted in draw_cs in
BeginRenderPass.

(checking for TU_CMD_DIRTY_DRAW_STATE also allows not emitting the draw
states if they will be re-emitted on the next draw anyway. the previous
patch makes it so TU_CMD_DIRTY_DRAW_STATE is always set outside of
renderpasses)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>

3 years agoturnip: correctly disable draw states outside of renderpasses
Jonathan Marek [Thu, 3 Dec 2020 04:49:26 +0000 (23:49 -0500)]
turnip: correctly disable draw states outside of renderpasses

* do the disable in EndRenderPass2 to fix the missing disable for sysmem
* we don't need a disable at the end of every tile, or between binning pass
  and gmem pass (the first draw in draw_cs emits all the draw states)

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>

3 years agoturnip: always emit LRZ draw state in DIRTY_DRAW_STATE path
Jonathan Marek [Thu, 3 Dec 2020 04:32:13 +0000 (23:32 -0500)]
turnip: always emit LRZ draw state in DIRTY_DRAW_STATE path

The packet size is constant and assumes all states, except for the 2 input
attachment states. (this means we get an invalid packet if DIRTY_LRZ isn't
set when DIRTY_DRAW_STATE is set).

Fixes: 3c07a1499863 ("turnip: enable LRZ")

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>

3 years agoturnip: do not include compute stage in pipeline_builder
Jonathan Marek [Thu, 3 Dec 2020 04:28:38 +0000 (23:28 -0500)]
turnip: do not include compute stage in pipeline_builder

This avoids emitting compute-related state in the graphics pipeline
(tu6_emit_xs_config was being called for compute stage).

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>

3 years agoturnip: no linear_to_srgb for alpha channel for gmem clear value packing
Jonathan Marek [Thu, 3 Dec 2020 04:23:20 +0000 (23:23 -0500)]
turnip: no linear_to_srgb for alpha channel for gmem clear value packing

Alpha channel is always linear (oops).

Fixes: ddac5933f8f3 ("turnip: call packing functions directly for pack_gmem_clear_value")

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7899>

3 years agogallium/u_threaded: optimize set_constant_buffer
Marek Olšák [Sun, 29 Nov 2020 06:25:01 +0000 (01:25 -0500)]
gallium/u_threaded: optimize set_constant_buffer

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

3 years agogallium/u_threaded: don't make a local copy of pipe_draw_start_count
Marek Olšák [Sat, 28 Nov 2020 10:24:06 +0000 (05:24 -0500)]
gallium/u_threaded: don't make a local copy of pipe_draw_start_count

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

3 years agogallium/u_threaded: don't copy the indexbuf pointer if we overwrite it
Marek Olšák [Sat, 28 Nov 2020 10:22:06 +0000 (05:22 -0500)]
gallium/u_threaded: don't copy the indexbuf pointer if we overwrite it

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

3 years agogallium/u_threaded: set has_user_indices = false in the driver thread
Marek Olšák [Sat, 28 Nov 2020 10:18:38 +0000 (05:18 -0500)]
gallium/u_threaded: set has_user_indices = false in the driver thread

to remove some overhead from the main thread.

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

3 years agogallium/u_threaded: don't pass index bounds to the driver to decrease overhead
Marek Olšák [Sat, 28 Nov 2020 10:03:31 +0000 (05:03 -0500)]
gallium/u_threaded: don't pass index bounds to the driver to decrease overhead

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

3 years agoglthread: count batch space in units of uint64_t elements
Marek Olšák [Sat, 10 Oct 2020 09:09:53 +0000 (05:09 -0400)]
glthread: count batch space in units of uint64_t elements

This removes one x86 shr instruction from _mesa_glthread_allocate_command.

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

3 years agoglthread: change sizes to unsigned or size_t where needed
Marek Olšák [Sat, 10 Oct 2020 03:05:08 +0000 (23:05 -0400)]
glthread: change sizes to unsigned or size_t where needed

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

3 years agoglthread: use uint64_t to declare the batch buffer instead of align(8)
Marek Olšák [Sat, 10 Oct 2020 02:37:28 +0000 (22:37 -0400)]
glthread: use uint64_t to declare the batch buffer instead of align(8)

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

3 years agoglthread: use glthread->used instead of glthread->next_batch->used
Marek Olšák [Sat, 10 Oct 2020 02:16:29 +0000 (22:16 -0400)]
glthread: use glthread->used instead of glthread->next_batch->used

remove one pointer dereference by having "used" in glthread too

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

3 years agozink: use shader keys for samplemask
Mike Blumenkrantz [Mon, 7 Dec 2020 18:41:03 +0000 (13:41 -0500)]
zink: use shader keys for samplemask

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

3 years agozink: change a memcmp==0 to !memcmp
Mike Blumenkrantz [Mon, 7 Dec 2020 20:43:33 +0000 (15:43 -0500)]
zink: change a memcmp==0 to !memcmp

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

3 years agozink: initial shader key implementation
Mike Blumenkrantz [Thu, 26 Nov 2020 17:08:46 +0000 (12:08 -0500)]
zink: initial shader key implementation

this is a squashed version of a previously-reviewed series
ref https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7193

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

3 years agovulkan/device_select: Store Vulkan vendorID and deviceID as uint32_t
Witold Baryluk [Mon, 7 Dec 2020 20:45:42 +0000 (20:45 +0000)]
vulkan/device_select: Store Vulkan vendorID and deviceID as uint32_t

Vulkan uses 32-bit IDs, compared to PCI/USB 16-bit ones.

Some driver vendorIDs do exceed 0xffff, including MESA (used by lavapipe).

Without this, the value will be truncated, and device select layer
will not match expected (or any) device.

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

3 years agogallium/aux: Update scons build for u_tracepoints.[ch]
Rob Clark [Mon, 7 Dec 2020 17:08:10 +0000 (09:08 -0800)]
gallium/aux: Update scons build for u_tracepoints.[ch]

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7974>

3 years agogallium/aux: Split u_tracepoints.[ch] generation
Rob Clark [Mon, 7 Dec 2020 17:05:29 +0000 (09:05 -0800)]
gallium/aux: Split u_tracepoints.[ch] generation

Allow for separate rules to be used to generate the .c and .h (partially
to make it easier for scons build, and partially because that is just a
better practice).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7974>

3 years agogallium/aux: Avoid creating queue when traces not enabled
Rob Clark [Sat, 5 Dec 2020 18:39:45 +0000 (10:39 -0800)]
gallium/aux: Avoid creating queue when traces not enabled

Avoids unnecessarily creating an extra thread when tracing is not
enabled.  Which also side-steps a chrome/ium sandbox issue with
the setscheduler call in u_queue.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7974>

3 years agonir: improve divergence analysis for loads with non-uniform resources
Rhys Perry [Fri, 22 May 2020 12:39:06 +0000 (13:39 +0100)]
nir: improve divergence analysis for loads with non-uniform resources

If ACCESS_NON_UNIFORM is not specified, we can assume the resource is
uniform. This requires nir_lower_non_uniform_access to remove that flag.

A few Detroit: Become Human shaders use a index sourced from a fragment
input which is expected to be uniform.

shader-db (Navi):
Totals from 8 (0.01% of 127638) affected shaders:
SGPRs: 224 -> 384 (+71.43%)
VGPRs: 208 -> 112 (-46.15%)
CodeSize: 5360 -> 5344 (-0.30%); split: -1.49%, +1.19%
Instrs: 1036 -> 1028 (-0.77%); split: -1.93%, +1.16%
VMEM: 1320 -> 608 (-53.94%)
SMEM: 384 -> 336 (-12.50%); split: +14.58%, -27.08%
VClause: 24 -> 16 (-33.33%)
SClause: 48 -> 56 (+16.67%)
PreSGPRs: 124 -> 216 (+74.19%)
PreVGPRs: 168 -> 88 (-47.62%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5201>

3 years agonir/lower_non_uniform: remove non_uniform flags after lowering
Rhys Perry [Tue, 6 Oct 2020 16:08:33 +0000 (17:08 +0100)]
nir/lower_non_uniform: remove non_uniform flags after lowering

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5201>

3 years agoiris: fix memleak for query_buffer_uploader
yshi18 [Thu, 3 Dec 2020 05:54:14 +0000 (13:54 +0800)]
iris: fix memleak for query_buffer_uploader

In the Chrome WebGL Aquarium  stress test, 20 instances of Chrome will run
Aquarium  simultaneously over 20+ hours. That causes Chrome crash.
During the stress, glBeginQueryIndexed is called frequently.

1.Each query will only use 32 bytes from query_buffer_uploader. After the offset
exceed 4096, it will alloc new buffer for query_buffer_uploader->buffer
and release the old buffer.

2.But iris_begin_query will call u_upload_alloc when the offset changed, and it
will increase the query_buffer_uploader->buffer->reference.count every time
when it called u_upload_alloc.

3.So when u_upload_release_buffer try to release the resource of
query_buffer_uploader->buffer, its reference.count is
already equal to 129. pipe_reference_described will only decrease its reference
count to 128.So it never called old_dst->screen->resource_destroy.

4.The old resouce bo will never be freeed. And chrome will called mmap every time
when it alloc new resource bo.

5. Chrome process map too many vmas in its process. Its map count exceed the
sysctl_max_map_count which is 65530 defined in kernel.

6. When iris_begin_query want to alloc new resource bo, it will meet NULL pointer
because mmap return failed. Finally chrome crashed when it access this NULL resource
bo.

The fix is decrease the reference count in iris_destroy_query.

Patch is verified by chrome webgl Aquarium test case for more than 72 hours.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Yang Shi <yang.a.shi@intel.com>
Reviewed-by: Alex Zuo <alex.zuo@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7890>

3 years agoaco: use UINT64_C on 64 bit constant arguments
Jonathan Gray [Tue, 4 Aug 2020 07:22:32 +0000 (17:22 +1000)]
aco: use UINT64_C on 64 bit constant arguments

avoids errors seen when building on OpenBSD/amd64

../src/amd/compiler/aco_instruction_selection.cpp:1677:62: error: ambiguous conversion for functional-style cast from 'unsigned long' to 'aco::Operand'
            bld.vop3(aco_opcode::v_mul_f64, Definition(dst), Operand(0x3FF0000000000000lu), tmp);
                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
glibc uses unsigned long for uint64_t on LP64 archs and unsigned long long for
uint64_t on ILP32 archs.  On OpenBSD unsigned long long is used for uint64_t
on all archs.

The Operand constructors are uint8_t uint16_t uint32_t uint64_t
use UINT64_C so lu or llu suffix will be used as needed.

Fixes: df645fa369d ("aco: implement VK_KHR_shader_float_controls")
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7944>

3 years agomesa/st: lower 64 bit ops to scalar before lowering to soft-float
Gert Wollny [Sun, 25 Oct 2020 18:28:22 +0000 (19:28 +0100)]
mesa/st: lower 64 bit ops to scalar before lowering to soft-float

The fp64 emulation is not prepared for vectorized 64 bit code, so
if the driver doesn't ask for lowering to scalar by itself, do it before
lowering to soft-fb, and run a vectorizazion pass afterwards.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7961>

3 years agoradv: disable alphaToOne feature
Samuel Pitoiset [Mon, 7 Dec 2020 11:38:46 +0000 (12:38 +0100)]
radv: disable alphaToOne feature

The feature was exposed but completely ignored by the driver. Other
AMD drivers don't expose it as well, probably because it's complicated
to implement alpha-to-coverage properly. Let's disable it.

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

3 years agodriconf: add allow_incorrect_primitive_id option
Pierre-Eric Pelloux-Prayer [Wed, 4 Nov 2020 09:19:18 +0000 (10:19 +0100)]
driconf: add allow_incorrect_primitive_id option

And enable it for SPECviewperf.

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

3 years agovbo/dlist: only use merged primitives when it's ok to do so
Pierre-Eric Pelloux-Prayer [Tue, 20 Oct 2020 08:57:04 +0000 (10:57 +0200)]
vbo/dlist: only use merged primitives when it's ok to do so

Merging primitives generates incorrect gl_PrimitiveID[In] values.
So make merged primitives construction non-destructive and fallback
to drawing with original primitives if a program reads gl_PrimitiveId.

This commit adds _mesa_update_primitive_id_is_unused modeled after
_mesa_update_allow_draw_out_of_order to update ctx->_PrimitiveIDIsUnused
each time shaders are updated.

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