platform/upstream/mesa.git
16 months agoci: Remove some -Werror workarounds for debian-android job
Michel Dänzer [Tue, 7 Mar 2023 16:09:51 +0000 (17:09 +0100)]
ci: Remove some -Werror workarounds for debian-android job

No more corresponding warnings.

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

16 months agoiris: Use ralloc_free for memory allocated with rzalloc
Michel Dänzer [Tue, 7 Mar 2023 17:21:57 +0000 (18:21 +0100)]
iris: Use ralloc_free for memory allocated with rzalloc

Pointed out by GCC with LTO:

../src/gallium/drivers/iris/iris_context.c: In function 'iris_create_context':
../src/gallium/drivers/iris/iris_context.c:304:7: error: 'free' called on pointer 'block_180' with nonzero offset 48 [-Werror=free-nonheap-object]
  304 |       free(ctx);
      |       ^
[...]
../src/gallium/drivers/iris/iris_context.c:313:7: error: 'free' called on pointer 'block_180' with nonzero offset 48 [-Werror=free-nonheap-object]
  313 |       free(ctx);
      |       ^

v2:
* Use ice pointer instead of ctx. (Karol Herbst)

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

16 months agocrocus: Use ralloc_free for memory allocated with rzalloc
Michel Dänzer [Tue, 7 Mar 2023 17:14:57 +0000 (18:14 +0100)]
crocus: Use ralloc_free for memory allocated with rzalloc

Pointed out by GCC with LTO:

../src/gallium/drivers/crocus/crocus_context.c: In function 'crocus_create_context':
../src/gallium/drivers/crocus/crocus_context.c:261:7: error: 'free' called on pointer 'block_174' with nonzero offset 48 [-Werror=free-nonheap-object]
  261 |       free(ctx);
      |       ^

v2:
* Use ice pointer instead of ctx. (Karol Herbst)

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

16 months agor600: Use container_of instead of direct pointer cast
Michel Dänzer [Mon, 13 Feb 2023 18:03:15 +0000 (19:03 +0100)]
r600: Use container_of instead of direct pointer cast

Fixes strict aliasing violation:

In function 'r600_init_resource_fields',
    inlined from 'r600_buffer_create' at ../src/gallium/drivers/r600/r600_buffer_common.c:578:2:
../src/gallium/drivers/r600/r600_buffer_common.c:139:48: warning: array subscript 'struct r600_texture[0]' is partly outside array bounds of 'unsigned char[264]' [-Warray-bounds]
  139 |         if ((res->b.b.target != PIPE_BUFFER && !rtex->surface.is_linear) ||
      |                                                ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/util/os_memory.h:37,
                 from ../src/util/u_memory.h:38,
                 from ../src/gallium/include/pipe/p_state.h:47,
                 from ../src/gallium/auxiliary/util/u_inlines.h:34,
                 from ../src/gallium/auxiliary/pipebuffer/pb_buffer.h:49,
                 from ../src/gallium/include/winsys/radeon_winsys.h:46,
                 from ../src/gallium/drivers/r600/r600_pipe_common.h:37,
                 from ../src/gallium/drivers/r600/r600_cs.h:33,
                 from ../src/gallium/drivers/r600/r600_buffer_common.c:27:
In function 'r600_alloc_buffer_struct',
    inlined from 'r600_buffer_create' at ../src/gallium/drivers/r600/r600_buffer_common.c:576:34:
../src/util/os_memory_stdc.h:41:27: note: object of size 264 allocated by 'malloc'
   41 | #define os_malloc(_size)  malloc(_size)
      |                           ^~~~~~~~~~~~~
../src/util/u_memory.h:46:24: note: in expansion of macro 'os_malloc'
   46 | #define MALLOC(_size)  os_malloc(_size)
      |                        ^~~~~~~~~
../src/util/u_memory.h:54:41: note: in expansion of macro 'MALLOC'
   54 | #define MALLOC_STRUCT(T)   (struct T *) MALLOC(sizeof(struct T))
      |                                         ^~~~~~
../src/gallium/drivers/r600/r600_buffer_common.c:554:19: note: in expansion of macro 'MALLOC_STRUCT'
  554 |         rbuffer = MALLOC_STRUCT(r600_resource);
      |                   ^~~~~~~~~~~~~

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

16 months agonouveau: Make getSize return unsigned int
Michel Dänzer [Tue, 14 Feb 2023 17:05:21 +0000 (18:05 +0100)]
nouveau: Make getSize return unsigned int

This matches the type of the underlying size member, and is consistent
with other getSize methods.

Avoids compiler warning with LTO enabled:

In member function '__ct ',
    inlined from 'convertToSSA' at ../src/nouveau/codegen/nv50_ir_ssa.cpp:401:26,
    inlined from 'convertToSSA' at ../src/nouveau/codegen/nv50_ir_ssa.cpp:310:28,
    inlined from 'nv50_ir_generate_code' at ../src/nouveau/codegen/nv50_ir.cpp:1331:22:
../src/nouveau/codegen/nv50_ir_ssa.cpp:407:48: error: argument 1 value '18446744073709551615' exceeds maximum object size 9223372036854775807 [-Werror=alloc-size-larger-than=]
  407 |    stack = new Stack[func->allLValues.getSize()];
      |                                                ^
/usr/include/c++/12/new: In function 'nv50_ir_generate_code':
/usr/include/c++/12/new:128:26: note: in a call to allocation function 'operator new []' declared here
  128 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
      |                          ^

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

16 months agov3dv/debug: add debug option to disable TFU codepaths
Alejandro Piñeiro [Tue, 14 Mar 2023 11:34:31 +0000 (12:34 +0100)]
v3dv/debug: add debug option to disable TFU codepaths

This can have two main uses:
  * If we suspect a problem with TFU copies, we can disable it and
    check if other codepaths gets a test/app working.
  * To test other codepaths, as in general, TFU is the preferred
    option for copies.

Note that for now this is only for v3dv, as for v3d, mipmap generation
uses TFU without an alternative codepath.

With this option we also adds an assert if we try to submit a TFU job,
just in case we keep adding other methods that use TFU, and forget to
include the debug option there.

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

16 months agozink: only flag rp info for updating on flush, don't actually update
Mike Blumenkrantz [Mon, 13 Mar 2023 11:57:45 +0000 (07:57 -0400)]
zink: only flag rp info for updating on flush, don't actually update

this is more consistent with actual usage

also sanitize rp info on flush to ensure it isn't reused

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

16 months agoaux/tc: rework inter-batch renderpass info handling
Mike Blumenkrantz [Wed, 8 Mar 2023 23:36:24 +0000 (18:36 -0500)]
aux/tc: rework inter-batch renderpass info handling

the tricky part of tracking renderpass info in tc is handling batch
flushing. there are a number of places that can trigger it, but
there are only two types of flushes:
* full flushes (all commands execute)
* partial flushes (more commands will execute after)

the latter case is the important one, as it effectively means that
the current renderpass info needs to "roll over" into the next one,
and it's really the next info that the driver will want to look at.
this is made trickier by there being no way (for the driver) to distinguish
when a rollover happens in order to delay beginning a renderpass for
further parsing

to solve this, add a member to renderpass info to chain the rolled-over info,
which tc can then process when the driver tries to wait. this works "most"
of the time, except when an app/test blows out the tc batch count, in which
case this pointer will be non-null, and it can be directly signaled as a less
optimized renderpass to avoid deadlocking

also sometimes a flush will trigger sub-flushes for buffer lists, so
add an assert to ensure nobody tries using this with driver_calls_flush_notify=true

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

16 months agoaux/tc: make some of the rp tracking api private
Mike Blumenkrantz [Mon, 13 Mar 2023 11:52:35 +0000 (07:52 -0400)]
aux/tc: make some of the rp tracking api private

this enables some more under-the-hood changes without touching the header
that will force all of gallium to be recompiled

also update/clarify rules for using rp tracking; these haven't changed,
but the documentation was less clear before

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

16 months agoaux/tc: fix initial rp info allocation
Mike Blumenkrantz [Mon, 13 Mar 2023 11:41:33 +0000 (07:41 -0400)]
aux/tc: fix initial rp info allocation

this value is -1 by default, which means the initial allocation yields
9 info structs instead of 10 (though this has no bearing on functionality)

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

16 months agoaux/tc: add a function to reset rp info
Mike Blumenkrantz [Mon, 13 Mar 2023 11:40:03 +0000 (07:40 -0400)]
aux/tc: add a function to reset rp info

drivers should be maintaining a local copy of the rp info, and this
provides a consistent way to reset that info if a renderpass is ended
early

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

16 months agoaux/tc: don't sync for get_sample_position
Mike Blumenkrantz [Thu, 9 Mar 2023 12:37:02 +0000 (07:37 -0500)]
aux/tc: don't sync for get_sample_position

no drivers actually use the context for this, so a sync is pointless

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

16 months agoaux/tc: track the number of active queries
Mike Blumenkrantz [Thu, 9 Mar 2023 12:18:23 +0000 (07:18 -0500)]
aux/tc: track the number of active queries

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

16 months agoaux/tc: fix renderpass splitting on flush
Mike Blumenkrantz [Wed, 8 Mar 2023 20:06:49 +0000 (15:06 -0500)]
aux/tc: fix renderpass splitting on flush

it's expected that a driver won't immediately trigger a deferred flush
if a fence is present, so don't split the renderpass in this case since
that breaks everything

Fixes: 07017aa137b ("util/tc: implement renderpass tracking")

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

16 months agoaux/tc: use a local 'deferred' variable in tc_flush()
Mike Blumenkrantz [Wed, 8 Mar 2023 20:06:10 +0000 (15:06 -0500)]
aux/tc: use a local 'deferred' variable in tc_flush()

no functional changes

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

16 months agoaux/tc: flag late zs clears as partial clears
Mike Blumenkrantz [Wed, 8 Mar 2023 17:13:05 +0000 (12:13 -0500)]
aux/tc: flag late zs clears as partial clears

this ensures drivers can't optimize out a zs attachment that gets
a late clear

Fixes: 07017aa137b ("util/tc: implement renderpass tracking")

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

16 months agozink: trigger oom flushes more aggressively from copy ops
Mike Blumenkrantz [Wed, 15 Mar 2023 23:16:17 +0000 (19:16 -0400)]
zink: trigger oom flushes more aggressively from copy ops

this cuts down on needing to flush from set_fb or draw

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

16 months agozink: disable tc flush notify with rp optimizing
Mike Blumenkrantz [Wed, 15 Mar 2023 20:38:30 +0000 (16:38 -0400)]
zink: disable tc flush notify with rp optimizing

this is extremely broken and nonfunctional since it randomly flushes
mid-renderpass and triggers invalidations

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

16 months agozink: disable queries when flushing clears from set_fb
Mike Blumenkrantz [Wed, 15 Mar 2023 22:48:22 +0000 (18:48 -0400)]
zink: disable queries when flushing clears from set_fb

this otherwise has weird side effects, especially with rp optimizing enabled

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

16 months agozink: add and use a function for "safely" ending renderpasses
Mike Blumenkrantz [Mon, 13 Mar 2023 12:19:33 +0000 (08:19 -0400)]
zink: add and use a function for "safely" ending renderpasses

these are all points at which a renderpass should be split, so make sure
renderpass data isn't reset in any way here

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

16 months agozink: reset tc fb info upon splitting a renderpass
Mike Blumenkrantz [Wed, 8 Mar 2023 17:15:45 +0000 (12:15 -0500)]
zink: reset tc fb info upon splitting a renderpass

not sure if this actually affects anything, but if a renderpass has
to be split for some reason, ensure subsequent renderpasses don't lose
data

also ensure that rp data isn't lost when triggering primgen clears and
delete a now-invalid assert

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

16 months agozink: don't use/update tc rp info while blitting
Mike Blumenkrantz [Fri, 10 Mar 2023 12:40:59 +0000 (07:40 -0500)]
zink: don't use/update tc rp info while blitting

this is illegal

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

16 months agozink: add an assert to catch renderpass optimizing bugs
Mike Blumenkrantz [Wed, 8 Mar 2023 23:37:53 +0000 (18:37 -0500)]
zink: add an assert to catch renderpass optimizing bugs

this should only trigger if tc has a bug

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

16 months agointel/fs: Fix register coalesce in presence of force_writemask_all copy source writes.
Francisco Jerez [Sat, 11 Feb 2023 03:35:35 +0000 (19:35 -0800)]
intel/fs: Fix register coalesce in presence of force_writemask_all copy source writes.

This fixes the behavior of register coalesce in cases where the source
of a copy is written elsewhere in the program by a force_writemask_all
instruction, which could cause the overwrite to be executed for an
inactive channel under non-uniform control flow, causing
can_coalesce_vars() to give incorrect results.  This has been reported
in cases like:

> while (true) {
>    x = imageSize(img);
>    if (non_uniform_condition()) {
>       y = x;
>       break;
>    }
> }
> use(y);

Currently the register coalesce pass would coalesce x and y in the
example above, which is invalid since in the example above imageSize()
is implemented as a force_writemask_all SEND message, whose result is
broadcast to all channels, so when a given channel executes 'y = x'
and breaks out of the loop, another divergent channel can execute a
subsequent iteration of the loop overwriting 'x' with a different
value, hence coalescing y and x into the same register changes the
behavior of the program.

Note that this is a regression introduced by commit a4b36cd3dd30.  In
order to avoid the problem without reverting that patch, we prevent
register coalesce if there is an overwrite of the source with
force_writemask_all behavior inconsistent with the copy and this
occurs anywhere in the intersection of the live ranges of source and
destination, even if it occurs lexically before the copy, since it
might be physically executed after the copy under divergent loop
control flow.

Fixes: a4b36cd3dd30 ("intel/fs: Coalesce when the src live range is contained in the dst")
Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21351>

16 months agointel/fs: Fix copy propagation dataflow analysis in presence of force_writemask_all...
Francisco Jerez [Sat, 11 Feb 2023 03:33:50 +0000 (19:33 -0800)]
intel/fs: Fix copy propagation dataflow analysis in presence of force_writemask_all ACP overwrites.

This fixes the behavior of copy propagation in cases where either the
source or destination of an ACP is overwritten elsewhere in the
program by a force_writemask_all instruction, which could cause the
overwrite to be executed for an inactive channel under non-uniform
control flow, causing the current per-channel dataflow propagation to
give incorrect results.  This has been reported in cases like:

> while (true) {
>    x = imageSize(img);
>    if (non_uniform_condition()) {
>       y = x;
>       break;
>    }
> }
> use(y);

Currently the copy propagation pass would propagate copy 'y = x' into
'use(y)', which is invalid since in the example above imageSize() is
implemented as a force_writemask_all SEND message, whose result is
broadcast to all channels, so when a given channel executes 'y = x'
and breaks out of the loop, another divergent channel can execute a
subsequent iteration of the loop overwriting 'x' with a different
value, hence replacing 'y' with 'x' at 'use(y)' changes the behavior
of the program.

This patch extends the global dataflow analysis algorithm to determine
whether there is any control flow path from a given copy to an
overwrite of its source or destination which has force_writemask_all
behavior inconsistent with the copy, and in such case prevents copy
propagation for that ACP entry at any point of the program which can
be reached from the overwrite, even if the copy is statically
re-executed along all such control flow paths (as in the example
above), since the execution of the overwrite for a given channel i may
corrupt other channels j!=i inactive for the subsequently re-executed
copy.

Note that a simpler solution has been attempted which fully shuts down
copy propagation if such a force_writemask_all ACP overwrite is
present /anywhere/ in the program regardless of its location in the
control flow graph, however that led to large shader-db regressions in
some programs from shader-db (like a CS from Car Chase which would
emit 53% more instructions).  With this solution the only handful of
shaders that suffer instruction count regressions seem to be getting
misoptimized right now (e.g. some compute shaders from Deus Ex
Mankind).  This solution doesn't seem to affect the run-time of
shader-db significantly, it's less than 1% higher with the fix
applied.

Reported-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21351>

16 months agointel/fs: Track force_writemask_all behavior of copy propagation ACP entries.
Francisco Jerez [Sat, 11 Feb 2023 03:29:20 +0000 (19:29 -0800)]
intel/fs: Track force_writemask_all behavior of copy propagation ACP entries.

force_writemask_all determines whether all channels of the copy are
actually valid, and may be required to be set for it to be propagated
safely in cases where the destination of the copy is used by another
force_writemask_all instruction, or when the copy occurs in a
divergent control flow block different from its use.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21351>

16 months agoi965/vec4: Implement uclz in the vec4 backend
Kenneth Graunke [Thu, 16 Mar 2023 23:01:16 +0000 (16:01 -0700)]
i965/vec4: Implement uclz in the vec4 backend

Commit 28311f9d029 moved ufind_msb lowering to NIR and started emitting
uclz.  Unfortunately, the vec4 backend never actually implemented uclz.

It's trivial to do.  Now it does.

Fixes: 28311f9d029 ("nir: intel/compiler: Move ufind_msb lowering to NIR")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21974>

16 months agointel/fs: Make bld.F16TO32 actually emit F16TO32 not F32TO16
Kenneth Graunke [Thu, 16 Mar 2023 22:54:07 +0000 (15:54 -0700)]
intel/fs: Make bld.F16TO32 actually emit F16TO32 not F32TO16

Ahem, "add builder helpers that work on Gfx7"...now might actually work.
Too much copy and paste...

Fixes: 966995d9117 ("intel/fs: Add builder helpers for F32TO16/F16TO32 that work on Gfx7.x")
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21974>

16 months agointel/vec4: Retype texture/sampler indexes to UD
Kenneth Graunke [Thu, 16 Mar 2023 21:53:50 +0000 (14:53 -0700)]
intel/vec4: Retype texture/sampler indexes to UD

generate_tex() asserts that sampler_index.type == UD, but commit
83fd7a5ed15 removed the uint temporary, which caused us to see D at
some points.  Really, either should be fine, but let's just put the
UD retype back.  This fixes a ton of things in crocus.

Fixes: 83fd7a5ed15 ("intel: Use nir_lower_tex_options::lower_index_to_offset")
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21974>

16 months agonir: Propagate alignment when rematerializing cast derefs
Jesse Natalie [Thu, 16 Mar 2023 23:19:32 +0000 (16:19 -0700)]
nir: Propagate alignment when rematerializing cast derefs

Fixes: 878a8daca6bf ("nir: Add alignment information to cast derefs")
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21975>

16 months agozink: track tc fences better
Mike Blumenkrantz [Fri, 10 Mar 2023 17:48:30 +0000 (12:48 -0500)]
zink: track tc fences better

tc fence lifetimes can exceed the lifetimes of their parent contexts,
which means they can be destroyed after mfence->fence has been destroyed

to avoid invalid memory access on a destroyed fence, store all the assigned
tc fences into an array on the real fence and then use that to unset fence
pointers on any outstanding tc fences

fixes flakiness in dEQP-EGL.functional.sharing.gles2.multithread.random_egl_sync.images.texsubimage2d.12

in caselist:
dEQP-EGL.functional.query_context.get_current_surface.rgba4444_pbuffer
dEQP-EGL.functional.create_surface.platform_window.rgba5551_depth_no_stencil
dEQP-EGL.functional.query_surface.simple.pbuffer.rgb888_depth_no_stencil
dEQP-EGL.functional.color_clears.multi_context.gles2.rgb888_pixmap
dEQP-EGL.functional.color_clears.multi_context.gles1_gles2.rgba8888_window
dEQP-EGL.functional.color_clears.multi_context.gles1_gles2_gles3.rgb888_window
dEQP-EGL.functional.render.multi_thread.gles2_gles3.rgba5551_pbuffer
dEQP-EGL.functional.sharing.gles2.multithread.random_egl_sync.buffers.buffersubdata.3
dEQP-EGL.functional.sharing.gles2.multithread.random_egl_sync.programs.link.6
dEQP-EGL.functional.sharing.gles2.multithread.random_egl_sync.images.texsubimage2d.12

cc: mesa-stable

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

16 months agod3d12: Track up to 16 contexts worth of batch references locally in bos
Giancarlo Devich [Tue, 14 Mar 2023 19:21:19 +0000 (12:21 -0700)]
d3d12: Track up to 16 contexts worth of batch references locally in bos

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

16 months agod3d12: Unroll shader variant selection loop
Giancarlo Devich [Tue, 14 Mar 2023 18:55:47 +0000 (11:55 -0700)]
d3d12: Unroll shader variant selection loop

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

16 months agod3d12: Reduce gs variant key init cost; unnecessary validate gs calls
Giancarlo Devich [Tue, 14 Mar 2023 18:52:16 +0000 (11:52 -0700)]
d3d12: Reduce gs variant key init cost; unnecessary validate gs calls

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

16 months agod3d12: Use short circuit in shader key compare; update key hash
Giancarlo Devich [Tue, 14 Mar 2023 18:50:03 +0000 (11:50 -0700)]
d3d12: Use short circuit in shader key compare; update key hash

Move common key compare to the final step; change to short circuit from
memcmp.

Update key hash to treat varying pointers as uint64.

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

16 months agod3d12: Use context-level sampler_state array for filling shader keys
Giancarlo Devich [Tue, 14 Mar 2023 18:38:53 +0000 (11:38 -0700)]
d3d12: Use context-level sampler_state array for filling shader keys

This significantly reduces the size of d3d12_shader_key

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

16 months agod3d12: Don't unnecessarily recompute manual_depth_range
Giancarlo Devich [Tue, 14 Mar 2023 18:28:24 +0000 (11:28 -0700)]
d3d12: Don't unnecessarily recompute manual_depth_range

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

16 months agod3d12: Track up to 16 contexts worth of pending barriers locally in bos
Giancarlo Devich [Tue, 14 Mar 2023 18:26:36 +0000 (11:26 -0700)]
d3d12: Track up to 16 contexts worth of pending barriers locally in bos

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

16 months agozink: use res->queue to auto-handle queue transitions back to gfx queue
Mike Blumenkrantz [Mon, 19 Sep 2022 19:23:44 +0000 (15:23 -0400)]
zink: use res->queue to auto-handle queue transitions back to gfx queue

much simpler

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

16 months agozink: remove redundant dmabuf_acquire setting
Mike Blumenkrantz [Mon, 19 Sep 2022 19:17:48 +0000 (15:17 -0400)]
zink: remove redundant dmabuf_acquire setting

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

16 months agozink: track current queue for resources
Mike Blumenkrantz [Mon, 19 Sep 2022 19:16:39 +0000 (15:16 -0400)]
zink: track current queue for resources

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

16 months agoci/traces: disable nheko trace with zink since it flakes
David Heidelberg [Fri, 17 Mar 2023 00:21:59 +0000 (01:21 +0100)]
ci/traces: disable nheko trace with zink since it flakes

Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21976>

16 months agoglsl: Fix codegen for constant ir_binop_{l,r}shift with mixed types
Sviatoslav Peleshko [Thu, 28 Jul 2022 09:46:37 +0000 (12:46 +0300)]
glsl: Fix codegen for constant ir_binop_{l,r}shift with mixed types

Fixes: 13106e10 ("glsl: Generate code for constant ir_binop_lshift and ir_binop_rshift expressions")

Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17787>

16 months agozink: fix layer check for compressed format surface creation
Mike Blumenkrantz [Mon, 13 Mar 2023 19:29:31 +0000 (15:29 -0400)]
zink: fix layer check for compressed format surface creation

this is a universal check, not a check based on mutable state

Fixes: 56108b411fd ("zink: verify compressed format layer count when creating surfaces")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21881>

16 months agoaco: Always enable idxen for swizzled buffer access on GFX11.
Timur Kristóf [Sat, 18 Feb 2023 12:45:22 +0000 (13:45 +0100)]
aco: Always enable idxen for swizzled buffer access on GFX11.

This helps pass the mesh shader I/O tests.
Swizzled buffer addressing seems to be broken on GFX11
when the idxen bit is 0.

No Fossil DB changes on Rembrandt (GFX10.3).

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21930>

16 months agoaco: Disable MUBUF/MTBUF offsets when they are zero.
Timur Kristóf [Sat, 18 Feb 2023 12:42:53 +0000 (13:42 +0100)]
aco: Disable MUBUF/MTBUF offsets when they are zero.

Fossil DB stats on Rembrandt (GFX10.3):

Totals from 1264 (0.94% of 134920) affected shaders:
VGPRs: 69504 -> 69336 (-0.24%)
CodeSize: 6885468 -> 6886224 (+0.01%); split: -0.02%, +0.03%
MaxWaves: 24632 -> 24670 (+0.15%)
Instrs: 1287027 -> 1287209 (+0.01%); split: -0.04%, +0.05%
Latency: 6830411 -> 6831165 (+0.01%); split: -0.06%, +0.07%
InvThroughput: 1220643 -> 1220438 (-0.02%); split: -0.04%, +0.02%
VClause: 24737 -> 24751 (+0.06%); split: -0.25%, +0.30%
SClause: 42774 -> 42911 (+0.32%); split: -0.13%, +0.45%
Copies: 75408 -> 75600 (+0.25%); split: -0.62%, +0.88%
PreVGPRs: 60544 -> 59809 (-1.21%)

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21930>

16 months agoaco: Use zero for MUBUF/MTBUF when soffset is undefined.
Timur Kristóf [Wed, 15 Mar 2023 20:50:52 +0000 (13:50 -0700)]
aco: Use zero for MUBUF/MTBUF when soffset is undefined.

No Fossil DB changes on Rembrandt (GFX10.3).

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21930>

16 months agoaco: Don't add soffset to swizzled MUBUF base.
Timur Kristóf [Fri, 17 Feb 2023 11:19:33 +0000 (12:19 +0100)]
aco: Don't add soffset to swizzled MUBUF base.

No Fossil DB changes on Rembrandt (GFX10.3).

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21930>

16 months agoandroid/ci: raise error on script when not related to the tests
Helen Koike [Wed, 15 Mar 2023 15:55:12 +0000 (12:55 -0300)]
android/ci: raise error on script when not related to the tests

The cuttlefish-runner.sh script was failing before reaching the test
suite execution (which was not executing the complete test suite due to
the previous non-catched failures, and was erroneous passing) and we
were not catching that.
Add set -e so we can catch those.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21941>

16 months agoandroid/ci: Fix call to adb
Helen Koike [Thu, 16 Mar 2023 13:10:51 +0000 (10:10 -0300)]
android/ci: Fix call to adb

Call to adb should be made with ADB variable, following the pattern from
the script.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21941>

16 months agoandroid/ci: fix removal of inexistent file
Helen Koike [Thu, 16 Mar 2023 00:49:52 +0000 (21:49 -0300)]
android/ci: fix removal of inexistent file

file libEGL_mesa.so doesn't exist and the rm command was failing,
replace by libGLES_mesa.so which exists.

Signed-off-by: Helen Koike <helen.koike@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21941>

16 months agoradv: Add RT shader stage names for executable properties
Friedrich Vock [Thu, 16 Mar 2023 17:10:58 +0000 (18:10 +0100)]
radv: Add RT shader stage names for executable properties

Now that we use raygen shaders, we also need to support RT stages for
executable properties.

Fixes: f123d65e9f5 ("radv/rt: use prolog for raytracing shaders")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21960>

16 months agoRevert "zink/kopper: Add extra swapchain images for Venus"
Yiwei Zhang [Thu, 16 Mar 2023 17:57:33 +0000 (10:57 -0700)]
Revert "zink/kopper: Add extra swapchain images for Venus"

This reverts commit 10f8240caf20382826015d99f368e073093880d7.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21963>

16 months agoasahi: Extend batch tracking for explicit sync
Asahi Lina [Wed, 1 Mar 2023 09:23:10 +0000 (18:23 +0900)]
asahi: Extend batch tracking for explicit sync

Now that we have stub sync support in the submission API, we can
implement the batch tracking changes required to support an explicit
sync world. This excludes the UAPI-specific bits (command decoding and
status parsing).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21620>

16 months agoasahi: Make agx_flush_resource reallocate non-shareable resources
Asahi Lina [Sun, 26 Feb 2023 06:00:45 +0000 (15:00 +0900)]
asahi: Make agx_flush_resource reallocate non-shareable resources

It's not legal to share a resource that isn't PIPE_BIND_SHARED, but
flush_resource needs to prepare a resource for potential sharing.
Let's allocate a new resource and blit it over when this happens.

See also:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13154

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21620>

16 months agoasahi: Support importing sync objects on BO export
Asahi Lina [Fri, 3 Mar 2023 09:55:24 +0000 (18:55 +0900)]
asahi: Support importing sync objects on BO export

When a BO is exported, implicit sync convention requires that writers
signal a fence on the object when complete. We already do this for BOs
that are *already* exported, but it is possible for a BO to be written
to, then exported for the first time.

Add a field to agx_bo to keep track of the current writer syncobj
handle. On first export, we use this to import it into the DMA-BUF.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21620>

16 months agoasahi: Use a dynarray for writers
Alyssa Rosenzweig [Fri, 3 Mar 2023 19:22:08 +0000 (14:22 -0500)]
asahi: Use a dynarray for writers

We don't want a writer hash table with persistent pointers to resources, because
the resources could be freed without the hash table being updated (even though
the underlying BO will not be freed until it's ready). To avoid the reference
count hell, do away with the pointer hash table and instead use a flat dynarray
for mapping BO (handles) to writer (batch indices).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21620>

16 months agoradv: Wait for shader uploads asynchronously.
Tatsuyuki Ishi [Tue, 12 Jul 2022 08:25:00 +0000 (17:25 +0900)]
radv: Wait for shader uploads asynchronously.

This introduces tracking of the required semaphore values in pipelines,
which is then propagated to cmd_buffers on bind. Each queue also keeps
track the maximum count it has waited for, so that we can avoid the waiting
overhead once all the shaders are loaded and referenced.

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

16 months agoradv: Upload shaders to invisible VRAM on small BAR systems.
Tatsuyuki Ishi [Fri, 24 Feb 2023 05:56:20 +0000 (14:56 +0900)]
radv: Upload shaders to invisible VRAM on small BAR systems.

Following PAL's implementation, this patch avoids allocating shader code
buffers in BAR and use SDMA to upload them to invisible VRAM
directly.

For some games like HZD, shaders can take as much as 400MB, which exceeds
the non-resizable BAR size (256MB) and cause inconsistent spilling
behavior. The kernel will normally move these to invisible VRAM on its own,
but there are a few cases that it does not reliably happen. This patch does
the moving explicitly in the driver to ensure predictable results.

In this patch, we upload the shaders synchronously; so the shader will be
ready as soon as vkCreate*Pipeline returns. A following patch will make
this asynchronous and don't block until we see a use of the pipeline.

As a side effect, when SQTT is used we now store the shaders on a cacheable
buffer which would speed up writing the trace to the disk.

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

16 months agoradv: Introduce sdma_copy_buffer for GFX7+.
Tatsuyuki Ishi [Tue, 28 Feb 2023 13:09:18 +0000 (22:09 +0900)]
radv: Introduce sdma_copy_buffer for GFX7+.

Helper salvaged from radeonsi (before SDMA removal).

This will be used for driver internal submissions to DMA shaders from GTT
to invisible VRAM.

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

16 months agoradv: Use radeon_cmdbuf for sdma_copy_image.
Tatsuyuki Ishi [Tue, 28 Feb 2023 13:02:30 +0000 (22:02 +0900)]
radv: Use radeon_cmdbuf for sdma_copy_image.

For consistency with the sdma_copy_buffer helper that will be added next.

As a general justification, SDMA commands require little state tracking and
using radeon_cmdbuf makes it more suitable for driver internal use.

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

16 months agoRevert "CI: Disable Windows runners"
Jesse Natalie [Wed, 15 Mar 2023 18:23:55 +0000 (11:23 -0700)]
Revert "CI: Disable Windows runners"

This reverts commit 023d7e860eeb148d0d245bcc49f5b66b9aeb8363.

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

16 months agoradv: Fix returning an expression from a void function
Jesse Natalie [Thu, 16 Mar 2023 14:22:28 +0000 (07:22 -0700)]
radv: Fix returning an expression from a void function

Fixes: d5de56bf ("radv: add RT shader args")
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21932>

16 months agovulkan/wsi: Fix Windows build
Jesse Natalie [Wed, 15 Mar 2023 18:22:16 +0000 (11:22 -0700)]
vulkan/wsi: Fix Windows build

The headless path doesn't build for Windows (yet, anyway).

Fixes: d4a2c0fc ("vulkan/wsi: add a headless swapchain implementation/option")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Giancarlo Devich <gdevich@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21932>

16 months agoiris: implement TES distribution mode WA 22012785325
Anuj Phogat [Mon, 24 May 2021 18:19:36 +0000 (11:19 -0700)]
iris: implement TES distribution mode WA 22012785325

Set TEDMODE_RR_STRICT when TEEnable is set.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21899>

16 months agoanv: implement TES distribution mode WA 22012785325
Anuj Phogat [Mon, 24 May 2021 18:27:35 +0000 (11:27 -0700)]
anv: implement TES distribution mode WA 22012785325

Set TEDMODE_RR_STRICT when TEEnable is set.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21899>

16 months agoasahi: replace copies of .clang-format with symlinks
Eric Engestrom [Thu, 16 Mar 2023 10:03:06 +0000 (10:03 +0000)]
asahi: replace copies of .clang-format with symlinks

Avoid all the issues of having to keep them in sync, and few-enough
people (read: probably no-one ever) will be working on the asahi driver
from a Windows machine, so symlinks can be relied upon, especially for
something optional like automatic code formatting.

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

16 months agoradv/rt: Don't upload the prolog twice.
Tatsuyuki Ishi [Thu, 16 Mar 2023 06:32:48 +0000 (15:32 +0900)]
radv/rt: Don't upload the prolog twice.

radv_shader_create already calls radv_shader_binary_upload.

Fixes: 4b92a532859 ("radv: add radv_create_rt_prolog()")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21945>

16 months agov3dv/ci: fix test name (`,Fail` is not part of the test name)
Eric Engestrom [Thu, 16 Mar 2023 10:56:05 +0000 (10:56 +0000)]
v3dv/ci: fix test name (`,Fail` is not part of the test name)

Fixes: a0bf0adade0b23f72d69 ("ci/broadcom: move rare failure to the flakes")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21954>

16 months agozink/ci: update the radv expectations
Martin Roukala (né Peres) [Tue, 7 Mar 2023 07:46:23 +0000 (09:46 +0200)]
zink/ci: update the radv expectations

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21873>

16 months agozink/ci: increase the parallelism of zink-radv-vangogh-valve
Martin Roukala (né Peres) [Mon, 6 Mar 2023 13:30:49 +0000 (15:30 +0200)]
zink/ci: increase the parallelism of zink-radv-vangogh-valve

It current takes 17 minutes to run this job, which is above the 15
minutes target for Mesa CI. Let's increase the parallelism to reduce
exec time to closer to 13 minutes.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21873>

16 months agoradv/ci: reduce the parallelism for vkcts-vangogh
Martin Roukala (né Peres) [Mon, 6 Mar 2023 13:29:16 +0000 (15:29 +0200)]
radv/ci: reduce the parallelism for vkcts-vangogh

We are about to enable pre-merge testing for radv-zink on vangogh,
which would mean the steam decks would be used for the following jobs:

 * Mesa pre-merge CI:
  * zink: 3 (~12 minutes)
 * Mesa Post-merge CI:
   * vkcts: 4 (~30 minutes)
   * vkd3d: 1 (~5 minutes)
 * DXVK CI: 1 (takes ~4 hours)

This means we could have 9 jobs running at the same time on steam
decks, despite only having 6 available. By reducing the number of decks
allocated for VKCTS runs from 4 to 2, we get closer to the actual
availability, and since vkd3d is so short + DXVK CI runs so
infrequently, we should never have to wait for a deck for too long!

Unfortunately, with the change of parallelism, a known flake started
failing more consistently, so I added it to the flakes list.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Signed-off-by: Martin Roukala (né Peres) <martin.roukala@mupuf.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21873>

16 months agomeson: correct typo in comment
Erik Faye-Lund [Mon, 13 Mar 2023 08:04:33 +0000 (09:04 +0100)]
meson: correct typo in comment

Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21868>

16 months agovirgl: Lower binding start into buffer indices
Gert Wollny [Mon, 27 Feb 2023 16:17:54 +0000 (17:17 +0100)]
virgl: Lower binding start into buffer indices

This requires that we limit the number of max combinded SSBOs to 31,
otherwisewe shaders that use SSBO binding points with higher values
will break on the host.

Fixes CTS:
  KHR-GL43.shader_storage_buffer_object.basic-atomic-case1
  KHR-GL43.shader_storage_buffer_object.basic-atomic-case2
  KHR-GL43.shader_storage_buffer_object.advanced-indirectAddressing-case2
  KHR-GL43.shader_storage_buffer_object.advanced-usage-case1
  KHR-GL43.shader_storage_buffer_object.advanced-usage-sync
  KHR-GL43.shader_storage_buffer_object.advanced-matrix

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

16 months agontt: add option to lower SSBO bindings to buffer index
Gert Wollny [Mon, 27 Feb 2023 16:15:45 +0000 (17:15 +0100)]
ntt: add option to lower SSBO bindings to buffer index

When a shader uses SSBOs in various shader stages, then we have to track
the binding locations in order to be able to properly bind these SSBOs.

Therefore add a flag that enables adding the start index of the bindings to
the SSBO index.

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

16 months agovirgl: Don't try to do re-alloc or readback by transfer for blob resources
Gert Wollny [Mon, 27 Feb 2023 11:53:19 +0000 (12:53 +0100)]
virgl: Don't try to do re-alloc or readback by transfer for blob resources

Blob resources are mapped directly, no need to copy data around, and
in any case, neither the resource nor the transfer info will have an
IOV attached to it, so the transfer would result error out on the host
anyway.

In addition, blob resources should not use re-allocation.

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

16 months agovirgl: Enable AMD_vertex_shader_(layer|viewport_index) when host supports it
Gert Wollny [Wed, 22 Feb 2023 16:58:58 +0000 (17:58 +0100)]
virgl: Enable AMD_vertex_shader_(layer|viewport_index) when host supports it

This increase the number of cases when the texture upload from buffer
can use the PBO upload code path.

v2: Fix logic combination (Corentin)

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

16 months agoanv: use vk_get_physical_device_features
Constantine Shablya [Thu, 9 Mar 2023 07:18:12 +0000 (09:18 +0200)]
anv: use vk_get_physical_device_features

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21754>

16 months agopanvk: Use vk_get_physical_device_features
Alyssa Rosenzweig [Mon, 13 Feb 2023 00:13:55 +0000 (19:13 -0500)]
panvk: Use vk_get_physical_device_features

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21754>

16 months agovulkan: use vk_features for vk_device::enabled_features
Constantine Shablya [Wed, 15 Mar 2023 14:04:22 +0000 (16:04 +0200)]
vulkan: use vk_features for vk_device::enabled_features

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21754>

16 months agovulkan: add hepler for vkGetPhysicalDeviceFeatures2
Constantine Shablya [Wed, 15 Mar 2023 15:44:46 +0000 (17:44 +0200)]
vulkan: add hepler for vkGetPhysicalDeviceFeatures2

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21754>

16 months agovulkan: delete trailing namespace
Constantine Shablya [Wed, 15 Mar 2023 15:45:58 +0000 (17:45 +0200)]
vulkan: delete trailing namespace

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21754>

16 months agovulkan: tidy up vk_physical_device_features
Constantine Shablya [Wed, 15 Mar 2023 15:38:51 +0000 (17:38 +0200)]
vulkan: tidy up vk_physical_device_features

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21754>

16 months agovulkan: relocate rmv to its correct home
Constantine Shablya [Wed, 15 Mar 2023 14:03:49 +0000 (16:03 +0200)]
vulkan: relocate rmv to its correct home

Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21754>

16 months agoradeonsi: monolithic TCS emit tessfactor in nir directly
Qiang Yu [Tue, 14 Feb 2023 04:01:46 +0000 (12:01 +0800)]
radeonsi: monolithic TCS emit tessfactor in nir directly

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21437>

16 months agoradeonsi: lower nir_load_ring_tess_factors_offset_amd
Qiang Yu [Tue, 14 Feb 2023 07:54:48 +0000 (15:54 +0800)]
radeonsi: lower nir_load_ring_tess_factors_offset_amd

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21437>

16 months agoac/llvm,radeonsi: lower nir_load_ring_tess_factors_amd
Qiang Yu [Tue, 14 Feb 2023 07:26:56 +0000 (15:26 +0800)]
ac/llvm,radeonsi: lower nir_load_ring_tess_factors_amd

No one implement this intrinsic in llvm, so remove the
llvm entry too.

This will be used in TCS nir tess factor write.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21437>

16 months agoac/nir: handle tess factor output missing case
Qiang Yu [Tue, 14 Mar 2023 07:01:19 +0000 (15:01 +0800)]
ac/nir: handle tess factor output missing case

tcs_tess_lvl_(in|out)_loc may be not set if user miss tess
factor output.

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

16 months agoac/nir: init tess factor location with IO remap
Qiang Yu [Wed, 15 Feb 2023 11:21:55 +0000 (19:21 +0800)]
ac/nir: init tess factor location with IO remap

Radeonsi is going to use nir tess factor write, so need to
remap tess factor location.

RADV set tess factor driver location to be 0 and 1 in
get_linked_variable_location(). While radeonsi also set them
to be 0 and 1 in st->map_io aka. si_shader_io_get_unique_index_patch().

We could just set them to be 0 and 1 at the beginning of
ac_nir_lower_hs_outputs_to_mem(), but in order to keep the
location map at the same place, we still do this in
lower_hs_output_store().

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

16 months agoac/nir: tcs write tess factor support pass by reg
Qiang Yu [Tue, 14 Feb 2023 02:48:18 +0000 (10:48 +0800)]
ac/nir: tcs write tess factor support pass by reg

For radeonsi usage.

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21437>

16 months agoac/nir: move store_var_components to common place
Qiang Yu [Tue, 14 Feb 2023 02:19:44 +0000 (10:19 +0800)]
ac/nir: move store_var_components to common place

It will be shared by other nir lowering too.

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

16 months agopanfrost: Don't round up Midgard polygon list BOs
Alyssa Rosenzweig [Mon, 31 Oct 2022 01:37:51 +0000 (21:37 -0400)]
panfrost: Don't round up Midgard polygon list BOs

Rounding up the polygon list BO can waste large amounts of memory. In a common
case I observed, it rounded up 11MB to 16MB, wasting 5MB. That adds up quickly
across processes, especially on the 2GB machines.

This only applies to Midgard. On Bifrost and newer, the driver does not
explicitly allocate this data structure. Cc stable because this rounding is
incorrect and the increase in RAM usage can cause real problems (especially
given how slow the shrinker is).

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21831>

16 months agoglsl: allow 64-bit integer on RHS of shift
Timothy Arceri [Wed, 15 Mar 2023 04:18:46 +0000 (15:18 +1100)]
glsl: allow 64-bit integer on RHS of shift

Fixes: 9ba9a7f854dd ("glsl: Add 64-bit integer support to some operations.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6862

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

16 months agoaco: remove aco::rt_stack variable
Daniel Schürmann [Tue, 14 Mar 2023 23:14:07 +0000 (00:14 +0100)]
aco: remove aco::rt_stack variable

Since we initialize scratch in the RT proglog,
there is no need for this variable anymore.

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

16 months agoradv/rt: use prolog for raytracing shaders
Daniel Schürmann [Tue, 21 Feb 2023 16:37:04 +0000 (17:37 +0100)]
radv/rt: use prolog for raytracing shaders

Co-authored-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21780>

16 months agoradv/rt: Add shader config combination/postprocessing utils
Friedrich Vock [Tue, 7 Mar 2023 20:28:16 +0000 (21:28 +0100)]
radv/rt: Add shader config combination/postprocessing utils

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

16 months agoradv: Emit RT shader VA user SGPR
Friedrich Vock [Tue, 7 Mar 2023 17:21:45 +0000 (18:21 +0100)]
radv: Emit RT shader VA user SGPR

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

16 months agoradv: compile rt_prolog
Daniel Schürmann [Tue, 21 Feb 2023 14:02:31 +0000 (15:02 +0100)]
radv: compile rt_prolog

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

16 months agoradv: add radv_create_rt_prolog()
Daniel Schürmann [Tue, 21 Feb 2023 13:21:39 +0000 (14:21 +0100)]
radv: add radv_create_rt_prolog()

Co-authored-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21780>

16 months agoaco: implement select_rt_prolog()
Daniel Schürmann [Thu, 26 Jan 2023 14:58:01 +0000 (15:58 +0100)]
aco: implement select_rt_prolog()

Co-authored-by: Friedrich Vock <friedrich.vock@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21780>