mesa.git
9 years agogallium: add double opcodes and TGSI execution (v4.2)
Dave Airlie [Thu, 14 Aug 2014 08:38:51 +0000 (18:38 +1000)]
gallium: add double opcodes and TGSI execution (v4.2)

This patch adds support for a set of double opcodes
to TGSI. It is an update of work done originally
by Michal Krol on the gallium-double-opcodes branch.

The opcodes have a hint where they came from in the
header file.

v2: add unsigned/int <-> double
v2.1:  update docs.

v3: add DRSQ (Glenn), fix review comments (Glenn).

v4: drop DDIV
v4.1: cleanups, fix some docs bugs, (Ilia)
      rework store_dest and fetch_source fns. (Ilia)
4.2: fixup float comparisons (Ilia)

This is based on code by Michael Krol <michal@vmware.com>

Roland and Glenn also reviewed earlier versions.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agogallium/util: indentation fix
Brian Paul [Thu, 19 Feb 2015 16:29:18 +0000 (09:29 -0700)]
gallium/util: indentation fix

9 years agost/mesa: add GSL_TYPE_DOUBLE, new ir_unop_* switch cases
Brian Paul [Thu, 19 Feb 2015 16:26:51 +0000 (09:26 -0700)]
st/mesa: add GSL_TYPE_DOUBLE, new ir_unop_* switch cases

To silence compiler warnings about unhandled switch cases.
v2: move GSL_TYPE_DOUBLE case to the "Invalid type in type_size" section,
per Ilia.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonir: add missing GLSL_TYPE_DOUBLE case in type_size()
Brian Paul [Thu, 19 Feb 2015 16:25:42 +0000 (09:25 -0700)]
nir: add missing GLSL_TYPE_DOUBLE case in type_size()

To silence compiler warning about unhandled switch case.
v2: move GLSL_TYPE_DOUBLE to the "not reached" section, per Ilia.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agost/mesa: fix sampler view reference counting bug in glDraw/CopyPixels
Brian Paul [Wed, 18 Feb 2015 18:16:55 +0000 (11:16 -0700)]
st/mesa: fix sampler view reference counting bug in glDraw/CopyPixels

Use pipe_sampler_view_reference() instead of ordinary assignment.
Also add a new sanity check assertion.

Fixes piglit gl-1.0-drawpixels-color-index test crash.  But note
that the test still fails.

Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoswrast: fix multiple color buffer writing
Brian Paul [Mon, 16 Feb 2015 18:23:06 +0000 (11:23 -0700)]
swrast: fix multiple color buffer writing

If a fragment program wrote to more than one color buffer, the
first fragment color got replicated to all dest buffers.  This
fixes 5 piglit FBO tests, including fbo-drawbuffers-arbfp.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=45348
Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agomesa: remove unused _math_trans_4chan()
Brian Paul [Mon, 16 Feb 2015 18:12:40 +0000 (11:12 -0700)]
mesa: remove unused _math_trans_4chan()

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoinstall-lib-links: don't depend on .libs directory
Lucas Stach [Thu, 19 Feb 2015 13:52:49 +0000 (14:52 +0100)]
install-lib-links: don't depend on .libs directory

This snippet can be included in Makefiles that may, depending on the
project configuration, not actually build any installable libraries.

In that case we don't have anything to depend on and this part of
the makefile may be executed before the .libs directory is created,
so do not depend on it being there.

Cc: "10.3 10.4 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
9 years agoi965/vec4: Calculate register allocation q values manually.
Francisco Jerez [Wed, 11 Feb 2015 16:15:44 +0000 (18:15 +0200)]
i965/vec4: Calculate register allocation q values manually.

This fixes a regression in the running time of Piglit introduced by
commit 78e9043475d4bed8b50f7e413963c960fa0935bb, which increased the
number of register allocation classes set up by the VEC4 back-end
from 2 to 16.  The algorithm used by ra_set_finalize() to calculate
them is unnecessarily expensive, do it manually like the FS back-end
does.

Reported-by: Mark Janes <mark.a.janes@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Don't compact instructions with unmapped bits.
Francisco Jerez [Fri, 30 Jan 2015 15:50:35 +0000 (17:50 +0200)]
i965: Don't compact instructions with unmapped bits.

Some instruction bits don't have a mapping defined to any compacted
instruction field.  If they're ever set and we end up compacting the
instruction they will be forced to zero.  Avoid using compaction in such
cases.

v2: Align multiple lines of an expression to the same column.  Change
    conditional compaction of 3-source instructions to an
    assertion. (Matt)
v3: The 3-source instruction bit 105 is part of SourceIndex on CHV.
    Add assertion that reserved bit 7 is not set. (Matt)
    Document overlap with UIP and 64-bit immediate fields.
v4: Make some more unmapped bit checks assertions. (Matt)

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Handle F16TO32/F32TO16 with dword src/dst consistently on both back-ends.
Francisco Jerez [Wed, 4 Feb 2015 16:24:47 +0000 (18:24 +0200)]
i965: Handle F16TO32/F32TO16 with dword src/dst consistently on both back-ends.

Due to the way it's implemented in hardware, the F16TO32/F32TO16
instructions require the source/destination register to be of some
16-bit type in Align1 mode, while they require it to be some 32-bit
type in Align16 mode (and as an undocumented feature the high 16 bits
of the destination register are zeroed out in the case of the F32TO16
instruction on Gen7).  Make their behaviour consistent so you can
specify a 32 bit register type as source or destination and get
predictable results in the most significant bits no matter what access
mode is being used.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/gen8: Fix F32TO16 in vec4 mode if the source and destination registers alias.
Francisco Jerez [Wed, 4 Feb 2015 16:08:47 +0000 (18:08 +0200)]
i965/gen8: Fix F32TO16 in vec4 mode if the source and destination registers alias.

We cannot zero out the destination register if it overlaps with the
source.  Use an Align1 instruction instead to zero out the high 16
bits after the conversion to half float.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/fs: Replace ud_reg_to_w() with a more general helper function.
Francisco Jerez [Wed, 4 Feb 2015 15:58:49 +0000 (17:58 +0200)]
i965/fs: Replace ud_reg_to_w() with a more general helper function.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Don't attempt to reduce swizzles of send from GRF instructions.
Francisco Jerez [Tue, 3 Feb 2015 18:34:17 +0000 (20:34 +0200)]
i965/vec4: Don't attempt to reduce swizzles of send from GRF instructions.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/vec4: Fix constant propagation across different types.
Francisco Jerez [Tue, 3 Feb 2015 20:48:27 +0000 (22:48 +0200)]
i965/vec4: Fix constant propagation across different types.

If the source type differs from the original type of the constant we
need to bit-cast it before propagating, otherwise the original type
information will be lost.  If the constant was a vector float there
isn't much we can do, because the result of bit-casting the component
values of a vector float cannot itself be represented as an immediate.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: A shader cannot redefine or overload built-in functions in GLSL ES 3.00
Samuel Iglesias Gonsalvez [Tue, 25 Nov 2014 15:36:53 +0000 (16:36 +0100)]
glsl: A shader cannot redefine or overload built-in functions in GLSL ES 3.00

Create a new search function to look for matching built-in functions by name
and use it for built-in function redefinition or overload in GLSL ES 3.00.

GLSL ES 3.0 spec, chapter 6.1 "Function Definitions", page 71

  "A shader cannot redefine or overload built-in functions."

While in GLSL ES 1.0 specification, chapter 8 "Built-in Functions"

  "User code can overload the built-in functions but cannot redefine them."

So this check is specific to GLSL ES 3.00.

This patch fixes the following dEQP tests:

dEQP-GLES3.functional.shaders.functions.invalid.overload_builtin_function_vertex
dEQP-GLES3.functional.shaders.functions.invalid.overload_builtin_function_fragment
dEQP-GLES3.functional.shaders.functions.invalid.redefine_builtin_function_vertex
dEQP-GLES3.functional.shaders.functions.invalid.redefine_builtin_function_fragment

No piglit regressions.

Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: Adds check for integer internal format and num samples in glRenderbufferStorage...
Eduardo Lima Mitev [Mon, 15 Dec 2014 10:30:21 +0000 (11:30 +0100)]
mesa: Adds check for integer internal format and num samples in glRenderbufferStorageMultisample

Per GLES3 specification, section 4.4 Framebuffer objects page 198, "If
internalformat is a signed or unsigned integer format and samples is greater
than zero, then the error INVALID_OPERATION is generated.".

Fixes 1 dEQP test:
* dEQP-GLES3.functional.negative_api.buffer.renderbuffer_storage_multisample

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: Returns correct error values from gl(Get)SamplerParameter*() on GL-ES 3.0+
Eduardo Lima Mitev [Tue, 16 Dec 2014 08:15:07 +0000 (09:15 +0100)]
mesa: Returns correct error values from gl(Get)SamplerParameter*() on GL-ES 3.0+

'3.8.2 Sampler Objects' section of the GL-ES 3.0 specification states:

    "An INVALID_OPERATION error is generated if sampler is not the name
    of a sampler object previously returned from a call to GenSamplers."

In desktop GL, an GL_INVALID_VALUE is returned instead.

Fixes 6 dEQP failing tests:
* dEQP-GLES3.functional.negative_api.shader.get_sampler_parameteriv
* dEQP-GLES3.functional.negative_api.shader.get_sampler_parameterfv
* dEQP-GLES3.functional.negative_api.shader.sampler_parameteri
* dEQP-GLES3.functional.negative_api.shader.sampler_parameteriv
* dEQP-GLES3.functional.negative_api.shader.sampler_parameterf
* dEQP-GLES3.functional.negative_api.shader.sampler_parameterfv

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: remove bogus 'd' constant qualifiers
Ilia Mirkin [Thu, 19 Feb 2015 06:44:44 +0000 (01:44 -0500)]
glsl: remove bogus 'd' constant qualifiers

0.0 is a double anyways. Apparently my version of gcc was happy with
0.0d as well, but this is not true of all compilers.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89218

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agost/mesa: don't die for ETC2 formats when no driver support
Ilia Mirkin [Thu, 19 Feb 2015 06:38:58 +0000 (01:38 -0500)]
st/mesa: don't die for ETC2 formats when no driver support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonir: Add an ALU op builder kind of like ir_builder.h
Eric Anholt [Mon, 10 Nov 2014 19:16:30 +0000 (11:16 -0800)]
nir: Add an ALU op builder kind of like ir_builder.h

v2: Rebase on the nir_opcodes.h python code generation support.
v3: Use SSA values, and set an appropriate writemask on dot products.
v4: Make the arguments be SSA references as well.  This lets you stack up
    expressions in the arguments of other expressions, at the cost of
    having to insert a fmov/imov if you want to swizzle.  Also, add
    the generated file to NIR_GENERATED_FILES.
v5: Use more pythonish style for iterating the list.
v6: Infer the size of the dest from the size of the srcs, and auto-swizzle
    a single small src out to the appropriate size.
v7: Add little helpers for initializing the struct, add a typedef for the
    struct like other nir types have.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v6)
Reviewed-by: Connor Abbott <cwabbott0@gmail.com> (v7)
9 years agodocs: mark ARB_gpu_shader_fp64 as done in core
Ilia Mirkin [Wed, 18 Feb 2015 19:53:26 +0000 (14:53 -0500)]
docs: mark ARB_gpu_shader_fp64 as done in core

No driver support... yet. But core is ready.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl/tests: add DOUBLE types
Ilia Mirkin [Sun, 8 Feb 2015 08:42:51 +0000 (03:42 -0500)]
glsl/tests: add DOUBLE types

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: add a lowering pass for frexp/ldexp with double arguments
Ilia Mirkin [Thu, 17 Jul 2014 21:59:32 +0000 (17:59 -0400)]
glsl: add a lowering pass for frexp/ldexp with double arguments

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: lower double optional passes (v2)
Dave Airlie [Thu, 14 Aug 2014 10:21:46 +0000 (20:21 +1000)]
glsl: lower double optional passes (v2)

These lowering passes are optional for the backend to request, currently
the TGSI softpipe backend most likely the r600g backend would want to use
these passes as is. They aim to hit the gallium opcodes from the standard
rounding/truncation functions.

v2: also lower floor in mod_to_floor

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: implement double builtin functions
Dave Airlie [Thu, 14 Aug 2014 08:48:57 +0000 (18:48 +1000)]
glsl: implement double builtin functions

This implements the bulk of the builtin functions for fp64 support.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl/lower_instructions: add double lowering passes
Dave Airlie [Thu, 14 Aug 2014 08:44:35 +0000 (18:44 +1000)]
glsl/lower_instructions: add double lowering passes

This lowers double dot product and lrp to fma.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: enable/disable certain lowering passes for doubles
Dave Airlie [Thu, 14 Aug 2014 08:44:50 +0000 (18:44 +1000)]
glsl: enable/disable certain lowering passes for doubles

We want to restrict some lowering passes to floats only,
and enable other for doubles.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: validate output types for shader stages
Tapani Pälli [Mon, 11 Aug 2014 09:03:54 +0000 (12:03 +0300)]
glsl: validate output types for shader stages

Patch fixes Piglit test:
   arb_gpu_shader_fp64/preprocessor/fs-output-double.frag

and adds additional validation for shader outputs.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: add double support to lower_mat_op_to_vec
Dave Airlie [Thu, 14 Aug 2014 08:48:09 +0000 (18:48 +1000)]
glsl: add double support to lower_mat_op_to_vec

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: Linking support for doubles
Dave Airlie [Thu, 5 Feb 2015 10:11:58 +0000 (12:11 +0200)]
glsl: Linking support for doubles

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: Support double loop control
Dave Airlie [Thu, 5 Feb 2015 10:10:26 +0000 (12:10 +0200)]
glsl: Support double loop control

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: Support double inouts
Dave Airlie [Thu, 5 Feb 2015 10:09:04 +0000 (12:09 +0200)]
glsl: Support double inouts

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl/lexer: Support double floats
Dave Airlie [Thu, 5 Feb 2015 10:07:34 +0000 (12:07 +0200)]
glsl/lexer: Support double floats

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl/parser: Support double floats
Dave Airlie [Thu, 5 Feb 2015 10:06:20 +0000 (12:06 +0200)]
glsl/parser: Support double floats

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl/ast: Support double floats
Dave Airlie [Thu, 5 Feb 2015 10:04:58 +0000 (12:04 +0200)]
glsl/ast: Support double floats

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: Add ubo lowering support for doubles
Dave Airlie [Thu, 5 Feb 2015 10:00:11 +0000 (12:00 +0200)]
glsl: Add ubo lowering support for doubles

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: Add support doubles in optimization passes
Dave Airlie [Thu, 5 Feb 2015 09:58:05 +0000 (11:58 +0200)]
glsl: Add support doubles in optimization passes

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl/ir: Add builder support for functions with double floats
Dave Airlie [Thu, 5 Feb 2015 09:54:39 +0000 (11:54 +0200)]
glsl/ir: Add builder support for functions with double floats

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl/ir: Add builtin constant function support for doubles
Dave Airlie [Thu, 5 Feb 2015 09:53:10 +0000 (11:53 +0200)]
glsl/ir: Add builtin constant function support for doubles

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl/ir: Add cloning support for doubles
Dave Airlie [Thu, 5 Feb 2015 10:53:26 +0000 (12:53 +0200)]
glsl/ir: Add cloning support for doubles

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl/ir: Add printing support for doubles
Dave Airlie [Thu, 5 Feb 2015 10:52:19 +0000 (12:52 +0200)]
glsl/ir: Add printing support for doubles

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl/ir: Add builtin function support for doubles
Dave Airlie [Thu, 5 Feb 2015 09:50:43 +0000 (11:50 +0200)]
glsl/ir: Add builtin function support for doubles

v2: add d2b, more ir_constant stuff (Ilia)

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: fix uniform linking logic in the presence of structs
Ilia Mirkin [Tue, 10 Feb 2015 08:02:09 +0000 (03:02 -0500)]
glsl: fix uniform linking logic in the presence of structs

Add a enter/leave record callback so that the offset may be aligned to
the proper value. Otherwise only leaf fields are called, and the first
field needs to be aligned to the outer struct's base alignment while the
last field needs to be aligned to the inner struct's base alignment.

This removes most usage of the last field/record type values passed into
visit_field.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: teach std140_base_alignment about samplers
Ilia Mirkin [Sat, 14 Feb 2015 03:03:47 +0000 (22:03 -0500)]
glsl: teach std140_base_alignment about samplers

These functions are about to be used more aggressively for determining
uniform layout. Samplers may be inside of structs, and it's easier to
reuse the existing base alignment logic.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl: Uniform linking support for doubles
Dave Airlie [Thu, 5 Feb 2015 09:44:02 +0000 (11:44 +0200)]
glsl: Uniform linking support for doubles

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: Add double builtin type generation
Dave Airlie [Thu, 5 Feb 2015 09:38:44 +0000 (11:38 +0200)]
glsl: Add double builtin type generation

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: add ARB_gpu_shader_fp64 to the glsl extensions. (v2)
Dave Airlie [Wed, 11 Jun 2014 03:36:12 +0000 (13:36 +1000)]
glsl: add ARB_gpu_shader_fp64 to the glsl extensions. (v2)

v2: add define bit (Tapani Pälli)

Patch makes following Piglit tests pass:
   arb_gpu_shader_fp64/preprocessor/define.vert
   arb_gpu_shader_fp64/preprocessor/define.frag

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomesa: add double uniform support. (v5)
Dave Airlie [Wed, 11 Jun 2014 03:28:32 +0000 (13:28 +1000)]
mesa: add double uniform support. (v5)

This adds support for the new uniform interfaces
from ARB_gpu_shader_fp64.

v2:
support ARB_separate_shader_objects ProgramUniform*d* (Ian)
don't allow boolean uniforms to be updated (issue 15) (Ian)

v3: fix size_mul
v4: Teach uniform update to take into account double precision (Topi)
v5: add transpose for double case (Ilia)

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglsl: Add double builtin type
Dave Airlie [Sun, 8 Feb 2015 00:24:48 +0000 (19:24 -0500)]
glsl: Add double builtin type

This causes a lot of warnings about unchecked type in
switch statements - fix them later.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agomesa: add ARB_gpu_shader_fp64 extension info (v2)
Dave Airlie [Wed, 11 Jun 2014 03:27:22 +0000 (13:27 +1000)]
mesa: add ARB_gpu_shader_fp64 extension info (v2)

This just adds the entries to extensions.c and mtypes.h

v2: use core profile only (Ian)

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoglapi: add ARB_gpu_shader_fp64 (v2)
Dave Airlie [Wed, 11 Jun 2014 03:17:36 +0000 (13:17 +1000)]
glapi: add ARB_gpu_shader_fp64 (v2)

Just add the xml file covering this extension,
and dummy interface files in mesa, and fix up
sanity tests.

v2:
Enable ProgramUniform*d* from ARB_separate_shader_objects (Ian)
use 40 instead of 43 for dispatch_sanity.cpp (Chris)
uncomment PU sanity tests.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno: add missing PIPE_CAP_RESOURCE_FROM_USER_MEMORY to switch
Ilia Mirkin [Thu, 19 Feb 2015 03:36:13 +0000 (22:36 -0500)]
freedreno: add missing PIPE_CAP_RESOURCE_FROM_USER_MEMORY to switch

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno/a3xx: add ARB_instanced_arrays support
Ilia Mirkin [Tue, 2 Dec 2014 05:32:57 +0000 (00:32 -0500)]
freedreno/a3xx: add ARB_instanced_arrays support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno/a3xx: add support for vertexid and instanceid sysvals
Ilia Mirkin [Thu, 2 Oct 2014 03:13:22 +0000 (23:13 -0400)]
freedreno/a3xx: add support for vertexid and instanceid sysvals

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno: pass number of instances to draw
Ilia Mirkin [Wed, 22 Oct 2014 04:42:04 +0000 (00:42 -0400)]
freedreno: pass number of instances to draw

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno/a3xx: add ETC2 decoding support
Ilia Mirkin [Mon, 16 Feb 2015 07:28:50 +0000 (02:28 -0500)]
freedreno/a3xx: add ETC2 decoding support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agost/mesa: pass etc2 textures to driver if supported
Ilia Mirkin [Mon, 16 Feb 2015 07:27:37 +0000 (02:27 -0500)]
st/mesa: pass etc2 textures to driver if supported

If the driver actually supports ETC2, don't decode it in software.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agollvmpipe,softpipe: only support ETC1, not the upcoming ETC2
Ilia Mirkin [Thu, 19 Feb 2015 03:23:12 +0000 (22:23 -0500)]
llvmpipe,softpipe: only support ETC1, not the upcoming ETC2

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agogallium: add ETC2 format support
Ilia Mirkin [Mon, 16 Feb 2015 07:25:52 +0000 (02:25 -0500)]
gallium: add ETC2 format support

No actual decoding is added, similar faking mechanism to bptc.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agofreedreno/a3xx: add hardware ETC1 support
Ilia Mirkin [Mon, 16 Feb 2015 06:33:11 +0000 (01:33 -0500)]
freedreno/a3xx: add hardware ETC1 support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agogallium/dri: Shut up a compiler warning.
Eric Anholt [Wed, 11 Feb 2015 22:40:47 +0000 (14:40 -0800)]
gallium/dri: Shut up a compiler warning.

The compiler doesn't see that buffers is set in the !image case and used
in the !image case.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir: Recognize and reduce duplicated fsats.
Eric Anholt [Fri, 30 Jan 2015 22:10:58 +0000 (14:10 -0800)]
nir: Recognize and reduce duplicated fsats.

No effect on vc4 shader-db.

v2: Rebase to master (no TGSI->NIR present)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
9 years agonir: Add a flag for lowering fsat.
Eric Anholt [Fri, 30 Jan 2015 21:53:39 +0000 (13:53 -0800)]
nir: Add a flag for lowering fsat.

vc4 cse/algebraic-disabled stats:
total instructions in shared programs: 44356 -> 44354 (-0.00%)
instructions in affected programs:     55 -> 53 (-3.64%)

v2: Rebase to master (no TGSI->NIR present)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
9 years agonir: Add a flag for lowering ffma.
Eric Anholt [Fri, 30 Jan 2015 21:49:48 +0000 (13:49 -0800)]
nir: Add a flag for lowering ffma.

vc4 cse/algebraic-disabled stats:
total uniforms in shared programs: 13966 -> 13791 (-1.25%)
uniforms in affected programs:     435 -> 260 (-40.23%)
total instructions in shared programs: 44732 -> 44356 (-0.84%)
instructions in affected programs:     9599 -> 9223 (-3.92%)

v2: Rebase to master (no TGSI->NIR present)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
9 years agonir: Add a flag for lowering fneg/ineg.
Eric Anholt [Wed, 28 Jan 2015 18:52:53 +0000 (10:52 -0800)]
nir: Add a flag for lowering fneg/ineg.

vc4 cse/algebraic-disabled stats:
total instructions in shared programs: 44911 -> 44732 (-0.40%)
instructions in affected programs:     11371 -> 11192 (-1.57%)

v2: Fix broken iabs(isub(0, a)) transformation.
v3: Rebase to master (no TGSI->NIR present)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
9 years agonir: Add a flag for lowering fsqrt(x) to frcp(frsqrt(x)).
Eric Anholt [Wed, 28 Jan 2015 18:39:29 +0000 (10:39 -0800)]
nir: Add a flag for lowering fsqrt(x) to frcp(frsqrt(x)).

vc4 cse/algebraic-disabled stats:
total uniforms in shared programs: 13972 -> 13966 (-0.04%)
uniforms in affected programs:     408 -> 402 (-1.47%)
total instructions in shared programs: 44973 -> 44911 (-0.14%)
instructions in affected programs:     1551 -> 1489 (-4.00%)

v2: Rebase to master (no TGSI->NIR present)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
9 years agonir: Add lowering of POW instructions if the lower flag is set.
Eric Anholt [Wed, 28 Jan 2015 18:32:57 +0000 (10:32 -0800)]
nir: Add lowering of POW instructions if the lower flag is set.

This could be done in a separate pass like we do in GLSL IR, but it seems
to me like having the definitions of the transformations in the two
directions next to each other makes a lot of sense.

v2: Reorder the comment about the transformation.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Conditionalize the POW reconstruction on shader compiler options.
Eric Anholt [Wed, 28 Jan 2015 00:22:54 +0000 (16:22 -0800)]
nir: Conditionalize the POW reconstruction on shader compiler options.

Mesa has a shader compiler struct flagging whether GLSL IR's opt_algebraic
and other passes should try and generate certain types of opcodes or
patterns.  Extend that to NIR by defining our own struct, which is
automatically generated from the Mesa struct in glsl_to_nir and provided
directly by the driver in TGSI-to-NIR.

v2: Split out the previous two prep patches.
v3: Rebase to master (no TGSI->NIR present)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v2)
9 years agonir: Add an optional expression controlling nir_algebraic xforms.
Eric Anholt [Tue, 3 Feb 2015 00:20:06 +0000 (16:20 -0800)]
nir: Add an optional expression controlling nir_algebraic xforms.

This will be used so that we can customize the transforms for the target
GPU, so we don't un-lower expressions that had already been lowered (or
introduce new lowering transformations that not all GPUs want)

v2: Drop the complication of having the condition->index dictionary, since
    we don't actually expect there to be many different conditions (change
    by Kenneth).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Add a nir_shader_compiler_options struct pointed to by the shaders.
Eric Anholt [Tue, 3 Feb 2015 00:13:49 +0000 (16:13 -0800)]
nir: Add a nir_shader_compiler_options struct pointed to by the shaders.

This will be used to give the optimization passes a chance to customize
behavior for the particular target device.

v2: Rebase to master (no TGSI->NIR present)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
9 years agoi965/simd8vs: Fix SIMD8 atomics (read-only)
Jordan Justen [Tue, 17 Feb 2015 17:57:35 +0000 (09:57 -0800)]
i965/simd8vs: Fix SIMD8 atomics (read-only)

An update for d9cd982d556be560af3bcbcdaf62b6b93eb934a5.

A similar change was needed for CS to allow the piglit test
tests/spec/arb_compute_shader/execution/simple-barrier-atomics.shader_test
to pass.

The previous change (d9cd982d) should fix cases that write atomics,
such as atomicCounterIncrement, and this change will fix cases than
only read atomics, such as atomicCounter.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoilo: fix PCB alloc asserts on Gen7.5 GT3
Chia-I Wu [Wed, 18 Feb 2015 20:26:29 +0000 (13:26 -0700)]
ilo: fix PCB alloc asserts on Gen7.5 GT3

GT3 has two slices and all limits are doubled.

9 years agoilo: fix compiler warnings
Chia-I Wu [Tue, 17 Feb 2015 23:10:10 +0000 (16:10 -0700)]
ilo: fix compiler warnings

Fix -Wmaybe-uninitialized warnings.  The change to
ilo_blit_resolve_slices_for_hiz() is a potential bug fix.

9 years agoi915: For the love of all that is holy, stop saying "IGD"
Adam Jackson [Wed, 28 Jan 2015 21:28:12 +0000 (16:28 -0500)]
i915: For the love of all that is holy, stop saying "IGD"

a001 and a011 are pineview chips.  Say so.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
9 years agoauxiliary/vl: honour the DRI2PROTO_CFLAGS
Emil Velikov [Mon, 16 Feb 2015 19:11:33 +0000 (19:11 +0000)]
auxiliary/vl: honour the DRI2PROTO_CFLAGS

Otherwise for non-default installations the build will fail to find the
headers and error out.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoauxiliary/vl: Build vl_winsys_dri.c only when needed.
Emil Velikov [Mon, 16 Feb 2015 18:22:16 +0000 (18:22 +0000)]
auxiliary/vl: Build vl_winsys_dri.c only when needed.

With commit c39dbfdd0f7(auxiliary/vl: bring back the VL code for the dri
targets) we did not fully consider users of dri-swrast alone. Thus we
ended up trying to compile the dri2 specific code on platform which lack
it - Cygwin for example.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reported-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jon TURNEY <jon.turney@dronecode.org.uk>
9 years agoautomake: Use AM_DISTCHECK_CONFIGURE_FLAGS
Emil Velikov [Thu, 12 Feb 2015 15:27:28 +0000 (15:27 +0000)]
automake: Use AM_DISTCHECK_CONFIGURE_FLAGS

Currently we use DISTCHECK_CONFIGURE_FLAGS, which is reserved for
the user. As with other variables, one should use the AM_ variable
within the makefile.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglx: do not leak the dri2 extension information
Emil Velikov [Thu, 22 Jan 2015 17:35:40 +0000 (17:35 +0000)]
glx: do not leak the dri2 extension information

The XExtensionInfo is allocated dynamically (if the pointer is NULL)
in the XEXT_GENERATE_FIND_DISPLAY macro. On the other hand the
macro XEXT_GENERATE_CLOSE_DISPLAY does not check/free the memory.

Follow the example set by dri1 and appledri, and use a static variable.

Spotted while hunting "still reachable" leaks in Waffle.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoRevert "radeon/llvm: enable unsafe math for graphics shaders"
Michel Dänzer [Tue, 17 Feb 2015 08:03:35 +0000 (17:03 +0900)]
Revert "radeon/llvm: enable unsafe math for graphics shaders"

This reverts commit 0e9cdedd2e3943bdb7f3543a3508b883b167e427.

It caused the grass to disappear in The Talos Principle.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89069
Cc: "10.5 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agost/mesa: add ARB_pipeline_statistics_query support
Ilia Mirkin [Wed, 11 Feb 2015 05:36:47 +0000 (00:36 -0500)]
st/mesa: add ARB_pipeline_statistics_query support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoi965: implement ARB_pipeline_statistics_query
Ben Widawsky [Wed, 3 Dec 2014 02:33:12 +0000 (18:33 -0800)]
i965: implement ARB_pipeline_statistics_query

NOTE: The implementation was initially one patch, this. All the history is kept
here, even though all the core mesa changes were moved to the parent of this
patch.

This patch implements ARB_pipeline_statistics_query. This addition to GL does
not add a new API. Instead, it adds new tokens to the existing query APIs. The
work to hook up the new tokens is trivial due to it's similarity to the previous
work done for the query APIs. I've implemented all the new tokens to some
degree, but have stubbed out the untested ones at the entry point for Begin().
Doing this should allow the remainder of the code to be left in.

The new tokens give GL clients a way to obtain stats about the GL pipeline.
Generally, you get the number of things going in, invocations, and number of
things coming out, primitives, of the various stages. There are two immediate
uses for this, performance information, and debugging various types of
misrendering. I doubt one can use these for debugging very complex applications,
but for piglit tests, it should be quite useful.

Tessellation shaders, and compute shaders are not addressed in this patch
because there is no upstream implementation. I've implemented how I believe
tessellation shader stats will work for Intel hardware (though there is a bit of
ambiguity). Compute shaders are a bit more interesting though, and I don't yet
know what we'll do there.

For the lazy, here is a link to the relevant part of the spec:
https://www.opengl.org/registry/specs/ARB/pipeline_statistics_query.txt

Running the piglit tests
http://lists.freedesktop.org/archives/piglit/2014-November/013321.html
(http://cgit.freedesktop.org/~bwidawsk/piglit/log/?h=pipe_stats)
yield the following results:

> piglit-run.py -t stats tests/all.py output/pipeline_stats
> [5/5] pass: 5 Running Test(s): 5

v2:
- Don't allow pipeline_stats to be per stream (Ilia). This may (not sure) be
  needed for AMD_transform_feedback4, which we do not support.
   > If AMD_transform_feedback4 is supported then GEOMETRY_SHADER_PRIMITIVES_-
   > EMITTED_ARB counts primitives emitted to any of the vertex streams for
   > which STREAM_RASTERIZATION_AMD is enabled.
- Remove comment from GL3.txt because it is only used for extensions that are
  part of required versions (Ilia)
- Move the new tokens to a new XML doc instead of using the main GL4x.xml (Ilia)
- Add a fallthrough comment (Ilia)
- Only divide PS invocations by 4 on HSW+ (Ben)

v3:
- Add ARB_pipeline_statistics_query to relnotes.html
- Add ARB_pipeline_statistics_query.xml to the Makefile.am, and master XML (Ilia)
- Correct extension number (Ilia)
- Add link to xml in the main GL API xml (Ilia)
- remove special GS case from gen6_end_query (Ian)
- Make lookup table static so gcc doesn't initialized it on every call (Ian)
- Use if (_mesa_has_geometry_shaders(ctx)) instead of explicit checks (Ian)
- Core mesa parts moved into a prep patch (Ilia)

v4:
- Change to 10.6 relnotes since we missed 10.5 window
- Moved compute shader stuff into the switch statement (Jordan)
- Jordan: Add compute shader support

v5:
- Fixed relnote style (Ilia)

v6:
- Rebased on master which beat me to adding the first relnotes - essentially
  this undoes v5 (which had a typo anyway)
- Some code style fixes (Ken)
- Remove some excess comments (Ken)
- Unify tessellation failure style - unreachable (Ken)
- Fix workaround comment for PS invocations (Ken)

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: Add support for the ARB_pipeline_statistics_query extension
Ben Widawsky [Fri, 2 Jan 2015 20:13:53 +0000 (12:13 -0800)]
mesa: Add support for the ARB_pipeline_statistics_query extension

This was originally part of a single patch which added the extension, and
implemented it for i965 classic. For information about the evolution of the
patch, please see the subsequent commit.

One difference here as compared to the original mega patch is this does build
support for the compute shader query. Since it cannot be tested on any platform,
it will always return NULL for now. Jordan has already written a patch to
address this, and when that patch lands, this logic can be modified.

v2: Fix typo in subject (Brian Paul)
Add checks for desktop gl (Ilia)
Fail for any callers for now (Ilia)
Update QueryCounterBits for new tokens (Ilia)
Jordan: Use _mesa_has_compute_shaders

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
v3: Rebased on patch which adds the proper information to unstub tessellation
shaders.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: Add _mesa_has_compute_shaders
Jordan Justen [Sat, 14 Feb 2015 20:53:42 +0000 (12:53 -0800)]
mesa: Add _mesa_has_compute_shaders

v2 (Ben): Change GLboolean to bool as requested by Ian

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
9 years agomesa: Add ARB_tessellation_shader to extension table.
Fabian Bieler [Sun, 21 Sep 2014 01:40:42 +0000 (13:40 +1200)]
mesa: Add ARB_tessellation_shader to extension table.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Prefer Meta over the BLT for BlitFramebuffer.
Kenneth Graunke [Thu, 15 Jan 2015 09:41:14 +0000 (01:41 -0800)]
i965: Prefer Meta over the BLT for BlitFramebuffer.

There's some debate about whether we should use Meta or BLORP,
but either should run circles around the BLT engine.

In particular, this means that Gen8+ will use the 3D engine for blits,
like we do on Gen6-7.

Improves performance in "copypixrate -blit -back" (from Mesa demos)
by 232.037% +/- 3.15795% (n=10) on Broadwell GT3e.

v2: Rebase on Laura's changes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
9 years agoi965/fs: Add algebraic optimizations for MAD.
Matt Turner [Mon, 10 Nov 2014 01:27:52 +0000 (17:27 -0800)]
i965/fs: Add algebraic optimizations for MAD.

total instructions in shared programs: 5764176 -> 5763808 (-0.01%)
instructions in affected programs:     25121 -> 24753 (-1.46%)
helped:                                164
HURT:                                  2

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Emit MAD instructions when possible.
Matt Turner [Mon, 27 Oct 2014 05:08:15 +0000 (22:08 -0700)]
i965/fs: Emit MAD instructions when possible.

Previously we didn't emit MAD instructions since they cannot take
immediate arguments, but with the opt_combine_constants() pass we can
handle this properly.

total instructions in shared programs: 5920017 -> 5733278 (-3.15%)
instructions in affected programs:     3625153 -> 3438414 (-5.15%)
helped:                                22017
HURT:                                  870
GAINED:                                91
LOST:                                  49

Without constant pooling, this patch is a complete loss:

total instructions in shared programs: 5912589 -> 5987888 (1.27%)
instructions in affected programs:     3190050 -> 3265349 (2.36%)
helped:                                1564
HURT:                                  17827
GAINED:                                27
LOST:                                  101

And since the constant pooling patch by itself hurt a bunch of things,
from before constant pooling to this patch the results are:

total instructions in shared programs: 5895414 -> 5747946 (-2.50%)
instructions in affected programs:     3617993 -> 3470525 (-4.08%)
helped:                                20478
HURT:                                  4469
GAINED:                                54
LOST:                                  146

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Allow immediates in MAD and LRP instructions.
Matt Turner [Mon, 27 Oct 2014 05:07:06 +0000 (22:07 -0700)]
i965/fs: Allow immediates in MAD and LRP instructions.

And then the opt_combine_constants() pass will pull them out into
registers. This will allow us to do some algebraic optimizations on MAD
and LRP.

total instructions in shared programs: 5946656 -> 5931320 (-0.26%)
instructions in affected programs:     778247 -> 762911 (-1.97%)
helped:                                3780
HURT:                                  6
GAINED:                                12
LOST:                                  12

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Add pass to combine immediates.
Matt Turner [Wed, 12 Feb 2014 19:00:46 +0000 (11:00 -0800)]
i965/fs: Add pass to combine immediates.

total instructions in shared programs: 5885407 -> 5940958 (0.94%)
instructions in affected programs:     3617311 -> 3672862 (1.54%)
helped:                                3
HURT:                                  23556
GAINED:                                31
LOST:                                  165

... but will allow us to always emit MAD instructions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Remove force_writemask_all assertion for execsize < 8.
Matt Turner [Mon, 27 Oct 2014 05:10:53 +0000 (22:10 -0700)]
i965/fs: Remove force_writemask_all assertion for execsize < 8.

This doesn't seem to be necessary.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86974
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/cfg: Add function to generate a dot file of the dominator tree.
Matt Turner [Thu, 27 Feb 2014 00:15:52 +0000 (16:15 -0800)]
i965/cfg: Add function to generate a dot file of the dominator tree.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/cfg: Add function to generate a dot file of the CFG.
Matt Turner [Thu, 27 Feb 2014 00:07:52 +0000 (16:07 -0800)]
i965/cfg: Add function to generate a dot file of the CFG.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/cfg: Calculate the immediate dominators.
Matt Turner [Wed, 19 Feb 2014 00:35:56 +0000 (16:35 -0800)]
i965/cfg: Calculate the immediate dominators.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/cfg: Allow cfg::dump to be called without a visitor.
Matt Turner [Wed, 19 Feb 2014 00:38:07 +0000 (16:38 -0800)]
i965/cfg: Allow cfg::dump to be called without a visitor.

The fs_visitor's dump_instruction() implementation calls cfg_t()
indirectly through calculate_live_intervals, so if you have an infinite
loop in the CFG code, you can't call cfg::dump(fs_visitor *) to debug
it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Allow exec_list sentinels as arguments to insert functions.
Matt Turner [Wed, 18 Feb 2015 02:01:41 +0000 (18:01 -0800)]
i965: Allow exec_list sentinels as arguments to insert functions.

To insert an instruction at the end of a basic block, we typically do
something like

   inst = block->last_non_control_flow_inst();
   inst->insert_after(block, new_inst);

But blocks can consist of a single control flow instruction, so inst
will actually be the exec_list's head sentinel. We shouldn't use it as
if it were a regular instruction, but it is safe to insert something after
it.

This patch avoids assert-failing because an exec_list sentinel wasn't in
the basic block's instruction list.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoMake _mesa_swizzle_and_convert argument types in .c match those in .h
Alan Coopersmith [Mon, 16 Feb 2015 00:20:25 +0000 (16:20 -0800)]
Make _mesa_swizzle_and_convert argument types in .c match those in .h

Caused Solaris Studio compilers to fail to build with errors about
incompatible function redefinitions.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoUse __typeof instead of typeof with Solaris Studio compilers
Alan Coopersmith [Mon, 16 Feb 2015 00:19:06 +0000 (16:19 -0800)]
Use __typeof instead of typeof with Solaris Studio compilers

While the C compiler accepts typeof, C++ requires __typeof.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86944
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoAvoid fighting with Solaris headers over isnormal()
Alan Coopersmith [Mon, 16 Feb 2015 00:16:15 +0000 (16:16 -0800)]
Avoid fighting with Solaris headers over isnormal()

When compiling in C99 or C++11 modes, Solaris defines isnormal() as
a macro via <math.h>, which causes the function definition to become
too mangled to compile.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoRemove extraneous ; after DECL_TYPE usage
Alan Coopersmith [Sun, 15 Feb 2015 22:46:29 +0000 (14:46 -0800)]
Remove extraneous ; after DECL_TYPE usage

The macro is defined to provide a trailing ; so this caused the expansion
to end in ";;" which made the Solaris Studio compilers issue warnings for
every line of:
  "builtin_type_macros.h", line 113: Warning: extra ";" ignored.
for every file that included the header, filling build logs with thousands
of useless warnings.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>