platform/upstream/mesa.git
7 years agodisk_cache: Fix issue reading GLSL metadata
Jordan Justen [Sat, 14 Oct 2017 05:04:52 +0000 (22:04 -0700)]
disk_cache: Fix issue reading GLSL metadata

This would cause the read of the metadata content to fail, which would
prevent the linking from being skipped.

Seen on Rocket League with i965 shader cache.

Fixes: b86ecea3446e "util/disk_cache: write cache item metadata to disk"
Cc: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoglsl/shader_cache: Save fs (BlendSupport) metadata
Jordan Justen [Tue, 28 Mar 2017 18:48:55 +0000 (11:48 -0700)]
glsl/shader_cache: Save fs (BlendSupport) metadata

Fixes many GL 4.5 CTS blend tests, such as:

* GL45-CTS.blend_equation_advanced.extension_directive_enable
* GL45-CTS.blend_equation_advanced.extension_directive_warn
* GL45-CTS.blend_equation_advanced.blend_all.GL_MULTIPLY_KHR_all_qualifier
* GL45-CTS.blend_equation_advanced.blend_specific.GL_COLORBURN_KHR

v2:
 * Directly save the BlendSupport field to avoid potentially including
   a pointer in the future in the structure is updated. (tarceri)

Cc: Timothy Arceri <tarceri@itsqueeze.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Initialize sha1 hash of dri config options
Jordan Justen [Sun, 26 Feb 2017 01:36:28 +0000 (17:36 -0800)]
i965: Initialize sha1 hash of dri config options

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Don't link when the program was found in the disk cache
Jordan Justen [Sat, 25 Feb 2017 10:37:57 +0000 (02:37 -0800)]
i965: Don't link when the program was found in the disk cache

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: add cache fallback support using serialized nir
Jordan Justen [Thu, 19 Oct 2017 02:25:48 +0000 (19:25 -0700)]
i965: add cache fallback support using serialized nir

If the i965 gen program cannot be loaded from the cache, then we
fallback to using a serialized nir program.

This is based on "i965: add cache fallback support" by Timothy Arceri
<timothy.arceri@collabora.com>. Tim's version was written to fallback
to compiling from source, and therefore had to be much more complex.
After Connor and Jason implemented nir serialization, I was able to
rewrite and greatly simplify this patch.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: add support for cached shaders with xfb qualifiers
Timothy Arceri [Mon, 23 Jan 2017 21:35:51 +0000 (08:35 +1100)]
i965: add support for cached shaders with xfb qualifiers

For now this disables the shader cache when transform feedback is
enabled via the GL API as we don't currently allow for it when
generating the sha for the shader.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agomesa/glsl: add api_enabled flag to gl_transform_feedback_info
Timothy Arceri [Sat, 19 Nov 2016 05:16:08 +0000 (16:16 +1100)]
mesa/glsl: add api_enabled flag to gl_transform_feedback_info

This will be used to disable the shader cache when xfb is enabled
via the api as we don't currently allow for it when generating the
sha for the shader.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Add shader cache support for compute
Jordan Justen [Thu, 2 Mar 2017 00:52:23 +0000 (16:52 -0800)]
i965: Add shader cache support for compute

v2:
 * Use MAYBE_UNUSED. (Matt)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: add shader cache support for tess stages
Timothy Arceri [Tue, 29 Nov 2016 01:25:54 +0000 (12:25 +1100)]
i965: add shader cache support for tess stages

v2:
 * Use MAYBE_UNUSED. (Matt)

[jordan.l.justen@intel.com: *_cached_program => brw_disk_cache_*_program]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: add shader cache support for geometry shaders
Timothy Arceri [Tue, 29 Nov 2016 01:24:54 +0000 (12:24 +1100)]
i965: add shader cache support for geometry shaders

v2:
 * Use MAYBE_UNUSED. (Matt)

[jordan.l.justen@intel.com: *_cached_program => brw_disk_cache_*_program]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Add shader cache support for vertex and fragment stages
Timothy Arceri [Mon, 23 Jan 2017 21:41:36 +0000 (08:41 +1100)]
i965: Add shader cache support for vertex and fragment stages

This enables the cache on vertex and fragment shaders only.

v2:
 * Use MAYBE_UNUSED. (Matt)

[jordan.l.justen@intel.com: reword subject]
[jordan.l.justen@intel.com: *_cached_program => brw_disk_cache_*_program]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: add initial implementation of on disk shader cache
Timothy Arceri [Fri, 1 Jul 2016 07:02:57 +0000 (17:02 +1000)]
i965: add initial implementation of on disk shader cache

This uses the Mesa disk_cache support to write out the final linked
binary for vertex and fragment shader programs.

This is based off the initial implementation done by Carl Worth. It
has been significantly reworked, first by Tim Arceri, and then by
Jordan Justen.

v2:
 * Squash 'i965: add image param shader cache support'
 * Squash 'i965: add shader cache support for pull param pointers'
 * Sustantially simplified by a rework on top of Jason's 2975e4c56a7a.
 * Rename load_program_data to read_program_data. (Jason)

v3:
 * Simplify and align program read/write. (Jason)

v4:
 * Don't save prog_data size since we know it from the stage. (Ken)
 * Don't save program size, since prog_data includes the size. (Ken)
 * Remove `assert` that potentially could be triggered by disk
   corruption of the cache entries. (Ken)
 * Fix compute shader scratch allocation. (Ken)
 * Remove special case mapping for non-LLC. (Ken)
 * Remove SET_UPLOAD_PARAMS macro

[jordan.l.justen@intel.com: *_cached_program => brw_disk_cache_*_program]
[jordan.l.justen@intel.com: brw_shader_cache.c => brw_disk_cache.c]
[jordan.l.justen@intel.com: don't map to write program when LLC is present]
[jordan.l.justen@intel.com: set program_written_to_cache on read from cache]
[jordan.l.justen@intel.com: only try cache when status is linking_skipped]
[jordan.l.justen@intel.com: all v2-v4 changes noted above]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Calculate thread_count in brw_alloc_stage_scratch
Jordan Justen [Tue, 31 Oct 2017 07:34:32 +0000 (00:34 -0700)]
i965: Calculate thread_count in brw_alloc_stage_scratch

Previously, thread_count was sent in from the stage after some stage
specific calculations. Those stage specific calculations were moved
into brw_alloc_stage_scratch, which will allow the shader cache to
also use the same calculations.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/compiler: Add functions to get prog_data and prog_key sizes for a stage
Jordan Justen [Sat, 21 Oct 2017 08:30:13 +0000 (01:30 -0700)]
intel/compiler: Add functions to get prog_data and prog_key sizes for a stage

v2:
 * Return unsigned instead of size_t. (Ken)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agointel/compiler: Add union types for prog_data and prog_key stages
Jordan Justen [Sat, 21 Oct 2017 08:29:16 +0000 (01:29 -0700)]
intel/compiler: Add union types for prog_data and prog_key stages

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoblob: Don't set overrun if reading 0 bytes at end of data
Jordan Justen [Sat, 21 Oct 2017 09:23:30 +0000 (02:23 -0700)]
blob: Don't set overrun if reading 0 bytes at end of data

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/compiler: Remove final_program_size from brw_compile_*
Jordan Justen [Sun, 22 Oct 2017 03:55:45 +0000 (20:55 -0700)]
intel/compiler: Remove final_program_size from brw_compile_*

The caller can now use brw_stage_prog_data::program_size which is set
by the brw_compile_* functions.

Cc: Jason Ekstrand <jason@jlekstrand.net>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/compiler: add new field for storing program size
Carl Worth [Thu, 14 Apr 2016 00:59:16 +0000 (10:59 +1000)]
intel/compiler: add new field for storing program size

This will be used by the on disk shader cache.

v2:
 * Set in brw_compile_* rather than brw_codegen_*. (Jason)

Signed-off-by: Timothy Arceri <timothy.arceri@collabora.com>
[jordan.l.justen@intel.com: Only add to brw_stage_prog_data]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Don't rely on nir for uses_texture_gather
Jordan Justen [Fri, 28 Jul 2017 22:46:02 +0000 (15:46 -0700)]
i965: Don't rely on nir for uses_texture_gather

When a program is restored from the shader cache, prog->nir will be
NULL, but prog->info will be restored.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965/link: Serialize program to nir after linking for shader cache
Jordan Justen [Fri, 13 Oct 2017 20:07:50 +0000 (13:07 -0700)]
i965/link: Serialize program to nir after linking for shader cache

If the shader cache is enabled, after linking the program, we
serialize the program to nir. This will be saved out by the glsl
shader cache support.

Later, if the same program is found in the cache, we can use the nir
for a fallback in the unlikely case that the gen binary program is not
found in the cache.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoglsl/shader_cache: Save and restore serialized nir in gl_program
Jordan Justen [Fri, 13 Oct 2017 20:02:29 +0000 (13:02 -0700)]
glsl/shader_cache: Save and restore serialized nir in gl_program

v3:
 * Rename serialized_nir* to driver_cache_blob*. (Tim)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agomain: Add driver cache blob fields to gl_program
Jordan Justen [Fri, 13 Oct 2017 20:00:23 +0000 (13:00 -0700)]
main: Add driver cache blob fields to gl_program

These fields can be used to optionally save off a driver blob with the
program metadata. For example, serialized nir, or tgsi.

v3:
 * Rename serialized_nir* to driver_cache_blob*. (Tim)
 * Free memory. (Jason)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agonir: Add hooks for testing serialization
Jason Ekstrand [Thu, 14 Sep 2017 23:49:53 +0000 (16:49 -0700)]
nir: Add hooks for testing serialization

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agonir: add serialization and deserialization
Connor Abbott [Wed, 13 Sep 2017 03:17:51 +0000 (23:17 -0400)]
nir: add serialization and deserialization

v2 (Jason Ekstrand):
 - Various whitespace cleanups
 - Add helpers for reading/writing objects
 - Rework derefs
 - [de]serialize nir_shader::num_*
 - Fix uses of blob_reserve_bytes
 - Use a bitfield struct for packing tex_instr data

v3:
 - Zero nir_variable struct on deserialization. (Jordan)
 - Allow nir_serialize.h to be included in C++. (Jordan)
 - Handle NULL info.name. (Jason)
 - Set info.name to NULL when name is NULL. (Jordan)

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agomesa/st: implement max combined output resources limiting.
Dave Airlie [Tue, 31 Oct 2017 23:54:27 +0000 (09:54 +1000)]
mesa/st: implement max combined output resources limiting.

if the driver sets the cap, then use the value it gives us.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agogallium: add cap for driver specified max combined shader resources.
Dave Airlie [Tue, 31 Oct 2017 23:40:33 +0000 (09:40 +1000)]
gallium: add cap for driver specified max combined shader resources.

Some hw (evergreen) has a limit on how many combined (images/buffers/mrts)
a fragment shader can access.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agor600/sb: bail out if prepare_alu_group() doesn't find a proper scheduling
Gert Wollny [Mon, 16 Oct 2017 19:06:26 +0000 (21:06 +0200)]
r600/sb: bail out if prepare_alu_group() doesn't find a proper scheduling

It is possible that the optimizer ends up in an infinite loop in
post_scheduler::schedule_alu(), because post_scheduler::prepare_alu_group()
does not find a proper scheduling. This can be deducted from
pending.count() being larger than zero and not getting smaller.

This patch works around this problem by signalling this failure so that the
optimizers bails out and the un-optimized shader is used.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103142
Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Gert Wollny <gw.fossdev@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradeonsi: fix culldist_writemask in nir path
Timothy Arceri [Tue, 31 Oct 2017 03:19:18 +0000 (14:19 +1100)]
radeonsi: fix culldist_writemask in nir path

The shared si_create_shader_selector() code already offsets the mask.

Fixes the following piglit tests:

arb_cull_distance/clip-cull-3.shader_test
arb_cull_distance/clip-cull-4.shader_test

Fixes: 29d7bdd179bb (radeonsi: scan NIR shaders to obtain required info)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agonir/opt_intrinsics: Fix values for gl_SubGroupG{e,t}MaskARB
Neil Roberts [Tue, 31 Oct 2017 14:05:33 +0000 (15:05 +0100)]
nir/opt_intrinsics: Fix values for gl_SubGroupG{e,t}MaskARB

Previously the values were calculated by just shifting ~0 by the
invocation ID. This would end up including bits that are higher than
gl_SubGroupSizeARB. The corresponding CTS test effectively requires that
these high bits be zero so it was failing. There is a Piglit test as
well but this appears to checking the wrong values so it passes.

For the two greater-than bitmasks, this patch adds an extra mask with
(~0>>(64-gl_SubGroupSizeARB)) to force these bits to zero.

Fixes: KHR-GL45.shader_ballot_tests.ShaderBallotBitmasks

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102680#c3
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Neil Roberts <nroberts@igalia.com>
7 years agoi965: Check CCS_E compatibility for texture view rendering
Nanley Chery [Thu, 26 Oct 2017 23:05:52 +0000 (16:05 -0700)]
i965: Check CCS_E compatibility for texture view rendering

Only use CCS_E to render to a texture that is CCS_E-compatible with the
original texture's miptree (linear) format. This prevents render
operations from writing data that can't be decoded with the original
miptree format.

On Gen10, with the new CCS_E-enabled formats handled, this enables the
driver to pass the arb_texture_view-rendering-formats piglit test.

v2. Add a TODO for texturing. (Jason)

Cc: <mesa-stable@lists.freedesktop.org>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agointel/isl: Disable some gen10 CCS_E formats for now
Nanley Chery [Wed, 23 Aug 2017 17:51:28 +0000 (10:51 -0700)]
intel/isl: Disable some gen10 CCS_E formats for now

CannonLake additionally supports R11G11B10_FLOAT and four 10-10-10-2
formats with CCS_E. None of these formats fit within the current
blorp_copy framework so disable them until support is added.

Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agomeson: pass correct args to gles2 ABI test
Eric Engestrom [Mon, 30 Oct 2017 15:46:15 +0000 (15:46 +0000)]
meson: pass correct args to gles2 ABI test

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomeson: pass correct args to gles1 ABI test
Eric Engestrom [Mon, 30 Oct 2017 15:46:05 +0000 (15:46 +0000)]
meson: pass correct args to gles1 ABI test

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomeson: pass correct args to gbm symbol test
Eric Engestrom [Mon, 30 Oct 2017 15:45:22 +0000 (15:45 +0000)]
meson: pass correct args to gbm symbol test

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomeson: pass correct args to wayland-egl symbol test
Eric Engestrom [Mon, 30 Oct 2017 15:47:26 +0000 (15:47 +0000)]
meson: pass correct args to wayland-egl symbol test

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoautomake+meson: don't run egl symbol check on libglvnd lib
Eric Engestrom [Mon, 30 Oct 2017 15:43:10 +0000 (15:43 +0000)]
automake+meson: don't run egl symbol check on libglvnd lib

We might want to add a symbol check for the glvnd variant though.

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomeson: pass correct env/args to egl tests
Eric Engestrom [Mon, 30 Oct 2017 15:42:16 +0000 (15:42 +0000)]
meson: pass correct env/args to egl tests

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agogles2: fail symbol check if lib is missing
Eric Engestrom [Mon, 30 Oct 2017 15:28:18 +0000 (15:28 +0000)]
gles2: fail symbol check if lib is missing

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agogles1: fail symbol check if lib is missing
Eric Engestrom [Mon, 30 Oct 2017 15:28:08 +0000 (15:28 +0000)]
gles1: fail symbol check if lib is missing

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agogbm: fail symbol check if lib is missing
Eric Engestrom [Mon, 30 Oct 2017 15:27:25 +0000 (15:27 +0000)]
gbm: fail symbol check if lib is missing

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agowayland-egl: fail symbol check if lib is missing
Eric Engestrom [Mon, 30 Oct 2017 15:27:49 +0000 (15:27 +0000)]
wayland-egl: fail symbol check if lib is missing

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: fail symbol check if lib is missing
Eric Engestrom [Mon, 30 Oct 2017 15:27:10 +0000 (15:27 +0000)]
egl: fail symbol check if lib is missing

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomeson: set visibility flags on gbm
Dylan Baker [Mon, 30 Oct 2017 18:31:45 +0000 (11:31 -0700)]
meson: set visibility flags on gbm

This is done in autotools, and is an oversight in the meson build.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Tested-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agomeson: Don't link gbm with threads
Dylan Baker [Mon, 30 Oct 2017 18:30:34 +0000 (11:30 -0700)]
meson: Don't link gbm with threads

It's supposed to be linked with pthread-stubs (if the platform needs
pthread-stubs). Pthread stubs support isn't (yet) implemented in the
meson build, so add a TODO.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agomeson: Use true and false instead of yes and no for tristate options
Dylan Baker [Mon, 30 Oct 2017 17:27:48 +0000 (10:27 -0700)]
meson: Use true and false instead of yes and no for tristate options

This allows a user to not care whether they're setting a tristate or a
boolean option, which is a nice user facing feature, and something I've
personally run into.

Suggested-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agowinsys/amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
Andrey Grodzovsky [Tue, 31 Oct 2017 15:40:12 +0000 (11:40 -0400)]
winsys/amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
7 years agomeson: do not search for needless deps
Erik Faye-Lund [Wed, 25 Oct 2017 08:02:38 +0000 (10:02 +0200)]
meson: do not search for needless deps

If we don't want to use these deps, there's no good reason to search
for them in the first place. This should shave a bit of time for the
initial build.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agoradv: bail out when binding the same vertex buffers
Samuel Pitoiset [Mon, 30 Oct 2017 18:37:39 +0000 (19:37 +0100)]
radv: bail out when binding the same vertex buffers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: bail out when binding the same index buffer
Samuel Pitoiset [Mon, 30 Oct 2017 16:12:05 +0000 (17:12 +0100)]
radv: bail out when binding the same index buffer

DOW3 appears to hit this path.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agomeson: use dep_m in libgallium
Erik Faye-Lund [Sat, 28 Oct 2017 12:36:04 +0000 (14:36 +0200)]
meson: use dep_m in libgallium

The u_format_other.c users sqrtf, which on some systems require
a math-library. So let's make sure we link with it.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
7 years agoradv: use correct alloc function when loading from disk
Timothy Arceri [Tue, 31 Oct 2017 00:31:19 +0000 (11:31 +1100)]
radv: use correct alloc function when loading from disk

Fixes regression in:

dEQP-VK.api.object_management.alloc_callback_fail.graphics_pipeline

Fixes: 1e84e53712ae "radv: add cache items to in memory cache when reading from disk"
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoi965: Fix ARB_indirect_parameters logic.
Plamena Manolova [Mon, 30 Oct 2017 21:14:24 +0000 (21:14 +0000)]
i965: Fix ARB_indirect_parameters logic.

This patch modifies the ARB_indirect_parameters logic in
brw_draw_prims, so that our implementation isn't affected if
another application attempts to use predicates. Previously we
were using a predicate with a DELTAS_EQUAL comparison operation
and relying on the MI_PREDICATE_DATA register being 0. Our code
to initialize MI_PREDICATE_DATA to 0 was incorrect, so we were
accidentally using whatever value was written there. Because the
kernel does not initialize the MI_PREDICATE_DATA register on
hardware context creation, we might inherit the value from whatever
context was last running on the GPU (likely another process).
The Haswell command parser also does not currently allow us to write
the MI_PREDICATE_DATA register. Rather than fixing this and requiring
an updated kernel, we switch to a different approach which uses a
SRCS_EQUAL predicate that makes no assumptions about the states of any
of the predicate registers.

Fixes Piglit's spec/arb_indirect_parameters/tf-count-arrays test.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103085
Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoi965: Don't flag BRW_NEW_SURFACES unless some push constants are dirty.
Kenneth Graunke [Fri, 20 Oct 2017 22:38:52 +0000 (15:38 -0700)]
i965: Don't flag BRW_NEW_SURFACES unless some push constants are dirty.

Due to a gaffe on my part, we were re-emitting all binding table entries
on every single draw call.  The push_constant_packets atom listens to
BRW_NEW_DRAW_CALL, but skips emitting 3DSTATE_CONSTANT_XS for each stage
unless stage_state->push_constants_dirty is true.  However, it flagged
BRW_NEW_SURFACES unconditionally at the end, by mistake.

Instead, it should only flag it if we actually emit 3DSTATE_CONSTANT_XS
for a stage.  We can move it a few lines up, inside the loop - the early
continues will skip over it if push constants aren't dirty for a stage.

With INTEL_NO_HW=1 set, improves performance of GFXBench5 gl_driver_2
on Apollolake at 1280x720 by 1.01122% +/- 0.470723% (n=35).

Reviewed-by: Rafael Antognolli <rafael.antognolli@intel.com>
7 years agointel/genxml: Fix decoding of groups with fields smaller than a DWord.
Kenneth Graunke [Thu, 26 Oct 2017 03:33:33 +0000 (20:33 -0700)]
intel/genxml: Fix decoding of groups with fields smaller than a DWord.

Groups containing fields smaller than a DWord were not being decoded
correctly.  For example:

    <group count="32" start="32" size="4">
      <field name="Vertex Element Enables" start="0" end="3" type="uint"/>
    </group>

gen_field_iterator_next would properly walk over each element of the
array, incrementing group_iter, and calling iter_group_offset_bits()
to advance to the proper DWord.  However, the code to print the actual
values only considered iter->field->start/end, which are 0 and 3 in the
above example.  So it would always fetch bits 3:0 of the current DWord
when printing values, instead of advancing to each element of the array,
printing bits 0-3, 4-7, 8-11, and so on.

To fix this, we add new iter->start/end tracking, which properly
advances for each instance of a group's field.

Caught by Matt Turner while working on 3DSTATE_VF_COMPONENT_PACKING,
with a patch to convert it to use an array of bitfields (the example
above).

This also fixes the decoding of 3DSTATE_SBE's "Attribute Active
Component Format" fields.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoglsl: Fix bad formatting in a comment
Ian Romanick [Thu, 26 Oct 2017 22:32:09 +0000 (15:32 -0700)]
glsl: Fix bad formatting in a comment

Trivial

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
7 years agobroadcom/vc5: Force blending to treat alpha as 1 for formats without alpha.
Eric Anholt [Fri, 27 Oct 2017 22:52:22 +0000 (15:52 -0700)]
broadcom/vc5: Force blending to treat alpha as 1 for formats without alpha.

Fixes fbo-blending-formats on RGB8 and 565.  We will still need to demote
blending to shader code in the MRT case to fix it in general, but that can
be added when we start doing 32F blending (which also needs to be done in
the shader).

7 years agobroadcom/vc5: Do BGRA vs RGBA swapping for the BLEND_CONSTANT_COLOR.
Eric Anholt [Fri, 27 Oct 2017 21:41:35 +0000 (14:41 -0700)]
broadcom/vc5: Do BGRA vs RGBA swapping for the BLEND_CONSTANT_COLOR.

Fixes many of the fbo-blending-formats tests.

7 years agobroadcom/vc5: Pack clear colors according to the TLB internal format/type.
Eric Anholt [Fri, 27 Oct 2017 21:13:46 +0000 (14:13 -0700)]
broadcom/vc5: Pack clear colors according to the TLB internal format/type.

The previous packing I did got us all the R*16F and R*32F formats, where
the pipe format basically matched the TLB's format, but since the clear
color will just be memcpyed to the TLB, we should be looking at its format
for deciding how to pack.

Fixes RGB565, RGB5_A1 and RGBA10 fbo-clear-formats tests and improves
4444.

7 years agobroadcom/vc5: Don't do r/b channel swapping on 565.
Eric Anholt [Mon, 30 Oct 2017 17:13:52 +0000 (10:13 -0700)]
broadcom/vc5: Don't do r/b channel swapping on 565.

The HW's format actually matches the gallium format.

7 years agobroadcom/vc5: Use the proper gallium format for our RGB10_A2.
Eric Anholt [Fri, 27 Oct 2017 21:08:02 +0000 (14:08 -0700)]
broadcom/vc5: Use the proper gallium format for our RGB10_A2.

This keeps us from needing our own reswizzling of the B vs R fields.

7 years agobroadcom/vc5: Add some comments about the texture/output format ordering.
Eric Anholt [Fri, 27 Oct 2017 20:27:22 +0000 (13:27 -0700)]
broadcom/vc5: Add some comments about the texture/output format ordering.

The output formats are consistent with their channels appearing from low
to high in their name.  Textures are interpreted the same way, but their
names may have the channels swapped around.  I'm retaining the texture
names so that we are consistent with the documentation, but I want to
leave a warning for others.

7 years agobroadcom/vc5: Drop duplicated setup of clip_window_height_in_pixels.
Eric Anholt [Thu, 26 Oct 2017 23:03:59 +0000 (16:03 -0700)]
broadcom/vc5: Drop duplicated setup of clip_window_height_in_pixels.

7 years agobroadcom/vc5: Don't forget to actually turn on stencil testing.
Eric Anholt [Thu, 26 Oct 2017 22:59:21 +0000 (15:59 -0700)]
broadcom/vc5: Don't forget to actually turn on stencil testing.

I had the rest of stencil state set up, but forgot to actually enable it
in the higher level configuration bits packet.

7 years agobroadcom/vc5: Stop lowering negates to subs.
Eric Anholt [Thu, 26 Oct 2017 22:40:38 +0000 (15:40 -0700)]
broadcom/vc5: Stop lowering negates to subs.

In the case of fneg(0.0), we were getting back 0.0 instead of -0.0.  We
were also needing an immediate 0 value for ineg, when there's an opcode to
do the job properly.

Fixes fs-floatBitsToInt-neg.shader_test.

7 years agobroadcom/vc5: Set up MSAA texture type according to the internal format.
Eric Anholt [Wed, 25 Oct 2017 20:00:44 +0000 (13:00 -0700)]
broadcom/vc5: Set up MSAA texture type according to the internal format.

It gets most of EXT_framebuffer_multisample-formats passing, but doesn't
really work for texture views.

7 years agobroadcom/vc5: Use the sampler view's format, not the resource's.
Eric Anholt [Wed, 25 Oct 2017 19:51:04 +0000 (12:51 -0700)]
broadcom/vc5: Use the sampler view's format, not the resource's.

This should help with texture views, though I just noticed this while
reading the code.

7 years agobroadcom/vc5: Emit raw loads for MSAA buffers.
Eric Anholt [Wed, 25 Oct 2017 19:29:51 +0000 (12:29 -0700)]
broadcom/vc5: Emit raw loads for MSAA buffers.

Similar to stores, but we also need to emit dummy stores in between each
load, to flush out the previous queued load.

7 years agobroadcom/vc5: Use raw stores for MSAA buffers.
Eric Anholt [Tue, 24 Oct 2017 20:28:53 +0000 (13:28 -0700)]
broadcom/vc5: Use raw stores for MSAA buffers.

We were storing the resolved pixels in all cases, but nr_samples > 0 means
we should be keeping the per-sample values.

We will probably want to change the job structure at some point, as we'll
want to recognize full-buffer resolves and do the resolved store in the
same job as the original rendering, meaning we'll need to track both the
MSAA and single-sample resources in the job.  However, this will be enough
to build the rest of the MSAA support.

7 years agobroadcom/vc5: Add lowering for txf_ms to a txf on a 2x2-scaled texture.
Eric Anholt [Tue, 24 Oct 2017 19:16:50 +0000 (12:16 -0700)]
broadcom/vc5: Add lowering for txf_ms to a txf on a 2x2-scaled texture.

The HW has no native sampler support for multisample textures, but since
we only need to support txf_ms and the layout is UIF, we just need to
scale up the texcoords and then add in the sample.

This drops the old TEXTURE_MSAA_ADDR special uniform, since we're treating
MSAA textures as textures, rather than basically texbos like VC4 had to.

7 years agobroadcom/vc5: Lay out MSAA textures/renderbuffers as UIF scaled by 4.
Eric Anholt [Wed, 25 Oct 2017 01:45:57 +0000 (18:45 -0700)]
broadcom/vc5: Lay out MSAA textures/renderbuffers as UIF scaled by 4.

We just need to multiply width/height by 2 each, and always set them up as
UIF tiling, since that's how the TLB will store them in raw (per-sample)
mode.

7 years agobroadcom/vc5: Keep output height pad out of the store TLB general address.
Eric Anholt [Wed, 25 Oct 2017 01:35:00 +0000 (18:35 -0700)]
broadcom/vc5: Keep output height pad out of the store TLB general address.

The equivalent load already had the pad separated out.

7 years agobroadcom/vc5: Drop padding bits from the texture shader state's address.
Eric Anholt [Wed, 25 Oct 2017 02:14:29 +0000 (19:14 -0700)]
broadcom/vc5: Drop padding bits from the texture shader state's address.

7 years agobroadcom/vc5: Drop alignment bits from texture P1's address.
Eric Anholt [Wed, 25 Oct 2017 02:14:08 +0000 (19:14 -0700)]
broadcom/vc5: Drop alignment bits from texture P1's address.

7 years agobroadcom/vc5: Drop alignment bits from Z/S rendering mode config address.
Eric Anholt [Wed, 25 Oct 2017 02:13:17 +0000 (19:13 -0700)]
broadcom/vc5: Drop alignment bits from Z/S rendering mode config address.

Improves CLIF dumping output.

7 years agobroadcom/xml: Fix address packing for address with >= 8 alignment bits.
Eric Anholt [Wed, 25 Oct 2017 02:10:37 +0000 (19:10 -0700)]
broadcom/xml: Fix address packing for address with >= 8 alignment bits.

We were handing the intra-byte padding fine, but with a 24-bit address
(bottom 8 bits implied 0) we would end up off by 8 bytes in our shift,
impacting vc5's load/store general packets (all other packets we have had
<8 bits of padding).

7 years agobroadcom/clif: Print out the contents of the generic tile list.
Eric Anholt [Wed, 25 Oct 2017 00:55:03 +0000 (17:55 -0700)]
broadcom/clif: Print out the contents of the generic tile list.

This is the real meat of the RCL, so let's get it printed again.

7 years agobroadcom/clif: Move the CL printing part of CL dumps to a helper.
Eric Anholt [Wed, 25 Oct 2017 00:52:31 +0000 (17:52 -0700)]
broadcom/clif: Move the CL printing part of CL dumps to a helper.

This will let me reuse the printing for processing branches to other CLs.

7 years agobroadcom/vc5: Lower unpack_*_4x8 to normal math.
Eric Anholt [Tue, 24 Oct 2017 20:08:17 +0000 (13:08 -0700)]
broadcom/vc5: Lower unpack_*_4x8 to normal math.

We only have 2x16 unpacking in our ALUs.  To enable this, we also need
lower_fdiv for its new instructions, which had been handled at a higher
level previously.

7 years agobroadcom/vc5: Add PIPE_TEX_WRAP_CLAMP support for linear-filtered textures.
Eric Anholt [Tue, 24 Oct 2017 19:29:39 +0000 (12:29 -0700)]
broadcom/vc5: Add PIPE_TEX_WRAP_CLAMP support for linear-filtered textures.

I already had the texture's wrapping set up to use different behavior for
nearest or linear, so we just needed to saturate the coordinates in linear
mode to get the "proper" blend between the edge and border values.

7 years agobroadcom/vc5: Disable GL_ARB_transform_feedback3.
Eric Anholt [Tue, 24 Oct 2017 17:36:07 +0000 (10:36 -0700)]
broadcom/vc5: Disable GL_ARB_transform_feedback3.

We don't seem to have a way to generally handle gl_SkipComponents.

7 years agobroadcom/vc5: Fix gl_FragCoord pixel center setup.
Eric Anholt [Tue, 24 Oct 2017 17:12:37 +0000 (10:12 -0700)]
broadcom/vc5: Fix gl_FragCoord pixel center setup.

Fixes glsl-arb-fragment-coord-conventions.

7 years agobroadcom/vc5: Always set up 1D textures as raster order.
Eric Anholt [Tue, 24 Oct 2017 16:53:32 +0000 (09:53 -0700)]
broadcom/vc5: Always set up 1D textures as raster order.

1D is the exception to "all V3D textures are tiled", since tiling 1D
textures would just waste memory and cache space.  This ended up being a
problem once we started actually marking 1D textures as 1D instead of 2D.

7 years agobroadcom/xml: Throw an #error in XML-based codegen for a >1bit bool
Eric Anholt [Mon, 23 Oct 2017 19:47:28 +0000 (12:47 -0700)]
broadcom/xml: Throw an #error in XML-based codegen for a >1bit bool

I've debugged two nasty errors now due to copy-and-pasting a bool type
when writing a uint field.  Make sure I don't do that again.

7 years agobroadcom/vc4: Fix bool marking on Rasterizer Oversample Mode.
Eric Anholt [Mon, 23 Oct 2017 19:45:59 +0000 (12:45 -0700)]
broadcom/vc4: Fix bool marking on Rasterizer Oversample Mode.

We don't set this field using the XML codegen, but this would help us
decode the right value in case of 16x (VG) oversampling.

7 years agobroadcom/vc5: Mark lookup type as uint, not bool.
Eric Anholt [Mon, 23 Oct 2017 19:40:35 +0000 (12:40 -0700)]
broadcom/vc5: Mark lookup type as uint, not bool.

Fixes non-2D texturing.

7 years agobroadcom/vc5: Fix GPU hang with no vertex elements used by the VS.
Eric Anholt [Mon, 23 Oct 2017 17:30:37 +0000 (10:30 -0700)]
broadcom/vc5: Fix GPU hang with no vertex elements used by the VS.

Like VC4, we need to at least have one element set up, but unlike VC4 it
seems we don't need to read it to keep the HW happy.  Fixes GPU hangs with
glsl-no-vertex-attribs.shader_test.

7 years agogit_sha1_gen: create empty file in fallback path
Eric Engestrom [Sun, 29 Oct 2017 22:06:28 +0000 (22:06 +0000)]
git_sha1_gen: create empty file in fallback path

I missed this part in my conversion, the old stream redirection meant
the file was always created.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103496
Fixes: 7088622e5fb506b64c90 "buildsys: move file regeneration logic to
       the script itself"
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
7 years agointel: common: silence compiler warning
Lionel Landwerlin [Fri, 27 Oct 2017 16:44:14 +0000 (17:44 +0100)]
intel: common: silence compiler warning

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoglsl/linker: Check that re-declared, inter-shader built-in blocks match
Eduardo Lima Mitev [Sun, 5 Mar 2017 19:28:43 +0000 (20:28 +0100)]
glsl/linker: Check that re-declared, inter-shader built-in blocks match

>From GLSL 4.5 spec, section "7.1 Built-In Language Variables", page 130 of
the PDF states:

    "If multiple shaders using members of a built-in block belonging to
     the same interface are linked together in the same program, they must
     all redeclare the built-in block in the same way, as described in
     section 4.3.9 “Interface Blocks” for interface-block matching, or a
     link-time error will result."

Fixes:
* GL45-CTS.CommonBugs.CommonBug_PerVertexValidation

v2 (Neil Roberts):
Explicitly look for gl_PerVertex in the symbol tables instead of
waiting to find a variable in the interface.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102677
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eduardo Lima Mitev <elima@igalia.com>
Signed-off-by: Neil Roberts <nroberts@igalia.com>
7 years agoglsl: Use the utility function to copy symbols between symbol tables
Eduardo Lima Mitev [Sun, 5 Mar 2017 19:28:42 +0000 (20:28 +0100)]
glsl: Use the utility function to copy symbols between symbol tables

This effectively factorizes a couple of similar routines.

v2 (Neil Roberts): Non-trivial rebase on master

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eduardo Lima Mitev <elima@igalia.com>
Signed-off-by: Neil Roberts <nroberts@igalia.com>
7 years agoglsl_parser_extra: Add utility to copy symbols between symbol tables
Eduardo Lima Mitev [Sun, 5 Mar 2017 19:28:41 +0000 (20:28 +0100)]
glsl_parser_extra: Add utility to copy symbols between symbol tables

Some symbols gathered in the symbols table during parsing are needed
later for the compile and link stages, so they are moved along the
process. Currently, only functions and non-temporary variables are
copied between symbol tables. However, the built-in gl_PerVertex
interface blocks are also needed during the linking stage (the last
step), to match re-declared blocks of inter-stage shaders.

This patch adds a new utility function that will factorize current code
that copies functions and variables between two symbol tables, and in
addition will copy explicitly declared gl_PerVertex blocks too.

The function will be used in a subsequent patch.

v2 (Neil Roberts):
Allow the src symbol table to be NULL and explicitly copy the
gl_PerVertex symbols in case they are not referenced in the exec_list.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eduardo Lima Mitev <elima@igalia.com>
Signed-off-by: Neil Roberts <nroberts@igalia.com>
7 years agoi965: remove unused variable
Eric Engestrom [Mon, 30 Oct 2017 10:35:34 +0000 (10:35 +0000)]
i965: remove unused variable

Fixes: 2c873060d3578c7004c0 "i965: Delete unused
       brw_vs_prog_data::nr_attributes field."
Cc: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>