platform/upstream/mesa.git
8 years agotgsi/text: add str_match_format helper function
Nicolai Hähnle [Thu, 28 Apr 2016 22:07:44 +0000 (17:07 -0500)]
tgsi/text: add str_match_format helper function

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi/build: pass Memory.Texture and .Format through tgsi_build_full_instruction
Nicolai Hähnle [Thu, 28 Apr 2016 22:34:40 +0000 (17:34 -0500)]
tgsi/build: pass Memory.Texture and .Format through tgsi_build_full_instruction

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi/dump: signal nospace when the last print exceeded the size
Nicolai Hähnle [Thu, 28 Apr 2016 20:51:25 +0000 (15:51 -0500)]
tgsi/dump: signal nospace when the last print exceeded the size

Previously, there was a bug where nospace wasn't signalled if it just so
happened that the very last print exceeded the available space.

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agotgsi/dump: shared dump_ctx initialization
Nicolai Hähnle [Thu, 28 Apr 2016 20:29:23 +0000 (15:29 -0500)]
tgsi/dump: shared dump_ctx initialization

Reviewed-by: Dave Airlie <airlied@redhat.com>
8 years agost/omx: don't return early in vid_enc_EncodeFrame()
Emil Velikov [Fri, 29 Apr 2016 12:51:45 +0000 (13:51 +0100)]
st/omx: don't return early in vid_enc_EncodeFrame()

Earlier commit plugged a memory leak, although it missed a pair of
brackets. Thus we unconditionally returned even in the case of no error.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95203
Fixes: b87856d25d1 ("st/omx: Fix resource leak on OMX_ErrorNone")
Tested-by: Andy Furniss <adf.lists@gmail.com>
Acked-by: Robert Foss <robert.foss@collabora.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
---
What an embarassing bug - missing brackets. Andy can you confirm that it
resolves the issue ?

8 years agoglsl: Checks for interpolation into its own function.
Andres Gomez [Wed, 23 Mar 2016 23:13:26 +0000 (01:13 +0200)]
glsl: Checks for interpolation into its own function.

This generalizes the validation also to be done for variables inside
interface blocks, which, for some cases, was missing.

For a discussion about the additional validation cases included see
https://lists.freedesktop.org/archives/mesa-dev/2016-March/109117.html
and Khronos bug #15671.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
8 years agonir/algebraic: Support lowering for both 64 and 32-bit ldexp
Jason Ekstrand [Wed, 27 Apr 2016 18:18:04 +0000 (11:18 -0700)]
nir/algebraic: Support lowering for both 64 and 32-bit ldexp

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agonir/opcodes: Make ldexp take an explicitly 32-bit int
Jason Ekstrand [Wed, 27 Apr 2016 18:12:44 +0000 (11:12 -0700)]
nir/opcodes: Make ldexp take an explicitly 32-bit int

There is no sense in having the double version of ldexp take a 64-bit
integer.  Instead, let's just take a 32-bit int all the time.  This also
matches what GLSL does where both variants of ldexp take a regular integer
for the exponent argument.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agonir/opcodes: Simplify the expressions for [un]pack_double
Jason Ekstrand [Wed, 27 Apr 2016 17:57:00 +0000 (10:57 -0700)]
nir/opcodes: Simplify the expressions for [un]pack_double

The new expressions are more explicit in terms of where the bits go so it's
a little easier to tell what's going on.  This is the way GLSL specifies
things so it's a bit easier to verify too.  It also has the benifit that
the new expressions easily vectorize so we can constant-fold vector forms
of the _split versions correctly.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agomesa: Fix indirect draw buffer size check on 32-bit systems.
Kenneth Graunke [Tue, 26 Apr 2016 05:34:37 +0000 (22:34 -0700)]
mesa: Fix indirect draw buffer size check on 32-bit systems.

Fixes dEQP-GLES31.functional subtests:
draw_indirect.negative.command_offset_not_in_buffer_signed32_wrap
draw_indirect.negative.command_offset_not_in_buffer_unsigned32_wrap

These tests use really large values that overflow GLsizeiptr, at
which point the buffer size isn't less than "end".

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95138
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
8 years agonir: Switch the arguments to nir_foreach_def
Jason Ekstrand [Wed, 27 Apr 2016 03:34:01 +0000 (20:34 -0700)]
nir: Switch the arguments to nir_foreach_def

This matches the "foreach x in container" pattern found in many other
programming languages.  Generated by the following regular expression:

s/nir_foreach_def(\([^,]*\),\s*\([^,]*\))/nir_foreach_def(\2, \1)/

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agonir: Switch the arguments to nir_foreach_use and friends
Jason Ekstrand [Wed, 27 Apr 2016 03:30:10 +0000 (20:30 -0700)]
nir: Switch the arguments to nir_foreach_use and friends

This matches the "foreach x in container" pattern found in many other
programming languages.  Generated by the following regular expression:

s/nir_foreach_use(\([^,]*\),\s*\([^,]*\))/nir_foreach_use(\2, \1)/

and similar expressions for nir_foreach_use_safe, etc.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agonir: Switch the arguments to nir_foreach_function
Jason Ekstrand [Wed, 27 Apr 2016 03:26:42 +0000 (20:26 -0700)]
nir: Switch the arguments to nir_foreach_function

This matches the "foreach x in container" pattern found in many other
programming languages.  Generated by the following regular expression:

s/nir_foreach_function(\([^,]*\),\s*\([^,]*\))/nir_foreach_function(\2, \1)/

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agonir: Switch the arguments to nir_foreach_parallel_copy_entry
Jason Ekstrand [Wed, 27 Apr 2016 03:21:27 +0000 (20:21 -0700)]
nir: Switch the arguments to nir_foreach_parallel_copy_entry

This matches the "foreach x in container" pattern found in many other
programming languages.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agonir: Switch the arguments to nir_foreach_phi_src
Jason Ekstrand [Wed, 27 Apr 2016 03:16:21 +0000 (20:16 -0700)]
nir: Switch the arguments to nir_foreach_phi_src

This matches the "foreach x in container" pattern found in many other
programming languages.  Generated by the following regular expression:

s/nir_foreach_phi_src(\([^,]*\),\s*\([^,]*\))/nir_foreach_phi_src(\2, \1)/

and a similar expression for nir_foreach_phi_src_safe.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
8 years agonir: Switch the arguments to nir_foreach_instr
Jason Ekstrand [Wed, 27 Apr 2016 01:34:19 +0000 (18:34 -0700)]
nir: Switch the arguments to nir_foreach_instr

This matches the "foreach x in container" pattern found in many other
programming languages.  Generated by the following regular expression:

s/nir_foreach_instr(\([^,]*\),\s*\([^,]*\))/nir_foreach_instr(\2, \1)/

and similar expressions for nir_foreach_instr_safe etc.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoanv/lower_push_constants: fixup for nir_foreach_block()
Jason Ekstrand [Wed, 20 Apr 2016 04:20:26 +0000 (21:20 -0700)]
anv/lower_push_constants: fixup for nir_foreach_block()

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/apply_pipeline_layout: fixup for nir_foreach_block()
Jason Ekstrand [Wed, 20 Apr 2016 04:19:56 +0000 (21:19 -0700)]
anv/apply_pipeline_layout: fixup for nir_foreach_block()

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/apply_dynamic_offsets: fixup for nir_foreach_block()
Jason Ekstrand [Wed, 20 Apr 2016 04:18:56 +0000 (21:18 -0700)]
anv/apply_dynamic_offsets: fixup for nir_foreach_block()

Signed-off-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoi965/nir: fixup for new foreach_block()
Connor Abbott [Wed, 13 Apr 2016 02:56:14 +0000 (22:56 -0400)]
i965/nir: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/algebraic: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 19:30:22 +0000 (15:30 -0400)]
nir/algebraic: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/validate: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 19:17:46 +0000 (15:17 -0400)]
nir/validate: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/nir_worklist: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 19:16:14 +0000 (15:16 -0400)]
nir/nir_worklist: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/remove_dead_variables: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 19:14:04 +0000 (15:14 -0400)]
nir/remove_dead_variables: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/split_var_copies: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 19:10:03 +0000 (15:10 -0400)]
nir/split_var_copies: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/repair_ssa: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 19:06:20 +0000 (15:06 -0400)]
nir/repair_ssa: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/opt_peephole_select: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 19:03:41 +0000 (15:03 -0400)]
nir/opt_peephole_select: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/phi_builder: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 18:57:35 +0000 (14:57 -0400)]
nir/phi_builder: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/opt_cp: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 18:55:19 +0000 (14:55 -0400)]
nir/opt_cp: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/opt_remove_phis: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 18:49:09 +0000 (14:49 -0400)]
nir/opt_remove_phis: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/opt_undef: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 18:46:03 +0000 (14:46 -0400)]
nir/opt_undef: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/opt_dead_cf: fixup for new foreach_block()
Connor Abbott [Tue, 12 Apr 2016 18:43:16 +0000 (14:43 -0400)]
nir/opt_dead_cf: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/opt_dce: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 21:43:48 +0000 (17:43 -0400)]
nir/opt_dce: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/opt_gcm: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 21:40:02 +0000 (17:40 -0400)]
nir/opt_gcm: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/opt_constant_folding: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 21:37:40 +0000 (17:37 -0400)]
nir/opt_constant_folding: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_samplers: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 21:33:42 +0000 (17:33 -0400)]
nir/lower_samplers: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/normalize_cubemap_coords: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 21:29:45 +0000 (17:29 -0400)]
nir/normalize_cubemap_coords: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_var_copies: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 21:25:10 +0000 (17:25 -0400)]
nir/lower_var_copies: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/move_vec_src_uses_to_dest: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 21:18:45 +0000 (17:18 -0400)]
nir/move_vec_src_uses_to_dest: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_vars_to_ssa: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 20:39:38 +0000 (16:39 -0400)]
nir/lower_vars_to_ssa: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_vec_to_movs: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 20:37:04 +0000 (16:37 -0400)]
nir/lower_vec_to_movs: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_idiv: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 20:32:58 +0000 (16:32 -0400)]
nir/lower_idiv: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_to_source_mods: fixup for new foreeach_block()
Connor Abbott [Fri, 8 Apr 2016 20:18:55 +0000 (16:18 -0400)]
nir/lower_to_source_mods: fixup for new foreeach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_io: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 20:16:56 +0000 (16:16 -0400)]
nir/lower_io: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_system_values: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 20:15:14 +0000 (16:15 -0400)]
nir/lower_system_values: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_phis_to_scalar: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 20:12:30 +0000 (16:12 -0400)]
nir/lower_phis_to_scalar: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_indirect_derefs: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 20:10:16 +0000 (16:10 -0400)]
nir/lower_indirect_derefs: fixup for new foreach_block()

v2 (Jason Ekstrand): Use nir_foreach_block_safe

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/nir_lower_global_vars: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 20:06:16 +0000 (16:06 -0400)]
nir/nir_lower_global_vars: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_atomics: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 20:01:50 +0000 (16:01 -0400)]
nir/lower_atomics: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_load_const: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 19:57:40 +0000 (15:57 -0400)]
nir/lower_load_const: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_locals_to_regs: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 19:56:09 +0000 (15:56 -0400)]
nir/lower_locals_to_regs: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_gs_intrinsics: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 19:53:46 +0000 (15:53 -0400)]
nir/lower_gs_intrinsics: fixup for new foreach_block()

v2 (Jason Ekstrand): Use nir_foreach_block_safe

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/nir: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 19:51:26 +0000 (15:51 -0400)]
nir/nir: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_clip: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 19:47:40 +0000 (15:47 -0400)]
nir/lower_clip: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_alu_to_scalar: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 19:39:24 +0000 (15:39 -0400)]
nir/lower_alu_to_scalar: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/liveness: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 19:30:02 +0000 (15:30 -0400)]
nir/liveness: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/inline_functions: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 19:24:36 +0000 (15:24 -0400)]
nir/inline_functions: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/from_ssa: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 19:12:40 +0000 (15:12 -0400)]
nir/from_ssa: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/dominance: fixup for new foreach_block()
Connor Abbott [Fri, 8 Apr 2016 19:01:28 +0000 (15:01 -0400)]
nir/dominance: fixup for new foreach_block()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonvc0: stick compute kernel arguments into uniform_bo
Samuel Pitoiset [Mon, 25 Apr 2016 21:14:03 +0000 (23:14 +0200)]
nvc0: stick compute kernel arguments into uniform_bo

Having one buffer object for input kernel arguments coming from clover
and an other one for OpenGL user uniforms is unnecessary. Using the
uniform_bo object for both GL/CL uniforms avoids to declare a new BO.

This only affects compute programs but it should not hurt anything
because the states are dirtied and data will get reuploaded.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoswr: remove duplicated constant update code
Tim Rowley [Thu, 28 Apr 2016 01:11:41 +0000 (20:11 -0500)]
swr: remove duplicated constant update code

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
8 years agogallium/radeon: add the size only once in r600_context_add_resource_size
Marek Olšák [Thu, 28 Apr 2016 14:57:09 +0000 (16:57 +0200)]
gallium/radeon: add the size only once in r600_context_add_resource_size

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agowinsys/radeon: enlarge buffer_indices_hashlist
Bas Nieuwenhuizen [Tue, 8 Mar 2016 15:01:47 +0000 (16:01 +0100)]
winsys/radeon: enlarge buffer_indices_hashlist

Enlarge the buffer hashlist to prevent large numbers of misses
due to adding more buffers than can be cached in the hashlist.

Ported from winsys/amdgpu: 6373845d985d65c00f7c62b793e67ae5106eabff

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agogallium/radeon: drop support for LINEAR_GENERAL layout
Marek Olšák [Fri, 22 Apr 2016 21:39:23 +0000 (23:39 +0200)]
gallium/radeon: drop support for LINEAR_GENERAL layout

Unused. All texture imports use LINEAR_ALIGNED regardless of what
the DDX does.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
8 years agoradeonsi: rework clear_buffer flags
Marek Olšák [Fri, 22 Apr 2016 08:26:28 +0000 (10:26 +0200)]
radeonsi: rework clear_buffer flags

Changes:
- don't flush DB for fast color clears
- don't flush any caches for initial clears
- remove the flag from si_copy_buffer, always assume shader coherency

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoanv/dynamic_offsets: Fix the order of arguments to nir_build_imm
Jason Ekstrand [Thu, 28 Apr 2016 18:05:56 +0000 (11:05 -0700)]
anv/dynamic_offsets: Fix the order of arguments to nir_build_imm

8 years agoanv: Fix a build error caused by recent fp64 NIR changes
Jason Ekstrand [Thu, 28 Apr 2016 17:13:42 +0000 (10:13 -0700)]
anv: Fix a build error caused by recent fp64 NIR changes

8 years agonir: Try to warn when C99 extensions are used in nir headers.
Jose Fonseca [Thu, 28 Apr 2016 11:25:15 +0000 (12:25 +0100)]
nir: Try to warn when C99 extensions are used in nir headers.

Ideally we'd have nir.h being included with -Wpedantic too, but it fails
with:

src/compiler/nir/nir.h:754:20: warning: ISO C++ forbids zero-size array ‘src’ [-Wpedantic]
    nir_alu_src src[];
                    ^
In file included from src/compiler/nir/glsl_to_nir.cpp:42:0:
src/compiler/nir/nir.h:919:16: warning: ISO C++ forbids zero-size array ‘src’ [-Wpedantic]
    nir_src src[];

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir: Remove spurious ; after nir_builder functions.
Jose Fonseca [Thu, 28 Apr 2016 11:19:13 +0000 (12:19 +0100)]
nir: Remove spurious ; after nir_builder functions.

Makes -pedantic happy.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir: Remove spurious ; after namespace.
Jose Fonseca [Thu, 28 Apr 2016 11:18:34 +0000 (12:18 +0100)]
nir: Remove spurious ; after namespace.

Makes -pedantic happy.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
8 years agonir: Avoid C99 field initializers.
Jose Fonseca [Thu, 28 Apr 2016 11:17:42 +0000 (12:17 +0100)]
nir: Avoid C99 field initializers.

As they are not standard C++ and are not supported by MSVC C++ compiler.

Just have nir_imm_double match nir_imm_float above.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
8 years agogallium/util: s/Elements/ARRAY_SIZE/
Brian Paul [Wed, 27 Apr 2016 00:10:00 +0000 (18:10 -0600)]
gallium/util: s/Elements/ARRAY_SIZE/

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agomesa: improve comment on _mesa_check_disallowed_mapping(), return bool
Brian Paul [Wed, 27 Apr 2016 16:42:39 +0000 (10:42 -0600)]
mesa: improve comment on _mesa_check_disallowed_mapping(), return bool

The old comment was a bit terse.  Also, change the function return
type to bool.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agoradeonsi: remove needless cache flushes at the end of CP DMA operations
Marek Olšák [Fri, 22 Apr 2016 08:18:17 +0000 (10:18 +0200)]
radeonsi: remove needless cache flushes at the end of CP DMA operations

not needed AFAIK

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: remove flushes at the beginning and end of IBs done by the kernel
Marek Olšák [Fri, 22 Apr 2016 08:16:14 +0000 (10:16 +0200)]
radeonsi: remove flushes at the beginning and end of IBs done by the kernel

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agonir: Add lrp lowering for doubles in opt_algebraic
Samuel Iglesias Gonsálvez [Tue, 26 Apr 2016 07:35:30 +0000 (09:35 +0200)]
nir: Add lrp lowering for doubles in opt_algebraic

Some hardware (i965 on Broadwell generation, for example) does not support
natively the execution of lrp instruction with double arguments.

Add 'lower_flrp64' flag to lower this instruction in that case.

v2:
   - Rename lower_flrp_double to lower_flrp64 (Jason)
   - Fix typo (Jason)
   - Adapt the code to define bit_size information in the opcodes.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir: rename lower_flrp to lower_flrp32
Samuel Iglesias Gonsálvez [Thu, 28 Apr 2016 05:13:10 +0000 (07:13 +0200)]
nir: rename lower_flrp to lower_flrp32

A later patch will add lower_flrp64 option to NIR.

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_double_ops: lower round_even()
Iago Toral Quiroga [Tue, 5 Jan 2016 09:32:49 +0000 (10:32 +0100)]
nir/lower_double_ops: lower round_even()

At least i965 hardware does not have native support for round_even() on doubles.

Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agonir/lower_double_ops: lower fract()
Iago Toral Quiroga [Tue, 5 Jan 2016 08:14:51 +0000 (09:14 +0100)]
nir/lower_double_ops: lower fract()

At least i965 hardware does not have native support for fract() on doubles.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_double_ops: lower ceil()
Iago Toral Quiroga [Mon, 4 Jan 2016 15:10:11 +0000 (16:10 +0100)]
nir/lower_double_ops: lower ceil()

At least i965 hardware does not have native support for ceil on doubles.

v2 (Sam):
   - Improve the lowering pass to remove one bcsel (Jason).

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_double_ops: lower floor()
Iago Toral Quiroga [Mon, 4 Jan 2016 15:02:47 +0000 (16:02 +0100)]
nir/lower_double_ops: lower floor()

At least i965 hardware does not have native support for floor on doubles.

v2 (Sam):
  - Improve the lowering pass to remove one bcsel (Jason)

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/lower_double_ops: lower trunc()
Iago Toral Quiroga [Mon, 4 Jan 2016 11:52:14 +0000 (12:52 +0100)]
nir/lower_double_ops: lower trunc()

At least i965 hardware does not have native support for truncating doubles.

v2:
  - Simplified the implementation significantly.
  - Fixed the else branch, that was not doing what we wanted.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir: add a pass to lower some double operations
Connor Abbott [Fri, 31 Jul 2015 18:57:48 +0000 (11:57 -0700)]
nir: add a pass to lower some double operations

v2: Move to compiler/nir (Iago)
v3: Use nir_imm_int() to load the constants (Sam)
v4 (Sam):
  - Undo line-wrap (Jason).
  - Fix comment (Jason).
  - Improve generated code for get_signed_inf() function (Connor).

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/builder: add nir_imm_double()
Connor Abbott [Fri, 31 Jul 2015 17:52:04 +0000 (10:52 -0700)]
nir/builder: add nir_imm_double()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/builder: Add bit_size info to nir_build_imm()
Samuel Iglesias Gonsálvez [Wed, 23 Mar 2016 09:43:03 +0000 (10:43 +0100)]
nir/builder: Add bit_size info to nir_build_imm()

v2:
- Group num_components and bit_size together (Jason)

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoradeonsi: check if value is negative
Jakob Sinclair [Mon, 25 Apr 2016 07:03:52 +0000 (09:03 +0200)]
radeonsi: check if value is negative

Fixes a Coverity defect by adding checks to see if a value is negative
before using it to index an array. By checking the value first it makes
the code a bit safer but overall should not have a big impact.

CID: 1355598

Signed-off-by: Jakob Sinclair <sinclair.jakob@openmailbox.org>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
8 years agoclover: Fix build against clang SVN >= r267772
Michel Dänzer [Thu, 28 Apr 2016 03:57:03 +0000 (12:57 +0900)]
clover: Fix build against clang SVN >= r267772

(Re-pushing previous fix for clang SVN r265359, which was reverted in
the meantime)

Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
8 years agoglsl: fix lowering outputs for early/nested returns
Lars Hamre [Sun, 17 Apr 2016 17:18:32 +0000 (13:18 -0400)]
glsl: fix lowering outputs for early/nested returns

Return statements in conditional blocks were not having their
output varyings lowered correctly.

This patch fixes the following piglit tests:
/spec/glsl-1.10/execution/vs-float-main-return
/spec/glsl-1.10/execution/vs-vec2-main-return
/spec/glsl-1.10/execution/vs-vec3-main-return

Signed-off-by: Lars Hamre <chemecse@gmail.com>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agonir: rewrite nir_foreach_block and friends
Connor Abbott [Fri, 8 Apr 2016 06:11:44 +0000 (02:11 -0400)]
nir: rewrite nir_foreach_block and friends

Previously, these were functions which took a callback. This meant that
the per-block code had to be in a separate function, and all the data
that you wanted to pass in had to be a single void *. They walked the
control flow tree recursively, doing a depth-first search, and called
the callback in a preorder, matching the order of the original source
code. But since each node in the control flow tree has a pointer to its
parent, we can implement a "get-next" and "get-previous" method that
does the same thing that the recursive function did with no state at
all. This lets us rewrite nir_foreach_block() as a simple for loop,
which lets us greatly simplify its users in some cases. This does
require us to rewrite every user, although the transformation from the
old nir_foreach_block() to the new nir_foreach_block() is mostly
trivial.

One subtlety, though, is that the new nir_foreach_block() won't handle
the case where the current block is deleted, which the old one could.
There's a new nir_foreach_block_safe() which implements the standard
trick for solving this. Most users don't modify control flow, though, so
they won't need it. Right now, only opt_select_peephole needs it.

The old functions are reimplemented in terms of the new macros, although
they'll go away after everything is converted.

v2: keep an implementation of the old functions around
v3 (Jason Ekstrand): A small cosmetic change and a bugfix in the loop
   handling of nir_cf_node_cf_tree_last().
v4 (Jason Ekstrand): Use the _safe macro in foreach_block_reverse_call

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agonir/opt_cp: use nir_block_get_following_if()
Connor Abbott [Tue, 12 Apr 2016 18:52:43 +0000 (14:52 -0400)]
nir/opt_cp: use nir_block_get_following_if()

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agovbo: Return INVALID_OPERATION during draw with a mapped buffer
Jordan Justen [Mon, 25 Apr 2016 23:09:21 +0000 (16:09 -0700)]
vbo: Return INVALID_OPERATION during draw with a mapped buffer

Fixes the OpenGLES 3.1 CTS:
 * ESEXT-CTS.draw_elements_base_vertex_tests.invalid_mapped_bos

Because this is triggering the error message after the normal API
validation phase, we don't have the API function name available, and
therefore we generate an error message without the draw call name:

Mesa: User error: GL_INVALID_OPERATION in draw call (vertex buffers are mapped)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95142
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoanv/formats: Return proper error code for unsupported formats
Nanley Chery [Fri, 15 Apr 2016 00:14:14 +0000 (17:14 -0700)]
anv/formats: Return proper error code for unsupported formats

Fixes some failures in dEQP-VK.api.info.image_format_properties.* and
enables the test group to execute without assert failing.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94896
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agoanv/device: Set the compressed texture feature flags correctly
Nanley Chery [Fri, 15 Apr 2016 20:36:31 +0000 (13:36 -0700)]
anv/device: Set the compressed texture feature flags correctly

Sampling from an ETC2 texture is supported on Bay Trail and
from Gen8 onwards. While ASTC_LDR is supported on Gen9, the
logic to handle such formats has not yet been implemented in
the driver.

Fixes dEQP-VK.api.info.format_properties.compressed_formats.

v2: Enable ETC2 for Bay Trail (Kenneth Graunke)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94896
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agonir/algebraic: Add a bit-size validator
Jason Ekstrand [Tue, 26 Apr 2016 03:58:47 +0000 (20:58 -0700)]
nir/algebraic: Add a bit-size validator

This commit adds a validator that ensures that all expressions passed
through nir_algebraic are 100% non-ambiguous as far as bit-sizes are
concerned.  This way it's a compile-time error rather than a hard-to-trace
C exception some time later.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agonir/opt_algebraic: Fix some expressions with ambiguous bit sizes
Jason Ekstrand [Tue, 26 Apr 2016 03:59:06 +0000 (20:59 -0700)]
nir/opt_algebraic: Fix some expressions with ambiguous bit sizes

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir/search: Respect the bit_size parameter on nir_search_value
Jason Ekstrand [Mon, 25 Apr 2016 19:41:44 +0000 (12:41 -0700)]
nir/search: Respect the bit_size parameter on nir_search_value

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir/algebraic: Add a mechanism for specifying the bit size of a value
Jason Ekstrand [Mon, 25 Apr 2016 19:23:38 +0000 (12:23 -0700)]
nir/algebraic: Add a mechanism for specifying the bit size of a value

Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir/algebraic: Use "uint" instead of "unsigned" for uint types
Jason Ekstrand [Mon, 25 Apr 2016 19:00:12 +0000 (12:00 -0700)]
nir/algebraic: Use "uint" instead of "unsigned" for uint types

This is consistent with the rename done for the rest of NIR.  Currently,
"bool" is the only type specifier used in nir_opt_algebraic.py so this is
really a no-op.

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agonir/algebraic: Do better error reporting of bad expressions
Jason Ekstrand [Mon, 25 Apr 2016 18:36:08 +0000 (11:36 -0700)]
nir/algebraic: Do better error reporting of bad expressions

Previously, if an exception was encountered anywhere, nir_algebraic would
just die in a fire with no indication whatsoever as to where the actual bug
is.  This commit makes it print out the particular search-and-replace
expression that is causing problems along with the exception.  Also, it
will now report all of the errors it finds and then exit at the end like a
standard C compiler would do.

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
8 years agoisl: move -lm at the end of tests_ldadd
Alejandro Piñeiro [Wed, 27 Apr 2016 17:54:40 +0000 (19:54 +0200)]
isl: move -lm at the end of tests_ldadd

The test was failing to build with "undefined reference to `roundf'" errors,
so Make check on mesa was failing.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>