mesa.git
5 years agost/va: Return correct status from vlVaQuerySurfaceStatus
Indrajit Das [Thu, 3 Jan 2019 09:06:33 +0000 (14:36 +0530)]
st/va: Return correct status from vlVaQuerySurfaceStatus

This ensures that during encoding, applications can get
the correct status of the surface before submitting
more operations on the same.

Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Indrajit Das <indrajit-kumar.das@amd.com>
5 years agoRevert "llvmpipe: Always return some fence in flush (v2)"
Roland Scheidegger [Wed, 9 Jan 2019 16:25:52 +0000 (17:25 +0100)]
Revert "llvmpipe: Always return some fence in flush (v2)"

This reverts commit f6a6da8131383d8eeee07cd59326a70f4b15866b.

With this commit we see massive amounts of asserts triggering
in lp_fence_wait(), assert(f->issued), for instance with libgl_xlib
state tracker and piglit. Not entirely sure if the assert could
just be removed.

5 years agost/mesa: don't leak pipe_surface if pipe_context is not current
Marek Olšák [Tue, 8 Jan 2019 16:12:05 +0000 (11:12 -0500)]
st/mesa: don't leak pipe_surface if pipe_context is not current

We have found some pipe_surface leaks internally.

This is the same code as surface_destroy in radeonsi.
Ideally, surface_destroy would be in pipe_screen.

Cc: 18.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
5 years agost/mesa: don't reference pipe_surface locally in PBO code
Marek Olšák [Tue, 8 Jan 2019 15:47:31 +0000 (10:47 -0500)]
st/mesa: don't reference pipe_surface locally in PBO code

Reviewed-by: Brian Paul <brianp@vmware.com>
5 years agost/mesa: unify window-system renderbuffer initialization
Marek Olšák [Tue, 8 Jan 2019 15:44:29 +0000 (10:44 -0500)]
st/mesa: unify window-system renderbuffer initialization

Reviewed-by: Brian Paul <brianp@vmware.com>
5 years agoradeonsi: Fix use of 1- or 2- component GL_DOUBLE vbo's.
Mario Kleiner [Mon, 7 Jan 2019 18:42:29 +0000 (19:42 +0100)]
radeonsi: Fix use of 1- or 2- component GL_DOUBLE vbo's.

With Mesa 18.1, commit be973ed21f6e, si_llvm_load_input_vs()
changed the number of source 32-bit wide dword components
used for fetching vertex attributes into the vertex shader
from a constant 4 to a variable num_channels number, depending
on input data format, with some special case handling for
input data formats like 64-Bit doubles.

In the case of a GL_DOUBLE input data format with one
or two components though, e.g, submitted via ...

a) glTexCoordPointer(1, GL_DOUBLE, 0, buffer);
b) glTexCoordPointer(2, GL_DOUBLE, 0, buffer);

... the input format would be SI_FIX_FETCH_RG_64_FLOAT,
but no special case handling was implemented for that
case, so in the default path the number of 32-bit
dwords would be set to the number of float input components
derived from info->input_usage_mask. This ends with corrupted
input to the vertex shader, because fetching a 64-bit double
from the vbo requires fetching two 32-bit dwords instead of 1,
and fetching a two double input requires 4 dword fetches
instead of 2, so in these cases the vertex shader receives
incomplete/truncated input data:

a) float v = gl_MultiTexCoord0.x;  -> v.x is corrupted.
b) vec2  v = gl_MultiTexCoord0.xy; -> v.x is assigned
   correctly, but v.y is corrupted.

This happens with the standard TGSI IR compiled shaders.
Under NIR with R600_DEBUG=nir, we got correct behavior
because the current radeonsi nir code always assigns
info->input_usage_mask = TGSI_WRITEMASK_XYZW, thereby
always fetches 4 dwords regardless of what the shader
actually needs.

Fix this by properly assigning 2 or 4 dword fetches for
one or two component GL_DOUBLE input.

Fixes: be973ed21f6e ("radeonsi: load the right number of
       components for VS inputs and TBOs")

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
Cc: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
5 years agoac/nir,radv,radeonsi/nir: use correct indices for interpolation intrinsics
Rhys Perry [Wed, 9 Jan 2019 11:09:33 +0000 (11:09 +0000)]
ac/nir,radv,radeonsi/nir: use correct indices for interpolation intrinsics

Fixes artifacts in World of Warcraft when Multi-sample Alpha-Test is
enabled with DXVK.
It also fixes artifacts with Fallout 4's god rays with DXVK.
Various piglit interpolateAt*() tests under NIR are also fixed.

v2: formatting fix
    update commit message to include Fallout 4 and the Fixes tag

Fixes: f4e499ec791 ('radv: add initial non-conformant radv vulkan driver')
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106595
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
5 years agoradv: skip draws with instance_count == 0
Samuel Pitoiset [Wed, 9 Jan 2019 09:06:08 +0000 (10:06 +0100)]
radv: skip draws with instance_count == 0

Loosely based on RadeonSI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: enable variable pointers
Samuel Pitoiset [Wed, 9 Jan 2019 11:31:48 +0000 (12:31 +0100)]
radv: enable variable pointers

The Vulkan spec 1.1.97 says:
   "variablePointers specifies whether the implementation supports
    the SPIR-V VariablePointers capability. When this feature is
    not enabled, shader modules must not declare the
    VariablePointers capability."

As the SPIR-V feature is enabled, we should turn on the
extension feature as well.

All dEQP-VK.spirv_assembly.instruction.compute.variable_pointers.*
pass with the khronos internal repo. Note that a bunch of them
fails with the public repo, but it's expected as they violate the
specification.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agoradv: get rid of bunch of KHR suffixes
Samuel Pitoiset [Tue, 8 Jan 2019 13:30:32 +0000 (14:30 +0100)]
radv: get rid of bunch of KHR suffixes

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Eric Engestrom <eric.engestrom@intel.com>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradeon: fix printf format specifier.
Maya Rashish [Sun, 6 Jan 2019 16:39:36 +0000 (18:39 +0200)]
radeon: fix printf format specifier.

From glibc printf(3):

Z      A nonstandard synonym for z that predates the appearance of z.
       Do not use in new code.

Z may not exist on non-glibc systems. Prefer the standard symbol.

Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agollvmpipe: Always return some fence in flush (v2)
Tomasz Figa [Fri, 14 Dec 2018 08:17:40 +0000 (17:17 +0900)]
llvmpipe: Always return some fence in flush (v2)

If there is no last fence, due to no rendering happening yet, just
create a new signaled fence and return it, to match the expectations of
the EGL sync fence API.

Fixes random "Could not create sync fence 0x3003" assertion failures from
Skia on Android, coming from the following code:

https://android.googlesource.com/platform/frameworks/base/+/master/libs/hwui/pipeline/skia/SkiaOpenGLPipeline.cpp#427

Reproducible especially with thread count >= 4.

One could make the driver always keep the reference to the last fence,
but:

 - the driver seems to explicitly destroy the fence whenever a rendering
   pass completes and changing that would require a significant functional
   change to the code. (Specifically, in lp_scene_end_rasterization().)

 - it still wouldn't solve the problem of an EGL sync fence being created
   and waited on without any rendering happening at all, which is
   also likely to happen with Android code pointed to in the commit.

Therefore, the simple approach of always creating a fence is taken,
similarly to other drivers, such as radeonsi.

Tested with piglit llvmpipe suite with no regressions and following
tests fixed:

egl_khr_fence_sync
 conformance
  eglclientwaitsynckhr_flag_sync_flush
  eglclientwaitsynckhr_nonzero_timeout
  eglclientwaitsynckhr_zero_timeout
  eglcreatesynckhr_default_attributes
  eglgetsyncattribkhr_invalid_attrib
  eglgetsyncattribkhr_sync_status

v2:
 - remove the useless lp_fence_reference() dance (Nicolai),
 - explain why creating the dummy fence is the right approach.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
5 years agoglsl: Fix buffer overflow with an atomic buffer binding out of range.
Eric Anholt [Tue, 8 Jan 2019 19:45:16 +0000 (11:45 -0800)]
glsl: Fix buffer overflow with an atomic buffer binding out of range.

The binding is checked against the limits later in the function, so we
need to make sure we don't overflow before the check here.

Fixes this valgrind warning (and sometimes segfault):

==1460== Invalid write of size 4
==1460==    at 0x74C98DD: ast_declarator_list::hir(exec_list*, _mesa_glsl_parse_state*) (ast_to_hir.cpp:4943)
==1460==    by 0x74C054F: _mesa_ast_to_hir(exec_list*, _mesa_glsl_parse_state*) (ast_to_hir.cpp:159)
==1460==    by 0x7435C12: _mesa_glsl_compile_shader (glsl_parser_extras.cpp:2130)

in

dEQP-GLES31.functional.debug.negative_coverage.get_error.compute.
   exceed_atomic_counters_limit

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
5 years agonir: Make nir_deref_instr_build/get_const_offset actually use size_align.
Eric Anholt [Sat, 5 Jan 2019 00:52:32 +0000 (16:52 -0800)]
nir: Make nir_deref_instr_build/get_const_offset actually use size_align.

I think this was copy-and-paste mistake -- nir_opt_large_constants was
passing in glsl_get_natural_size_align_bytes() given brw_nir.c's arguments
to the opt pass.

I wanted to reuse this function for handling constant offsets of arrays of
images in V3D.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
5 years agoglsl/linker: Fix unmatched TCS outputs being reduced to local variable
Danylo Piliaiev [Wed, 2 Jan 2019 13:55:08 +0000 (15:55 +0200)]
glsl/linker: Fix unmatched TCS outputs being reduced to local variable

Always match TCS outputs since they are shared by all invocations
within the patch and should not be converted to local variables.

This is one of the issues found in Downward.

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104297

5 years agov3d: Enable GL_ARB_texture_gather on V3D 4.x.
Eric Anholt [Thu, 27 Dec 2018 07:04:10 +0000 (23:04 -0800)]
v3d: Enable GL_ARB_texture_gather on V3D 4.x.

This is part of GLES 3.1, and with the NIR lowering we're now passing the
GLES31 testcases.

5 years agonir: Add nir_lower_tex support for Broadcom's swizzled TG4 results.
Eric Anholt [Thu, 27 Dec 2018 06:45:04 +0000 (22:45 -0800)]
nir: Add nir_lower_tex support for Broadcom's swizzled TG4 results.

V3D returns the texels in a different order in the resulting vec4 from
what GLSL wants, so we need to put in a swizzle.  Fixes
dEQP-GLES31.functional.texture.gather.basic.2d.rgba8.base_level.level_1

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agofreedreno: Move register constant files to src/freedreno.
Bas Nieuwenhuizen [Fri, 28 Dec 2018 14:20:13 +0000 (15:20 +0100)]
freedreno: Move register constant files to src/freedreno.

This way they can be shared. Build tested with meson, but not too sure
on the autotools stuff though.

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Acked-by: Rob Clark <robdclark@gmail.com>
5 years agonir: fix warning in nir_lower_io.c
Caio Marcelo de Oliveira Filho [Tue, 8 Jan 2019 17:31:29 +0000 (09:31 -0800)]
nir: fix warning in nir_lower_io.c

Initialize the variable with NULL.  Fixes the following

    In file included from ../src/compiler/nir/nir_lower_io.c:34:
    ../src/compiler/nir/nir_lower_io.c: In function ‘nir_lower_explicit_io’:
    ../src/compiler/nir/nir.h:668:11: warning: ‘addr’ may be used uninitialized in this function [-Wmaybe-uninitialized]
        return src;
               ^~~
    ../src/compiler/nir/nir_lower_io.c:735:17: note: ‘addr’ was declared here
        nir_ssa_def *addr;
                     ^~~~

v2: Avoid using a 'default' case so we get help from the compiler when
    new deref types are added. (Lionel)

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agofreedreno/drm: sync uapi again
Chia-I Wu [Tue, 8 Jan 2019 00:26:53 +0000 (16:26 -0800)]
freedreno/drm: sync uapi again

"pad" was missing in Mesa's msm_drm.h.  sizeof(drm_msm_gem_info)
remains the same, but now the compiler initializes the field to
zero.

Buffer allocation results in EINVAL without this for me.

Cc: Rob Clark <robdclark@gmail.com>
Cc: Kristian Høgsberg <hoegsberg@gmail.com>
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@gmail.com>
5 years agomeson: fix EGL/X11 build without GLX
Chia-I Wu [Mon, 7 Jan 2019 20:54:19 +0000 (12:54 -0800)]
meson: fix EGL/X11 build without GLX

dep_xcb and others were not set under this configuration.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agowsi: drop unneeded KHR suffix
Eric Engestrom [Tue, 8 Jan 2019 18:06:01 +0000 (18:06 +0000)]
wsi: drop unneeded KHR suffix

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoanv: drop unneeded KHR suffix
Eric Engestrom [Tue, 8 Jan 2019 18:04:54 +0000 (18:04 +0000)]
anv: drop unneeded KHR suffix

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: rename global/local to private/function memory
Karol Herbst [Tue, 23 Oct 2018 21:26:22 +0000 (23:26 +0200)]
nir: rename global/local to private/function memory

the naming is a bit confusing no matter how you look at it. Within SPIR-V
"global" memory is memory accessible from all threads. glsl "global" memory
normally refers to shader thread private memory declared at global scope. As
we already use "shared" for memory shared across all thrads of a work group
the solution where everybody could be happy with is to rename "global" to
"private" and use "global" later for memory usually stored within system
accessible memory (be it VRAM or system RAM if keeping SVM in mind).
glsl "local" memory is memory only accessible within a function, while SPIR-V
"local" memory is memory accessible within the same workgroup.

v2: rename local to function as well
v3: rename vtn_variable_mode_local as well

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoautotools: Remove tegra vdpau driver
Dylan Baker [Tue, 18 Dec 2018 22:37:52 +0000 (14:37 -0800)]
autotools: Remove tegra vdpau driver

This has never functioned and probably wont ever function, due to the
way gallium media state trackers are architected and the tegra video
decoder is architected.

Cc: Thierry Reding <thierry.reding@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Fixes: 1755f608f5201e0a23f00cc3ea1b01edd07eb6ef
       ("tegra: Initial support")

5 years agoclover/meson: Ignore 'svn' suffix when computing CLANG_RESOURCE_DIR
Pierre Moreau [Mon, 7 Jan 2019 20:30:17 +0000 (21:30 +0100)]
clover/meson: Ignore 'svn' suffix when computing CLANG_RESOURCE_DIR

The version exported by LLVM in its CMake configuration files can
include the “svn” suffix when building a development version (for
example “8.0.0svn”). However the exported clang headers are still found
under “lib/clang/8.0.0/”, without the “svn” suffix.
Meson takes care of removing the “svn” suffix from the version when
using the dependency’s `version()` method.

This processing is already performed in “configure.ac” when using
autotools.

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
5 years agoanv: flush fast clear colors into compressed surfaces
Lionel Landwerlin [Sun, 23 Dec 2018 17:49:23 +0000 (17:49 +0000)]
anv: flush fast clear colors into compressed surfaces

In the following scenario :

   1. Create image format R8G8B8A8_UNORM
   2. Create image view format R8G8B8A8_SRGB
   3. Clear the view through a sub pass to a particular color
   4. Barrier on the image to from color attachment to source transfer
   5. Copy the image into a linear buffer to check the content

The step 4 resolving the clear color is unaware of the SRGB format of
the view, because the blorp resolve operations operate on images the
color associated with the resolve will not operate on SRGB format but
UNORM. Leading to the wrong color being written into surfaces.

This change forces a clear color resolve at the end of the render pass
so following resolves won't have to deal with the clear color with a
format that doesn't match the image's format.

On gfxbench vulkan_5_normal 1280x720, this appear to cost us ~0.5fps,
from 49.316 down to 48.949.

v2: Only fast clear resolve when image & view have different formats
    (Lionel)

v3: Update warning (Jason)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108911
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: mesa-stable@lists.freedesktop.org
5 years agoanv: explictly specify format for blorp ccs/mcs op
Lionel Landwerlin [Mon, 24 Dec 2018 10:11:59 +0000 (10:11 +0000)]
anv: explictly specify format for blorp ccs/mcs op

Resolve operations can happen when dealing with view (begin/end
subpasses) in which case the view's format needs to apply, not the
image's format.

v2: Relayout arguments of a ccs_op() call (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108911
Cc: mesa-stable@lists.freedesktop.org
5 years agodri3: initialize adaptive_sync as false before configQueryb
Tapani Pälli [Mon, 7 Jan 2019 08:52:56 +0000 (10:52 +0200)]
dri3: initialize adaptive_sync as false before configQueryb

Fixes following errors from valgrind output:

   ==23388== Conditional jump or move depends on uninitialised value(s)
   ==23388==    at 0x48B4924: loader_dri3_drawable_init (loader_dri3_helper.c:381)
   ==23388==    by 0x48A97D2: dri3_create_drawable (dri3_glx.c:386)
   ==23388==    by 0x489E190: driFetchDrawable (dri_common.c:369)
   ==23388==    by 0x48A9187: dri3_bind_context (dri3_glx.c:195)
   ==23388==    by 0x488B75C: MakeContextCurrent (glxcurrent.c:220)
   ==23388==    by 0x488B8DB: glXMakeCurrent (glxcurrent.c:267)
   ==23388==    by 0x10A987: ??? (in /usr/bin/glxgears)
   ==23388==    by 0x4BEB412: (below main) (in /usr/lib64/libc-2.28.so)
   ==23388==
   ==23388== Conditional jump or move depends on uninitialised value(s)
   ==23388==    at 0x48B5A40: loader_dri3_swap_buffers_msc (loader_dri3_helper.c:923)
   ==23388==    by 0x48A9B7E: dri3_swap_buffers (dri3_glx.c:587)
   ==23388==    by 0x4887A81: glXSwapBuffers (glxcmds.c:857)
   ==23388==    by 0x10ADED: ??? (in /usr/bin/glxgears)
   ==23388==    by 0x4BEB412: (below main) (in /usr/lib64/libc-2.28.so)

Fixes: 2e12fe425fe "loader/dri3: Enable adaptive_sync via _VARIABLE_REFRESH property"
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
5 years agovirgl: use primconvert provoking vertex properly
Dave Airlie [Fri, 28 Dec 2018 06:21:23 +0000 (16:21 +1000)]
virgl: use primconvert provoking vertex properly

This stores the raster state and calls the correct primconvert interface
using the currently bound raster state.

Reviewed-By: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
5 years agoanv: Sort properties and features switch statements
Jason Ekstrand [Mon, 7 Jan 2019 16:51:59 +0000 (10:51 -0600)]
anv: Sort properties and features switch statements

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv: Sort supported capabilities
Jason Ekstrand [Mon, 7 Jan 2019 16:28:23 +0000 (10:28 -0600)]
spirv: Sort supported capabilities

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agoanv: Enable the new deref-based UBO/SSBO path
Jason Ekstrand [Sat, 15 Dec 2018 00:38:08 +0000 (18:38 -0600)]
anv: Enable the new deref-based UBO/SSBO path

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv: Add support for using derefs for UBO/SSBO access
Jason Ekstrand [Sat, 15 Dec 2018 00:36:01 +0000 (18:36 -0600)]
spirv: Add support for using derefs for UBO/SSBO access

For now, it's hidden behind a cap.  Hopefully, we can eventually drop
that along with all the manual offset code in spirv_to_nir.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Tested-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
5 years agospirv: Make better use of vtn_pointer_uses_ssa_offset
Jason Ekstrand [Sat, 15 Dec 2018 00:25:38 +0000 (18:25 -0600)]
spirv: Make better use of vtn_pointer_uses_ssa_offset

The choice of whether or not we should use block_load/store isn't a
choice between external and not so much as a choice between deref
instructions and manually calculated offsets.  In vtn_pointer_from_ssa,
we guard the index+offset case behind vtn_pointer_uses_ssa_offset and
then branch out from there.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv: Add explicit pointer types
Jason Ekstrand [Wed, 28 Nov 2018 21:20:03 +0000 (15:20 -0600)]
spirv: Add explicit pointer types

Instead of baking in uvec2 for UBO and SSBO pointers and uint for push
constant and shared memory pointers, make it configurable.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv: Choose atomic deref type with pointer_uses_ssa_offset
Jason Ekstrand [Sat, 15 Dec 2018 00:20:00 +0000 (18:20 -0600)]
spirv: Choose atomic deref type with pointer_uses_ssa_offset

Previously, we hard-coded the rule about workgroup variables and the
builder lower_workgroup_access_to_offsets flag.  Instead base it on the
handy helper we have for exactly this sort of thing.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv: Add error checking for Block and BufferBlock decorations
Jason Ekstrand [Sat, 15 Dec 2018 14:31:51 +0000 (08:31 -0600)]
spirv: Add error checking for Block and BufferBlock decorations

Variable pointers being well-defined across the block boundary requires
a couple of very specific SPIR-V validation rules.  Normally, we'd trust
the validator to catch these but since CTS tests have been found in the
wild which violate them, we'll carry our own checks.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/vulkan: Add a descriptor type to vulkan resource intrinsics
Jason Ekstrand [Thu, 13 Dec 2018 22:50:19 +0000 (16:50 -0600)]
nir/vulkan: Add a descriptor type to vulkan resource intrinsics

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/lower_io: Add "explicit" IO lowering
Jason Ekstrand [Wed, 28 Nov 2018 03:31:42 +0000 (21:31 -0600)]
nir/lower_io: Add "explicit" IO lowering

This new pass is for lowering explicitly laid out memory coming in from
SPIR-V or a similar source.  It's quite a bit more complicated than the
normal lower_io because we have to be able to handle matrices.  The
way the stride information is stored for matrices is awkward and dealing
with row-major matrices is especially painful.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/validate: Allow array derefs on vectors in more modes
Jason Ekstrand [Fri, 14 Dec 2018 00:34:35 +0000 (18:34 -0600)]
nir/validate: Allow array derefs on vectors in more modes

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/intrinsics: Add access flags to load/store_deref
Jason Ekstrand [Wed, 28 Nov 2018 19:44:56 +0000 (13:44 -0600)]
nir/intrinsics: Add access flags to load/store_deref

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/intrinsics: Allow deref sources to consume anything
Jason Ekstrand [Wed, 28 Nov 2018 03:30:22 +0000 (21:30 -0600)]
nir/intrinsics: Allow deref sources to consume anything

This commit adds a new num_components value for intrinsic sources of -1
which means that it consumes everything and the number of components
effectively isn't validated.  This is useful for deref sources which
just take the result of the deref and we leave it up to the driver to
decide what that size should be.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/validate: Allow derefs in phi nodes
Jason Ekstrand [Thu, 13 Dec 2018 23:42:34 +0000 (17:42 -0600)]
nir/validate: Allow derefs in phi nodes

We added this assert when first moving derefs over to instructions to
ensure that deref chains could go all the way back to the variables.
Now that we're going to start using derefs for things that we can do
variable pointers on such as UBOs and SSBOs, we need to be able to run
derefs through phi nodes, selects, and basically anything else.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/remove_dead_variables: Properly handle deref casts
Jason Ekstrand [Wed, 28 Nov 2018 23:27:57 +0000 (17:27 -0600)]
nir/remove_dead_variables: Properly handle deref casts

We already detect any incomplete deref chains (where the deref is used
for something other than another deref or a load/store) and flag the
variable as used thanks to deref_used_for_not_store.  All that's left to
do is to properly skip casts when cleaning up.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/deref: Skip over casts in fixup_deref_modes
Jason Ekstrand [Wed, 28 Nov 2018 23:27:00 +0000 (17:27 -0600)]
nir/deref: Skip over casts in fixup_deref_modes

This pass is used when, for instance, we lazily change the mode of
variables rather than replacing the variable with a new one.  Since we
only do this in cases where we know we have full deref chains, it's ok
to just skip them in fixup_deref_modes.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/deref: Support casts and ptr_as_array in comparisons
Jason Ekstrand [Thu, 13 Dec 2018 19:50:51 +0000 (13:50 -0600)]
nir/deref: Support casts and ptr_as_array in comparisons

The code which constructs deref paths already gives you the path
starting at the nearest deref_cast or deref_var.  All we need to do for
casts is handle the case where the start of the path isn't a deref_var.
For ptr_as_array derefs, we just bail if we have any after the
divergence point between the two derefs.  We may be able to do better in
the future but this works for now.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/opt_deref: Properly optimize ptr_as_array derefs
Jason Ekstrand [Thu, 13 Dec 2018 18:37:59 +0000 (12:37 -0600)]
nir/opt_deref: Properly optimize ptr_as_array derefs

When handling casts, we can't blindly propagate the parent of a cast
into a ptr_as_array deref because doing so might loose the stride
information from the cast.  Instead, before we can propagate into
ptr_as_array derefs, we need to check that the cast is a cast of an
array deref and that the stride matches.  For other types of derefs, we
can continue to propagate casts as normal because they don't need the
stride.  We also add an optimization which can combine a ptr_as_array
deref with it parent if it is also an array deref of some form.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/validate: Don't allow derefs in if conditions
Jason Ekstrand [Fri, 4 Jan 2019 17:11:49 +0000 (11:11 -0600)]
nir/validate: Don't allow derefs in if conditions

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir: Add a ptr_as_array deref type
Jason Ekstrand [Wed, 28 Nov 2018 18:26:52 +0000 (12:26 -0600)]
nir: Add a ptr_as_array deref type

These correspond directly to SPIR-V's OpPtrAccessChain.  As such, they
treat whatever their parent gives them as if it's the first element in
some array and dereferences that array.  If the parent is, itself, an
array deref, then the two indices can just be added together to get the
final array deref.  However, it can also be used in cases where what you
have is a dereference to some random vec2 value somewhere.  In this
case, we require a cast before the ptr_as_array and use the ptr_stride
field in the cast to provide a stride for the ptr_as_array derefs.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir: Move propagation of cast derefs to a new nir_opt_deref pass
Jason Ekstrand [Thu, 13 Dec 2018 17:08:13 +0000 (11:08 -0600)]
nir: Move propagation of cast derefs to a new nir_opt_deref pass

We're going to want to do more deref optimizations going forward and
this gives us a central place to do them.  Also, cast propagation will
get a bit more complicated with the addition of ptr_as_array derefs.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv: Propagate layout decorations to created glsl_types
Jason Ekstrand [Wed, 12 Dec 2018 22:07:07 +0000 (16:07 -0600)]
spirv: Propagate layout decorations to created glsl_types

Instead of just storing the decorations in the vtn_type, propagate them
all the way through to the glsl_type.  For array strides, this means we
need to handle them earlier so we break array stride handling into it's
own function and explicitly call it for both pointer and array types.

Due to type deduplication in the SPIR-V, we may have explicit layout
decorations on all sorts of types that don't actually want them.  In
order to prevent these leaking into unfortunate places in NIR, we
explicitly strip them off before creating NIR variables and when casting
pointers to non-external memory.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
5 years agoglsl_type: Add support for explicitly laid out matrices and arrays
Jason Ekstrand [Wed, 12 Dec 2018 20:32:19 +0000 (14:32 -0600)]
glsl_type: Add support for explicitly laid out matrices and arrays

SPIR-V allows for matrix and array types to be decorated with explicit
byte stride decorations and matrix types to be decorated row- or
column-major.  This commit adds support to glsl_type to encode this
information.  Because this doesn't work nicely with std430 and std140
alignments, we add asserts to ensure that we don't use any of the std430
or std140 layout functions with explicitly laid out types.

In SPIR-V, the layout information for matrices is applied to the parent
struct member instead of to the matrix type itself.  However, this is
gets rather clumsy when you're walking derefs trying to compute offsets
because, the moment you hit a matrix, you have to crawl back the deref
chain and find the struct.  Instead, we take the same path here as we've
taken in spirv_to_nir and put the decorations on the matrix type itself.

This also subtly adds support for strided vector types.  These don't
come up in SPIR-V directly but you can get one as the result of taking a
column from a row-major matrix or a row from a column-major matrix.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
5 years agoglsl_type: Simplify glsl_channel_type
Jason Ekstrand [Wed, 12 Dec 2018 21:25:47 +0000 (15:25 -0600)]
glsl_type: Simplify glsl_channel_type

This is C++ so we can just poke at the fields of glsl_type if we wish
and calling get_instance is way easier and more reliable than handling
each instance separately.  While we're at it, we re-arrange the base
type labels to match the enum order and add 8-bit type support.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agoglsl_type: Add a C wrapper to get struct field offsets
Jason Ekstrand [Tue, 18 Dec 2018 16:30:23 +0000 (10:30 -0600)]
glsl_type: Add a C wrapper to get struct field offsets

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agoglsl_type: Drop the glsl_get_array_instance C helper
Jason Ekstrand [Wed, 12 Dec 2018 21:18:04 +0000 (15:18 -0600)]
glsl_type: Drop the glsl_get_array_instance C helper

It was added in bce6f9987522 even though it's completely redundant with
glsl_array_type().

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir: Distinguish between normal uniforms and UBOs
Jason Ekstrand [Fri, 14 Dec 2018 17:21:50 +0000 (11:21 -0600)]
nir: Distinguish between normal uniforms and UBOs

Previously, NIR had a single nir_var_uniform mode used for atomic
counters, UBOs, samplers, images, and normal uniforms.  This commit
splits this into nir_var_uniform and nir_var_ubo where nir_var_uniform
is still a bit of a catch-all but the nir_var_ubo is specific to UBOs.
While we're at it, we also rename shader_storage to ssbo to follow the
convention.

We need this so that we can distinguish between normal uniforms and UBO
access at the deref level without going all the way back variable and
seeing if it has an interface type.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir: Allow storing to shader_storage
Jason Ekstrand [Fri, 14 Dec 2018 17:31:08 +0000 (11:31 -0600)]
nir: Allow storing to shader_storage

I have no idea how shader_storage made it into the list of banned
variable modes for stores but it clearly should be allowed.  This only
doesn't cause us a problem today because we never actually use derefs on
shader_storage variables.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/validate: Require array indices to match the deref bit size
Jason Ekstrand [Fri, 14 Dec 2018 17:16:09 +0000 (11:16 -0600)]
nir/validate: Require array indices to match the deref bit size

This doesn't currently change anything because array indices are
required to be 32 bits and all derefs are also 32 bits.  However, we
will one day have 64-bit derefs for OpenCL.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv: Handle arbitrary bit sizes for deref array indices
Jason Ekstrand [Fri, 14 Dec 2018 17:06:07 +0000 (11:06 -0600)]
spirv: Handle arbitrary bit sizes for deref array indices

We already had code in link_as_ssa to handle bit sizes; we just need to
use it.  While we're at it we clean up link_as_ssa a bit and add an
explicit bit_size parameter in preparation for a day when we have derefs
that aren't 32 bit.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agonir/builder: Add nir_i2i and nir_u2u helpers which take a bit size
Jason Ekstrand [Tue, 27 Nov 2018 22:28:32 +0000 (16:28 -0600)]
nir/builder: Add nir_i2i and nir_u2u helpers which take a bit size

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com
5 years agospirv: Emit NIR deref instructions on-the-fly
Jason Ekstrand [Thu, 25 Oct 2018 15:34:34 +0000 (10:34 -0500)]
spirv: Emit NIR deref instructions on-the-fly

This simplifies our deref handling by emitting the actual NIR deref
instructions on-the-fly instead of of building up a deref chain and then
emitting them at the last moment.  In order for this to work with the
parts of the compiler that assume they can chase deref chains, we have
to run nir_rematerialize_derefs_in_use_blocks_impl to put the derefs
back in the right places.  Otherwise, in cases such as loop continues
where the SPIR-V blocks are not in the same order as the NIR blocks, we
may end up with a deref chain with a parent that does not dominate it's
child and nir_repair_ssa_impl will insert phis in the deref chain.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv: Sign-extend array indices
Jason Ekstrand [Sat, 15 Dec 2018 15:57:26 +0000 (09:57 -0600)]
spirv: Sign-extend array indices

The SPIR-V spec was recently updated to clarify that array indices are
treated as signed integers.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agoanv/apply_pipeline_layout: Set the cursor in lower_res_reindex_intrinsic
Jason Ekstrand [Fri, 14 Dec 2018 00:33:46 +0000 (18:33 -0600)]
anv/apply_pipeline_layout: Set the cursor in lower_res_reindex_intrinsic

The loop through instructions doesn't set the cursor for us so unless we
set it somewhere, we may end up emitting instructions in the wrong
place.  The only reason why we haven't been bitten by this in the past
is that it only happens in a few variable pointers cases and the CTS
tests for those don't use much control flow so things were getting
emitted in the correct order by accident.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv: Handle any bit size in vector_insert/extract
Jason Ekstrand [Fri, 14 Dec 2018 16:54:08 +0000 (10:54 -0600)]
spirv: Handle any bit size in vector_insert/extract

This crops up both in the actual SPIR-V VectorInsert/Extract opcodes as
well as various places where we deal with vector derefs.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agoglsl_type: Support serializing 8 and 16-bit types
Jason Ekstrand [Wed, 12 Dec 2018 19:56:02 +0000 (13:56 -0600)]
glsl_type: Support serializing 8 and 16-bit types

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
5 years agospirv: Fix matrix parameters in function calls.
Bas Nieuwenhuizen [Sun, 6 Jan 2019 11:34:24 +0000 (12:34 +0100)]
spirv: Fix matrix parameters in function calls.

They can be handled exactly the same as arrays, we just need to handle
the base type correctly in the switches.

Fixes: a45b6fb4524 "spirv: Pass SSA values through functions"
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109204
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradv: Fix rasterization precision bits.
Bas Nieuwenhuizen [Wed, 2 Jan 2019 16:53:41 +0000 (17:53 +0100)]
radv: Fix rasterization precision bits.

Note that these limits are exact, not a "precision is at least x",
as texel coords also get snapped to a multiple of this step size
before filtering.

This fixes CTS tests

dEQP-VK.texture.explicit_lod.2d.sizes.31x55_nearest_linear_mipmap_nearest_repeat
dEQP-VK.texture.explicit_lod.2d.sizes.57x35_nearest_linear_mipmap_nearest_repeat

Fixes: f4e499ec791 "radv: add initial non-conformant radv vulkan driver"
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109151
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agonir: Make gl_nir_lower_samplers use gl_nir_lower_samplers_as_deref
Kenneth Graunke [Thu, 3 Jan 2019 07:34:19 +0000 (23:34 -0800)]
nir: Make gl_nir_lower_samplers use gl_nir_lower_samplers_as_deref

These days, we have two sampler lowering passes.  The newer one,
gl_nir_lower_samplers_as_deref, is used by radeonsi.  It rewrites
variables to drop structures out of sampler deref chains, to make
life simpler.  It then sets var->data.binding for non-bindless
sampler and image variables based on the GL uniform storage's
opaque index values.

The older one converts sampler deref chains (nir_tex_src_texture_deref)
to a numerical offset (nir_tex_src_texture_offset).  It also stores the
constant-valued portion of that number in tex->texture_index, making
life really simple for drivers that don't support indirects.  It too
pokes at GL uniform storage's opaque index values.

Logically, we can do the first pass (simplify derefs, set bindings)
then the second (turn derefs to offsets, set texture_index).  This
patch does exactly that, eliminating some redundancy (only one pass
has to poke at GL uniform storage), and gaining proper var->data.binding
values for drivers using the full lowering.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: Fix gl_nir_lower_samplers_as_deref's structure type handling.
Kenneth Graunke [Fri, 4 Jan 2019 00:12:20 +0000 (16:12 -0800)]
nir: Fix gl_nir_lower_samplers_as_deref's structure type handling.

We recurse to remove structures, and at each step, re-modify the
resulting type for our link in the deref chain.  For arrays, the
result of recursion is the new underlying type - so we wrap it with
the array dimensionality again.  For structs, we want to simply use
the new underlying type, skipping the struct altogether.

The correct way to do this is to do nothing at all.  Previously, we
had reset type to next->type, which is the /old/ field type, not the
new field type we obtained by recursing.  This undid our recursive work.

Fixes about 338 tests with nested structs, such as:

dEQP-GLES2.functional.uniform_api.value.initial.get_uniform.nested_structs_arrays.sampler2D_samplerCube_fragment

Note that currently only radeonsi uses this pass, and NIR support is
disabled there by default, so the breakage was likely not seen by most
people.  The next commit uses this pass for more drivers, so this fix
prevents regressions from that change.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoamd/common: Add some parentheses to silence warning.
Bas Nieuwenhuizen [Sat, 5 Jan 2019 16:45:01 +0000 (17:45 +0100)]
amd/common: Add some parentheses to silence warning.

[1/59] Compiling C object 'src/amd/common/src@amd@common@@amd_common@sta/ac_nir_to_llvm.c.o'.
../mesa/src/amd/common/ac_nir_to_llvm.c: In function ‘get_inst_tessfactor_writemask’:
../mesa/src/amd/common/ac_nir_to_llvm.c:4089:32: warning: suggest parentheses around ‘+’ inside ‘<<’ [-Wparentheses]
   writemask = ((1 << num_comps + 1) - 1) << first_component;
                      ~~~~~~~~~~^~~
../mesa/src/amd/common/ac_nir_to_llvm.c:4091:33: warning: suggest parentheses around ‘+’ inside ‘<<’ [-Wparentheses]
   writemask = (((1 << num_comps + 1) - 1) << first_component) << 4;

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradv: Remove unused variable.
Bas Nieuwenhuizen [Sat, 5 Jan 2019 16:43:12 +0000 (17:43 +0100)]
radv: Remove unused variable.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoradv: Remove device path.
Bas Nieuwenhuizen [Sat, 5 Jan 2019 16:40:37 +0000 (17:40 +0100)]
radv: Remove device path.

unused and gcc complains about strncpy. (from what I can see because
strncpy does not leave a 0 byte on truncate. That said we don't use
it so this does not fix a real bug).

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoac: remove unused variable from ac_build_ddxy
Marek Olšák [Mon, 7 Jan 2019 19:51:13 +0000 (14:51 -0500)]
ac: remove unused variable from ac_build_ddxy

trivial

5 years agoglsl: correct typo in GLSL compilation error message
Andres Gomez [Mon, 7 Jan 2019 13:50:35 +0000 (15:50 +0200)]
glsl: correct typo in GLSL compilation error message

v2: Add the "fix" tag (Erik).

Fixes: 037f68d81e1 ("glsl: apply align layout qualifier rules to block offsets")
Cc: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
5 years agovulkan: Update the XML and headers to 1.1.97
Jason Ekstrand [Mon, 7 Jan 2019 15:35:50 +0000 (09:35 -0600)]
vulkan: Update the XML and headers to 1.1.97

Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agodocs: update 18.3 and add 19.x cycles for the release calendar
Andres Gomez [Mon, 17 Dec 2018 23:09:48 +0000 (01:09 +0200)]
docs: update 18.3 and add 19.x cycles for the release calendar

v2: replace incorrect "<td/>" with "<td>" (Eric).

Cc: Dylan Baker <dylan.c.baker@intel.com>
Cc: Juan A. Suarez <jasuarez@igalia.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Juan A. Suarez <jasuarez@igalia.com>
5 years agoanv/android: Do not reject storage images.
Bas Nieuwenhuizen [Wed, 5 Dec 2018 10:28:12 +0000 (11:28 +0100)]
anv/android: Do not reject storage images.

We do the ImageFormatProperties check already, and rejecting an usage
flag when both ImageFormatProperties and the WSI (which is Android)
support it is not allowed.

Intel does support storage for some of the support WSI formats, such
as R8G8B8A8_UNORM, and looking at the ISL_SURF_USAGE_DISABLE_AUX_BIT,
the imported images do not have any form of compression that would
prevent this fix.

v2: Also consider STORAGE bit for Gralloc usage bits.
     (From Kevin Strasser <kevin.strasser@intel.com>)

Fixes: 053d4c328fa "anv: Implement VK_ANDROID_native_buffer (v9)"
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
5 years agoradv: Implement buffer stores with less than 4 components.
Bas Nieuwenhuizen [Mon, 24 Dec 2018 14:41:56 +0000 (15:41 +0100)]
radv: Implement buffer stores with less than 4 components.

We started using it in the btoi paths for r32g32b32, and the LLVM IR
checker will complain about it because we end up with intrinsics with
the wrong type extension in the name.

Fixes: 593996bc02 ("radv: implement buffer to image operations for R32G32B32")
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
5 years agoappveyor: Add a Cygwin build script
Jon Turney [Fri, 10 Nov 2017 13:42:55 +0000 (13:42 +0000)]
appveyor: Add a Cygwin build script

5 years agoappveyor: put build steps in a script, rather than inline in appveyor.yml
Jon Turney [Fri, 10 Nov 2017 13:27:06 +0000 (13:27 +0000)]
appveyor: put build steps in a script, rather than inline in appveyor.yml

5 years agoetnaviv: annotate variables only used in debug build
Lucas Stach [Wed, 14 Nov 2018 14:29:04 +0000 (15:29 +0100)]
etnaviv: annotate variables only used in debug build

Some of the status variables in the compiler are only used in asserts
and thus may be unused in release builds. Annotate them accordingly
to avoid 'unused but set' warnings from the compiler.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
5 years agoetnaviv: enable full overwrite in a few more cases
Lucas Stach [Wed, 14 Nov 2018 13:56:59 +0000 (14:56 +0100)]
etnaviv: enable full overwrite in a few more cases

Take into account the render target format when checking if the color
mask affects all channels of the RT. This allows to enable full
overwrite in a few cases where a non-alpha format is used.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
5 years agonir: avoid uninitialized variable warning
Timothy Arceri [Sun, 6 Jan 2019 23:33:43 +0000 (10:33 +1100)]
nir: avoid uninitialized variable warning

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109231

5 years agost/glsl: refactor st_link_nir()
Timothy Arceri [Wed, 2 Jan 2019 23:03:05 +0000 (10:03 +1100)]
st/glsl: refactor st_link_nir()

The functional change here is moving the nir_lower_io_to_scalar_early()
calls inside st_nir_link_shaders() and moving the st_nir_opts() call
after the call to nir_lower_io_arrays_to_elements().

This fixes a bug with the following piglit test due to the current code
not cleaning up dead code after we lower arrays. This was causing an
assert in the new duplicate varyings link time opt introduced in
70be9afccb23.

tests/spec/glsl-1.10/execution/vsfs-unused-array-member.shader_test

Moving the nir_lower_io_to_scalar_early() calls also allows us to tidy
up the code a little and merge some loops.

Reviewed-by: Eric Anholt <eric@anholt.net>
5 years agov3d: Use the core tex lowering.
Eric Anholt [Thu, 20 Dec 2018 17:43:43 +0000 (09:43 -0800)]
v3d: Use the core tex lowering.

Even without any clever optimization on the unpack operations, this gives
us a useful value for the channels read field, which we can use to avoid
ldtmu instructions to the no-op register.

instructions in affected programs: 890712 -> 881974 (-0.98%)

5 years agonir: Add nir_lower_tex options to lower sampler return formats.
Eric Anholt [Wed, 19 Dec 2018 21:53:39 +0000 (13:53 -0800)]
nir: Add nir_lower_tex options to lower sampler return formats.

I've been doing this in the nir-to-vir and nir-to-qir backends of v3d and
vc4, but nir could potentially do some useful stuff for us (like avoiding
unpack/repacks) if we give it the information.

v2: Skip lowering for txs/query_levels
v3: Fix a crash on old-style shadow
v4: Rename to tex_packing, use nir_format_unpack_sint/uint helpers, pack
    the enum.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agonir: Allow nir_format_unpack_int/sint to unpack larger values.
Eric Anholt [Wed, 2 Jan 2019 22:50:20 +0000 (14:50 -0800)]
nir: Allow nir_format_unpack_int/sint to unpack larger values.

For V3D, I want to unpack 4-16-bit packed integers for 8 and 16-bit
integer samplers.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agointel/blorp: Be more conservative about copying clear colors
Jason Ekstrand [Fri, 4 Jan 2019 17:32:40 +0000 (11:32 -0600)]
intel/blorp: Be more conservative about copying clear colors

In 92eb5bbc68d7324 we attempted to avoid copying clear colors whenever
we weren't doing a resolve.  However, this broke MSAA resolves because
we need the clear color in the source.  This patch makes blorp much more
conservative such that it only avoids the clear color copy if either
aux_usage == NONE or it's explicitly doing a fast-clear.

Fixes: 92eb5bbc68d7 "intel/blorp: Only copy clear color when doing..."
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107728
Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
5 years agov3d: Stop scalarizing our uniform loads.
Eric Anholt [Thu, 3 Jan 2019 19:38:57 +0000 (11:38 -0800)]
v3d: Stop scalarizing our uniform loads.

We can pull a whole vector in a single indirect load.  This saves a bunch
of round-trips to the TMU, instructions for setting up multiple loads,
references to the UBO base in the uniforms, and apparently manages to
reduce register pressure as well.

instructions in affected programs: 3086665 -> 2454967 (-20.47%)
uniforms in affected programs: 919581 -> 721039 (-21.59%)
threads in affected programs: 1710 -> 3420 (100.00%)
spills in affected programs: 596 -> 522 (-12.42%)
fills in affected programs: 680 -> 562 (-17.35%)

Improves 3dmmes performance by 2.29312% +/- 0.139825% (n=5)

5 years agov3d: Do UBO loads a vector at a time.
Eric Anholt [Thu, 3 Jan 2019 20:13:18 +0000 (12:13 -0800)]
v3d: Do UBO loads a vector at a time.

In the process of adding support for SSBOs and CS shared vars, I ended up
needing a helper function for doing TMU general ops.  This helper can be
that starting point, and saves us a bunch of round-trips to the TMU by
loading a vector at a time.

5 years agov3d: Remove dead switch cases and comments from v3d_nir_lower_io.
Eric Anholt [Thu, 3 Jan 2019 19:31:37 +0000 (11:31 -0800)]
v3d: Remove dead switch cases and comments from v3d_nir_lower_io.

Moving things to NIR left this mess around.  All we lower now is uniforms.

5 years agov3d: Fix up VS output setup during precompiles.
Eric Anholt [Thu, 3 Jan 2019 06:48:29 +0000 (22:48 -0800)]
v3d: Fix up VS output setup during precompiles.

I noticed that a VS I was debugging was missing all of its output stores
-- outputs_written was for POS, VAR0, VAR3, while the shader's variables
were POS, VAR9, and VAR12.  I'm not sure what outputs_written is supposed
to be doing here, but we can just walk the declared variables and avoid
both this bug and the emission of extra stvpms for less-than-vec4
varyings.

5 years agov3d: Reinstate the new shader-db output after v3d_compile() refactor.
Eric Anholt [Thu, 3 Jan 2019 01:34:11 +0000 (17:34 -0800)]
v3d: Reinstate the new shader-db output after v3d_compile() refactor.

I misplaced it in the rebase conflicts.

5 years agonir: remove dead code from copy_prop_vars
Caio Marcelo de Oliveira Filho [Wed, 19 Dec 2018 23:23:28 +0000 (15:23 -0800)]
nir: remove dead code from copy_prop_vars

When copy_prop_vars also took care of dead write handling, intrin was
used as part of store_to_entry.  Now it isn't, so this assignment
isn't used really used.  Add a comment clarifying what happens to
intrin.

Fixes: 4dfa7adc100 "nir: Remove handling of dead writes from copy_prop_vars"
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
5 years agoi965: add CS stall on VF invalidation workaround
Lionel Landwerlin [Thu, 3 Jan 2019 16:18:48 +0000 (16:18 +0000)]
i965: add CS stall on VF invalidation workaround

Even with the previous commit, hangs are still happening. The problem
there is that the VF cache invalidate do happen immediately without
waiting for previous rendering to complete. What happens is that we
invalidate the cache the moment the PIPE_CONTROL is parsed but we
still have old rendering in the pipe which continues to pull data into
the cache with the old high address bits. The later rendering with the
new high address bits then doesn't have the clean cache that it
expects/needs.

v2: Update commit message/explanation with Jason's

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Fixes: a363bb2cd0e2a1 ("i965: Allocate VMA in userspace for full-PPGTT systems.")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109072

5 years agoi965: include draw_params/derived_draw_params for VF cache workaround
Lionel Landwerlin [Thu, 3 Jan 2019 16:17:04 +0000 (16:17 +0000)]
i965: include draw_params/derived_draw_params for VF cache workaround

These buffers are using VB slots and should be included in the
workaround decision.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Fixes: a363bb2cd0e2a1 ("i965: Allocate VMA in userspace for full-PPGTT systems.")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109072

5 years agointel/blorp: emit VF caching workaround before 3DSTATE_VERTEX_BUFFERS
Lionel Landwerlin [Thu, 3 Jan 2019 16:14:50 +0000 (16:14 +0000)]
intel/blorp: emit VF caching workaround before 3DSTATE_VERTEX_BUFFERS

Probably no difference but it's nice to have i965 & blorp emit things
in the same order.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoi965: limit VF caching workaround to gen8/9/10
Lionel Landwerlin [Thu, 3 Jan 2019 16:13:14 +0000 (16:13 +0000)]
i965: limit VF caching workaround to gen8/9/10

Documentation of the 3DSTATE_VERTEX_BUFFERS packet says this is only
needed before ICL.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agoglsl/linker: complete documentation for assign_attribute_or_color_locations
Andres Gomez [Wed, 2 Jan 2019 13:21:17 +0000 (15:21 +0200)]
glsl/linker: complete documentation for assign_attribute_or_color_locations

Commit 27f1298b9d9 ("glsl/linker: validate attribute aliasing before optimizations")
forgot to complete the documentation.

Cc: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>