mesa.git
10 years agoutil: Implement unreachable for MSVC using __assume
Ian Romanick [Wed, 22 Oct 2014 23:41:41 +0000 (16:41 -0700)]
util: Implement unreachable for MSVC using __assume

Based on the description of __assume at:

http://msdn.microsoft.com/en-us/library/1b3fsfxw.aspx

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agoi965: Fix sampler state pointer adjustment for nonconst samplers
Chris Forbes [Tue, 4 Nov 2014 17:41:13 +0000 (06:41 +1300)]
i965: Fix sampler state pointer adjustment for nonconst samplers

This started hitting an assertion recently. Only affects Haswell
(Ivybridge doesn't support this meddling with the sampler state pointer,
and ARB_gpu_shader5 is not enabled yet on Broadwell)

14 Piglits crash->pass.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoilo: add drm_configuration for the pipe-target
Nick Sarnie [Wed, 15 Oct 2014 20:08:38 +0000 (16:08 -0400)]
ilo: add drm_configuration for the pipe-target

Allows the driver to advertise DMA-BUF and throttling.

10 years agoi965: Re-enable Z16 on Gen8+.
Kenneth Graunke [Wed, 22 Oct 2014 15:58:59 +0000 (08:58 -0700)]
i965: Re-enable Z16 on Gen8+.

Improves performance in GLBenchmark 2.7 TRex by 3.88889% +/- 0.336383%
(n=80) at 1280x720 on Broadwell GT3.  Together with the previous patch,
it improves performance by 5.42738% +/- 0.541971% (n=10) at 1920x1080.

Note that without the PMA stall fix, this would instead decrease
performance by 22%.

v2: Update comment (noticed by Kristian Høgsberg).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Implement the PMA stall fix.
Kenneth Graunke [Wed, 22 Oct 2014 15:58:58 +0000 (08:58 -0700)]
i965: Implement the PMA stall fix.

Certain non-promoted depth cases typically incur stalls.  In very
specific cases, we can enable a workaround which improves performance.

Improves performance in GLBenchmark 2.7 TRex by 1.17762% +/- 0.448765%
(n=75) at 1280x720 on Broadwell GT3.

Haswell has this feature as well, but we can't currently write registers
from userspace batches (and we'd incur additional software batch
scanning overhead as well), so we haven't enabled it.  Broadwell allows
us to write CACHE_MODE_1.  Backporters beware: the formula and flushing
incantation differs between Haswell and Broadwell.

v2: Move pma_stall_bits from brw->state to brw itself (requested by
    Kristian Høgsberg).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Add #defines for Broadwell HiZ workarounds in CACHE_MODE_1.
Kenneth Graunke [Wed, 22 Oct 2014 15:58:57 +0000 (08:58 -0700)]
i965: Add #defines for Broadwell HiZ workarounds in CACHE_MODE_1.

This patch adds macros needed for the HiZ PMA stall optimization.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Update compaction code to handle Skylake like Cherryview.
Kenneth Graunke [Tue, 4 Nov 2014 06:16:13 +0000 (22:16 -0800)]
i965: Update compaction code to handle Skylake like Cherryview.

Matt requested this in review feedback on the original patch, which I
completely missed when pushing this series.  Kristian also made this
change, but I grabbed the wrong version of the patch.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agomesa: Don't call _mesa_ClipControl from glPopAttrib when unsupported.
Kenneth Graunke [Tue, 4 Nov 2014 02:16:41 +0000 (18:16 -0800)]
mesa: Don't call _mesa_ClipControl from glPopAttrib when unsupported.

Otherwise, calling glPopAttrib on drivers that don't support
ARB_clip_control gives you a GL error, which is surprising at best.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965: Disable fast color clears on Skylake for now.
Kenneth Graunke [Mon, 3 Nov 2014 23:34:56 +0000 (15:34 -0800)]
i965: Disable fast color clears on Skylake for now.

We're not programming the clear values yet, so this won't work.

This patch should be (effectively) reverted eventually.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/skl: Use new MOCS for SKL
Kristian Høgsberg [Tue, 23 Sep 2014 16:46:28 +0000 (09:46 -0700)]
i965/skl: Use new MOCS for SKL

On Skylake, the MOCS bits are an index into a table of 63 different,
configurable cache configurations.  As for previous GENs, we only care about
WB and WT, which are available in the documented default set.  Define
SKL_MOCS_WB and SKL_MOCS_WT to the indices for those configucations and use
those for the Skylake MOCS values.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Implement workaround for VF Invalidate issue
Jordan Justen [Thu, 1 May 2014 18:03:09 +0000 (11:03 -0700)]
i965/skl: Implement workaround for VF Invalidate issue

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>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Update Viewport Z Clip Test Enable bits for Skylake.
Kenneth Graunke [Tue, 22 Apr 2014 02:47:07 +0000 (19:47 -0700)]
i965/skl: Update Viewport Z Clip Test Enable bits for Skylake.

Skylake has separate controls for enabling the Z Clip Test for the near
and far planes.  For now, maintain the legacy behavior by setting both.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Emit extra zeros in 3DSTATE_DS on Skylake.
Kenneth Graunke [Tue, 22 Apr 2014 02:43:50 +0000 (19:43 -0700)]
i965/skl: Emit extra zeros in 3DSTATE_DS on Skylake.

Skylake's 3DSTATE_DS packet has a few more fields; we don't support
domain shaders yet though.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Init instructions compaction tables for SKL
Kristian Høgsberg [Mon, 22 Sep 2014 10:10:34 +0000 (03:10 -0700)]
i965/skl: Init instructions compaction tables for SKL

They are the same as for BDW, so just add a case for SKL to the init switch.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/skl: Add fast clear resolve rect multipliers for SKL
Kristian Høgsberg [Sat, 6 Sep 2014 04:19:02 +0000 (21:19 -0700)]
i965/skl: Add fast clear resolve rect multipliers for SKL

SKL updates the resolve rectangle scaling factors again.

Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Always emit 3DSTATE_BINDING_TABLE_POINTERS_* on Skylake.
Kenneth Graunke [Tue, 29 Apr 2014 22:32:40 +0000 (15:32 -0700)]
i965/skl: Always emit 3DSTATE_BINDING_TABLE_POINTERS_* on Skylake.

On SKL, 3DSTATE_CONSTANT_* command is not committed until we give
the corresponding 3DSTATE_BINDING_TABLE_POINTERS_* command.  If we
fail to do so, the constant buffers wont be read and push constants
will be wrong.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Allocate 16 DWords for SURFACE_STATE on Skylake.
Kenneth Graunke [Thu, 24 Apr 2014 20:54:14 +0000 (13:54 -0700)]
i965/skl: Allocate 16 DWords for SURFACE_STATE on Skylake.

Otherwise they overlap and horrible things happen.  All the new DWords
are for fast color clear values, which we don't do yet.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Refactor surface state allocation.
Kenneth Graunke [Thu, 24 Apr 2014 20:40:53 +0000 (13:40 -0700)]
i965/skl: Refactor surface state allocation.

We will need to allocate more DWords on Skylake.

v2: Don't mark brw_context parameter const.  It's modified.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Emit extra zeros in STATE_BASE_ADDRESS on Skylake.
Kenneth Graunke [Tue, 22 Apr 2014 02:38:18 +0000 (19:38 -0700)]
i965/skl: Emit extra zeros in STATE_BASE_ADDRESS on Skylake.

Skylake introduces a new base address for a feature we don't yet expose.
Setting these to 0 should be safe.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Update stencil reference handling for Skylake.
Kenneth Graunke [Tue, 22 Apr 2014 02:30:51 +0000 (19:30 -0700)]
i965/skl: Update stencil reference handling for Skylake.

Skylake uploads the stencil reference values in DW3 of the
3DSTATE_WM_DEPTH_STENCIL packet, rather than in COLOR_CALC_STATE.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Set mask bits in PIPELINE_SELECT on Skylake.
Kenneth Graunke [Mon, 21 Apr 2014 23:37:04 +0000 (16:37 -0700)]
i965/skl: Set mask bits in PIPELINE_SELECT on Skylake.

Skylake has some extra bits in PIPELINE_SELECT, none of which are
interesting for a 3D driver.  In order to selectively change them, it
also introduces new "mask bits" in 15:8.  We care about the "Pipeline
Selection" bits (1:0), so set the mask to 0x3.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Set max OpenGL version the same as gen7/8
Jordan Justen [Mon, 21 Apr 2014 00:31:30 +0000 (17:31 -0700)]
i965/skl: Set max OpenGL version the same as gen7/8

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>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoi965/skl: Update 3DSTATE_SBE for Skylake.
Damien Lespiau [Wed, 27 Feb 2013 15:05:25 +0000 (15:05 +0000)]
i965/skl: Update 3DSTATE_SBE for Skylake.

This commands has seen the addition of 2 dwords that allow to specify
which channels of which attributes need to be forwarded to the fragment
shader.

v2: Rebase forward a year (done by Ken).

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
10 years agoglsl: Improve the CSE pass debugging output.
Kenneth Graunke [Wed, 29 Oct 2014 09:43:29 +0000 (02:43 -0700)]
glsl: Improve the CSE pass debugging output.

The CSE pass now prints out why it thinks a value is not a candidate for
adding to the AE set.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
10 years agoi965/fs: Don't compute_to_mrf() on Gen >= 7.
Matt Turner [Wed, 29 Oct 2014 21:21:14 +0000 (14:21 -0700)]
i965/fs: Don't compute_to_mrf() on Gen >= 7.

No differences in shader-db on Haswell (Gen 7.5).

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Remove now useless dot optimization on basis vect
Matt Turner [Thu, 30 Oct 2014 22:39:36 +0000 (15:39 -0700)]
glsl: Remove now useless dot optimization on basis vect

The optimization in commit d056863b covers these cases, which were the
first optimizations I added to the GLSL compiler.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: Emit mul instead of dot if only one component left.
Matt Turner [Fri, 31 Oct 2014 17:33:17 +0000 (10:33 -0700)]
glsl: Emit mul instead of dot if only one component left.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85683
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85691
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoclover: Fix clBuildProgram piglit regression
Tom Stellard [Mon, 3 Nov 2014 14:14:01 +0000 (09:14 -0500)]
clover: Fix clBuildProgram piglit regression

Should trigger CL_INVALID_VALUE if device_list is NULL and num_devices
is greater than zero.

Introduced by e5468dfa523be2a7a0d04bb9efcf8ae780957563

Reported by: EdB

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agogallivm: Disable frame-pointer-omission on x86 to ensure right stack alignment.
José Fonseca [Fri, 31 Oct 2014 22:58:52 +0000 (22:58 +0000)]
gallivm: Disable frame-pointer-omission on x86 to ensure right stack alignment.

Between release 3.2 and 3.3 LLVM stopped aligning properly when certain
conditions (no allocas, but large number of vectors causing spills to
the stack, and frame pointer omission enabled).

We were already disabling frame-pointer-omission on several build types,
but we now disable it on all build types.

It's not clear whether this affects 32-bits x86 processes only, or if it
can also affect 64-bits x86_64 processes when AVX registers are
available and used.  So disable frame-pointer-omission on both
x86/x86_64 to be on the safe side.

See also:
- http://llvm.org/PR21435

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agogallivm: When disassemble a function, start by printing out its name.
José Fonseca [Fri, 31 Oct 2014 23:09:02 +0000 (23:09 +0000)]
gallivm: When disassemble a function, start by printing out its name.

To help recognize what's supposed to do.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
10 years agoi965/chv: Increase VS and GS thread counts
Ben Widawsky [Sun, 2 Nov 2014 19:43:24 +0000 (11:43 -0800)]
i965/chv: Increase VS and GS thread counts

AFAICT the number of threads is 80, not 70. I am not sure if Ken knows
something I do not.

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agogallium/docs: fix NRM, NRM4 docs
Brian Paul [Fri, 31 Oct 2014 22:01:25 +0000 (16:01 -0600)]
gallium/docs: fix NRM, NRM4 docs

Need to do a sqrt().

FWIW, the html that Sphinx 1.1.3 generates for the math expressions
looks completely broken.

Reviewed-by: José Fonseca <jfonseca@vmware.com>
10 years agosoftpipe: use the tgsi_free_tokens() function
Brian Paul [Fri, 31 Oct 2014 03:02:19 +0000 (21:02 -0600)]
softpipe: use the tgsi_free_tokens() function

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
10 years agotgsi: add a tgsi_free_tokens() function
Brian Paul [Fri, 31 Oct 2014 01:08:59 +0000 (19:08 -0600)]
tgsi: add a tgsi_free_tokens() function

To match tgsi_alloc_tokens().

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
10 years agoutil: simplify u_pstipple.c code
Brian Paul [Fri, 31 Oct 2014 01:45:52 +0000 (19:45 -0600)]
util: simplify u_pstipple.c code

Use the new helper functions in the tgsi_transform.h file to emit
declarations and instructions.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
10 years agoutil: simplify temp register selection in u_pstipple.c
Brian Paul [Fri, 31 Oct 2014 01:38:09 +0000 (19:38 -0600)]
util: simplify temp register selection in u_pstipple.c

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
10 years agoutil: simplify util_pstipple_create_fragment_shader() params
Brian Paul [Fri, 31 Oct 2014 01:13:57 +0000 (19:13 -0600)]
util: simplify util_pstipple_create_fragment_shader() params

Pass and return tgsi_token buffers instead of pipe_shader_state.

And update softpipe driver (the only user of this function).

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
10 years agosoftpipe: remove unused softpipe_create_fs_variant_exec() parameter
Brian Paul [Fri, 31 Oct 2014 01:11:54 +0000 (19:11 -0600)]
softpipe: remove unused softpipe_create_fs_variant_exec() parameter

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
10 years agosoftpipe: check for SP_NEW_STIPPLE when building quad pipeline
Brian Paul [Fri, 31 Oct 2014 02:45:36 +0000 (20:45 -0600)]
softpipe: check for SP_NEW_STIPPLE when building quad pipeline

Fixes polygon stipple if both DO_PSTIPPLE_IN_DRAW_MODULE and
DO_PSTIPPLE_IN_HELPER_MODULE are zero/off.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
10 years agor600g: Fix build with opencl and radeonsi disabled
Tom Stellard [Fri, 31 Oct 2014 20:26:52 +0000 (16:26 -0400)]
r600g: Fix build with opencl and radeonsi disabled

10 years agoclover: Fix bug when binary programs are passed to clBuildProgram() v2
Tom Stellard [Tue, 21 Oct 2014 14:33:21 +0000 (10:33 -0400)]
clover: Fix bug when binary programs are passed to clBuildProgram() v2

This was a regression introduced by
611d66fe4513e53bde052dd2bab95d448c909a2a

Passing a binary program to clBuildProgram() is legal, but passing one
to clCompileProgram() is not.

v2:
  - Code cleanups.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoclover: Factor input validation of clCompileProgram into a new function v2
Tom Stellard [Tue, 21 Oct 2014 14:31:56 +0000 (10:31 -0400)]
clover: Factor input validation of clCompileProgram into a new function v2

This factors out the validation that is common with clBuildProgram().

v2:
  - Code cleanups.

Reviewed-by: Francisco Jerez <currojerez@riseup.net>
10 years agoradeonsi/compute: Enable PIPE_SHADER_IR_NATIVE for compute shaders v2
Tom Stellard [Fri, 26 Sep 2014 01:11:24 +0000 (18:11 -0700)]
radeonsi/compute: Enable PIPE_SHADER_IR_NATIVE for compute shaders v2

v2:
  - Drop dependency on LLVM >= 3.5.1
  - Rename si_create_shader() to si_shader_binary_read()

10 years agor600g/compute: Enable PIPE_SHADER_IR_NATIVE for compute shaders v2
Tom Stellard [Fri, 26 Sep 2014 01:10:44 +0000 (18:10 -0700)]
r600g/compute: Enable PIPE_SHADER_IR_NATIVE for compute shaders v2

v2:
  - Drop dependency on LLVM >= 3.5.1

10 years agogallium/radeon: Add query for symbol specific config information
Tom Stellard [Mon, 29 Sep 2014 16:36:42 +0000 (09:36 -0700)]
gallium/radeon: Add query for symbol specific config information

This adds a query which allows drivers to access the config
information of a specific function within the LLVM generated ELF
binary.  This makes it possible for the driver to handle ELF
binaries with multiple kernels / global functions.

10 years agor300g: remove enabled/disabled hyperz and AA compression messages
Marek Olšák [Thu, 30 Oct 2014 20:57:00 +0000 (21:57 +0100)]
r300g: remove enabled/disabled hyperz and AA compression messages

It's annoying with octave. Reported by Michael Burian.

Cc: 10.2 10.3 <mesa-stable@lists.freedesktop.org>
10 years agor600g: Delete unused variable 'max_global_size' in 'r600_get_compute_param'
Dieter Nützel [Thu, 23 Oct 2014 17:59:13 +0000 (19:59 +0200)]
r600g: Delete unused variable 'max_global_size' in 'r600_get_compute_param'

Signed-off-by: Dieter Nützel <Dieter@nuetzel-hh.de>
10 years agomesa: protect the debug state with a mutex
Chia-I Wu [Wed, 20 Aug 2014 06:40:31 +0000 (14:40 +0800)]
mesa: protect the debug state with a mutex

We are about to change mesa to spawn threads for deferred glCompileShader and
glLinkProgram, and we need to make sure those threads can send compiler
warnings/errors to the debug output safely.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: protect glsl_type with a mutex
Chia-I Wu [Wed, 20 Aug 2014 06:40:29 +0000 (14:40 +0800)]
glsl: protect glsl_type with a mutex

glsl_type has several static hash tables and a static ralloc context.  They
need to be protected by a mutex as they are not thread-safe.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=69200
Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoglsl: protect anonymous struct id with a mutex
Chia-I Wu [Wed, 20 Aug 2014 06:40:28 +0000 (14:40 +0800)]
glsl: protect anonymous struct id with a mutex

There may be two contexts compiling shaders at the same time, and we want the
anonymous struct id to be globally unique.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoutil: initialize locale_t with a static object
Chia-I Wu [Wed, 20 Aug 2014 06:40:24 +0000 (14:40 +0800)]
util: initialize locale_t with a static object

_mesa_strtod and _mesa_strtof may be called from multiple threads.  They need
to be thread-safe.

v2: platform checks are now done in configure.ac

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoconfigure: check for xlocale.h and strtof
Chia-I Wu [Wed, 20 Aug 2014 06:40:23 +0000 (14:40 +0800)]
configure: check for xlocale.h and strtof

With the assumptions that xlocale.h implies newlocale and strtof_l.  SCons is
updated to define HAVE_XLOCALE_H on linux and darwin.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoutil: add _mesa_strtod and _mesa_strtof
Chia-I Wu [Wed, 20 Aug 2014 06:40:22 +0000 (14:40 +0800)]
util: add _mesa_strtod and _mesa_strtof

Both core mesa and glsl have their own wrappers for strtof_l.  Merge
and move them to util/.  They are compiled with a C++ compiler so that
we can make them thread-safe in a following commit.

Signed-off-by: Chia-I Wu <olv@lunarg.com>
Reviewed-by: Kenneth Graunke <kenneth@whiteacpe.org>
10 years agomesa/gallium: Signal _NEW_TRANSFORM from glClipControl.
Mathias Fröhlich [Sat, 25 Oct 2014 08:17:04 +0000 (10:17 +0200)]
mesa/gallium: Signal _NEW_TRANSFORM from glClipControl.

This removes the need for the gallium rasterizer state
to listen to viewport changes.
Thanks to Marek Olšák <maraeo@gmail.com>.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
10 years agoRevert "i965/compaction: Disable compaction on SNB temporarily."
Matt Turner [Thu, 30 Oct 2014 04:38:39 +0000 (21:38 -0700)]
Revert "i965/compaction: Disable compaction on SNB temporarily."

This reverts commit cabc93c5adc9ea62be901621eff5ce4cb9574791.

Mark thinks the failures on the SNB GT2 in the lab are actually because
of faulty hardware, not instruction compaction. The GT1 didn't see any
problems after changes to the compaction code.

10 years agoi965/vec4: Perform CSE on MAD instructions with final arguments switched.
Matt Turner [Sun, 26 Oct 2014 17:31:21 +0000 (10:31 -0700)]
i965/vec4: Perform CSE on MAD instructions with final arguments switched.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Perform CSE on MAD instructions with final arguments switched.
Matt Turner [Sun, 26 Oct 2014 17:08:40 +0000 (10:08 -0700)]
i965/fs: Perform CSE on MAD instructions with final arguments switched.

Multiplication is commutative.

instructions in affected programs:     48314 -> 47954 (-0.75%)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglsl: Drop constant 0.0 components from dot products.
Matt Turner [Sat, 18 Oct 2014 03:32:58 +0000 (20:32 -0700)]
glsl: Drop constant 0.0 components from dot products.

Helps a small number of vertex shaders in the games Dungeon Defenders
and Shank, as well as an internal benchmark.

instructions in affected programs:     2801 -> 2719 (-2.93%)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoglx/dri3: Implement LIBGL_SHOW_FPS=1 for DRI3/Present.
Kenneth Graunke [Sat, 15 Mar 2014 01:53:42 +0000 (18:53 -0700)]
glx/dri3: Implement LIBGL_SHOW_FPS=1 for DRI3/Present.

v2: Use the UST value provided in the PRESENT_COMPLETE_NOTIFY event
    rather than gettimeofday(), which gives us the presentation time
    instead of the time when SwapBuffers was called.  Suggested by
    Keith Packard.  This relies on the fact that the X DRI3/Present
    implementations use microseconds for UST.

v3: Properly ignore PresentCompleteKindMSCNotify; multiply in 64 bits
    (caught by Keith Packard).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Keith Packard <keithp@keithp.com> [v3]
Reviewed-by: Marek Olšák <marek.olsak@amd.com> [v1]
10 years agoi965: Rename brw_vec4_gs.[ch] to brw_gs.[ch].
Kenneth Graunke [Wed, 29 Oct 2014 00:27:39 +0000 (17:27 -0700)]
i965: Rename brw_vec4_gs.[ch] to brw_gs.[ch].

These source files support actual geometry shaders, so using "gs" for
the name makes a lot of sense.  We're going to be adding SIMD8 geometry
shader support as well, at which point "vec4_gs" will be a misnomer.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
Acked-by: Iago Toral Quiroga <itoral@igalia.com>
10 years agoi965: Rename brw_gs{,_emit}.[ch] to brw_ff_gs{,_emit}.[ch].
Kenneth Graunke [Wed, 29 Oct 2014 00:18:55 +0000 (17:18 -0700)]
i965: Rename brw_gs{,_emit}.[ch] to brw_ff_gs{,_emit}.[ch].

The brw_gs.[ch] and brw_gs_emit.c source files contain code for
emulating fixed-function unit functionality (VF primitive decomposition
or SOL) using the GS unit.  They do not contain code to support proper
geometry shaders.

We've taken to calling that code "ff_gs" (see brw_ff_gs_prog_key,
brw_ff_gs_prog_data, brw_context::ff_gs, brw_ff_gs_compile,
brw_ff_gs_prog).  So it makes sense to make the filenames match.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Matt Turner <mattst88@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@intel.com>
Acked-by: Iago Toral Quiroga <itoral@igalia.com>
10 years agoi965: Rename intel_bufferobj_* functions to match GL and DD hooks.
Kenneth Graunke [Tue, 28 Oct 2014 08:05:12 +0000 (01:05 -0700)]
i965: Rename intel_bufferobj_* functions to match GL and DD hooks.

The GL functions and driver hooks use corresponding names---for example,
glMapBufferRange and Driver.MapBufferRange.  But our implementation was
called "intel_bufferobj_map_range," which has the words "map" and
"buffer" swapped, as well as randomly adding "obj."

FlushMappedBufferRange was even trickier: it ordered the words
3, "obj", 1, 2, 4: intel_bufferobj_flush_mapped_range.

Even though the old names were consistent, I always had trouble
rearranging the jumble of words when searching for a function,
and it took a few tries to eventually land there.

The new names match the word order of GL and the driver hooks;
FlushMappedBufferRange is simply brw_flush_mapped_buffer_range.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoconfigure: fix typos
Jan Vesely [Tue, 21 Oct 2014 16:19:13 +0000 (12:19 -0400)]
configure: fix typos

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
10 years agoconfigure: include llvm systemlibs when using static llvm
Jan Vesely [Thu, 23 Oct 2014 21:17:07 +0000 (17:17 -0400)]
configure: include llvm systemlibs when using static llvm

v2: drop -WL,--exclude-libs, it's not necessary
    fix tabs/spaces

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=70410
Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
10 years agoradeon/llvm: Dynamically allocate branch/loop stack arrays
Michel Dänzer [Tue, 28 Oct 2014 02:28:29 +0000 (11:28 +0900)]
radeon/llvm: Dynamically allocate branch/loop stack arrays

This prevents us from silently overflowing the stack arrays, and allows
arbitrary stack depths.

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

Cc: mesa-stable@lists.freedesktop.org
Reported-and-Tested-by: Nick Sarnie <commendsarnex@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
10 years agomesa: Fix order of errors for glDrawTransformFeedbackStream
Chris Forbes [Sat, 18 Oct 2014 08:12:07 +0000 (21:12 +1300)]
mesa: Fix order of errors for glDrawTransformFeedbackStream

The OpenGL 4.0 core profile specification, section 2.17.3
Transform Feedback Draw Operations says:

   "The error INVALID_VALUE is generated if <stream> is greater
    than or equal to the value of MAX_VERTEX_STREAMS.
    ...
    The error INVALID_OPERATION
    is generated if EndTransformFeedback has never been called
    while the object named by id was bound."

Fixes the piglit test:
   ARB_transform_feedback3/arb_transform_feedback3-draw_using_invalid_stream_index
   (with the test itself fixed to eliminate an unrelated failure)

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agovc4: Add support for ARL and indirect register access on TGSI_FILE_CONSTANT.
Eric Anholt [Thu, 2 Oct 2014 01:27:24 +0000 (18:27 -0700)]
vc4: Add support for ARL and indirect register access on TGSI_FILE_CONSTANT.

Fixes 14 ARB_vp tests (which had no lowering done), and should improve
performance of indirect uniform array access in GLSL.

10 years agovc4: Fix mixup of return type in reloc_tex().
Eric Anholt [Tue, 28 Oct 2014 23:24:28 +0000 (16:24 -0700)]
vc4: Fix mixup of return type in reloc_tex().

10 years agovc4: Drop redundant check for is_tmu_write().
Eric Anholt [Sat, 25 Oct 2014 11:12:16 +0000 (12:12 +0100)]
vc4: Drop redundant check for is_tmu_write().

This function is only called when it would return true.

10 years agovc4: Don't forget to validate code that's got PROG_END on it.
Eric Anholt [Fri, 24 Oct 2014 19:50:20 +0000 (20:50 +0100)]
vc4: Don't forget to validate code that's got PROG_END on it.

This signal doesn't terminate the program now, it terminates the program
soon.  So you have to actually validate the code in the instruction.

10 years agovc4: Add .dir-locals.el for kernel style in the kernel code.
Eric Anholt [Fri, 24 Oct 2014 19:49:27 +0000 (20:49 +0100)]
vc4: Add .dir-locals.el for kernel style in the kernel code.

10 years agovc4: Fix a couple missing '\n's in error output.
Eric Anholt [Fri, 24 Oct 2014 19:42:51 +0000 (20:42 +0100)]
vc4: Fix a couple missing '\n's in error output.

10 years agost/mesa: use PIPE_BIND_DISPLAY_TARGET when checking for sRGB capability
Brian Paul [Mon, 27 Oct 2014 21:03:05 +0000 (15:03 -0600)]
st/mesa: use PIPE_BIND_DISPLAY_TARGET when checking for sRGB capability

When we're checking if the framebuffer is sRGB capable, call
is_format_supported() with the PIPE_BIND_DISPLAY_TARGET flag.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
10 years agoRevert "st/mesa: set MaxUnrollIterations = 255"
Marek Olšák [Tue, 28 Oct 2014 18:49:44 +0000 (19:49 +0100)]
Revert "st/mesa: set MaxUnrollIterations = 255"

This reverts commit 20836c81851e0df29a8ee9c86e5e5388738c840b.

255 is a huge number. If you have a loop with 255 iterations, unrolling it
will exceed the SM3 instruction limit. Let's use the default again.

The comment about a SM3 limit doesn't make sense. For SM3, we generally
want 32 (default) or a lower number due to the SM3 instruction limit, which
is 512 instructions. For SM4, we can try higher numbers if needed, but
some shaders can end up being pretty huge and shader compilation can take
more time.

This fixes a shader compile failure on R500/SM3. Reported on IRC.

Cc: 10.2 10.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
10 years agor300g/vdpau: enable again
David Heidelberger [Wed, 15 Oct 2014 21:47:22 +0000 (23:47 +0200)]
r300g/vdpau: enable again

Signed-off-by: David Heidelberger <david.heidelberger@ixit.cz>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
10 years agor300g: only set clip_halfz for chips with HW TCL
Marek Olšák [Tue, 28 Oct 2014 10:12:27 +0000 (11:12 +0100)]
r300g: only set clip_halfz for chips with HW TCL

I forgot that we cannot emit vertex shader state on a chip without VS.
In such a case, clip_halfz is handled by the Draw module.

10 years agoradeonsi: fix incorrect index buffer max size for lowered 8-bit indices
Marek Olšák [Wed, 22 Oct 2014 21:22:16 +0000 (23:22 +0200)]
radeonsi: fix incorrect index buffer max size for lowered 8-bit indices

Cc: 10.2 10.3 mesa-stable@lists.freedesktop.org
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agoradeonsi: fix polygon mode for points and lines and point/line fill modes
Marek Olšák [Thu, 23 Oct 2014 11:44:14 +0000 (13:44 +0200)]
radeonsi: fix polygon mode for points and lines and point/line fill modes

Fixes piglit/polygon-mode-offset.

Cc: 10.2 10.3 mesa-stable@lists.freedesktop.org
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g: fix polygon mode for points and lines and point/line fill modes
Marek Olšák [Thu, 23 Oct 2014 11:44:14 +0000 (13:44 +0200)]
r600g: fix polygon mode for points and lines and point/line fill modes

Fixes piglit/polygon-mode-offset.

Cc: 10.2 10.3 mesa-stable@lists.freedesktop.org
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
10 years agor600g: Implement sm5 UBO/sampler indexing
Glenn Kennard [Wed, 15 Oct 2014 15:12:16 +0000 (17:12 +0200)]
r600g: Implement sm5 UBO/sampler indexing

Caveat: Shaders using UBO/sampler indexing will
not be optimized by SB, due to SB not currently
supporting the necessary CF_INDEX_[01] index
registers.

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
10 years agor600g: Implement sm5 interpolation functions
Glenn Kennard [Wed, 15 Oct 2014 15:12:15 +0000 (17:12 +0200)]
r600g: Implement sm5 interpolation functions

Requires evergreen/cayman

Signed-off-by: Glenn Kennard <glenn.kennard@gmail.com>
10 years agodocs: Update GL3.txt and relnotes for GL_KHR_context_flush_control
Neil Roberts [Tue, 28 Oct 2014 16:51:12 +0000 (16:51 +0000)]
docs: Update GL3.txt and relnotes for GL_KHR_context_flush_control

10 years agomesa: Add support for the GL_KHR_context_flush_control extension
Neil Roberts [Tue, 23 Sep 2014 18:01:04 +0000 (19:01 +0100)]
mesa: Add support for the GL_KHR_context_flush_control extension

The GL side of this extension just provides an accessor via glGetIntegerv for
the value of GL_CONTEXT_RELEASE_BEHAVIOR so it is trivial to implement. There
is a constant on the context for the value of the enum which is initialised to
GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH. The extension is always enabled because it
doesn't need any driver interaction to retrieve the value.

If the value of the enum is anything but FLUSH then _mesa_make_current will
now refrain from calling _mesa_flush. This should only affect drivers that
explicitly change the enum to a non-default value.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agogles2: Update gl2ext.h to revision 28335
Neil Roberts [Wed, 1 Oct 2014 16:24:10 +0000 (17:24 +0100)]
gles2: Update gl2ext.h to revision 28335

The main incentive to do this is to get the defines for the
GL_KHR_context_flush_control extension.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
10 years agoi965/fs: Don't set dependency hints on instructions with spilled destinations
Jason Ekstrand [Mon, 27 Oct 2014 23:50:12 +0000 (16:50 -0700)]
i965/fs: Don't set dependency hints on instructions with spilled destinations

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
10 years agoi965/fs: Make scratch write instructions use the correct execution size
Jason Ekstrand [Fri, 24 Oct 2014 18:42:02 +0000 (11:42 -0700)]
i965/fs: Make scratch write instructions use the correct execution size

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoi965/fs: Use correct spill offsets
Jason Ekstrand [Fri, 24 Oct 2014 18:41:25 +0000 (11:41 -0700)]
i965/fs: Use correct spill offsets

Different platforms require the offset to be in different units.  However,
the generator fixes all of this up for us and only requires an offset in
bytes.  Previously, we were getting this wrong all over the place.  Some
computed/used it correctly as bytes while others treated the offset as
whole registers or computed it as bytes or bytes*2 in SIMD16 mode.  This
commit cleans all this up and makes us properly treat it as bytes
everywhere.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoi965: Use the spill destination for the message header on GEN >= 7
Jason Ekstrand [Fri, 24 Oct 2014 19:22:04 +0000 (12:22 -0700)]
i965: Use the spill destination for the message header on GEN >= 7

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoi965/fs: Don't [un]spill multiple registers at a time in SIMD8 mode
Jason Ekstrand [Fri, 24 Oct 2014 18:37:55 +0000 (11:37 -0700)]
i965/fs: Don't [un]spill multiple registers at a time in SIMD8 mode

I thought this would be a clever way to make spilling less expensive.
However, it appears that the oword read/write messages we are using for
spilling ignore the execution size and assume SIMD16 whenever working with
more than one register.

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoi965/fs: Use instruction execution sizes when generating scratch reads/writes
Jason Ekstrand [Fri, 24 Oct 2014 18:35:51 +0000 (11:35 -0700)]
i965/fs: Use instruction execution sizes when generating scratch reads/writes

Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agoegl/drm: do not crash when swapping buffers without any rendering
Lionel Landwerlin [Tue, 14 Oct 2014 09:39:47 +0000 (10:39 +0100)]
egl/drm: do not crash when swapping buffers without any rendering

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
10 years agonv50: handle inverted render conditions
Tobias Klausmann [Mon, 22 Sep 2014 02:40:58 +0000 (04:40 +0200)]
nv50: handle inverted render conditions

This enables ARB_conditional_render_inverted.

Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann@mni.thm.de>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
10 years agofreedreno/ir3: consider instruction neighbors in cp
Rob Clark [Fri, 24 Oct 2014 13:27:37 +0000 (09:27 -0400)]
freedreno/ir3: consider instruction neighbors in cp

Fanin (merge) nodes require it's srcs to be "adjacent" in consecutive
scalar registers.  Keep track of instruction neighbors in copy-
propagation step and avoid eliminating mov's which would cause an
instruction to need multiple distinct left and/or right neighbors.

This lets us not fall on our face when we encounter things like:

  1: MOV TEMP[2], IN[0].xyzw
  2: TEX OUT[0].xy, TEMP[2], SAMP[0], SHADOW2D
  3: MOV TEMP[2].xy, IN[0].yxzz
  4: TEX OUT[0].zw, TEMP[2], SAMP[0], SHADOW2D
  5: END

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/ir3: always mov tex coords
Rob Clark [Fri, 24 Oct 2014 13:38:33 +0000 (09:38 -0400)]
freedreno/ir3: always mov tex coords

Always insert extra mov's for the tex coord into the fanin.  This
simplifies things a bit, and avoids a scenario where multiple sam
instructions can have mutually exclusive input's to it's fanin, for
example:

  1: TEX OUT[0].xy, IN[0].xyxx, SAMP[0], 2D
  2: TEX OUT[0].zw, IN[0].yxxx, SAMP[0], 2D

The CP pass can always remove the mov's that are not actually needed,
so better to start out with too many mov's in the front end, than not
enough.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno: rename a couple debug flags
Rob Clark [Wed, 22 Oct 2014 17:27:35 +0000 (13:27 -0400)]
freedreno: rename a couple debug flags

dscis -> noscis
dbypass -> nobypass

a bit more consistant w/ nobin, etc.  And IMO a bit more sensible names.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agofreedreno/ir3: skip virtual outputs in standalone compiler
Rob Clark [Sat, 25 Oct 2014 14:23:47 +0000 (10:23 -0400)]
freedreno/ir3: skip virtual outputs in standalone compiler

Kills get added to the outputs list, to ensure they get scheduled.  But
they aren't *really* outputs so skip them in the header comment block.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agoglx: Fix make check.
Mathias Fröhlich [Sat, 25 Oct 2014 12:42:14 +0000 (14:42 +0200)]
glx: Fix make check.

This fixes https://bugs.freedesktop.org/show_bug.cgi?id=85429.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
10 years agomesa: Add ARB_clip_control.xml to automake.
Mathias Fröhlich [Sat, 25 Oct 2014 06:57:00 +0000 (08:57 +0200)]
mesa: Add ARB_clip_control.xml to automake.

Adding this makes 'make check' catch failures introduced from
within ARB_clip_control.xml earlier.

Signed-off-by: Mathias Froehlich <Mathias.Froehlich@web.de>
10 years agofreedreno/ir3: standalone compiler updates for ir3test
Rob Clark [Fri, 24 Oct 2014 21:05:49 +0000 (17:05 -0400)]
freedreno/ir3: standalone compiler updates for ir3test

In order to test compiler changes more easily, spit out the assembled
shader with some header information so that we can know about
inputs/outputs more easily.

See: git://people.freedesktop.org/~robclark/ir3test

In ir3test we have a big collection of tgsi shaders and reference
ir3_compiler outputs.  When making compiler changes, regenerate the
compiler outputs and feed to ir3test to compare the new vs reference
shader.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
10 years agoilo: improve blob decoding
Chia-I Wu [Sat, 25 Oct 2014 05:27:09 +0000 (13:27 +0800)]
ilo: improve blob decoding

The last few dwords were skipped if the total number of dwords was not a
multiple of 4.  Change the formatting for better readability.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>