mesa.git
9 years agonir: Add a lowering pass for texture projectors.
Eric Anholt [Fri, 27 Mar 2015 21:18:11 +0000 (14:18 -0700)]
nir: Add a lowering pass for texture projectors.

Not much hardware wants them these days, and it might give us a chance to
do CSE or algebraic at the NIR level.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Add an interface to turn a nir_src into a nir_ssa_def.
Eric Anholt [Fri, 27 Mar 2015 21:19:46 +0000 (14:19 -0700)]
nir: Add an interface to turn a nir_src into a nir_ssa_def.

We use nir_ssa_defs for nir_builder args, so this takes a nir_src and
makes one so it can be passed in.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Add an interface for the builder to insert instructions before.
Eric Anholt [Fri, 27 Mar 2015 21:18:54 +0000 (14:18 -0700)]
nir: Add an interface for the builder to insert instructions before.

So far we'd only used nir_builder to build brand new programs.  But if
we're doing modifications to instructions (like in a lowering pass), then
we want to generate new stuff before the instruction we're modifying.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agogallium: fix gcc compile errors when using _XOPEN_SOURCE=600 but not std=c99
Jose Fonseca [Thu, 2 Apr 2015 15:35:16 +0000 (17:35 +0200)]
gallium: fix gcc compile errors when using _XOPEN_SOURCE=600 but not std=c99

The fpclassify stuff either needs std=c99 or _XOPEN_SOURCE=600 passed
to gcc, but when using the latter the lrint family of function will be defined
too.

9 years agoi965: Rename do_<stage>_prog to brw_compile_<stage>_prog (and export)
Carl Worth [Fri, 20 Mar 2015 19:10:49 +0000 (12:10 -0700)]
i965: Rename do_<stage>_prog to brw_compile_<stage>_prog (and export)

This is in preparation for these functions to be called from other
files.

This commit is intended to have no functional change. It exists in
preparation for some upcoming code movement in preparation for the
shader cache.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Split out per-stage dirty-bit checking into separate functions
Carl Worth [Fri, 20 Mar 2015 19:01:33 +0000 (12:01 -0700)]
i965: Split out per-stage dirty-bit checking into separate functions

The dirty-bit checking from each brw_upload_<stage>_prog function is
split out into its a new brw_<stage>_state_dirty function.

This commit is intended to have no functional change. It exists in
preparation for some upcoming code movement in preparation for the
shader cache.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Split out brw_<stage>_populate_key into their own functions
Carl Worth [Mon, 23 Feb 2015 22:44:39 +0000 (14:44 -0800)]
i965: Split out brw_<stage>_populate_key into their own functions

This commit splits portions of the existing brw_upload_vs_prog and
brw_upload_gs_prog function into new brw_vs_populate_key and
brw_gs_populate_key functions. This follows the same style as is
already present for all other stages, (see brw_wm_populate_key, etc.).

This commit is intended to have no functional change. It exists in
preparation for some upcoming code movement in preparation for the
shader cache.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonv50/ir: avoid folding immediates into imad operations
Ilia Mirkin [Thu, 2 Apr 2015 22:42:31 +0000 (18:42 -0400)]
nv50/ir: avoid folding immediates into imad operations

Commit 09ee907266 added logic to fold immediates into mad operations,
but the emission code is only there for fmad. Only allow it on float
types.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonv50/ir: fix imad emission when dst == src2
Ilia Mirkin [Thu, 2 Apr 2015 22:33:55 +0000 (18:33 -0400)]
nv50/ir: fix imad emission when dst == src2

Commit fb63df22151f added 4-byte mad support, but only supported
emission for floats. Disable it for ints for now.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agonir: Allocate nir_tex_instr::sources out of the instruction itself.
Kenneth Graunke [Sat, 28 Mar 2015 07:02:37 +0000 (00:02 -0700)]
nir: Allocate nir_tex_instr::sources out of the instruction itself.

The lifetime of the sources array needs to be match the nir_tex_instr
itself.  So, allocate it using the instruction itself as the context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Allocate predecessor and dominance frontier sets from block itself.
Kenneth Graunke [Sat, 28 Mar 2015 04:29:07 +0000 (21:29 -0700)]
nir: Allocate predecessor and dominance frontier sets from block itself.

These sets are part of the block, and their lifetime needs to match the
block itself.  So, allocate them using the block itself as the context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Allocate register fields out of the register itself.
Kenneth Graunke [Sat, 28 Mar 2015 03:21:59 +0000 (20:21 -0700)]
nir: Allocate register fields out of the register itself.

The lifetime of each register's use/def/if_use sets needs to match the
register itself.  So, allocate them using the register itself as the
context.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Make nir_create_function() strdup the function name.
Kenneth Graunke [Sat, 28 Mar 2015 02:23:36 +0000 (19:23 -0700)]
nir: Make nir_create_function() strdup the function name.

glsl_to_nir passes in the ir_function's name field; we were copying the
pointer, but not duplicating the memory.

We want to be able to free the linked GLSL IR program after translating
to NIR, so we'll need to create a copy of the function name that the NIR
shader actually owns.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Free dead variables when removing them.
Kenneth Graunke [Fri, 27 Mar 2015 23:19:27 +0000 (16:19 -0700)]
nir: Free dead variables when removing them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Combine remove_dead_local_vars() and remove_dead_global_vars().
Kenneth Graunke [Fri, 27 Mar 2015 23:17:20 +0000 (16:17 -0700)]
nir: Combine remove_dead_local_vars() and remove_dead_global_vars().

We can just pass a pointer to the list of variables, and reuse the code.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoralloc: Implement a new ralloc_adopt() API.
Kenneth Graunke [Sat, 28 Mar 2015 02:24:33 +0000 (19:24 -0700)]
ralloc: Implement a new ralloc_adopt() API.

ralloc_adopt() reparents all children from one context to another.
Conceptually, ralloc_adopt(new_ctx, old_ctx) behaves like this
pseudocode:

   foreach child of old_ctx:
      ralloc_steal(new_ctx, child)

However, ralloc provides no way to iterate over a memory context's
children, and ralloc_adopt does this task more efficiently anyway.

One potential use of this is to implement a memory-sweeper pass: first,
steal all of a context's memory to a temporary context.  Then, walk over
anything that should be kept, and ralloc_steal it back to the original
context.  Finally, free the temporary context.  This works when the
context is something that can't be freed (i.e. an important structure).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir/opt_peephole_ffma: Fix a couple typos in a comment
Jason Ekstrand [Thu, 2 Apr 2015 17:42:12 +0000 (10:42 -0700)]
nir/opt_peephole_ffma: Fix a couple typos in a comment

Acked-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: add ARB_depth_buffer_float to ES3.0 required extension list
Ilia Mirkin [Wed, 1 Apr 2015 20:19:09 +0000 (16:19 -0400)]
mesa: add ARB_depth_buffer_float to ES3.0 required extension list

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agovc4: Add support for nir_iabs.
Eric Anholt [Wed, 1 Apr 2015 22:19:38 +0000 (15:19 -0700)]
vc4: Add support for nir_iabs.

Tested using the GLSL 1.30 tests for integer abs().  Not currently used,
but it was one of the new opcodes used by robclark's idiv lowering.

9 years agoi965/generator: Get rid of the ! in the unreachable statement
Jason Ekstrand [Wed, 1 Apr 2015 23:18:31 +0000 (16:18 -0700)]
i965/generator: Get rid of the ! in the unreachable statement

Reviewed-by: Mark Janes <mark.a.janes@intel.com>
9 years agonir/print: Correctly print swizzles for explicitly sized alu sources
Jason Ekstrand [Wed, 1 Apr 2015 23:16:52 +0000 (16:16 -0700)]
nir/print: Correctly print swizzles for explicitly sized alu sources

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agofreedreno/a3xx: add MRT support
Ilia Mirkin [Sun, 15 Feb 2015 08:39:43 +0000 (03:39 -0500)]
freedreno/a3xx: add MRT support

The hardware only supports 4 MRTs. It should be possible to emulate
support for 8, but doesn't seem worth the trouble.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno: convert blit program to array for each number of rts
Ilia Mirkin [Wed, 1 Apr 2015 05:14:39 +0000 (01:14 -0400)]
freedreno: convert blit program to array for each number of rts

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno: add support for laying out MRTs in gmem
Ilia Mirkin [Mon, 30 Mar 2015 00:54:42 +0000 (20:54 -0400)]
freedreno: add support for laying out MRTs in gmem

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno: add core infrastructure support for MRTs
Ilia Mirkin [Mon, 30 Mar 2015 00:39:48 +0000 (20:39 -0400)]
freedreno: add core infrastructure support for MRTs

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno/ir3: add support for FS_COLOR0_WRITES_ALL_CBUFS property
Ilia Mirkin [Mon, 30 Mar 2015 00:24:57 +0000 (20:24 -0400)]
freedreno/ir3: add support for FS_COLOR0_WRITES_ALL_CBUFS property

This will enable the driver to tell which regids to link up to which
MRT outputs.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno/a3xx: add independent blend function support
Ilia Mirkin [Mon, 30 Mar 2015 00:04:38 +0000 (20:04 -0400)]
freedreno/a3xx: add independent blend function support

This is needed for MRT support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agofreedreno: remove alpha key from ir3_shader
Ilia Mirkin [Sun, 29 Mar 2015 23:59:38 +0000 (19:59 -0400)]
freedreno: remove alpha key from ir3_shader

This complication is unnecessary and makes MRTs more complicated and
likely to generate tons of variants.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoi915g: Implement EGL_EXT_image_dma_buf_import
Stéphane Marchesin [Thu, 2 Apr 2015 03:00:08 +0000 (20:00 -0700)]
i915g: Implement EGL_EXT_image_dma_buf_import

This adds all the plumbing to get EGL_EXT_image_dma_buf_import in
i915g.

Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
9 years agoi965/fs: Relax type check in cmod propagation.
Matt Turner [Thu, 26 Mar 2015 17:09:54 +0000 (10:09 -0700)]
i965/fs: Relax type check in cmod propagation.

The thing we want to avoid is int/float comparisons, but int/unsigned
comparisons with 0 are equivalent.

total instructions in shared programs: 6194829 -> 6193996 (-0.01%)
instructions in affected programs:     117192 -> 116359 (-0.71%)
helped:                                471

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agonir: Remove useless ftrunc inside f2i/f2u.
Matt Turner [Thu, 26 Mar 2015 17:09:42 +0000 (10:09 -0700)]
nir: Remove useless ftrunc inside f2i/f2u.

No shader-db changes, probably because they're all removed by the GLSL
compiler optimization added in commit 69ad5fd4.

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Recognize (a < b || a < c) as a < max(b, c).
Matt Turner [Thu, 26 Mar 2015 17:09:21 +0000 (10:09 -0700)]
nir: Recognize (a < b || a < c) as a < max(b, c).

Doesn't work for analogous && cases, because of NaNs.

total instructions in shared programs: 6195712 -> 6194829 (-0.01%)
instructions in affected programs:     42000 -> 41117 (-2.10%)
helped:                                403

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Add addition/multiplication identities of exp/log.
Matt Turner [Thu, 26 Mar 2015 18:08:01 +0000 (11:08 -0700)]
nir: Add addition/multiplication identities of exp/log.

instructions in affected programs:     2858 -> 2808 (-1.75%)
helped:                                12

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Add identities for the log function.
Matt Turner [Thu, 26 Mar 2015 17:07:58 +0000 (10:07 -0700)]
nir: Add identities for the log function.

The rcp(log(x)) pattern affects instruction counts.

instructions in affected programs:     144 -> 138 (-4.17%)
helped:                                6

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Add identities for the exponential function.
Matt Turner [Thu, 26 Mar 2015 17:16:24 +0000 (10:16 -0700)]
nir: Add identities for the exponential function.

No changes in shader-db.

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Recognize another open coded lrp.
Matt Turner [Thu, 26 Mar 2015 17:36:42 +0000 (10:36 -0700)]
nir: Recognize another open coded lrp.

total instructions in shared programs: 6195924 -> 6195768 (-0.00%)
instructions in affected programs:     4876 -> 4720 (-3.20%)
helped:                                58
HURT:                                  10

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Recognize open coded lrp.
Matt Turner [Wed, 25 Mar 2015 22:03:52 +0000 (15:03 -0700)]
nir: Recognize open coded lrp.

total instructions in shared programs: 6197614 -> 6195924 (-0.03%)
instructions in affected programs:     34773 -> 33083 (-4.86%)
helped:                                147
HURT:                                  6

Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agonir: Use _mesa_flsll(InputsRead) in prog->nir.
Kenneth Graunke [Mon, 30 Mar 2015 23:09:51 +0000 (16:09 -0700)]
nir: Use _mesa_flsll(InputsRead) in prog->nir.

InputsRead is a 64-bit bitfield.  Using _mesa_fls would silently
truncate off the high bits, claiming inputs 32..56 (VARYING_SLOT_MAX)
were never read.

Using <= here was a hack I threw in at the last minute to fix programs
which happened to use input slot 32.  Switch back to using < now that
the underlying problem is fixed.

Fixes crashes in "Euro Truck Simulator 2" when using prog->nir, which
uses input slot 33.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa: Implement _mesa_flsll().
Kenneth Graunke [Mon, 30 Mar 2015 23:08:26 +0000 (16:08 -0700)]
mesa: Implement _mesa_flsll().

This is _mesa_fls() for 64-bit values.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir: In prog->nir, don't wrap dot products with ptn_channel(..., X).
Kenneth Graunke [Mon, 30 Mar 2015 12:17:56 +0000 (05:17 -0700)]
nir: In prog->nir, don't wrap dot products with ptn_channel(..., X).

ptn_move_dest and nir_fadd already take care of replicating the last
channel out, so we can just use a scalar and skip splatting it.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
9 years agoi965: Use the same nir options for all gens
Jason Ekstrand [Mon, 23 Mar 2015 22:58:34 +0000 (15:58 -0700)]
i965: Use the same nir options for all gens

If we tell NIR to split ffma's, then we don't need seperate options
anymore.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/nir: Run DCE again before going out of SSA
Jason Ekstrand [Wed, 1 Apr 2015 19:37:43 +0000 (12:37 -0700)]
i965/nir: Run DCE again before going out of SSA

We run lowering and optimization passes that might leave garbage lying
around. This keeps the FS cse from having to clean it up.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/nir: Run the ffma peephole after the rest of the optimizations
Jason Ekstrand [Mon, 23 Mar 2015 22:08:31 +0000 (15:08 -0700)]
i965/nir: Run the ffma peephole after the rest of the optimizations

The idea here is that fusing multiply-add combinations too early can reduce
our ability to perform CSE and value-numbering.  Instead, we split ffma
opcodes up-front, hope CSE cleans up, and then fuse after-the-fact.
Unless an algebraic pass does something silly where it inserts something
between the multiply and the add, splitting and re-fusing should never
cause a problem.  We run the late algebraic optimizations after this so
that things like compare-with-zero don't hurt our ability to fuse things.

shader-db results for fragment shaders on Haswell:
total instructions in shared programs: 4390538 -> 4379236 (-0.26%)
instructions in affected programs:     989359 -> 978057 (-1.14%)
helped:                                5308
HURT:                                  97
GAINED:                                78
LOST:                                  5

This does, unfortunately, cause some substantial hurt to a shader in Kerbal
Space Program.  However, the damage is caused by changing a single
instruction from a ffma to an add.  This, in turn, *decreases* register
pressure in one part of the program causing it to fail to register allocate
and spill.  Given the overwhelmingly positive results in other shaders and
the fact that the NIR for the Kerbal shaders is actually better, this
should be considered a positive.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir/peephole_ffma: Be less agressive about fusing multiply-adds
Jason Ekstrand [Mon, 23 Mar 2015 21:55:20 +0000 (14:55 -0700)]
nir/peephole_ffma: Be less agressive about fusing multiply-adds

shader-db results for fragment shaders on Haswell:
total instructions in shared programs: 4395688 -> 4389623 (-0.14%)
instructions in affected programs:     355876 -> 349811 (-1.70%)
helped:                                1455
HURT:                                  14
GAINED:                                5
LOST:                                  0

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir: Add a dedicated ffma peephole optimization
Jason Ekstrand [Sat, 21 Mar 2015 19:21:21 +0000 (12:21 -0700)]
nir: Add a dedicated ffma peephole optimization

i965/nir: Use the dedicated ffma peephole

total instructions in shared programs: 4418748 -> 4394618 (-0.55%)
instructions in affected programs:     1292790 -> 1268660 (-1.87%)
helped:                                5999
HURT:                                  457
GAINED:                                4
LOST:                                  9

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir: Move the compare-with-zero optimizations to the late section
Jason Ekstrand [Tue, 24 Mar 2015 00:36:22 +0000 (17:36 -0700)]
nir: Move the compare-with-zero optimizations to the late section

total instructions in shared programs: 4422307 -> 4422363 (0.00%)
instructions in affected programs:     4230 -> 4286 (1.32%)
helped:                                0
HURT:                                  12

While this does hurt some things, the losses are minor and it prevents the
compare-with-zero optimization from fighting with ffma which is much more
important.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir/algebraic: Add a seperate section for "late" optimizations
Jason Ekstrand [Tue, 24 Mar 2015 00:11:49 +0000 (17:11 -0700)]
nir/algebraic: Add a seperate section for "late" optimizations

i965/nir: Use the late optimizations

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir/algebraic: Remove a duplicate optimization
Jason Ekstrand [Wed, 1 Apr 2015 19:24:37 +0000 (12:24 -0700)]
nir/algebraic: Remove a duplicate optimization

This optimization is repeated verbatim above

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir/algebraic: #define around structure definitions
Jason Ekstrand [Tue, 24 Mar 2015 00:22:44 +0000 (17:22 -0700)]
nir/algebraic: #define around structure definitions

Previously, we couldn't generate two algebraic passes in the same file
because of multiple structure definitions.  To solve this, we play the
age-old header file trick and just #define around it.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir/print: Don't print extra swizzzle components
Jason Ekstrand [Tue, 24 Mar 2015 01:20:21 +0000 (18:20 -0700)]
nir/print: Don't print extra swizzzle components

Previously, NIR would just print 4 swizzle components if the swizzle was
anything other than foo.xyzw.  This creates lots of noise if, for example,
you have a one-component element with a swizzle of foo.xxxx.

Reviewed-by: Kenneth Grunke <kenneth@whitecape.org>
9 years agoconfigure: nuke --with-max-{width,height}
Emil Velikov [Wed, 1 Apr 2015 14:51:59 +0000 (15:51 +0100)]
configure: nuke --with-max-{width,height}

Unused as of commit 630ab0d27ba(mesa: remove last of MAX_WIDTH,
MAX_HEIGHT). Update all the remaining references to the defines.

v2: Use the correct variable name in the comments

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agogallium: ship tgsi_to_nir.h in the tarball
Emil Velikov [Wed, 1 Apr 2015 19:09:00 +0000 (19:09 +0000)]
gallium: ship tgsi_to_nir.h in the tarball

Acked-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoconfigure.ac: error out if python/mako is not found when required
Emil Velikov [Mon, 23 Mar 2015 17:49:24 +0000 (17:49 +0000)]
configure.ac: error out if python/mako is not found when required

In case of using a distribution tarball (or a dirty git tree) one can
have the generated sources locally. Make configure.ac error out
otherwise, to alert that about the unmet requirement(s) of python/mako.

v2: Check only for a single file for each dependency.

Suggested-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglsl: Make sure not to dereference NULL.
Matt Turner [Wed, 1 Apr 2015 17:24:26 +0000 (10:24 -0700)]
glsl: Make sure not to dereference NULL.

Found by Coverity.

9 years agomain: create_buffers unlocks mutex when throwing OUT_OF_MEMORY.
Laura Ekstrand [Wed, 1 Apr 2015 18:18:32 +0000 (11:18 -0700)]
main: create_buffers unlocks mutex when throwing OUT_OF_MEMORY.

Ilia Mirkin found that I had forgotten to free the mutex in the error case.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agoautomake,scons: Put NIR source files in a separate var to fix SCons build.
Jose Fonseca [Wed, 1 Apr 2015 18:49:09 +0000 (19:49 +0100)]
automake,scons: Put NIR source files in a separate var to fix SCons build.

SCons does not build NIR yet.

Trivial.

9 years agoautomake: Fix out-of-source builds.
Jose Fonseca [Wed, 1 Apr 2015 18:48:09 +0000 (19:48 +0100)]
automake: Fix out-of-source builds.

Add include path for generated nir_opcodes.h.

Trivial.

9 years agomesa: don't include colormac.h in format code
Brian Paul [Wed, 1 Apr 2015 16:31:26 +0000 (10:31 -0600)]
mesa: don't include colormac.h in format code

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
9 years agomesa: remove unneeded #include of colormac.h
Brian Paul [Wed, 1 Apr 2015 15:45:57 +0000 (09:45 -0600)]
mesa: remove unneeded #include of colormac.h

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
9 years agotnl: remove unneeded #include of colormac.h
Brian Paul [Wed, 1 Apr 2015 15:45:38 +0000 (09:45 -0600)]
tnl: remove unneeded #include of colormac.h

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
9 years agoswrast: remove unneeded #include of colormac.h
Brian Paul [Wed, 1 Apr 2015 15:45:31 +0000 (09:45 -0600)]
swrast: remove unneeded #include of colormac.h

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
9 years agomesa: remove unused macros from colormac.h
Brian Paul [Wed, 1 Apr 2015 15:45:12 +0000 (09:45 -0600)]
mesa: remove unused macros from colormac.h

Acked-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Mark Janes <mark.a.janes@intel.com>
9 years agonir: Recognize a pattern of bool frobbing from TGSI KILL_IF.
Eric Anholt [Mon, 30 Mar 2015 06:04:21 +0000 (23:04 -0700)]
nir: Recognize a pattern of bool frobbing from TGSI KILL_IF.

TGSI's conditional discards take float arg and negate it, so GLSL to TGSI
generates a b2f and negates that value.  Only, in NIR we want a proper
bool once again, so we compare with 0.  This is a lot of pointless extra
instructions.

total instructions in shared programs: 39735 -> 39702 (-0.08%)
instructions in affected programs:     1342 -> 1309 (-2.46%)

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: Recognize a pattern for doing b2f without the opcode.
Eric Anholt [Mon, 30 Mar 2015 05:59:39 +0000 (22:59 -0700)]
nir: Recognize a pattern for doing b2f without the opcode.

Since we have patterns based on b2f, generate them if we see the b2f
equivalent using an iand.  This is common when generating NIR from TGSI.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agovc4: Add shader-db dumping of NIR instruction count.
Eric Anholt [Fri, 20 Feb 2015 08:31:51 +0000 (00:31 -0800)]
vc4: Add shader-db dumping of NIR instruction count.

I was previously using temporary disables of VC4 optimization to show the
benefits of improved NIR optimization, but this can get me quick and dirty
numbers for NIR-only improvements without having to add hacks to disable
VC4's code (disabling of which might hide ways that the NIR changes would
hurt actual VC4 codegen).

9 years agovc4: Convert to consuming NIR.
Eric Anholt [Thu, 30 Oct 2014 19:51:47 +0000 (12:51 -0700)]
vc4: Convert to consuming NIR.

NIR brings us better optimization than I would have bothered to write
within the driver, developers sharing future optimization work, and the
ability to share device-specific lowering code that we and other
GLES2-level drivers need.

total uniforms in shared programs: 13421 -> 13422 (0.01%)
uniforms in affected programs:     62 -> 63 (1.61%)
total instructions in shared programs: 39961 -> 39707 (-0.64%)
instructions in affected programs:     15494 -> 15240 (-1.64%)

v2: Add missing imov support, and assert that there are no dest saturates.
v3: Rebase on the target-specific algebraic series.
v4: Rebase on gallium-includes-from-NIR changes in mater.
v5: Rebase on variables being in lists instead of hash tables.
v6: Squash in intermediate changes that used the NIR-to-TGSI pass (which
    I'm not committing)

9 years agogallium: Add tgsi_to_nir to get a nir_shader for a TGSI shader.
Eric Anholt [Wed, 29 Oct 2014 21:32:16 +0000 (14:32 -0700)]
gallium: Add tgsi_to_nir to get a nir_shader for a TGSI shader.

This will be used by the VC4 driver for doing device-independent
optimization, and hopefully eventually replacing its whole IR.  It also
may be useful to other drivers for the same reason.

v2: Add all of the instructions I was relying on tgsi_lowering to remove,
    and more.
v3: Rebase on SSA rework of the builder.
v4: Use the NIR ineg operation instead of doing a src modifier.
v5: Don't use ineg for fnegs.  (infer_src_type on MOV doesn't do what I
    expect, again).
v6: Fix handling of multi-channel KILL_IF sources.
v7: Make ttn_get_f() return a swizzle of a scalar load_const, rather than
    a vector load_const.  CSE doesn't recognize that srcs out of those
    channels are actually all the same.
v8: Rebase on nir_builder auto-sizing, make the scalar arguments to
    non-ALU instructions actually be scalars.
v9: Add support for if/loop instructions, additional texture targets, and
    untested support for indirect addressing on temps.
v10: Rebase on master, drop bad comment about control flow and just choose
     the X channel, use int comparison opcodes in LIT for now, drop unused
     pipe_context argument..
v11: Fix translation of LRP (previously missed because I mis-translated
     back out), use nir_builder init helpers.
v12: Rebase on master, adding explicit include of mtypes.h to get
     INTERP_QUALIFIER_*
v13: Rebase on variables being in lists instead of hash tables, drop use
     of mtypes.h in favor of util/pipeline.h.  Use Ken's nir_builder
     swizzle and fmov/imov_alu helpers, drop "struct" in front of
     nir_builder, use nir_builder directly as the function arg in a lot of
     cases, drop redundant members of ttn_compile that are also in
     nir_builder, drop some half-baked malloc failure handling.
v14: The indirect uniform src0 should be scalar, not vector (noticed as
     odd by robclark, confirmed by cwabbott).  Apply Ken's review to
     initialize s->num_uniforms and friends, skip ttn_channel for dot
     products, and use the simpler discard_if intrinsic.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v13)
Acked-by: Rob Clark <robclark@freedesktop.org>
9 years agovc4: Tell shader-db how big our UBOs are, if present.
Eric Anholt [Tue, 31 Mar 2015 18:39:45 +0000 (11:39 -0700)]
vc4: Tell shader-db how big our UBOs are, if present.

I had regressed them for a while with the NIR work.

9 years agomesa: Make a shared header for 3D pipeline enum / #defines.
Eric Anholt [Wed, 25 Mar 2015 19:58:51 +0000 (12:58 -0700)]
mesa: Make a shared header for 3D pipeline enum / #defines.

NIR uses these enums/#defines in nir_variables and associated intrinsics,
but I want to be able to use them from TGSI->NIR and NIR->TGSI.
Otherwise, we had to pull in all of mtypes.h.

This doesn't cover all of the enums we might want from a shared compiler
core (like varying slots or vert attribs), but it at least covers what I
need at the moment (system values and interp qualifiers).

v2: Move to src/glsl since util/ is really vague.  Include in Makefile.am
    list.  Use plain bitshifts and stdint types instead of undefined
    BITFIELD64_BIT.
v3: Rename to shader_enums.h. Move it into Makefile.sources.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v2, with
             recommendation to rename)

9 years agonir: add nir_builder.h to the tarball
Emil Velikov [Tue, 31 Mar 2015 09:54:34 +0000 (10:54 +0100)]
nir: add nir_builder.h to the tarball

The header was added with commit 2a135c470e3(nir: Add an ALU op builder
kind of like ir_builder.h) but did not made it into to the sources list.

Fortunately it remained unused until a recent commit faf6106c6f6(nir:
Implement a Mesa IR -> NIR translator.)

v2: Remove the bogus dependency. Tweak commit message.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoxmlpool: remove the clean target
Emil Velikov [Sun, 29 Mar 2015 12:46:32 +0000 (13:46 +0100)]
xmlpool: remove the clean target

... by folding it into CLEANFILES. Don't worry about $(LANG) as it is
essentially the first folder of $(POS). With the latter already handled.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoxmlpool: don't forget to ship the MOS
Emil Velikov [Sun, 29 Mar 2015 12:46:31 +0000 (13:46 +0100)]
xmlpool: don't forget to ship the MOS

This will allow us to finally remove python from the build time
dependencies list. Considering that you're building from a release
tarball of course :-)

Cc: Bernd Kuhls <bernd.kuhls@t-online.de>
Reported-by: Bernd Kuhls <bernd.kuhls@t-online.de>
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 agoosmesa: don't try to bundle osmesa.def SConscript
Emil Velikov [Sun, 29 Mar 2015 00:56:09 +0000 (00:56 +0000)]
osmesa: don't try to bundle osmesa.def SConscript

Both of which were removed with commit 69db422218b(scons: Don't build
osmesa.)

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agodocs: note that classic osmesa/libEGL no longer builds with scons
Emil Velikov [Wed, 25 Mar 2015 20:12:02 +0000 (20:12 +0000)]
docs: note that classic osmesa/libEGL no longer builds with scons

Plus nuke the final reference to osmesa from README.WIN32.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoi965: Handle scratch accesses where reladdr also points to scratch space
Iago Toral Quiroga [Tue, 17 Mar 2015 09:48:04 +0000 (10:48 +0100)]
i965: Handle scratch accesses where reladdr also points to scratch space

This is a problem when we have IR like this:

(array_ref (var_ref temps) (swiz x (expression ivec4 bitcast_f2i
   (swiz xxxx (array_ref (var_ref temps) (constant int (2)) ) )) )) ) )

where we are indexing an array with the result of an expression that
accesses the same array.

In this scenario, temps will be moved to scratch space and we will need
to add scratch reads/writes for all accesses to temps, however, the
current implementation does not consider the case where a reladdr pointer
(obtained by indexing into temps trough a expression) points to a register
that is also stored in scratch space (as in this case, where the expression
used to index temps access temps[2]), and thus, requires a scratch read
before it is accessed.

v2 (Francisco Jerez):
 - Handle also recursive reladdr addressing.
 - Do not memcpy dst_reg into src_reg when rewriting reladdr.

v3 (Francisco Jerez):
 - Reduce complexity by moving recursive reladdr scratch access handling
   to a separate recursive function.
 - Do not skip demoting reladdr index registers to scratch space if the
   top level GRF has already been visited.

v4 (Francisco Jerez)
 - Remove redundant checks.
 - Simplify code by making emit_resolve_reladdr return a register with
   the original src data except for reg, reg_offset and reladdr.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89508
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agogallivm: (trivial) fix the logic deciding if function call should be used...
Roland Scheidegger [Wed, 1 Apr 2015 11:25:56 +0000 (13:25 +0200)]
gallivm: (trivial) fix the logic deciding if function call should be used...

Copy and paste bug with the img filter decision. Since there's only 2 different
filters anyway just drop this bit.

9 years agomesa/fbo: lock ctx->Shared->Mutex when allocating renderbuffers
Martin Peres [Mon, 30 Mar 2015 07:34:20 +0000 (10:34 +0300)]
mesa/fbo: lock ctx->Shared->Mutex when allocating renderbuffers

This mutex is used to make sure the shared context does not change
while some shared code is looking into it.

Calling BindRenderbufferEXT BindRenderbuffer with a gles context
would not take the mutex before allocating an entry. Commit a34669b
then moved out the allocation out of bind_renderbuffer into
allocate_renderbuffer before using it for the CreateRenderBuffer
entry point. This thus also made this entry point unsafe.

The issue has been hinted by Ilia Mirkin.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomesa/fbo: do not assign a value that is never read later on
Martin Peres [Wed, 25 Mar 2015 14:28:03 +0000 (16:28 +0200)]
mesa/fbo: do not assign a value that is never read later on

The issue has been detected by coverty.

v2:
- move the declaration of obj to the else clause (Brian Paul)

v3: Review by Brian Paul
- get rid of the obj declaration in favor of a direct reference

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agoegl: add initial EGL_MESA_image_dma_buf_export v2.4
Dave Airlie [Mon, 3 Mar 2014 03:57:16 +0000 (13:57 +1000)]
egl: add initial EGL_MESA_image_dma_buf_export v2.4

At the moment to get an EGL image to a dma-buf file descriptor,
you have to use EGL_MESA_drm_image, and then use libdrm to
convert this to a file descriptor.

This extension just provides an API modelled on EGL_MESA_drm_image,
to return a dma-buf file descriptor.

v2: update spec for new API proposal
add internal queries to get the fourcc back from intel driver.

v2.1: add gallium pieces.

v2.2: add offsets to spec and API, rename fd->fds, stride->strides
in API. rewrite spec a bit more, add some q/a

v2.3:
add modifiers to query interface and 64-bit type for that (Daniel Stone)
specifiy what happens to num fds vs num planes differences. (Chad Versace)

v2.4:
fix grammar (Daniel Stone)

Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi965/state: Remove brw->state.dirty
Jordan Justen [Fri, 20 Mar 2015 07:46:03 +0000 (00:46 -0700)]
i965/state: Remove brw->state.dirty

We now use brw->NewGLState and brw->ctx.NewDriverState instead.

Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Don't use brw->state.dirty.mesa
Jordan Justen [Fri, 20 Mar 2015 05:33:16 +0000 (22:33 -0700)]
i965/state: Don't use brw->state.dirty.mesa

Now, we only use brw->NewGLState.

I used this bash & sed command in the i965 directory:
  for file in *.[ch] *.[ch]pp; do
    sed -i -e 's/brw->state\.dirty\.mesa/brw->NewGLState/g' $file
  done

Followed by manual changes to brw_state_upload.c.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Don't use brw->state.dirty.brw
Jordan Justen [Fri, 20 Mar 2015 01:57:34 +0000 (18:57 -0700)]
i965/state: Don't use brw->state.dirty.brw

Now, we only use ctx->NewDriverState.

I used this bash & sed command in the i965 directory:
  for file in *.[ch] *.[ch]pp; do
    sed -i -e 's/state\.dirty\.brw/ctx.NewDriverState/g' $file
  done

Followed by manual changes to brw_state_upload.c.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Add compute pipeline with empty atom lists
Jordan Justen [Sun, 8 Mar 2015 08:08:18 +0000 (00:08 -0800)]
i965/state: Add compute pipeline with empty atom lists

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Only upload render programs for render state uploads
Jordan Justen [Fri, 20 Mar 2015 19:36:21 +0000 (12:36 -0700)]
i965/state: Only upload render programs for render state uploads

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Create separate dirty state bits for each pipeline
Jordan Justen [Sun, 8 Mar 2015 07:21:46 +0000 (23:21 -0800)]
i965/state: Create separate dirty state bits for each pipeline

When clearing the state for a pipeline, we will save changed state for
the other pipelines.

v3:
 * Adjust brw_upload_pipeline_state
   * Don't pull pipeline state bits into common state bits
   * Don't clear pipeline state bits
 * Adjust 'clear' phase
   * brw_clear_dirty_bits is now brw_render_state_finished
   * Move cross-pipeline state flagging to brw_pipeline_state_finished
   * Move pipeline clears to brw_pipeline_state_finished

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Support multiple pipelines in brw->num_atoms
Jordan Justen [Sun, 8 Mar 2015 06:44:39 +0000 (22:44 -0800)]
i965/state: Support multiple pipelines in brw->num_atoms

brw->num_atoms is converted to an array, but currently just an array
of length 1.

Adds brw_copy_pipeline_atoms which copies the atoms for a pipeline,
and sets brw->num_atoms[p] for pipeline p.

v2:
 * Rename brw->atoms[] to render_atoms
 * Rename brw_add_pipeline_atoms to brw_copy_pipeline_atoms
 * Rename brw_pipeline_first_atom to brw_get_pipeline_atoms

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Rename brw_clear_dirty_bits to brw_render_state_finished
Jordan Justen [Wed, 18 Mar 2015 22:43:34 +0000 (15:43 -0700)]
i965/state: Rename brw_clear_dirty_bits to brw_render_state_finished

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/state: Rename brw_upload_state to brw_upload_render_state
Jordan Justen [Sun, 8 Mar 2015 04:20:03 +0000 (20:20 -0800)]
i965/state: Rename brw_upload_state to brw_upload_render_state

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agogallivm: do some hack heuristic to disable texture functions
Roland Scheidegger [Tue, 31 Mar 2015 22:56:12 +0000 (00:56 +0200)]
gallivm: do some hack heuristic to disable texture functions

We've seen some cases where performance can hurt quite a bit.
Technically, the more simple the function the more overhead there is
for using a function for this (and the less benefits this provides).
Hence don't do this if we expect the generated code to be simple.
There's an even more important reason why this hurts performance,
which is shaders reusing the same unit with some of the same inputs,
as llvm cannot figure out the calculations are the same if they
are performned in the function (even just reusing the same unit without
any input being the same provides such optimization opportunities though
not very much). This is something which would need to be handled by IPO
passes however.

9 years agoi965/fs: Allow CSE to handle MULs with negated arguments.
Matt Turner [Wed, 28 Jan 2015 03:18:46 +0000 (19:18 -0800)]
i965/fs: Allow CSE to handle MULs with negated arguments.

mul x, -y is equivalent to mul -x, y; and mul x, y is the negation of
mul x, -y.

With NIR:
total instructions in shared programs: 6167779 -> 6161193 (-0.11%)
instructions in affected programs:     983511 -> 976925 (-0.67%)
helped:                                4106
HURT:                                  16
GAINED:                                18
LOST:                                  7

Without NIR:
total instructions in shared programs: 6192323 -> 6185299 (-0.11%)
instructions in affected programs:     987875 -> 980851 (-0.71%)
helped:                                4146
HURT:                                  16
GAINED:                                16
LOST:                                  0

9 years agoi965: Mark brw_inst_bits' brw_inst* parameter const.
Matt Turner [Sat, 28 Mar 2015 18:01:29 +0000 (11:01 -0700)]
i965: Mark brw_inst_bits' brw_inst* parameter const.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoglsl: Remove bogus Makefile dependency.
Matt Turner [Tue, 31 Mar 2015 21:06:56 +0000 (14:06 -0700)]
glsl: Remove bogus Makefile dependency.

9 years agoglsl: Reassociate multiplication of mat*mat*vec.
Matt Turner [Sat, 28 Mar 2015 00:13:51 +0000 (17:13 -0700)]
glsl: Reassociate multiplication of mat*mat*vec.

The typical case of mat4*mat4*vec4 is 80 scalar multiplications, but
mat4*(mat4*vec4) is only 32.

On HSW (with vec4 vertex shaders):
instructions in affected programs:     4420 -> 3194 (-27.74%)

On BDW (with scalar vertex shaders):
instructions in affected programs:     12756 -> 6726 (-47.27%)

Implementing a general matrix chain ordering is harder (or at least
tedious) because of having to walk the GLSL IR to create a list of
multiplicands. I'm guessing that this patch handles 90+% of cases, but
of course to tell definitively you'd have to implement the general
thing.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoglsl: Implement type inferencing of matrix types.
Matt Turner [Fri, 27 Mar 2015 17:45:07 +0000 (10:45 -0700)]
glsl: Implement type inferencing of matrix types.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoglsl: Factor out a get_mul_type() function.
Matt Turner [Fri, 27 Mar 2015 17:43:05 +0000 (10:43 -0700)]
glsl: Factor out a get_mul_type() function.

Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agonouveau: synchronize "scratch runout" destruction with the command stream
Marcin Ślusarz [Tue, 31 Mar 2015 20:04:31 +0000 (22:04 +0200)]
nouveau: synchronize "scratch runout" destruction with the command stream

When nvc0_push_vbo calls nouveau_scratch_done it does not mean
scratch buffers can be freed immediately. It means "when hardware
advances to this place in the command stream the scratch buffers
can be freed".

To fix it, just postpone scratch runout destruction after current
fence is signalled.

The bug existed for a very long time. Nobody noticed, because
"scratch runout" code path is rarely executed.

Fixes hang at the very beginning of first mission in "Serious Sam 3"
on nve7/gk107. It manifested as:

nouveau E[   PFIFO][0000:01:00.0] read fault at 0x000a9e0000 [PTE] from GR/GPC0/PE_2 on channel 0x007f853000 [Sam3[17056]]

Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
9 years agodocs: document Viewperf 12 issues
Brian Paul [Tue, 31 Mar 2015 17:30:32 +0000 (11:30 -0600)]
docs: document Viewperf 12 issues

Signed-off-by: Brian Paul <brianp@vmware.com>
9 years agoi965/skl: Avoid using the 1D stencil layout for stencil-only images
Neil Roberts [Tue, 31 Mar 2015 13:58:28 +0000 (14:58 +0100)]
i965/skl: Avoid using the 1D stencil layout for stencil-only images

Commit cf67ca9ffa9 made the layouting code pick a special layout for
1D images on Skylake. This should not be used for depth and stencil
buffers because these need to be treated as 2D tiled images. However
the patch was missing a check for images with a base format of
GL_STENCIL_INDEX. In practice I don't think it's currently possible to
hit this because Mesa doesn't support GL_ARB_texture_stencil8 and it's
not possible to create a 1D renderbuffer, but it'll be good to be
ready for when the extension is supported.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agoclover: Return CL_BUILD_ERROR for CL_PROGRAM_BUILD_STATUS when compilation fails v2
Tom Stellard [Tue, 24 Mar 2015 17:17:22 +0000 (17:17 +0000)]
clover: Return CL_BUILD_ERROR for CL_PROGRAM_BUILD_STATUS when compilation fails v2

v2:
  - Don't use _errs map

Cc: 10.5 10.4 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agoradeonsi/compute: Default to the same PIPE_SHADER_CAP values as other shader types v2
Tom Stellard [Sat, 21 Mar 2015 00:27:16 +0000 (00:27 +0000)]
radeonsi/compute: Default to the same PIPE_SHADER_CAP values as other shader types v2

v2:
  - Fix typo

Reviewed-by: Marek Olšák <marek.olsak@amd.com>