mesa.git
6 years agoglsl/nir: Use deref instructions instead of dref chains
Jason Ekstrand [Thu, 15 Mar 2018 16:58:22 +0000 (09:58 -0700)]
glsl/nir: Use deref instructions instead of dref chains

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoglsl/nir: Only claim to handle intrinsic functions
Jason Ekstrand [Mon, 19 Mar 2018 22:10:29 +0000 (15:10 -0700)]
glsl/nir: Only claim to handle intrinsic functions

Non-intrinsic function handling has never actually been tested and
probably doesn't work.  Just get rid of it for now.  We can always add
it back in later if it's useful.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: add deref lowering sanity checking
Rob Clark [Wed, 16 May 2018 14:02:55 +0000 (10:02 -0400)]
nir: add deref lowering sanity checking

This will be removed at the end of the transition, but add some tracking
plus asserts to help ensure that lowering passes are called at the
correct point (pre or post deref instruction lowering) as passes are
converted and the point where lower_deref_instrs() is called is moved.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoanv,i965,radv,st,ir3: Call nir_lower_deref_instrs
Jason Ekstrand [Mon, 19 Mar 2018 17:50:40 +0000 (10:50 -0700)]
anv,i965,radv,st,ir3: Call nir_lower_deref_instrs

This inserts a call to nir_lower_deref_instrs at every call site of
glsl_to_nir, spirv_to_nir, and prog_to_nir.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/deref: Add some deref cleanup functions
Jason Ekstrand [Wed, 21 Mar 2018 00:32:07 +0000 (17:32 -0700)]
nir/deref: Add some deref cleanup functions

Sometimes it's useful for a pass to be able to clean up its own derefs
instead of waiting for DCE.  This little helper makes it very easy.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add helpers for working with deref instructions
Jason Ekstrand [Fri, 16 Mar 2018 08:15:47 +0000 (01:15 -0700)]
nir: Add helpers for working with deref instructions

This commit adds a pass for lowering deref instructions to deref chains
as well as some smaller helpers to ease the transition.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add deref sources to texture instructions
Jason Ekstrand [Mon, 19 Mar 2018 17:24:59 +0000 (10:24 -0700)]
nir: Add deref sources to texture instructions

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add _deref versions of all of the _var intrinsics
Jason Ekstrand [Thu, 15 Mar 2018 21:56:43 +0000 (14:56 -0700)]
nir: Add _deref versions of all of the _var intrinsics

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/builder: Add deref building helpers
Jason Ekstrand [Thu, 15 Mar 2018 14:57:58 +0000 (07:57 -0700)]
nir/builder: Add deref building helpers

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir: Add a deref instruction type
Jason Ekstrand [Thu, 15 Mar 2018 04:45:38 +0000 (21:45 -0700)]
nir: Add a deref instruction type

This commit adds a new instruction type to NIR for handling derefs.
Nothing uses it yet but this adds the data structure as well as all of
the code to validate, print, clone, and [de]serialize them.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonir/validate: Rework intrinsic type validation
Jason Ekstrand [Tue, 3 Apr 2018 02:23:36 +0000 (19:23 -0700)]
nir/validate: Rework intrinsic type validation

This moves the switch statement for specific intrinsics above source and
destination validation.  We also rework the source and destination
validation to use different bit_size values for each source and/or
destination.

Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agonv50/ir: only avoid spilling constrained def if a mov is added
Karol Herbst [Wed, 2 May 2018 16:36:41 +0000 (18:36 +0200)]
nv50/ir: only avoid spilling constrained def if a mov is added

fix spilling regression introduced by 5428066f5e

this is just a minor mistake done while moving the code out into a new
function. The function contained a loop which might have been terminated
earlier and skipped setting noSpill to 1. After the refactoring it was always
set.

Fixes: 5428066f5e1ef5ea6ae04c84019f270023cfc6aa
("nv50/ir: make a copy of tex src if it's referenced multiple times")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
6 years agomeson: Fix typo that breaks -Dgalium-xvmc=false
Dylan Baker [Fri, 22 Jun 2018 17:08:47 +0000 (10:08 -0700)]
meson: Fix typo that breaks -Dgalium-xvmc=false

_xmvc -> _xvmc. Sigh

Fixes: a6943bb4ce99ea7af7222552f1326fb80823d0b2
       ("meson: Fix auto option for xvmc")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Tested-by: Clayton Craft <clayton.a.craft@intel.com>
6 years agomeson: Fix auto option for va
Dylan Baker [Thu, 21 Jun 2018 15:35:03 +0000 (08:35 -0700)]
meson: Fix auto option for va

The same as the previous two patches, but for the libva state tracker.

Fixes: 724916c8a84b5bba8f880f17da936585d52c97b6
       ("meson: dedup gallium-xvmc logic")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: Fix auto option for xvmc
Dylan Baker [Thu, 21 Jun 2018 15:34:05 +0000 (08:34 -0700)]
meson: Fix auto option for xvmc

This fixes the same problem as the previous patch did for vdpau, but for
xvmc.

Fixes: 724916c8a84b5bba8f880f17da936585d52c97b6
       ("meson: dedup gallium-xvmc logic")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: Correct behavior of vdpau=auto
Dylan Baker [Thu, 21 Jun 2018 15:28:36 +0000 (08:28 -0700)]
meson: Correct behavior of vdpau=auto

Currently if vdpau is set to auto, it will be disabled only in cases
where gallium is disabled or the host OS is not supported (mac, haiku,
windows). However on (for example) Linux if libvdpau is not installed
then the build will error because of the unmet dependency. This corrects
auto to do the right thing, and not error if libvdpau is not installed.

Fixes: 992af0a4b8224bdb4809e01c2f00d2f32546aee5
       ("meson: dedup gallium-vdpau logic")
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoradv: always check the return error when submitting a CS
Samuel Pitoiset [Thu, 21 Jun 2018 12:39:30 +0000 (14:39 +0200)]
radv: always check the return error when submitting a CS

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: check the return values of radv_signal_fence()
Samuel Pitoiset [Thu, 21 Jun 2018 12:39:29 +0000 (14:39 +0200)]
radv: check the return values of radv_signal_fence()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: change the returned error in radv_signal_fence()
Samuel Pitoiset [Thu, 21 Jun 2018 12:39:28 +0000 (14:39 +0200)]
radv: change the returned error in radv_signal_fence()

From my point of view, when we aren't able to submit a CS
something terribly wrong happens and we are most likely
going to lost the device.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agofreedreno: a2xx: fix clear color
Jonathan Marek [Thu, 21 Jun 2018 21:06:30 +0000 (17:06 -0400)]
freedreno: a2xx: fix clear color

the format of the CLEAR_COLOR register doesn't depend on the target format
this fixes clear color when rendering to 32-bit RGBA and 16-bit targets

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: a2xx: fix crash when freeing context
Jonathan Marek [Thu, 21 Jun 2018 21:06:29 +0000 (17:06 -0400)]
freedreno: a2xx: fix crash when freeing context

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: a2xx: fix crash on first clear
Jonathan Marek [Thu, 21 Jun 2018 21:06:28 +0000 (17:06 -0400)]
freedreno: a2xx: fix crash on first clear

blend can be NULL, so check for that

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: add a20x
Jonathan Marek [Thu, 21 Jun 2018 21:06:27 +0000 (17:06 -0400)]
freedreno: add a20x

this patch adds support for a20x, which has some differences with a220:
-no VGT_MAX_VTX_INDX register
-no CLEAR_COLOR register
-set RB_BC_CONTROL in restore (hangs without)
-different CP_DRAW_INDX format

tested with kmscube and glmark2 scenes, on par with a220

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: a2xx: increase size of the offset field in instr_fetch_vtx_t
Jonathan Marek [Thu, 21 Jun 2018 21:06:26 +0000 (17:06 -0400)]
freedreno: a2xx: increase size of the offset field in instr_fetch_vtx_t

The offset field is 22 bit large.
11 bits are necessary because MaxVertexAttribRelativeOffset = 2047

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agov3d: Don't forget to initialize the buffer offset of a new winsys handle.
Eric Anholt [Wed, 20 Jun 2018 23:56:26 +0000 (16:56 -0700)]
v3d: Don't forget to initialize the buffer offset of a new winsys handle.

6 years agov3d, vc4: Disable valgrind checking of CLE inputs when NDEBUG is set.
Eric Anholt [Thu, 21 Jun 2018 22:45:30 +0000 (15:45 -0700)]
v3d, vc4: Disable valgrind checking of CLE inputs when NDEBUG is set.

For a meson -Db_ndebug=true release build on x86_64, reduces text size of
libv3d.a from 53.0k to 51.6k.  Inspired by 0d5329d626e3 ("anv: Disable
__gen_validate_value if NDEBUG is set.")

6 years agomesa: fix glGetInteger64v for arrays of integers
Marek Olšák [Wed, 20 Jun 2018 18:55:24 +0000 (14:55 -0400)]
mesa: fix glGetInteger64v for arrays of integers

Cc: 18.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoac/surface: disallow rotated micro tile mode
Marek Olšák [Thu, 21 Jun 2018 00:00:59 +0000 (20:00 -0400)]
ac/surface: disallow rotated micro tile mode

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradeonsi: fix occlusion queries with 16x AA without FBO attachments on Stoney
Marek Olšák [Wed, 20 Jun 2018 23:43:36 +0000 (18:43 -0500)]
radeonsi: fix occlusion queries with 16x AA without FBO attachments on Stoney

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradeonsi: handle non-clearable DCC buffers as MSAA resolve dst
Marek Olšák [Wed, 20 Jun 2018 23:15:36 +0000 (18:15 -0500)]
radeonsi: handle non-clearable DCC buffers as MSAA resolve dst

This is reproducible on Stoney, but other chips may be affected too.

Cc 18.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradeonsi: disable DCC MSAA for 128bpp formats on Stoney
Marek Olšák [Wed, 20 Jun 2018 23:11:05 +0000 (18:11 -0500)]
radeonsi: disable DCC MSAA for 128bpp formats on Stoney

Cc: 18.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agodocs: update freedreno features
Rob Clark [Thu, 21 Jun 2018 12:37:07 +0000 (08:37 -0400)]
docs: update freedreno features

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agomesa: fix GLES 3.1 version calculation
Rob Clark [Tue, 19 Jun 2018 12:10:43 +0000 (08:10 -0400)]
mesa: fix GLES 3.1 version calculation

All of ARB_gpu_shader5 is most certainly not required for GLES 3.1
(most of it is in OES_gpu_shader5 on top of GLES 3.1).

Some of what is required from ARB_gpu_shader5 is provided by
ARB_texture_gather, so check for that.  The remaining subset of
ARB_gpu_shader5 doesn't have individual extensions to check for,
but I guess it is unlikely that some driver has all of these
extensions but not, say, integer bitfield manipulation.

Signed-off-by: Rob Clark <robdclark@gmail.com>
Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agofreedreno/a5xx: MSAA
Rob Clark [Fri, 15 Jun 2018 20:32:42 +0000 (16:32 -0400)]
freedreno/a5xx: MSAA

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: update generated headers
Rob Clark [Fri, 15 Jun 2018 20:24:36 +0000 (16:24 -0400)]
freedreno: update generated headers

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/ir3: txf_ms support
Rob Clark [Sun, 17 Jun 2018 16:07:07 +0000 (12:07 -0400)]
freedreno/ir3: txf_ms support

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a5xx: fix gpu hangs with large compute shaders
Rob Clark [Wed, 20 Jun 2018 16:50:40 +0000 (12:50 -0400)]
freedreno/a5xx: fix gpu hangs with large compute shaders

Similar to the combined limit for VS+FS, there is an upper limit for
shader size to run from internel memory.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/ir3: fix base_vertex
Rob Clark [Sat, 16 Jun 2018 16:26:50 +0000 (12:26 -0400)]
freedreno/ir3: fix base_vertex

Fixes: c366f422f0a nir: Offset vertex_id by first_vertex instead of base_vertex
Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agoi965: Link uniforms of SPIR-V programs using the NIR linker
Eduardo Lima Mitev [Tue, 14 Nov 2017 16:44:39 +0000 (17:44 +0100)]
i965: Link uniforms of SPIR-V programs using the NIR linker

v2: nir_link_uniforms renamed to gl_nir_link_uniforms

Signed-off-by: Eduardo Lima <elima@igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoi965: Setup glsl uniforms by index rather than name matching
Neil Roberts [Mon, 19 Feb 2018 13:04:54 +0000 (14:04 +0100)]
i965: Setup glsl uniforms by index rather than name matching

Previously when setting up a uniform it would try to walk the uniform
storage slots and find one that matches the name of the given
variable. However, each variable already has a location which is an
index into the UniformStorage array so we can just directly jump to
the right slot. Some of the variables take up more than one slot so we
still need to calculate how many it uses.

The main reason to do this is to support ARB_gl_spirv because in that
case the uniforms don’t have names so the previous approach won’t
work.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoi965: account for NIR uniforms without name
Eduardo Lima Mitev [Fri, 20 Oct 2017 13:20:36 +0000 (15:20 +0200)]
i965: account for NIR uniforms without name

Right now, the BRW linker code assumes nir_variable::name is always
non-NULL, but thanks to ARB_gl_spirv we will soon be linking SPIR-V
programs, and those explicitly require matching uniforms by location.
The name is just a debug hint.

Instead of checking for the name this patch makes it check for
var->num_state_slots on the assumption that everything that had an
internal name also had some state slots. This seems likely because the
two code paths that are taken when the name begins with "gl_" already
have an assert that var->state_slots is not NULL.

v2: simplified, most of it moved to glsl/nir/spirv (Neil Roberts)
v3: check for num_state_slots instead of the name. This is needed
    because we do actually have nameless builtins with SPIR-V such as
    PatchVerticesIn and we want them to hit the
    _mesa_add_state_reference code path (Neil Roberts)

Signed-off-by: Eduardo Lima <elima@igalia.com>
Signed-off-by: Neil Roberts <nroberts@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoi965: Update TexturesUsed after linking the shaders
Neil Roberts [Wed, 7 Feb 2018 22:17:08 +0000 (23:17 +0100)]
i965: Update TexturesUsed after linking the shaders

Otherwise if the shader is SPIR-V then SamplerUsed won’t have been
initialised yet so it will end up thinking no textures are used. This
was causing a crash later on if nothing causes it to regenerate
TexturesUsed before the next render.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoi965: Build SPIR-V programs' resource list using NIR
Eduardo Lima Mitev [Tue, 10 Oct 2017 12:11:03 +0000 (14:11 +0200)]
i965: Build SPIR-V programs' resource list using NIR

v2: tweak after nir_linker.h being renamed to gl_nir_linker.h

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/linker: Add nir_build_program_resource_list()
Eduardo Lima Mitev [Tue, 14 Nov 2017 23:29:28 +0000 (00:29 +0100)]
nir/linker: Add nir_build_program_resource_list()

This function is equivalent to the linker.cpp
build_program_resource_list() but will extract the resources from NIR
shaders instead.

For now, only uniforms and program inputs are implemented.

v2: move from compiler/nir to compiler/glsl (Timothy Arceri)

v3: remove support for inputs, that is still WIP (spotted by Timothy
    Arceri)

Signed-off-by: Eduardo Lima <elima@igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agocompiler/link: move add_program_resource to linker_util
Alejandro Piñeiro [Sat, 12 May 2018 07:59:32 +0000 (09:59 +0200)]
compiler/link: move add_program_resource to linker_util

So it could be used by the GLSL and NIR linker.

v2: (Timothy Arceri)
   * Moved from compiler to compiler/glsl
   * Method renamed to link_util_add_program_resource

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/linker: Set the uniform initial values
Neil Roberts [Fri, 23 Feb 2018 16:09:22 +0000 (17:09 +0100)]
nir/linker: Set the uniform initial values

This is based on link_uniform_initializers.cpp.

v2: move from compiler/nir to compiler/glsl (Timothy Arceri)

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/linker: Add gl_nir_link_uniforms()
Eduardo Lima Mitev [Tue, 14 Nov 2017 11:25:47 +0000 (12:25 +0100)]
nir/linker: Add gl_nir_link_uniforms()

This function will be the entry point for linking the uniforms from
the nir_shader objects associated with the gl_linked_shaders of a
program.

This patch includes initial support for linking uniforms from NIR
shaders. It is tailored for the ARB_gl_spirv needs, and it is far from
complete, but it should handle most cases of uniforms, array
uniforms, structs, samplers and images.

There are some FIXMEs related to specific features that will be
implemented in following patches, like atomic counters, UBOs and
SSBOs.

Also, note that ARB_gl_spirv makes mandatory explicit location for
normal uniforms, so this code only handles uniforms with explicit
location. But there are cases, like uniform atomic counters, that
doesn't have a location from the OpenGL point of view (they have a
binding), but that Mesa assign internally a location. That will be
handled on following patches.

A nir_linker.h file is also added. More NIR-linking related API will
be added in subsequent patches and those will include stuff from Mesa,
so reusing nir.h didn't seem a good idea.

v2: move from compiler/nir to compiler/glsl (Timothy Arceri)
v3: sets var->driver.location if the uniform was found from a previous
    stage (Neil Roberts).

Signed-off-by: Eduardo Lima <elima@igalia.com>
Signed-off-by: Neil Roberts <nroberts@igalia.com
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agocompiler/link: add linker_util.h, move linker_error/warning to it
Alejandro Piñeiro [Wed, 28 Mar 2018 12:59:26 +0000 (14:59 +0200)]
compiler/link: add linker_util.h, move linker_error/warning to it

Linker utilities common to the GLSL IR and NIR linker (the latter to
be used for ARB_gl_spirv).

We need to move it to a new header as the NIR linker doesn't need to
know about ir_variable, and others, included at linker.h.

v2: move from src/compiler to src/compiler/glsl (Timothy Arceri)

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agospirv: Set nir_variable->explicit_binding
Neil Roberts [Fri, 23 Feb 2018 16:07:52 +0000 (17:07 +0100)]
spirv: Set nir_variable->explicit_binding

When SpvDecorationBinding is encountered in the SPIR-V source it now
sets explicit_binding on the nir_variable. This will be used to
determine whether to initialise sampler and image uniforms with the
binding value.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agospirv: Get rid of vtn_variable_mode_image/sampler
Neil Roberts [Thu, 1 Mar 2018 16:51:58 +0000 (17:51 +0100)]
spirv: Get rid of vtn_variable_mode_image/sampler

vtn_variable_mode_image and _sampler are instead replaced with
vtn_variable_mode_uniform which encompasses both of them. In the few
places where it was neccessary to distinguish between the two, the
GLSL type of the pointer is used instead.

The main reason to do this is that on OpenGL it is permitted to put
images and samplers into structs and declare a uniform with them. That
means that variables can now have a mix of uniform, sampler and image
modes so picking a single one of those modes for a variable no longer
makes sense.

This fixes OpLoad on a sampler within a struct which was previously
using the variable mode to determine whether it was a sampler or not.
The type of the variable is a struct so it was not being considered to
be uniform mode even though the member being loaded should be sampler
mode.

The previous code appeared to be using var->interface_type as a place
to store the type of the variable without the enclosing array for
images and samplers. I guess this worked because opaque types can not
appear in interfaces so the interface_type is sort of unused. This
patch removes the overloading of var->interface_type and any places
that needed the type without the array can now just deduce it from
var->type.

v2: squash in this patch the changes to anv/nir (Timothy)

Signed-off-by: Eduardo Lima <elima@igalia.com>
Signed-off-by: Neil Roberts <nroberts@igalia.com
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agospirv: translate default-block uniforms
Nicolai Hähnle [Thu, 22 Jun 2017 11:00:08 +0000 (13:00 +0200)]
spirv: translate default-block uniforms

They are supported by SPIR-V for ARB_gl_spirv.

v2 (changes on top of Nicolai's original patch):
   * Handle UniformConstant storage class for uniforms other than
     samplers and images. (Eduardo Lima)
   * Handle location decoration also for samplers and images. (Eduardo
     Lima)
   * Rebase update (spirv_to_nir options added, logging changes, and
     others) (Alejandro Piñeiro)

Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Eduardo Lima <elima@igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/types: Add a utility wrapper to glsl_type::sampler_index()
Eduardo Lima Mitev [Thu, 26 Oct 2017 09:05:30 +0000 (11:05 +0200)]
nir/types: Add a utility wrapper to glsl_type::sampler_index()

I think it is more accurate to call it a sampler target (?).

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/types: Add a glsl_get_component_slots() utility
Eduardo Lima Mitev [Thu, 19 Oct 2017 11:28:35 +0000 (13:28 +0200)]
nir/types: Add a glsl_get_component_slots() utility

It is basically a wrapper around glsl_type::component_slots().

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir/lower_samplers: Limit assert to GLSL shader programs
Eduardo Lima Mitev [Wed, 15 Nov 2017 23:14:52 +0000 (00:14 +0100)]
nir/lower_samplers: Limit assert to GLSL shader programs

Vulkan has the concept of separate image and sampler objects in the
SPIR-V code whereas GL conflates them into one. nir_lower_samplers
contains an assert to verify that sampler operand is not being set on
the nir instruction. However when the code comes from spirv_to_nir the
sampler operand is always set. GL_arb_gl_spirv explicitly states that
OpTypeSampler is not supported so it retains the GL behaviour of not
being able to seperate them. Therefore the sampler will always be the
same as the texture. This GL version of the lowering code ignores
instr->sampler and sets instr->sampler_index to the same value as
instr->texture_index. Some other places in the code (such as in
nir_print) assume that once the instruction is lowered then both
instr->texture and instr->sampler will be NULL, so to keep this
behaviour we now set instr->sampler to NULL after ignoring it to fill
in instr->sampler_index.

Signed-off-by: Eduardo Lima <elima@igalia.com>
Signed-off-by: Neil Roberts <nroberts@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agonir: Add explicit_binding to nir_variable
Neil Roberts [Fri, 23 Feb 2018 15:06:30 +0000 (16:06 +0100)]
nir: Add explicit_binding to nir_variable

This is copied from the corresponding value in ir_variable. The
intention is to eventually use it in a pure-NIR linker.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa/main: add NULL name check when searching for a resource name
Alejandro Piñeiro [Thu, 21 Dec 2017 15:20:18 +0000 (16:20 +0100)]
mesa/main: add NULL name check when searching for a resource name

Since ARB_gl_spirv name reflection can be missing. piglit
shader_runner does several resource checking, so this commit is useful
to get even the more simple piglit tests running without crashing on
SPIR-V mode.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoi965: use gl_shader_program_data::spirv
Alejandro Piñeiro [Fri, 13 Apr 2018 14:44:23 +0000 (16:44 +0200)]
i965: use gl_shader_program_data::spirv

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agomesa/main: Add a 'spirv' flag to gl_shader_program_data
Eduardo Lima Mitev [Tue, 10 Oct 2017 08:27:01 +0000 (10:27 +0200)]
mesa/main: Add a 'spirv' flag to gl_shader_program_data

This will be used by the linker code to differentiate between programs
made out of SPIR-V or GLSL shaders.

This was rejected in the past, assuming that it was equivalent to
check for "shProg->_LinkedShaders[stage]->spirv_data != NULL". But:

  * At some points of the linking process it would be needed to check
    if _LinkerShaders[stage] is present, so the full check would be:

    "shProg->_LinkedShaders[stage] != NULL &&
     shProg->_LinkedShaders[stage]->spirv_data != NULL"

  * Sometimes you would like to do some specific to SPIR-V
    independently of the stage, or for any stage. For example, "link
    all the uniforms, for all stages". In that case checking for the
    flag would be equivalent to iterate all the _LinkedShaders and
    check if there is any spirv_data available.

The former makes readibility really worse. Both could be solved by
adding two helpers. But adding a flag seems really more simple and
readable.

v2: added justification for the flag on the commit message (Alejandro)

Signed-off-by: Eduardo Lima <elima@igalia.com>
Signed-off-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agodocs/release-calendar: restore the missing 18.1 column
Emil Velikov [Wed, 20 Jun 2018 12:33:48 +0000 (13:33 +0100)]
docs/release-calendar: restore the missing 18.1 column

Earlier commit removed the column, instead of adjusting the height.

Cc: Dylan Baker <dylan@pnwbakers.com>
Fixes: 0d4f338a116 ("docs: Update release-notes and calendar")
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agoconfigure: use compliant grep regex checks
Emil Velikov [Thu, 14 Jun 2018 13:15:59 +0000 (14:15 +0100)]
configure: use compliant grep regex checks

The current `grep "foo\|bar"' trips on some grep implementations, like
the FreeBSD one. Instead use `egrep "foo|bar"' as suggested by Stefan.

Cc: Stefan Esser <se@FreeBSD.org>
Reported-by: Stefan Esser <se@FreeBSD.org>
Bugzilla: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=228673
Fixes: 1914c814a6c ("configure: error out if building OMX w/o supported platform")
Fixes: 63e11ac2b5c ("configure: error out if building VA w/o supported platform")
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agoglsl/tests/glcpp: reinstate "error out if no tests found"
Emil Velikov [Tue, 24 Apr 2018 17:49:22 +0000 (18:49 +0100)]
glsl/tests/glcpp: reinstate "error out if no tests found"

With the recent rework of converting the shell script to a python one
the check for actual tests was dropped.

Bring that back, since it was explicitly added considering we had a ~2
year period, during which the tests were not run.

v2: use raise Exception() over  print() & return false (Dylan)

Fixes: db8cd8e36771 ("glcpp/tests: Convert shell scripts to a python
script")
Cc: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoglsl/glcpp/tests: reinstate srcdir/abs_builddir blurb
Emil Velikov [Tue, 24 Apr 2018 17:49:21 +0000 (18:49 +0100)]
glsl/glcpp/tests: reinstate srcdir/abs_builddir blurb

Bring back the "detection" of the said variables, to allow
standalone execution.

Fixes: db8cd8e36771 ("glcpp/tests: Convert shell scripts to a python
script")
Cc: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agoglsl: fold glcpp-test-cr-lf.sh into glcpp-test.sh
Emil Velikov [Tue, 24 Apr 2018 17:49:20 +0000 (18:49 +0100)]
glsl: fold glcpp-test-cr-lf.sh into glcpp-test.sh

As of recently both of these have been reworked so they invoke a python
script. At the same time the latter can be executed with the combined
arguments of both scripts.

AKA we no longer need to have them separate.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agost/dri: constify dri_fill_st_visual's screen
Emil Velikov [Tue, 24 Apr 2018 17:48:02 +0000 (18:48 +0100)]
st/dri: constify dri_fill_st_visual's screen

As the function says - only the visual is changed.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agomesa: remove struct gl_extensions::ATI_separate_stencil
Emil Velikov [Tue, 10 Apr 2018 16:11:29 +0000 (17:11 +0100)]
mesa: remove struct gl_extensions::ATI_separate_stencil

Virtually every driver that supports ATI_separate_stencil
also supports EXT_stencil_two_side.

Use the latter boolean for both extension. With that in mind we can drop
the explicit true from the drivers and the nasty comment in
compute_version().

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agotravis: add libXrandr and its randrproto dependency
Eric Engestrom [Thu, 21 Jun 2018 10:02:29 +0000 (11:02 +0100)]
travis: add libXrandr and its randrproto dependency

Fixes: 3f960c1338713d317ce6 "vulkan: EXT_acquire_xlib_display requires libXrandr headers to build"
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoswr: bump minimum supported LLVM version to 5.0
Juan A. Suarez Romero [Mon, 18 Jun 2018 13:45:51 +0000 (15:45 +0200)]
swr: bump minimum supported LLVM version to 5.0

RADV now requires LLVM 5.0 or greater, and thus we can't build dist
tarball because swr requires LLVM 4.0.

Let's bump required LLVM to 5.0 in swr too.

Fixes: f9eb1ef870 ("amd: remove support for LLVM 4.0")
Cc: Tim Rowley <timothy.o.rowley@intel.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Cc: Dylan Baker <dylan@pnwbakers.com>
Cc: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoradeonsi: add a debug flag to zero vram allocations
Grazvydas Ignotas [Wed, 20 Jun 2018 19:17:39 +0000 (22:17 +0300)]
radeonsi: add a debug flag to zero vram allocations

This allows to avoid having to see garbage in Dying Light loading screen
at least, which probably expects Windows/NV behavior of all allocations
being zeroed by default.

Analogous to radv flag with the same name.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoradeonsi: use shifts for sign extension
Grazvydas Ignotas [Sat, 16 Jun 2018 18:56:13 +0000 (21:56 +0300)]
radeonsi: use shifts for sign extension

Avoids a branch and reduces code size a tiny bit:
    text   data     bss      dec    hex filename
10804563 398653 2070368 13273584 ca89f0 /tmp/radeonsi_dri.so.old
10804499 398653 2070368 13273520 ca89b0 /tmp/radeonsi_dri.so

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoradv: set EVENT_WRITE_EOP.INT_SEL = wait for write confirmation
Samuel Pitoiset [Wed, 20 Jun 2018 14:10:56 +0000 (16:10 +0200)]
radv: set EVENT_WRITE_EOP.INT_SEL = wait for write confirmation

Ported from RadeonSI.
Not sure why this is needed but AMDVLK does something similar.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: use EOP_DATA_SEL_* instead of magic numbers
Samuel Pitoiset [Wed, 20 Jun 2018 14:10:55 +0000 (16:10 +0200)]
radv: use EOP_DATA_SEL_* instead of magic numbers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agor600: fix copy/paste bug for sampleMaskIn workaround
Roland Scheidegger [Fri, 15 Jun 2018 21:36:52 +0000 (23:36 +0200)]
r600: fix copy/paste bug for sampleMaskIn workaround

The sampleMaskIn workaround (b936f4d1ca0d2ab1e828ff6a6e617f12469687fa)
tries to figure out if the shader is running at per-sample frequency, but
there's a typo bug so it will only recognize per-sample linar inputs,
not per-sample perspective ones.

Spotted by Eric Engestrom <eric.engestrom@intel.com>

Fixes: b936f4d1ca0d2ab1e828a "r600: partly fix sampleMaskIn value"
6 years agov3d: Fix min vs mag determination when not doing mip filtering.
Eric Anholt [Wed, 20 Jun 2018 17:22:44 +0000 (10:22 -0700)]
v3d: Fix min vs mag determination when not doing mip filtering.

Fixes all 128 failing tests in
dEQP-GLES3.functional.texture.filtering.*.combinations

6 years agovulkan: EXT_acquire_xlib_display requires libXrandr headers to build
Keith Packard [Tue, 19 Jun 2018 22:58:30 +0000 (15:58 -0700)]
vulkan: EXT_acquire_xlib_display requires libXrandr headers to build

When VK_USE_PLATFORM_XLIB_XRANDR_EXT is defined, vulkan.h includes
X11/extensions/Xrandr.h for the RROutput typedef which is used in
the vkGetRandROutputDisplayEXT interface.

Make sure we have the required header by checking during the build,
and also set CFLAGS to point at the right directory.

We don't need to link against the library as we don't use any
functions from there, so don't add the _LIBS value in the autotools
build.

Signed-off-by: Keith Packard <keithp@keithp.com>
Fixes: dbac8e25f851ed44c51f "radv: Add EXT_acquire_xlib_display to radv driver [v2]"
Reviewed-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agov3d: Implement ALPHA_TO_COVERAGE.
Eric Anholt [Tue, 19 Jun 2018 23:27:17 +0000 (16:27 -0700)]
v3d: Implement ALPHA_TO_COVERAGE.

There's a convenient "FTOC" instruction for generating the coverage now,
unlike vc4.  This fixes
dEQP-GLES3.functional.multisample.fbo_4_samples.proportionality_alpha_to_coverage

6 years agov3d: Track write reference to the separate stencil buffer.
Eric Anholt [Tue, 19 Jun 2018 23:00:15 +0000 (16:00 -0700)]
v3d: Track write reference to the separate stencil buffer.

Otherwise, a blit from separate stencil may fail to flush the job that
initialized it, or new drawing could fail to flush a blit reading from
stencil.

Fixes:
dEQP-GLES3.functional.fbo.blit.depth_stencil.depth32f_stencil8_basic
dEQP-GLES3.functional.fbo.blit.depth_stencil.depth32f_stencil8_scale
dEQP-GLES3.functional.fbo.blit.depth_stencil.depth32f_stencil8_stencil_only
dEQP-GLES3.functional.fbo.msaa.2_samples.depth32f_stencil8
dEQP-GLES3.functional.fbo.msaa.4_samples.depth32f_stencil8

6 years agov3d: Add missing reference to the separate stencil buffer.
Eric Anholt [Tue, 19 Jun 2018 22:48:15 +0000 (15:48 -0700)]
v3d: Add missing reference to the separate stencil buffer.

Noticed while debugging a missing flush of rendering in the z32f_s8 case.

6 years agov3d: Fix return value from fence_finish.
Eric Anholt [Tue, 19 Jun 2018 18:24:56 +0000 (11:24 -0700)]
v3d: Fix return value from fence_finish.

We needed to convert from a -errno to a boolean success value.  Fixes:

GTF-GLES3.gtf.GL3Tests.sync.sync_functionality_clientwaitsync_flush
GTF-GLES3.gtf.GL3Tests.sync.sync_functionality_clientwaitsync_signaled

6 years agomesa/st: only do scalar lowerings if driver benefits
Christian Gmeiner [Fri, 15 Jun 2018 10:29:59 +0000 (12:29 +0200)]
mesa/st: only do scalar lowerings if driver benefits

As not every (upcoming) backend compiler is happy with
nir_lower_xxx_to_scalar lowerings do them only if the backend
is scalar (and not vec4) based.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agogallium: add scalar isa shader cap
Christian Gmeiner [Fri, 15 Jun 2018 10:29:58 +0000 (12:29 +0200)]
gallium: add scalar isa shader cap

v1 -> v2:
 - nv30 is _NOT_ scalar as suggested by Ilia Mirkin.
 - Change from a screen cap to a shader cap as suggested
   by Eric Anholt.
 - radeonsi is scalar as suggested by Marek Olšák.
 - Change missing ones to be scalar.

v2 -> v3:
 - r600 prefers vec4 as suggested by Marek Olšák.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoradv: Add VK_EXT_display_surface_counter to radv driver
Keith Packard [Wed, 11 Oct 2017 07:20:08 +0000 (00:20 -0700)]
radv: Add VK_EXT_display_surface_counter to radv driver

This extension is required to support EXT_display_control as it offers
a way to query whether the vblank counter is supported.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv: Add VK_EXT_display_surface_counter to anv driver [v2]
Keith Packard [Wed, 11 Oct 2017 07:20:08 +0000 (00:20 -0700)]
anv: Add VK_EXT_display_surface_counter to anv driver [v2]

This extension is required to support EXT_display_control as it offers
a way to query whether the vblank counter is supported.

v2:
Add extension to list in alphabetical order

Suggested-by: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoVulkan/wsi: Implement VK_EXT_display_surface_counter
Jason Ekstrand [Sat, 16 Jun 2018 17:44:11 +0000 (10:44 -0700)]
Vulkan/wsi: Implement VK_EXT_display_surface_counter

This extension is required to support EXT_display_control as it offers a
way to query whether the vblank counter is supported.  Internally, it is
implemented using a fake MESA extension which provides a chain-in to
GetSurfaceCapabilities2KHR which contains the one added field.  This has
the advantage of reducing number of callbacks needed in the back-ends.
It also means that anything chained into GetSurfaceCapabilities2EXT
through VkSurfaceCapabilities2KHR::pNext so we only need to handle
crawling the pNext chain once per back-end.

Reviewed-by: Keith Packard <keithp@keithp.com>
6 years agovulkan/wsi: Get rid of the get_capabilities hook
Jason Ekstrand [Sat, 16 Jun 2018 17:27:40 +0000 (10:27 -0700)]
vulkan/wsi: Get rid of the get_capabilities hook

Instead, we can just use get_capabilities2.  This way back-ends only
have to implement one hook.

Reviewed-by: Keith Packard <keithp@keithp.com>
6 years agointel/aubinator: drop unused functions
Eric Engestrom [Tue, 19 Jun 2018 14:55:26 +0000 (15:55 +0100)]
intel/aubinator: drop unused functions

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agoradv: always initialize the clear depth/stencil values to 0
Samuel Pitoiset [Tue, 19 Jun 2018 14:04:30 +0000 (16:04 +0200)]
radv: always initialize the clear depth/stencil values to 0

Similar to the clear color values.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: always initialize the clear color values to 0
Samuel Pitoiset [Tue, 19 Jun 2018 13:56:19 +0000 (15:56 +0200)]
radv: always initialize the clear color values to 0

Having random data in there is probably not the best.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: always initialize the DCC predicate to FALSE
Samuel Pitoiset [Tue, 19 Jun 2018 13:39:25 +0000 (15:39 +0200)]
radv: always initialize the DCC predicate to FALSE

This might eventually skip some useless DCC decompression
passes.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: do not use an user SGPR for the sample position offset
Samuel Pitoiset [Tue, 19 Jun 2018 12:25:48 +0000 (14:25 +0200)]
radv: do not use an user SGPR for the sample position offset

We know the number of samples at compile time.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: don't store the number of samples as log2
Samuel Pitoiset [Tue, 19 Jun 2018 12:25:47 +0000 (14:25 +0200)]
radv: don't store the number of samples as log2

Needed for the following patch.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agogallium/aux/util/u_cpu_detect.h: Fix -Wsign-compare warning in u_cpu_detect.c
Gert Wollny [Tue, 5 Jun 2018 11:59:06 +0000 (13:59 +0200)]
gallium/aux/util/u_cpu_detect.h: Fix -Wsign-compare warning in u_cpu_detect.c

Change the type of util_cpu_caps::nr_cpus to int because sysconfig
returns a signed value, fixes:

u_cpu_detect.c: In function 'util_cpu_detect':
u_cpu_detect.c:317:30: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
    if (util_cpu_caps.nr_cpus == -1)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agogallium/aux/util/u_debug.h: Fix "noreturn" warnings in debug mode
Gert Wollny [Tue, 5 Jun 2018 11:59:05 +0000 (13:59 +0200)]
gallium/aux/util/u_debug.h: Fix "noreturn" warnings in debug mode

Only decorate function as noreturn when DEBUG is not defined, because
when compiled in DEBUG mode the function actually executes an int3 and
may return, fixes:
u_debug.c: In function '_debug_assert_fail':
u_debug.c:309:1: warning: 'noreturn' function does return

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agogallium/aux/util: Fix some warnings
Gert Wollny [Tue, 5 Jun 2018 11:59:04 +0000 (13:59 +0200)]
gallium/aux/util: Fix some warnings

util/u_cpu_detect.c: In function 'util_cpu_detect':
util/u_cpu_detect.c:377:30: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    if (util_cpu_caps.nr_cpus == ~0u)
                              ^~

util/u_hash_table.c:274:21: warning: unused parameter 'k' [-Wunused-
parameter]
 util_hash_inc(void *k, void *v, void *d)
                     ^
util/u_hash_table.c:274:30: warning: unused parameter 'v' [-Wunused-
parameter]
 util_hash_inc(void *k, void *v, void *d)
                              ^

util/u_tests.c: In function 'test_texture_barrier':
util/u_tests.c:652:25: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
       for (int i = 0; i < num_samples / 2; i++) {
                         ^

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agogallium/aux/tgsi_ureg.c: remove unused parameter from match_or_expand_immediate64
Gert Wollny [Tue, 5 Jun 2018 11:59:03 +0000 (13:59 +0200)]
gallium/aux/tgsi_ureg.c: remove unused parameter from match_or_expand_immediate64

remove "type" from "match_or_expand_immediate64", fixes:

tgsi/tgsi_ureg.c: In function 'match_or_expand_immediate64':
tgsi/tgsi_ureg.c:837:34: warning: unused parameter 'type' [-Wunused-
parameter]
                              int type,
                                  ^~~~

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agogallium/aux/tgsi_two_side.c: Fix -Wsign-compare warnings
Gert Wollny [Tue, 5 Jun 2018 11:59:02 +0000 (13:59 +0200)]
gallium/aux/tgsi_two_side.c: Fix -Wsign-compare warnings

Integer propagation rules can sometimes be irritating. With
"unsigned x" "x + 1" gets propagated to a signed integer, so explicitely
assign the sum to an unsigned and use that for comaprison.

In file included from tgsi/tgsi_two_side.c:41:0:
tgsi/tgsi_two_side.c: In function 'xform_decl':
./util/u_math.h:660:29: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
 #define MAX2( A, B )   ( (A)>(B) ? (A) : (B) )
                             ^
tgsi/tgsi_two_side.c:86:24: note: in expansion of macro 'MAX2'
       ts->num_inputs = MAX2(ts->num_inputs, decl->Range.Last + 1);
                        ^~~~
./util/u_math.h:660:40: warning: signed and unsigned type in conditional
expression [-Wsign-compare]
 #define MAX2( A, B )   ( (A)>(B) ? (A) : (B) )
                                        ^
tgsi/tgsi_two_side.c:86:24: note: in expansion of macro 'MAX2'
       ts->num_inputs = MAX2(ts->num_inputs, decl->Range.Last + 1);
                        ^~~~
./util/u_math.h:660:29: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
 #define MAX2( A, B )   ( (A)>(B) ? (A) : (B) )
                             ^
tgsi/tgsi_two_side.c:89:23: note: in expansion of macro 'MAX2'
       ts->num_temps = MAX2(ts->num_temps, decl->Range.Last + 1);
                       ^~~~
./util/u_math.h:660:40: warning: signed and unsigned type in conditional
expression [-Wsign-compare]
 #define MAX2( A, B )   ( (A)>(B) ? (A) : (B) )
                                        ^
tgsi/tgsi_two_side.c:89:23: note: in expansion of macro 'MAX2'
       ts->num_temps = MAX2(ts->num_temps, decl->Range.Last + 1);
                       ^~~~
tgsi/tgsi_two_side.c: In function 'xform_inst':
tgsi/tgsi_two_side.c:184:45: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
             if (inst->Src[i].Register.Index == ts-
>front_color_input[j]) {
                                             ^~

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agogallium/aux/tgsi_ureg.c: Fix various warnings
Gert Wollny [Tue, 5 Jun 2018 11:59:01 +0000 (13:59 +0200)]
gallium/aux/tgsi_ureg.c: Fix various warnings

tgsi/tgsi_ureg.c: In function 'ureg_DECL_sampler':
tgsi/tgsi_ureg.c:721:34: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
       if (ureg->sampler[i].Index == nr)
                                  ^~
tgsi/tgsi_ureg.c: In function 'match_or_expand_immediate64':
tgsi/tgsi_ureg.c:837:34: warning: unused parameter 'type' [-Wunused-
parameter]
                              int type,
                                  ^~~~
tgsi/tgsi_ureg.c: In function 'emit_decls':
tgsi/tgsi_ureg.c:1821:31: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
       if (ureg->properties[i] != ~0)
                               ^~
tgsi/tgsi_ureg.c: In function 'ureg_create_with_screen':
tgsi/tgsi_ureg.c:2193:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ARRAY_SIZE(ureg->properties); i++)
                  ^

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agogallium/aux/tgsi_text.c: Fix -Wsign-compare warnings
Gert Wollny [Tue, 5 Jun 2018 11:59:00 +0000 (13:59 +0200)]
gallium/aux/tgsi_text.c: Fix -Wsign-compare warnings

tgsi/tgsi_text.c: In function 'parse_identifier':
tgsi/tgsi_text.c:218:16: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
          if (i == len - 1)
                ^~
tgsi/tgsi_text.c: In function 'parse_optional_swizzle':
tgsi/tgsi_text.c:873:21: warning: comparison between signed and unsigned
integer expressions [-Wsign-compare]
       for (i = 0; i < components; i++) {
                     ^
tgsi/tgsi_text.c: In function 'parse_instruction':
tgsi/tgsi_text.c:1103:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < info->num_dst + info->num_src + info->is_tex; i++) {
                  ^
tgsi/tgsi_text.c:1118:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
       else if (i < info->num_dst + info->num_src) {
                  ^
tgsi/tgsi_text.c: In function 'parse_immediate':
tgsi/tgsi_text.c:1660:24: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (type = 0; type < ARRAY_SIZE(tgsi_immediate_type_names); ++type)
{
                        ^
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agogallium/aux/tgsi_point_sprite.c: Fix -Wsign-compare warnings
Gert Wollny [Tue, 5 Jun 2018 11:58:59 +0000 (13:58 +0200)]
gallium/aux/tgsi_point_sprite.c: Fix -Wsign-compare warnings

tgsi/tgsi_lowering.c: In function 'emit_twoside':
tgsi/tgsi_lowering.c:1179:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ctx->two_side_colors; i++) {
                  ^
tgsi/tgsi_lowering.c:1208:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ctx->two_side_colors; i++) {
                  ^
tgsi/tgsi_lowering.c:1216:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ctx->two_side_colors; i++) {
                  ^
tgsi/tgsi_lowering.c: In function 'emit_decls':
tgsi/tgsi_lowering.c:1280:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ctx->numtmp; i++) {
                  ^
tgsi/tgsi_lowering.c: In function 'rename_color_inputs':
tgsi/tgsi_lowering.c:1311:28: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
             if (src->Index == ctx->two_side_idx[j]) {
                            ^~

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agogallium/aux/tgsi_lowering.c: Fix -Wsign-compare warnings
Gert Wollny [Tue, 5 Jun 2018 11:58:58 +0000 (13:58 +0200)]
gallium/aux/tgsi_lowering.c: Fix -Wsign-compare warnings

tgsi/tgsi_lowering.c: In function 'emit_twoside':
tgsi/tgsi_lowering.c:1179:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ctx->two_side_colors; i++) {
                  ^
tgsi/tgsi_lowering.c:1208:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ctx->two_side_colors; i++) {
                  ^
tgsi/tgsi_lowering.c:1216:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ctx->two_side_colors; i++) {
                  ^
tgsi/tgsi_lowering.c: In function 'emit_decls':
tgsi/tgsi_lowering.c:1280:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < ctx->numtmp; i++) {
                  ^
tgsi/tgsi_lowering.c: In function 'rename_color_inputs':
tgsi/tgsi_lowering.c:1311:28: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
             if (src->Index == ctx->two_side_idx[j]) {
                            ^~

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agogallium/aux/tgsi_build.c: Fix -Wsign-compare warnings
Gert Wollny [Tue, 5 Jun 2018 11:58:57 +0000 (13:58 +0200)]
gallium/aux/tgsi_build.c: Fix -Wsign-compare warnings

tgsi/tgsi_build.c: In function 'tgsi_build_full_immediate':
tgsi/tgsi_build.c:622:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for( i = 0; i < full_imm->Immediate.NrTokens - 1; i++ ) {
                  ^
tgsi/tgsi_build.c: In function 'tgsi_build_full_property':
tgsi/tgsi_build.c:1393:18: warning: comparison between signed and
unsigned integer expressions [-Wsign-compare]
    for( i = 0; i < full_prop->Property.NrTokens - 1; i++ ) {
                  ^

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>