platform/upstream/mesa.git
2 years agomesa: handle atomic counter lowering for drivers with big ssbo offset aligns
Mike Blumenkrantz [Fri, 27 May 2022 17:34:09 +0000 (13:34 -0400)]
mesa: handle atomic counter lowering for drivers with big ssbo offset aligns

according to the spec, atomic counters can be bound at any offset divisible by 4,
which means that any driver that uses the ssbo lowering pass and doesn't have
a min offset align of 4 is potentially broken

to handle this, use a statevar to inject the misaligned remainder of the offset
into the shader as a uniform. for well-aligned counter binds, the uniform offset
will be 0

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

2 years agost/glsl_to_nir: call st_set_prog_affected_state_flags() as late as possible
Mike Blumenkrantz [Thu, 2 Jun 2022 21:44:34 +0000 (17:44 -0400)]
st/glsl_to_nir: call st_set_prog_affected_state_flags() as late as possible

this function should be called late to allow for other passes potentially
making changes which affect the states in use by shaders

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

2 years agomesa: conditionally set constants dirty for atomic counter binds
Mike Blumenkrantz [Fri, 27 May 2022 17:33:14 +0000 (13:33 -0400)]
mesa: conditionally set constants dirty for atomic counter binds

this is necessary for updating the offset uniforms

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

2 years agomesa: add statevar for atomic counter offsets
Mike Blumenkrantz [Fri, 27 May 2022 17:30:11 +0000 (13:30 -0400)]
mesa: add statevar for atomic counter offsets

some hardware can't do a ssbo offset=4, as required by the atomic->ssbo
lowering pass, so for these cases an offset can be passed for the counter
as a uniform, and the shaders can be adjusted accordingly

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

2 years agor300: merge simple movs with constant swizzles together
Pavel Ondračka [Fri, 20 May 2022 09:11:07 +0000 (11:11 +0200)]
r300: merge simple movs with constant swizzles together

This pass will merge instructions like these

MOV output[0].x, temp[5].x___;
MOV output[0].yzw, none._001;

into

MOV output[0].xyzw, temp[5].x001;

It is currently very careful with control flow and dependency
tracking, so there is still room for improvements.

Shader-db stats with RV530:
total instructions in shared programs: 132486 -> 132256 (-0.17%)
instructions in affected programs: 6186 -> 5956 (-3.72%)
helped: 65
HURT: 0
total temps in shared programs: 18035 -> 18014 (-0.12%)
temps in affected programs: 295 -> 274 (-7.12%)
helped: 22
HURT: 1

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16657>

2 years agor300: don't check for unitialized reads when rewriting register
Filip Gawin [Sat, 12 Feb 2022 23:28:36 +0000 (00:28 +0100)]
r300: don't check for unitialized reads when rewriting register

This fixes the "Rewrite of inst X failed Can't allocate source
for Inst X src_type=X new_index=X new_mask=X" errors.

The compiler is quite strict when rewriting registers during
the pair allocation and checks that all of the reads of it are
initialized. However the spec doesn't enfore that, and
specifically with control flow depending on user input we can't
really know...

In the following example temp[4].x is written only in one branch,
that might or might not be taken, but this is enough to keep the
compiler happy:

IF aluresult.x___;
   MAD temp[4].x, src0.1__, src0.111, src0.000
ENDIF;
src0.xyz = temp[4], src0.w = temp[4]
MAD color[0].xyz, src0.xyz, src0.111, src0.000
MAD color[0].w, src0.w, src0.1, src0.0

After switch to ntt, more IFs are converted to CMP, and the color
write looks like this. Please note that the CMP here is not TGSI
opcode but rather our US_OP_RGB_CMP: src2 >= 0 ? src0 : src1

src0.xyz = temp[4], src0.w = temp[4], src1.xyz = temp[3], src1.w = temp[12], src2.xyz = temp[2]
CMP color[0].xyz, src0.xyz, src1.xyz, -src2.xxx
CMP color[0].w, src0.w, src1.w, -src2.x

At this point temp[4].x is undefined. Now when compiler tries to
allocate register for temp[4] at some previous instruction, it will
find out that it is used as a source in the final CMP and bail out.
Instead of increasing the complexitty even more trying to account for
this, just get rid of the check completelly.

Fixes:
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_subscript_write_component_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_subscript_write_direct_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_subscript_write_dynamic_subscript_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_subscript_write_static_loop_subscript_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec2_dynamic_subscript_write_static_subscript_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_component_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_direct_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_dynamic_subscript_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_static_loop_subscript_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec3_dynamic_subscript_write_static_subscript_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec4_dynamic_subscript_write_component_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec4_dynamic_subscript_write_direct_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec4_dynamic_subscript_write_dynamic_subscript_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec4_dynamic_subscript_write_static_loop_subscript_read_fragment,Fail
dEQP-GLES2.functional.shaders.indexing.vector_subscript.vec4_dynamic_subscript_write_static_subscript_read_fragment,Fail

Reviewed-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16657>

2 years agor300: Update list of RV515 dEQP failures and add some flakes
Pavel Ondračka [Thu, 19 May 2022 08:32:56 +0000 (10:32 +0200)]
r300: Update list of RV515 dEQP failures and add some flakes

The fixes are mostly from 23dfae4c810e5e31cea647b7803700b0fcd4eb96

dEQP-GLES2.functional.fragment_ops.depth_stencil tests show random
flakes. The ones in failures are showing unexpected pass, however other
random test failures from the same group keep showing so just mark it
all as flakes.

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16657>

2 years agor300: don't try to use inline constants instead of constant swizzles
Pavel Ondračka [Thu, 19 May 2022 10:38:01 +0000 (12:38 +0200)]
r300: don't try to use inline constants instead of constant swizzles

It doesn't make sense and was not working anyway. This was spotted
by Filip Gawin in https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13978
however the fix there was IMO just papering over the problem.

I don't believe that this could manifest as a real issues, because
when all of the swizzles were constant the file would be set to
RC_FILE_NONE already. So in theory this could lead to an issue only
in the close to impossible circumstance that the out of bounds memory
read by constant->u.Immediate[swz] would end with the same exact value
as another inlineable constant in different channel. However in some
circumstances it would lead to following valgrind warnings:

 Conditional jump or move depends on uninitialised value(s)
    at 0x5D4E690: ieee_754_to_r300_float (radeon_inline_literals.c:61)
    by 0x5D4E690: rc_inline_literals (radeon_inline_literals.c:133)
    by 0x5D3877A: rc_run_compiler_passes (radeon_compiler.c:436)
    by 0x5D38821: rc_run_compiler (radeon_compiler.c:458)
    by 0x5D4AF63: r3xx_compile_fragment_program (r3xx_fragprog.c:139)
    by 0x5D48377: r300_translate_fragment_shader (r300_fs.c:499)
    by 0x5D491B0: r300_pick_fragment_shader (r300_fs.c:601)
    by 0x5D2BFEE: r300_create_fs_state (r300_state.c:1072)
    by 0x57DDC36: st_create_nir_shader (st_program.c:538)
    by 0x57DF10E: st_create_fp_variant (st_program.c:1056)
    by 0x57E057C: st_get_fp_variant (st_program.c:1102)
    by 0x57E0AB1: st_precompile_shader_variant (st_program.c:1287)
    by 0x57E0AB1: st_finalize_program (st_program.c:1333)
    by 0x57CB6F3: st_link_nir (st_glsl_to_nir.cpp:958)

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16657>

2 years agor300: be less agresive with copy propagate in loops
Pavel Ondračka [Fri, 13 May 2022 07:11:27 +0000 (09:11 +0200)]
r300: be less agresive with copy propagate in loops

When there are multiple MOVs with the same destination in loop
in different branches and some readers after the loop, we would
now errorneously copy propagate the last MOV, like in the following
snippet:

BGNLOOP;
  ...
  IF temp[3].x___;
    MOV temp[2], const[1].yxxy;
    BRK;
  ENDIF;
  IF temp[4].x___;
    MOV temp[2], const[1].xyxy;
    BRK;
  ENDIF;
  ...
  MOV temp[2], const[1].xyxy;
ENDLOOP;
ADD_SAT temp[0], temp[2], temp[1];

into:

BGNLOOP;
  ...
  IF temp[3].x___;
    MOV temp[2], const[1].yxxy;
    BRK;
  ENDIF;
  IF temp[3].y___;
    MOV temp[2], const[1].xyxy;
    BRK;
  ENDIF;
  ...
ENDLOOP;
ADD_SAT temp[0], const[1].xyxy, temp[1];

We need the copy propagate just for simple cleanups after ttn,
anything more complex should have been handled already in NIR.
So just bail out if any of the readers is after the loop.

No changes in shader-db.

Fixes few piglit tests when loop unrolling is disabled:
spec@glsl-1.10@execution@vs-loop-complex-unroll
spec@glsl-1.10@execution@vs-loop-complex-unroll-nested-break
spec@glsl-1.10@execution@vs-loop-complex-unroll-with-else-break

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6467
Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16657>

2 years agor300: deduplicate common NIR options
Pavel Ondračka [Thu, 19 May 2022 07:49:05 +0000 (09:49 +0200)]
r300: deduplicate common NIR options

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16657>

2 years agomesa/st: bump param reservation to 28
Mike Blumenkrantz [Fri, 3 Jun 2022 13:52:29 +0000 (09:52 -0400)]
mesa/st: bump param reservation to 28

now d3d12 is hitting it, so here we go

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

2 years agovirgl: add some ci flakes
Mike Blumenkrantz [Sun, 5 Jun 2022 13:04:39 +0000 (09:04 -0400)]
virgl: add some ci flakes

issue #6614

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

2 years agoclc: Fix build with llvm-15.
Vinson Lee [Wed, 1 Jun 2022 04:24:15 +0000 (21:24 -0700)]
clc: Fix build with llvm-15.

opencl_c_h is defined only for llvm < 15.

Fixes: bcc2df48905 ("clc: speed up compilation by not relying on opencl-c.h")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16808>

2 years agod3d12: skip time-elapsed piglit tests in ci
Mike Blumenkrantz [Sat, 4 Jun 2022 13:12:15 +0000 (09:12 -0400)]
d3d12: skip time-elapsed piglit tests in ci

flaky

Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16866>

2 years agoglsl: remove the now unused GLSL IR loop unrolling code
Timothy Arceri [Fri, 6 May 2022 02:28:33 +0000 (12:28 +1000)]
glsl: remove the now unused GLSL IR loop unrolling code

This code was slow, buggy and hard to understand. All drivers
have now switched to using the NIR unrolling code \o/

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agogallium: remove PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT CAP
Timothy Arceri [Fri, 6 May 2022 02:13:44 +0000 (12:13 +1000)]
gallium: remove PIPE_SHADER_CAP_MAX_UNROLL_ITERATIONS_HINT CAP

This is used for the old, buggy and slow GLSL IR loop unrolling
code. All drivers have now switched to the NIR unrolling code so
here we remove the CAP.

Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agosvga: disable GLSL IR loop unrolling
Timothy Arceri [Fri, 6 May 2022 02:09:09 +0000 (12:09 +1000)]
svga: disable GLSL IR loop unrolling

NIR loop unrolling is already enabled so just let it do its job.

Here we also fix up the force unroll settings.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agonouveau/nvc0: disable GLSL IR loop unrolling
Timothy Arceri [Fri, 6 May 2022 01:52:31 +0000 (11:52 +1000)]
nouveau/nvc0: disable GLSL IR loop unrolling

NIR loop unrolling is already enabled so just let it do its job.

Shader-db results (nv120):

total gpr in shared programs: 893490 -> 893898 (0.05%)
gpr in affected programs: 15338 -> 15746 (2.66%)
total instructions in shared programs: 6243205 -> 6237068 (-0.10%)
instructions in affected programs: 71160 -> 65023 (-8.62%)
total bytes in shared programs: 66729616 -> 66664760 (-0.10%)
bytes in affected programs: 759328 -> 694472 (-8.54%)

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agonouveau/nv50: disable GLSL IR loop unrolling
Timothy Arceri [Fri, 6 May 2022 01:50:42 +0000 (11:50 +1000)]
nouveau/nv50: disable GLSL IR loop unrolling

NIR loop unrolling is already enabled so just let it do its job.

Shader-db results (nv92):

total gpr in shared programs: 734638 -> 735037 (0.05%)
gpr in affected programs: 11058 -> 11457 (3.61%)
total instructions in shared programs: 6073415 -> 6073398 (<.01%)
instructions in affected programs: 10079 -> 10062 (-0.17%)
total bytes in shared programs: 41837432 -> 41838872 (<.01%)
bytes in affected programs: 252504 -> 253944 (0.57%)

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agonouveau/nv30: disable GLSL IR loop unrolling
Timothy Arceri [Fri, 6 May 2022 01:47:11 +0000 (11:47 +1000)]
nouveau/nv30: disable GLSL IR loop unrolling

NIR loop unrolling is already enabled so just let it do its job.

Shader-db results (nv40):

total instructions in shared programs: 17446532 -> 17446068 (<.01%)
instructions in affected programs: 15532 -> 15068 (-2.99%)
total gpr in shared programs: 82658 -> 82801 (0.17%)
gpr in affected programs: 1680 -> 1823 (8.51%)

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agolima: switch to NIR loop unrolling
Timothy Arceri [Fri, 6 May 2022 01:44:31 +0000 (11:44 +1000)]
lima: switch to NIR loop unrolling

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agolima: fixup nir indirect unroll options to match gallium CAP
Timothy Arceri [Wed, 18 May 2022 06:33:37 +0000 (16:33 +1000)]
lima: fixup nir indirect unroll options to match gallium CAP

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agolima: lower all undefs to zero in vs
Timothy Arceri [Wed, 18 May 2022 05:32:09 +0000 (15:32 +1000)]
lima: lower all undefs to zero in vs

Otherwise we will later hit:

gpir_error("nir_ssa_undef_instr is not supported\n");

Unfortunatly this causes a piglit failure due to increased register
pressure in an unrealistic shader but since not doing this can
result in hitting the not supported error in more relistic shaders
this seems the right thing to do for now.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agofreedreno: switch to NIR loop unrolling
Timothy Arceri [Fri, 6 May 2022 01:38:09 +0000 (11:38 +1000)]
freedreno: switch to NIR loop unrolling

Force unroll setting based on GLSL IR settings:

   case PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR:
   case PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR:
   case PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR:
   case PIPE_SHADER_CAP_INDIRECT_CONST_ADDR:
      /* a2xx compiler doesn't handle indirect: */
      return is_ir3(screen) ? 1 : 0;

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agofreedreno/ir3: tidy up duplication of common nir options
Timothy Arceri [Wed, 18 May 2022 06:00:42 +0000 (16:00 +1000)]
freedreno/ir3: tidy up duplication of common nir options

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agogallivm: disable GLSL IR loop unrolling in LLVMPIPE
Timothy Arceri [Fri, 6 May 2022 01:17:38 +0000 (11:17 +1000)]
gallivm: disable GLSL IR loop unrolling in LLVMPIPE

The NIR unroller is already enabled so just allow it to do its job.

We add a new failure here because llvmpipe fails to handle a
shader that is no longer unrolled.

Previously GLSL IR could unroll the loop because it only had a
single break. However once lower_returns passes over the shader
it ends up with more than 2 breaks making it no longer possible
to unroll. This is a disadvantage of doing the unrolling in NIR
however in practice we don't see shaders in the wild with multiple
returns inside loops.

Being unable to handle this loop is an existing bug with llvmpipe
exposed by the loop no longer being unrolled.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16366>

2 years agopanfrost: Launch transform feedback shaders
Alyssa Rosenzweig [Fri, 1 Apr 2022 21:23:09 +0000 (17:23 -0400)]
panfrost: Launch transform feedback shaders

We now have infrastructure in place to generate variants of vertex shaders
specialized for transform feedback. All that's left is launching these
compute-like kernels before the IDVS job, implementing both the
transform feedback and the regular rasterization pipeline. This implements
transform feedback on Valhall, passing the relevant GLES3.1 tests.

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

2 years agopanfrost: Create transform feedback shaders
Alyssa Rosenzweig [Thu, 2 Jun 2022 14:51:16 +0000 (10:51 -0400)]
panfrost: Create transform feedback shaders

Valhall has no architectural support for transform feedback. So if a vertex
shader uses transform feedback, we need to split the shader into two: a pure
vertex stage and a compute-like transform feedback stage. This splitting
resembles the splitting we do for IDVS.

When compiling a vertex shader that uses transform feedback on Bifrost, also
compile the transform feedback variant. That variant (marked by internal=true)
will get its stores lowered by the NIR pass introduced earlier in this series.

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

2 years agopanfrost: Wire up transfrom feedback sysvals
Alyssa Rosenzweig [Fri, 1 Apr 2022 21:22:05 +0000 (17:22 -0400)]
panfrost: Wire up transfrom feedback sysvals

Wire the Gallium interface for transform feedback up to the system values that
will be fed into our lowering code. This is based on our existing transform
feedback implementation for Midgard.

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

2 years agopanfrost: Don't allow vertex shaders to have side effects
Alyssa Rosenzweig [Mon, 4 Apr 2022 19:58:10 +0000 (15:58 -0400)]
panfrost: Don't allow vertex shaders to have side effects

In both GL and VK, the driver may choose not to support vertex shaders with side
effects (SSBOs, atomics, images). Supporting this opens a can of worms for IDVS.
Neither freedreno nor the (Vulkan?) DDK advertise support, for this reason.
Apps should not be using this anti-feature anyway.

Stop advertising support.

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

2 years agopan/bi: Handle transform feedback intrinsics
Alyssa Rosenzweig [Fri, 1 Apr 2022 21:24:21 +0000 (17:24 -0400)]
pan/bi: Handle transform feedback intrinsics

Translate the intrinsics we introduced to lower away transform feedback into
Panfrost system values which the GL driver can handle.

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

2 years agopan/bi: Add transform feedback lowering pass
Alyssa Rosenzweig [Thu, 2 Jun 2022 14:50:54 +0000 (10:50 -0400)]
pan/bi: Add transform feedback lowering pass

Add a simple NIR-based implementation of transform feedback, appropriate for
OpenGL ES 3.1 class hardware (compute but no geometry or tessellation shaders).
Stores to varyings that will be captured are replaced by stores to transform
feedback buffers and some addressing math. This allows implementing the semantic
of transform feedback in a compute-like stage.

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

2 years agonir: Export nir_io_add_intrinsic_xfb_info
Alyssa Rosenzweig [Mon, 30 May 2022 15:43:03 +0000 (11:43 -0400)]
nir: Export nir_io_add_intrinsic_xfb_info

This is useful for drivers which wish to consume XFB information. These
hopefully-uncontroversial hunks are extracted from the much more controversial
"st,nir,radeons: Move nir_lower_io_passes to si_nir_lower_io" by Jason.

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

2 years agonir: Add transform feedback system values
Alyssa Rosenzweig [Fri, 1 Apr 2022 21:20:09 +0000 (17:20 -0400)]
nir: Add transform feedback system values

These will be used to facilitate transform feedback lowering for Panfrost,
although other backends could use the sysvals in the future.

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

2 years agoformat_utils: properly parenthesize macro params
Mike Blumenkrantz [Fri, 3 Jun 2022 20:32:39 +0000 (16:32 -0400)]
format_utils: properly parenthesize macro params

this otherwise breaks evaluation of the parameters on arm64

cc: mesa-stable

fixes #6496

Reviewed-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16860>

2 years agopanfrost: Use C11 static_assert for enums
Alyssa Rosenzweig [Fri, 3 Jun 2022 18:33:58 +0000 (14:33 -0400)]
panfrost: Use C11 static_assert for enums

Rather than asserting everything in an unused function, just do it in global
context with C11 static_asserts. This is a bit neater now that we depend on C11
projectwide.

Obvious follow-on from !16670.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16856>

2 years agomesa/st: bump param reservation to 20
Mike Blumenkrantz [Fri, 3 Jun 2022 13:52:29 +0000 (09:52 -0400)]
mesa/st: bump param reservation to 20

I was hitting the realloc assert, so increase this again

fixes (zink+tu):
KHR-GL46.geometry_shader.api.max_atomic_counter_buffers

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

2 years agomesa: improve relocation problem message
Mike Blumenkrantz [Fri, 3 Jun 2022 13:36:46 +0000 (09:36 -0400)]
mesa: improve relocation problem message

make it easier to immediately know what the problem is

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

2 years agoglsl: remove now unused lower_const_arrays_to_uniforms()
Timothy Arceri [Fri, 6 May 2022 12:45:24 +0000 (22:45 +1000)]
glsl: remove now unused lower_const_arrays_to_uniforms()

We now use a NIR version instead.

Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770>

2 years agoglsl: switch to NIR based implementation of lower_const_arrays_to_uniforms()
Timothy Arceri [Mon, 11 Oct 2021 11:31:25 +0000 (22:31 +1100)]
glsl: switch to NIR based implementation of lower_const_arrays_to_uniforms()

Shader-db results iris (BDW):

total instructions in shared programs: 17523543 -> 17513909 (-0.05%)
instructions in affected programs: 218091 -> 208457 (-4.42%)
helped: 69
HURT: 327
helped stats (abs) min: 2 max: 2919 x̄: 160.84 x̃: 12
helped stats (rel) min: 0.21% max: 96.88% x̄: 14.87% x̃: 6.40%
HURT stats (abs)   min: 1 max: 47 x̄: 4.48 x̃: 1
HURT stats (rel)   min: 0.10% max: 22.02% x̄: 3.33% x̃: 0.18%
95% mean confidence interval for instructions value: -45.02 -3.63
95% mean confidence interval for instructions %-change: -1.16% 1.47%
Inconclusive result (%-change mean confidence interval includes 0).

total loops in shared programs: 4875 -> 4868 (-0.14%)
loops in affected programs: 7 -> 0
helped: 7
HURT: 0
helped stats (abs) min: 1 max: 1 x̄: 1.00 x̃: 1
helped stats (rel) min: 100.00% max: 100.00% x̄: 100.00% x̃: 100.00%
95% mean confidence interval for loops value: -1.00 -1.00
95% mean confidence interval for loops %-change: -100.00% -100.00%
Loops are helped.

total cycles in shared programs: 858032406 -> 857984712 (<.01%)
cycles in affected programs: 22940290 -> 22892596 (-0.21%)
helped: 155
HURT: 312
helped stats (abs) min: 1 max: 49696 x̄: 1697.70 x̃: 62
helped stats (rel) min: <.01% max: 70.84% x̄: 5.60% x̃: 0.82%
HURT stats (abs)   min: 1 max: 19640 x̄: 690.54 x̃: 100
HURT stats (rel)   min: <.01% max: 217.23% x̄: 33.57% x̃: 0.92%
95% mean confidence interval for cycles value: -436.09 231.84
95% mean confidence interval for cycles %-change: 15.39% 25.75%
Inconclusive result (value mean confidence interval includes 0).

total spills in shared programs: 16289 -> 15205 (-6.65%)
spills in affected programs: 2753 -> 1669 (-39.38%)
helped: 9
HURT: 1

total fills in shared programs: 20347 -> 20324 (-0.11%)
fills in affected programs: 1642 -> 1619 (-1.40%)
helped: 9
HURT: 1

total sends in shared programs: 972151 -> 971960 (-0.02%)
sends in affected programs: 1910 -> 1719 (-10.00%)
helped: 25
HURT: 20
helped stats (abs) min: 1 max: 50 x̄: 9.00 x̃: 2
helped stats (rel) min: 0.87% max: 53.76% x̄: 13.89% x̃: 6.25%
HURT stats (abs)   min: 1 max: 8 x̄: 1.70 x̃: 1
HURT stats (rel)   min: 8.33% max: 200.00% x̄: 52.36% x̃: 33.33%
95% mean confidence interval for sends value: -8.19 -0.29
95% mean confidence interval for sends %-change: -1.07% 32.18%
Inconclusive result (%-change mean confidence interval includes 0).

LOST:   3
GAINED: 27

Note a small number of tests fail on lima and r300 after this patch.
However since we are doing the correct thing here and they only
fail due to a slight increase in instruction count pushing them
over their instruction count limit, we are defering that issue
to a different bug report for further discussion.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6540

Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770>

2 years agoglsl: move gl_nir_link_opts() call out of the st code
Timothy Arceri [Mon, 30 May 2022 23:55:02 +0000 (09:55 +1000)]
glsl: move gl_nir_link_opts() call out of the st code

Calling this directly in the linker code allows us to place it between
the varying linker and uniform linker calls which allows for better
optimisation/removal of uniforms.

Also in a later patch it allows us to insert a new nir based
lower_const_arrays_to_uniforms() call after the gl_nir_link_opts()
call. This is important because it allows the linking opts to
move constant arrays to later stages if possible before
lower_const_arrays_to_uniforms() turns them into uniforms.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6541

Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770>

2 years agoglsl: move common link time optimisation calls to linker code
Timothy Arceri [Mon, 30 May 2022 23:44:21 +0000 (09:44 +1000)]
glsl: move common link time optimisation calls to linker code

In the following patch we will move the users of this function to
this file too and make it static again.

Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770>

2 years agoglsl/nir: allow the nir linker to remove dead uniforms we created
Timothy Arceri [Mon, 11 Oct 2021 04:48:28 +0000 (15:48 +1100)]
glsl/nir: allow the nir linker to remove dead uniforms we created

Some backends lower constant arrays to uniforms in GLSL IR. These
create so called hidden uniforms. Since we know these are added
per stage it is safe to remove them if we detect they are dead.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770>

2 years agoglsl/nir: skip adding hidden uniforms to the remap tables
Timothy Arceri [Tue, 12 Oct 2021 02:38:46 +0000 (13:38 +1100)]
glsl/nir: skip adding hidden uniforms to the remap tables

The remap tables are used with the GL API so there is no need to
add hidden uniforms to them. Also when we switch to lowering some
constant arrays to uniforms in NIR in a following patch there
will no longer be enough room in the tables as we assign their
size in the GLSL IR linker not the NIR linker currently.

Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770>

2 years agonir: add nir based version of the lower_const_arrays_to_uniforms pass
Timothy Arceri [Sun, 10 Oct 2021 09:33:15 +0000 (20:33 +1100)]
nir: add nir based version of the lower_const_arrays_to_uniforms pass

Doing this in NIR should give better results, but also allows us to
stop calling more GLSL IR optimisations passes.

v2: Skip 8bit and 16bit type that would require further processing
    I believe this is an existing bug in the GLSL IR pass also.

v3: rebuild constant initialisers as we want to call this pass
    after nir has already lowered them and performed optimisations.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> (v1)
Acked-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16770>

2 years agozink: Use VK_USE_64_BIT_PTR_DEFINES to check for 64bit platforms.
Georg Lehmann [Fri, 3 Jun 2022 14:26:11 +0000 (16:26 +0200)]
zink: Use VK_USE_64_BIT_PTR_DEFINES to check for 64bit platforms.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6605

Cc: mesa-stable
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16853>

2 years agozink: add back kms handling
Mike Blumenkrantz [Wed, 1 Jun 2022 15:31:28 +0000 (11:31 -0400)]
zink: add back kms handling

removing this broke the ability to create system compositors

rework it a bit though so that kms handles are stored and destroyed
when the bo is freed

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16815>

2 years agoRevert "zink: remove drm_fd"
Mike Blumenkrantz [Wed, 1 Jun 2022 15:30:32 +0000 (11:30 -0400)]
Revert "zink: remove drm_fd"

This reverts commit c5960f64b139605dbefa34c2cc2a089ba00ae1e2.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16815>

2 years agozink: handle aux plane imports
Mike Blumenkrantz [Wed, 1 Jun 2022 19:46:27 +0000 (15:46 -0400)]
zink: handle aux plane imports

basically do nothing here and it magically works

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16822>

2 years agozink: rename a variable
Mike Blumenkrantz [Wed, 1 Jun 2022 19:20:30 +0000 (15:20 -0400)]
zink: rename a variable

no functional changes

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16822>

2 years agozink: represent plane offsets using offset from plane 0 vs size of plane
Mike Blumenkrantz [Wed, 1 Jun 2022 18:26:15 +0000 (14:26 -0400)]
zink: represent plane offsets using offset from plane 0 vs size of plane

this is a bit easier to keep track of

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16822>

2 years agozink: fix dmabuf plane layout struct scoping
Mike Blumenkrantz [Wed, 1 Jun 2022 18:12:16 +0000 (14:12 -0400)]
zink: fix dmabuf plane layout struct scoping

this struct needs to exist for all the scopes it's used in

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16822>

2 years agozink: Print the VkResult if vkCreateInstance fails
Adam Jackson [Fri, 3 Jun 2022 15:33:39 +0000 (11:33 -0400)]
zink: Print the VkResult if vkCreateInstance fails

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16854>

2 years agoci: disable unit tests
Mike Blumenkrantz [Fri, 3 Jun 2022 22:47:19 +0000 (18:47 -0400)]
ci: disable unit tests

Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16863>

2 years agopanfrost/ci: Mark draw_buffers_indexed.* as flakes
Alyssa Rosenzweig [Fri, 3 Jun 2022 18:23:04 +0000 (14:23 -0400)]
panfrost/ci: Mark draw_buffers_indexed.* as flakes

These keep flaking. Icecream95 observes the issue relates to AFBC in the
discussion of the flake in issue 6604. Until the root cause can be identified
and fixed, mark the tests as known flakes for CI.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16855>

2 years agokopper: use get_drawable_info path for non-x11 drawables
Mike Blumenkrantz [Wed, 1 Jun 2022 15:31:49 +0000 (11:31 -0400)]
kopper: use get_drawable_info path for non-x11 drawables

wayland surfaces need to take this path to get resizing right

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16814>

2 years agoegl/wayland: skip buffer creation on zink
Mike Blumenkrantz [Wed, 1 Jun 2022 20:34:32 +0000 (16:34 -0400)]
egl/wayland: skip buffer creation on zink

this happens through wsi, so don't create resources that aren't used

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16814>

2 years agoegl/wayland: manually swap backbuffer when using zink
Mike Blumenkrantz [Wed, 1 Jun 2022 14:47:27 +0000 (10:47 -0400)]
egl/wayland: manually swap backbuffer when using zink

this would usually occur through dri2_wl_swrast_commit_backbuffer(),
but zink triggers this functionality using vulkan wsi, which fails to
perform these updates as expected

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16814>

2 years agoRevert "radeon: hardcode uvd/vce encoder not_referenced value to false"
SureshGuttula [Mon, 30 May 2022 03:53:35 +0000 (09:23 +0530)]
Revert "radeon: hardcode uvd/vce encoder not_referenced value to false"

This reverts commit 96b276b3270f82ac90baea37301b96f900684860.

This patch enable SVC encoding support on VCE/UVD.

Signed-off-by: Suresh Guttula <suresh.guttula@amd.com>
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16768>

2 years agomicrosoft/clc: Fixes compiling of microsoft clc with mingw
Yonggang Luo [Thu, 5 May 2022 11:29:37 +0000 (19:29 +0800)]
microsoft/clc: Fixes compiling of microsoft clc with mingw

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>

2 years agodzn: Fixes compiling error by include `<unknwn.h>`
Yonggang Luo [Fri, 29 Apr 2022 21:30:22 +0000 (05:30 +0800)]
dzn: Fixes compiling error by include `<unknwn.h>`

In mingw's `<unknwn.h>`, it's defeind __REQUIRED_RPCNDR_H_VERSION__ to 475,
so that gcc/mingw won't raise compiling error that because directx/d3d12.h
define __REQUIRED_RPCNDR_H_VERSION__ to 500, but the maximal supported __REQUIRED_RPCNDR_H_VERSION__ in mingw
are 475.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>

2 years agodzn: Fixes compiling error when build with msys2/mingw
Yonggang Luo [Thu, 21 Apr 2022 12:35:29 +0000 (20:35 +0800)]
dzn: Fixes compiling error when build with msys2/mingw

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>

2 years agod3d12/wgl/test: Fixes wgl_tests.cpp for d3d12 with mingw
Yonggang Luo [Fri, 29 Apr 2022 19:05:23 +0000 (03:05 +0800)]
d3d12/wgl/test: Fixes wgl_tests.cpp for d3d12 with mingw

wgl needs dxguids/dxguids.h for correct GUID

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>

2 years agod3d12: `#include <windows.h>` instead `#include <Windows.h>` for building under linux...
Yonggang Luo [Mon, 2 May 2022 06:51:21 +0000 (14:51 +0800)]
d3d12: `#include <windows.h>` instead `#include <Windows.h>` for building under linux with mingw

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>

2 years agod3d12: Fixes compiling error by include `<unknwn.h>`
Yonggang Luo [Fri, 29 Apr 2022 19:11:04 +0000 (03:11 +0800)]
d3d12: Fixes compiling error by include `<unknwn.h>`

In mingw's `<unknwn.h>`, it's defeind __REQUIRED_RPCNDR_H_VERSION__ to 475,
so that gcc/mingw won't raise compiling error that because directx/d3d12.h
define __REQUIRED_RPCNDR_H_VERSION__ to 500, but the maximal supported __REQUIRED_RPCNDR_H_VERSION__ in mingw
are 475.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>

2 years agod3d12: Move shared code that include d3d12 headers into d3d12_common.h
Yonggang Luo [Fri, 29 Apr 2022 19:10:47 +0000 (03:10 +0800)]
d3d12: Move shared code that include d3d12 headers into d3d12_common.h

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>

2 years agod3d12: Fixes d3d12 compiling errors in `D3D12ResourceState.h` for mingw
Yonggang Luo [Fri, 29 Apr 2022 18:54:33 +0000 (02:54 +0800)]
d3d12: Fixes d3d12 compiling errors in `D3D12ResourceState.h` for mingw

```
In file included from ../../src/gallium/drivers/d3d12/D3D12ResourceState.cpp:24:
../../src/gallium/drivers/d3d12/D3D12ResourceState.h:51:45: error: call to non-'constexpr' function 'D3D12_RESOURCE_STATES operator|(D3D12_RESOURCE_STATES, D3D12_RESOURCE_STATES)'
   45 | D3D12_RESOURCE_STATE_RENDER_TARGET          |
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   46 | D3D12_RESOURCE_STATE_UNORDERED_ACCESS       |
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   47 | D3D12_RESOURCE_STATE_DEPTH_WRITE            |
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   48 | D3D12_RESOURCE_STATE_STREAM_OUT             |
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   49 | D3D12_RESOURCE_STATE_COPY_DEST              |
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   50 | D3D12_RESOURCE_STATE_RESOLVE_DEST           |
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   51 | D3D12_RESOURCE_STATE_VIDEO_DECODE_WRITE     |
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
   52 | D3D12_RESOURCE_STATE_VIDEO_PROCESS_WRITE;
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:/CI-Tools/msys64/mingw64/include/minwindef.h:163,
                 from C:/CI-Tools/msys64/mingw64/include/windef.h:9,
                 from C:/CI-Tools/msys64/mingw64/include/windows.h:69,
                 from C:/CI-Tools/msys64/mingw64/include/rpc.h:16,
                 from ../../subprojects/DirectX-Headers-1.0/include/directx/d3d12.h:26,
                 from ../../src/gallium/drivers/d3d12/D3D12ResourceState.h:33,
                 from ../../src/gallium/drivers/d3d12/D3D12ResourceState.cpp:24:
../../subprojects/DirectX-Headers-1.0/include/directx/d3d12.h:2865:1: note: 'D3D12_RESOURCE_STATES operator|(D3D12_RESOURCE_STATES, D3D12_RESOURCE_STATES)' declared here
 2865 | DEFINE_ENUM_FLAG_OPERATORS( D3D12_RESOURCE_STATES );
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~
```

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16767>

2 years agozink: disable compute pbos on turnip
Mike Blumenkrantz [Tue, 17 May 2022 03:41:41 +0000 (23:41 -0400)]
zink: disable compute pbos on turnip

this saves ~15 minutes in cts somehow

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16548>

2 years agomeson: Use a C99 STDC_VERSION for flex
Jesse Natalie [Thu, 2 Jun 2022 16:26:54 +0000 (09:26 -0700)]
meson: Use a C99 STDC_VERSION for flex

Fixes: 8575d0e8 ("meson: modernize win_flex stdint.h logic")
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16839>

2 years agoradv: Some acceleration structure cleanups
Konstantin Seurer [Mon, 30 May 2022 20:00:39 +0000 (22:00 +0200)]
radv: Some acceleration structure cleanups

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16782>

2 years agoradv: Add and use radv_cp_dma_wait_for_stages
Konstantin Seurer [Mon, 30 May 2022 20:02:47 +0000 (22:02 +0200)]
radv: Add and use radv_cp_dma_wait_for_stages

Adds a small helper for handling cp dma sync. This
Also adds the missing handling for some stage
flags in write_event.

Signed-off-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16782>

2 years agozink/codegen: do not automatically consider extensions promoted
Hoe Hao Cheng [Sun, 1 May 2022 10:03:52 +0000 (18:03 +0800)]
zink/codegen: do not automatically consider extensions promoted

...until an entry is added to VERSIONS in zink_device_info.py.

Now that we stop obtaining feature structs of promoted extensions when the VK
impl is new enough, it's possible for things to break when someone updates
vk.xml, and extensions get promoted but the codegen is not updated to include
e.g. info->feats13 and info->props13 (or newer) in zink_device_info

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16265>

2 years agozink/codegen: do not include compilation structs with extension structs
Hoe Hao Cheng [Sun, 1 May 2022 09:29:08 +0000 (17:29 +0800)]
zink/codegen: do not include compilation structs with extension structs

(compilation structs refer to VkPhysicalDeviceVulkanXYFeatures/Properties, as
they consist of all features added by extensions promoted in VK X.Y)

The spec prohibits this, so instead we map the fields in the compilation
structs onto the fields in extension structs.

Some extensions' feature/properties structs are not promoted, and the spec
allows including both compilation structs and extension structs in such cases.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16265>

2 years agozink/codegen: remember the fields in feats/props structs of extensions
Hoe Hao Cheng [Sun, 1 May 2022 09:22:36 +0000 (17:22 +0800)]
zink/codegen: remember the fields in feats/props structs of extensions

this will be useful in the next commit, where we reapply fields from one struct
to another.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16265>

2 years agost/mesa: use mutex in st_get_texture_sampler_view_from_stobj
Pierre-Eric Pelloux-Prayer [Thu, 19 May 2022 08:57:40 +0000 (10:57 +0200)]
st/mesa: use mutex in st_get_texture_sampler_view_from_stobj

st_texture_release_all_sampler_views uses the validate_mutex,
but st_get_texture_sampler_view_from_stobj didn't.

Since they both modify stObj->view we could have threadA in
st_get_texture_sampler_view_from_stobj with a non-NULL sv,
so expecting sv->view to be non-NULL, while threadB was in
st_texture_release_all_sampler_views clearing sv->view.

It's also needed to protect st_sampler_view::private_refcount,
which is supposed to be used from the owning context thread,
but can also be used by any context in st_texture_release_all_sampler_views.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6088
Fixes: ef5d4274132 ("st/mesa: add a mechanism to bypass atomics when binding sampler views")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16779>

2 years agoanv: use anv_cmd_dirty_mask_t type for dynamic state
Tapani Pälli [Fri, 3 Jun 2022 05:43:07 +0000 (08:43 +0300)]
anv: use anv_cmd_dirty_mask_t type for dynamic state

We were using both uint32_t and anv_cmd_dirty_mask_t, this is
a cleanup making type usage consistent. Commit also changes type of
the mask to be enum anv_cmd_dirty_bits.

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

2 years agomicrosoft/spirv_to_dxil: Fix the push_constant UBO size calculation
Boris Brezillon [Wed, 25 May 2022 08:18:32 +0000 (10:18 +0200)]
microsoft/spirv_to_dxil: Fix the push_constant UBO size calculation

Right now, we just consider the size of the accessed portion of the
push constant array, but it doesn't necessarily reflect the size
of the UBO we should declare.

Fixes: de1e941c5909 ("microsoft/spirv_to_dxil: Lower push constant loads to UBO loads")
Reviewed-by: Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16703>

2 years agomicrosoft/spirv_to_dxil: Fix push_constants type declaration
Boris Brezillon [Wed, 25 May 2022 08:05:26 +0000 (10:05 +0200)]
microsoft/spirv_to_dxil: Fix push_constants type declaration

We're not declaring an array of bytes but an array of uint32. Let's
fix the element_count we pass to glsl_array_type().

Fixes: de1e941c5909 ("microsoft/spirv_to_dxil: Lower push constant loads to UBO loads")
Reviewed-by: Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16703>

2 years agonir/opt_vectorize: refactor src rewriting to avoid unnecessary mov instructions
Daniel Schürmann [Tue, 29 Mar 2022 17:01:59 +0000 (19:01 +0200)]
nir/opt_vectorize: refactor src rewriting to avoid unnecessary mov instructions

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15647>

2 years agoradv: enable radv_zero_vram for Hammerting
Samuel Pitoiset [Thu, 2 Jun 2022 07:03:16 +0000 (09:03 +0200)]
radv: enable radv_zero_vram for Hammerting

This native Vulkan game is broken, it has TON of Vulkan validation
errors and hangs without RADV_DEBUG=zerovram. Also tested with PRO
and AMDVLK.

The application name is also not really descriptive but the executable
name 'boot.exe' is worst.

https://github.com/ValveSoftware/Proton/issues/4347#issuecomment-1141415515

Cc: mesa-stable
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16832>

2 years agospirv: Workaround for RelaxedPrecision on OpLogical* in 3DMark
Danylo Piliaiev [Fri, 27 May 2022 12:11:52 +0000 (15:11 +0300)]
spirv: Workaround for RelaxedPrecision on OpLogical* in 3DMark

Per spec RelaxedPrecision cannot be applied to bool types, however
3DMark Wild Life does it:

OpDecorate %171 RelaxedPrecision
...
%171 = OpLogicalAnd %bool %169 %170

Fixes crash in 3DMark Wild Life on Android.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16746>

2 years agomeson: add back -Werror=vla to msvc compat flags
Erik Faye-Lund [Mon, 23 May 2022 09:58:55 +0000 (11:58 +0200)]
meson: add back -Werror=vla to msvc compat flags

Back when STATIC_ASSERT was prepared for use in common code, the
-Werror=vla flag was removed from the MSVC compat flags. But now we're
using C++11 / C11 static asserts instead, so we can add it back again.

This should help us noticing some breakages before they happen.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agoutil: implement STATIC_ASSERT using c++11 / c11 primitives
Erik Faye-Lund [Mon, 23 May 2022 09:53:22 +0000 (11:53 +0200)]
util: implement STATIC_ASSERT using c++11 / c11 primitives

Since we now require C11 and C++14, we can use the standard
static_asserts from the standard library instead of rolling our own
compiler-specific versions.

To avoid needing scopes around usage in switch cases, keep the
while-wrapping from before. This means it still can't be used outside of
functions, but that should be fine; we should probably just use
static_assert directly in those cases anyway.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agoutil: use static_assert directly
Erik Faye-Lund [Tue, 31 May 2022 08:24:38 +0000 (10:24 +0200)]
util: use static_assert directly

For some reason, Clang doesn't love the STATIC_ASSERT implementation
we're about switch to in this *one* particular case. Other cases seems
to work fine, so let's just use static_assert directly here.

It lets us give a better error string anyway, so yay.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agobroadcom/compiler: use macro for power-of-two check
Erik Faye-Lund [Tue, 31 May 2022 11:20:00 +0000 (13:20 +0200)]
broadcom/compiler: use macro for power-of-two check

This will allow the use of static_assert here instead of our
compiler-specific implementation.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agointel/compiler: use macro for power-of-two check
Erik Faye-Lund [Tue, 31 May 2022 11:17:30 +0000 (13:17 +0200)]
intel/compiler: use macro for power-of-two check

This will allow the use of static_assert here instead of our
compiler-specific implementation.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agoutil: add IS_POT macro
Erik Faye-Lund [Tue, 31 May 2022 10:31:41 +0000 (12:31 +0200)]
util: add IS_POT macro

This macro kinda complements util_is_power_of_two_*, but is implemented
as a macro. This means that it can expand to a constant integral
expression, and thus be used in static_assert.

Because we don't really need the added complexity, this doesn't handle
zero correctly. But that's OK, because the call-sites will.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agov3dv: do not do STATIC_ASSERT on variables
Erik Faye-Lund [Mon, 23 May 2022 12:58:48 +0000 (14:58 +0200)]
v3dv: do not do STATIC_ASSERT on variables

Use an enum value instead, so it's guaranteed to be constant.

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agofreedreno: degrade STATIC_ASSERT to assert
Erik Faye-Lund [Mon, 23 May 2022 12:36:52 +0000 (14:36 +0200)]
freedreno: degrade STATIC_ASSERT to assert

dirty is a variable, and C standard doesn't guarantee that the compiler
can see that it's always passed a constant. So this isn't appropriate to
use for static_assert, which we're about to convert STATIC_ASSERT to
expand to.

If we really want to do this compile-time, we need to make
fd_context_dirty a macro instead. But it seems reaonable to just use a
run-time assert instead here.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agoiris: do not do STATIC_ASSERT on variables
Erik Faye-Lund [Mon, 23 May 2022 12:53:49 +0000 (14:53 +0200)]
iris: do not do STATIC_ASSERT on variables

Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agofreedreno: do not do STATIC_ASSERT on variables
Erik Faye-Lund [Mon, 23 May 2022 12:49:06 +0000 (14:49 +0200)]
freedreno: do not do STATIC_ASSERT on variables

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agofreedreno: do not use variable in STATIC_ASSERT
Erik Faye-Lund [Mon, 23 May 2022 12:11:12 +0000 (14:11 +0200)]
freedreno: do not use variable in STATIC_ASSERT

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agoturnip: do not do STATIC_ASSERT on a variable
Erik Faye-Lund [Mon, 23 May 2022 11:36:09 +0000 (13:36 +0200)]
turnip: do not do STATIC_ASSERT on a variable

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agopvr: do not use c_msvc_compat_args
Erik Faye-Lund [Mon, 23 May 2022 12:01:36 +0000 (14:01 +0200)]
pvr: do not use c_msvc_compat_args

This code isn't MSVC compatible, as it uses VLAs (for instance).

Until there's a reason to support MSVC, let's not even try. Otherwise,
we make it harder than needed to add flags to make the MSVC compat flags
more complete.

Reviewed-by: Karmjit Mahil <Karmjit.Mahil@imgtec.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16670>

2 years agoradv: Remove usage of `cnd_monotonic.h`
Yonggang Luo [Sat, 9 Apr 2022 13:53:03 +0000 (21:53 +0800)]
radv: Remove usage of `cnd_monotonic.h`

Improve: 91fe0b5629d ("radv: Delete lots of sync code.")

As cnd_monotonic.h are include `util/os_time.h`, radv_debug.c and radv_debug.c needs `util/os_time.h`
So include in these files directly.

The compiling errors are:
```
../src/amd/vulkan/radv_debug.c:707:12: error: implicit declaration of function 'os_localtime' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
   timep = os_localtime(&raw_time, &result);

../src/amd/vulkan/radv_device.c:97:11: error: implicit declaration of function 'os_time_get_nano' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
   return os_time_get_nano();
          ^

../../src/amd/vulkan/radv_pipeline.c: In function 'radv_create_shaders':
../../src/amd/vulkan/radv_pipeline.c:4119:29: error: implicit declaration of function 'os_time_get_nano' [-Werror=implicit-function-declaration]
 4119 |    int64_t pipeline_start = os_time_get_nano();
```

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16536>

2 years agoaux/trace: implement pipe_screen::is_compute_copy_faster
Mike Blumenkrantz [Fri, 13 May 2022 20:40:18 +0000 (16:40 -0400)]
aux/trace: implement pipe_screen::is_compute_copy_faster

stop crashing!

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

2 years agoaux/trace: fix sampler view dumping
Mike Blumenkrantz [Fri, 13 May 2022 16:29:24 +0000 (12:29 -0400)]
aux/trace: fix sampler view dumping

this should just dump the samplerview target, not the resource target too

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

2 years agozink: fix framebuffer attachment usage asserts for dummy attachments
Mike Blumenkrantz [Fri, 27 May 2022 14:04:05 +0000 (10:04 -0400)]
zink: fix framebuffer attachment usage asserts for dummy attachments

dummy attachments never overwrite existing attachments,
so they must be explicitly compared like this to avoid
erroneous crashing

Fixes: 3892c133811 ("zink: add an alternate path for EXT_color_write_enable usage")

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

2 years agonouveau/codegen: drop gallium headers from the interface.
Dave Airlie [Sat, 28 May 2022 04:23:18 +0000 (14:23 +1000)]
nouveau/codegen: drop gallium headers from the interface.

I know pipe defines are still used internally, but I'd want
better testing, before starting to remove that.

Acked-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Yusuf Khan<yusisamerican@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16763>

2 years agonouveau/codegen: drop all ubytes from codegen.
Dave Airlie [Mon, 30 May 2022 00:06:07 +0000 (10:06 +1000)]
nouveau/codegen: drop all ubytes from codegen.

There wasn't that many, so get rid of them in favour of real types.

Acked-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Yusuf Khan<yusisamerican@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16763>