mesa.git
6 years agomeson: wire up egl/android
Eric Engestrom [Tue, 24 Oct 2017 15:08:15 +0000 (16:08 +0100)]
meson: wire up egl/android

Cc: Rob Herring <robh@kernel.org>
Cc: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agoglsl: Remove ir_binop_greater and ir_binop_lequal expressions
Ian Romanick [Fri, 8 May 2015 19:55:00 +0000 (12:55 -0700)]
glsl: Remove ir_binop_greater and ir_binop_lequal expressions

NIR does not have these instructions.  TGSI and Mesa IR both implement
them using < and >=, repsectively.  Removing them deletes a bunch of
code and means I don't have to add code to the SPIR-V generator for
them.

v2: Rebase on 2+ years of change... and fix a major bug added in the
rebase.

   text    data     bss     dec     hex filename
8255291  268856  294072 8818219  868e2b 32-bit i965_dri.so before
8254235  268856  294072 8817163  868a0b 32-bit i965_dri.so after
7815339  345592  420592 8581523  82f193 64-bit i965_dri.so before
7813995  345560  420592 8580147  82ec33 64-bit i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoglsl/parser: Track built-in types using the glsl_type directly
Ian Romanick [Wed, 20 Sep 2017 21:19:15 +0000 (16:19 -0500)]
glsl/parser: Track built-in types using the glsl_type directly

Without the lexer changes, tests/glslparsertest/glsl2/tex_rect-02.frag
fails.  Before this change, the parser would determine that
sampler2DRect is not a valid type because the call to
state->symbols->get_type() in ast_type_specifier::glsl_type() would
return NULL.  Since ast_type_specifier::glsl_type() is now going to
return the glsl_type pointer that it received from the lexer, it doesn't
have an opportunity to generate an error.

   text    data     bss     dec     hex filename
8255243  268856  294072 8818171  868dfb 32-bit i965_dri.so before
8255291  268856  294072 8818219  868e2b 32-bit i965_dri.so after
7815195  345592  420592 8581379  82f103 64-bit i965_dri.so before
7815339  345592  420592 8581523  82f193 64-bit i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoglsl/parser: Return the glsl_type object from the lexer
Ian Romanick [Wed, 20 Sep 2017 21:05:54 +0000 (16:05 -0500)]
glsl/parser: Return the glsl_type object from the lexer

This allows us to use a single token for every built-in type except void.

   text    data     bss     dec     hex filename
8275163  269336  294072 8838571  86ddab 32-bit i965_dri.so before
8255243  268856  294072 8818171  868dfb 32-bit i965_dri.so after
7836963  346552  420592 8604107  8349cb 64-bit i965_dri.so before
7815195  345592  420592 8581379  82f103 64-bit i965_dri.so after

Yes, the 64-bit binary shrinks by 21k.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoglsl/parser: Allocate identifier inside classify_identifier
Ian Romanick [Thu, 21 Sep 2017 17:14:04 +0000 (12:14 -0500)]
glsl/parser: Allocate identifier inside classify_identifier

Passing YYSTYPE into classify_identifier enables a later patch.

   text    data     bss     dec     hex filename
8310339  269336  294072 8873747  876713 32-bit i965_dri.so before
8275163  269336  294072 8838571  86ddab 32-bit i965_dri.so after
7845579  346552  420592 8612723  836b73 64-bit i965_dri.so before
7836963  346552  420592 8604107  8349cb 64-bit i965_dri.so after

Yes, the 64-bit binary shrinks by 8k.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoglsl/parser: Move anonymous struct name handling to the parser
Ian Romanick [Tue, 26 Sep 2017 03:29:35 +0000 (20:29 -0700)]
glsl/parser: Move anonymous struct name handling to the parser

There are two callers of the constructor, and they are right next to
each other.  Move the "#anon_struct" name handling to the parser so that
the conditional can be removed.

I've also deleted part of the comment (about the memory leak) because I
don't think it's quite accurate or relevant.

   text    data     bss     dec     hex filename
8310399  269336  294072 8873807  87674f 32-bit i965_dri.so before
8310339  269336  294072 8873747  876713 32-bit i965_dri.so after
7845611  346552  420592 8612755  836b93 64-bit i965_dri.so before
7845579  346552  420592 8612723  836b73 64-bit i965_dri.so after

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoglsl/parser: Silence unused parameter warning
Ian Romanick [Tue, 26 Sep 2017 01:07:50 +0000 (18:07 -0700)]
glsl/parser: Silence unused parameter warning

glsl/glsl_parser_extras.cpp: In constructor ‘ast_struct_specifier::ast_struct_specifier(void*, const char*, ast_declarator_list*)’:
glsl/glsl_parser_extras.cpp:1675:50: warning: unused parameter ‘lin_ctx’ [-Wunused-parameter]
 ast_struct_specifier::ast_struct_specifier(void *lin_ctx, const char *identifier,
                                                  ^~~~~~~

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoglsl: Silence unused parameter warnings
Ian Romanick [Tue, 26 Sep 2017 01:06:17 +0000 (18:06 -0700)]
glsl: Silence unused parameter warnings

glsl/standalone_scaffolding.cpp: In function ‘GLbitfield _mesa_program_state_flags(const gl_state_index*)’:
glsl/standalone_scaffolding.cpp:103:66: warning: unused parameter ‘state’ [-Wunused-parameter]
 _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH])
                                                                  ^
glsl/standalone_scaffolding.cpp: In function ‘char* _mesa_program_state_string(const gl_state_index*)’:
glsl/standalone_scaffolding.cpp:109:67: warning: unused parameter ‘state’ [-Wunused-parameter]
 _mesa_program_state_string(const gl_state_index state[STATE_LENGTH])
                                                                   ^
glsl/standalone_scaffolding.cpp: In function ‘void _mesa_delete_shader(gl_context*, gl_shader*)’:
glsl/standalone_scaffolding.cpp:115:40: warning: unused parameter ‘ctx’ [-Wunused-parameter]
 _mesa_delete_shader(struct gl_context *ctx, struct gl_shader *sh)
                                        ^~~
glsl/standalone_scaffolding.cpp: In function ‘void _mesa_delete_linked_shader(gl_context*, gl_linked_shader*)’:
glsl/standalone_scaffolding.cpp:123:47: warning: unused parameter ‘ctx’ [-Wunused-parameter]
 _mesa_delete_linked_shader(struct gl_context *ctx,
                                               ^~~

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
6 years agoAndroid: move drivers' symlinks to /vendor (v2)
Mauro Rossi [Fri, 27 Oct 2017 19:54:14 +0000 (21:54 +0200)]
Android: move drivers' symlinks to /vendor (v2)

Having moved gallium_dri.so library to /vendor/lib/dri
also symlinks need to be coherently created using TARGET_OUT_VENDOR instead of TARGET_OUT
or all non Intel drivers will not be loaded with Android N and earlier,
thus causing SurfaceFlinger SIGABRT

(v2) simplification of post install command

Fixes: c3f75d483c ("Android: move libraries to /vendor")
Cc: 17.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com> (v1)
Reviewed-by: Rob Herring <robh@kernel.org> (v1)
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agoRevert "foo"
Emil Velikov [Mon, 30 Oct 2017 15:32:56 +0000 (15:32 +0000)]
Revert "foo"

This reverts commit 27d5a7bce09aef83d3349cca5f3777007b3b94b6.

I fat fingered it, failing to reset the checkout before applying the
sequential commit.

6 years agodocs/release-calendar: update - 17.3.0-rc2 is out
Emil Velikov [Mon, 30 Oct 2017 15:24:00 +0000 (15:24 +0000)]
docs/release-calendar: update - 17.3.0-rc2 is out

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
6 years agofoo
Emil Velikov [Wed, 25 Oct 2017 13:52:55 +0000 (14:52 +0100)]
foo

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
6 years agoutil: hashtable: make hashing prototypes match
Lionel Landwerlin [Fri, 27 Oct 2017 16:43:45 +0000 (17:43 +0100)]
util: hashtable: make hashing prototypes match

It seems nobody's using the string hashing function. If you try to
pass it directly to the hashtable creation function, you'll get
compiler warning for non matching prototypes. Let's make them match.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agodocs: update calendar, add news item and link release notes for 17.2.4
Andres Gomez [Mon, 30 Oct 2017 14:58:51 +0000 (16:58 +0200)]
docs: update calendar, add news item and link release notes for 17.2.4

Signed-off-by: Andres Gomez <agomez@igalia.com>
6 years agodocs: add sha256 checksums for 17.2.4
Andres Gomez [Mon, 30 Oct 2017 14:53:44 +0000 (16:53 +0200)]
docs: add sha256 checksums for 17.2.4

Signed-off-by: Andres Gomez <agomez@igalia.com>
6 years agodocs: add release notes for 17.2.4
Andres Gomez [Mon, 30 Oct 2017 14:46:20 +0000 (16:46 +0200)]
docs: add release notes for 17.2.4

Signed-off-by: Andres Gomez <agomez@igalia.com>
6 years agoradv: Fix -Wformat-security issue
Alex Smith [Mon, 30 Oct 2017 08:38:14 +0000 (08:38 +0000)]
radv: Fix -Wformat-security issue

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103513
Fixes: de889794134e ("radv: Implement VK_AMD_shader_info")
Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoradv: add cache items to in memory cache when reading from disk
Timothy Arceri [Wed, 25 Oct 2017 22:35:48 +0000 (09:35 +1100)]
radv: add cache items to in memory cache when reading from disk

Otherwise we will leak them, load duplicates from disk rather
than memory and never write items loaded from disk to the apps
pipeline cache.

Fixes: fd24be134ffd 'radv: make use of on-disk cache'
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoi965: fix blorp stage_prog_data->param leak
Tapani Pälli [Fri, 27 Oct 2017 11:49:40 +0000 (14:49 +0300)]
i965: fix blorp stage_prog_data->param leak

Patch uses mem_ctx for allocation to ensure param array gets freed
later.

==6164== 48 bytes in 1 blocks are definitely lost in loss record 61 of 193
==6164==    at 0x4C2EB6B: malloc (vg_replace_malloc.c:299)
==6164==    by 0x12E31C6C: ralloc_size (ralloc.c:121)
==6164==    by 0x130189F1: fs_visitor::assign_constant_locations() (brw_fs.cpp:2095)
==6164==    by 0x13022D32: fs_visitor::optimize() (brw_fs.cpp:5715)
==6164==    by 0x13024D5A: fs_visitor::run_fs(bool, bool) (brw_fs.cpp:6229)
==6164==    by 0x1302549A: brw_compile_fs (brw_fs.cpp:6570)
==6164==    by 0x130C4B07: blorp_compile_fs (blorp.c:194)
==6164==    by 0x130D384B: blorp_params_get_clear_kernel (blorp_clear.c:79)
==6164==    by 0x130D3C56: blorp_fast_clear (blorp_clear.c:332)
==6164==    by 0x12EFA439: do_single_blorp_clear (brw_blorp.c:1261)
==6164==    by 0x12EFC4AF: brw_blorp_clear_color (brw_blorp.c:1326)
==6164==    by 0x12EFF72B: brw_clear (brw_clear.c:297)

Fixes: 8d90e28839 ("intel/compiler: Allocate pull_param in assign_constant_locations")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable@lists.freedesktop.org
6 years agoi965: correctly assign SamplerCount of INTERFACE_DESCRIPTOR_DATA
Kevin Rogovin [Mon, 25 Sep 2017 10:34:05 +0000 (13:34 +0300)]
i965: correctly assign SamplerCount of INTERFACE_DESCRIPTOR_DATA

We were dividing by 4 twice.  This also papered over a bug where we
were neglecting to clamp the sampler count to the [0, 16] range.

This should have no functional impact, it only affects prefetching.

v2 [Kenneth Graunke]:
 - Clamp sampler_count to [0, 16] to avoid overflowing the valid values
   for this field.  Write a commit message.

Signed-off-by: Kevin Rogovin <kevin.rogovin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965: Only set key->high_quality_derivatives when it matters.
Kenneth Graunke [Thu, 26 Oct 2017 22:22:45 +0000 (15:22 -0700)]
i965: Only set key->high_quality_derivatives when it matters.

This avoids recompiles for shaders that don't use explicit derivatives
when ctx->Hint.FragmentShaderDerivative == GL_NICEST.

For example, GFXBench 5 Aztec Ruins sets the GL_NICEST hint before
compiling any shaders, but none of them use dFdx() or dFdy() - only
implicit derivatives.  This doesn't eliminate any recompiles, but
does eliminate one of the reasons for doing so.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agonir: Make nir_gather_info collect a uses_fddx_fddy flag.
Kenneth Graunke [Thu, 26 Oct 2017 22:19:25 +0000 (15:19 -0700)]
nir: Make nir_gather_info collect a uses_fddx_fddy flag.

i965 turns fddx/fddy into their coarse/fine variants based on the
ctx->Hint.FragmentShaderDerivative setting.  It needs to know whether
this can impact a shader in order to better guess NOS settings.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoi965: Update brw_wm_debug_recompile() for newer key entries.
Kenneth Graunke [Thu, 26 Oct 2017 21:58:26 +0000 (14:58 -0700)]
i965: Update brw_wm_debug_recompile() for newer key entries.

Also, reorder them to match the structure's field order, to make it
easier to check that they're all present.

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoi965: Delete brw_wm_prog_key::drawable_height.
Kenneth Graunke [Thu, 26 Oct 2017 21:57:41 +0000 (14:57 -0700)]
i965: Delete brw_wm_prog_key::drawable_height.

This has been unused since we switched to nir_lower_wpos_ytransform.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoradv: Implement VK_AMD_shader_info
Alex Smith [Fri, 27 Oct 2017 13:25:05 +0000 (14:25 +0100)]
radv: Implement VK_AMD_shader_info

This allows an app to query shader statistics and get a disassembly of
a shader. RenderDoc git has support for it, so this allows you to view
shader disassembly from a capture.

When this extension is enabled on a device (or when tracing), we now
disable pipeline caching, since we don't get the shader debug info when
we retrieve cached shaders.

v2: Improvements to resource usage reporting
v3: Disassembly string must be null terminated (string_buffer's length
    does not include the terminator)
v4: Fixed LDS reporting. (Bas)

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoetnaviv: add ext_texture_srgb support
Christian Gmeiner [Sat, 28 Oct 2017 15:24:58 +0000 (17:24 +0200)]
etnaviv: add ext_texture_srgb support

Following piglits are passing:
 - glean@texture_srgb
 - spec@ext_texture_srgb@fbo-srgb
 - spec@ext_texture_srgb@tex-srgb
 - spec@ext_texture_srgb@texwrap formats
 - spec@ext_texture_srgb@texwrap formats-s3tc

Btw. this enables GL 2.1 :-)

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Reviewed-by: Wladimir J. van der Laan <laanwj@gmail.com>
6 years agointel/compiler/gen9: Pixel shader header only workaround
Topi Pohjolainen [Wed, 25 Oct 2017 13:50:11 +0000 (16:50 +0300)]
intel/compiler/gen9: Pixel shader header only workaround

Fixes intermittent GPU hangs on Broxton with an Intel internal
test case.

There are plenty of similar fragment shaders in piglit that do
not use any varyings and any uniforms. According to the
documentation special timing is needed between pipeline stages.
Apparently we just don't hit that with piglit. Even with the
failing test case one doesn't always get the hang.

Moreover, according to the error states the hang happens
significantly later than the execution of the problematic shader.
There are multiple render cycles (primitive submissions) in between.
I've also seen error states where the ACTHD points outside the
batch. Almost as if the hardware writes somewhere that gets used
later on. That would also explain why piglit doesn't suffer from
this - most tests kick off one render cycle and any corruption
is left unseen.

v2 (Ken): Instead of enabling push constants, enable one of the
          inputs (PSIZ).
v3 (Ken, Jason): Use LAYER instead making vulkan emit_3dstate_sbe()
                 happy.

Cc: "17.3 17.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
6 years agoscons: fix OSMesa driver build
Brian Paul [Fri, 27 Oct 2017 22:34:41 +0000 (16:34 -0600)]
scons: fix OSMesa driver build

Fixes: ea53d9a8eb5d4b2 "glapi: include generated headers without path"
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agoscons: fix scons build to find generated glapitable.h
Brian Paul [Fri, 27 Oct 2017 21:14:45 +0000 (15:14 -0600)]
scons: fix scons build to find generated glapitable.h

Fixes: ea53d9a8eb5d4b2 "glapi: include generated headers without path"
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agogallium: s/unsigned/enum pipe_prim_type/
Brian Paul [Fri, 27 Oct 2017 20:36:01 +0000 (14:36 -0600)]
gallium: s/unsigned/enum pipe_prim_type/

In the vbuf_render::set_primitive() functions.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agodraw: don't cull tris with zero area
Roland Scheidegger [Thu, 26 Oct 2017 19:23:27 +0000 (21:23 +0200)]
draw: don't cull tris with zero area

Culling tris with zero area seems like a great idea, but apparently with
fill mode line (and point) we're supposed to draw them, at least some tests
for some other state tracker complained otherwise.
Such tris also always seem to be back facing (not sure if this can be
inferred from anything, since in a mathematical sense it cannot really be
determined), so make sure to account for this when filling in the face
information.
(For solid tris, this is of course unnecessary, drivers will throw the tris
away later in any case.)

Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agomeson: Add a dependency on nir_opcodes_h for freedreno
Dylan Baker [Fri, 27 Oct 2017 17:09:46 +0000 (10:09 -0700)]
meson: Add a dependency on nir_opcodes_h for freedreno

This fixes a race condition in the build.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
6 years agomeson: build gallium based osmesa
Dylan Baker [Tue, 24 Oct 2017 22:52:57 +0000 (15:52 -0700)]
meson: build gallium based osmesa

This has been tested with the osdemo from mesa-demos

v2: - Add SELinux dependency
    - fix typo GALLIUM_LLVM -> GALLIUM_LLVMPIPE

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: build classic osmesa
Dylan Baker [Sat, 21 Oct 2017 04:48:18 +0000 (21:48 -0700)]
meson: build classic osmesa

This builds the classic (non-gallium) osmesa with meson. This has been
tested with the osdemo application from mesa-demos.

v2: - Remove unrelated change
    - Add SELinux dependency to osmesa

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: Add generated files to non-shared glapi
Dylan Baker [Sat, 21 Oct 2017 05:25:39 +0000 (22:25 -0700)]
meson: Add generated files to non-shared glapi

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoglapi: include generated headers without path
Dylan Baker [Mon, 23 Oct 2017 23:09:41 +0000 (16:09 -0700)]
glapi: include generated headers without path

This has been tested wtih make dist-check and with meson.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agoosmesa: Include generated headers without path
Dylan Baker [Mon, 23 Oct 2017 23:09:15 +0000 (16:09 -0700)]
osmesa: Include generated headers without path

This makes things much easier to ensure correctness with meson. Tested
with make dist-check and with meson.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: move gallium include declarations to src
Dylan Baker [Sat, 21 Oct 2017 05:23:15 +0000 (22:23 -0700)]
meson: move gallium include declarations to src

These are used by non-gallium osmesa, so they need to be defined outside
of the gallium subdirectory.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: fix glprocs.h generator
Dylan Baker [Sat, 21 Oct 2017 05:22:01 +0000 (22:22 -0700)]
meson: fix glprocs.h generator

There was a typo that causes the generated file to be called gl_procs.h
instead.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: rename all instances of xf86vm to xxf86vm
Dylan Baker [Tue, 24 Oct 2017 18:34:04 +0000 (11:34 -0700)]
meson: rename all instances of xf86vm to xxf86vm

Because consistency

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: fix pkg-config Gl Require.Private
Dylan Baker [Tue, 24 Oct 2017 18:28:42 +0000 (11:28 -0700)]
meson: fix pkg-config Gl Require.Private

xf86vm -> xxf86vm

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomesa: Accept GL_BACK in get_fb0_attachment with ARB_ES3_1_compatibility.
Kenneth Graunke [Thu, 26 Oct 2017 18:44:09 +0000 (11:44 -0700)]
mesa: Accept GL_BACK in get_fb0_attachment with ARB_ES3_1_compatibility.

According to the ARB_ES3_1_compatibility specification,
glGetFramebufferAttachmentParameteriv is supposed to accept BACK,
and it behaves exactly like BACK_LEFT.

Fixes a GL error in GFXBench 5 Aztec Ruins.

Cc: "17.3 17.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agogallium/os: fix align_malloc() / os_malloc_aligned() comment mix-up
Brian Paul [Fri, 27 Oct 2017 00:30:51 +0000 (18:30 -0600)]
gallium/os: fix align_malloc() / os_malloc_aligned() comment mix-up

os_free_aligned() is the counterpart to os_malloc_aligned().
Trivial.

6 years agoformatquery: use correct target check for IMAGE_FORMAT_COMPATIBILITY_TYPE
Alejandro Piñeiro [Wed, 25 Oct 2017 12:35:36 +0000 (14:35 +0200)]
formatquery: use correct target check for IMAGE_FORMAT_COMPATIBILITY_TYPE

From the spec:
   "IMAGE_FORMAT_COMPATIBILITY_TYPE: The matching criteria use for the
    resource when used as an image textures is returned in
    <params>. This is equivalent to calling GetTexParameter"

So we would need to return None for any target not supported by
GetTexParameter. By mistake, we were using the target check for
GetTexLevelParameter.

v2: fix typo (GetTextParameter vs GetTexParemeter) on comment (Illia Mirkin)

Reviewed-by: Antia Puentes <apuentes@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agomeson: bring MESA_GIT_SHA1 in line with other build systems
Eric Engestrom [Tue, 24 Oct 2017 17:03:39 +0000 (18:03 +0100)]
meson: bring MESA_GIT_SHA1 in line with other build systems

Meson's vcs_tag() uses the output of `git describe`, eg.
  17.3-branchpoint-5-gfbf29c3cd15ae831e249+

Whereas the other build systems used a script that outputs only the sha1
of the HEAD commit, eg.
  fbf29c3cd1

Given that this information is used by printing it next to the version
number, there's some redundancy here, and inconsistency between build
systems.

Bring Meson in line by making it use the same script, with the added
advantage of now supporting the MESA_GIT_SHA1_OVERRIDE env var.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agobuildsys: move file regeneration logic to the script itself
Eric Engestrom [Wed, 25 Oct 2017 13:04:35 +0000 (14:04 +0100)]
buildsys: move file regeneration logic to the script itself

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agoradv: allow to use a compute shader for resetting the query pool
Samuel Pitoiset [Thu, 26 Oct 2017 16:03:24 +0000 (18:03 +0200)]
radv: allow to use a compute shader for resetting the query pool

Serious Sam Fusion 2017 uses a huge number of occlusion queries,
and the allocated query pool buffer is greater than 4096 bytes.

This slightly improves performance (tested in Ultra) from
117.2 FPS to 119.7 FPS (~+2%) on my RX480.

This also improves Talos, from 69 FPS to 72/73 FPS (~+5%).

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: make radv_fill_buffer() return the needed flush bits
Samuel Pitoiset [Thu, 26 Oct 2017 16:03:23 +0000 (18:03 +0200)]
radv: make radv_fill_buffer() return the needed flush bits

Only needed when the CS path is used.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agomeson: wire up selinux
Eric Engestrom [Thu, 26 Oct 2017 15:19:41 +0000 (16:19 +0100)]
meson: wire up selinux

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agowayland-egl: fix wayland cflags
Eric Engestrom [Thu, 26 Oct 2017 16:13:47 +0000 (17:13 +0100)]
wayland-egl: fix wayland cflags

Fixes: 80bfff5c4f1d4d8c842a0 "wayland-egl: adds CFLAGS for wayland.egl.h include"
Suggested-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Acked-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
6 years agovc4: fix release build
Eric Engestrom [Wed, 25 Oct 2017 13:08:58 +0000 (14:08 +0100)]
vc4: fix release build

Mesa's DEBUG and assert's NDEBUG are not tied to each other, so we need
to explicitly compile this code out.

Fixes: 3df78928786134874eafa "vc4: Drop reloc_count tracking for debug
       asserts on non-debug builds."
Cc: Eric Anholt <eric@anholt.net>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agoi965: unref push_const_bo in intelDestroyContext
Tapani Pälli [Fri, 27 Oct 2017 09:54:02 +0000 (12:54 +0300)]
i965: unref push_const_bo in intelDestroyContext

Valgrind shows that leak is caused by gen6_upload_push_constant, add
unref push_const_bo per stage to destructor to fix this (like done for
scratch_bo).

   ==10952== 144 bytes in 1 blocks are definitely lost in loss record 44 of 66
   ==10952==    at 0x4C30A1E: calloc (vg_replace_malloc.c:711)
   ==10952==    by 0x8C02847: bo_alloc_internal.constprop.10 (brw_bufmgr.c:344)
   ==10952==    by 0x8C425C4: intel_upload_space (intel_upload.c:101)
   ==10952==    by 0x8C22ED0: gen6_upload_push_constants (gen6_constant_state.c:154)

v2: remove if conditions, brw_bo_unreference handles NULL (Ken, Emil)

Fixes: 24891d7c05 ("i965: Store per-stage push constant BO pointers.")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
6 years agoi965: remove if conditions from scratch_bo unref
Tapani Pälli [Fri, 27 Oct 2017 09:50:50 +0000 (12:50 +0300)]
i965: remove if conditions from scratch_bo unref

brw_bo_unreference handles NULL case

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoanv: Fix assert about source attrs.
Kenneth Graunke [Wed, 25 Oct 2017 16:37:09 +0000 (09:37 -0700)]
anv: Fix assert about source attrs.

Asserting slot >= 2 made sense when the URB read offset was always 1
(pair of slots).  Commit 566a0c43f0b9fbf5106161471dd5061c7275f761 made
it possible to read from the VUE header in slot 0, by adjusting the
offset to be 0.  So, this assert is now bogus.  Use the one from GL.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv: Drop URB entry output read handling in 3DSTATE_XS.
Kenneth Graunke [Wed, 25 Oct 2017 16:35:49 +0000 (09:35 -0700)]
anv: Drop URB entry output read handling in 3DSTATE_XS.

Commit 566a0c43f0b9fbf5106161471dd5061c7275f761 started setting the
3DSTATE_SBE bit to override these values with the one calculated there.

So, they're dead.  Stop setting them.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoi965: Delete unused brw_vs_prog_data::nr_attributes field.
Kenneth Graunke [Fri, 20 Oct 2017 04:53:49 +0000 (21:53 -0700)]
i965: Delete unused brw_vs_prog_data::nr_attributes field.

Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agoradeonsi: update hack for HTILE corruption in ARK: Survival Evolved
Samuel Pitoiset [Thu, 26 Oct 2017 16:08:19 +0000 (18:08 +0200)]
radeonsi: update hack for HTILE corruption in ARK: Survival Evolved

It appears that flushing the DB metadata is actually not sufficient
since the driver uses the new VS blit shaders. This looks quite
strange though, but it seems like we need to flush DB for fixing
the corruption.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102955
Fixes: 69ccb9dae7 (radeonsi: use new VS blit shaders (VS inputs in SGPRs)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoradv: add support for local bos. (v3)
Dave Airlie [Wed, 25 Oct 2017 06:12:13 +0000 (07:12 +0100)]
radv: add support for local bos. (v3)

This uses the new kernel interfaces for reduced cs overhead,
We only set the local flag for memory allocations that don't have
 a dedicated allocation and ones that aren't imports.

v2: add to all the internal buffer creation paths.
v3: missed some command submission paths, handle 0/empty bo lists.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoi965/miptree: Take an isl_format in render_aux_usage
Jason Ekstrand [Mon, 23 Oct 2017 21:25:44 +0000 (14:25 -0700)]
i965/miptree: Take an isl_format in render_aux_usage

Not all rendering matches the miptree format.  We allow rendering to
texture views so there are cases where it may not match.  In those
cases, our current scheme of just passing the value of ctx->sRGBEnabled
isn't viable.  Instead, just do what we do for texturing and pass the
view format in directly.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: mesa-stable@lists.freedesktop.org
6 years agoi965/blorp: Use more temporary isl_format variables
Jason Ekstrand [Mon, 23 Oct 2017 21:24:06 +0000 (14:24 -0700)]
i965/blorp: Use more temporary isl_format variables

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: mesa-stable@lists.freedesktop.org
6 years agoi965/blorp: Use blorp_to_isl_format for src_isl_format in blit_miptrees
Jason Ekstrand [Mon, 23 Oct 2017 22:51:21 +0000 (15:51 -0700)]
i965/blorp: Use blorp_to_isl_format for src_isl_format in blit_miptrees

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Cc: mesa-stable@lists.freedesktop.org
6 years agospirv: Claim support for the simple memory model
Jason Ekstrand [Thu, 26 Oct 2017 17:08:21 +0000 (10:08 -0700)]
spirv: Claim support for the simple memory model

It's rather surprising that we've never actually hit this before.
Aparently, Ian's SPIR-V generator currently claims the Simple when you
don't do anything complex.  We really shouldn't assert-fail on it.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: mesa-stable@lists.freedesktop.org
6 years agoAndroid: egl: add dependency on libnativewindow
Rob Herring [Thu, 26 Oct 2017 19:18:22 +0000 (14:18 -0500)]
Android: egl: add dependency on libnativewindow

system/window.h is no longer available by default and is part of
libnativewindow, so add it to the shared libraries. It has to be conditional
because the library is only present in O and later.

Really, we should only be depending on vndk/window.h now, but that's only
in O and changing would be pretty invasive.

Signed-off-by: Rob Herring <robh@kernel.org>
6 years agomeson: build nouveau vieux driver
Dylan Baker [Tue, 17 Oct 2017 00:51:47 +0000 (17:51 -0700)]
meson: build nouveau vieux driver

Build tested only.

v2: - fix spelling error (veaux -> vieux)

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agomeson: build r200 driver
Dylan Baker [Tue, 17 Oct 2017 00:24:56 +0000 (17:24 -0700)]
meson: build r200 driver

v2: - remove TODO that is done

Build tested only

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agomeson: build r100 driver
Dylan Baker [Tue, 17 Oct 2017 00:12:52 +0000 (17:12 -0700)]
meson: build r100 driver

build tested only

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agoinstall_megadrivers: print the full path with driver name
Dylan Baker [Tue, 17 Oct 2017 00:25:53 +0000 (17:25 -0700)]
install_megadrivers: print the full path with driver name

Instead of just the path.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
6 years agointel/tools/disasm: correctly observe FILE *out parameter
Kevin Rogovin [Mon, 25 Sep 2017 10:34:11 +0000 (13:34 +0300)]
intel/tools/disasm: correctly observe FILE *out parameter

Signed-off-by: Kevin Rogovin <kevin.rogovin@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agointel/compiler: brw_validate_instructions to take const void* instead of void*
Kevin Rogovin [Mon, 25 Sep 2017 10:34:08 +0000 (13:34 +0300)]
intel/compiler: brw_validate_instructions to take const void* instead of void*

The disassembler does not (and should not) be modifying the data.

Signed-off-by: Kevin Rogovin <kevin.rogovin@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoloader: drop empty function alias
Eric Engestrom [Thu, 26 Oct 2017 14:37:49 +0000 (15:37 +0100)]
loader: drop empty function alias

While at it, drop the duplicate return.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emli.velikov@collabora.com>
6 years agoradeonsi: add a workaround for weird s_buffer_load_dword behavior on SI
Marek Olšák [Sun, 22 Oct 2017 13:54:23 +0000 (15:54 +0200)]
radeonsi: add a workaround for weird s_buffer_load_dword behavior on SI

See my LLVM patch which fixes the root cause.

Users have to apply this patch and then they have 2 choices:
- Downgrade to LLVM 5.0
- Update to LLVM git after my LLVM patch is pushed.

It won't be possible to use current and earlier development version
of LLVM 6.0.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Cc: 17.3 <mesa-stable@lists.freedesktop.org>
6 years agoutil: use OpenBSD/NetBSD code on FreeBSD/DragonFly
Greg V [Mon, 23 Oct 2017 20:20:43 +0000 (23:20 +0300)]
util: use OpenBSD/NetBSD code on FreeBSD/DragonFly

Obtained from: FreeBSD ports

Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
[Emil Velikov: wrap long line]
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agowinsys/svga/drm: add ERESTART define for *BSD
Greg V [Mon, 23 Oct 2017 20:20:42 +0000 (23:20 +0300)]
winsys/svga/drm: add ERESTART define for *BSD

Obtained from: FreeBSD ports

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agoloader: use drmGetDeviceNameFromFd2 from libdrm
Greg V [Mon, 23 Oct 2017 20:20:40 +0000 (23:20 +0300)]
loader: use drmGetDeviceNameFromFd2 from libdrm

Reduce code duplication and automatically benefit from OS-specific
fixes to libdrm (e.g. in FreeBSD ports).

API was introduced with 2.4.74 and we already require 2.4.75 globally.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103283
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
6 years agomeson: wayland-egl depends on wayland-client
Daniel Stone [Thu, 26 Oct 2017 10:56:22 +0000 (11:56 +0100)]
meson: wayland-egl depends on wayland-client

Since wayland-egl.h is currently provided by the core Wayland package,
depend on wayland-client to make sure we get it in our include path.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Acked-by: Emil Velikov <emil.velikov@collabora.com>
Fixes: 108d257a16 ("meson: build libEGL")
Cc: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Cc: Dylan Baker <dylan@pnwbakers.com>
Cc: Gert Wollny <gw.fossdev@gmail.com>
6 years agofreedreno: implement pipe->invalidate_resource()
Rob Clark [Wed, 11 Oct 2017 14:57:34 +0000 (10:57 -0400)]
freedreno: implement pipe->invalidate_resource()

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: GL_ARB_texture_barrier
Rob Clark [Thu, 5 Oct 2017 21:16:35 +0000 (17:16 -0400)]
freedreno: GL_ARB_texture_barrier

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a5xx: rename invalidate_resource()
Rob Clark [Thu, 5 Oct 2017 21:07:27 +0000 (17:07 -0400)]
freedreno/a5xx: rename invalidate_resource()

This is different from pipe->invalidate_resource()..

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno/a5xx: mem2gmem is read-only for BO
Rob Clark [Thu, 5 Oct 2017 21:05:03 +0000 (17:05 -0400)]
freedreno/a5xx: mem2gmem is read-only for BO

This should be OUT_RELOC() since the operation isn't writing to the
buffer.  Technically it doesn't matter much currently, since we'd
anyways to a gmem2mem later.  But that will change.

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agofreedreno: small rename
Rob Clark [Thu, 5 Oct 2017 21:01:54 +0000 (17:01 -0400)]
freedreno: small rename

Signed-off-by: Rob Clark <robdclark@gmail.com>
6 years agoradeon/video: add gfx9 offsets when rejoin the video surface
Leo Liu [Wed, 25 Oct 2017 13:46:17 +0000 (09:46 -0400)]
radeon/video: add gfx9 offsets when rejoin the video surface

For CPU access.

Signed-off-by: Leo Liu <leo.liu@amd.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Christian König <christian.koenig@amd.com>
6 years agoradv: only copy the dynamic states that changed
Samuel Pitoiset [Wed, 13 Sep 2017 11:55:58 +0000 (13:55 +0200)]
radv: only copy the dynamic states that changed

When binding a new pipeline, we applied all dynamic states
without checking if they really need to be re-emitted. This
doesn't seem to be useful for the meta operations because only
the viewports/scissors are updated.

This should reduce the number of commands added to the IB
when a new graphics pipeline is bound.

Also, rename radv_dynamic_state_copy() to radv_bind_dynamic_state()
and set the dirty flags directly there.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: store the dynamic state mask into radv_dynamic_state
Samuel Pitoiset [Wed, 13 Sep 2017 10:10:00 +0000 (12:10 +0200)]
radv: store the dynamic state mask into radv_dynamic_state

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: only emit the depth bounds test values when set dynamically
Samuel Pitoiset [Wed, 25 Oct 2017 15:41:02 +0000 (17:41 +0200)]
radv: only emit the depth bounds test values when set dynamically

The depth bounds test values are either set at pipeline
creation or dynamically using vkCmdSetDepthBounds().

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoglsl/linker: Fix type checks for location aliasing
Iago Toral Quiroga [Wed, 25 Oct 2017 07:14:22 +0000 (09:14 +0200)]
glsl/linker: Fix type checks for location aliasing

From the OpenGL 4.6 spec, section 4.4.1 Input Layout Qualifiers, Page 68,
(Location aliasing):

   "Further, when location aliasing, the aliases sharing the location
    must have the same underlying numerical type  (floating-point or
    integer)."

The current implementation is too strict, since it checks that the
the base types are an exact match instead.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoglsl/linker: refactor check_location_aliasing
Iago Toral Quiroga [Wed, 25 Oct 2017 06:45:24 +0000 (08:45 +0200)]
glsl/linker: refactor check_location_aliasing

Mostly, this merges the type checks with all the other checks so
we only have a single loop for this.

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoglsl/linker: validate explicit locations for SSO programs
Iago Toral Quiroga [Fri, 20 Oct 2017 07:18:33 +0000 (09:18 +0200)]
glsl/linker: validate explicit locations for SSO programs

v2:
- we only need to validate inputs to the first stage and outputs
  from the last stage, everything else has already been validated
  during cross_validate_outputs_to_inputs (Timothy).
- Use MAX_VARYING instead of MAX_VARYINGS_INCL_PATCH (Illia)

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoglsl/linker: generalize validate_explicit_variable_location for SSO
Iago Toral Quiroga [Fri, 20 Oct 2017 08:46:10 +0000 (10:46 +0200)]
glsl/linker: generalize validate_explicit_variable_location for SSO

For non-SSO programs, we only need to validate outputs, since
the cross validation of outputs to inputs will ensure that we
produce linker errors for invalid inputs too.

Hoever, for the SSO path there is no output to input validation,
so we need to validate inputs explicitly. Generalize the function
so it can handle this as well.

Also, notice that vertex shader inputs and fragment shader outputs
are already validated in assign_attribute_or_color_locations()
for both SSO and non-SSO paths, so we should not try to validate
that here again (in fact, the function would require explicit
paths to handle these two cases properly).

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoglsl/linker: create a helper function to validate explicit locations
Iago Toral Quiroga [Fri, 20 Oct 2017 07:00:41 +0000 (09:00 +0200)]
glsl/linker: create a helper function to validate explicit locations

Currently, we only validate explicit locations for non-SSO programs.
This creates a helper that we can call from both SSO and non-SSO paths
directly, so we can reuse all the logic behind this.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoglsl/linker: outputs in the same location must share auxiliary storage
Iago Toral Quiroga [Thu, 19 Oct 2017 14:33:49 +0000 (16:33 +0200)]
glsl/linker: outputs in the same location must share auxiliary storage

From ARB_enhanced_layouts:

"[...]when location aliasing, the aliases sharing the location
  must have the same underlying numerical type (floating-point or
  integer) and the same auxiliary storage and
  interpolation qualification.[...]"

Add code to the linker to validate that aliased locations do
have the same aux storage.

Fixes:
KHR-GL45.enhanced_layouts.varying_location_aliasing_with_mixed_auxiliary_storage

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoglsl/linker: outputs in the same location must share interpolation
Iago Toral Quiroga [Thu, 19 Oct 2017 14:13:21 +0000 (16:13 +0200)]
glsl/linker: outputs in the same location must share interpolation

From ARB_enhanced_layouts:

"[...]when location aliasing, the aliases sharing the location
 must have the same underlying numerical type (floating-point or
 integer) and the same auxiliary storage and
 interpolation qualification.[...]"

Add code to the linker to validate that aliased locations do
have the same interpolation.

Fixes:
KHR-GL45.enhanced_layouts.varying_location_aliasing_with_mixed_interpolation

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoglsl/linker: fix location aliasing checks for interface variables
Iago Toral Quiroga [Thu, 19 Oct 2017 11:44:48 +0000 (13:44 +0200)]
glsl/linker: fix location aliasing checks for interface variables

The existing code was checking the whole interface variable rather
than its members, which is not what we want: we want to check
aliasing for each member in the interface variable.

Surprisingly, there are piglit tests that verify this and were
passing due to a bug in the existing code: when we were computing
the last component used by an interface variable we would use
the 'vector' path and multiply by vector_elements, which is 0 for
interface variables. This made the loop that checks for aliasing
be a no-op and not add the interface variable to the list of outputs
so then we would fail to link when we did not see a matching output
for the same input in the next stage. Since the tests expect a
linker error to happen, they would pass, but not for the right
reason.

Unfortunately, the current implementation uses ir_variable instances
to keep track of explicit locations. Since we don't have
ir_variables instances for individual interface members, we need
to have a custom struct with the data we need. This struct has
the ir_variable (which for interface members is the whole
interface variable), plus the data that we need to validate for
each aliased location, for now only the base type, which for
interface members we will take from the appropriate field inside
the interface variable.

Later patches will expand this custom struct so we can also check
other requirements for location aliasing, specifically that
we have matching interpolation and auxiliary storage, that once
again, we will take from the appropriate field members for the
interface variables.

v2:
 - Use MAX_VARYING instead of MAX_VARYINGS_INCL_PATCH (Illia)

Fixes:
KHR-GL45.enhanced_layouts.varying_block_automatic_member_locations

Fixes (these were passing before but for incorrect reasons):
tests/spec/arb_enhanced_layouts/linker/block-member-locations/named-block-member-location-overlap.shader_test
tests/spec/arb_enhanced_layouts/linker/block-member-locations/named-block-member-mixed-order-overlap.shader_test

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoglsl/linker: refactor link-time validation of output locations
Iago Toral Quiroga [Thu, 19 Oct 2017 08:57:30 +0000 (10:57 +0200)]
glsl/linker: refactor link-time validation of output locations

Move the checks for explicit locations to a separate function. We
will use this in a follow-up patch to validate locations for interface
variables where we need to validate each interface member rather than
the interface variable itself.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoglsl/linker: report linker errors for invalid explicit locations on inputs
Iago Toral Quiroga [Tue, 24 Oct 2017 08:21:13 +0000 (10:21 +0200)]
glsl/linker: report linker errors for invalid explicit locations on inputs

We were assuming that if an input has an invalid explicit location it would
fail to link because it would not find the corresponding output, however,
since we look for the matching output by indexing the explicit_locations
array with the input location, we still need to ensure that we don't index
out of bounds.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
6 years agoac/llvm: drop pointless wrappers around umsb/imsb
Dave Airlie [Thu, 26 Oct 2017 05:30:33 +0000 (15:30 +1000)]
ac/llvm: drop pointless wrappers around umsb/imsb

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac/llvm: consolidate find lsb function.
Dave Airlie [Thu, 26 Oct 2017 05:28:41 +0000 (15:28 +1000)]
ac/llvm: consolidate find lsb function.

This was the same between si and ac.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac/llvm: drop v4f32empty. (v2)
Dave Airlie [Thu, 26 Oct 2017 05:21:44 +0000 (15:21 +1000)]
ac/llvm: drop v4f32empty. (v2)

This was unused.

v2: drop args.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac/llvm: add i1false/i1true to common code.
Dave Airlie [Thu, 26 Oct 2017 05:20:15 +0000 (15:20 +1000)]
ac/llvm: add i1false/i1true to common code.

These get used in fair few places.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac/llvm: use the ac i32 0/1 and f32 0/1 llvm types.
Dave Airlie [Thu, 26 Oct 2017 05:13:25 +0000 (15:13 +1000)]
ac/llvm: use the ac i32 0/1 and f32 0/1 llvm types.

This just avoids having two copies of these.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoac/nir: move lds declaration/load/store into shared code.
Dave Airlie [Thu, 26 Oct 2017 04:43:51 +0000 (14:43 +1000)]
ac/nir: move lds declaration/load/store into shared code.

This was duplicated between both drivers, share here.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>