mesa.git
5 years agonir/deref: Consider COHERENT decorated var derefs as aliasing
Jason Ekstrand [Sun, 10 Mar 2019 22:41:02 +0000 (17:41 -0500)]
nir/deref: Consider COHERENT decorated var derefs as aliasing

If we get to two deref_var paths with different variables, we usually
know they don't alias.  However, if both of the paths are marked
coherent, we don't have to worry about it.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agocompiler/types: Add helpers to get explicit types for standard layouts
Jason Ekstrand [Sat, 9 Mar 2019 15:06:27 +0000 (09:06 -0600)]
compiler/types: Add helpers to get explicit types for standard layouts

We also need to modify the current size/align helpers to not blow up
when they encounter an explicitly laid out type.  Previously we
considered using the size/align helpers mutually exclusive with standard
layouts but now we just assert that they match.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agocompiler/types: Add a C wrapper to get full struct field data
Jason Ekstrand [Mon, 11 Mar 2019 02:43:37 +0000 (21:43 -0500)]
compiler/types: Add a C wrapper to get full struct field data

Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agocompiler/types: Add a new is_interface C wrapper
Jason Ekstrand [Sat, 9 Mar 2019 16:22:39 +0000 (10:22 -0600)]
compiler/types: Add a new is_interface C wrapper

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/validate: Allow 32-bit boolean load/store intrinsics
Jason Ekstrand [Sat, 9 Mar 2019 21:05:25 +0000 (15:05 -0600)]
nir/validate: Allow 32-bit boolean load/store intrinsics

With UBOs and SSBOs we have boolean types but they're actually 32-bit
values.  Make the validator a little less strict so that we can do a
32-bit load/store on boolean types.  We're about to add a lowering pass
called gl_nir_lower_buffers which will lower boolean load/store
operations to 32-bit and insert i2b and b2i instructions to convert
to/from 1-bit booleans.  We want that to be legal.

Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/validate: Only require bare types to match for copy_deref
Jason Ekstrand [Sat, 9 Mar 2019 19:06:28 +0000 (13:06 -0600)]
nir/validate: Only require bare types to match for copy_deref

If we want to be able to use copy_deref instructions on explicitly laid
out types, we have to be a little more flexible about what types we
allow.  Instead, of requiring the types to exactly match, only require
the bare types to match.

Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/algebraic: Add a couple optimizations for iabs and ishr
Jason Ekstrand [Sun, 10 Mar 2019 15:06:56 +0000 (10:06 -0500)]
nir/algebraic: Add a couple optimizations for iabs and ishr

Shader-db results on Kaby Lake:

    total instructions in shared programs: 15225213 -> 15222365 (-0.02%)
    instructions in affected programs: 43524 -> 40676 (-6.54%)
    helped: 203
    HURT: 0

Lots of shaders in Shadow Warrior had this pattern along with Deus Ex,
Civ, Shadow of Mordor, and several others.

Reviewed-by: Kristian H. Kristensen <hoegsberg@chromium.org>
5 years agomesa/st: Fix leaks of TGSI tokens in VP variants.
Eric Anholt [Tue, 12 Mar 2019 22:18:43 +0000 (15:18 -0700)]
mesa/st: Fix leaks of TGSI tokens in VP variants.

Starting a glxgears and closing it, I was seeing a lot of leaked TGSI for
the fixed function VPs.

v2: drop unused delete_ir() arg.

Fixes: 3b4929ec6e64 ("st/mesa: Copy VP TGSI tokens if they exist, even for NIR shaders.")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agomesa/st: Make sure that prog_to_nir NIR gets freed.
Eric Anholt [Wed, 13 Mar 2019 00:07:16 +0000 (17:07 -0700)]
mesa/st: Make sure that prog_to_nir NIR gets freed.

GLSL NIR gets freed on relink by _mesa_delete_program(), but for ARB
programs we need to free the old NIR when PSN is used to set up new NIR in
the same gl_program.  Additionally, set the base .nir field so that it
will get freed by _mesa_delete_program().

Fixes: 3d7611e9a6c6 ("st/nir: use NIR for asm programs")
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agopanfrost/midgard: Implement fpow
Alyssa Rosenzweig [Wed, 13 Mar 2019 05:01:43 +0000 (05:01 +0000)]
panfrost/midgard: Implement fpow

We have a native op for this, which was just found in a disassembly --
so instead of lowering, use it!

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Compute viewport state on the fly
Alyssa Rosenzweig [Wed, 13 Mar 2019 01:50:40 +0000 (01:50 +0000)]
panfrost: Compute viewport state on the fly

Previously, we were caching this incorrectly; there's no real reason to
given how variable it is (sensitive to changes in viewport, framebuffer
dimensions, and scissors) and how cheap it is to recompute. So, just do
it on the fly each draw.

Fixes glmark-es2 -bshadow and -brefract.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost; Disable AFBC for depth buffers
Alyssa Rosenzweig [Wed, 13 Mar 2019 01:31:30 +0000 (01:31 +0000)]
panfrost; Disable AFBC for depth buffers

For inexplicable reasons, the depth buffer is faster if kept as linear,
whereas the colour buffers are faster if AFBC. Given both code paths are
available, we'll choose the faster one of each (which also helps with
testing coverage).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Allocate extra data for depth buffer
Alyssa Rosenzweig [Wed, 13 Mar 2019 00:53:34 +0000 (00:53 +0000)]
panfrost: Allocate extra data for depth buffer

It's not clear why the hardware "spills" a little bit, but if we don't
do this, we get MMU faults with linear depth buffers.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Comment spelling fix
Alyssa Rosenzweig [Wed, 13 Mar 2019 00:53:18 +0000 (00:53 +0000)]
panfrost: Comment spelling fix

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost/mfbd: Respect per-job depth write flag
Alyssa Rosenzweig [Tue, 12 Mar 2019 23:16:37 +0000 (23:16 +0000)]
panfrost/mfbd: Respect per-job depth write flag

While a depth buffer may be supplied, it only needs to be written to if
the depth writemask is set for any draw AND if the depth buffer is not
immediately invalidated (as is the case for scanout). This refactors
panfrost_job to provide a depth write requirement, which is now
implemented for MFBD depth buffers.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost/mfbd: Implement linear depth buffers
Alyssa Rosenzweig [Tue, 12 Mar 2019 22:49:33 +0000 (22:49 +0000)]
panfrost/mfbd: Implement linear depth buffers

This removes a clunky hack where the depth buffer was enabled during the
*clear*, instead of during depth buffer linking. That said, this does
not yet support writeback like AFBC depth buffers.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Minor comment cleanup (version detection)
Alyssa Rosenzweig [Tue, 12 Mar 2019 22:42:16 +0000 (22:42 +0000)]
panfrost: Minor comment cleanup (version detection)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Remove staging MFBD
Alyssa Rosenzweig [Tue, 12 Mar 2019 22:41:11 +0000 (22:41 +0000)]
panfrost: Remove staging MFBD

Same idea as the previous commit, but for the MFBD this time instead of
the SFBD.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Remove staging SFBD for pan_context
Alyssa Rosenzweig [Tue, 12 Mar 2019 22:01:23 +0000 (22:01 +0000)]
panfrost: Remove staging SFBD for pan_context

The fragment framebuffer descriptor should not be a context entry;
rather, it should be constructed only at fragment time to keep analysis
tractable.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Break out fragment to SFBD/MFBD files
Alyssa Rosenzweig [Tue, 12 Mar 2019 03:32:17 +0000 (03:32 +0000)]
panfrost: Break out fragment to SFBD/MFBD files

This substantially cleans up the corresponding logic at the expense of a
bit of code duplication; nevertheless, it's a net win since otherwise
incompatible hardware code is mixed confusingly.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agofreedreno: Use shared drm_find_modifier util
Alyssa Rosenzweig [Thu, 14 Mar 2019 04:14:37 +0000 (04:14 +0000)]
freedreno: Use shared drm_find_modifier util

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Rob Clark <robdclark@gmail.com>
5 years agovc4: Use shared drm_find_modifier util
Alyssa Rosenzweig [Thu, 14 Mar 2019 04:16:07 +0000 (04:16 +0000)]
vc4: Use shared drm_find_modifier util

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agov3d: Use shared drm_find_modifier util
Alyssa Rosenzweig [Thu, 14 Mar 2019 04:15:20 +0000 (04:15 +0000)]
v3d: Use shared drm_find_modifier util

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agoutil: Add a drm_find_modifier helper
Alyssa Rosenzweig [Thu, 14 Mar 2019 04:13:45 +0000 (04:13 +0000)]
util: Add a drm_find_modifier helper

This function is replicated across vc4/v3d/freedreno and is needed in
Panfrost; let's make this shared code.

v2: Supply generic util_array_contains_u64 version (Eric Engestrom). Add
missing stdbool.h include (Eric Anholt). Mark inline (Christian
Gmeiner).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agomesa: add logging function for formatted string
Mark Janes [Fri, 7 Dec 2018 00:35:44 +0000 (16:35 -0800)]
mesa: add logging function for formatted string

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomesa: rename logging functions to reflect that they format strings
Mark Janes [Fri, 7 Dec 2018 00:35:43 +0000 (16:35 -0800)]
mesa: rename logging functions to reflect that they format strings

In preparation for the definition of a function to log a formatted
string.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agomesa: properly report the length of truncated log messages
Mark Janes [Fri, 7 Dec 2018 00:35:42 +0000 (16:35 -0800)]
mesa: properly report the length of truncated log messages

_mesa_log_msg must provide the length of the string passed into the
KHR_debug api.  When the string formatted by _mesa_gl_vdebugf exceeds
MAX_DEBUG_MESSAGE_LENGTH, the length is incorrectly set to the number
of characters that would have been written if enough space had been
available.

Fixes: 30256805784450b8bb9d4dabfb56226271ca9d24
       ("mesa: Add support for GL_ARB_debug_output with dynamic ID allocation.")

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agoanv: Only set 3DSTATE_PS::VectorMaskEnable on gen8+
Jason Ekstrand [Wed, 13 Mar 2019 22:27:39 +0000 (17:27 -0500)]
anv: Only set 3DSTATE_PS::VectorMaskEnable on gen8+

We don't set it on HSW and earlier in i965 and disabling it appears to
make derivatives somewhat more reliable.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agotravis: fix osx meson build
Eric Engestrom [Thu, 14 Mar 2019 12:30:15 +0000 (12:30 +0000)]
travis: fix osx meson build

5 years agoradv: always initialize HTILE when the src layout is UNDEFINED
Samuel Pitoiset [Thu, 14 Mar 2019 13:27:03 +0000 (14:27 +0100)]
radv: always initialize HTILE when the src layout is UNDEFINED

HTILE should always be initialized when transitioning from
VK_IMAGE_LAYOUT_UNDEFINED to other image layouts. Otherwise,
if an app does a transition from UNDEFINED to GENERAL, the
driver doesn't initialize HTILE and it tries to decompress
the depth surface. For some reasons, this results in VM faults.

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107563
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agopanfrost: Adapt to uapi changes
Tomeu Vizoso [Thu, 14 Mar 2019 14:20:50 +0000 (15:20 +0100)]
panfrost: Adapt to uapi changes

Two ioctls had wrong DRM_IO* flags.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Rob Herring <robh@kernel.org>
5 years agoi965: Disable ARB_fragment_shader_interlock for platforms prior to GEN9
Plamena Manolova [Tue, 12 Mar 2019 19:25:36 +0000 (21:25 +0200)]
i965: Disable ARB_fragment_shader_interlock for platforms prior to GEN9

ARB_fragment_shader_interlock depends on memory fences to
ensure fragment ordering and this ordering guarantee is
only supported from GEN9 onwards.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109980
Fixes: 939312702e35 "i965: Add ARB_fragment_shader_interlock support."
Signed-off-by: Plamena Manolova <plamena.n.manolova@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoiris: Don't mutate box in transfer map code
Kenneth Graunke [Wed, 13 Mar 2019 22:35:28 +0000 (15:35 -0700)]
iris: Don't mutate box in transfer map code

Not mutating the boxes is arguably cleaner.

Split from a patch by Chris Wilson but reworked to use a pointer to the
original box rather than making a copy at all.

5 years agoi965: remove scaling factors from P010, P012
Tapani Pälli [Wed, 13 Mar 2019 10:13:09 +0000 (12:13 +0200)]
i965: remove scaling factors from P010, P012

Patch removes scaling factors introduced in 2a2e69f975b but leaves
option to use scaling in place as it could be useful with other upcoming
YUV formats.

We did this scaling because ffmpeg was shifting channel bits down, however
it seems this is not the right place as compositor wants to flip same
buffers directly to display as well and therefore bitshifting needs to be
done by the client when receiving frame from ffmpeg.

Now P0x formats are treated the same, e.g. P010 is same as P016 but with
lower 6 bits set to zeros.

Fixes: 2a2e69f975b "i965: add P0x formats and propagate required scaling factors"
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoanv/pass: Flag the need for a RT flush for resolve attachments
Jason Ekstrand [Wed, 13 Mar 2019 03:55:14 +0000 (22:55 -0500)]
anv/pass: Flag the need for a RT flush for resolve attachments

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Cc: mesa-stable@lists.freedesktop.org
5 years agoanv: Stop using VK_TRUE/FALSE
Jason Ekstrand [Tue, 12 Mar 2019 20:22:19 +0000 (15:22 -0500)]
anv: Stop using VK_TRUE/FALSE

We've been fairly inconsistent about this so we should really choose
whether we're going to use VK_TRUE/FALSE or the C boolean values.  The
Vulkan #defines are set to 1 and 0 respectively so it's the same value
as C gives you when you cast a boolean expression to an integer.  Since
there are several places where we set a VkBool32 to a C logical
expression, let's just embrace C booleans and stop using the VK defines.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agovirgl: use uint16_t mask instead of separate booleans
Gurchetan Singh [Wed, 13 Mar 2019 22:58:22 +0000 (22:58 +0000)]
virgl: use uint16_t mask instead of separate booleans

This should save some space.

Suggested-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoFix link release notes for 19.0.0.
Albert Pal [Wed, 13 Mar 2019 20:28:06 +0000 (20:28 +0000)]
Fix link release notes for 19.0.0.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agoiris: Enable auxiliary buffer support again
Rafael Antognolli [Fri, 22 Feb 2019 01:51:26 +0000 (17:51 -0800)]
iris: Enable auxiliary buffer support again

Now that we are properly resolving buffers before giving them to the
window system, let's enable aux support again.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris: Convert RGBX to RGBA always.
Rafael Antognolli [Thu, 7 Mar 2019 23:32:38 +0000 (15:32 -0800)]
iris: Convert RGBX to RGBA always.

In i965, we disable the use of RGBX formats, so the higher layers of
Mesa choose the equivalent RGBA format, and swizzle the alpha channel to
1.0.

However, Gallium won't do that. We need to explicitly convert it to
RGBA.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris: Add resolve on iris_flush_resource.
Rafael Antognolli [Thu, 28 Feb 2019 19:08:32 +0000 (11:08 -0800)]
iris: Add resolve on iris_flush_resource.

The flush_resource hook is supposedly called when the resource content
needs to be made visible to external (okay, that's pretty vague). For
instance, it gets called before a surface gets handled to the window
system. So we need to resolve it if it's not resolved yet.

v2 (Ken):
 - Check mod_info in iris_flush_resource instead of ISL_AUX_USAGE_NONE
 - Drop my old broken resolve code from iris_resource_get_handle() now
   that Rafael's got it hooked up in the right place.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoir3/lower_io_offsets: Try propagate SSBO's SHR into a previous shift instruction
Eduardo Lima Mitev [Thu, 28 Feb 2019 17:17:50 +0000 (18:17 +0100)]
ir3/lower_io_offsets: Try propagate SSBO's SHR into a previous shift instruction

While we lack value range tracking, this patch tries to 'manually' propogate
the division by 4 to calculate SSBO element-offset, into a possible previous
shift operation (shift left or right); checking that it is safe to do so.

This should help in cases like ie. when accessing a field in an array of
structs, where the offset is likely defined as base plus a multiplication
by a struct or array element size.

See dEQP test 'dEQP-GLES31.functional.ssbo.atomic.xor.highp_uint'
for an example of a shader that benefits from this.

Reviewed-by: Rob Clark <robdclark@gmail.com>
5 years agoir3/compiler: Enable lower_io_offsets pass and handle new SSBO intrinsics
Eduardo Lima Mitev [Tue, 26 Feb 2019 13:07:04 +0000 (14:07 +0100)]
ir3/compiler: Enable lower_io_offsets pass and handle new SSBO intrinsics

These intrinsics have the offset in dwords already computed in the last
source, so the change here is basically using that instead of emitting
the ir3_SHR to divide the byte-offset by 4.

The improvement in shader stats is significant, of up to ~15% in
instruction count in some cases. Tested only on a5xx.

shader-db is unfortunately not very useful here because shaders that use
SSBO require GLSL versions that are not supported by freedreno yet.

For examples, most Khronos CTS tests under 'dEQP-GLES31.functional.ssbo.*'
are helped.

A random case:

dEQP-GLES31.functional.ssbo.layout.2_level_array.packed.row_major_mat3x2

with current master:

; CL prog 14/1: 1252 instructions, 0 half, 48 full
; 8 const, 8 constlen
; 61 (ss), 43 (sy)

with the SSBO dword-offset moved to NIR:

; CL prog 14/1: 1053 instructions, 0 half, 45 full
; 7 const, 7 constlen
; 34 (ss), 73 (sy)

The SHR previously emitted for every single SSBO instruction disappears
in most cases, and the dword-offset ends up embedded in the STGB
instruction as immediate in many cases as well.

There are also a few of those tests that are currently failing on register
allocation, that start to pass as a result of reducing the pressure. At least
these, probably more:

dEQP-GLES31.functional.ssbo.layout.random.unsized_arrays.24
dEQP-GLES31.functional.ssbo.layout.random.arrays_of_arrays.6
dEQP-GLES31.functional.ssbo.layout.random.arrays_of_arrays.17
dEQP-GLES31.functional.ssbo.layout.random.nested_structs_arrays.14
dEQP-GLES31.functional.ssbo.layout.random.nested_structs_arrays_instance_arrays.5
dEQP-GLES31.functional.ssbo.layout.random.nested_structs_arrays_instance_arrays.7

No regressions observed with relevant CTS and piglit tests.

Reviewed-by: Rob Clark <robdclark@gmail.com>
5 years agoir3/nir: Add a new pass 'ir3_nir_lower_io_offsets'
Eduardo Lima Mitev [Sun, 13 Jan 2019 19:10:34 +0000 (20:10 +0100)]
ir3/nir: Add a new pass 'ir3_nir_lower_io_offsets'

This NIR->NIR pass implements offset computations that are currently
done on the IR3 backend compiler, to give NIR a better chance of
optimizing them.

For now, it supports lowering the dword-offset computation for SSBO
instructions. It will take an SSBO intrinsic and replace it with the
new ir3-specific version that adds an extra source. That source will
hold the SSA value resulting from inserting a division by 4 (an SHR op)
of the original byte-offset source already provided by NIR in one of
the intrinsic sources.

Note that on a6xx the original byte-offset is not needed, so we could
potentially replace that source instead of adding a new one. But to
keep things simple and consistent we always add the new source and
a6xx will just ignore the original one.

Reviewed-by: Rob Clark <robdclark@gmail.com>
5 years agonir: Add ir3-specific version of most SSBO intrinsics
Eduardo Lima Mitev [Tue, 26 Feb 2019 07:45:07 +0000 (08:45 +0100)]
nir: Add ir3-specific version of most SSBO intrinsics

These are ir3 specific versions of SSBO intrinsics that add an
extra source to hold the element offset (dword), which is what the
backend instructions need.

The original byte-offset source provided by NIR is not replaced
because on a4xx and a5xx the backend still needs it.

Reviewed-by: Rob Clark <robdclark@gmail.com>
5 years agodocs: update calendar, add news item, and link release notes for 19.0.0
Dylan Baker [Wed, 13 Mar 2019 19:36:27 +0000 (12:36 -0700)]
docs: update calendar, add news item, and link release notes for 19.0.0

5 years agodocs: Add SHA256 sums for 19.0.0
Dylan Baker [Wed, 13 Mar 2019 19:09:08 +0000 (12:09 -0700)]
docs: Add SHA256 sums for 19.0.0

5 years agodocs: Add release notes for 19.0.0
Dylan Baker [Wed, 13 Mar 2019 17:40:19 +0000 (10:40 -0700)]
docs: Add release notes for 19.0.0

5 years agoegl/dri: Avoid out of bounds array access
Kevin Strasser [Mon, 28 Jan 2019 18:42:44 +0000 (10:42 -0800)]
egl/dri: Avoid out of bounds array access

indexConfigAttrib iterates over every index in the dri driver, possibly
exceeding __DRI_ATTRIB_MAX. In other words, if the dri driver has newer
attributes libEGL will end up reading from uninitialized memory through
dri2_to_egl_attribute_map[].

Signed-off-by: Kevin Strasser <kevin.strasser@intel.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
5 years agoiris: Use streaming loads to read from tiled surfaces
Chris Wilson [Fri, 22 Feb 2019 20:53:41 +0000 (20:53 +0000)]
iris: Use streaming loads to read from tiled surfaces

Always use the streaming load (since we know we have Broadwell+, all of
our target CPU support sse41) for reading back form the tiled surface
for mapping the resource. This means we hit the fast WC handling paths
on Atoms (without LLC), and for big Core (with LLC) using the streaming
load is no less efficient as we do not require the tiled buffer to be
pulled into the CPU cache.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris: Use coherent allocation for PIPE_RESOURCE_STAGING
Chris Wilson [Fri, 22 Feb 2019 21:24:46 +0000 (21:24 +0000)]
iris: Use coherent allocation for PIPE_RESOURCE_STAGING

On !llc machines (Atoms), reading from a linear buffers is slow and so
copying from one resource into the linear staging buffer is still slow.
However, we can tell the GPU to snoop the CPU cache when reading from and
writing to the staging buffer eliminating the slow uncached reads.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoiris: Use PIPE_BUFFER_STAGING for the query objects
Chris Wilson [Mon, 25 Feb 2019 09:42:49 +0000 (09:42 +0000)]
iris: Use PIPE_BUFFER_STAGING for the query objects

We prefer fast CPU access to read back the query results.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agointel/nir: Combine store_derefs to improve code from SPIR-V
Caio Marcelo de Oliveira Filho [Mon, 11 Mar 2019 16:43:04 +0000 (09:43 -0700)]
intel/nir: Combine store_derefs to improve code from SPIR-V

Due to lack of write mask in SPIR-V store, generators may produce
multiple stores to the same vector but using different array derefs.
Use the combining store pass to clean this up.  For example,

    layout(binding = 3) buffer block {
        vec4 v;
    };

    void main() {
        v.x = 11;
        v.y = 22;
    }

after going to SPIR-V and NIR, ends up with in two store_derefs to
v[0] and v[1]

    vec2 32 ssa_4 = deref_struct &ssa_3->field0 (ssbo vec4) /* &((block *)ssa_2)->field0 */
    vec2 32 ssa_6 = deref_array &(*ssa_4)[0] (ssbo float) /* &((block *)ssa_2)->field0[0] */
    intrinsic store_deref (ssa_6, ssa_7) (1, 0) /* wrmask=x */ /* access=0 */
    vec1 32 ssa_13 = load_const (0x00000001 /* 0.000000 */)
    vec2 32 ssa_14 = deref_array &(*ssa_4)[1] (ssbo float) /* &((block *)ssa_2)->field0[1] */
    intrinsic store_deref (ssa_14, ssa_15) (1, 0) /* wrmask=x */ /* access=0 */

producing two different sends instructions in skl.  The combining pass
transform the snippet above into

    vec2 32 ssa_4 = deref_struct &ssa_3->field0 (ssbo vec4) /* &((block *)ssa_2)->field0 */
    vec4 32 ssa_18 = vec4 ssa_7, ssa_15, ssa_16, ssa_17
    intrinsic store_deref (ssa_4, ssa_18) (3, 0) /* wrmask=xy */ /* access=0 */

producing a single sends instruction.

v2: Move this from spirv_to_nir into the general optimization pass for
    intel compiler.  (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/nir: Combine store_derefs after vectorizing IO
Caio Marcelo de Oliveira Filho [Fri, 8 Mar 2019 19:50:47 +0000 (11:50 -0800)]
intel/nir: Combine store_derefs after vectorizing IO

Shader-db results for skl:

    total instructions in shared programs: 15232903 -> 15224781 (-0.05%)
    instructions in affected programs: 61246 -> 53124 (-13.26%)
    helped: 221
    HURT: 0

    total cycles in shared programs: 371440470 -> 371398018 (-0.01%)
    cycles in affected programs: 281363 -> 238911 (-15.09%)
    helped: 221
    HURT: 0

Results for bdw are very similar.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: Add a pass to combine store_derefs to same vector
Caio Marcelo de Oliveira Filho [Fri, 8 Mar 2019 18:08:20 +0000 (10:08 -0800)]
nir: Add a pass to combine store_derefs to same vector

v2: (all from Jason)
    Reuse existing function for the end of the block combinations.
    Check the SSA values are coming from the right place in tests.
    Document the case when the store to array_deref is reused.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoac: use the raw tbuffer version for 16-bit SSBO loads
Samuel Pitoiset [Wed, 13 Mar 2019 13:04:14 +0000 (14:04 +0100)]
ac: use the raw tbuffer version for 16-bit SSBO loads

vindex is always 0.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoac: add ac_build_{struct,raw}_tbuffer_load() helpers
Samuel Pitoiset [Wed, 13 Mar 2019 13:04:13 +0000 (14:04 +0100)]
ac: add ac_build_{struct,raw}_tbuffer_load() helpers

The struct version sets IDXEN=1, while the raw version sets IDXEN=0.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: use typed buffer loads for vertex input fetches
Samuel Pitoiset [Tue, 26 Feb 2019 12:42:28 +0000 (13:42 +0100)]
radv: use typed buffer loads for vertex input fetches

This drastically reduces the number of SGPRs because the driver
now uses descriptors per vertex binding, instead of per vertex
attribute format.

29077 shaders in 15096 tests
Totals:
SGPRS: 1354285 -> 1282109 (-5.33 %)
VGPRS: 909896 -> 908800 (-0.12 %)
Spilled SGPRs: 24840 -> 24811 (-0.12 %)
Code Size: 49221144 -> 48986628 (-0.48 %) bytes
Max Waves: 243930 -> 244229 (0.12 %)

Totals from affected shaders:
SGPRS: 390648 -> 318472 (-18.48 %)
VGPRS: 288432 -> 287336 (-0.38 %)
Spilled SGPRs: 94 -> 65 (-30.85 %)
Code Size: 11548412 -> 11313896 (-2.03 %) bytes
Max Waves: 86460 -> 86759 (0.35 %)

This gives a really tiny boost.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: store more vertex attribute infos as pipeline keys
Samuel Pitoiset [Tue, 26 Feb 2019 12:42:27 +0000 (13:42 +0100)]
radv: store more vertex attribute infos as pipeline keys

They are required for using typed buffer loads.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoac: rework typed buffers loads for LLVM 7
Samuel Pitoiset [Tue, 26 Feb 2019 12:42:26 +0000 (13:42 +0100)]
ac: rework typed buffers loads for LLVM 7

Be more generic, this will be used by an upcoming series.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agopanfrost: Set bo->gem_handle when creating a linear BO
Tomeu Vizoso [Mon, 11 Mar 2019 12:35:27 +0000 (13:35 +0100)]
panfrost: Set bo->gem_handle when creating a linear BO

So we can free it later.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Set bo->size[0] in the DRM backend
Tomeu Vizoso [Mon, 11 Mar 2019 12:34:53 +0000 (13:34 +0100)]
panfrost: Set bo->size[0] in the DRM backend

So we can unmap it later.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agointel/fs: Fix opt_peephole_csel to not throw away saturates.
Kenneth Graunke [Tue, 12 Mar 2019 02:00:21 +0000 (19:00 -0700)]
intel/fs: Fix opt_peephole_csel to not throw away saturates.

We were not copying the saturate bit from the original instruction
to the new replacement instruction.  This caused major misrendering
in DiRT Rally on iris, where comparisons leading to discards failed
due to the missing saturate, causing lots of extra garbage pixels to
be drawn in text rendering, trees, and so on.

This did not show up on i965 because st/nir performs a more aggressive
version of nir_opt_peephole_select, yielding more b32csel operations.

Fixes: 52c7df1643e i965/fs: Merge CMP and SEL into CSEL on Gen8+
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
5 years agoglsl/lower_vector_derefs: Don't use a temporary for TCS outputs
Jason Ekstrand [Tue, 12 Mar 2019 01:43:15 +0000 (20:43 -0500)]
glsl/lower_vector_derefs: Don't use a temporary for TCS outputs

Tessellation control shader outputs act as if they have memory backing
them and you can have multiple writes to different components of the
same vector in-flight at the same time.  When this happens, the load vec
store pattern that gets used by ir_triop_vector_insert doesn't yield the
correct results.  Instead, just emit a sequence of conditional
assignments.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: mesa-stable@lists.freedesktop.org
5 years agoglsl/list: Add a list variant of insert_after
Jason Ekstrand [Tue, 12 Mar 2019 02:01:34 +0000 (21:01 -0500)]
glsl/list: Add a list variant of insert_after

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>

5 years agonir/loop_unroll: Fix out-of-bounds access handling
Jason Ekstrand [Tue, 12 Mar 2019 21:25:39 +0000 (16:25 -0500)]
nir/loop_unroll: Fix out-of-bounds access handling

The previous code was completely broken when it came to constructing the
undef values.  I'm not sure how it ever worked.  For the case of a copy
that reads an undefined value, we can just delete the copy because the
destination is a valid undefined value.  This saves us the effort of
trying to construct a value for an arbitrary copy_deref intrinsic.

Fixes: e8a8937a04 "nir: add partial loop unrolling support"
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agoanv: Ignore VkRenderPassInputAttachementAspectCreateInfo
Jason Ekstrand [Tue, 12 Mar 2019 23:18:58 +0000 (18:18 -0500)]
anv: Ignore VkRenderPassInputAttachementAspectCreateInfo

We don't care about the information but there's no sense in throwing a
debug warning about it.  It's harmless but annoying to users.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109984
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
5 years agov3d: Fix leak of the renderonly struct on screen destruction.
Eric Anholt [Tue, 12 Mar 2019 21:59:21 +0000 (14:59 -0700)]
v3d: Fix leak of the renderonly struct on screen destruction.

This makes v3d match vc4's destroy path.

Fixes: e113b21cb779 ("v3d: Add renderonly support.")
5 years agov3d: Fix leak of the mem_ctx after the DAG refactor.
Eric Anholt [Tue, 12 Mar 2019 21:56:57 +0000 (14:56 -0700)]
v3d: Fix leak of the mem_ctx after the DAG refactor.

Noticed while trying to get a CTS run again.

Fixes: 33886474d646 ("v3d: Use the DAG datastructure for QPU instruction scheduling.")
5 years agoglx: add support for GLX_ARB_create_context_no_error (v3)
Grigori Goronzy [Thu, 3 Aug 2017 18:07:58 +0000 (20:07 +0200)]
glx: add support for GLX_ARB_create_context_no_error (v3)

v2: Only reject no-error contexts for too-old GL if we're actually
trying to create a no-error context (Adam Jackson)
v3: Fix share contexts (Adam Jackson)

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agoradv: set the maximum number of IBs per submit to 192
Samuel Pitoiset [Tue, 12 Mar 2019 20:49:42 +0000 (21:49 +0100)]
radv: set the maximum number of IBs per submit to 192

This fixes random SteamVR corruption, see
https://github.com/ValveSoftware/SteamVR-for-Linux/issues/181

Fixes: 4d30f2c6f42 ("radv/winsys: remove the max IBs per submit limit for the fallback path")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoanv: Fix destroying descriptor sets when pool gets reset
Danylo Piliaiev [Tue, 12 Mar 2019 15:13:47 +0000 (17:13 +0200)]
anv: Fix destroying descriptor sets when pool gets reset

pool->next and pool->free_list were reset before their usage in
anv_descriptor_pool_free_set

Fixes: 775aabdd "anv: destroy descriptor sets when pool gets reset"
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agov3d: Disable PIPE_CAP_BLIT_BASED_TEXTURE_TRANSFER.
Eric Anholt [Mon, 11 Mar 2019 22:59:24 +0000 (15:59 -0700)]
v3d: Disable PIPE_CAP_BLIT_BASED_TEXTURE_TRANSFER.

This reduces the runtime of dEQP-GLES3.functional.shaders.precision.* from
11.5s to 3.3s.  This brings CTS runs down to 4 hours on one of my target
devices.

5 years agointel/nir: Vectorize all IO
Jason Ekstrand [Thu, 7 Mar 2019 21:01:37 +0000 (15:01 -0600)]
intel/nir: Vectorize all IO

The IO scalarization pass that we run to help with linking end up
turning some shader I/O such as that for tessellation and geometry
shaders into many scalar URB operations rather than one vector one.  To
alleviate this, we now vectorize the I/O once again.  This fixes a 10%
performance regression in the GfxBench tessellation test that was caused
by scalarizing.

Shader-db results on Kaby Lake:

    total instructions in shared programs: 15224023 -> 15220871 (-0.02%)
    instructions in affected programs: 342009 -> 338857 (-0.92%)
    helped: 1236
    HURT: 443

    total spills in shared programs: 23471 -> 23465 (-0.03%)
    spills in affected programs: 6 -> 0
    helped: 1
    HURT: 0

    total fills in shared programs: 31770 -> 31766 (-0.01%)
    fills in affected programs: 4 -> 0
    helped: 1
    HURT: 0

Cycles was just a lot of churn do to moves being different places.  Most
of the pure churn in instructions was +/- one or two instructions in
fragment shaders.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107510
Fixes: 4434591bf56a "intel/nir: Call nir_lower_io_to_scalar_early"
Fixes: 8d8222461f9d "intel/nir: Enable nir_opt_find_array_copies"
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
5 years agonir: Add a pass for lowering IO back to vector when possible
Jason Ekstrand [Wed, 6 Mar 2019 21:21:51 +0000 (15:21 -0600)]
nir: Add a pass for lowering IO back to vector when possible

This pass tries to turn scalar and array-of-scalar IO variables into
vector IO variables whenever possible.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Cc: "19.0" <mesa-stable@lists.freedesktop.org>
5 years agoac/nir: fix 16-bit ssbo stores
Rhys Perry [Thu, 6 Dec 2018 14:58:50 +0000 (14:58 +0000)]
ac/nir: fix 16-bit ssbo stores

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoscons: Compatibility with Scons development version string
pal1000 [Thu, 7 Mar 2019 08:38:10 +0000 (10:38 +0200)]
scons: Compatibility with Scons development version string

This ensures Mesa3D build doesn't fail in this case as encountered when
bisecting Scons source code while regression testing
https://bugs.freedesktop.org/show_bug.cgi?id=109443
and when testing 3.0.5.a.2

Technical details:
Scons version string has consistently been in this format:
MajorVersion.MinorVersion.Patch[.alpha/beta.yyyymmdd]
so these formulas should strip alpha/beta flags and return Scons version:

- as string - `'.'.join(SCons.__version__.split('.')[:3])`
- as tuple of integers - `tuple(map(int, SCons.__version__.split('.')[:3]))`

- v2: Fixed Scons version retrieval formulas as string and tuple of integers.
- v3: Fixed Scons version string format description.

Cc: "19.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
5 years agoanv: revert "anv: release memory allocated by glsl types during spirv_to_nir"
Tapani Pälli [Tue, 12 Mar 2019 12:01:26 +0000 (14:01 +0200)]
anv: revert "anv: release memory allocated by glsl types during spirv_to_nir"

This reverts commit 47fc359822494935852de1e70e4d840b2fe6a25c.

Reason is that patch did not take in to account situation where we might
have both OpenGL and Vulkan using glsl_types at the same time.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agoradeonsi/nir: Use nir stripping pass
Connor Abbott [Mon, 4 Mar 2019 17:00:30 +0000 (18:00 +0100)]
radeonsi/nir: Use nir stripping pass

This reduces compilation time for my shader-db collection from around 40
seconds to 30, vs. 19 seconds for TGSI. There are still some shaders
that TGSI caches but NIR doesn't, partly because of more aggressive
cross-stage optimizations with NIR.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agonir: Add a stripping pass for improved cacheability
Connor Abbott [Mon, 4 Mar 2019 16:51:12 +0000 (17:51 +0100)]
nir: Add a stripping pass for improved cacheability

Oftentimes various nir shaders after lowering will be the same, or
almost the same. For example, this can happen when the same shader is
linked with different shaders to form different pipelines and
cross-stage optimizations don't kick in to change it. We want to avoid
running the backend twice on these shaders. We were already doing this
with radeonsi, but we were storing a few extra pieces of information
that made this much less effective compared to TGSI. The worse offender
by far was the program name, which caused most of the cache misses. This
pass strips out these pieces of information, controlled by the NIR_STRIP
debug env variable.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoradv: fix pointSizeRange limits
Samuel Pitoiset [Mon, 11 Mar 2019 09:25:53 +0000 (10:25 +0100)]
radv: fix pointSizeRange limits

The values should match the ones that are emitted.

This fixes new CTS dEQP-VK.rasterization.primitive_size.points.*.

Fixes: f4e499ec791 ("radv: add initial non-conformant radv vulkan driver")
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoiris: Flag fewer dirty bits in BLORP
Sagar Ghuge [Thu, 14 Feb 2019 06:22:16 +0000 (22:22 -0800)]
iris: Flag fewer dirty bits in BLORP

v2: 1) Skip flagging IRIS_DIRTY_DEPTH_BUFFER if
       BLORP_BATCH_NO_EMIT_DEPTH_STENCIL is set (Kenneth Graunke)
    2) Add missing flags (Kenneth Graunke)

Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agost/glsl_to_nir: fix incorrect arrary access
Timothy Arceri [Fri, 1 Mar 2019 10:35:41 +0000 (21:35 +1100)]
st/glsl_to_nir: fix incorrect arrary access

This fixes a segfault when we try to access the array using a
-1 when the array wasn't allocated in the first place.

Before 7536af670b75 we would just access a pre-allocated array
that was also load/stored to/from the shader cache. But now the
cache will no longer allocate these arrays if they are empty.
The change resulted in tests such as the following segfaulting
when run with a warm shader cache.

tests/spec/arb_arrays_of_arrays/execution/sampler/fs-struct-const-index.shader_test

5 years agonir: silence a couple new compiler warnings
Brian Paul [Tue, 12 Mar 2019 02:12:15 +0000 (20:12 -0600)]
nir: silence a couple new compiler warnings

[33/630] Compiling C object 'src/compiler/nir/nir@sta/nir_loop_analyze.c.o'.
../src/compiler/nir/nir_loop_analyze.c: In function ‘try_find_trip_count_vars_in_iand’:
../src/compiler/nir/nir_loop_analyze.c:846:29: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
    if (*ind == NULL || *ind && (*ind)->type != basic_induction ||
                             ^
[85/630] Compiling C object 'src/compiler/nir/nir@sta/nir_opt_loop_unroll.c.o'.
../src/compiler/nir/nir_opt_loop_unroll.c: In function ‘complex_unroll_single_terminator’:
../src/compiler/nir/nir_opt_loop_unroll.c:494:17: warning: unused variable ‘unroll_loc’ [-Wunused-variable]
    nir_cf_node *unroll_loc =
                 ^
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agopanfrost: Identify fragment_extra flags
Alyssa Rosenzweig [Sat, 9 Mar 2019 00:45:23 +0000 (00:45 +0000)]
panfrost: Identify fragment_extra flags

The fragment_extra structure contains additional fields extending the
MRT framebuffer descriptor, snuck in between the main framebuffer
descriptor and the render targets. Its fields include those related to
transaction elimination and depth/stencil buffers. This patch identifies
the flags field (previously just "unk" with some magic values) as well
as identifying some (but not all) flags set by the driver.

The process of identifying flags brought a bug to light where
transaction elimination (checksumming) could not be enabled unless AFBC
was in-use. This issue is now resolved.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
5 years agopanfrost: Document "depth-buffer writeback" bit
Alyssa Rosenzweig [Sat, 9 Mar 2019 00:12:07 +0000 (00:12 +0000)]
panfrost: Document "depth-buffer writeback" bit

This bit, if set, causes the depth buffer to be copied from GPU tile
memory to the provided depth buffer in main memory. If not set, the GPU
will not access the main memory (saving considerable memory bandwidth if
depth results are not actually used).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Support linear depth textures
Alyssa Rosenzweig [Fri, 8 Mar 2019 23:41:12 +0000 (23:41 +0000)]
panfrost: Support linear depth textures

This combination has not yet been seen "in the wild" in traces, but to
support linear depth FBOs, ~bruteforce reveals this bit pattern is
necessary. It's not yet clear why the meanings of 0x1 and 0x2 are
essentially flipped (tiled vs linear for colour, linear vs some sort of
tiled for depth).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
5 years agopanfrost: Allocate dedicated slab for linear BOs
Alyssa Rosenzweig [Fri, 8 Mar 2019 23:36:02 +0000 (23:36 +0000)]
panfrost: Allocate dedicated slab for linear BOs

Previously, linear BOs shared memory with each other to minimize kernel
round-trips / latency, as well as to work around a bug in the free_slab
function. These concerns are invalid now, but continuing to use the slab
allocator for BOs resulted in memory allocation errors. This issue was
aggravated, though not introduced (so not a real regression) in the
previous commit.

v2 (unreviewed): Fix bug in v1 preventing munmaps from working

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
5 years agopanfrost: Determine framebuffer format bits late
Alyssa Rosenzweig [Thu, 7 Mar 2019 04:42:49 +0000 (04:42 +0000)]
panfrost: Determine framebuffer format bits late

Again, these formats are only properly known at the time of fragment job
emit. Rather than hardcoding the format, at least for MFBD we begin to
construct the format bits on-demand. This cleans up the code,
futureproofs for ES3 framebuffer formats, and should fix bugs regarding
FBO colour swizzles.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Tomeu Vizoso <tomeu.visozo@collabora.com>
5 years agopanfrost: Delay color buffer setup
Alyssa Rosenzweig [Thu, 7 Mar 2019 04:19:21 +0000 (04:19 +0000)]
panfrost: Delay color buffer setup

In an effort to cleanup framebuffer management code, we delay
colour buffer setup until the FRAGMENT job is actually emitted, allowing
the AFBC and linear codepaths to be unified.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Tomeu Vizoso <tomeu.visozo@collabora.com>
5 years agopanfrost: Combine has_afbc/tiled in layout enum
Alyssa Rosenzweig [Thu, 7 Mar 2019 03:52:20 +0000 (03:52 +0000)]
panfrost: Combine has_afbc/tiled in layout enum

AFBC, tiled, and linear BO layouts are mutually exclusive; they should
be coupled via a single enum rather than ad hoc checks of booleans.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Tomeu Vizoso <tomeu.visozo@collabora.com>
5 years agopanfrost: Cleanup needless if in create_bo
Alyssa Rosenzweig [Thu, 7 Mar 2019 03:24:45 +0000 (03:24 +0000)]
panfrost: Cleanup needless if in create_bo

I'm not sure why we were checking for these additional criteria (likely
inherited from some other driver); remove the needless checks to cleanup
the code and perhaps fix some bugs down the line.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Tomeu Vizoso <tomeu.visozo@collabora.com>
5 years agoi965: Reimplement all the PIPE_CONTROL rules.
Kenneth Graunke [Fri, 17 Nov 2017 07:47:43 +0000 (23:47 -0800)]
i965: Reimplement all the PIPE_CONTROL rules.

This implements virtually all documented PIPE_CONTROL restrictions
in a centralized helper.  You now simply ask for the operations you
want, and the pipe control "brain" will figure out exactly what pipe
controls to emit to make that happen without tanking your system.

The hope is that this will fix some intermittent flushing issues as
well as GPU hangs.  However, it also has a high risk of causing GPU
hangs and other regressions, as this is a particularly sensitive
area and poking the bear isn't always advisable.

Mark Janes noted that this patch helps with some GPU hangs on Icelake.

This does re-enable the VF Invalidate => Write Immediate workaround
on Gen8, which had been disabled (bug 103787) due to GPU hangs.  The
old code did this workaround after another which would have added CS
stall bits, so it missed a workaround.  The new code orders them
properly and appears to work.

v4: Don't pass "bo, offset, imm" to a recursive CS stall (caught by
    Topi Pohjolainen), drop Gen10 workarounds that are unnecessary for
    production hardware.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
5 years agoi965: Use genxml for emitting PIPE_CONTROL.
Kenneth Graunke [Thu, 1 Nov 2018 22:55:51 +0000 (15:55 -0700)]
i965: Use genxml for emitting PIPE_CONTROL.

While this does add a bunch of boilerplate, it also protects us against
the hardware moving bits, or changing their meaning.  For something as
finnicky as PIPE_CONTROL, the extra safety seems worth it.

We turn PIPE_CONTROL_* into an bitfield of arbitrary flags, and then
pack them appropriately.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
5 years agoi965: Rename ISP_DIS to INDIRECT_STATE_POINTERS_DISABLE.
Kenneth Graunke [Thu, 1 Nov 2018 22:55:21 +0000 (15:55 -0700)]
i965: Rename ISP_DIS to INDIRECT_STATE_POINTERS_DISABLE.

Clearer name.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
5 years agoi965: Move some genX infrastructure to genX_boilerplate.h.
Kenneth Graunke [Fri, 17 Nov 2017 06:37:02 +0000 (22:37 -0800)]
i965: Move some genX infrastructure to genX_boilerplate.h.

This will let us make multiple genX_*.c files, without copy and pasting
all this boilerplate.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
5 years agogallium/winsys/kms: fix incomplete type compilation failure
Brian Paul [Fri, 8 Mar 2019 22:50:58 +0000 (15:50 -0700)]
gallium/winsys/kms: fix incomplete type compilation failure

Fixes:
../src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c: In function ‘kms_sw_displaytarget_from_handle’:
../src/gallium/winsys/sw/kms-dri/kms_dri_sw_winsys.c:402:60: error: dereferencing pointer to incomplete type ‘const struct pipe_resource’
                                                       templ->format,
                                                            ^

Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
5 years agodrisw: fix incomplete type compilation failure
Brian Paul [Fri, 8 Mar 2019 22:49:49 +0000 (15:49 -0700)]
drisw: fix incomplete type compilation failure

Fixes:
../src/gallium/winsys/sw/dri/dri_sw_winsys.c: In function ‘dri_sw_displaytarget_display’:
../src/gallium/winsys/sw/dri/dri_sw_winsys.c:255:39: error: dereferencing pointer to incomplete type ‘struct pipe_box’
       offset = dri_sw_dt->stride * box->y;
                                       ^

Reviewed-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
5 years agodocs: try to improve the Meson documentation (v2)
Brian Paul [Fri, 8 Mar 2019 03:39:49 +0000 (20:39 -0700)]
docs: try to improve the Meson documentation (v2)

Add new Introduction and Advanced Usage sections.
Spell out a few more details, like "ninja install".
Improve the layout around example commands.
Fix grammatical errors and tighten up the text.
Explain the --prefix option.

v2: Remove language about 'ninja clean' and move link to Meson
information about separate build directories earlier in the page.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
5 years agost/mesa: minor refactoring of texture/sampler delete code
Brian Paul [Wed, 6 Mar 2019 23:20:55 +0000 (16:20 -0700)]
st/mesa: minor refactoring of texture/sampler delete code

Rename st_texture_free_sampler_views() to
st_delete_texture_sampler_views() to align with
st_DeleteTextureObject(), its only caller.

Move the call to st_texture_release_all_sampler_views() from
st_DeleteTextureObject() to st_delete_texture_sampler_views()
so all the sampler view clean-up code is in one place.

Reviewed-by: Neha Bhende <bhenden@vmware.com>