mesa.git
8 years agollvmpipe: add POWER8 portability file - u_pwr8.h
Oded Gabbay [Thu, 3 Dec 2015 07:11:13 +0000 (09:11 +0200)]
llvmpipe: add POWER8 portability file - u_pwr8.h

This file provides a portability layer that will make it easier to convert
SSE-based functions to VMX/VSX-based functions.

All the functions implemented in this file are prefixed using "vec_".
Therefore, when converting from SSE-based function, one needs to simply
replace the "_mm_" prefix of the SSE function being called to "vec_".

Having said that, not all functions could be converted as such, due to the
differences between the architectures. So, when doing such
conversion hurt the performance, I preferred to implement a more ad-hoc
solution. For example, converting the _mm_shuffle_epi32 needed to be done
using ad-hoc masks instead of a generic function.

All the functions in this file support both little-endian and big-endian
but currently the file is build only on POWER8 LE machine.

All of the functions are implemented using the Altivec/VMX intrinsics,
except one where I needed to use inline assembly (due to missing
intrinsic).

v2:
- Use vec_vgbbd instead of __builtin_vec_vgbbd
- Add an aligned load function
- Don't use typeof()
- Make file build only on POWER8 LE machine

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agoconfigure.ac: Detect if running on POWER8 arch
Oded Gabbay [Thu, 3 Dec 2015 07:11:04 +0000 (09:11 +0200)]
configure.ac: Detect if running on POWER8 arch

To determine if we could use special POWER8 assembly directives, we first
need to detect whether we are running on POWER8 architecture. This patch
adds this detection to configure.ac and adds the necessary compilation
flags accordingly.

v2:

- Add option to disable POWER8 instructions generation
- Detect whether building on BE or LE machine and build with
  -mpower8-vector only on LE machine
- Make the printed messages more standard

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agonir: Add a lower_fdiv option, turn fdiv into fmul/frcp.
Kenneth Graunke [Tue, 5 Jan 2016 13:09:46 +0000 (05:09 -0800)]
nir: Add a lower_fdiv option, turn fdiv into fmul/frcp.

The nir_opt_algebraic rule

(('fadd', ('flog2', a), ('fneg', ('flog2', b))), ('flog2', ('fdiv', a, b))),

can produce new fdiv operations, which need to be lowered on i965,
as we don't actually implement fdiv.  (Normally, we handle this in
GLSL IR's lower_instructions pass, but in the above case we introduce
an fdiv after that point.  So, make NIR do it for us.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agoi965: Only turn on ARB_compute_shader if we can write registers.
Kenneth Graunke [Tue, 5 Jan 2016 10:54:50 +0000 (02:54 -0800)]
i965: Only turn on ARB_compute_shader if we can write registers.

Compute shaders require reconfiguring the L3 for shared local memory
support.  We have to be able to write the L3 registers to do that.

This effectively turns off compute shaders prior to Kernel 4.2.

(Previously, the extension enable was in an API_OPENGL_CORE conditional.
However, that isn't necessary - core Mesa extension handling already
restricts it properly.  I've moved it out in this patch.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
8 years agoi965: Use rcp in brw_lower_texture_gradients rather than 1.0 / x.
Kenneth Graunke [Tue, 5 Jan 2016 12:46:33 +0000 (04:46 -0800)]
i965: Use rcp in brw_lower_texture_gradients rather than 1.0 / x.

That's what it's for.  Plus, we actually implement rcp.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agomesa: fix GL_MAX_NAME_LENGTH query for tessellation shaders
Timothy Arceri [Wed, 6 Jan 2016 00:27:05 +0000 (11:27 +1100)]
mesa: fix GL_MAX_NAME_LENGTH query for tessellation shaders

This fixes some piglit subtests for ARB_program_interface_query.

V3: remove some of the unnecessary parentheses
V2: fix alignment

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoglsl: don't change the varying type in validation code
Timothy Arceri [Wed, 23 Dec 2015 03:26:49 +0000 (14:26 +1100)]
glsl: don't change the varying type in validation code

There is a function dedicated to demoting unused varyings lets
trust it to do its job.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoglsl: move lowering after matching validation
Timothy Arceri [Wed, 23 Dec 2015 03:11:04 +0000 (14:11 +1100)]
glsl: move lowering after matching validation

After lowering the matching flag is_unmatched_generic_inout is lost so
we need to move this validation before lowering.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoglsl: only add outward facing varyings to resourse list for SSO
Timothy Arceri [Wed, 23 Dec 2015 22:50:59 +0000 (09:50 +1100)]
glsl: only add outward facing varyings to resourse list for SSO

An SSO program can have multiple stages and we only want to add the externally
facing varyings. The current code was adding both the packed inputs and outputs
for the first and last stage of each program.

Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agoi965/gen9: Modify the conditions to use blitter on skl+
Anuj Phogat [Tue, 24 Mar 2015 23:07:40 +0000 (16:07 -0700)]
i965/gen9: Modify the conditions to use blitter on skl+

Conditions modified allow skl+ to use blitter:
 - for all tiling formats
 - to write data to YF/YS tiled surfaces

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
8 years agoi965/gen9: Return false in place of assert in intelEmitCopyBlit()
Anuj Phogat [Tue, 10 Nov 2015 23:33:53 +0000 (15:33 -0800)]
i965/gen9: Return false in place of assert in intelEmitCopyBlit()

This allows the fallback paths to handle it correctly.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965/gen9: Remove regions overlap check in fast copy blit
Anuj Phogat [Tue, 3 Nov 2015 18:31:45 +0000 (10:31 -0800)]
i965/gen9: Remove regions overlap check in fast copy blit

Overlapping blits are anyway undefined in OpenGL. So no need
of overlap check here.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965/gen9: Don't use fast copy blit in case of non power of 2 cpp
Anuj Phogat [Tue, 28 Jul 2015 17:47:35 +0000 (10:47 -0700)]
i965/gen9: Don't use fast copy blit in case of non power of 2 cpp

Fast copy blit is currently enabled for use only with Yf/Ys tiling.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi915/i965: Fix typo in perf_debug message
Ian Romanick [Fri, 18 Dec 2015 01:50:34 +0000 (17:50 -0800)]
i915/i965: Fix typo in perf_debug message

Trivial

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
8 years agost/mesa: minor indentation fixes
Brian Paul [Tue, 5 Jan 2016 20:04:46 +0000 (13:04 -0700)]
st/mesa: minor indentation fixes

8 years agodraw: minor indentation fix
Brian Paul [Tue, 5 Jan 2016 20:03:05 +0000 (13:03 -0700)]
draw: minor indentation fix

8 years agomesa: minor clean-up of some memcpy/sizeof() calls in m_matrix.c
Brian Paul [Tue, 5 Jan 2016 20:03:05 +0000 (13:03 -0700)]
mesa: minor clean-up of some memcpy/sizeof() calls in m_matrix.c

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agoutil: add debug_dump_ubyte_rgba_bmp()
Brian Paul [Tue, 5 Jan 2016 20:03:04 +0000 (13:03 -0700)]
util: add debug_dump_ubyte_rgba_bmp()

Like debug_dump_float_rgba_bmp() but takes ubyte values.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agomesa: check for z=0 in _mesa_Vertex3dv()
Brian Paul [Tue, 5 Jan 2016 20:03:04 +0000 (13:03 -0700)]
mesa: check for z=0 in _mesa_Vertex3dv()

It's very rare that a GL app calls glVertex3dv(), but one in particular
calls it lot, always with Z = 0.  Check for that condition and convert
the call into glVertex2f.  This reduces VBO memory used and reduces
the number of times we have to switch between float[2] and float[3]
vertex formats in the svga driver.  This results in a small but
measurable performance improvement.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: fix test for SVGA_NEW_STIPPLE
Brian Paul [Tue, 5 Jan 2016 20:03:04 +0000 (13:03 -0700)]
svga: fix test for SVGA_NEW_STIPPLE

We only want to set the SVGA_NEW_STIPPLE dirty flag when the polygon
stipple state changes.  Before, we only set the flag when we were
enabling stipple, but not disabling.

We don't really have to add SVGA_NEW_STIPPLE to the dirty FS state
set since it's a subset of SVGA_NEW_RAST, but let's be explicit.

This doesn't fix any known bugs.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: add some comments in svga_state_vs.c
Brian Paul [Tue, 5 Jan 2016 20:03:04 +0000 (13:03 -0700)]
svga: add some comments in svga_state_vs.c

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: change svga_hw_view_state::dirty to boolean
Brian Paul [Tue, 5 Jan 2016 20:03:04 +0000 (13:03 -0700)]
svga: change svga_hw_view_state::dirty to boolean

Since it's a true/false value.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: avoid emitting redundant SetVertexBuffers() commands
Brian Paul [Tue, 5 Jan 2016 20:03:04 +0000 (13:03 -0700)]
svga: avoid emitting redundant SetVertexBuffers() commands

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agosvga: check for no-ops in svga_bind_sampler_states()
Brian Paul [Tue, 5 Jan 2016 20:03:04 +0000 (13:03 -0700)]
svga: check for no-ops in svga_bind_sampler_states()

and svga_set_sampler_views().  If there's no change, return early
and don't set a SVGA_NEW_x dirty state flag.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
8 years agoi965: quieten compiler warning about out-of-bounds access
Ilia Mirkin [Tue, 5 Jan 2016 04:28:52 +0000 (23:28 -0500)]
i965: quieten compiler warning about out-of-bounds access

gcc 4.9.3 shows the following error:

brw_vue_map.c:260:20: warning: array subscript is above array bounds
[-Warray-bounds]
    return brw_names[slot - VARYING_SLOT_MAX];

This is because BRW_VARYING_SLOT_COUNT is a valid value for the enum
type. Adding an assert will generate no additional code but will teach
the compiler to not complain.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agobuild: enable st/va with nouveau driver
Julien Isorce [Thu, 9 Apr 2015 12:45:17 +0000 (13:45 +0100)]
build: enable st/va with nouveau driver

vainfo fails in vaDriverInit because "dd_create_screen"
does not reach strcmp(driver_name, "nouveau") code.
Indeed when compiling the va target.c, the macro GALLIUM_NOUVEAU
is not defined.
This patch define the macro the same it is done for dri and
vdpau targets.

Tested with:
./autogen.sh --enable-glx --enable-gles2 --enable-egl --enable-vdpau --enable-glx-tls=yes --enable-va
--with-gallium-drivers=swrast,nouveau --with-dri-drivers=swrast,nouveau --with-egl-platforms=x11

LIBVA_DRIVER_NAME=gallium vainfo
Output:
vainfo: Driver version: mesa gallium vaapi
vainfo: Supported profile and entrypoints
VAProfileMPEG2Simple                  : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileMPEG4Simple            : VAEntrypointVLD
      VAProfileMPEG4AdvancedSimple    : VAEntrypointVLD
      VAProfileVC1Simple              : VAEntrypointVLD
      VAProfileVC1Main                : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD
      VAProfileH264Baseline           : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointVLD
      VAProfileNone                   : VAEntrypointVideoProc

Signed-off-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: add support for st/va
Julien Isorce [Wed, 23 Dec 2015 09:25:53 +0000 (09:25 +0000)]
nvc0: add support for st/va

- split nvc0_decoder_bsp in begin/next/end
- preserve content buffer when calling nvc0_decoder_bsp_next
- implement pipe_video_codec::begin_frame/end_frame

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

Signed-off-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonouveau: split nouveau_vp3_bsp in begin/next/end
Julien Isorce [Wed, 23 Dec 2015 09:25:52 +0000 (09:25 +0000)]
nouveau: split nouveau_vp3_bsp in begin/next/end

It allows to call nouveau_vp3_bsp_next multiple times
between one begin/end.

It is required to support st/va.

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

Signed-off-by: Julien Isorce <j.isorce@samsung.com>
[imirkin: create strparm_bsp function, simplified w0 calculation]
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agost/va: count number of slices
Julien Isorce [Tue, 5 Jan 2016 15:02:47 +0000 (15:02 +0000)]
st/va: count number of slices

The counter was not set but used by the nouveau driver.
It is required otherwise visual output is garbage.

Signed-off-by: Julien Isorce <j.isorce@samsung.com>
Reviewed-by: Christian Koenig <christian.koenig@amd.com>
8 years agoi965/wm: use binding size for ubo/ssbo when automatic size is unset
Ilia Mirkin [Tue, 5 Jan 2016 00:57:11 +0000 (19:57 -0500)]
i965/wm: use binding size for ubo/ssbo when automatic size is unset

This fixes the same tests that commit 8cf2e892f was attempting to fix:

ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-std430-vec-bindrangeOffset
ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-std430-vec-bindrangeSize

as confirmed by Samuel.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agoRevert "i965/wm: use proper API buffer size for the surfaces."
Ilia Mirkin [Tue, 5 Jan 2016 00:48:08 +0000 (19:48 -0500)]
Revert "i965/wm: use proper API buffer size for the surfaces."

This reverts commit 8cf2e892fca20c4776b4a07c39918343cb2d4e0e. It's
entirely bogus to attempt to store anything about the binding in the
buffer object itself, which might be bound any number of times.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Cc: Marta Lofstedt <marta.lofstedt@intel.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
8 years agost/mesa: make KHR_debug output independent of context creation flags (v2)
Nicolai Hähnle [Mon, 4 Jan 2016 22:31:05 +0000 (17:31 -0500)]
st/mesa: make KHR_debug output independent of context creation flags (v2)

Instead, keep track of GL_DEBUG_OUTPUT and (un)install the pipe_debug_callback
accordingly. Hardware drivers can still use the absence of the callback to
skip more expensive operations in the normal case, and users can no longer be
surprised by the need to set the debug flag at context creation time.

v2:
- re-add the proper initialization of debug contexts (Ilia Mirkin)
- silence a potential warning (Ilia Mirkin)

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonvc0: scale up inter_bo size so that it's 16M for a 4K video
Ilia Mirkin [Mon, 4 Jan 2016 16:26:27 +0000 (11:26 -0500)]
nvc0: scale up inter_bo size so that it's 16M for a 4K video

Experimentally, 4M causes corruption and slowness, try to ramp it up
with size instead.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agonv50,nvc0: fix crash when increasing bsp bo size for h264
Ilia Mirkin [Mon, 4 Jan 2016 16:16:45 +0000 (11:16 -0500)]
nv50,nvc0: fix crash when increasing bsp bo size for h264

H264 doesn't have a bitplane bo. We just need a device reference, so use
the one from the client.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agoi965/wm: use proper API buffer size for the surfaces.
Samuel Iglesias Gonsálvez [Tue, 15 Dec 2015 11:51:48 +0000 (12:51 +0100)]
i965/wm: use proper API buffer size for the surfaces.

Commit 5bb5eeea fixes a bug indicating that the surfaces should have the
API buffer size. Hovewer it picked the wrong value.

This patch adds a new variable, which takes into account
glBindBufferRange() values. This patch fixes the following CTS
regressions:

ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-std430-vec-bindrangeOffset
ES31-CTS.shader_storage_buffer_object.advanced-unsizedArrayLength-cs-std430-vec-bindrangeSize

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
8 years agoradeonsi: remove unused parameter from si_shader_binary_read_config
Marek Olšák [Mon, 28 Dec 2015 00:39:20 +0000 (01:39 +0100)]
radeonsi: remove unused parameter from si_shader_binary_read_config

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: move si_shader_binary_upload out of si_shader_binary_read
Marek Olšák [Sun, 27 Dec 2015 22:22:14 +0000 (23:22 +0100)]
radeonsi: move si_shader_binary_upload out of si_shader_binary_read

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: dump LLVM module outside of radeon_llvm_compile
Marek Olšák [Sun, 27 Dec 2015 21:16:05 +0000 (22:16 +0100)]
gallium/radeon: dump LLVM module outside of radeon_llvm_compile

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: always add +DumpCode to the LLVM target machine for LLVM <= 3.5
Marek Olšák [Sun, 27 Dec 2015 20:57:40 +0000 (21:57 +0100)]
gallium/radeon: always add +DumpCode to the LLVM target machine for LLVM <= 3.5

It's the same behavior that we use for later LLVM.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agogallium/radeon: r600_can_dump_shader should get TGSI processor type directly
Marek Olšák [Sun, 27 Dec 2015 20:24:47 +0000 (21:24 +0100)]
gallium/radeon: r600_can_dump_shader should get TGSI processor type directly

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: pass TGSI processor type to si_shader_binary_read for dumping
Marek Olšák [Sun, 27 Dec 2015 21:24:41 +0000 (22:24 +0100)]
radeonsi: pass TGSI processor type to si_shader_binary_read for dumping

the parameter will be used later

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: pass TGSI processor type to si_compile_llvm for dumping
Marek Olšák [Sun, 27 Dec 2015 21:22:24 +0000 (22:22 +0100)]
radeonsi: pass TGSI processor type to si_compile_llvm for dumping

the parameter will be used later

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agoradeonsi: rename shader parameter definitions and variables for more clarity
Marek Olšák [Wed, 30 Dec 2015 14:04:26 +0000 (15:04 +0100)]
radeonsi: rename shader parameter definitions and variables for more clarity

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agonvc0/ir: add support for PK2H/UP2H
Ilia Mirkin [Thu, 29 Oct 2015 06:52:56 +0000 (02:52 -0400)]
nvc0/ir: add support for PK2H/UP2H

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agost/mesa: use PK2H/UP2H when supported
Ilia Mirkin [Thu, 29 Oct 2015 06:52:57 +0000 (02:52 -0400)]
st/mesa: use PK2H/UP2H when supported

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallium: add PIPE_CAP_TGSI_PACK_HALF_FLOAT to indicate UP2H/PK2H support
Ilia Mirkin [Sat, 2 Jan 2016 23:55:48 +0000 (18:55 -0500)]
gallium: add PIPE_CAP_TGSI_PACK_HALF_FLOAT to indicate UP2H/PK2H support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agotgsi: update PK2H/UP2H channel behavior info
Ilia Mirkin [Thu, 29 Oct 2015 21:52:46 +0000 (17:52 -0400)]
tgsi: update PK2H/UP2H channel behavior info

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallium: document PK2H/UP2H
Ilia Mirkin [Thu, 29 Oct 2015 06:52:55 +0000 (02:52 -0400)]
gallium: document PK2H/UP2H

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agost/mesa: fix parameter names for tesseval/tessctrl prototypes
Samuel Pitoiset [Sun, 3 Jan 2016 17:40:39 +0000 (18:40 +0100)]
st/mesa: fix parameter names for tesseval/tessctrl prototypes

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agonouveau: fix double-const qualifier
Ilia Mirkin [Sun, 3 Jan 2016 16:29:09 +0000 (11:29 -0500)]
nouveau: fix double-const qualifier

Reported by Tom^ on IRC. The original intent was to mark the pointer
constant as well as the data being pointed to, so move the *.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agofreedreno/ir3: use NIR_PASS helper macros
Rob Clark [Sat, 24 Oct 2015 18:54:56 +0000 (14:54 -0400)]
freedreno/ir3: use NIR_PASS helper macros

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agonir: extract out helper macros for running passes
Rob Clark [Wed, 18 Nov 2015 21:33:41 +0000 (16:33 -0500)]
nir: extract out helper macros for running passes

Note these are a bit uglier, due to avoidance of GNU C extensions.  But
drivers which do not need to be built with compilers that don't support
the extension can wrap these macros with their own.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agofreedreno/ir3: we require block_index metadata
Rob Clark [Mon, 26 Oct 2015 14:50:35 +0000 (10:50 -0400)]
freedreno/ir3: we require block_index metadata

Found during NIR_TEST_CLONE=1 piglit run.  We were using block->index
but forgetting to require it.  Causing things to not work with a cloned
shader which didn't preserve block_index.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: refactor NIR IR handling
Rob Clark [Sat, 24 Oct 2015 18:30:31 +0000 (14:30 -0400)]
freedreno/ir3: refactor NIR IR handling

Immediately convert into NIR and do an initial key-agnostic lowering/
optimization pass.  This should let us share most of the per-variant
transformations between each variant, and hopefully minimize the draw-
time variant creation part of the compilation process.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agofreedreno/ir3: drop unnecessary unreachable() case
Rob Clark [Mon, 21 Dec 2015 15:21:29 +0000 (10:21 -0500)]
freedreno/ir3: drop unnecessary unreachable() case

It will still hit a compile_assert() in emit_tex, which has the
advantage of dumping out the offending shader.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
8 years agogallium/tests: fix build with clang compiler
Samuel Pitoiset [Wed, 25 Nov 2015 00:19:16 +0000 (01:19 +0100)]
gallium/tests: fix build with clang compiler

Nested functions are supported as an extension in GNU C, but Clang
don't support them.

This fixes compilation errors when (manually) building compute.c,
or by setting --enable-gallium-tests to the configure script.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=75165
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
8 years agonv50,nvc0: optimize coherent buffer checking at draw time
Samuel Pitoiset [Wed, 9 Dec 2015 18:53:18 +0000 (19:53 +0100)]
nv50,nvc0: optimize coherent buffer checking at draw time

Instead of iterating over all the buffer resources looking for coherent
buffers, we keep track of a context-wide count. This will save some
iterations (and CPU cycles) in 99.99% case because usually coherent
buffers are not so used.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agoi965: Make TCS precompile use the TES primitive mode when available.
Kenneth Graunke [Sat, 2 Jan 2016 06:27:22 +0000 (22:27 -0800)]
i965: Make TCS precompile use the TES primitive mode when available.

If there's a linked TES program, we should just use the actual
primitive mode.  If not, just guess triangles (as we did before).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agoi965: Push most TES inputs in SIMD8 mode.
Kenneth Graunke [Mon, 28 Dec 2015 01:26:30 +0000 (17:26 -0800)]
i965: Push most TES inputs in SIMD8 mode.

Using the push model for inputs is much more efficient than pulling
inputs - the hardware can simply copy a large chunk into URB registers
at thread creation time, rather than having the thread send messages to
request data from the L3 cache.  Unfortunately, it's possible to have
more TES inputs than fit in registers, so we have to fall back to the
pull model in some cases.

However, it turns out that most tessellation evaluation shaders are
fairly simple, and don't use many inputs.  An arbitrary cut-off of
32 vec4 slots (16 registers) is more than sufficient to ensure that
100% of TES inputs are pushed for Shadow of Mordor, Unigine Heaven,
GPUTest/TessMark, and SynMark.

Note that unlike most SIMD8 stages, this actually reads packed vec4
data, since that is what our vec4 TCS programs write.

Improves performance in GPUTest's tessmark_x64 microbenchmark
by 93.4426% +/- 5.35541% (n = 25) on my Lenovo X250 at 1024x768.

Improves performance in Synmark's Gl40TerrainFlyTess microbenchmark
by 22.74% +/- 0.309394% (n = 5).

Improves performance in Shadow of Mordor at low settings with
tessellation enabled at 1280x720 by 2.12197% +/- 0.478553% (n = 4).

shader-db statistics for files containing tessellation shaders:

total instructions in shared programs: 184358 -> 181181 (-1.72%)
instructions in affected programs: 27971 -> 24794 (-11.36%)
helped: 226

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Use LOAD_PAYLOAD for SIMD8 TES input loads, not MOV.
Kenneth Graunke [Mon, 28 Dec 2015 00:14:11 +0000 (16:14 -0800)]
i965: Use LOAD_PAYLOAD for SIMD8 TES input loads, not MOV.

We need a MOV to replicate g0.0<0,1,0> to all 8 channels.  Since the
message payload is a single register, MOV seemed more sensible than
LOAD_PAYLOAD.  However, MOV cannot be CSE'd, while LOAD_PAYLOAD can.

All input loads can use the same header - we don't need to re-expand
g0 every time.  CSE accomplishes this, saving instructions.

shader-db statistics for files containing tessellation shaders:

total instructions in shared programs: 186923 -> 184358 (-1.37%)
instructions in affected programs: 30536 -> 27971 (-8.40%)
helped: 226
HURT: 0

total cycles in shared programs: 1009850 -> 1005356 (-0.45%)
cycles in affected programs: 168206 -> 163712 (-2.67%)
helped: 226
HURT: 0

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agoi965: Move 3-src subnr swizzle handling into the vec4 backend.
Kenneth Graunke [Thu, 31 Dec 2015 20:47:19 +0000 (12:47 -0800)]
i965: Move 3-src subnr swizzle handling into the vec4 backend.

While most align16 instructions only support a SubRegNum of 0 or 4
(using swizzling to control the other channels), 3-src instructions
actually support arbitrary SubRegNums.  When the RepCtrl bit is set,
we believe it ignores the swizzle and uses the equivalent of a <0,1,0>
region from the subnr.

In the past, we adopted a vec4-centric approach of specifying subnr of
0 or 4 and a swizzle, then having brw_eu_emit.c convert that to a proper
SubRegNum.  This isn't a great fit for the scalar backend, where we
don't set swizzles at all, and happily set subnrs in the range [0, 7].

This patch changes brw_eu_emit.c to use subnr and swizzle directly,
relying on the higher levels to set them sensibly.

This should fix problems where scalar sources get copy propagated into
3-src instructions in the FS backend.  I've only observed this with
TES push model inputs, but I suppose it could happen in other cases.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agovc4: Fix build from upload changes.
Eric Anholt [Sun, 3 Jan 2016 01:33:19 +0000 (17:33 -0800)]
vc4: Fix build from upload changes.

8 years agogallium/radeon: send LLVM diagnostics as debug messages
Nicolai Hähnle [Sat, 2 Jan 2016 21:40:47 +0000 (16:40 -0500)]
gallium/radeon: send LLVM diagnostics as debug messages

Diagnostics sent during code generation and the every error message reported
by LLVMTargetMachineEmitToMemoryBuffer are disjoint reporting mechanisms. We
take care of both and also send an explicit message indicating failure at the
end, so that log parsers can more easily tell the boundary between shader
compiles.

Removed an fprintf that could never be triggered.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: pass pipe_debug_callback into radeon_llvm_compile (v2)
Nicolai Hähnle [Wed, 30 Dec 2015 21:00:56 +0000 (16:00 -0500)]
gallium/radeon: pass pipe_debug_callback into radeon_llvm_compile (v2)

This will allow us to send shader debug info via the context's debug callback.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> (v1)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: send shader info as debug messages in addition to stderr output
Nicolai Hähnle [Sat, 2 Jan 2016 21:30:57 +0000 (16:30 -0500)]
radeonsi: send shader info as debug messages in addition to stderr output

The output via stderr is very helpful for ad-hoc debugging tasks, so that remains
unchanged, but having the information available via debug messages as well
will allow the use of parallel shader-db runs.

Shader stats are always provided (if the context is a debug context, that is),
but you still have to enable the appropriate R600_DEBUG flags to get
disassembly (since it is rather spammy and is only generated by LLVM when we
explicitly ask for it).

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agoradeonsi: pass pipe_debug_callback down into si_shader_binary_read (v2)
Nicolai Hähnle [Wed, 30 Dec 2015 20:02:57 +0000 (15:02 -0500)]
radeonsi: pass pipe_debug_callback down into si_shader_binary_read (v2)

This will allow us to send shader debug info.

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> (v1)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agogallium/radeon: implement set_debug_callback
Nicolai Hähnle [Wed, 30 Dec 2015 19:55:34 +0000 (14:55 -0500)]
gallium/radeon: implement set_debug_callback

Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agou_upload_mgr: allow specifying PIPE_USAGE_* for the upload buffer
Marek Olšák [Sat, 19 Dec 2015 16:54:31 +0000 (17:54 +0100)]
u_upload_mgr: allow specifying PIPE_USAGE_* for the upload buffer

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agou_upload_mgr: remove alignment parameter from u_upload_create
Marek Olšák [Sat, 19 Dec 2015 16:43:48 +0000 (17:43 +0100)]
u_upload_mgr: remove alignment parameter from u_upload_create

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agou_upload_mgr: pass alignment to u_upload_buffer manually
Marek Olšák [Sat, 19 Dec 2015 16:15:02 +0000 (17:15 +0100)]
u_upload_mgr: pass alignment to u_upload_buffer manually

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agou_upload_mgr: pass alignment to u_upload_data manually
Marek Olšák [Sat, 19 Dec 2015 16:15:02 +0000 (17:15 +0100)]
u_upload_mgr: pass alignment to u_upload_data manually

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agou_upload_mgr: pass alignment to u_upload_alloc manually
Marek Olšák [Sat, 19 Dec 2015 16:15:02 +0000 (17:15 +0100)]
u_upload_mgr: pass alignment to u_upload_alloc manually

The fixed alignment of u_upload_mgr will go away.
This is the first step.

The motivation is that one u_upload_mgr can have multiple users,
each allocating from the same buffer, but requiring a different alignment.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agou_upload_mgr: rework the application of alignment
Marek Olšák [Sat, 19 Dec 2015 15:44:52 +0000 (16:44 +0100)]
u_upload_mgr: rework the application of alignment

The function only aligned the size, but not the offset.
The offset was aligned only when the previous suballocation was aligned.
That yielded the correct offset alignment if the alignment was constant
for all suballocations.

Instead, directly align the offset, but allow an unaligned size.
There is no change in behavior, because the alignment is constant
at the moment.

This a prerequisite for allowing a variable alignment for suballocations.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
8 years agost/mesa: fix GLSL uniform updates for glBitmap & glDrawPixels (v2)
Marek Olšák [Sun, 6 Dec 2015 12:36:57 +0000 (13:36 +0100)]
st/mesa: fix GLSL uniform updates for glBitmap & glDrawPixels (v2)

Spotted by luck. The GLSL uniform storage is only associated once
in LinkShader and can't be reallocated afterwards, because that would
break the association.

v2: don't remove st_upload_constants calls, clarify why they're needed

Cc: 11.0 11.1 <mesa-stable@lists.freedesktop.org>
8 years agoprogram: add _mesa_reserve_parameter_storage
Marek Olšák [Sun, 6 Dec 2015 12:31:25 +0000 (13:31 +0100)]
program: add _mesa_reserve_parameter_storage

The next commit will use this.

Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: 11.0 11.1 <mesa-stable@lists.freedesktop.org>
8 years agomesa: Fix warning with MESA_VERBOSE=api for BindBufferRange
Jordan Justen [Sat, 2 Jan 2016 00:58:49 +0000 (16:58 -0800)]
mesa: Fix warning with MESA_VERBOSE=api for BindBufferRange

Reported-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
8 years agonv50,nvc0: make sure there's pushbuf space and that we ref the bo early
Ilia Mirkin [Fri, 1 Jan 2016 01:33:15 +0000 (20:33 -0500)]
nv50,nvc0: make sure there's pushbuf space and that we ref the bo early

First off, we can't flush in the middle of a command. Secondly
requesting the extra push space might cause a flush to happen. If that
flush happens, we'd have to do the PUSH_REFN again. So instead do
PUSH_REFN after the push space request. This helps avoid rare crashes
with supertuxkart in libdrm due to assertion failures.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agost/mesa: sort extensions enablement array
Ilia Mirkin [Thu, 31 Dec 2015 21:22:40 +0000 (16:22 -0500)]
st/mesa: sort extensions enablement array

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
8 years agonir/lower_clip: add missing writemask on store
Rob Clark [Fri, 1 Jan 2016 17:52:22 +0000 (12:52 -0500)]
nir/lower_clip: add missing writemask on store

Signed-off-by: Rob Clark <robclark@freedesktop.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
8 years agomesa: Add MESA_VERBOSE=api for GL_ARB_program_interface_query
Jordan Justen [Wed, 30 Dec 2015 21:08:07 +0000 (13:08 -0800)]
mesa: Add MESA_VERBOSE=api for GL_ARB_program_interface_query

v2:
 * Add braces '{}' when the _mesa_debug call spans multiple lines (Ken)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
8 years agomesa: Add MESA_VERBOSE=api for several indexed BindBuffer variants
Jordan Justen [Tue, 29 Dec 2015 22:24:09 +0000 (14:24 -0800)]
mesa: Add MESA_VERBOSE=api for several indexed BindBuffer variants

v2:
 * Add braces '{}' when the _mesa_debug call spans multiple lines (Ken)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
8 years agost/glsl_to_tgsi: fix block movs for doubles
Dave Airlie [Sat, 19 Dec 2015 04:43:19 +0000 (14:43 +1000)]
st/glsl_to_tgsi: fix block movs for doubles

While playing with fp64, I disable varying packing to debug
something else, and noticed we never emitted half the output
movs for double matrix arrays.

We should be moving the left index two slots for dual
source doubles, and the right index two slots for non-vs
input doubles.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agost/glsl_to_tgsi: handle different attrib size
Dave Airlie [Sat, 19 Dec 2015 04:43:18 +0000 (14:43 +1000)]
st/glsl_to_tgsi: handle different attrib size

vertex inputs are counted differently in some cases, with
vertex inputs we need to make sure we don't double count them.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agost/glsl_to_tgsi: readd the double_reg2 for input index mapping
Dave Airlie [Sat, 19 Dec 2015 04:43:17 +0000 (14:43 +1000)]
st/glsl_to_tgsi: readd the double_reg2 for input index mapping

Otherwise we end up emitting the wrong index for the second
double.

This fixes dmat-vs-gs-tcs-tes.shader_test and dvec3-vs-gs-tcs-tes.shader_test

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agost/glsl_to_tgsi: when doing reladdr get vec4 of correct type
Dave Airlie [Sat, 19 Dec 2015 04:43:16 +0000 (14:43 +1000)]
st/glsl_to_tgsi: when doing reladdr get vec4 of correct type

This fixes fp64 relative addressing, in the upcoming
dmat-vs-gs-tcs-tes.shader_test.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agost/glsl_to_tgsi: handle double immediates in matrices properly.
Dave Airlie [Sat, 19 Dec 2015 04:43:15 +0000 (14:43 +1000)]
st/glsl_to_tgsi: handle double immediates in matrices properly.

This handles matrix initialisation properly.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agost/glsl_to_tgsi: setup writemask for double arrays and matricies.
Dave Airlie [Sat, 19 Dec 2015 04:43:14 +0000 (14:43 +1000)]
st/glsl_to_tgsi: setup writemask for double arrays and matricies.

It's important for the double instruction emission code that
the writemasks are correct going in for double so it know
which channels to replicate.

This fixes it for the array and matrix cases.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agost/glsl_to_tgsi: handle doubles in array shrinking code.
Dave Airlie [Sat, 19 Dec 2015 04:43:13 +0000 (14:43 +1000)]
st/glsl_to_tgsi: handle doubles in array shrinking code.

This code takes into account double inputs in the array
shrinking code. This fixes some issues with doubles
and geom/tess inputs.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agost/glsl_to_tgsi: handle doubles outputs in arrays.
Dave Airlie [Sat, 19 Dec 2015 04:43:12 +0000 (14:43 +1000)]
st/glsl_to_tgsi: handle doubles outputs in arrays.

This handles the case where a double output is stored
in an array, and tracks it for use in the double
instruction emit code.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agost/glsl_to_tgsi: store if dst is double in array
Dave Airlie [Sat, 19 Dec 2015 04:43:11 +0000 (14:43 +1000)]
st/glsl_to_tgsi: store if dst is double in array

This is just a precursor patch to a fix for doubles with
tessellation that I've written.

We need to descend into output arrays in that case and
mark dst's as double.

Signed-off-by: Dave Airlie <airlied@redhat.com>
8 years agonvc0: Set winding order regardless of domain.
Kenneth Graunke [Wed, 30 Dec 2015 10:53:08 +0000 (02:53 -0800)]
nvc0: Set winding order regardless of domain.

Quads need to respect winding order, too - not just triangles.

Fixes rendering in GFXBench 4.0's tessellation benchmark.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agoglsl: Fix varying struct locations when varying packing is disabled.
Kenneth Graunke [Wed, 30 Dec 2015 10:33:00 +0000 (02:33 -0800)]
glsl: Fix varying struct locations when varying packing is disabled.

varying_matches::record tries to compute the number of components in
each varying, which varying_matches::assign_locations uses to assign
locations.  With varying packing, it uses glsl_type::component_slots()
to come up with a reasonable value.

Without varying packing, it fell back to an open-coded computation
that didn't bother to handle structs at all.  I believe we can simply
use 4 * glsl_type::count_attribute_slots(false), which already handles
these cases correctly.

Partially fixes rendering in GFXBench 4.0's tessellation benchmark.
(NVE0 is almost right after this, but i965 is still mostly garbage.)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>
8 years agodrirc: Disable ARB_blend_func_extended for Heaven 4.0/Valley 1.0.
Kenneth Graunke [Mon, 28 Dec 2015 22:20:28 +0000 (14:20 -0800)]
drirc: Disable ARB_blend_func_extended for Heaven 4.0/Valley 1.0.

Unigine Heaven 4.0 and Valley 1.0 use dual color blending but don't
specify which fragment shader output is which, so there's at best a
50/50 chance of us guessing it correctly.  This is invalid.

Unigine fixed this in 4.1 and 1.1 versions over a year and a half ago,
but hasn't actually released them for whatever reason.  So, add the
workaround back so that it works for most people.

Fixes Heaven 4.0/Valley 1.0 rendering on Ivybridge.  For whatever
reason, Broadwell worked.  4.1 and 1.1 have always worked.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92233
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable@lists.freedesktop.org
8 years agoglsl: add GL_ARB_shader_draw_parameters define
Ilia Mirkin [Wed, 30 Dec 2015 23:47:18 +0000 (18:47 -0500)]
glsl: add GL_ARB_shader_draw_parameters define

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
8 years agonvc0: add ARB_shader_draw_parameters support
Ilia Mirkin [Wed, 30 Dec 2015 19:50:02 +0000 (14:50 -0500)]
nvc0: add ARB_shader_draw_parameters support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
8 years agost/mesa: add GL_ARB_shader_draw_parameters support
Ilia Mirkin [Tue, 29 Dec 2015 21:39:16 +0000 (16:39 -0500)]
st/mesa: add GL_ARB_shader_draw_parameters support

Hooks up the new system values, passes the drawid in.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallium: add a drawid to pipe_draw_info
Ilia Mirkin [Tue, 29 Dec 2015 22:00:05 +0000 (17:00 -0500)]
gallium: add a drawid to pipe_draw_info

This will allow the state tracker to inform the driver where in a
broken-up multidraw we currently are. This can then be passed into the
vertex shader.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallium: add PIPE_CAP_DRAW_PARAMETERS
Ilia Mirkin [Tue, 29 Dec 2015 21:49:32 +0000 (16:49 -0500)]
gallium: add PIPE_CAP_DRAW_PARAMETERS

This allows the state tracker to know that the various draw parameters
are available in vertex shaders.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agogallium: add baseinstance/drawid semantics
Ilia Mirkin [Tue, 29 Dec 2015 21:37:19 +0000 (16:37 -0500)]
gallium: add baseinstance/drawid semantics

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
8 years agonv50/ir: attempt to do more constant folding on mad -> add conversion
Ilia Mirkin [Mon, 7 Dec 2015 04:49:48 +0000 (23:49 -0500)]
nv50/ir: attempt to do more constant folding on mad -> add conversion

The add might actually have a 0 as an argument, which would convert it
into a mov. Make sure to detect that. Also avoid the hack of putting the
immediate directly into the instruction, instead use a mov to put it
into place and let the later LoadPropagation pass place it if possible.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>