mesa.git
4 years agomesa: Refactor the entirety of _mesa_format_matches_format_and_type().
Eric Anholt [Mon, 19 Aug 2019 22:17:58 +0000 (15:17 -0700)]
mesa: Refactor the entirety of _mesa_format_matches_format_and_type().

This function was difficult to implement for new formats due to the
combination of endianness and swapbytes support.  Since it's mostly
used for fast paths, bugs in it were often missed during testing.

Just reimplement it on top of the recent
_mesa_format_from_format_and_type() which can give us a canonical
MESA_FORMAT for a format and type enum (while respecting endianness).

Fixes:
- R4G4B4A4_UNORM, B4G4R4_UINT, R4G4B4A4_UINT incorrectly matched with
  swapBytes (you can't just reverse the channels if the channels
  aren't bytes)
- A4R4G4B4_UNORM and A4R4G4B4_UINT missing BGRA/4444_REV matches
- failing to match RGB/BGR unorm8 array formats on BE
2101010 formats incorrectly matching with swapBytes set.
- UINT/SINT byte formats failed to match with swapBytes set.

This deletes the part of tests/mesa_formats.cpp that called
_mesa_format_matches_format_and_type() to make sure it didn't
assertion fail, as it now would assertion fail due to the fact that we
were passing an invalid format (GL_RG) for most types.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
4 years agomesa: Add support for array formats of depth and stencil.
Eric Anholt [Wed, 18 Sep 2019 21:01:29 +0000 (14:01 -0700)]
mesa: Add support for array formats of depth and stencil.

In desktop GL, you can specify things like GL_DEPTH_COMPONENT/GL_BYTE as a
ReadPixels format, and we need to be able to represent that to see if we
have proper MESA_FORMATs for them.  That's exactly what the
mesa_array_format enum is for.

v2: Drop _mesa from static fn.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
4 years agomesa: Add format/type matching for DEPTH/UINT_24_8.
Eric Anholt [Wed, 18 Sep 2019 21:27:51 +0000 (14:27 -0700)]
mesa: Add format/type matching for DEPTH/UINT_24_8.

We had missed this case where GLES3 allows glReadPixels(DEPTH, UINT_24_8),
and just got lucky by the readpixels path never asking for the matching
format from this function.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
4 years agomesa: Fix depth/stencil ordering in _mesa_format_from_format_and_type().
Eric Anholt [Tue, 17 Sep 2019 21:54:48 +0000 (14:54 -0700)]
mesa: Fix depth/stencil ordering in _mesa_format_from_format_and_type().

The GL spec says the 24-bit component is in the high bits, and
format_unpack.c looks at the high 24 bits in the S8Z24 case, not
Z24SS8.

Avoids a regression in the next commit.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
4 years agomesa: Add debug info to _mesa_format_from_format_and_type() error path.
Eric Anholt [Wed, 18 Sep 2019 21:46:49 +0000 (14:46 -0700)]
mesa: Add debug info to _mesa_format_from_format_and_type() error path.

The unreachable() that follows isn't very useful for debug, and by adding
this here we get a nice description of the failure in debug builds.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
4 years agofreedreno/a6xx: Turn on geometry shaders
Kristian H. Kristensen [Fri, 11 Oct 2019 03:54:28 +0000 (20:54 -0700)]
freedreno/a6xx: Turn on geometry shaders

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ci: Add failing tests to skip list
Kristian H. Kristensen [Mon, 14 Oct 2019 02:32:37 +0000 (19:32 -0700)]
freedreno/ci: Add failing tests to skip list

Some queries are still failing and layered rending needs more work.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/a6xx: Implement PIPE_QUERY_PRIMITIVES_GENERATED for GS
Kristian H. Kristensen [Wed, 16 Oct 2019 19:08:19 +0000 (12:08 -0700)]
freedreno/a6xx: Implement PIPE_QUERY_PRIMITIVES_GENERATED for GS

When we don't have streamout enabled, we have to read this register to
get the number of primitives emitted.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/blitter: Save GS state
Kristian H. Kristensen [Fri, 11 Oct 2019 22:15:23 +0000 (15:15 -0700)]
freedreno/blitter: Save GS state

We have GS state now.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agost/mesa: Also enable GS when ESSLVersion > 320
Kristian H. Kristensen [Thu, 10 Oct 2019 18:27:47 +0000 (11:27 -0700)]
st/mesa: Also enable GS when ESSLVersion > 320

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/a6xx: Support layered render targets
Kristian H. Kristensen [Fri, 11 Oct 2019 20:56:20 +0000 (13:56 -0700)]
freedreno/a6xx: Support layered render targets

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/a6xx: Emit program state for GS
Kristian H. Kristensen [Fri, 11 Oct 2019 20:43:53 +0000 (13:43 -0700)]
freedreno/a6xx: Emit program state for GS

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: End VS with CHMASK and CHSH in GS pipelines
Kristian H. Kristensen [Fri, 11 Oct 2019 19:37:38 +0000 (12:37 -0700)]
freedreno/ir3: End VS with CHMASK and CHSH in GS pipelines

When used in a GS pipeline, the VS doesn't end with the END
instruction. Instead it chains to the GS, which continues running with
the same register allocation.  The intended use cases seems to be that
you can compile a regular VS (ie outputs in registers and ending with
END) but then tack on link-time generated code past the END to write
the outputs using STLW, in case the VS is used with GS.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: Start GS with (ss) and (sy)
Kristian H. Kristensen [Fri, 11 Oct 2019 19:36:49 +0000 (12:36 -0700)]
freedreno/ir3: Start GS with (ss) and (sy)

We don't know what kind of loads we might have to wait on when coming
in from chsh in the VS so set both sync flags.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: Pre-color GS header and primitive ID
Kristian H. Kristensen [Fri, 11 Oct 2019 19:34:54 +0000 (12:34 -0700)]
freedreno/ir3: Pre-color GS header and primitive ID

These sysvals have to be unclobbered by VS and in the same registers
in both VS and GS, since the chsh from VS to GS doesn't reload the
values. We use the pre-color argument to ir3_ra() to always place
these values in r0.x and r0.y.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: Setup ir3 inputs and outputs for GS
Kristian H. Kristensen [Fri, 11 Oct 2019 19:24:12 +0000 (12:24 -0700)]
freedreno/ir3: Setup ir3 inputs and outputs for GS

Inputs are the GS header, which contains vertex ID, local primitive ID
and thread ID as well as primitive ID. The setup is a little different
from other sysvals, since we always have to receive them in the VS so
that it can pass them on into the GS.

The vertex flag outputs from GS is set up as a proper nir output in
the lowering pass and doesn't need special handling here.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: Implement primitive layout intrinsics
Kristian H. Kristensen [Fri, 11 Oct 2019 04:02:45 +0000 (21:02 -0700)]
freedreno/ir3: Implement primitive layout intrinsics

This implements the load_vs_primitive_stride_ir3,
load_vs_vertex_stride_ir3 and load_primitive_location_ir3 intrinsics,
used for getting the primitive layout strides and locations.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: Implement lowering passes for VS and GS
Kristian H. Kristensen [Fri, 11 Oct 2019 00:17:10 +0000 (17:17 -0700)]
freedreno/ir3: Implement lowering passes for VS and GS

This introduces two new lowering passes. One to lower VS to explicit
outputs using STLW and one to lower GS to load input using LDLW and
implement the GS specific functionality.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: Add has_gs flag to shader key
Kristian H. Kristensen [Thu, 10 Oct 2019 22:37:19 +0000 (15:37 -0700)]
freedreno/ir3: Add has_gs flag to shader key

Since the presence of GS changes how the VS operates we need to track
that in the shader key.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/a6xx: Add missing adjacency primitives to table
Kristian H. Kristensen [Thu, 10 Oct 2019 22:24:10 +0000 (15:24 -0700)]
freedreno/a6xx: Add missing adjacency primitives to table

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: Add intrinsics that map to LDLW/STLW
Kristian H. Kristensen [Thu, 10 Oct 2019 22:15:37 +0000 (15:15 -0700)]
freedreno/ir3: Add intrinsics that map to LDLW/STLW

These intrinsics will let us do all the offset calculations in nir,
which is nicer to work with and lets nir_opt_algebraic eat it all up.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: Add new LDLW/STLW instructions
Kristian H. Kristensen [Thu, 10 Oct 2019 22:09:49 +0000 (15:09 -0700)]
freedreno/ir3: Add new LDLW/STLW instructions

These access memory used for passing data between geometry stages.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: Extend RA with mechanism for pre-coloring registers
Kristian H. Kristensen [Thu, 10 Oct 2019 21:43:03 +0000 (14:43 -0700)]
freedreno/ir3: Extend RA with mechanism for pre-coloring registers

We'll need to pre-color certain input registers betwee VS and GS
shaders.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: Use third register for offset for LDL and LDLV
Kristian H. Kristensen [Thu, 10 Oct 2019 20:44:14 +0000 (13:44 -0700)]
freedreno/ir3: Use third register for offset for LDL and LDLV

Before, offset held the offset, which can be either immediate or a
register.  Use a third register to hold the offset so that we can use
a register.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ir3: Add support for CHSH and CHMASK instructions
Kristian H. Kristensen [Thu, 10 Oct 2019 20:21:25 +0000 (13:21 -0700)]
freedreno/ir3: Add support for CHSH and CHMASK instructions

Just add the constructors for now and special case similar to END so
we don't remove them.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/a6xx: Trim a few regs from fd6_emit_restore()
Kristian H. Kristensen [Fri, 11 Oct 2019 19:17:54 +0000 (12:17 -0700)]
freedreno/a6xx: Trim a few regs from fd6_emit_restore()

We know what these do an either write them in the program stateobj or
don't need to write them.

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/registers: Update with GS, HS and DS registers
Kristian H. Kristensen [Thu, 10 Oct 2019 22:21:25 +0000 (15:21 -0700)]
freedreno/registers: Update with GS, HS and DS registers

Signed-off-by: Kristian H. Kristensen <hoegsberg@google.com>
4 years agofreedreno/ci: Ban texsubimage2d_pbo.r16ui_2d, due to two flakes reported.
Eric Anholt [Sun, 6 Oct 2019 02:46:38 +0000 (19:46 -0700)]
freedreno/ci: Ban texsubimage2d_pbo.r16ui_2d, due to two flakes reported.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Daniel Stone <daniels@collabora.com>
4 years agost/mesa: silence a warning in st_nir_lower_tex_src_plane
Marek Olšák [Thu, 17 Oct 2019 20:07:26 +0000 (16:07 -0400)]
st/mesa: silence a warning in st_nir_lower_tex_src_plane

trivial

4 years agogallium/u_blitter: remove an unused variable
Marek Olšák [Thu, 17 Oct 2019 20:07:02 +0000 (16:07 -0400)]
gallium/u_blitter: remove an unused variable

trivial

4 years agoradeonsi: recreate aux_context after a GPU reset
Marek Olšák [Wed, 16 Oct 2019 21:22:20 +0000 (17:22 -0400)]
radeonsi: recreate aux_context after a GPU reset

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agoradeonsi: call the reset callback if get_device_reset_status returns a failure
Marek Olšák [Wed, 16 Oct 2019 21:09:29 +0000 (17:09 -0400)]
radeonsi: call the reset callback if get_device_reset_status returns a failure

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agost/mesa: call the reset callback if glGetGraphicsResetStatus returns a failure
Marek Olšák [Wed, 16 Oct 2019 21:12:43 +0000 (17:12 -0400)]
st/mesa: call the reset callback if glGetGraphicsResetStatus returns a failure

so that we immediately set the no-op dispatch

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agointel/fs/gen12: Add tests for scoreboard pass
Caio Marcelo de Oliveira Filho [Fri, 4 Oct 2019 19:30:08 +0000 (12:30 -0700)]
intel/fs/gen12: Add tests for scoreboard pass

Tests the combinations of cases of RAW, WAW and WAR hazards involving
both inorder and outoforder instructions.  Also tests that
dependencies combine and propagate correctly through control
flow (loops and conditionals).

v2: Add an extra test illustrating that the non-logical CFG edge
    between then-block and else-block is being taking into
    account.  (Curro)

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
4 years agoaco: don't combine minmax3 if there is a neg or abs modifier in between
Daniel Schürmann [Thu, 17 Oct 2019 13:06:48 +0000 (15:06 +0200)]
aco: don't combine minmax3 if there is a neg or abs modifier in between

This fixes a graphical corruption in HotS.
No pipelinedb changes other than that.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
4 years agogallivm: Fix saturated signed psub/padd intrinsics on llvm 8
Roland Scheidegger [Thu, 17 Oct 2019 02:14:28 +0000 (04:14 +0200)]
gallivm: Fix saturated signed psub/padd intrinsics on llvm 8

LLVM 8 did remove both the signed and unsigned sse2/avx intrinsics in
the end, and provide arch-independent llvm intrinsics instead.
Fixes a crash when using snorm framebuffers (tested with piglit
arb_color_buffer_float-render GL_RGBA8_SNORM -auto).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
CC: <mesa-stable@lists.freedesktop.org>
4 years agoradv: fix DCC fast clear code for intensity formats (correctly)
Samuel Pitoiset [Wed, 16 Oct 2019 20:51:08 +0000 (22:51 +0200)]
radv: fix DCC fast clear code for intensity formats (correctly)

Previous fix was pretty bogus.

This fixes a rendering regression with Nier (minimap too large).

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1943
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1952
Fixes: ea92273cea8 ("radv: fix DCC fast clear code for intensity formats")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
4 years agopanfrost: Keep track of active BOs
Tomeu Vizoso [Wed, 9 Oct 2019 08:10:44 +0000 (10:10 +0200)]
panfrost: Keep track of active BOs

If two jobs use the same GEM object at the same time, the job that
finishes first will (previous to this commit) close the GEM object, even
if there's a job still referencing it.

To prevent this, have all jobs use the same panfrost_bo for a given GEM
object, so it's only closed once the last job is done with it.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Rohan Garg <rohan.garg@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agonv50/ir: remove DUMMY edge type
Karol Herbst [Mon, 14 Oct 2019 20:50:58 +0000 (22:50 +0200)]
nv50/ir: remove DUMMY edge type

it was never used

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
4 years agogallium: do not increase ref count of the new throttle fence
James Xiong [Wed, 16 Oct 2019 16:22:22 +0000 (09:22 -0700)]
gallium: do not increase ref count of the new throttle fence

A new throttle fence was initialized to 1, and increased by 1
again when it's put in drawable->throttle_fence; the ref was
decreased by 1 when it's removed from drawable->throttle_fence,
and never reached to 0, caused leak.

Fixes: ff77bf5cbf7 ("gallium: simplify throttle implementation")
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1949
Signed-off-by: James Xiong <james.xiong@intel.com>
Reported-by: Florian Wesch <fw@info-beamer.com>
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com>
4 years agonir: drop unused alpha_ref_float
Erik Faye-Lund [Mon, 7 Oct 2019 10:19:15 +0000 (12:19 +0200)]
nir: drop unused alpha_ref_float

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agonir: drop support for using load_alpha_ref_float
Erik Faye-Lund [Mon, 7 Oct 2019 10:08:55 +0000 (12:08 +0200)]
nir: drop support for using load_alpha_ref_float

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agov3d: do not report alpha-test as supported
Erik Faye-Lund [Mon, 7 Oct 2019 10:18:09 +0000 (12:18 +0200)]
v3d: do not report alpha-test as supported

This triggers lowering in the state-tracker, which makes things a bit
simpler.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agovc4: do not report alpha-test as supported
Erik Faye-Lund [Mon, 7 Oct 2019 10:07:47 +0000 (12:07 +0200)]
vc4: do not report alpha-test as supported

This triggers lowering in the state-tracker, which makes things a bit
simpler.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agopanfrost: do not report alpha-test as supported
Erik Faye-Lund [Mon, 7 Oct 2019 10:07:20 +0000 (12:07 +0200)]
panfrost: do not report alpha-test as supported

This triggers lowering in the state-tracker, which makes things a bit
simpler.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa/st: support lowering user-clip-planes automatically
Erik Faye-Lund [Thu, 25 Jul 2019 12:06:33 +0000 (14:06 +0200)]
mesa/st: support lowering user-clip-planes automatically

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa/program: support referencing the clip-space clip-plane state
Erik Faye-Lund [Thu, 3 Oct 2019 20:53:47 +0000 (16:53 -0400)]
mesa/program: support referencing the clip-space clip-plane state

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agonir: support feeding state to nir_lower_clip_[vg]s
Erik Faye-Lund [Wed, 2 Oct 2019 20:30:45 +0000 (16:30 -0400)]
nir: support feeding state to nir_lower_clip_[vg]s

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agonir: support lowering clipdist to arrays
Erik Faye-Lund [Wed, 2 Oct 2019 20:19:08 +0000 (16:19 -0400)]
nir: support lowering clipdist to arrays

This allows us to make sure clipdist is emitted as a scalar array rather
than two vec4s. This matches SPIR-V semantics, and will be useful for
Zink.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa/gallium: automatically lower two-sided lighting
Erik Faye-Lund [Thu, 3 Oct 2019 20:51:19 +0000 (16:51 -0400)]
mesa/gallium: automatically lower two-sided lighting

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agonir: support derefs in two-sided lighting lowering
Erik Faye-Lund [Thu, 3 Oct 2019 20:51:03 +0000 (16:51 -0400)]
nir: support derefs in two-sided lighting lowering

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa/gallium: automatically lower point-size
Erik Faye-Lund [Thu, 3 Oct 2019 20:49:15 +0000 (16:49 -0400)]
mesa/gallium: automatically lower point-size

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agonir: add lowering-pass for point-size mov
Erik Faye-Lund [Thu, 3 Oct 2019 20:44:29 +0000 (16:44 -0400)]
nir: add lowering-pass for point-size mov

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agost/mesa: move point_size_per_vertex-logic to helper
Erik Faye-Lund [Thu, 18 Jul 2019 14:29:27 +0000 (16:29 +0200)]
st/mesa: move point_size_per_vertex-logic to helper

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa/gallium: automatically lower alpha-testing
Erik Faye-Lund [Thu, 3 Oct 2019 20:35:23 +0000 (16:35 -0400)]
mesa/gallium: automatically lower alpha-testing

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agonir: allow passing alpha-ref state to lowering-code
Erik Faye-Lund [Thu, 3 Oct 2019 20:22:58 +0000 (16:22 -0400)]
nir: allow passing alpha-ref state to lowering-code

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agomesa: expose alpha-ref as a state-variable
Erik Faye-Lund [Thu, 4 Jul 2019 08:07:27 +0000 (10:07 +0200)]
mesa: expose alpha-ref as a state-variable

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agost/mesa: handling lower flatshading for NIR drivers.
Dave Airlie [Thu, 24 Jan 2019 03:12:10 +0000 (13:12 +1000)]
st/mesa: handling lower flatshading for NIR drivers.

This uses the NIR pass to lower flatshading when the driver
requests it.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agogallium: add flatshade lowering capability
Dave Airlie [Thu, 24 Jan 2019 03:11:22 +0000 (13:11 +1000)]
gallium: add flatshade lowering capability

This allows the driver to request flatshade lowering.
(NIR drivers only so far).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agonir: add a pass to lower flat shading.
Dave Airlie [Thu, 24 Jan 2019 03:07:42 +0000 (13:07 +1000)]
nir: add a pass to lower flat shading.

This takes any color or backcolor that has unspecified
shading and converts it to flat shading.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agogallium/u_blitter: set a more sane viewport-state
Erik Faye-Lund [Mon, 15 Jul 2019 12:44:48 +0000 (14:44 +0200)]
gallium/u_blitter: set a more sane viewport-state

This actually corresponds to legal GL depth-ranges, because depth-clear
values are always in the 0..1 range in OpenGL.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
4 years agost/mesa: reorder and document code in st_translate_vertex_program
Marek Olšák [Wed, 16 Oct 2019 02:20:17 +0000 (22:20 -0400)]
st/mesa: reorder and document code in st_translate_vertex_program

move the TGSI code after the ARB_vp code

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: call prog_to_nir sooner for ARB_fp
Marek Olšák [Wed, 16 Oct 2019 02:19:42 +0000 (22:19 -0400)]
st/mesa: call prog_to_nir sooner for ARB_fp

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: don't call translate_*_program functions for NIR
Marek Olšák [Fri, 27 Sep 2019 21:43:42 +0000 (17:43 -0400)]
st/mesa: don't call translate_*_program functions for NIR

move the initializaton to st_link_nir

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: finalize NIR after shader variant passes for TCS/TES/GS/CS
Marek Olšák [Wed, 16 Oct 2019 01:08:35 +0000 (21:08 -0400)]
st/mesa: finalize NIR after shader variant passes for TCS/TES/GS/CS

Same as VS and FS.

This might fix vertex color clamping.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: unify transform feedback info translation code
Marek Olšák [Fri, 11 Oct 2019 19:08:40 +0000 (15:08 -0400)]
st/mesa: unify transform feedback info translation code

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: move vertex program preparation code into st_prepare_vertex_program
Marek Olšák [Fri, 11 Oct 2019 18:53:15 +0000 (14:53 -0400)]
st/mesa: move vertex program preparation code into st_prepare_vertex_program

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: clean up more after the removal of st_compute_program
Marek Olšák [Sat, 12 Oct 2019 00:32:02 +0000 (20:32 -0400)]
st/mesa: clean up more after the removal of st_compute_program

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: deduplicate st_common_program code in st_program_string_notify
Marek Olšák [Mon, 30 Sep 2019 21:37:42 +0000 (17:37 -0400)]
st/mesa: deduplicate st_common_program code in st_program_string_notify

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: sink TCS/TES/GS/CS translate code into st_translate_common_program
Marek Olšák [Mon, 30 Sep 2019 21:24:24 +0000 (17:24 -0400)]
st/mesa: sink TCS/TES/GS/CS translate code into st_translate_common_program

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: deduplicate cases in st_deserialise_ir_program
Marek Olšák [Mon, 30 Sep 2019 21:13:32 +0000 (17:13 -0400)]
st/mesa: deduplicate cases in st_deserialise_ir_program

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: remove st_compute_program in favor of st_common_program
Marek Olšák [Mon, 30 Sep 2019 21:06:45 +0000 (17:06 -0400)]
st/mesa: remove st_compute_program in favor of st_common_program

The conversion from pipe_shader_state to pipe_compute_state is done
at the end.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: don't store stream output info to shader cache for tess ctrl shaders
Marek Olšák [Mon, 30 Sep 2019 20:54:00 +0000 (16:54 -0400)]
st/mesa: don't store stream output info to shader cache for tess ctrl shaders

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: simplify the signature of st_release_basic_variants
Marek Olšák [Mon, 30 Sep 2019 20:45:48 +0000 (16:45 -0400)]
st/mesa: simplify the signature of st_release_basic_variants

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: deduplicate code for ATI fs in st_program_string_notify
Marek Olšák [Mon, 30 Sep 2019 20:39:23 +0000 (16:39 -0400)]
st/mesa: deduplicate code for ATI fs in st_program_string_notify

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agost/mesa: use *prog at the end of st_link_nir
Marek Olšák [Fri, 27 Sep 2019 21:28:48 +0000 (17:28 -0400)]
st/mesa: use *prog at the end of st_link_nir

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
4 years agoappveyor: Cache meson's wrap downloads
Dylan Baker [Mon, 14 Oct 2019 17:20:54 +0000 (10:20 -0700)]
appveyor: Cache meson's wrap downloads

This makes us less reliant on wrap-db (and reduces the amount of
downloading that goes on during the build).

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/1936
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
4 years agogitlab-ci: Set the meson wrapmode to disabled
Dylan Baker [Mon, 14 Oct 2019 16:04:47 +0000 (09:04 -0700)]
gitlab-ci: Set the meson wrapmode to disabled

This will prevent us from accidentally falling back to the wrap-db
instead of using locally installed versions.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
4 years agoRevert "gitlab-ci: Disable meson-mingw32-x86_64 job again for now"
Dylan Baker [Fri, 11 Oct 2019 16:04:14 +0000 (09:04 -0700)]
Revert "gitlab-ci: Disable meson-mingw32-x86_64 job again for now"

This reverts commit d60b8679a46212d992dcd94b9d3eeebfcff3f00a.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
4 years agogitlab-ci: Add a pkg-config for mingw
Dylan Baker [Fri, 11 Oct 2019 16:21:17 +0000 (09:21 -0700)]
gitlab-ci: Add a pkg-config for mingw

The one debian provides is broken in buster+, so I've just written my
own. This allows meson to find the installed zlib and prevents it from
falling back to wraps.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
4 years agomeson: Don't use expat on windows
Dylan Baker [Fri, 11 Oct 2019 16:19:25 +0000 (09:19 -0700)]
meson: Don't use expat on windows

It's not really needed, and there's no debian package for it so we're
forced to fall back to wraps in mesa's CI. This can be problematic in
itself.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
4 years agost/mesa: fix crash for drivers supporting nir defaulting to tgsi
Karol Herbst [Mon, 14 Oct 2019 23:06:18 +0000 (01:06 +0200)]
st/mesa: fix crash for drivers supporting nir defaulting to tgsi

nvc0 and I assume radeonsi as well hit an assert inside glsl_to_tgsi as atan
instructions get inserted into the shader.

Fixes: cece947a8dfa ("glsl/builtin: Add alternate versions of atan using new ops")
Cc: Neil Roberts <nroberts@igalia.com>
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
4 years agoutil/u_atomic: fix return type of p_atomic_{inc,dec}_return() and p_atomic_{cmp,...
Eric Engestrom [Wed, 16 Oct 2019 12:58:56 +0000 (13:58 +0100)]
util/u_atomic: fix return type of p_atomic_{inc,dec}_return() and p_atomic_{cmp,}xchg()

We're trying to cast the return type to the type of the var, but instead
we were casting `sizeof(*v)`.

Fixes: 6df72e970c0e2794a565 ("util: Make u_atomic.h typeless.")
Fixes: 0a7f17cf5b591330a257 ("util/u_atomic: add p_atomic_xchg")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
4 years agomesa/math: delete duplicate extern symbol
Eric Engestrom [Wed, 16 Oct 2019 11:55:33 +0000 (12:55 +0100)]
mesa/math: delete duplicate extern symbol

It's already defined in `m_debug_util.h`, along with an explanation of
what it is and how to use it.

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
4 years agomesa/math: delete leftover... from 18 years ago (!)
Eric Engestrom [Wed, 16 Oct 2019 11:45:05 +0000 (12:45 +0100)]
mesa/math: delete leftover... from 18 years ago (!)

Left over from 0a79baf1bff93718e50a ("remove dead vertex assembly").

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
4 years agolima: Fix crash when there are no vertex shader attributes
Andreas Baierl [Fri, 27 Sep 2019 06:32:12 +0000 (08:32 +0200)]
lima: Fix crash when there are no vertex shader attributes

Signed-off-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
4 years agolima: Fix compiler warning in standalone compiler
Andreas Baierl [Wed, 9 Oct 2019 07:11:28 +0000 (09:11 +0200)]
lima: Fix compiler warning in standalone compiler

'struct lima_context' has to be declared before usage in lima_program.h

Signed-off-by: Andreas Baierl <ichgeh@imkreisrum.de>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
4 years agoaco: emit_split_vector() s_memtime results
Rhys Perry [Thu, 10 Oct 2019 16:05:09 +0000 (17:05 +0100)]
aco: emit_split_vector() s_memtime results

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
4 years agoaco: don't CSE s_memtime
Rhys Perry [Thu, 10 Oct 2019 16:04:47 +0000 (17:04 +0100)]
aco: don't CSE s_memtime

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
4 years agoaco: fix scheduling with s_memtime/s_memrealtime
Rhys Perry [Thu, 10 Oct 2019 16:04:06 +0000 (17:04 +0100)]
aco: fix scheduling with s_memtime/s_memrealtime

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
4 years agointel/common: include unistd.h for ioctl() prototype on Solaris
Alan Coopersmith [Tue, 8 Oct 2019 22:36:48 +0000 (15:36 -0700)]
intel/common: include unistd.h for ioctl() prototype on Solaris

Fixes build errors of:
In file included from ../src/intel/vulkan/anv_private.h:48,
                 from ../src/intel/vulkan/genX_blorp_exec.c:26:
../src/intel/common/gen_gem.h: In function ‘gen_ioctl’:
../src/intel/common/gen_gem.h:68:15: error: implicit declaration of function ‘ioctl’ [-Werror=implicit-function-declaration]
   68 |         ret = ioctl(fd, request, arg);
      |               ^~~~~
In file included from ../include/c11/threads_posix.h:35,
                 from ../include/c11/threads.h:66,
                 from ../src/mesa/main/mtypes.h:39,
                 from ../src/intel/compiler/brw_compiler.h:30,
                 from ../src/intel/vulkan/anv_private.h:51,
                 from ../src/intel/vulkan/genX_blorp_exec.c:26:
/usr/include/unistd.h: At top level:
/usr/include/unistd.h:471:12: error: conflicting types for ‘ioctl’
  471 | extern int ioctl(int, int, ...);
      |            ^~~~~
/usr/include/unistd.h:471:1: note: a parameter list with an ellipsis can’t match an empty parameter name list declaration
  471 | extern int ioctl(int, int, ...);
      | ^~~~~~
In file included from ../src/intel/vulkan/anv_private.h:48,
                 from ../src/intel/vulkan/genX_blorp_exec.c:26:
../src/intel/common/gen_gem.h:68:15: note: previous implicit declaration of ‘ioctl’ was here
   68 |         ret = ioctl(fd, request, arg);
      |               ^~~~~

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
4 years agomeson: recognize "sunos" as the system name for Solaris
Alan Coopersmith [Tue, 8 Oct 2019 01:46:41 +0000 (18:46 -0700)]
meson: recognize "sunos" as the system name for Solaris

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
4 years agoutil: Solaris has linux-style pthread_setname_np
Alan Coopersmith [Tue, 8 Oct 2019 01:10:43 +0000 (18:10 -0700)]
util: Solaris has linux-style pthread_setname_np

Fixes: dcf9d91a ("util: Handle differences in pthread_setname_np")
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
4 years agoutil: Workaround lack of flock on Solaris
Alan Coopersmith [Sat, 22 Apr 2017 04:57:50 +0000 (21:57 -0700)]
util: Workaround lack of flock on Solaris

v2: Replace autoconf check for flock() with meson check

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
4 years agoutil: Make Solaris implemention of p_atomic_add work with gcc
Alan Coopersmith [Sun, 12 Feb 2017 02:35:55 +0000 (18:35 -0800)]
util: Make Solaris implemention of p_atomic_add work with gcc

gcc is very particular about where you place the (void) cast
The previous placement made it error out with:

In file included from disk_cache.c:40:0:
../../src/util/u_atomic.h:203:29: error: void value not ignored as it ought to be
 #define p_atomic_add(v, i) ((void)         \
                              ^
disk_cache.c:658:4: note: in expansion of macro ‘p_atomic_add’
    p_atomic_add(cache->size, size);
    ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
4 years agoc99_compat.h: Don't try to use 'restrict' in C++ code
Alan Coopersmith [Sat, 10 Sep 2016 16:46:02 +0000 (09:46 -0700)]
c99_compat.h: Don't try to use 'restrict' in C++ code

Fixes build failures on Solaris in C++ files using gcc:

../src/util/u_math.h:628:41: error: expected ‘,’ or ‘...’ before ‘dest’
  628 | util_memcpy_cpu_to_le32(void * restrict dest, const void * restrict src, size_t n)
      |                                         ^~~~
../src/util/u_math.h: In function ‘void* util_memcpy_cpu_to_le32(void*)’:
../src/util/u_math.h:641:18: error: ‘dest’ was not declared in this scope
  641 |    return memcpy(dest, src, n);
      |                  ^~~~
../src/util/u_math.h:641:24: error: ‘src’ was not declared in this scope
  641 |    return memcpy(dest, src, n);
      |                        ^~~
../src/util/u_math.h:641:29: error: ‘n’ was not declared in this scope; did you mean ‘yn’?
  641 |    return memcpy(dest, src, n);
      |                             ^
      |                             yn

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
4 years agopan/midgard: Do not repeatedly spill same value
Alyssa Rosenzweig [Sun, 13 Oct 2019 18:16:37 +0000 (14:16 -0400)]
pan/midgard: Do not repeatedly spill same value

It doesn't make sense. You already spilled it once, and it didn't help.
Don't try again, or you'll end up in a loop.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Fix memory corruption in register spilling
Alyssa Rosenzweig [Tue, 8 Oct 2019 02:42:35 +0000 (22:42 -0400)]
pan/midgard: Fix memory corruption in register spilling

Essentially an off-by-one error ... bit of an edge case, but seems to
occur in some glamor shaders.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Allow COMPUTE jobs in panfrost_bo_access_for_stage
Alyssa Rosenzweig [Sat, 12 Oct 2019 15:30:52 +0000 (11:30 -0400)]
pan/midgard: Allow COMPUTE jobs in panfrost_bo_access_for_stage

Fixes: ada752afe40 ("panfrost: Extend the panfrost_batch_add_bo() API to pass access flags")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
4 years agopan/midgard: Use 16-bit liveness masks
Alyssa Rosenzweig [Wed, 16 Oct 2019 02:01:16 +0000 (22:01 -0400)]
pan/midgard: Use 16-bit liveness masks

We'll want liveness per-byte, so we need to accomodate up to 16 bytes.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>