mesa.git
5 years agospirv_extensions: define spirv_extensions_supported
Alejandro Piñeiro [Wed, 19 Jun 2019 18:58:30 +0000 (13:58 -0500)]
spirv_extensions: define spirv_extensions_supported

Add a struct to maintain which SPIR-V extensions are supported, and an
utility method to initialize it based on
nir_spirv_supported_capabilities.

v2:
  * Fixing code style (Ian Romanick)
  * Adding a prefix (spirv) to fill_supported_spirv_extensions (Ian Romanick)

v3: rebase update (nir_spirv_supported_extensions renamed)

v4: include AMD_gcn_shader support

v5: move spirv_fill_supported_spirv_extensions to
    src/mesa/main/spirv_extensions.c

Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Arcady Goldmints-Orlov <agoldmints@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv_extensions: add list of extensions and to_string method
Alejandro Piñeiro [Fri, 13 Oct 2017 14:17:51 +0000 (16:17 +0200)]
spirv_extensions: add list of extensions and to_string method

Ideally this should be generated somehow. One option would be gather
all the extension dependencies listed on the core grammar, but there
would be the possibility of not including some of the extensions.

Note that spirv-tools is doing it just slightly better, as it has a
hardcoded list of extensions manually took from the registry, that
they parse to get the enum and the to_string method (see
generate_grammar_tables.py).

v2:
  * Use a macro to improve readability. (Tapani Pälli)
  * Add unreachable on the switch, no default (Eric Engestrom)
  * No typedef enum (Ian Romanick)
  * Sort extensions names (Ian Romanick)
  * Don't add extensions unlikely to be supported by Mesa at any point
    (Ian Romanick)

v3: rebase update

v4: Include AMD_gcn_shader

v5: move spirv_extensions_to_string to src/mesa/main/spirv_extensions.c

Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Arcady Goldmints-Orlov <agoldmints@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv_extensions: add GL_ARB_spirv_extensions boilerplate
Alejandro Piñeiro [Tue, 10 Oct 2017 14:09:25 +0000 (16:09 +0200)]
spirv_extensions: add GL_ARB_spirv_extensions boilerplate

v2:
  * Mention extension gap at gl_API.xml (Emil Velikov)
  * Bail with INVALID_ENUM if extension not available on getStringi (Emil Velikov)
  * Use EXTRA_EXT macro when defining the extension at
    get.c/get_hash_params.py (Emil Velikov)
  * Rename source files (spirvextensions.[ch] -> spirv_extensions.[ch]) (Ian)

v3:
  * Fix GL_PROGRAM_BINARY_FORMATS glGet query, broken by error on a
    previous rebase

v4:
   * Fix rebase conflicts on getstring.c after
     GL_SHADING_LANGUAGE_VERSION query was added

v5:
   * Remove src/mapi/glapi/gen/Makefile.am as it no longer exists in
     master

Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Signed-off-by: Arcady Goldmints-Orlov <agoldmints@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agoradv/gfx10: implement VK_EXT_post_depth_coverage
Samuel Pitoiset [Tue, 16 Jul 2019 15:11:50 +0000 (17:11 +0200)]
radv/gfx10: implement VK_EXT_post_depth_coverage

I did implement this extension a while ago but it didn't work
on pre GFX10 for some reasons. Now all CTS pass.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv/gfx10: disable the TC compat zrange workaround
Samuel Pitoiset [Tue, 16 Jul 2019 15:35:00 +0000 (17:35 +0200)]
radv/gfx10: disable the TC compat zrange workaround

Unnecessary.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv/gfx10: fallback to the legacy path if tess and extreme geometry
Samuel Pitoiset [Tue, 16 Jul 2019 14:39:16 +0000 (16:39 +0200)]
radv/gfx10: fallback to the legacy path if tess and extreme geometry

This is unsupported and hangs.

This fixes GPU hangs with
dEQP-VK.tessellation.geometry_interaction.limits.output_required_*.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv/gfx10: always build the GS copy shader but uses it on-demand
Samuel Pitoiset [Tue, 16 Jul 2019 14:39:15 +0000 (16:39 +0200)]
radv/gfx10: always build the GS copy shader but uses it on-demand

It should be possible to build it on-demand too but it requires
more work. On GFX10, the GS copy shader is required when tess
is enabled with extreme geometry.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agosoftpipe: Remove unused static function
Gert Wollny [Thu, 2 May 2019 13:54:55 +0000 (15:54 +0200)]
softpipe: Remove unused static function

Thanks to Eric Engestrom for pointing out that there was something wrong
with that function.

Fixes: 724a73509e1bc1ce3abf9500e457bb2911b642db
  softpipe: Prepare handling explicit gradients

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agospirv: Bail when we see CounterBuffer decoration
Caio Marcelo de Oliveira Filho [Wed, 10 Jul 2019 16:00:47 +0000 (09:00 -0700)]
spirv: Bail when we see CounterBuffer decoration

This decoration can be ignored, so we can just skip the next steps.
Otherwise we'd have to also handle it in apply_var_decoration.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoiris: Drop copy and pasted iris_timebase_scale
Kenneth Graunke [Mon, 15 Jul 2019 18:51:14 +0000 (11:51 -0700)]
iris: Drop copy and pasted iris_timebase_scale

Lionel moved brw_timebase_scale to gen_device_info_timebase_scale a few
months ago, so we should just use that, and not our own copy in iris.

5 years agonir/regs_to_ssa: Handle regs in phi sources properly
Jason Ekstrand [Fri, 12 Jul 2019 16:01:40 +0000 (11:01 -0500)]
nir/regs_to_ssa: Handle regs in phi sources properly

Sources of phi instructions act as if they occur at the very end of the
predecessor block not the block in which the phi lives.  In order to
handle them correctly, we have to skip phi sources on the normal
instruction walk and handle them as a separate walk over the successor
phis.  While registers in phi instructions is a bit of an oddity it can
happen when we temporarily go out-of-SSA for control-flow manipulations.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111075
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv: Add a warning for ArrayStride on arrays of blocks
Jason Ekstrand [Wed, 10 Jul 2019 22:55:44 +0000 (17:55 -0500)]
spirv: Add a warning for ArrayStride on arrays of blocks

It's disallowed according to the SPIR-V spec or at least I think that's
what the spec says.  It's in a section explicitly about explicit layout
of things in the StorageBuffer, Uniform, and PushConstant storage
classes so it's not 100% clear that it applies with other storage
classes.  However, it seems like it should apply in general and
violating it can trigger (fairly harmless) asserts in NIR.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agoanv: Increase state allocation size limit to 2MB
Caio Marcelo de Oliveira Filho [Fri, 12 Jul 2019 18:33:38 +0000 (11:33 -0700)]
anv: Increase state allocation size limit to 2MB

When running on ICL the
dEQP-VK.ssbo.phys.layout.random.16bit.scalar.13 needs more than 1M for
the shader, so bump it.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agometa: leaking of BO with DrawPixels
Yevhenii Kolesnikov [Tue, 9 Jul 2019 12:11:15 +0000 (15:11 +0300)]
meta: leaking of BO with DrawPixels

ctx->Unpack.BufferObj wasn't unreferenced.

Fixes: d492e7b0171 (meta: Fix invalid PBO access from DrawPixels when
trying to just alloc.)
CC: Eric Anholt <eric@anholt.net>
Signed-off-by: Yevhenii Kolesnikov <yevhenii.kolesnikov@globallogic.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agoswrast: Move _mesa_format_pack_colormask() to the only caller.
Eric Anholt [Tue, 2 Jul 2019 00:20:55 +0000 (17:20 -0700)]
swrast: Move _mesa_format_pack_colormask() to the only caller.

This avoids needing format_pack to have access to the GLenum return
functions for mesa_format.  It seems like an odd function and unlikely
to be reused.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agomesa: Give _mesa_format_get_color_encoding a clearer name.
Eric Anholt [Mon, 1 Jul 2019 22:43:19 +0000 (15:43 -0700)]
mesa: Give _mesa_format_get_color_encoding a clearer name.

It only returned one of two values.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agomesa: Drop redundant checks for sRGB before sRGB to linear conversion.
Eric Anholt [Mon, 1 Jul 2019 22:38:56 +0000 (15:38 -0700)]
mesa: Drop redundant checks for sRGB before sRGB to linear conversion.

_mesa_get_srgb_format_linear() just returns the original format if it
wasn't sRGB.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agomesa: Fold _mesa_unpack_depth_stencil_row() into its only caller.
Eric Anholt [Mon, 1 Jul 2019 23:45:32 +0000 (16:45 -0700)]
mesa: Fold _mesa_unpack_depth_stencil_row() into its only caller.

This was the last bit of gl.h usage in format packing.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agomesa: Convert format_pack/unpack off of GL types.
Eric Anholt [Mon, 1 Jul 2019 23:27:24 +0000 (16:27 -0700)]
mesa: Convert format_pack/unpack off of GL types.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agomesa: Port format_pack/unpack off of _mesa_problem().
Eric Anholt [Mon, 1 Jul 2019 23:34:23 +0000 (16:34 -0700)]
mesa: Port format_pack/unpack off of _mesa_problem().

unreachable() should be plenty of debug for these.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agomesa: Mostly switch Mesa format info off of GL types other than GLenum.
Eric Anholt [Mon, 1 Jul 2019 22:23:19 +0000 (15:23 -0700)]
mesa: Mostly switch Mesa format info off of GL types other than GLenum.

I'm considering moving most of this code to src/util/, and I want that
code to not expose GL types in its interfaces.

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agomesa: Rename gl_pack typedefs to mesa_pack.
Eric Anholt [Mon, 1 Jul 2019 21:29:45 +0000 (14:29 -0700)]
mesa: Rename gl_pack typedefs to mesa_pack.

These are packing mesa formats, not a GL format/type.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agomesa: Rename gl_format_info to mesa_format_info.
Eric Anholt [Mon, 1 Jul 2019 21:07:30 +0000 (14:07 -0700)]
mesa: Rename gl_format_info to mesa_format_info.

It's about MESA_FORMATs, after all.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agostate_tracker: Move the format test out to be an actual unit test.
Eric Anholt [Mon, 1 Jul 2019 20:06:09 +0000 (13:06 -0700)]
state_tracker: Move the format test out to be an actual unit test.

We want errors in the table to show up as unit test failures in MRs.
Also keeps unit test code out of the built drivers.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agou_format: Remove pointless comments.
Eric Anholt [Mon, 1 Jul 2019 19:38:41 +0000 (12:38 -0700)]
u_format: Remove pointless comments.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agosrc/util: Switch _mesa_half_to_float() to u_half.h's version.
Eric Anholt [Thu, 27 Jun 2019 22:53:53 +0000 (15:53 -0700)]
src/util: Switch _mesa_half_to_float() to u_half.h's version.

The two implementations differ across the entire input range only in
that u_half.h preserves mantissa bits for NaNs.  The u_half.h version
shaves 15% off of the text size of half_float.o.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agou_half_test: Turn it into an actual unit test.
Eric Anholt [Thu, 27 Jun 2019 22:46:28 +0000 (15:46 -0700)]
u_half_test: Turn it into an actual unit test.

You could break the test and meson test wouldn't complain, since we
returned success either way.

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
5 years agoandroid: radv/gfx10: generate gfx10_format_table.h
Mauro Rossi [Sun, 7 Jul 2019 23:17:22 +0000 (01:17 +0200)]
android: radv/gfx10: generate gfx10_format_table.h

This patch adds the missing building rules for Android,
to avoid following building errors:

In file included from external/mesa/src/amd/vulkan/radv_debug.c:35:
In file included from external/mesa/src/amd/vulkan/radv_debug.h:27:
external/mesa/src/amd/vulkan/radv_private.h:95:10:
fatal error: 'gfx10_format_table.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.

In file included from external/mesa/src/amd/vulkan/radv_android.c:31:
external/mesa/src/amd/vulkan/radv_private.h:95:10:
fatal error: 'gfx10_format_table.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Fixes: 3dc5ec5d16 ("radv/gfx10: generate gfx10_format_table.h")
Signed-off-by: Mauro Rossi <issor.oruam@gmail.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agomesa/st: add sampler uniforms
Rob Clark [Mon, 15 Jul 2019 16:05:55 +0000 (09:05 -0700)]
mesa/st: add sampler uniforms

Add sampler uniforms for the UV plane(s), so driver can count the
uniforms and get the correct sampler count.

Fixes lowered YUV on a6xx which actually wants to know # of samplers.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agoegl/android: handle multi-fd native windows
Rob Clark [Fri, 12 Jul 2019 16:17:30 +0000 (09:17 -0700)]
egl/android: handle multi-fd native windows

We can hit multi-fd EGL_NATIVE_BUFFER_ANDROID case when the native
android buffer is YUV.  So we need to handle that.

Currently this went unnoticed because, even though we have two or
three fd's for YUV native android buffers, they all reference the
same backing buffer.  But we really shouldn't rely on that.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agost,i965: Stop looping on 64-bit lowering
Jason Ekstrand [Thu, 11 Jul 2019 21:59:31 +0000 (16:59 -0500)]
st,i965: Stop looping on 64-bit lowering

Now that the 64-bit lowering passes do a complete lowering in one go, we
don't need to loop anymore.  We do, however, have to ensure that int64
lowering happens after double lowering because double lowering can
produce int64 ops.

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir/lower_doubles: Handle fdiv and fsub directly
Jason Ekstrand [Thu, 11 Jul 2019 22:06:31 +0000 (17:06 -0500)]
nir/lower_doubles: Handle fdiv and fsub directly

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir/lower_doubles: Use the new NIR lowering framework
Jason Ekstrand [Thu, 11 Jul 2019 21:54:01 +0000 (16:54 -0500)]
nir/lower_doubles: Use the new NIR lowering framework

One advantage of this is that we no longer need to run in a loop because
the new framework handles lowering instructions added by lowering.

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir/lower_doubles: Use "alu" for the nir_alu_instr
Jason Ekstrand [Thu, 11 Jul 2019 21:46:19 +0000 (16:46 -0500)]
nir/lower_doubles: Use "alu" for the nir_alu_instr

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir/lower_int64: Use the core NIR lowering framework
Jason Ekstrand [Thu, 11 Jul 2019 21:31:49 +0000 (16:31 -0500)]
nir/lower_int64: Use the core NIR lowering framework

One advantage of this is that we no longer need to run in a loop because
the new framework handles lowering instructions added by lowering.

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir/alu_to_scalar: Use the new NIR lowering framework
Jason Ekstrand [Thu, 11 Jul 2019 20:20:39 +0000 (15:20 -0500)]
nir/alu_to_scalar: Use the new NIR lowering framework

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir/alu_to_scalar: Use "alu" as the name for the nir_alu_instr
Jason Ekstrand [Thu, 11 Jul 2019 20:19:17 +0000 (15:19 -0500)]
nir/alu_to_scalar: Use "alu" as the name for the nir_alu_instr

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir/lower_system_values: Support lowering more intrinsics
Jason Ekstrand [Fri, 12 Jul 2019 20:26:03 +0000 (15:26 -0500)]
nir/lower_system_values: Support lowering more intrinsics

Instead of only lowering system from variables, lower most to intrinsics
and let the lowering framework immediately lower the intrinsic.  This
will result in a bit more instruction churn but it means that NIR code
builders can just use intrinsics instead of everything having to go
through variables.

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir/lower_system_values: Drop the context-aware builder functions
Jason Ekstrand [Thu, 11 Jul 2019 19:01:20 +0000 (14:01 -0500)]
nir/lower_system_values: Drop the context-aware builder functions

Instead of having context-aware builder functions, just provide lowering
for the system value intrinsics and let nir_shader_lower_instructions
handle the recursion for us.  This makes everything a bit simpler and
means that the lowering can also be used if something comes in as a
system value intrinsic rather than a load_deref.

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir/lower_system_values: Use the new generic NIR lowering helpers
Jason Ekstrand [Thu, 11 Jul 2019 18:30:03 +0000 (13:30 -0500)]
nir/lower_system_values: Use the new generic NIR lowering helpers

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir/lower_subgroups: Use the new generic NIR lowering helpers
Jason Ekstrand [Thu, 11 Jul 2019 18:04:05 +0000 (13:04 -0500)]
nir/lower_subgroups: Use the new generic NIR lowering helpers

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir: Add some generic helpers for writing lowering passes
Jason Ekstrand [Thu, 11 Jul 2019 18:00:42 +0000 (13:00 -0500)]
nir: Add some generic helpers for writing lowering passes

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agonir: Add a helper for fetching the SSA def from an instruction
Jason Ekstrand [Thu, 11 Jul 2019 20:05:27 +0000 (15:05 -0500)]
nir: Add a helper for fetching the SSA def from an instruction

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agopandecode: Add more addresses to trace
Tomeu Vizoso [Fri, 12 Jul 2019 14:42:52 +0000 (16:42 +0200)]
pandecode: Add more addresses to trace

When debugging, we're given the fault_pointer unresolved, so it is
helpful to have more context in the decode.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
5 years agopanfrost: Use 64-bit descriptors globally
Tomeu Vizoso [Thu, 11 Jul 2019 06:06:41 +0000 (08:06 +0200)]
panfrost: Use 64-bit descriptors globally

Midgard supports two modes of operation, 32-bit mode and 64-bit mode.
The GPU is natively 64-bit, but job descriptors can be submitted in
32-bit mode. Among other changes, 32-bit mode shortens pointer sizes to
use 32-bit pointers rather than the full 64-bit range.

The blob decides which mode to use based on the CPU bitness, so an armhf
system uses 32-bit descriptors and an aarch64 system uses 64-bit
descriptors. For a while, we mimicked this, bu inevitably this caused
the 32-bit support to lag behind as our reference platform is 64-bit.

To combat the code staleness, we traced an older GPU paired with a 64-bit
CPU (the Midgard T720 on-board the sunxi H64). From there, we could tell
which fields were really about hardware and which fields were simply
reflections of the descriptor bitness.

From there, we decided to remove support for 32-bit descriptors
entirely, using 64-bit descriptors unconditionally. There is minimal
performance penalty for this in practice, and it allows us to unify
these disparate code paths. This fixes:

   - T860 + armhf
   - T820 + armhf
   - T760 + aarch64

And will help bringup of 1st/2nd generation Midgard regardless of CPU.

[Work done by Tomeu. Commit message written by Alyssa.]

v2: Add comments preserving information about the old behaviour for
future reference. Fix a compiler warning. (Alyssa)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agoanv: Account for dynamic stencil write disables in the PMA fix
Jason Ekstrand [Mon, 15 Jul 2019 22:14:26 +0000 (17:14 -0500)]
anv: Account for dynamic stencil write disables in the PMA fix

In 6ce8592836b8 we started looking at the dynamic stencil state and
disabling stencil writes when the stencil mask is zero.  Unfortunately,
we never updated the PMA fix code accordingly so 3DSTATE_WM_DEPTH_STENCIL
and the PMA fix were getting out-of-sync causing hangs.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109203
Fixes: 6ce8592836 "anv: Disable stencil writes when both write..."
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agopanfrost: Implement opportunistic AFBC
Alyssa Rosenzweig [Mon, 15 Jul 2019 21:15:24 +0000 (14:15 -0700)]
panfrost: Implement opportunistic AFBC

Rather than hardcoding a BO layout at creation-time, we implement the
ability to hint layouts at various points in a BO's lifetime,
potentially reallocating and switching layouts if it's heuristically
deemed useful to do so.

In this patch, we add a simple hinting implementation, opportunistically
compressing FBOs.

Support is hidden behind PAN_MESA_DEBUG=afbc as the implementation is
incomplete (software access to AFBC is unimplemented at the moment) and
therefore would regress significantly.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/mfbd: Zero out framebuffer_stride
Alyssa Rosenzweig [Mon, 15 Jul 2019 22:35:30 +0000 (15:35 -0700)]
panfrost/mfbd: Zero out framebuffer_stride

We don't know what this is, so let's not pretend we do.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: AFBC buffers must be cache-line aligned
Alyssa Rosenzweig [Mon, 15 Jul 2019 22:34:50 +0000 (15:34 -0700)]
panfrost: AFBC buffers must be cache-line aligned

Fixes a DATA_INVALID_FAULT when AFBC is paried with mipmapping.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Add Z/S and MRT BOs to the job
Alyssa Rosenzweig [Mon, 15 Jul 2019 22:16:08 +0000 (15:16 -0700)]
panfrost: Add Z/S and MRT BOs to the job

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Set usage2 during draw, not CSO
Alyssa Rosenzweig [Mon, 15 Jul 2019 21:59:03 +0000 (14:59 -0700)]
panfrost: Set usage2 during draw, not CSO

It can change from a layout switch.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agometa: memory leak of CopyPixels usage
Sergii Romantsov [Mon, 27 May 2019 13:45:35 +0000 (16:45 +0300)]
meta: memory leak of CopyPixels usage

Meta of CopyPixel generates a buffer object
but does not free it on cleanup.

Fixes: 37d11b13ce1d (meta: Don't pollute the buffer object namespace in _mesa_meta_setup_vertex_objects)
Signed-off-by: Sergii Romantsov <sergii.romantsov@globallogic.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
5 years agoradv: add radv_emit_streamout_{begin,end} helpers
Samuel Pitoiset [Fri, 12 Jul 2019 16:12:36 +0000 (18:12 +0200)]
radv: add radv_emit_streamout_{begin,end} helpers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: pass output values to radv_emit_stream_output()
Samuel Pitoiset [Fri, 12 Jul 2019 16:12:35 +0000 (18:12 +0200)]
radv: pass output values to radv_emit_stream_output()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: allow to select DST_SEL with RELEASE_MEM
Samuel Pitoiset [Fri, 12 Jul 2019 16:12:34 +0000 (18:12 +0200)]
radv: allow to select DST_SEL with RELEASE_MEM

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: allow to emit PS_DONE/CS_DONE with RELEASE_MEM
Samuel Pitoiset [Fri, 12 Jul 2019 16:12:33 +0000 (18:12 +0200)]
radv: allow to emit PS_DONE/CS_DONE with RELEASE_MEM

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: restore an assertion in handle_vs_outputs()
Samuel Pitoiset [Fri, 12 Jul 2019 16:12:32 +0000 (18:12 +0200)]
radv: restore an assertion in handle_vs_outputs()

The NGG GS epilogue no longers call that function so the assertion
is just useless now.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv/gfx10: emit ES outputs of TES when it's not NGG
Samuel Pitoiset [Fri, 12 Jul 2019 16:12:31 +0000 (18:12 +0200)]
radv/gfx10: emit ES outputs of TES when it's not NGG

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: update LATE_ALLOC_VS.LIMIT
Samuel Pitoiset [Tue, 16 Jul 2019 07:34:40 +0000 (09:34 +0200)]
radv: update LATE_ALLOC_VS.LIMIT

Mirror RadeonSI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv/gfx10: support pixel shaders without exports
Samuel Pitoiset [Tue, 16 Jul 2019 07:34:39 +0000 (09:34 +0200)]
radv/gfx10: support pixel shaders without exports

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoradv: fix gathering clip/cull distance masks for GS
Samuel Pitoiset [Tue, 16 Jul 2019 06:37:32 +0000 (08:37 +0200)]
radv: fix gathering clip/cull distance masks for GS

For NGG, the driver relies on the VS outinfo struct.

This fixes
dEQP-VK.clipping.user_defined.clip_*_vert_tess_geom_*

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
5 years agoRevert "radv/gfx10: don't set array pitch field on images"
Samuel Pitoiset [Tue, 16 Jul 2019 07:37:56 +0000 (09:37 +0200)]
Revert "radv/gfx10: don't set array pitch field on images"

It introduces too many regressions.

This reverts commit 6d50dcd80fc120fdabcd57ef576f3e45ea2724e4.

5 years agov3d: flag dirty state when binding new sampler states
Iago Toral Quiroga [Fri, 12 Jul 2019 09:06:22 +0000 (11:06 +0200)]
v3d: flag dirty state when binding new sampler states

We emit code to saturate texture coordinates when using clamp wrapping
mode so if we don't flag the dirty state here we don't get to recompile
the shaders when the wrapping mode changes.

v2:
  - Do the same when setting sampler views (Eric)
  - Use a switch statement instead of an if ladder.
  - Swap the shader stage assertion with an unreachable.

Fixes:
spec/!opengl 1.1/texwrap 1d bordercolor/gl_rgba8, border color only
spec/!opengl 1.1/texwrap 1d proj bordercolor/gl_rgba8, projected, border color only
spec/!opengl 1.1/texwrap 2d bordercolor/gl_rgba8, border color only
spec/!opengl 1.1/texwrap 2d proj bordercolor/gl_rgba8, projected, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_alpha12, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_alpha16, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_alpha4, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_alpha8, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_intensity8, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_luminance4_alpha4, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_luminance6_alpha2, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_luminance8, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_luminance8_alpha8, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_r3_g3_b2, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_rgb10, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_rgb10_a2, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_rgb4, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_rgb5, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_rgb5_a1, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_rgb8, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_rgba4, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor-swizzled/gl_rgba8, swizzled, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_alpha12, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_alpha16, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_alpha4, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_alpha8, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_intensity8, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_luminance4_alpha4, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_luminance6_alpha2, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_luminance8, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_luminance8_alpha8, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_r3_g3_b2, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_rgb10, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_rgb10_a2, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_rgb4, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_rgb5, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_rgb5_a1, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_rgb8, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_rgba4, border color only
spec/!opengl 1.1/texwrap formats bordercolor/gl_rgba8, border color only
spec/!opengl 1.2/texwrap 3d bordercolor/gl_rgba8, border color only
spec/!opengl 1.2/texwrap 3d proj bordercolor/gl_rgba8, projected, border color only
spec/arb_es2_compatibility/texwrap formats bordercolor-swizzled/gl_rgb565, swizzled, border color only
spec/arb_es2_compatibility/texwrap formats bordercolor/gl_rgb565, border color only
spec/arb_texture_compression/texwrap formats bordercolor-swizzled/gl_compressed_alpha, swizzled, border color only
spec/arb_texture_compression/texwrap formats bordercolor-swizzled/gl_compressed_luminance_alpha, swizzled, border color only
spec/arb_texture_compression/texwrap formats bordercolor-swizzled/gl_compressed_rgb, swizzled, border color only
spec/arb_texture_compression/texwrap formats bordercolor/gl_compressed_alpha, border color only
spec/arb_texture_compression/texwrap formats bordercolor/gl_compressed_luminance_alpha, border color only
spec/arb_texture_compression/texwrap formats bordercolor/gl_compressed_rgb, border color only
spec/arb_texture_float/texwrap formats bordercolor-swizzled/gl_alpha16f_arb, swizzled, border color only
spec/arb_texture_float/texwrap formats bordercolor-swizzled/gl_intensity16f_arb, swizzled, border color only
spec/arb_texture_float/texwrap formats bordercolor-swizzled/gl_luminance16f_arb, swizzled, border color only
spec/arb_texture_float/texwrap formats bordercolor-swizzled/gl_luminance_alpha16f_arb, swizzled, border color only
spec/arb_texture_float/texwrap formats bordercolor-swizzled/gl_rgb16f, swizzled, border color only
spec/arb_texture_float/texwrap formats bordercolor-swizzled/gl_rgba16f, swizzled, border color only
spec/arb_texture_float/texwrap formats bordercolor/gl_alpha16f_arb, border color only
spec/arb_texture_float/texwrap formats bordercolor/gl_intensity16f_arb, border color only
spec/arb_texture_float/texwrap formats bordercolor/gl_luminance16f_arb, border color only
spec/arb_texture_float/texwrap formats bordercolor/gl_luminance_alpha16f_arb, border color only
spec/arb_texture_float/texwrap formats bordercolor/gl_rgb16f, border color only
spec/arb_texture_float/texwrap formats bordercolor/gl_rgba16f, border color only
spec/arb_texture_rectangle/texwrap rect bordercolor/gl_rgba8, border color only
spec/arb_texture_rectangle/texwrap rect proj bordercolor/gl_rgba8, projected, border color only
spec/arb_texture_rg/texwrap formats bordercolor-swizzled/gl_r8, swizzled, border color only
spec/arb_texture_rg/texwrap formats bordercolor-swizzled/gl_rg8, swizzled, border color only
spec/arb_texture_rg/texwrap formats bordercolor/gl_r8, border color only
spec/arb_texture_rg/texwrap formats bordercolor/gl_rg8, border color only
spec/arb_texture_rg/texwrap formats-float bordercolor-swizzled/gl_r16f, swizzled, border color only
spec/arb_texture_rg/texwrap formats-float bordercolor-swizzled/gl_rg16f, swizzled, border color only
spec/arb_texture_rg/texwrap formats-float bordercolor/gl_r16f, border color only
spec/arb_texture_rg/texwrap formats-float bordercolor/gl_rg16f, border color only
spec/ext_packed_float/texwrap formats bordercolor-swizzled/gl_r11f_g11f_b10f, swizzled, border color only
spec/ext_packed_float/texwrap formats bordercolor/gl_r11f_g11f_b10f, border color only
spec/ext_texture_shared_exponent/texwrap formats bordercolor-swizzled/gl_rgb9_e5, swizzled, border color only
spec/ext_texture_shared_exponent/texwrap formats bordercolor/gl_rgb9_e5, border color only
spec/ext_texture_snorm/texwrap formats bordercolor-swizzled/gl_alpha8_snorm, swizzled, border color only
spec/ext_texture_snorm/texwrap formats bordercolor-swizzled/gl_intensity8_snorm, swizzled, border color only
spec/ext_texture_snorm/texwrap formats bordercolor-swizzled/gl_luminance8_alpha8_snorm, swizzled, border color only
spec/ext_texture_snorm/texwrap formats bordercolor-swizzled/gl_luminance8_snorm, swizzled, border color only
spec/ext_texture_snorm/texwrap formats bordercolor-swizzled/gl_r8_snorm, swizzled, border color only
spec/ext_texture_snorm/texwrap formats bordercolor-swizzled/gl_rg8_snorm, swizzled, border color only
spec/ext_texture_snorm/texwrap formats bordercolor-swizzled/gl_rgb8_snorm, swizzled, border color only
spec/ext_texture_snorm/texwrap formats bordercolor-swizzled/gl_rgba8_snorm, swizzled, border color only
spec/ext_texture_snorm/texwrap formats bordercolor/gl_alpha8_snorm, border color only
spec/ext_texture_snorm/texwrap formats bordercolor/gl_intensity8_snorm, border color only
spec/ext_texture_snorm/texwrap formats bordercolor/gl_luminance8_alpha8_snorm, border color only
spec/ext_texture_snorm/texwrap formats bordercolor/gl_luminance8_snorm, border color only
spec/ext_texture_snorm/texwrap formats bordercolor/gl_r8_snorm, border color only
spec/ext_texture_snorm/texwrap formats bordercolor/gl_rg8_snorm, border color only
spec/ext_texture_snorm/texwrap formats bordercolor/gl_rgb8_snorm, border color only
spec/ext_texture_snorm/texwrap formats bordercolor/gl_rgba8_snorm, border color only
spec/ext_texture_srgb/texwrap formats bordercolor-swizzled/gl_sluminance8, swizzled, border color only
spec/ext_texture_srgb/texwrap formats bordercolor-swizzled/gl_sluminance8_alpha8, swizzled, border color only
spec/ext_texture_srgb/texwrap formats bordercolor-swizzled/gl_srgb8, swizzled, border color only
spec/ext_texture_srgb/texwrap formats bordercolor-swizzled/gl_srgb8_alpha8, swizzled, border color only
spec/ext_texture_srgb/texwrap formats bordercolor/gl_sluminance8, border color only
spec/ext_texture_srgb/texwrap formats bordercolor/gl_sluminance8_alpha8, border color only
spec/ext_texture_srgb/texwrap formats bordercolor/gl_srgb8, border color only
spec/ext_texture_srgb/texwrap formats bordercolor/gl_srgb8_alpha8, border color only

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agoradv/gfx10: add missing conversions for 16-bit exports
Samuel Pitoiset [Mon, 15 Jul 2019 08:44:53 +0000 (10:44 +0200)]
radv/gfx10: add missing conversions for 16-bit exports

This fixes
dEQP-VK.spirv_assembly.instruction.graphics.16bit_storage.input_output_*

Found with RADV_DEBUG=checkir

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: remove unused code in radv_export_param()
Samuel Pitoiset [Mon, 15 Jul 2019 06:53:11 +0000 (08:53 +0200)]
radv: remove unused code in radv_export_param()

It was hack for geometry shaders.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv/gfx10: don't set array pitch field on images
Dave Airlie [Mon, 15 Jul 2019 23:23:15 +0000 (16:23 -0700)]
radv/gfx10: don't set array pitch field on images

Setting this seems to be broken, amdvlk only sets it for quilted
textures which I'm not sure what those are.

Fixes dEQP-VK.glsl.texture_functions.query.texturesize*3d*

Fixes: bf11f1c3a47 ("radv/gfx10: add gfx10_make_texture_descriptor")
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agolima/ppir: Fix assert condition in ppir_codegen_encode_branch.
Vinson Lee [Mon, 15 Jul 2019 05:58:33 +0000 (22:58 -0700)]
lima/ppir: Fix assert condition in ppir_codegen_encode_branch.

Fixes: af0de6b91c0b ("lima/ppir: implement discard and discard_if")
Reported-by: Coverity Scan
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com>
5 years agodocs: Tell people how to easily generate the Fixes lines.
Eric Anholt [Fri, 12 Jul 2019 20:36:51 +0000 (13:36 -0700)]
docs: Tell people how to easily generate the Fixes lines.

v2: Include '-s' to suppress the diff.
v3: use the git config command (Ken), use &lt; (Eric)

Reviewed-by: Matt Turner <mattst88@gmail.com> (v1)
Acked-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agospirv: Ignore ArrayStride for storage classes that should not use it
Caio Marcelo de Oliveira Filho [Wed, 3 Jul 2019 20:14:33 +0000 (13:14 -0700)]
spirv: Ignore ArrayStride for storage classes that should not use it

The stride was already overriden when using
lower_workgroup_access_to_offsets, so elaborate a bit the commentary
there.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agospirv: Fix stride calculation when lowering Workgroup to offsets
Caio Marcelo de Oliveira Filho [Wed, 3 Jul 2019 19:47:53 +0000 (12:47 -0700)]
spirv: Fix stride calculation when lowering Workgroup to offsets

Use alignment to calculate the stride associated with the pointer
types.  That stride is used when the pointers are casted to arrays.

Note that size alone is not sufficient, e.g. struct { vec2 a; vec1 b;
} will have element an element size of 12 bytes, but the stride needs
to be 16 bytes to respect the 8 byte alignment.

Fixes: 050eb6389a8 "spirv: Ignore ArrayStride in OpPtrAccessChain for Workgroup"
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agopanfrost/ci: Blacklist flush finish tests
Alyssa Rosenzweig [Mon, 15 Jul 2019 18:05:04 +0000 (11:05 -0700)]
panfrost/ci: Blacklist flush finish tests

We don't implement batch splitting quite yet which is necessary for the
ludicrous number of draw calls these tests invoke. Blacklist them for
now.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Don't leak oversized transient allocations
Alyssa Rosenzweig [Mon, 15 Jul 2019 19:05:48 +0000 (12:05 -0700)]
panfrost: Don't leak oversized transient allocations

When we allocate them, we allocate with two references accidentally,
causing them to leak uncontrollably.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Implement panfrost_bo_cache_evict_all
Alyssa Rosenzweig [Mon, 15 Jul 2019 16:17:12 +0000 (09:17 -0700)]
panfrost: Implement panfrost_bo_cache_evict_all

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Implement panfrost_bo_cache_get
Alyssa Rosenzweig [Mon, 15 Jul 2019 16:08:32 +0000 (09:08 -0700)]
panfrost: Implement panfrost_bo_cache_get

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Implement panfrost_bo_cache_put
Alyssa Rosenzweig [Mon, 15 Jul 2019 16:00:54 +0000 (09:00 -0700)]
panfrost: Implement panfrost_bo_cache_put

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Add pan_bucket helper
Alyssa Rosenzweig [Mon, 15 Jul 2019 15:51:11 +0000 (08:51 -0700)]
panfrost: Add pan_bucket helper

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Implement pan_bucket_index helper
Alyssa Rosenzweig [Mon, 15 Jul 2019 15:47:59 +0000 (08:47 -0700)]
panfrost: Implement pan_bucket_index helper

We'll use this whenever we need to lookup a bucket.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Add BO cache data structure
Alyssa Rosenzweig [Mon, 15 Jul 2019 15:36:19 +0000 (08:36 -0700)]
panfrost: Add BO cache data structure

Linked list of panfrost_bo* nested inside an array of buckets.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Describe BO cache architecture
Alyssa Rosenzweig [Mon, 15 Jul 2019 15:27:57 +0000 (08:27 -0700)]
panfrost: Describe BO cache architecture

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Stub out panfrost_bo_cache_evict
Alyssa Rosenzweig [Mon, 15 Jul 2019 15:22:33 +0000 (08:22 -0700)]
panfrost: Stub out panfrost_bo_cache_evict

This destructor will be used to legitimately free the BOs, now that a BO
free with cacheable=0 is only a "fake" free.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Stub out panfrost_bo_cache_put
Alyssa Rosenzweig [Mon, 15 Jul 2019 15:19:53 +0000 (08:19 -0700)]
panfrost: Stub out panfrost_bo_cache_put

..so we can intercept the BO free.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Stub out panfrost_bo_cache_get
Alyssa Rosenzweig [Mon, 15 Jul 2019 15:13:10 +0000 (08:13 -0700)]
panfrost: Stub out panfrost_bo_cache_get

We will use this function to fetch cached BOs instead of freshly
allocating them.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Don't leak the blend CSO hash table
Alyssa Rosenzweig [Mon, 15 Jul 2019 18:37:42 +0000 (11:37 -0700)]
panfrost: Don't leak the blend CSO hash table

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Cleanup after scoreboarding
Alyssa Rosenzweig [Mon, 15 Jul 2019 18:32:23 +0000 (11:32 -0700)]
panfrost: Cleanup after scoreboarding

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Allocate UBOs on the stack, not the heap
Alyssa Rosenzweig [Mon, 15 Jul 2019 18:30:35 +0000 (11:30 -0700)]
panfrost: Allocate UBOs on the stack, not the heap

Saves a call to calloc (the maximum size is small and known at
compile-time) and fixes a leak.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agonir,intel: Add support for lowering 64-bit nir_opt_extract_*
Jason Ekstrand [Mon, 15 Jul 2019 15:31:49 +0000 (10:31 -0500)]
nir,intel: Add support for lowering 64-bit nir_opt_extract_*

We need this when doing full software 64-bit emulation.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110309
Fixes: cbad201c2b3 "nir/algebraic: Add missing 64-bit extract_[iu]8..."
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
5 years agonir/opt_if: Clean up single-src phis in opt_if_loop_terminator
Jason Ekstrand [Wed, 10 Jul 2019 20:14:42 +0000 (15:14 -0500)]
nir/opt_if: Clean up single-src phis in opt_if_loop_terminator

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111071
Fixes: 2a74296f24ba "nir: add opt_if_loop_terminator()"
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agoradeonsi: verify buffer_offset value before using it
Pierre-Eric Pelloux-Prayer [Fri, 5 Jul 2019 12:57:29 +0000 (14:57 +0200)]
radeonsi: verify buffer_offset value before using it

This buffer_ofset can come directly from the application (e.g: when using
glVertexAttribPointer) and can contain an invalid value.

st_atom_array already makes sure that if it's not negative so all that's left
is to verify that it's smaller that the buffer size.

Bugs related to this issue:

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105251#c52
Bugzilla: https://bugzilla.freedesktop.org/show_bug.cgi?id=109693
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
5 years agost/mesa: verify that vertex buffer offset isn't negative
Pierre-Eric Pelloux-Prayer [Fri, 5 Jul 2019 12:51:23 +0000 (14:51 +0200)]
st/mesa: verify that vertex buffer offset isn't negative

For drivers supporting PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET the buffer_offset value
will be interpreted as an signed int.

An example of application code causing a negative offset:

            float b[] = { ... }; // 3 float for pos, 3 for color
            glBufferData(GL_ARRAY_BUFFER, ..., b, ...);
            glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), 0);
            glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), &b[3]);
                                                                                ^
                                                                    should be 3 * sizeof(float)

The offset is a ptr so when interpreted as a signed int it can be negative.

This commit adds a verification that (int) buffer_offset is not negative - this would
indicate an application bug. Since it's too late to emit a GL_INVALID_VALUE error,
we replace the negative offset by 0 and emit a debug message.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
5 years agost/mesa: don't invalidate a buffer range that is mapped
Marek Olšák [Wed, 3 Jul 2019 22:51:24 +0000 (18:51 -0400)]
st/mesa: don't invalidate a buffer range that is mapped

This is needed to fix an issue with OpenGL when a buffer is mapped and
BufferSubData is called. In this case, we can't invalidate the buffer range.

5 years agogallium: use MAP_DIRECTLY to mean supression of DISCARD in buffer_subdata
Marek Olšák [Wed, 3 Jul 2019 22:51:24 +0000 (18:51 -0400)]
gallium: use MAP_DIRECTLY to mean supression of DISCARD in buffer_subdata

This is needed to fix an issue with OpenGL when a buffer is mapped and
BufferSubData is called. In this case, we can't invalidate the buffer range.

5 years agoiris: Better handle decoder base addresses
Kenneth Graunke [Fri, 12 Jul 2019 20:52:35 +0000 (13:52 -0700)]
iris: Better handle decoder base addresses

It can be useful to call the decoder on a single batch.  But, that batch
may not contain STATE_BASE_ADDRESS, at which point the decoder will have
no idea how to find any buffers.  We can initialize the two static bases
at the beginning of time, so it has them even if it never sees SBA.

Surface base address changes dynamically, possibly in the middle of a
batch.  So we update it at the start of each batch, making it always
start at the value we inherited from the previous one.  SBA commands
inside the batch can update it to a proper value.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
5 years agoradv/gfx10: enable OC_LDS_EN for NGG GS if the ES stage is TES
Samuel Pitoiset [Mon, 15 Jul 2019 16:46:48 +0000 (18:46 +0200)]
radv/gfx10: enable OC_LDS_EN for NGG GS if the ES stage is TES

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoanv: Add android dependencies on android.
Bas Nieuwenhuizen [Mon, 8 Jul 2019 10:47:14 +0000 (12:47 +0200)]
anv: Add android dependencies on android.

Specifically needed for nativewindow for some VK_EXT_external_memory_android_hardware_buffers
functions, where we call into some AHardwareBuffer functions.

The legacy Android ext did not have us call into any Android function
at all and hence it was not noticed.

Fixes: 755c633b8d9 "anv: Fix vulkan build in meson."
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
5 years agopanfrost: Advertise more depth/stencil formats
Alyssa Rosenzweig [Mon, 15 Jul 2019 14:12:47 +0000 (07:12 -0700)]
panfrost: Advertise more depth/stencil formats

Fixes a regression in glmark's shadow/refract scenes.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost/mfbd: Add Z32 rendering support
Alyssa Rosenzweig [Mon, 15 Jul 2019 14:10:31 +0000 (07:10 -0700)]
panfrost/mfbd: Add Z32 rendering support

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Fix blend_cso if nr_cbufs == 0
Alyssa Rosenzweig [Mon, 15 Jul 2019 14:08:15 +0000 (07:08 -0700)]
panfrost: Fix blend_cso if nr_cbufs == 0

Fixes: 46396af1ec4b69ca4a ("panfrost: Refactor blend infrastructure")
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Cleanup shader upload code
Alyssa Rosenzweig [Fri, 12 Jul 2019 23:53:52 +0000 (16:53 -0700)]
panfrost: Cleanup shader upload code

The old algorithm is still used (and the same issue -- namely, leaking
all shaders -- applies) but we're way more concise about it since we're
*only* using the routine for shaders nowadays; everything else is a
BO-proper or transient.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Remove all old allocators
Alyssa Rosenzweig [Fri, 12 Jul 2019 23:45:44 +0000 (16:45 -0700)]
panfrost: Remove all old allocators

With the new refactor, this all becomes dead code.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
5 years agopanfrost: Use transient memory for occlusion queries
Alyssa Rosenzweig [Fri, 12 Jul 2019 23:38:11 +0000 (16:38 -0700)]
panfrost: Use transient memory for occlusion queries

These only last a frame anyway.

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