mesa.git
4 years agoradv: Always expose non-visible local memory type on dedicated GPUs
Clément Guérin [Wed, 3 Jun 2020 05:14:44 +0000 (22:14 -0700)]
radv: Always expose non-visible local memory type on dedicated GPUs

DOOM Eternal expects this type, but RADV doesn't expose it when the VRAM
is entirely host-visible, in my case on Fiji. Matches AMDVLK behavior.

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/3054
Cc: <mesa-stable@lists.freedesktop.org>
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/5308>

4 years agopan/mdg: Legalize inverts with constants
Alyssa Rosenzweig [Tue, 2 Jun 2020 16:15:18 +0000 (12:15 -0400)]
pan/mdg: Legalize inverts with constants

We need to force src_invert to be in the right place even if we flip
when lowering an embedded->inline constant.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes: 449e5ded934 ("pan/mdg: Treat inot as a modifier")
Reported-by: Icecream95 <ixn@keemail.me>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5299>

4 years agonir: reuse existing psiz-variable
Erik Faye-Lund [Tue, 2 Jun 2020 08:44:13 +0000 (10:44 +0200)]
nir: reuse existing psiz-variable

For shaders where there's already a psiz-variable, we should rather
reuse it than create a second one. This can happen if a shader writes
gl_PointSize, but disables GL_PROGRAM_POINT_SIZE.

Fixes: 878c94288a8 ("nir: add lowering-pass for point-size mov")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5328>

4 years agoi965: fix export of GEM handles
Lionel Landwerlin [Sat, 2 May 2020 13:59:19 +0000 (16:59 +0300)]
i965: fix export of GEM handles

We reuse DRM file descriptors internally. Therefore when we export a
GEM handle we must do so in the file descriptor used externally.

v2: Fix dmabuf leak
    Fix GEM handle leaks by tracking exported handles

v3: Check os_same_file_description error (Michel)
    Don't create multiple exports for a given GEM table

v4: Add WARN_ONCE (Ken)

v5: Remove blank line (Ian)
    Remove unused field (Ian)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2882
Fixes: 4094558e8643 ("i965: share buffer managers across screens")
Tested-by: Eric Engestrom <eric@engestrom.ch>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4861>

4 years agoiris: fix export of GEM handles
Lionel Landwerlin [Sat, 2 May 2020 13:46:47 +0000 (16:46 +0300)]
iris: fix export of GEM handles

We reuse DRM file descriptors internally. Therefore when we export a
GEM handle we must do so in the file descriptor used externally.

This change also fixes a file descriptor leak of the FD given at
screen creation.

v2: Don't bother checking fd equals, they're always different
    Fix dmabuf leak
    Fix GEM handle leaks by tracking exported handles

v3: Check os_same_file_description error (Michel)
    Don't create multiple exports for a given GEM table

v4: Add WARN_ONCE (Ken)
    Rename external_fd to winsys_fd

v5: Remove export lock in favor of bufmgr's

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2882
Fixes: 7557f1605968 ("iris: share buffer managers accross screens")
Tested-by: Eric Engestrom <eric@engestrom.ch>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4861>

4 years agoi965: don't forget to set screen on duped image
Lionel Landwerlin [Tue, 2 Jun 2020 08:52:35 +0000 (11:52 +0300)]
i965: don't forget to set screen on duped image

We'll start using this field more for querying image properties.
Without it we run into a crash.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4861>

4 years agoiris: fix BO destruction in error path
Lionel Landwerlin [Sat, 2 May 2020 19:43:22 +0000 (22:43 +0300)]
iris: fix BO destruction in error path

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4861>

4 years agomesa: Fix NetBSD compiler macro.
Vinson Lee [Sat, 23 May 2020 20:46:28 +0000 (13:46 -0700)]
mesa: Fix NetBSD compiler macro.

Reported-by: Rafał Mikrut <mikrutrafal54@gmail.com>
Fixes: a63b90712aad ("mesa: also check for __NetBSD__")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3015
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5191>

4 years agofreedreno/a6xx: also consider alpha-test for ztest-mode
Rob Clark [Wed, 3 Jun 2020 22:01:11 +0000 (15:01 -0700)]
freedreno/a6xx: also consider alpha-test for ztest-mode

Looks like we don't have CI coverage for this (since deqp==GLES) but
alpha test is conceptually the same as frag shaders with discard, and
should be handled as such.

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

4 years agofreedreno/a6xx: add early-lrz-late-z mode
Rob Clark [Wed, 3 Jun 2020 17:08:55 +0000 (10:08 -0700)]
freedreno/a6xx: add early-lrz-late-z mode

Now that we are doing a better job of managing LRZ, add support for the
EARLY_LRZ_LATE_Z mode.  Since we properly disable LRZ write in cases
where we don't know a fragment's z value during the binning pass (or
when blend is enabled in a later draw, meaning we will need the earlier
fragment's color), we can enable a mode that keeps the early-lrz test
when the frag shader has kill/discard.  This will only discard geometry
that is definitely not visible.

This is a pretty big win for games/benchmarks that have a lot of frag
shaders with kill/discard.  More than 10% gain for gfxbench trex/mh and
40% gain for mh31.

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

4 years agofreedreno/a6xx: re-work LRZ state tracking
Rob Clark [Wed, 3 Jun 2020 17:06:58 +0000 (10:06 -0700)]
freedreno/a6xx: re-work LRZ state tracking

In particular, properly detect reversal of depth-test direction.
With that we can remove a lot of cases where we were unnecessarily
invalidating LRZ, which was simply papering over the direction-
reversal issue in deqp.

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

4 years agofreedreno/a6xx: update depth-plane control regs
Rob Clark [Sun, 31 May 2020 17:46:54 +0000 (10:46 -0700)]
freedreno/a6xx: update depth-plane control regs

And document the early-lrz-late-z mode.

Initially I thought this would be two bits to control early-lrz vs
early-z.  But having early-z without early-lrz does not make sense,
and the way the values line up makes an enum fit better.

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

4 years agofreedreno/a6xx: sync registers from envytools
Rob Clark [Sat, 30 May 2020 21:24:36 +0000 (14:24 -0700)]
freedreno/a6xx: sync registers from envytools

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

4 years agofreedreno/ir3: split kill from no_earlyz
Rob Clark [Tue, 2 Jun 2020 00:29:00 +0000 (17:29 -0700)]
freedreno/ir3: split kill from no_earlyz

Unlike other conditions which prevent early-discard of fragments, kill
does not prevent early LRZ test.  Split `has_kill` from `no_earlyz` so
we can take advantage of this.

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

4 years agodocs/features.txt: Update for freedreno
Kristian H. Kristensen [Wed, 3 Jun 2020 19:50:15 +0000 (12:50 -0700)]
docs/features.txt: Update for freedreno

We've had GL_OES_texture_cube_map_array for a while for a4xx+ and
support for geometry and tessellation for a6xx+.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5319>

4 years agofreedreno/a6xx: Turn on robustness extensions
Kristian H. Kristensen [Wed, 3 Jun 2020 19:28:05 +0000 (12:28 -0700)]
freedreno/a6xx: Turn on robustness extensions

With UBO access going through LDC, all memory access uses buffer based
io primitives.  We can then advertise
PIPE_CAP_ROBUST_BUFFER_ACCESS_BEHAVIOR and
PIPE_CAP_DEVICE_RESET_STATUS_QUERY, which turn on GL_EXT_robustness,
GL_KHR_robust_buffer_access_behavior and GL_KHR_robustness.

Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5319>

4 years agovdpau: Fix wrong calloc sizeof argument.
Vinson Lee [Sat, 23 May 2020 00:59:27 +0000 (17:59 -0700)]
vdpau: Fix wrong calloc sizeof argument.

Fix warning reported by Coverity Scan.

Wrong sizeof argument (SIZEOF_MISMATCH)
suspicious_sizeof: Passing argument 3544UL (sizeof
(vlVdpPresentationQueue)) to function calloc that returns a pointer of
type vlVdpPresentationQueueTarget * is suspicious because a multiple of
sizeof (vlVdpPresentationQueueTarget) /*16*/ is expected.

Fixes: 65fe0866aec7 ("vl: implemented a few functions and made stubs to get mplayer running")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3026
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5182>

4 years agoOPTIONAL: iris: Perform BLORP buffer barriers outside of iris_blorp_exec() hook.
Francisco Jerez [Wed, 6 May 2020 22:40:30 +0000 (15:40 -0700)]
OPTIONAL: iris: Perform BLORP buffer barriers outside of iris_blorp_exec() hook.

The iris_blorp_exec() hook needs to be executed under a single
indivisible sync region, which means that in cases where we need to
emit a PIPE_CONTROL for a buffer barrier we won't be able to track the
subsequent commands separately from the previous commands, which will
prevent us from optimizing out subsequent PIPE_CONTROLs if we
encounter the same buffers again.  In particular I've encountered this
situation in some SynMark test-cases which perform lots of BLORP
operations with the same buffer bound as both source and destination
(in order to generate mipmaps): In such a scenario if the source
requires flushing we'd also end up flushing for the destination
redundantly, even though a single PIPE_CONTROL would have been
sufficient.

This avoids a 4.5% FPS regression in SynMark OglHdrBloom and a 3.5%
FPS regression in SynMark OglMultithread.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Remove iris_flush_depth_and_render_caches().
Francisco Jerez [Thu, 6 Feb 2020 04:29:09 +0000 (20:29 -0800)]
iris: Remove iris_flush_depth_and_render_caches().

This helper is unused now.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Emit single render target flush PIPE_CONTROL on format mismatch.
Francisco Jerez [Fri, 1 May 2020 00:40:52 +0000 (17:40 -0700)]
iris: Emit single render target flush PIPE_CONTROL on format mismatch.

The big-hammer iris_flush_depth_and_render_caches() is largely
redundant whenever a format mismatch is detected from
iris_cache_flush_for_render().  There is no need to kick the depth,
sampler nor constant caches in that case.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Open-code iris_cache_flush_for_read() and iris_cache_flush_for_depth().
Francisco Jerez [Thu, 6 Feb 2020 04:36:35 +0000 (20:36 -0800)]
iris: Open-code iris_cache_flush_for_read() and iris_cache_flush_for_depth().

These have become one-liners now so they can be easily inlined.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Remove render cache hash table-based synchronization.
Francisco Jerez [Wed, 19 Feb 2020 06:39:43 +0000 (22:39 -0800)]
iris: Remove render cache hash table-based synchronization.

The render cache hash table is now *mostly* redundant with the more
general seqno matrix-based cache tracking mechanism.  Most hash table
operations are now gone except for the format mismatch checks done in
iris_cache_flush_for_render().  Redundant code removed as a separate
patch for bisectability.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Remove depth cache set tracking and synchronization.
Francisco Jerez [Wed, 19 Feb 2020 04:53:26 +0000 (20:53 -0800)]
iris: Remove depth cache set tracking and synchronization.

The depth cache set is now redundant with the more general seqno
matrix-based cache tracking mechanism.  Removed as a separate patch
for bisectability.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Perform compute predraw flushes from compute batch.
Francisco Jerez [Thu, 6 Feb 2020 02:27:46 +0000 (18:27 -0800)]
iris: Perform compute predraw flushes from compute batch.

Whenever iris_predraw_resolve_inputs() ends up doing a flush or
invalidate, we really want it to be on the same batch which is going
to consume the result.  Any resolves should still be performed from
the render batch thanks to the previous patch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Remove batch argument of iris_resource_prepare_access() and friends.
Francisco Jerez [Fri, 24 Apr 2020 01:00:15 +0000 (18:00 -0700)]
iris: Remove batch argument of iris_resource_prepare_access() and friends.

The resolves performed by this function are only expected to work from
the render batch, so make sure we use it independently of the batch
the caller wants to use.  This function provides no synchronization
guarantees anyway, the caller is expected to insert any cache flushing
and synchronization required for the resolved surface to be visible to
the target batch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Insert buffer barrier in existing cache flush helpers.
Francisco Jerez [Thu, 6 Feb 2020 02:58:23 +0000 (18:58 -0800)]
iris: Insert buffer barrier in existing cache flush helpers.

As a first step to phasing out the current hashtable-based depth and
render cache tracking mechanisms.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Implement buffer-local memory barrier based on cache coherency matrix.
Francisco Jerez [Thu, 6 Feb 2020 02:59:46 +0000 (18:59 -0800)]
iris: Implement buffer-local memory barrier based on cache coherency matrix.

This takes advantage of the previously introduced cache tracking
infrastructure in order to define a multi-purpose barrier operation
that allows the caller to order memory operations with respect to
previous operations performed on the same buffer from any other cache
domain.

v2: Assorted CPU overhead micro-optimizations (Francisco).
v3: Use C99 designated initializers (Ken).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Update cache coherency matrix on PIPE_CONTROL.
Francisco Jerez [Mon, 10 Feb 2020 09:24:29 +0000 (01:24 -0800)]
iris: Update cache coherency matrix on PIPE_CONTROL.

This introduces a batch synchronization boundary at every PIPE_CONTROL
command, and updates the cache coherency status tracked during batch
construction according to the specified control bits.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Introduce cache coherency matrix for batch-local memory ordering.
Francisco Jerez [Wed, 19 Feb 2020 04:48:23 +0000 (20:48 -0800)]
iris: Introduce cache coherency matrix for batch-local memory ordering.

This introduces a representation of the cache coherency status of the
GPU at any point in the batch.  This is done by defining a matrix C of
synchronization sequence numbers such that at any point of batch
construction, a memory operation from domain i introduced into the
batch is guaranteed to be ordered after any memory operation from
domain j in a previous batch section with seqno n if the following
condition holds:

  C_i_j >= n

This allows us to efficiently determine whether additional flushing
and/or invalidation is required in order to access a buffer object
from some arbitrary domain.

Except for batch buffer reset which requires clearing the whole
matrix, all operations on the matrix are either O(n) or O(1) on the
number of caching domains (which is basically constant).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Report use of any in-flight buffers on first draw call after sync boundary.
Francisco Jerez [Fri, 7 Feb 2020 05:06:17 +0000 (21:06 -0800)]
iris: Report use of any in-flight buffers on first draw call after sync boundary.

This is the main performance trade-off of this cache tracking
mechanism: In order for the seqno vector of buffer objects to be
accurate, they need to be marked as used again every time the batch is
split into a new synchronization section if they remain bound to the
pipeline.  This can be achieved easily by re-using
iris_restore_render_saved_bos() and iris_restore_compute_saved_bos(),
which currently serve a similar purpose across batch buffer
boundaries.

The impact on Piglit drawoverhead results seems to be within a
standard deviation of the current results.

XXX - It might be possible to completely remove the current
      iris_batch::contains_draw flag at a small additional performance
      cost.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Drop redundant iris_address::write flag.
Francisco Jerez [Wed, 27 May 2020 20:42:22 +0000 (13:42 -0700)]
iris: Drop redundant iris_address::write flag.

The write flag is redundant since it can be inferred easily from the
iris_address::access domain.  This allows the iris_address struct to
be laid out more efficiently in memory, leading to a measurable
improvement in several Piglit Drawoverhead test-cases.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Annotate all BO uses with domain and sequence number information.
Francisco Jerez [Fri, 29 May 2020 23:38:43 +0000 (16:38 -0700)]
iris: Annotate all BO uses with domain and sequence number information.

Probably the most annoying patch to review from the whole series --
Mark every buffer object use as accessed through some caching domain
with the sequence number of the current synchronization section of the
batch.  The additional argument of iris_use_pinned_bo() makes sure I'd
have gotten a compile error if I had missed any buffer added to the
batch validation list.

There are only a few exceptions where a buffer is left untracked while
adding it to the validation list, justified below:

 - Batch buffers: These are strictly read-only for the moment.

 - BLORP buffer objects: Their seqnos are bumped manually at the end
   of iris_blorp_exec() instead, in order to avoid plumbing domain
   information through BLORP address combining.

 - Scratch buffers: The contents of these are strictly thread-local.

 - Shader images and SSBOs: Accesses of these buffers are explicitly
   synchronized at the API level.

v2: Opt out of tracking more aggressively (Ken): In addition to the
    above, surface states, binding tables, instructions and most
    dynamic states are now left untracked, which means a *lot* more BO
    uses marked IRIS_DOMAIN_NONE which need to be reviewed extremely
    carefully, since the cache tracker won't be able to provide any
    coherency guarantees for them.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Bracket batch operations which access memory within sync regions.
Francisco Jerez [Fri, 24 Apr 2020 00:58:48 +0000 (17:58 -0700)]
iris: Bracket batch operations which access memory within sync regions.

This delimits all batch operations which access memory between
iris_batch_sync_region_start() and iris_batch_sync_region_end() calls.
This makes sure that any buffer objects accessed within the region are
considered in use through the same caching domain until the end of the
region.

Adding any buffer to the batch validation list outside of a sync
region will lead to an assertion failure in a future commit, unless
the caller explicitly opted out of the cache tracking mechanism.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Add infrastructure to partition batch into sync boundaries.
Francisco Jerez [Wed, 27 May 2020 20:34:04 +0000 (13:34 -0700)]
iris: Add infrastructure to partition batch into sync boundaries.

This introduces some minimalistic infrastructure which will be used in
order to partition the batch into a series of sections, each one with
a unique, monotonically-increasing sequence number.  Section
boundaries will typically lie at points in the batch where the
execution and memory coherency status of some previous commands are
known, e.g. at batch buffer boundaries or PIPE_CONTROL commands.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agoiris: Add batch-local synchronization book-keeping to iris_bo.
Francisco Jerez [Fri, 24 Apr 2020 00:56:11 +0000 (17:56 -0700)]
iris: Add batch-local synchronization book-keeping to iris_bo.

The purpose of this is to represent the cache coherency state of a
buffer as a vector of integers (AKA seqnos), one for each incoherent
caching domain of the GPU.  A seqno will identify a single section of
a batch buffer uniquely across the whole pipe_screen (which means that
there will be no ambiguity about what context a given seqno belongs to
even if there are multiple threads accessing the same buffer in
parallel), and is guaranteed to be allocated in monotonically
increasing order within any given context.  The iris_bo_bump_seqno()
helper is provided for marking the last update of a buffer from a
given caching domain in a lockless manner.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3875>

4 years agopanfrost: Mark point sprites as todo on Bifrost
Alyssa Rosenzweig [Tue, 2 Jun 2020 00:52:59 +0000 (20:52 -0400)]
panfrost: Mark point sprites as todo on Bifrost

Emulating them will be a rather annoying dance. Let's not worry about
this until further down the line when we have a better sence of how to
do handle them efficiently.

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

4 years agopanfrost: Fix gl_PointSize out of GL_POINTS
Alyssa Rosenzweig [Tue, 2 Jun 2020 00:44:19 +0000 (20:44 -0400)]
panfrost: Fix gl_PointSize out of GL_POINTS

In this case, vs->writes_point_size is true as the VS writes
gl_PointSize, but panfrost_writes_points_size() is false as we are not
drawing points so the hardware doesn't process it. Thus the varying
descriptor is emitted but elements is never written. When the VS runs,
it will attempt to write to elements, a NULL pointer.

The behaviour is architecture-independent. On Midgard, the write
silently fails, hence why this bug was never noticed before. On Bifrost,
this raises an MMU fault.

The fix is to set the format to VARYING_DISCARD to ignore the write.

Noticed on Neverball.

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

4 years agopanfrost: Prefer sysval for gl_PointCoord on Bifrost
Alyssa Rosenzweig [Mon, 1 Jun 2020 22:26:03 +0000 (18:26 -0400)]
panfrost: Prefer sysval for gl_PointCoord on Bifrost

It's like gl_FragCoord. Still not implemented. This unfortunately makes
point sprites a lot more complicated.

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

4 years agopan/bi: Disassemble gl_PointCoord reads.
Alyssa Rosenzweig [Mon, 1 Jun 2020 21:36:35 +0000 (17:36 -0400)]
pan/bi: Disassemble gl_PointCoord reads.

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

4 years agopanfrost: Explicitly convert to 32-bit for logic-ops
Alyssa Rosenzweig [Tue, 2 Jun 2020 00:34:34 +0000 (20:34 -0400)]
panfrost: Explicitly convert to 32-bit for logic-ops

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reported-by: Icecream95 <ixn@keemail.me>
Fixes: 19b4e586f62 ("panfrost: Switch to pan_lower_framebuffer")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5289>

4 years agopanfrost: Readd MIDGARD_SHADERLESS quirk to t760
Alyssa Rosenzweig [Mon, 1 Jun 2020 22:32:41 +0000 (18:32 -0400)]
panfrost: Readd MIDGARD_SHADERLESS quirk to t760

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reported-by: Icecream95 <ixn@keemail.me>
Fixes: e53d27de61b ("panfrost: Add quirks for blend shader types")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5289>

4 years agoiris: Extend iris_context dirty state flags to 128 bits.
Francisco Jerez [Fri, 29 May 2020 23:57:01 +0000 (16:57 -0700)]
iris: Extend iris_context dirty state flags to 128 bits.

We're nearly out of dirty bits, and some patches pending review on
GitLab no longer apply due to that.  Make room for them by splitting
off shader stage-specific bits into a separate stage_dirty mask.

An alternative would be to split compute-related bits into a separate
mask, but that would prevent the '<< stage' indexing done in various
parts of the driver from working.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5279>

4 years agoiris: Simplify iris_batch_prepare_noop().
Francisco Jerez [Fri, 29 May 2020 23:54:35 +0000 (16:54 -0700)]
iris: Simplify iris_batch_prepare_noop().

This makes iris_batch_prepare_noop() return a boolean instead of
passing through the relevant set of dirty flags.  It will make it
easier to change the representation of dirty flags.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5279>

4 years agonir/lower_tex: fixes for fp16 yuv lowering
Rob Clark [Wed, 3 Jun 2020 18:34:09 +0000 (11:34 -0700)]
nir/lower_tex: fixes for fp16 yuv lowering

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3079
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5318>

4 years agonir/builder: add bitsize conversion helpers
Rob Clark [Wed, 3 Jun 2020 19:12:54 +0000 (12:12 -0700)]
nir/builder: add bitsize conversion helpers

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5318>

4 years agonir: extract out convert_to_bitsize() helper
Rob Clark [Wed, 3 Jun 2020 19:09:59 +0000 (12:09 -0700)]
nir: extract out convert_to_bitsize() helper

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5318>

4 years agonir: get_base_type() should return enum type
Rob Clark [Wed, 3 Jun 2020 19:07:52 +0000 (12:07 -0700)]
nir: get_base_type() should return enum type

Needed by the next patch, for c++ code which is more strict about
conversions between integers and enums.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5318>

4 years agopanfrost: Handle writes_memory correctly
Alyssa Rosenzweig [Tue, 2 Jun 2020 18:12:29 +0000 (14:12 -0400)]
panfrost: Handle writes_memory correctly

We need to pass it thru to EARLY_Z and WRITES_GLOBAL instead of ignoring
and assuming respectively. Nontrivial performance fix.

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

4 years agopanfrost: Document MALI_WRITES_GLOBAL bit
Alyssa Rosenzweig [Tue, 2 Jun 2020 18:05:34 +0000 (14:05 -0400)]
panfrost: Document MALI_WRITES_GLOBAL bit

We've been setting this unconditionally -- oops!

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

4 years agopanfrost: Update MALI_EARLY_Z description
Alyssa Rosenzweig [Tue, 2 Jun 2020 18:03:58 +0000 (14:03 -0400)]
panfrost: Update MALI_EARLY_Z description

Via the ES3.1 early-z testing force, I've confirmed this bit is e-z.
I've also confirmed e-z must be disabled for global writes, as expected.

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

4 years agoiris: remove unused iris_bo->swizzle_mode
Marcin Ślusarz [Wed, 3 Jun 2020 15:00:38 +0000 (17:00 +0200)]
iris: remove unused iris_bo->swizzle_mode

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5313>

4 years agoaco: sign-extend input/identity for 16-bit subgroup ops on GFX6-GFX7
Samuel Pitoiset [Tue, 26 May 2020 14:21:44 +0000 (16:21 +0200)]
aco: sign-extend input/identity for 16-bit subgroup ops on GFX6-GFX7

16-bit subgroup ops are implemented with 32-bit instructions
on GFX6-GFX7.

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

4 years agoaco: fix subdword copies on GFX6-GFX7
Samuel Pitoiset [Tue, 26 May 2020 07:38:27 +0000 (09:38 +0200)]
aco: fix subdword copies on GFX6-GFX7

SDWA is only GFX8+. Use v_mov_b32 since the upper 16 bits don't matter.

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

4 years agoaco: implement 16-bit nir_intrinsic_quad_* on GFX6-GFX7
Samuel Pitoiset [Tue, 26 May 2020 14:06:14 +0000 (16:06 +0200)]
aco: implement 16-bit nir_intrinsic_quad_* on GFX6-GFX7

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

4 years agoaco: implement 16-bit reduce operations on GFX6-GFX7
Samuel Pitoiset [Mon, 25 May 2020 17:59:57 +0000 (19:59 +0200)]
aco: implement 16-bit reduce operations on GFX6-GFX7

No fp16 on GFX6-GFX7.

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

4 years agopan/bi: Handle vectorized load_const
Alyssa Rosenzweig [Tue, 2 Jun 2020 23:30:56 +0000 (19:30 -0400)]
pan/bi: Handle vectorized load_const

In preparation for 16-bit vectors.

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

4 years agopan/bi: Passthrough second argument of F32_TO_F16
Alyssa Rosenzweig [Tue, 2 Jun 2020 23:29:25 +0000 (19:29 -0400)]
pan/bi: Passthrough second argument of F32_TO_F16

At the NIR level this is a second vector source of the first (only)
argument; at the BIR level this is a pair of scalars.

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

4 years agopan/bi: Pack second argument of F32_TO_F16
Alyssa Rosenzweig [Tue, 2 Jun 2020 23:28:55 +0000 (19:28 -0400)]
pan/bi: Pack second argument of F32_TO_F16

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

4 years agopan/bi: Fix SEL.16 swizzle
Alyssa Rosenzweig [Tue, 2 Jun 2020 23:28:03 +0000 (19:28 -0400)]
pan/bi: Fix SEL.16 swizzle

2 scalar arguments, not 1 vector.

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

4 years agopan/bi: Handle SEL with vec3 16-bit
Alyssa Rosenzweig [Tue, 2 Jun 2020 23:27:47 +0000 (19:27 -0400)]
pan/bi: Handle SEL with vec3 16-bit

Otherwise we end up with a missing argument.

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

4 years agopanfrost: Passthrough NATIVE loads/stores
Alyssa Rosenzweig [Mon, 25 May 2020 18:00:17 +0000 (14:00 -0400)]
panfrost: Passthrough NATIVE loads/stores

Now that we handle load_output directly, this works for e.g. RGB565 on
Midgard.

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

4 years agopan/mdg: Handle regular nir_intrinsic_load_output
Alyssa Rosenzweig [Mon, 1 Jun 2020 18:14:33 +0000 (14:14 -0400)]
pan/mdg: Handle regular nir_intrinsic_load_output

Instead of the vendored version. Only for blend shaders at the moment,
frag shaders fb_fetch has a lot more going on.

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

4 years agopan/mdg: Allow f2u8 and friends thru
Alyssa Rosenzweig [Mon, 25 May 2020 18:46:53 +0000 (14:46 -0400)]
pan/mdg: Allow f2u8 and friends thru

Now that we can handle destination sizes directly, this keeps us from
needing to chew through so many conversions.

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

4 years agopan/mdg: Handle f2u8
Alyssa Rosenzweig [Mon, 25 May 2020 18:46:40 +0000 (14:46 -0400)]
pan/mdg: Handle f2u8

This is similar to f2u16.

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

4 years agopan/mdg: Fold roundmode into applicable instructions
Alyssa Rosenzweig [Mon, 25 May 2020 18:19:24 +0000 (14:19 -0400)]
pan/mdg: Fold roundmode into applicable instructions

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

4 years agopan/mdg: Implement *_rtz conversions with roundmode
Alyssa Rosenzweig [Mon, 25 May 2020 18:19:11 +0000 (14:19 -0400)]
pan/mdg: Implement *_rtz conversions with roundmode

Use rte as the canonical type.

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

4 years agopan/mdg: Lower roundmodes
Alyssa Rosenzweig [Mon, 25 May 2020 18:11:04 +0000 (14:11 -0400)]
pan/mdg: Lower roundmodes

So now we can use the IR field semantically.

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

4 years agopan/mdg: Add opcode roundmode property
Alyssa Rosenzweig [Mon, 1 Jun 2020 18:06:44 +0000 (14:06 -0400)]
pan/mdg: Add opcode roundmode property

When the output is rounded in a specified direction.

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

4 years agopan/mdg: Add roundmode enum
Alyssa Rosenzweig [Mon, 25 May 2020 18:05:34 +0000 (14:05 -0400)]
pan/mdg: Add roundmode enum

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

4 years agopan/mdg: Distinguish blend shaders in internal shader-db
Alyssa Rosenzweig [Mon, 25 May 2020 17:19:43 +0000 (13:19 -0400)]
pan/mdg: Distinguish blend shaders in internal shader-db

Since these shaders are purely internal, the optimization criteria are a
bit different, so it's worth calling attention to this when dumping.

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

4 years agopanfrost: Only use AFBC YTR with RGB and RGBA
Icecream95 [Tue, 2 Jun 2020 02:14:12 +0000 (14:14 +1200)]
panfrost: Only use AFBC YTR with RGB and RGBA

The "lossless colorspace transform" is lossy for R and RG formats.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5293>

4 years agopanfrost: Decode AFBC flag bits
Icecream95 [Tue, 2 Jun 2020 02:13:03 +0000 (14:13 +1200)]
panfrost: Decode AFBC flag bits

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5293>

4 years agoglsl: when NIR linker enable use it to resize uniform arrays
Timothy Arceri [Tue, 5 May 2020 04:24:46 +0000 (14:24 +1000)]
glsl: when NIR linker enable use it to resize uniform arrays

Here we turn on uniform array resizing in the NIR linker and disable
the GLSL IR resizing pass when the NIR linker is enabled.

This will potentially make uniform arrays smaller due to NIR
optimising away more uniform uses.

Shader-db results (SKL):

total instructions in shared programs: 14947192 -> 14944093 (-0.02%)
instructions in affected programs: 138088 -> 134989 (-2.24%)
helped: 822
HURT: 4

total cycles in shared programs: 324868402 -> 324794597 (-0.02%)
cycles in affected programs: 3904170 -> 3830365 (-1.89%)
helped: 2333
HURT: 1485

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4910>

4 years agoglsl: gather uniform dereference info before main linking loop
Timothy Arceri [Tue, 5 May 2020 04:22:04 +0000 (14:22 +1000)]
glsl: gather uniform dereference info before main linking loop

We want to gather information for all stages here before the main
linking loop. In the following patch we will use to information
to reduce the size of uniform arrays where possible.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4910>

4 years agoglsl: add update_array_sizes() helper to the NIR uniform linker
Timothy Arceri [Tue, 5 May 2020 04:18:23 +0000 (14:18 +1000)]
glsl: add update_array_sizes() helper to the NIR uniform linker

This will be used to reduce the size of uniform arrays and replace
the current glsl ir pass. Doing this in NIR allows us to better
optimise the size of uniform arrays.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4910>

4 years agoglsl: add struct to gather more info about uniform array access
Timothy Arceri [Tue, 5 May 2020 04:13:51 +0000 (14:13 +1000)]
glsl: add struct to gather more info about uniform array access

This will be used in the following patches to allow the linker
to resize uniform arrays based on array dereferences.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4910>

4 years agoutil: add BITSET_LAST_BIT() helper
Timothy Arceri [Wed, 29 Apr 2020 04:15:12 +0000 (14:15 +1000)]
util: add BITSET_LAST_BIT() helper

This is the reverse of BITSET_FFS()

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4910>

4 years agoi965: call brw_nir_lower_uniforms() after uniform linking is complete
Timothy Arceri [Wed, 6 May 2020 04:01:41 +0000 (14:01 +1000)]
i965: call brw_nir_lower_uniforms() after uniform linking is complete

i965 currently uses the NIR uniform linker for spirv support. Until
now the only reason there has been no issue with calling the
lowering pass before the linker is because no garbage collection
is done between the calls.

An upcoming change to the linker will add an optimisation to resize
unform arrays where possible. Because lowering causes the array
defs to no longer be used the new optimisation ends up resizing the
arrays to 0. To fix this we move the lowering call after the
linking calls.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4910>

4 years agogbm: document that gbm_bo_map exposes a linear view
Simon Ser [Thu, 28 May 2020 10:27:07 +0000 (12:27 +0200)]
gbm: document that gbm_bo_map exposes a linear view

Drivers (Gallium, i965) expose a linear view of the buffer via
gbm_bo_map.

Signed-off-by: Simon Ser <contact@emersion.fr>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5238>

4 years agoglsl: Don't replace lrp pattern with lrp if arguments are not floats
Danylo Piliaiev [Fri, 29 May 2020 13:20:45 +0000 (16:20 +0300)]
glsl: Don't replace lrp pattern with lrp if arguments are not floats

We don't have "lrp(int, int, int)" and validation of ir_triop_lrp
fails down the road.

Fixes: 8d37e991
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3059
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Tested-by: Witold Baryluk <witold.baryluk@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5257>

4 years agospirv: Use scoped barriers for SpvOpControlBarrier
Boris Brezillon [Tue, 5 May 2020 08:31:02 +0000 (10:31 +0200)]
spirv: Use scoped barriers for SpvOpControlBarrier

If use_scoped_barrier is set to true, we don't have to split the control
and memory barriers.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4900>

4 years agointel/compiler: Extract control barriers from scoped barriers
Boris Brezillon [Tue, 5 May 2020 08:18:29 +0000 (10:18 +0200)]
intel/compiler: Extract control barriers from scoped barriers

Add a lowering pass extracting all control barriers embedded in scoped
barriers into proper control barriers so we can get rid of the logic
inserting control barriers when an SpvOpControlBarrier with WorkGroup
scope is parsed in spirv_to_nir().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4900>

4 years agonir: Replace the scoped_memory barrier by a scoped_barrier
Boris Brezillon [Tue, 5 May 2020 07:13:20 +0000 (09:13 +0200)]
nir: Replace the scoped_memory barrier by a scoped_barrier

SPIRV OpControlBarrier can have both a memory and a control barrier
which some hardware can handle with a single instruction. Let's
turn the scoped_memory_barrier into a scoped barrier which can embed
both barrier types. Note that control-only or memory-only barriers can
be supported through this new intrinsic by passing NIR_SCOPE_NONE to the
unused barrier type.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Suggested-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4900>

4 years agospirv: Split the vtn_emit_scoped_memory_barrier() logic
Boris Brezillon [Thu, 23 Apr 2020 12:16:43 +0000 (14:16 +0200)]
spirv: Split the vtn_emit_scoped_memory_barrier() logic

We are about to add support for scoped control+memory barriers. Let's
move the convert from SPIRV to NIR enums logic in helpers so we can
easily re-use them.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4900>

4 years agoradv: enable zero VRAM for all VKD3D (DX12->VK) games
Samuel Pitoiset [Fri, 29 May 2020 18:26:00 +0000 (20:26 +0200)]
radv: enable zero VRAM for all VKD3D (DX12->VK) games

To fix rendering issues with Metro Exodus, RE2 and 3 and probably
more titles. It seems the default behaviour of DX12 anyways.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3064
Cc: <mesa-stable@lists.freedesktop.org>
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/5262>

4 years agoradv: enable zero VRAM for Doom Eternal
Samuel Pitoiset [Fri, 29 May 2020 18:02:49 +0000 (20:02 +0200)]
radv: enable zero VRAM for Doom Eternal

That fixes some rendering issues. Probably some unitialized data
from the game.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3064
Cc: <mesa-stable@lists.freedesktop.org>
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/5262>

4 years agogitlab-ci: bump piglit checkout commit
Timothy Arceri [Wed, 3 Jun 2020 00:23:32 +0000 (10:23 +1000)]
gitlab-ci: bump piglit checkout commit

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

4 years agoglsl/spirv: remove dead uniforms in spirv nir linker
Timothy Arceri [Mon, 4 May 2020 04:33:56 +0000 (14:33 +1000)]
glsl/spirv: remove dead uniforms in spirv nir linker

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797>

4 years agoglsl: remove dead uniforms in the nir linker
Timothy Arceri [Wed, 29 Apr 2020 02:20:47 +0000 (12:20 +1000)]
glsl: remove dead uniforms in the nir linker

This is now possible as we do uniform linking via a nir based linker.

Shader-db results for IRIS (SKL):

total instructions in shared programs: 14947192 -> 14946397 (<.01%)
instructions in affected programs: 39498 -> 38703 (-2.01%)
helped: 230
HURT: 18

total cycles in shared programs: 324868402 -> 324847058 (<.01%)
cycles in affected programs: 706701 -> 685357 (-3.02%)
helped: 599
HURT: 449

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797>

4 years agoglsl: add can_remove_uniform() helper to the NIR linker
Timothy Arceri [Thu, 28 May 2020 01:08:42 +0000 (11:08 +1000)]
glsl: add can_remove_uniform() helper to the NIR linker

This helper reflects the rules we follow in the GLSL IR linker when
deciding if we can remove a dead uniform. This check is required to
avoid regressions when turning on NIR dead uniform clean up in the
following patch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797>

4 years agonir: add callback to nir_remove_dead_variables()
Timothy Arceri [Thu, 28 May 2020 00:59:28 +0000 (10:59 +1000)]
nir: add callback to nir_remove_dead_variables()

This allows us to do API specific checks before removing variable
without filling nir_remove_dead_variables() with API specific code.

In the following patches we will use this to support the removal
of dead uniforms in GLSL.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797>

4 years agonir: add glsl_get_ifc_packing() helper
Timothy Arceri [Thu, 30 Apr 2020 03:36:02 +0000 (13:36 +1000)]
nir: add glsl_get_ifc_packing() helper

This will be used in the following patch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797>

4 years agopan/mdg: Don't double-replicate blend on T720
Alyssa Rosenzweig [Tue, 2 Jun 2020 22:12:14 +0000 (18:12 -0400)]
pan/mdg: Don't double-replicate blend on T720

We already do this unconditionally in NIR.

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

4 years agoradv: Use common gfx10_format_table.h
Bas Nieuwenhuizen [Mon, 1 Jun 2020 23:44:52 +0000 (01:44 +0200)]
radv: Use common gfx10_format_table.h

Save some python code and build time, as well as some code duplication.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5291>

4 years agoradv: Include gfx10_format_table.h only from a single source file.
Bas Nieuwenhuizen [Mon, 1 Jun 2020 22:45:14 +0000 (00:45 +0200)]
radv: Include gfx10_format_table.h only from a single source file.

The radeonsi variant has everything in the header, so lets not
include it everywhere.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5291>

4 years agoradeonsi: Define gfx10_format in the common header.
Bas Nieuwenhuizen [Mon, 1 Jun 2020 22:55:22 +0000 (00:55 +0200)]
radeonsi: Define gfx10_format in the common header.

So we don't have to have multiple definitions of the struct when
sharing with radv.

While at it put the table properly in a C file so we don't have to
deal with multiple definitions, and the struct definition isn't
in generated source.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5291>

4 years agoamd/common,radeonsi: Move gfx10_format_table to common.
Bas Nieuwenhuizen [Mon, 1 Jun 2020 21:49:22 +0000 (23:49 +0200)]
amd/common,radeonsi: Move gfx10_format_table to common.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5291>

4 years agoradeonsi: Explicitly map Z16_UNORM_S8_UINT to None for GFX10.
Bas Nieuwenhuizen [Mon, 1 Jun 2020 22:34:28 +0000 (00:34 +0200)]
radeonsi: Explicitly map Z16_UNORM_S8_UINT to None for GFX10.

We should always use separate planes for textures with this format.

Fixes: 273ead81f1a "util/format: Add VK_FORMAT_D16_UNORM_S8_UINT."
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5291>

4 years agoRevert "CI: Disable Panfrost T720/T760"
Daniel Stone [Tue, 2 Jun 2020 18:59:00 +0000 (19:59 +0100)]
Revert "CI: Disable Panfrost T720/T760"

Switches have been rewired, VLANs have been reconfigured, network
elements with non-functional remote management have been removed from
racks and thrown on desks in anger.

This reverts commit ae6e1aee7d1bd49ae494b8a25ca33d092a3a145a.

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

4 years agoci: bare-metal: make it possible to use a script for serial
Christian Gmeiner [Sat, 9 May 2020 19:49:52 +0000 (21:49 +0200)]
ci: bare-metal: make it possible to use a script for serial

Makes it possible to use e.g. a ser2net script to talk to the devices.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5268>