mesa.git
9 years agonir: Recognize sat(add(b2f(a), b2f(b))) as a logical OR.
Matt Turner [Wed, 18 Mar 2015 06:30:43 +0000 (23:30 -0700)]
nir: Recognize sat(add(b2f(a), b2f(b))) as a logical OR.

Transform this into b2f(or(a, b)).

instructions in affected programs:     432 -> 430 (-0.46%)
helped:                                2

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Recognize mul(b2f(a), b2f(b)) as a logical AND.
Matt Turner [Wed, 18 Mar 2015 06:30:32 +0000 (23:30 -0700)]
nir: Recognize mul(b2f(a), b2f(b)) as a logical AND.

Transform this into b2f(and(a, b)).

total instructions in shared programs: 6205448 -> 6204391 (-0.02%)
instructions in affected programs:     284030 -> 282973 (-0.37%)
helped:                                903
HURT:                                  6

Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agoglsl: Recognize sat(add(b2f(a), b2f(b))) as a logical OR.
Matt Turner [Wed, 18 Mar 2015 17:39:38 +0000 (10:39 -0700)]
glsl: Recognize sat(add(b2f(a), b2f(b))) as a logical OR.

Transform this into b2f(or(a, b)).

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: Recognize mul(b2f(a), b2f(b)) as a logical AND.
Matt Turner [Wed, 18 Mar 2015 06:28:27 +0000 (23:28 -0700)]
glsl: Recognize mul(b2f(a), b2f(b)) as a logical AND.

Transform this into b2f(and(a, b)).

total instructions in shared programs: 6190291 -> 6189225 (-0.02%)
instructions in affected programs:     267247 -> 266181 (-0.40%)
helped:                                866

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agonir: Handle mixed scalar/vector arguments to logical and/or/xor.
Matt Turner [Mon, 23 Mar 2015 23:04:41 +0000 (16:04 -0700)]
nir: Handle mixed scalar/vector arguments to logical and/or/xor.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agoglsl: Allow vector logic ops to be generated.
Matt Turner [Wed, 18 Mar 2015 06:27:38 +0000 (23:27 -0700)]
glsl: Allow vector logic ops to be generated.

They're not accessible from the source language, but optimizations are
allowed to generate them.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoconfigure.ac: move AC_MSG_RESULT reporting back into the m4 macro
Emil Velikov [Mon, 23 Mar 2015 17:49:23 +0000 (17:49 +0000)]
configure.ac: move AC_MSG_RESULT reporting back into the m4 macro

The one who does AC_MSG_CHECKING should provide the AC_MSG_RESULT.

Fixes: ced9425327b (configure: Introduce new output variable to
ax_check_python_mako_module.m4"

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89328
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
9 years agogallium/util: Use HAVE___BUILTIN_FFS* macros.
Jonathan Gray [Tue, 17 Mar 2015 01:49:39 +0000 (12:49 +1100)]
gallium/util: Use HAVE___BUILTIN_FFS* macros.

Make use of the builtin ffs macros and split out ffsll
to a seperate block.  Needed for at least OpenBSD which
does not have ffsll in libc.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoi965: add the remaining files to the tarball
Emil Velikov [Mon, 23 Mar 2015 16:17:36 +0000 (16:17 +0000)]
i965: add the remaining files to the tarball

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: add the remaining files to the tarball
Emil Velikov [Mon, 23 Mar 2015 16:17:35 +0000 (16:17 +0000)]
glsl: add the remaining files to the tarball

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomakefile: add all headers to the tarball
Emil Velikov [Mon, 23 Mar 2015 16:17:34 +0000 (16:17 +0000)]
makefile: add all headers to the tarball

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agogbm: remove gbm_gallium_drm from the loader
Emil Velikov [Sat, 21 Mar 2015 17:45:26 +0000 (17:45 +0000)]
gbm: remove gbm_gallium_drm from the loader

No longer used as of commit 48c7461d5a0(st/gbm: remove state-tracker)

v2: Add commit message.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> (v1)
9 years agoglsl: Generate link error for non-matching gl_FragCoord redeclarations
Anuj Phogat [Thu, 5 Mar 2015 19:07:52 +0000 (11:07 -0800)]
glsl: Generate link error for non-matching gl_FragCoord redeclarations

in different fragment shaders. This also applies to a case when gl_FragCoord
is redeclared with no layout qualifiers in one fragment shader and not
declared but used in other fragment shader.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Khronos Bug#12957
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agovc4: Add a dump-the-surface-contents routine.
Eric Anholt [Tue, 13 Jan 2015 20:58:35 +0000 (09:58 +1300)]
vc4: Add a dump-the-surface-contents routine.

This has been useful once again while trying to debug stride issues
between render targets and texturing.

9 years agovc4: Allow DRI3 on simulation, as well.
Eric Anholt [Mon, 23 Mar 2015 23:15:11 +0000 (16:15 -0700)]
vc4: Allow DRI3 on simulation, as well.

The problem I'd seen before seems to be gone.

9 years agovc4: Fix pitch alignment of linear textures.
Eric Anholt [Mon, 16 Mar 2015 21:48:26 +0000 (14:48 -0700)]
vc4: Fix pitch alignment of linear textures.

Fixes some non-power-of-two texture rendering when I force ARGB8888 to
raster.

9 years agovc4: Write the alignment of level width consistently in validation.
Eric Anholt [Mon, 23 Mar 2015 23:34:24 +0000 (16:34 -0700)]
vc4: Write the alignment of level width consistently in validation.

16 / cpp happens to be the same as utile_w on the only raster format
supported (4 bytes per pixel), but simulator/hw source code generally
talks in terms of utiles.

9 years agovc4: Fix use of a bool as an enum.
Eric Anholt [Mon, 16 Mar 2015 21:14:22 +0000 (14:14 -0700)]
vc4: Fix use of a bool as an enum.

The enum compared to was 0, so it worked out, but it sure looked wrong.

9 years agovc4: Decide the HW's format before laying out the miptree.
Eric Anholt [Mon, 23 Mar 2015 23:21:25 +0000 (16:21 -0700)]
vc4: Decide the HW's format before laying out the miptree.

I'm experimenting with a workaround for raster texture misrendering on
hardware, and this lets me look at the format chosen when computing
strides.

9 years agovc4: Use our device-specific ioctls for create/mmap.
Eric Anholt [Tue, 24 Mar 2015 00:17:17 +0000 (17:17 -0700)]
vc4: Use our device-specific ioctls for create/mmap.

They don't do anything special for us, but I've been told by kernel
maintainers that relying on dumb for my acceleration-capable buffers
is not OK.

9 years agovc4: Make a new #define for making code conditional on the simulator.
Eric Anholt [Tue, 24 Mar 2015 00:26:40 +0000 (17:26 -0700)]
vc4: Make a new #define for making code conditional on the simulator.

I'd like to compile as much of the device-specific code as possible
when building for simulator, and using if (using_simulator) instead of
ifdefs helps.

9 years agovc4: Add some useful debug printfs for miptrees.
Eric Anholt [Tue, 24 Mar 2015 00:38:29 +0000 (17:38 -0700)]
vc4: Add some useful debug printfs for miptrees.

I keep rewriting these.

9 years agoglsl: avoid calling base_alignment when samplers are involved
Ilia Mirkin [Mon, 23 Mar 2015 10:32:08 +0000 (06:32 -0400)]
glsl: avoid calling base_alignment when samplers are involved

Earlier commit 53bf7c8fd2e changed the logic to always call
base_alignment on structs. 1ec715ce8b12 hacked the function to return 0
for sampler fields, but didn't handle sampler arrays. Instead of
extending the hack, avoid calling base_alignment in the first place on
non-UBO uniforms.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89726
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Tapani Palli <tapani.palli@intel.com>
9 years agoRevert "nv50,nvc0: remove bogus 64_FLOAT formats"
Ilia Mirkin [Tue, 24 Mar 2015 00:53:19 +0000 (20:53 -0400)]
Revert "nv50,nvc0: remove bogus 64_FLOAT formats"

This reverts commit 20346808cf4f1ee4f320afaf18f94043fb146f2e.

The conversion is actually done since these are the *B macro variants
and no vtx format is supplied, which makes them go through the translate
module.

This restores the following piglit tests to passing:

  draw-vertices user
  gl-2.0-vertexattribpointer

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomapi: Make private copies of name strings provided by client.
Mario Kleiner [Thu, 12 Mar 2015 22:34:12 +0000 (23:34 +0100)]
mapi: Make private copies of name strings provided by client.

glXGetProcAddress("glFoo") ends up in stub_add_dynamic() to
create dynamic stubs for dynamic functions. stub_add_dynamic()
doesn't store the caller provided name string "Foo" in a mesa
private copy, but just stores a pointer to the "glFoo" string
passed to glXGetProcAddress - a pointer into arbitrary memory
outside mesa's control.

If the caller passes some dynamically allocated/changing
memory buffer to glXGetProcAddress(), or the caller gets unmapped
from memory, e.g., some dynamically loaded application
plugin which uses OpenGL, this ends badly - with a dangling
pointer.

strdup() the name string provided by the client to avoid
this problem.

Cc: "10.3 10.4 10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoclover: Return 0 as storage size for local kernel args that are not set v2
Tom Stellard [Fri, 20 Mar 2015 22:19:43 +0000 (22:19 +0000)]
clover: Return 0 as storage size for local kernel args that are not set v2

The storage size for local kernel args can be queried before the
arguments are set by using the CL_KERNEL_LOCAL_MEM_SIZE param
of clGetKernelWorkGroupInfo().

The spec says that if local kernel arguments have not been specified,
then we should assume their size is 0.

v2:
  - Implement using c++11 member initialization.

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Cc: 10.5 10.4 <mesa-stable@lists.freedesktop.org>
9 years agogallivm: Use MCInstrInfo in the disassembler for querying instruction info
Tom Stellard [Mon, 23 Mar 2015 14:37:24 +0000 (14:37 +0000)]
gallivm: Use MCInstrInfo in the disassembler for querying instruction info

This fixes the build since llvm r232885 and also simplifies the code.

9 years agoclover: use get_device_vendor instead of get_vendor
Giuseppe Bilotta [Sun, 22 Mar 2015 06:21:02 +0000 (07:21 +0100)]
clover: use get_device_vendor instead of get_vendor

The pipe's get_vendor method returns something more akin to a driver
vendor string in most cases, instead of the actual device vendor. Use
get_device_vendor instead, which was introduced specifically for this
purpose.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agogallium: implement get_device_vendor() for existing drivers
Giuseppe Bilotta [Sun, 22 Mar 2015 06:21:01 +0000 (07:21 +0100)]
gallium: implement get_device_vendor() for existing drivers

The only hackish ones are llvmpipe and softpipe, which currently return
the same string as for get_vendor(), while ideally they should return
the CPU vendor.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
9 years agogallium: introduce get_device_vendor() entrypoint for pipes
Giuseppe Bilotta [Sun, 22 Mar 2015 06:21:00 +0000 (07:21 +0100)]
gallium: introduce get_device_vendor() entrypoint for pipes

This will be needed by Clover to return the correct information
to CL_DEVICE_VENDOR info queries.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agogallium: remove trailing whitespace in p_screen.h
Giuseppe Bilotta [Sun, 22 Mar 2015 06:20:59 +0000 (07:20 +0100)]
gallium: remove trailing whitespace in p_screen.h

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoclover: The unit for CL_DEVICE_MEM_BASE_ADDR_ALIGN is bits not bytes
Tom Stellard [Sat, 21 Mar 2015 00:44:47 +0000 (00:44 +0000)]
clover: The unit for CL_DEVICE_MEM_BASE_ADDR_ALIGN is bits not bytes

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoclover: Add all the mandatory 1.1 extensions to the extension string
Tom Stellard [Sat, 21 Mar 2015 00:25:34 +0000 (00:25 +0000)]
clover: Add all the mandatory 1.1 extensions to the extension string

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoclover: Add a space at the end of CL_DEVICE_OPENCL_C_VERSION
Tom Stellard [Fri, 20 Mar 2015 23:55:58 +0000 (23:55 +0000)]
clover: Add a space at the end of CL_DEVICE_OPENCL_C_VERSION

This is required by the spec.

Reviewed-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoi965/vec4: Fix handling of multiple register reads and writes in dead_code_eliminate().
Francisco Jerez [Wed, 18 Mar 2015 19:06:28 +0000 (21:06 +0200)]
i965/vec4: Fix handling of multiple register reads and writes in dead_code_eliminate().

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Calculate live intervals with subregister granularity.
Francisco Jerez [Mon, 23 Mar 2015 12:08:49 +0000 (14:08 +0200)]
i965/vec4: Calculate live intervals with subregister granularity.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Define helpers to calculate the common live interval of a range of variables.
Francisco Jerez [Wed, 18 Mar 2015 18:49:43 +0000 (20:49 +0200)]
i965/vec4: Define helpers to calculate the common live interval of a range of variables.

These will be especially useful when we start keeping track of
liveness information for each subregister.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Define helper functions to convert a register to a variable index.
Francisco Jerez [Wed, 18 Mar 2015 18:17:23 +0000 (20:17 +0200)]
i965/vec4: Define helper functions to convert a register to a variable index.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Don't lose the force_writemask_all flag during CSE.
Francisco Jerez [Thu, 19 Mar 2015 13:08:16 +0000 (15:08 +0200)]
i965/vec4: Don't lose the force_writemask_all flag during CSE.

And set it in the MOV instructions that copy the temporary to the
original destination if the generator instruction had it set.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix handling of multiple register reads and writes in opt_cse().
Francisco Jerez [Wed, 18 Mar 2015 17:51:01 +0000 (19:51 +0200)]
i965/vec4: Fix handling of multiple register reads and writes in opt_cse().

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix handling of multiple register reads and writes during copy propagation.
Francisco Jerez [Wed, 18 Mar 2015 17:46:54 +0000 (19:46 +0200)]
i965/vec4: Fix handling of multiple register reads and writes during copy propagation.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix handling of multiple register reads and writes in split_virtual_grfs().
Francisco Jerez [Wed, 18 Mar 2015 17:45:40 +0000 (19:45 +0200)]
i965/vec4: Fix handling of multiple register reads and writes in split_virtual_grfs().

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix handling of multiple register reads and writes in opt_register_coalesce().
Francisco Jerez [Wed, 18 Mar 2015 17:43:44 +0000 (19:43 +0200)]
i965/vec4: Fix handling of multiple register reads and writes in opt_register_coalesce().

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Define method to check whether a backend_reg is inside a given range.
Francisco Jerez [Wed, 18 Mar 2015 17:35:31 +0000 (19:35 +0200)]
i965: Define method to check whether a backend_reg is inside a given range.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Remove dependency of vec4_live_variables on the visitor.
Francisco Jerez [Wed, 18 Mar 2015 14:03:30 +0000 (16:03 +0200)]
i965/vec4: Remove dependency of vec4_live_variables on the visitor.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Trivial copy propagate clean-up.
Francisco Jerez [Thu, 19 Mar 2015 13:30:06 +0000 (15:30 +0200)]
i965/vec4: Trivial copy propagate clean-up.

Fix typo and punctuation in a comment, break long line and add space
before curly bracket.

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
9 years agoi965/vec4: Add argument index and type checks to SEL saturate propagation.
Francisco Jerez [Wed, 18 Mar 2015 13:51:45 +0000 (15:51 +0200)]
i965/vec4: Add argument index and type checks to SEL saturate propagation.

SEL saturate propagation already implicitly relies on these
assumptions.

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
9 years agoi965/vec4: Fix broken saturate mask check in copy propagation.
Francisco Jerez [Thu, 19 Mar 2015 16:25:30 +0000 (18:25 +0200)]
i965/vec4: Fix broken saturate mask check in copy propagation.

try_copy_propagate() was checking the bit of the saturate mask for the
arg-th component of the source to decide whether the whole source
should be saturated (WTF?).  We need to swizzle the original saturate
mask and check that for all enabled channels the saturate flag is
either set or unset, as we cannot saturate a subset of destination
components only.

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
9 years agoi965/vec4: Don't lose copy propagation saturate bits for not written components.
Francisco Jerez [Wed, 18 Mar 2015 13:45:16 +0000 (15:45 +0200)]
i965/vec4: Don't lose copy propagation saturate bits for not written components.

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
9 years agoRevert "i965/vec4: Don't lose the saturate modifier in copy propagation."
Francisco Jerez [Wed, 18 Mar 2015 13:39:03 +0000 (15:39 +0200)]
Revert "i965/vec4: Don't lose the saturate modifier in copy propagation."

This reverts commit 0dfec59a2785cf7a87ee5128889ecebe810b611b.  The
change prevented propagation of copies with the saturate flag set,
making the whole saturate mask tracking completely useless.  A proper
fix follows.

Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
9 years agoi965/vec4: Remove unused method definition.
Francisco Jerez [Wed, 18 Mar 2015 13:40:25 +0000 (15:40 +0200)]
i965/vec4: Remove unused method definition.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Some more trivial swizzle clean-up.
Francisco Jerez [Wed, 18 Mar 2015 19:19:28 +0000 (21:19 +0200)]
i965/vec4: Some more trivial swizzle clean-up.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Improve src_reg/dst_reg conversion constructors.
Francisco Jerez [Wed, 18 Mar 2015 13:27:58 +0000 (15:27 +0200)]
i965/vec4: Improve src_reg/dst_reg conversion constructors.

This simplifies the src_reg/dst_reg conversion constructors using the
swizzle utils introduced in a previous patch.  It also makes them more
useful by changing their semantics slightly: dst_reg(src_reg) used to
set the writemask to XYZW if the src_reg swizzle was anything other
than XXXX, which was almost certainly not what the caller intended if
the swizzle was non-trivial.  After this patch the same components
that are present in the swizzle will be enabled in the resulting
writemask.

src_reg(dst_reg) used to set the first components of the swizzle to
the enabled components of the writemask and then replicate the last
enabled component to fill the swizzle, which, in cases where the
writemask didn't have exactly the first n components set, would in
general not be compatible with the original dst_reg.  E.g.:

| ADD(tmp, src_reg(tmp), src_reg(1));

would *not* do what one would expect (add one to each of the enabled
components of tmp) if tmp didn't have a writemask of the described
form (e.g. YZ, YW, XZW would all fail).  This pattern actually occurs
in many different places in the VEC4 back-end, it's a wonder that it
hasn't caused piglit failures until now.  After this patch
src_reg(dst_reg) will construct a swizzle with each enabled component
at its natural position (e.g. Y at the second position, Z at the
third, and so on).  The resulting swizzle will behave like the
identity when used in any instruction with the original writemask.

I've manually verified that *none* of the callers of both conversion
constructors were relying on the previous broken semantics.  There are
no piglit regressions on any generation.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Pass argument by reference to src_reg/dst_reg conversion constructors.
Francisco Jerez [Wed, 18 Mar 2015 13:21:20 +0000 (15:21 +0200)]
i965/vec4: Pass argument by reference to src_reg/dst_reg conversion constructors.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Remove swizzle_for_size() in favour of brw_swizzle_for_size().
Francisco Jerez [Wed, 18 Mar 2015 19:18:08 +0000 (21:18 +0200)]
i965/vec4: Remove swizzle_for_size() in favour of brw_swizzle_for_size().

It could be objected that swizzle_for_size() is "faster" than
brw_swizzle_for_size().  It's not measurably better in any reasonable
CPU-bound benchmark on VLV according to the Finnish benchmarking
system (including the SynMark2 DrvShComp shader compilation
benchmark).

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Remove broken vector size deduction in setup_builtin_uniform_values().
Francisco Jerez [Wed, 18 Mar 2015 13:26:10 +0000 (15:26 +0200)]
i965/vec4: Remove broken vector size deduction in setup_builtin_uniform_values().

This seemed to be trying to deduce the number of uniform vector
components from the parameter swizzle, but the algorithm would always
give 4 as result.  Instead grab the correct number of components from
the GLSL type.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Simplify visitor handling of swizzles using the swizzle utils.
Francisco Jerez [Wed, 18 Mar 2015 19:15:05 +0000 (21:15 +0200)]
i965/vec4: Simplify visitor handling of swizzles using the swizzle utils.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Simplify opt_register_coalesce() using the swizzle utils.
Francisco Jerez [Wed, 18 Mar 2015 19:11:20 +0000 (21:11 +0200)]
i965/vec4: Simplify opt_register_coalesce() using the swizzle utils.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Simplify reswizzle() using the swizzle utils.
Francisco Jerez [Wed, 18 Mar 2015 19:09:51 +0000 (21:09 +0200)]
i965/vec4: Simplify reswizzle() using the swizzle utils.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Simplify opt_reduce_swizzle() using the swizzle utils.
Francisco Jerez [Wed, 18 Mar 2015 19:08:52 +0000 (21:08 +0200)]
i965/vec4: Simplify opt_reduce_swizzle() using the swizzle utils.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Fix signedness of backend_reg::reg_offset.
Francisco Jerez [Thu, 19 Mar 2015 14:03:57 +0000 (16:03 +0200)]
i965: Fix signedness of backend_reg::reg_offset.

And make it 16-bit so it packs nicely with the previous field.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix signedness of dst_reg::writemask.
Francisco Jerez [Wed, 18 Mar 2015 13:24:06 +0000 (15:24 +0200)]
i965/vec4: Fix signedness of dst_reg::writemask.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Don't use GL types in the IR data structures.
Francisco Jerez [Wed, 18 Mar 2015 13:22:52 +0000 (15:22 +0200)]
i965/vec4: Don't use GL types in the IR data structures.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix signedness of brw_is_single_value_swizzle() argument.
Francisco Jerez [Wed, 18 Mar 2015 12:32:37 +0000 (14:32 +0200)]
i965/vec4: Fix signedness of brw_is_single_value_swizzle() argument.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Define some useful swizzle helper functions.
Francisco Jerez [Wed, 18 Mar 2015 12:34:51 +0000 (14:34 +0200)]
i965: Define some useful swizzle helper functions.

This defines helper functions implementing some common swizzle
transformations that are usually open-coded in the compiler back-end,
causing a lot of clutter.  Some optimization passes will become almost
trivial implemented in terms of these functions (e.g.
vec4_visitor::opt_reduce_swizzle()).

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: fix names in lower_constant_arrays_to_uniforms
Tapani Pälli [Mon, 23 Mar 2015 07:12:35 +0000 (09:12 +0200)]
glsl: fix names in lower_constant_arrays_to_uniforms

Patch changes lowering pass to use unique name for each uniform
so that arrays from different stages cannot end up having same
name.

v2: instead of global counter, use pointer to achieve
    unique name (Kenneth Graunke)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89590
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Cc: 10.5 10.4 <mesa-stable@lists.freedesktop.org>
9 years agoi965/nir: Use signed integer type for booleans
Jason Ekstrand [Wed, 18 Mar 2015 02:57:59 +0000 (19:57 -0700)]
i965/nir: Use signed integer type for booleans

FS instructions with NIR on i965:
total instructions in shared programs: 2663561 -> 2619051 (-1.67%)
instructions in affected programs:     1612965 -> 1568455 (-2.76%)
helped:                                5455
HURT:                                  12

FS instructions with NIR on g4x:
total instructions in shared programs: 2352633 -> 2307908 (-1.90%)
instructions in affected programs:     1441842 -> 1397117 (-3.10%)
helped:                                5463
HURT:                                  11

FS instructions with NIR on ilk:
total instructions in shared programs: 3997305 -> 3934278 (-1.58%)
instructions in affected programs:     2189409 -> 2126382 (-2.88%)
helped:                                8969
HURT:                                  22

FS instructions with NIR on hsw (snb and ivb were similar):
total instructions in shared programs: 4109389 -> 4109242 (-0.00%)
instructions in affected programs:     109869 -> 109722 (-0.13%)
helped:                                339
HURT:                                  190

No SIMD16 programs were gained or lost on any platform

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/nir: Do boolean resolves on GEN <= 5
Jason Ekstrand [Tue, 17 Mar 2015 18:49:04 +0000 (11:49 -0700)]
i965/nir: Do boolean resolves on GEN <= 5

v2: A couple comment clean-ups from Matt

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Add a NIR analysis pass for determining when a boolean resolve is needed
Jason Ekstrand [Tue, 17 Mar 2015 18:29:01 +0000 (11:29 -0700)]
i965: Add a NIR analysis pass for determining when a boolean resolve is needed

v2: Fix the spelling of analyze and re-arrange code for better readability
    as per Connor's comments.
v3: Make the naming of things more consistent and add a pile of comments
v4: Stop trying to avoid vectors

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agoi965/nir: Properly set the predicate on the SEL used in min/max
Jason Ekstrand [Tue, 17 Mar 2015 20:43:10 +0000 (13:43 -0700)]
i965/nir: Properly set the predicate on the SEL used in min/max

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/nir: Use NIR lowering for ffma for gen < 6
Jason Ekstrand [Tue, 17 Mar 2015 20:10:19 +0000 (13:10 -0700)]
i965/nir: Use NIR lowering for ffma for gen < 6

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/nir: Use emit_lrp for emitting flrp
Jason Ekstrand [Tue, 17 Mar 2015 18:37:09 +0000 (11:37 -0700)]
i965/nir: Use emit_lrp for emitting flrp

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965/fs: Make emit_lrp return an fs_inst
Jason Ekstrand [Tue, 17 Mar 2015 18:36:10 +0000 (11:36 -0700)]
i965/fs: Make emit_lrp return an fs_inst

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965: define I915_PARAM_REVISION
Dave Airlie [Sun, 22 Mar 2015 23:54:52 +0000 (09:54 +1000)]
i965: define I915_PARAM_REVISION

we are broken against the libdrm 2.4.60 minimum specified,
so fix it for now.

Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agogallivm: Silence unused variable warnings on release builds.
Jose Fonseca [Fri, 20 Mar 2015 12:02:42 +0000 (12:02 +0000)]
gallivm: Silence unused variable warnings on release builds.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Silence conversion from 'size_t' to 'type', possible loss of data on MSVC.
Jose Fonseca [Fri, 20 Mar 2015 12:01:23 +0000 (12:01 +0000)]
scons: Silence conversion from 'size_t' to 'type', possible loss of data on MSVC.

Most cases seem harmless, though that might not always be the case.  Maybe
one day we can get gcc to complain about these and fix them throughout
the code, but until then let's silence them.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Ensure inttypes.h is always pre-included on MSVC.
Jose Fonseca [Fri, 20 Mar 2015 06:53:09 +0000 (06:53 +0000)]
scons: Ensure inttypes.h is always pre-included on MSVC.

It's a bit hackish couldn't find another solution.  See code comment
for details.   The warning is useful, so universally disabling doesn't
sound a good idea.

Fixes

   warning C4005: 'xxx' : macro redefinition

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Silence MSVC C4351 warning.
Jose Fonseca [Thu, 19 Mar 2015 22:22:26 +0000 (22:22 +0000)]
scons: Silence MSVC C4351 warning.

It warns about change in MSVC behavior -- array initialisation used to
be non-standard, but is standard now, assuming I understand correctly
http://en.cppreference.com/w/cpp/language/zero_initialization .

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Match some of LLVM warning options.
Jose Fonseca [Thu, 19 Mar 2015 22:09:20 +0000 (22:09 +0000)]
scons: Match some of LLVM warning options.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Cleanup flex/bison settings specification.
Jose Fonseca [Thu, 19 Mar 2015 13:35:18 +0000 (13:35 +0000)]
scons: Cleanup flex/bison settings specification.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Prefer winflexbison, and use --wincompat when available.
Jose Fonseca [Thu, 19 Mar 2015 13:30:19 +0000 (13:30 +0000)]
scons: Prefer winflexbison, and use --wincompat when available.

This avoids MSVC the warning

  warning C4013: 'isatty' undefined; assuming extern returning int

with certain versions of flex.

Reviewed-by: Brian Paul <brianp@vmware.com>
v2: Add win flex-bison link to docs/install.html.

9 years agoscons: Define YY_USE_CONST on MSVC.
Jose Fonseca [Thu, 19 Mar 2015 11:53:36 +0000 (11:53 +0000)]
scons: Define YY_USE_CONST on MSVC.

This prevents the MSVC from

  warning C4090: 'function' : different 'const' qualifiers

when compiling flex generated lexers.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Tell MSVC STL library to not use exceptions.
Jose Fonseca [Fri, 20 Mar 2015 06:27:59 +0000 (06:27 +0000)]
scons: Tell MSVC STL library to not use exceptions.

MSVC defaults to no exceptions unless /EH option is passed (which we don't), while
MSVC's STL defaults to use exceptions unless _HAS_EXCEPTIONS=0 is defined,
which we didn't.

This fixes

  warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoscons: Ensure git_sha1.h's directory exists.
Jose Fonseca [Thu, 19 Mar 2015 13:31:37 +0000 (13:31 +0000)]
scons: Ensure git_sha1.h's directory exists.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoconfigure: Bail out with MinGW targets.
Jose Fonseca [Thu, 19 Mar 2015 13:38:52 +0000 (13:38 +0000)]
configure: Bail out with MinGW targets.

We only support native Windows builds with SCons.

Tested with:

  ./configure --host=i686-w64-mingw32

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoinclude: Ensure float.h is included for DBL_MAX.
Jose Fonseca [Thu, 19 Mar 2015 11:51:08 +0000 (11:51 +0000)]
include: Ensure float.h is included for DBL_MAX.

I didn't actually hit the issue in practice, but just happen to notice
while looking at the code.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agost/vdpau: Avoid constness cast warnings.
Jose Fonseca [Thu, 19 Mar 2015 13:14:41 +0000 (13:14 +0000)]
st/vdpau: Avoid constness cast warnings.

Fixes MSVC

  warning C4090: '=' : different 'const' qualifiers

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agoglsl: Disable MSVC switch warning on a per-file basis.
Jose Fonseca [Thu, 19 Mar 2015 22:24:20 +0000 (22:24 +0000)]
glsl: Disable MSVC switch warning on a per-file basis.

This addresses

  ...\glsl_parser.cpp(...) : warning C4065: switch statement contains 'default' but no 'case' labels

This is on code generated by bison, which we have little control.

It seems useful to have this warning otherwise enabled.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoglsl: Avoid GLboolean vs bool arithmetic MSVC warnings.
Jose Fonseca [Wed, 18 Mar 2015 14:21:15 +0000 (14:21 +0000)]
glsl: Avoid GLboolean vs bool arithmetic MSVC warnings.

Note that GLboolean is an alias for unsigned char, which lacks the
implicit true/false semantics that C++/C99 bool have.

Reviewed-by: Brian Paul <brianp@vmware.com>
v2: Change gl_shader::IsES and gl_shader_program::IsES to be bool as
recommended by Ian Romanick.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agogalahad: actually remove the driver
Emil Velikov [Sat, 21 Mar 2015 22:30:52 +0000 (22:30 +0000)]
galahad: actually remove the driver

Should have been part of 429a4355259(galahad: remove driver). Seems like
I've erroneously committed the trimmed patch.

Reported-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoegl: cut down static storage size for {Version,ClientAPI}String
Emil Velikov [Thu, 19 Mar 2015 01:36:08 +0000 (01:36 +0000)]
egl: cut down static storage size for {Version,ClientAPI}String

Both seems to be excessively long, namely:

ClientAPIString can get up-to 47 based on current code, while the name
of the driver can dictate the length of the VersionString, currently it
is around 11. Let's pad each to 100, rather than the current 1000.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agodocs: note the removal of gbm_gallium, galahad and identity
Emil Velikov [Sat, 21 Mar 2015 17:21:21 +0000 (17:21 +0000)]
docs: note the removal of gbm_gallium, galahad and identity

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agogalahad: remove driver
Emil Velikov [Sat, 14 Mar 2015 22:36:31 +0000 (22:36 +0000)]
galahad: remove driver

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Matt Turner <mattst88@gmail.com>
9 years agogallium/docs: remove information about identity driver
Emil Velikov [Sat, 14 Mar 2015 22:36:30 +0000 (22:36 +0000)]
gallium/docs: remove information about identity driver

Removed from tree.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Matt Turner <mattst88@gmail.com>
9 years agodocs: update the egl_platforms list
Emil Velikov [Sat, 14 Mar 2015 22:36:29 +0000 (22:36 +0000)]
docs: update the egl_platforms list

Add the missing wayland, null, android and haiku platforms.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Matt Turner <mattst88@gmail.com>
9 years agoegl/main: drop platform fbdev specific code
Emil Velikov [Sat, 14 Mar 2015 22:36:28 +0000 (22:36 +0000)]
egl/main: drop platform fbdev specific code

st/egl was the only one which had support for this platform.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Matt Turner <mattst88@gmail.com>
9 years agowinsys/sw/fbdev: remove unused software winsys
Emil Velikov [Sat, 14 Mar 2015 22:36:27 +0000 (22:36 +0000)]
winsys/sw/fbdev: remove unused software winsys

st/egl was its only user.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Matt Turner <mattst88@gmail.com>
9 years agowinsys/sw/wayland: remove unused winsys
Emil Velikov [Sat, 14 Mar 2015 22:36:26 +0000 (22:36 +0000)]
winsys/sw/wayland: remove unused winsys

st/egl was its only user.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Matt Turner <mattst88@gmail.com>
9 years agost/gbm: remove state-tracker
Emil Velikov [Sat, 14 Mar 2015 22:36:25 +0000 (22:36 +0000)]
st/gbm: remove state-tracker

st/egl was its only user.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Matt Turner <mattst88@gmail.com>
9 years agollvmpipe: use global llvm context for PIPE_SUBSYSTEM_EMBEDDED
Roland Scheidegger [Sat, 21 Mar 2015 00:13:54 +0000 (01:13 +0100)]
llvmpipe: use global llvm context for PIPE_SUBSYSTEM_EMBEDDED

There's 2 reasons why we'd want to use the global context:
1) There still seems to be one memory "leak" left when using multiple llvm
contexts (it is not a true leak as the memory disappears into some still
addressable pool but nevertheless the memory consumption grows). See
http://cgit.freedesktop.org/~jrfonseca/llvm-jitstress/
2) These contexts get kinda big - even when disposing modules etc. after
compiling a shader the LLVMContext can easily be over 100kB. So when there's
lots of llvm contexts arounds it adds up.

The downside is that at least right now this is absolutely not thread safe,
so this only works safely in environments where multiple pipe contexts are not
used concurrently.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>