mesa.git
9 years agonir/lower_vec_to_movs: Don't emit unneeded movs
Jason Ekstrand [Wed, 23 Sep 2015 04:32:06 +0000 (21:32 -0700)]
nir/lower_vec_to_movs: Don't emit unneeded movs

It's possible that, if a vecN operation is involved in a phi node, that we
could end up moving from a register to itself.  If swizzling is involved,
we need to emit the move but.  However, if there is no swizzling, then the
mov is a no-op and we might as well not bother emitting it.

Shader-db results on Haswell:

   total instructions in shared programs: 6262536 -> 6259558 (-0.05%)
   instructions in affected programs:     184780 -> 181802 (-1.61%)
   helped:                                838
   HURT:                                  0

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir/lower_vec_to_movs: Properly handle source modifiers on vecN ops
Jason Ekstrand [Wed, 23 Sep 2015 04:11:23 +0000 (21:11 -0700)]
nir/lower_vec_to_movs: Properly handle source modifiers on vecN ops

I don't know of any piglit tests that are currently broken.  However, there
is nothing stopping a vecN instruction from getting source modifiers and
lower_vec_to_movs is run after we lower to source modifiers.

Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi915: Make hw_prim[] const
Ville Syrjälä [Mon, 23 Mar 2015 12:47:28 +0000 (14:47 +0200)]
i915: Make hw_prim[] const

The table used to map the GL primitive to the hw primitive never
changes so make it const.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agot_dd_dmatmp: Make the render_tab[]s const
Ville Syrjälä [Mon, 23 Mar 2015 12:47:23 +0000 (14:47 +0200)]
t_dd_dmatmp: Make the render_tab[]s const

These tables hold function pointers and they never change so
make them const.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: Remove unused HAVE_TRI_STRIP_1 defines
Ian Romanick [Tue, 15 Sep 2015 00:57:15 +0000 (17:57 -0700)]
mesa: Remove unused HAVE_TRI_STRIP_1 defines

Defined to 0 in a few places, but it's not used anywhere.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Constify dmasz
Ian Romanick [Tue, 15 Sep 2015 00:29:50 +0000 (17:29 -0700)]
t_dd_dmatmp: Constify dmasz

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Silence comparison between signed and unsigned integer expression warnings
Ian Romanick [Tue, 15 Sep 2015 00:26:10 +0000 (17:26 -0700)]
t_dd_dmatmp: Silence comparison between signed and unsigned integer expression warnings

../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:83:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:83:55: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                                                       ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:116:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:116:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:140:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:140:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h: In function 'intel_render_line_loop_verts':
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:174:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:174:55: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                                                       ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:224:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:224:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:255:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:255:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:281:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j + 1);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:281:56: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j + 1);
                                                        ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h: In function 'intel_render_poly_verts':
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:313:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j + 1);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:313:59: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j + 1);
                                                           ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:365:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - nr);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:365:56: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - nr);
                                                        ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:83:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:83:55: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                                                       ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:116:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:116:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:140:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:140:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h: In function 'radeon_dma_render_line_loop_verts':
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:174:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:174:55: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j);
                                                       ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:224:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:224:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:255:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:255:52: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j);
                                                    ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:281:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       nr = MIN2(currentsz, count - j + 1);
                         ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:281:56: warning: signed and unsigned type in conditional expression [-Wsign-compare]
       nr = MIN2(currentsz, count - j + 1);
                                                        ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h: In function 'radeon_dma_render_poly_verts':
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:313:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - j + 1);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:313:59: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - j + 1);
                                                           ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:365:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
          nr = MIN2(currentsz, count - nr);
                            ^
../../../../../src/mesa/tnl_dd/t_dd_dmatmp.h:365:56: warning: signed and unsigned type in conditional expression [-Wsign-compare]
          nr = MIN2(currentsz, count - nr);
                                                        ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Use stdbool.h
Ian Romanick [Tue, 15 Sep 2015 00:12:06 +0000 (17:12 -0700)]
t_dd_dmatmp: Use stdbool.h

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: General indentation and formatting fixes
Ian Romanick [Tue, 15 Sep 2015 00:10:05 +0000 (17:10 -0700)]
t_dd_dmatmp: General indentation and formatting fixes

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_ELTS change
Ian Romanick [Tue, 15 Sep 2015 00:04:33 +0000 (17:04 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_ELTS change

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Remove HAVE_ELTS support
Ian Romanick [Mon, 14 Sep 2015 23:57:32 +0000 (16:57 -0700)]
t_dd_dmatmp: Remove HAVE_ELTS support

Two drivers use this file, and neither supports ELTs.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_TRI_FANS change
Ian Romanick [Mon, 14 Sep 2015 21:35:51 +0000 (14:35 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_TRI_FANS change

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Require HAVE_TRI_FANS
Ian Romanick [Mon, 14 Sep 2015 21:31:09 +0000 (14:31 -0700)]
t_dd_dmatmp: Require HAVE_TRI_FANS

Two drivers use this file, and both support triangle fans.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_TRI_STRIPS change
Ian Romanick [Mon, 14 Sep 2015 21:29:31 +0000 (14:29 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_TRI_STRIPS change

v2: Fix '- nr' typo noticed by Marius.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com> [v1]
9 years agot_dd_dmatmp: Require HAVE_TRI_STRIPS
Ian Romanick [Mon, 14 Sep 2015 21:23:44 +0000 (14:23 -0700)]
t_dd_dmatmp: Require HAVE_TRI_STRIPS

Two drivers use this file, and both support triangle strips.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Require HAVE_TRIANGLES
Ian Romanick [Mon, 14 Sep 2015 21:19:44 +0000 (14:19 -0700)]
t_dd_dmatmp: Require HAVE_TRIANGLES

Two drivers use this file, and both support triangles.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_LINE_STRIPS change
Ian Romanick [Mon, 14 Sep 2015 21:14:08 +0000 (14:14 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_LINE_STRIPS change

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Require HAVE_LINE_STRIPS
Ian Romanick [Mon, 14 Sep 2015 21:08:40 +0000 (14:08 -0700)]
t_dd_dmatmp: Require HAVE_LINE_STRIPS

Two drivers use this file, and both support line strips.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_LINES change
Ian Romanick [Mon, 14 Sep 2015 21:51:46 +0000 (14:51 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_LINES change

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Require HAVE_LINES
Ian Romanick [Mon, 14 Sep 2015 19:46:21 +0000 (12:46 -0700)]
t_dd_dmatmp: Require HAVE_LINES

Two drivers use this file, and both support lines.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Indentation and formatting fixes after HAVE_QUADS change
Ian Romanick [Mon, 14 Sep 2015 19:41:33 +0000 (12:41 -0700)]
t_dd_dmatmp: Indentation and formatting fixes after HAVE_QUADS change

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Remove HAVE_QUADS support
Ian Romanick [Mon, 14 Sep 2015 19:38:19 +0000 (12:38 -0700)]
t_dd_dmatmp: Remove HAVE_QUADS support

Two drivers use this file, and neither supports quads.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Remove HAVE_QUAD_STRIPS support
Ian Romanick [Mon, 14 Sep 2015 19:36:33 +0000 (12:36 -0700)]
t_dd_dmatmp: Remove HAVE_QUAD_STRIPS support

Two drivers use this file, and neither supports quad strips.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agot_dd_dmatmp: Use addition instead of subtraction in loop bounds
Ian Romanick [Mon, 14 Sep 2015 18:59:22 +0000 (11:59 -0700)]
t_dd_dmatmp: Use addition instead of subtraction in loop bounds

This is used everywhere else in this file because it avoids problems
when count is zero (due to trimming).

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38109
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: Marius Predut <marius.predut@intel.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agot_dd_dmatmp: Pull out common 'count -= count & 3' code
Ian Romanick [Mon, 14 Sep 2015 18:56:20 +0000 (11:56 -0700)]
t_dd_dmatmp: Pull out common 'count -= count & 3' code

This was missing in the HAVE_TRIANGLES path, and that could cause
incorrect rendering.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=38109
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: Marius Predut <marius.predut@intel.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agot_dd_dmatmp: Use '& 3' instead of '% 4' everywhere
Ian Romanick [Mon, 14 Sep 2015 18:50:28 +0000 (11:50 -0700)]
t_dd_dmatmp: Use '& 3' instead of '% 4' everywhere

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agot_dd_dmatmp: Clean up improper code formatting from previous patch
Ian Romanick [Mon, 14 Sep 2015 18:46:50 +0000 (11:46 -0700)]
t_dd_dmatmp: Clean up improper code formatting from previous patch

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agot_dd_dmatmp: Make "count" actually be the count
Ian Romanick [Mon, 14 Sep 2015 18:37:12 +0000 (11:37 -0700)]
t_dd_dmatmp: Make "count" actually be the count

The value passed in count previously was "vertex after the last vertex
to be processed."  Calling that "count" was misleading and kind of mean.
Looking at the code, many functions immediately do "count-start" to get
back the true count.  That's just silly.

If it is better for the loops to be 'for (j = start; j < (start +
count); j++)', GCC will do that transformation.

NOTE: There is some strange formatting left by this patch.  That was
done to make it more obvious that the before and after code is
equivalent.  These will be fixed in the next patch.

No piglit regressions on i915 (G33) or radeon (Radeon 7500).

v2: Fix a remaining (count-start) in render_quad_strip_verts.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com> [v1]
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agoi965/vec4: Don't coalesce regs in Gen6 MATH ops if reswizzle/writemask needed
Antia Puentes [Tue, 22 Sep 2015 16:17:45 +0000 (18:17 +0200)]
i965/vec4: Don't coalesce regs in Gen6 MATH ops if reswizzle/writemask needed

Gen6 MATH instructions can not execute in align16 mode, so swizzles or
writemasking are not allowed.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92033
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: Fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for default framebuffer.
Iago Toral Quiroga [Tue, 24 Feb 2015 18:02:56 +0000 (19:02 +0100)]
mesa: Fix GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE for default framebuffer.

From section 9.2. Binding and Managing Framebuffer Objects:

"Upon successful return from Get*FramebufferAttachmentParameteriv, if
pname is FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, then params will contain
one of NONE, FRAMEBUFFER_DEFAULT, TEXTURE, or RENDERBUFFER, identifying
the type of object which contains the attached image."

And then it clarifies further:

"If the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE is NONE, then
either no framebuffer is bound to target; or the default framebuffer is
bound, attachment is DEPTH or STENCIL, and the number of depth or stencil
bits, respectively, is zero"

Currently, if the default framebuffer is bound, we always return
GL_FRAMEBUFFER_DEFAULT for FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, but
according to the spec, when GL_DEPTH or GL_STENCIL attachments are
the ones being queried, we should return GL_NONE if they don't exist.

Fixes the following dEQP test:
dEQP-GLES3.functional.state_query.fbo.framebuffer_attachment_x_size_initial

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoglsl: bail out early in _mesa_ShaderSource if no shaderobj
Tapani Pälli [Tue, 22 Sep 2015 11:34:11 +0000 (14:34 +0300)]
glsl: bail out early in _mesa_ShaderSource if no shaderobj

Patch fixes a crash in conformance test that tries out different
invalid arguments for glShaderSource and glGetShaderSource:

   ES2-CTS.gtf.GL.glGetShaderSource.getshadersource_programhandle

This is a regression from commit:
   04e201d0c02cd30ace5c6fe80e9f021ebb733682

Additions in v2 also fix following failing deqp test:
   dEQP-GLES[2|3].functional.negative_api.shader.shader_source

v2: cleanup function, do check earlier (Iago Toral)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
9 years agoi965/vec4: Detect and delete useless MOVs.
Matt Turner [Mon, 21 Sep 2015 20:58:19 +0000 (13:58 -0700)]
i965/vec4: Detect and delete useless MOVs.

With NIR:

instructions in affected programs:     111508 -> 109193 (-2.08%)
helped:                                507

Without NIR:

instructions in affected programs:     28763 -> 28474 (-1.00%)
helped:                                186

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoprog_to_nir: Use nir_op_dph
Jason Ekstrand [Tue, 22 Sep 2015 23:57:03 +0000 (16:57 -0700)]
prog_to_nir: Use nir_op_dph

Shader-db results on HSW:

   instructions in affected programs:     72 -> 56 (-22.22%)

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/lower_alu_to_scalar: Add support for nir_op_fdph
Jason Ekstrand [Wed, 23 Sep 2015 00:29:49 +0000 (17:29 -0700)]
nir/lower_alu_to_scalar: Add support for nir_op_fdph

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/vec4: Add support for fdph_replicated
Jason Ekstrand [Tue, 22 Sep 2015 23:55:42 +0000 (16:55 -0700)]
i965/vec4: Add support for fdph_replicated

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Add fdph and fdph_replicated opcodes
Jason Ekstrand [Tue, 22 Sep 2015 23:54:27 +0000 (16:54 -0700)]
nir: Add fdph and fdph_replicated opcodes

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/lower_alu_to_scalar: Return after lower_reduction
Jason Ekstrand [Wed, 23 Sep 2015 00:16:59 +0000 (17:16 -0700)]
nir/lower_alu_to_scalar: Return after lower_reduction

We don't use any of the code after the switch anyway.  Since we check for
num_components == 1 and early-return, it doesn't get executed so
everything's ok.  However, it makes it much clearer what's going on if we
simply do an early return.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/lower_alu_to_scalar: Use the builder
Jason Ekstrand [Wed, 23 Sep 2015 00:14:45 +0000 (17:14 -0700)]
nir/lower_alu_to_scalar: Use the builder

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Add defines for tessellation stages
Chris Forbes [Tue, 9 Sep 2014 09:15:09 +0000 (21:15 +1200)]
i965: Add defines for tessellation stages

v2 (Ken):
- Squash together commits for HS, DS, and TE, as well as fixes.
- Add INTEL_MASK variants so we can use SET_FIELD if we want.
- Rename GEN7_HS_INSTANCE_CONTROL to GEN7_HS_INSTANCE_COUNT to match
  the documentation.
- Add some more fields from the PRMs.
- Add Broadwell variants.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agor600g: update num_dw in scissor_enable workaround
Grazvydas Ignotas [Tue, 22 Sep 2015 22:50:31 +0000 (01:50 +0300)]
r600g: update num_dw in scissor_enable workaround

"r600g: apply disable workaround on all scissors" forgot to update
num_dw, fix it.

Fixes: fbb423b433 "r600g: apply disable workaround on all scissors"
Reported-and-tested-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi965/vec4: refactor brw_vec4_copy_propagation.
Alejandro Piñeiro [Wed, 16 Sep 2015 15:19:50 +0000 (17:19 +0200)]
i965/vec4: refactor brw_vec4_copy_propagation.

Now it is more similar to brw_fs_copy_propagation, with three
clear stages:

1) Build up the value we are propagating as if it were the source of a
single MOV:
2) Check that we can propagate that value
3) Build the final value

Previously everything was somewhat messed up, making the
implementation on some specific cases, like knowing if you can
propagate from a previous instruction even with type mismatches, even
messier (for example, with the need of maintaining more of one
has_source_modifiers). The refactoring clears stuff, and gives
support to this mentioned use case without doing anything extra
(for example, only one has_source_modifiers is used).

Shader-db results for vec4 programs on Haswell:
total instructions in shared programs: 1683842 -> 1669037 (-0.88%)
instructions in affected programs:     739837 -> 725032 (-2.00%)
helped:                                6237
HURT:                                  0

v2: using 'arg' index to get the from inst was wrong
v3: rebased against last change on the previous patch of the series
v4: don't need to track instructions on struct copy_entry, as we
    only set the source on a direct copy
v5: change the approach for a refactoring
v6: tweaked comments

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agost/mesa: remove st_bind_framebuffer()
Brian Paul [Mon, 21 Sep 2015 15:03:45 +0000 (09:03 -0600)]
st/mesa: remove st_bind_framebuffer()

The function was a no-op and if the ctx->Driver.BindFramebuffer pointer
is null, Mesa won't try to use it.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: const-qualify _mesa_is_legal_tex_storage_format ctx param
Brian Paul [Thu, 17 Sep 2015 15:49:07 +0000 (09:49 -0600)]
mesa: const-qualify _mesa_is_legal_tex_storage_format ctx param

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: const-qualify _mesa_base_tex_format() ctx param
Brian Paul [Thu, 17 Sep 2015 15:47:36 +0000 (09:47 -0600)]
mesa: const-qualify _mesa_base_tex_format() ctx param

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: const-qualify buffer_object_subdata_range_good() bufObj parameter
Brian Paul [Thu, 17 Sep 2015 15:45:42 +0000 (09:45 -0600)]
mesa: const-qualify buffer_object_subdata_range_good() bufObj parameter

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: whitespace, comment fixes in texstorage.c
Brian Paul [Thu, 17 Sep 2015 15:45:20 +0000 (09:45 -0600)]
mesa: whitespace, comment fixes in texstorage.c

9 years agomesa/es3.1: Enable GL_ARB_vertex_attrib_binding functionality for GLES 3.1
Marta Lofstedt [Wed, 19 Aug 2015 18:25:24 +0000 (20:25 +0200)]
mesa/es3.1: Enable GL_ARB_vertex_attrib_binding functionality for GLES 3.1

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
9 years agomesa/es3.1: Allow query of Vertex bindings for GLES 3.1
Marta Lofstedt [Wed, 19 Aug 2015 18:25:23 +0000 (20:25 +0200)]
mesa/es3.1: Allow query of Vertex bindings for GLES 3.1

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
9 years agomesa/es3.1 : Align OpenGL ES 3.1 glBindVertexBuffer error handling with OpenGL Core
Marta Lofstedt [Wed, 19 Aug 2015 18:25:22 +0000 (20:25 +0200)]
mesa/es3.1 : Align OpenGL ES 3.1 glBindVertexBuffer error handling with OpenGL Core

According to OpenGL ES 3.1 specification 10.3.1:
"An INVALID_OPERATION error is generated if buffer is not zero
or a name returned from a previous call to GenBuffers,
or if such a name has since been deleted with DeleteBuffers."
This error check was previously limited to OpenGL Core.

Signed-off-by: Marta Lofstedt <marta.lofstedt@intel.com>
9 years agoi965: fix textureGrad for cubemaps
Tapani Pälli [Mon, 7 Sep 2015 12:08:13 +0000 (15:08 +0300)]
i965: fix textureGrad for cubemaps

Fixes bugs exposed by commit
2b1cdb0eddb73f62e4848d4b64840067f1f70865 in:
   ES3-CTS.gtf.GL3Tests.shadow.shadow_execution_frag

No regressions observed in deqp, CTS or Piglit.

v2: address review feedback from Iago Toral:
   - move rho calculation to else branch
   - optimize dx and dy calculation
   - fix documentation inconsistensies

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Kevin Rogovin <kevin.rogovin@intel.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=91114
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agonir: Report progress from nir_normalize_cubemap_coords().
Kenneth Graunke [Thu, 17 Sep 2015 20:18:41 +0000 (13:18 -0700)]
nir: Report progress from nir_normalize_cubemap_coords().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Add braces around multi-line loop.
Kenneth Graunke [Thu, 17 Sep 2015 20:08:03 +0000 (13:08 -0700)]
nir: Add braces around multi-line loop.

This was correct but not our usual style.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from nir_lower_system_values().
Kenneth Graunke [Thu, 17 Sep 2015 20:00:58 +0000 (13:00 -0700)]
nir: Report progress from nir_lower_system_values().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from nir_split_var_copies().
Kenneth Graunke [Thu, 17 Sep 2015 19:33:36 +0000 (12:33 -0700)]
nir: Report progress from nir_split_var_copies().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from nir_lower_locals_to_regs().
Kenneth Graunke [Thu, 17 Sep 2015 19:29:49 +0000 (12:29 -0700)]
nir: Report progress from nir_lower_locals_to_regs().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from nir_remove_dead_variables().
Kenneth Graunke [Thu, 17 Sep 2015 17:57:14 +0000 (10:57 -0700)]
nir: Report progress from nir_remove_dead_variables().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from lower_vec_to_movs().
Jason Ekstrand [Thu, 10 Sep 2015 00:50:09 +0000 (17:50 -0700)]
nir: Report progress from lower_vec_to_movs().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Report progress from nir_lower_globals_vars_to_local().
Kenneth Graunke [Thu, 17 Sep 2015 15:38:10 +0000 (08:38 -0700)]
nir: Report progress from nir_lower_globals_vars_to_local().

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965: Clean up GLSL compiler option setup
Jason Ekstrand [Mon, 21 Sep 2015 18:18:23 +0000 (11:18 -0700)]
i965: Clean up GLSL compiler option setup

The only functional change here is that we now set EmitNoIndirectOutput and
EmitNoIndirectTemp for compute shaders.  Compute shaders don't have outputs
per-se and we should have been setting EmitNoIndirectTemp all along.

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoconfigure.ac: Add support to enable read-only text segment on x86.
Jeremy Huddleston [Sat, 29 Aug 2015 21:51:45 +0000 (14:51 -0700)]
configure.ac: Add support to enable read-only text segment on x86.

Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.gentoo.org/240956
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965/skl: Use larger URB size where available.
Ben Widawsky [Thu, 10 Sep 2015 23:59:12 +0000 (16:59 -0700)]
i965/skl: Use larger URB size where available.

All SKL SKUs except the lowest one which has half the L3 size actually have 384K
of URB per slice.

For once, I can explain how this mistake was made and how it was missed in
review...  Historically when we enable a platform and put the production sizes,
you can simply look at the "smallest" SKU and see what its URB size is (and we
assumed it was the 1 slice variant). Since on newer platforms the URB sizes are
scaled automatically by HW, this was sufficient. On SKL, this is a bit different
as the lowest SKU actually has half of the L3 fused off. GT2 is the 1 slice (not
GT1) variant and it has 384K.

There are no Jenkins tests fixed (or regressions) and we don't expect any fixes
here because you can always run with less URB size.

Thanks to Sarah for bringing this to my attention.

Cc: Sarah Sharp <sarah.a.sharp@intel.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
9 years agonir/builder: Don't use designated initializers
Jason Ekstrand [Mon, 21 Sep 2015 15:22:12 +0000 (08:22 -0700)]
nir/builder: Don't use designated initializers

Designated initializers are not allowed in C++ (not even C++11).  Since
nir_lower_samplers is now using nir_builder, and nir_lower_samplers is in
C++, this breaks the build on some compilers.  Aparently, GCC 5 allows it
in some limited extent because mesa still builds on my system without this
patch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92052
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: Move system value -> intrinsic mapping into nir.c
Jason Ekstrand [Thu, 10 Sep 2015 23:53:08 +0000 (16:53 -0700)]
nir: Move system value -> intrinsic mapping into nir.c

This way they're right next to the map going the other direction.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: rename nir_lower_samplers.c{pp,}
Emil Velikov [Thu, 17 Sep 2015 15:12:17 +0000 (16:12 +0100)]
nir: rename nir_lower_samplers.c{pp,}

With the only C++ function having its own wrapper we can 'demote' this
file to a normal C one. This allows us to get rid of extern C { #include
<foo.h> } 'hacks'. Plus some of the headers may use C99 initializers,
which are not supported by the ISO standard.

This may cause build issue on incremental builds. If so run the
following:

sed -i -e 's|samplers\.cpp|samplers.c|' src/glsl/nir/.deps/nir_lower_samplers.Plo

Fixes: ef8eebc6ad5(nir: support indirect indexing samplers in struct arrays)
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reported-by: Gottfried Haider <gottfried.haider@gmail.com>
Tested-by: Gottfried Haider <gottfried.haider@gmail.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agonir: add C wrapper around glsl_type::record_location_offset
Emil Velikov [Thu, 17 Sep 2015 14:57:26 +0000 (15:57 +0100)]
nir: add C wrapper around glsl_type::record_location_offset

This will allow us to convert nir_lower_sampler.cpp to C.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Gottfried Haider <gottfried.haider@gmail.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agonir: move stdio.h inclusion before extern C
Emil Velikov [Thu, 17 Sep 2015 15:03:48 +0000 (16:03 +0100)]
nir: move stdio.h inclusion before extern C

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Tested-by: Gottfried Haider <gottfried.haider@gmail.com>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
9 years agoi965: Fix MRF register number assertions for compr4.
Kenneth Graunke [Mon, 21 Sep 2015 14:42:27 +0000 (07:42 -0700)]
i965: Fix MRF register number assertions for compr4.

compr4 is represented by setting the high bit on the MRF number.
We need to mask it out before sanity checking the register number.

Fixes ~8000 assert fails on Ironlake and G45.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92066
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoradeonsi: implement TXQS support
Ilia Mirkin [Fri, 18 Sep 2015 23:08:35 +0000 (19:08 -0400)]
radeonsi: implement TXQS support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Tested-by: Fredrik Bruhn <f@unibap.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoradeonsi: load fmask ptr relative to the resources array
Ilia Mirkin [Sat, 19 Sep 2015 20:19:26 +0000 (16:19 -0400)]
radeonsi: load fmask ptr relative to the resources array

res_ptr already contains the resource values. fmask_ptr needs to be
looked up relative to the start of the resource params.

Note that this only affects indirect loads of MS sampler arrays.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "11.0" <mesa-stable@lists.freedesktop.org>
9 years agoi965/vec4: Use MRF registers 21-23 for spilling in gen6
Iago Toral Quiroga [Thu, 17 Sep 2015 11:43:52 +0000 (13:43 +0200)]
i965/vec4: Use MRF registers 21-23 for spilling in gen6

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Use MRF registers 21-23 for spilling in gen6
Iago Toral Quiroga [Tue, 15 Sep 2015 14:33:48 +0000 (16:33 +0200)]
i965/fs: Use MRF registers 21-23 for spilling in gen6

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Turn BRW_MAX_MRF into a macro that accepts a hardware generation
Iago Toral Quiroga [Tue, 15 Sep 2015 14:00:26 +0000 (16:00 +0200)]
i965: Turn BRW_MAX_MRF into a macro that accepts a hardware generation

There are some bug reports about shaders failing to compile in gen6
because MRF 14 is used when we need to spill. For example:
https://bugs.freedesktop.org/show_bug.cgi?id=86469
https://bugs.freedesktop.org/show_bug.cgi?id=90631

Discussion in bugzilla pointed to the fact that gen6 might actually have
24 MRF registers available instead of 16, so we could use other MRF
registers and avoid these conflicts (we still need to investigate why
some shaders need up to MRF 14 anyway, since this is not expected).

Notice that the hardware docs are not clear about this fact:

SNB PRM Vol4 Part2's "Table 5-4. MRF Registers Available in Device
Hardware" says "Number per Thread" - "24 registers"

However, SNB PRM Vol4 Part1, 1.6.1 Message Register File (MRF) says:

"Normal threads should construct their messages in m1..m15. (...)
Regardless of actual hardware implementation, the thread should
not assume th at MRF addresses above m15 wrap to legal MRF registers."

Therefore experimentation was necessary to evaluate if we had these extra
MRF registers available or not. This was tested in gen6 using MRF
registers 21..23 for spilling and doing a full piglit run (all.py) forcing
spilling of everything on the FS backend. It was also tested by doing
spilling of everything on both the FS and the VS backends with a piglit run
of shader.py. In both cases no regressions were observed. In fact, many of
these tests where helped in the cases where we forced spilling, since that
triggered the same underlying problem described in the bug reports. Here are
some results using INTEL_DEBUG=spill_fs,spill_vec4 for a shader.py run on
gen6 hardware:

Using MRFs 13..15 for spilling:
crash: 2, fail: 113, pass: 6621, skip: 5461

Using MRFs 21..23 for spilling:
crash: 2, fail: 12, pass: 6722, skip: 5461

This patch sets the ground for later patches to implement spilling
using MRF registers 21..23 in gen6.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Move MRF register asserts out of brw_reg.h
Iago Toral Quiroga [Wed, 16 Sep 2015 07:08:19 +0000 (09:08 +0200)]
i965: Move MRF register asserts out of brw_reg.h

In a later patch we will make BRW_MAX_MRF return a different value depending
on the hardware generation, but it is inconvenient to add a gen parameter
to the brw_reg functions only for the assertions, so move these to places where
we have the hardware generation available.

Ken suggested to add the asserts to brw_set_src0 and brw_set_dest since that
would make sure that we catch all uses of MRF registers, even those coming
from modules that generate native code directly, like blorp. Unfortunately,
this is very late in the process which can make things harder to debug, so add
asserts to the generator as well.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Maximum allowed size of SEND messages is 15 (4 bits)
Iago Toral Quiroga [Fri, 18 Sep 2015 06:15:52 +0000 (08:15 +0200)]
i965: Maximum allowed size of SEND messages is 15 (4 bits)

Until now we only used MRFs 1..15 for regular SEND messages, so the
message length could not possibly exceed the maximum size. Soon we'll
allow to use MRF registers 1..23 in gen6, so we need to be careful
not to build messages that can go beyond the limit. That could occur,
specifically, when building URB write messages, which we may need to
split in chunks due to their size. Previously we would simply go and
create a new message when we reached MRF 13 (since 13..15 were
reserved for spilling), now we also want to check the size of the
message explicitly.

Besides adding that condition to split URB write messages properly,
this patch also adds asserts in the generator. Notice that
brw_inst_set_mlen already asserts for this, but asserting in the
generators is easy and can make debugging easier in some cases.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/print: fix coverity error
Rob Clark [Sun, 20 Sep 2015 18:02:29 +0000 (14:02 -0400)]
nir/print: fix coverity error

Not something actually hit in real life (now state is never non-null,
but only case state->syms is null is if nir_print_instr() path).  But it
was something I overlooked the first time, so might as well fix it.

    *** CID 1324642:  Null pointer dereferences  (REVERSE_INULL)
    /src/glsl/nir/nir_print.c: 299 in print_var_decl()
    293
    294           fprintf(fp, " (%s, %u)", loc, var->data.driver_location);
    295        }
    296
    297        fprintf(fp, "\n");
    298
    >>>     CID 1324642:  Null pointer dereferences  (REVERSE_INULL)
    >>>     Null-checking "state" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    299        if (state) {
    300           _mesa_set_add(state->syms, name);
    301           _mesa_hash_table_insert(state->ht, var, name);
    302        }
    303     }
    304

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agoi965/vec4/nir: Remove all "this->" snippets
Eduardo Lima Mitev [Fri, 18 Sep 2015 08:30:12 +0000 (10:30 +0200)]
i965/vec4/nir: Remove all "this->" snippets

For consistency, either we have all class members dereferenced, or none.
In this case, very few are so lets get rid of them all.

Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agodri/common: fix gbm-symbols-check regression
Marcin Ślusarz [Sun, 20 Sep 2015 11:40:10 +0000 (13:40 +0200)]
dri/common: fix gbm-symbols-check regression

Broken by commit c228514c72cb2fd5fb9e510808e29204fc9e7ae1
"dri/common: use sysconfdir when looking for drirc".

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92054
Signed-off-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
9 years agodocs: add news item and link release notes for 10.6.8
Emil Velikov [Sun, 20 Sep 2015 10:59:24 +0000 (11:59 +0100)]
docs: add news item and link release notes for 10.6.8

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodocs: add sha256 checksums for 10.6.8
Emil Velikov [Sun, 20 Sep 2015 10:55:41 +0000 (11:55 +0100)]
docs: add sha256 checksums for 10.6.8

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 02387926addc62198c9b684f4f51f7cbe06b3e25)

9 years agodocs: add release notes for 10.6.8
Emil Velikov [Sun, 20 Sep 2015 10:05:07 +0000 (11:05 +0100)]
docs: add release notes for 10.6.8

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit 91c6302734574e91424a7ccb52b6368b712366cc)

9 years agomesa/teximage: reuse compressed format utility functions for base_format
Nanley Chery [Thu, 27 Aug 2015 23:29:06 +0000 (16:29 -0700)]
mesa/teximage: reuse compressed format utility functions for base_format

Reuse utility functions instead of reimplementing the same logic.

* _mesa_is_compressed_format() performs the required checking to
  determine format support in the current context.
* _mesa_gl_compressed_format_base_format() returns the base format.

As a side effect, we now check that we're in a desktop context when
determining support for the FXT1 and RGTC formats. This is in agreement
with our extension table and the glext headers.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
9 years agomesa/texcompress: add compressed formats to base format utility function
Nanley Chery [Thu, 27 Aug 2015 23:25:48 +0000 (16:25 -0700)]
mesa/texcompress: add compressed formats to base format utility function

Add S3TC and PALETTE formats.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
9 years agomesa/glformats: refactor compressed format support function
Nanley Chery [Wed, 26 Aug 2015 23:36:11 +0000 (16:36 -0700)]
mesa/glformats: refactor compressed format support function

Instead of case statements, use _mesa_get_format_layout() to
determine if a GL format is part of a family of compressed formats.

v2. restrict LATC formats to API_OPENGL_COMPAT (Ilia).
    rename the variable mFormat to m_format.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
9 years agomesa/formats: add MESA_LAYOUT_LATC
Nanley Chery [Wed, 26 Aug 2015 23:25:44 +0000 (16:25 -0700)]
mesa/formats: add MESA_LAYOUT_LATC

This enables us to predicate statments on a compressed format being
a type of LATC format. Also, remove the comment that lists the enum
(it was getting a tad long).

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Signed-off-by: Nanley Chery <nanley.g.chery@intel.com>
9 years agodri/common: use sysconfdir when looking for drirc
Marcin Ślusarz [Sat, 19 Sep 2015 17:17:34 +0000 (19:17 +0200)]
dri/common: use sysconfdir when looking for drirc

Useful when locally installed mesa has more quirks than the system one.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agofreedreno/ir3: use nir two-sided-color lowering
Rob Clark [Thu, 17 Sep 2015 17:35:33 +0000 (13:35 -0400)]
freedreno/ir3: use nir two-sided-color lowering

With this, we completely switch over to nir lowering passes instead of
tgsi_lowering.  So one step closer to supporting direct glsl or spirv to
nir support for freedreno a3xx/a4xx.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agonir: add two-sided-color lowering pass
Rob Clark [Thu, 17 Sep 2015 17:17:08 +0000 (13:17 -0400)]
nir: add two-sided-color lowering pass

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir/build: add nir_vec() helper
Rob Clark [Fri, 18 Sep 2015 17:23:36 +0000 (13:23 -0400)]
nir/build: add nir_vec() helper

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agofreedreno/ir3: lower txp/clamp in NIR
Rob Clark [Wed, 16 Sep 2015 17:42:21 +0000 (13:42 -0400)]
freedreno/ir3: lower txp/clamp in NIR

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agonir/lower_tex: add support to clamp texture coords
Rob Clark [Fri, 18 Sep 2015 14:44:27 +0000 (10:44 -0400)]
nir/lower_tex: add support to clamp texture coords

Some hardware needs to clamp texture coordinates to [0.0, 1.0] in the
shader to emulate GL_CLAMP.  This is added to lower_tex_proj since, in
the case of projected coords, the clamping needs to happen *after*
projection.

v2: comments/suggestions from Ilia and Eric, use txs to get texture size
and clamp RECT textures to their dimensions rather than [0.0, 1.0] to
avoid having to lower RECT textures to 2D.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/lower_tex: support for lowering RECT textures
Rob Clark [Wed, 16 Sep 2015 20:49:14 +0000 (16:49 -0400)]
nir/lower_tex: support for lowering RECT textures

v2: comments/suggestions from Ilia and Eric, split out get_texture_size()
helper so we can use it in the next commit for clamping RECT textures.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/lower_tex: support projector lowering per sampler type
Rob Clark [Wed, 16 Sep 2015 16:56:58 +0000 (12:56 -0400)]
nir/lower_tex: support projector lowering per sampler type

Some hardware, such as adreno a3xx, supports txp on some but not all
sampler types.  In this case we want more fine grained control over
which texture projectors get lowered.

v2: split out nir_lower_tex_options struct to make it easier to
add the additional parameters coming in the following patches

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir/lower_tex: split out project_src() helper
Rob Clark [Wed, 16 Sep 2015 16:53:12 +0000 (12:53 -0400)]
nir/lower_tex: split out project_src() helper

Split this out to reduce noise in later patches.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: rename nir_lower_tex_projector
Rob Clark [Thu, 17 Sep 2015 11:54:35 +0000 (07:54 -0400)]
nir: rename nir_lower_tex_projector

Since the following patches will add additional tex-lowering related
functionality, which doesn't make sense to split out into a separate
pass (as they would require duplication of the projector lowering
logic), let's give this pass a more generic name.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/vec4: Change types as needed to propagate source modifiers using current instruction
Alejandro Piñeiro [Wed, 16 Sep 2015 08:26:55 +0000 (10:26 +0200)]
i965/vec4: Change types as needed to propagate source modifiers using current instruction

SEL and MOV instructions, as long as they don't have source modifiers, are
just copying bits around.  So those kind of instruction could be propagated
even if there are type mismatches. This is needed because NIR generates
integer SEL and MOV instructions whenever it doesn't know what else to
generate.

This commit adds support for copy propagation using current instruction
as reference.

Equivalent to commit 472ef9 but for vec4.

v2: include check for saturate, as Jason Ekstrand suggested
v3: check that the dst.type and the src type are the same, in order to
    solve (among others) the following deqp regression with v2:
    dEQP-GLES3.functional.shaders.operator.unary_operator.minus.lowp_uint_vertex

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965/fs: Fix comparison between signed and unsigned integer expressions
Iago Toral Quiroga [Fri, 18 Sep 2015 09:02:34 +0000 (11:02 +0200)]
i965/fs: Fix comparison between signed and unsigned integer expressions

brw_fs_visitor.cpp: In member function 'void fs_visitor::emit_urb_writes()':
brw_fs_visitor.cpp:977:58: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
9 years agomesa: fix errors when reading depth with glReadPixels
Tapani Pälli [Tue, 15 Sep 2015 06:17:20 +0000 (09:17 +0300)]
mesa: fix errors when reading depth with glReadPixels

OpenGL ES 3.0 spec 3.7.2 "Transfer of Pixel Rectangles" specifies
DEPTH_COMPONENT, UNSIGNED_INT as a valid couple, validation for
internal format is checked by is_float_depth().

Fix regression caused by 81d2fd91a90e5b2fd9fd74792a7a7c329f0e4d29 in:
   ES3-CTS.gtf.GL3Tests.packed_pixels.packed_pixels

Test uses GL_DEPTH_COMPONENT, UNSIGNED_INT only when GL_NV_read_depth
extension is present.

v2: change check in _mesa_error_check_format_and_type to be explicit
    for ES 2.0+, desktop OpenGL does not allow this behaviour + uses
    this function for both glReadPixels and glDrawPixels validation.
    (No Piglit regressions seen with v2.)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com> [v1]
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92009
Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
9 years agonir/builder: fix c++11 compiler warning
Rob Clark [Fri, 18 Sep 2015 01:07:41 +0000 (21:07 -0400)]
nir/builder: fix c++11 compiler warning

Fixes:

   In file included from nir/nir_lower_samplers.cpp:27:0:
   nir/nir_builder.h: In function 'nir_ssa_def* nir_channel(nir_builder*, nir_ssa_def*, int)':
   nir/nir_builder.h:222:37: warning: narrowing conversion of 'c' from 'int' to 'unsigned int' inside { } is ill-formed in C++11 [-Wnarrowing]
       unsigned swizzle[4] = {c, c, c, c};

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agonir: really actually fix comment this time
Rob Clark [Fri, 18 Sep 2015 01:06:11 +0000 (21:06 -0400)]
nir: really actually fix comment this time

Signed-off-by: Rob Clark <robclark@freedesktop.org>
9 years agonir/print: print variable names
Rob Clark [Thu, 17 Sep 2015 22:18:45 +0000 (18:18 -0400)]
nir/print: print variable names

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Timothy Arceri <t_arceri@yahoo.com.au>