mesa.git
9 years agoi965/fs: Introduce FS IR builder.
Francisco Jerez [Wed, 22 Apr 2015 11:02:47 +0000 (14:02 +0300)]
i965/fs: Introduce FS IR builder.

The purpose of this change is threefold: First, it improves the
modularity of the compiler back-end by separating the functionality
required to construct an i965 IR program from the rest of the visitor
god-object, what in turn will reduce the coupling between other
components and the visitor allowing a more modular design.  This patch
doesn't yet remove the equivalent functionality from the visitor
classes, as it involves major back-end surgery.

Second, it improves consistency between the scalar and vector
back-ends.  The FS and VEC4 builders can both be used to generate
scalar code with a compatible interface or they can be used to
generate natural vector width code -- 1 or 4 components respectively.

Third, the approach to IR construction is somewhat different to what
the visitor classes currently do.  All parameters affecting code
generation (execution size, half control, point in the program where
new instructions are inserted, etc.) are encapsulated in a stand-alone
object rather than being quasi-global state (yes, anything defined in
one of the visitor classes is effectively global due to the tight
coupling with virtually everything else in the compiler back-end).
This object is lightweight and can be copied, mutated and passed
around, making helper IR-building functions more flexible because they
can now simply take a builder object as argument and will inherit its
IR generation properties in exactly the same way that a discrete
instruction would from the same builder object.

The emit_typed_write() function from my image-load-store branch is an
example that illustrates the usefulness of the latter point: Due to
hardware limitations the function may have to split the untyped
surface message in 8-wide chunks.  That means that the several
functions called to help with the construction of the message payload
are themselves required to set the execution width and half control
correctly on the instructions they emit, and to allocate all registers
with half the default width.  With the previous approach this would
require the used helper functions to be aware of the parameters that
might differ from the default state and explicitly set the instruction
bits accordingly.  With the new approach they would get a modified
builder object as argument that would influence all instructions
emitted by the helper function as if it were the default state.

Another example is the fs_visitor::VARYING_PULL_CONSTANT_LOAD()
method.  It doesn't actually emit any instructions, they are simply
created and inserted into an exec_list which is returned for the
caller to emit at some location of the program.  This sort of two-step
emission becomes unnecessary with the builder interface because the
insertion point is one more of the code generation parameters which
are part of the builder object.  The caller can simply pass
VARYING_PULL_CONSTANT_LOAD() a modified builder object pointing at the
location of the program where the effect of the constant load is
desired.  This two-step emission (which pervades the compiler back-end
and is in most cases redundant) goes away: E.g. ADD() now actually
adds two registers rather than just creating an ADD instruction in
memory, emit(ADD()) is no longer necessary.

v2: Drop scalarizing VEC4 builder.
v3: Take a backend_shader as constructor argument.  Improve handling
    of debug annotations and execution control flags.
v4: Drop Gen6 IF with inline comparison.  Rename "instr" variable.
    Initialize cursor to NULL by default and add method to explicitly
    point the builder at the end of the program.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Define consistent interface to enable instruction result saturation.
Francisco Jerez [Wed, 3 Jun 2015 18:24:50 +0000 (21:24 +0300)]
i965: Define consistent interface to enable instruction result saturation.

v2: Use set_ prefix.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Define consistent interface to enable instruction conditional modifiers.
Francisco Jerez [Wed, 3 Jun 2015 18:24:18 +0000 (21:24 +0300)]
i965: Define consistent interface to enable instruction conditional modifiers.

v2: Use set_ prefix.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Define consistent interface to predicate an instruction.
Francisco Jerez [Wed, 3 Jun 2015 18:23:46 +0000 (21:23 +0300)]
i965: Define consistent interface to predicate an instruction.

v2: Use set_ prefix.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: Drop include of simple_list.h from mtypes.h.
Francisco Jerez [Mon, 8 Jun 2015 11:49:31 +0000 (14:49 +0300)]
mesa: Drop include of simple_list.h from mtypes.h.

simple_list.h defines a number of macros with short non-namespaced
names that can easily collide with other declarations (first_elem,
last_elem, next_elem, prev_elem, at_end), and according to the comment
it was only being included because of struct simple_node, which is no
longer used in this file.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agodri/nouveau: Include simple_list.h explicitly in nv*_state_tnl.c.
Francisco Jerez [Mon, 8 Jun 2015 11:48:29 +0000 (14:48 +0300)]
dri/nouveau: Include simple_list.h explicitly in nv*_state_tnl.c.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agotnl: Include simple_list.h explicitly in t_context.c.
Francisco Jerez [Mon, 8 Jun 2015 11:47:17 +0000 (14:47 +0300)]
tnl: Include simple_list.h explicitly in t_context.c.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa: Include simple_list.h explicitly in errors.c.
Francisco Jerez [Mon, 8 Jun 2015 11:46:58 +0000 (14:46 +0300)]
mesa: Include simple_list.h explicitly in errors.c.

This seems to be the only user of simple_list in core mesa not
including the header explicitly.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa/teximage: use correct extension for accept stencil texture.
Dave Airlie [Sun, 5 Apr 2015 06:48:47 +0000 (16:48 +1000)]
mesa/teximage: use correct extension for accept stencil texture.

This was using the wrong extension, ARB_stencil_texturing
doesn't mention any changes in this area.

Fixes "dEQP-GLES3.functional.fbo.completeness.renderable.texture.
stencil.stencil_index8."

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90751
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Make a helper function intel_miptree_set_total_width_height()
Anuj Phogat [Wed, 15 Apr 2015 05:06:47 +0000 (22:06 -0700)]
i965: Make a helper function intel_miptree_set_total_width_height()

and some more code refactoring. No functional changes in this patch.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965/gen9: Set vertical alignment for the miptree
Anuj Phogat [Wed, 15 Apr 2015 05:06:48 +0000 (22:06 -0700)]
i965/gen9: Set vertical alignment for the miptree

v3: Use ffs() and a switch loop in
    tr_mode_horizontal_texture_alignment() (Ben)

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965/gen9: Set horizontal alignment for the miptree
Anuj Phogat [Wed, 15 Apr 2015 05:06:48 +0000 (22:06 -0700)]
i965/gen9: Set horizontal alignment for the miptree

v3: Use ffs() and a switch loop in
    tr_mode_vertical_texture_alignment() (Ben)

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965/gen9: Set tiled resource mode for the miptree
Anuj Phogat [Wed, 15 Apr 2015 05:06:47 +0000 (22:06 -0700)]
i965/gen9: Set tiled resource mode for the miptree

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Pass miptree pointer as function parameter in intel_vertical_texture_alignment_unit
Anuj Phogat [Wed, 15 Apr 2015 05:06:47 +0000 (22:06 -0700)]
i965: Pass miptree pointer as function parameter in intel_vertical_texture_alignment_unit

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Move intel_miptree_choose_tiling() to brw_tex_layout.c
Anuj Phogat [Wed, 15 Apr 2015 05:06:47 +0000 (22:06 -0700)]
i965: Move intel_miptree_choose_tiling() to brw_tex_layout.c

and change the name to brw_miptree_choose_tiling().

V3: Remove redundant function parameters. (Topi)

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Choose tiling in brw_miptree_layout() function
Anuj Phogat [Wed, 15 Apr 2015 05:06:47 +0000 (22:06 -0700)]
i965: Choose tiling in brw_miptree_layout() function

This refactoring is required by later patches in this series.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
9 years agoi965: Disallow saturation for MACH operations.
Ben Widawsky [Tue, 23 Dec 2014 03:29:24 +0000 (19:29 -0800)]
i965: Disallow saturation for MACH operations.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965: Export format comparison for blitting between miptrees
Chris Wilson [Fri, 5 Jun 2015 13:45:18 +0000 (14:45 +0100)]
i965: Export format comparison for blitting between miptrees

Since the introduction of

commit 536003c11e4cb1172c540932ce3cce06f03bf44e
Author: Boyan Ding <boyan.j.ding@gmail.com>
Date:   Wed Mar 25 19:36:54 2015 +0800

    i965: Add XRGB8888 format to intel_screen_make_configs

winsys buffers no longer have an alpha channel. This causes
_mesa_format_matches_format_and_type() to reject previously working BGRA
uploads from using the BLT fast path. Instead of using the generic
routine for matching formats exactly, export the slightly more relaxed
check from intel_miptree_blit() which importantly allows the blitter
routine to apply a small number of format conversions.

References: https://bugs.freedesktop.org/show_bug.cgi?id=90839
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Alexander Monakov <amonakov@gmail.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
9 years agoi915: Blit RGBX<->RGBA drawpixels
Chris Wilson [Fri, 5 Jun 2015 13:33:36 +0000 (14:33 +0100)]
i915: Blit RGBX<->RGBA drawpixels

The blitter already has code to accommodate filling in the alpha channel
for BGRX destination formats, so expand this to also allow filling the
alpha channgel in RGBX formats.

More importantly for the next patch is moving the test into its own
function for the purpose of exporting the check to the callers.

v2: Fix alpha expansion as spotted by Alexander with the fix suggested by
Kenneth

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jason Ekstrand <jason@jlekstrand.net>
Cc: Alexander Monakov <amonakov@gmail.com>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
9 years agoi965: Fix HW blitter pitch limits
Chris Wilson [Fri, 5 Jun 2015 12:49:08 +0000 (13:49 +0100)]
i965: Fix HW blitter pitch limits

The BLT pitch is specified in bytes for linear surfaces and in dwords
for tiled surfaces. In both cases the programmable limit is 32,767, so
adjust the check to compensate for the effect of tiling.

v2: Tweak whitespace for functions (Kenneth)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by Kenneth Graunke <kenneth@whitecape.org>
Cc: mesa-stable@lists.freedesktop.org
9 years agosoftpipe/query: force parenthesis around a logical not
Martin Peres [Fri, 5 Jun 2015 12:19:01 +0000 (15:19 +0300)]
softpipe/query: force parenthesis around a logical not

This makes GCC5 happy.

Reviewed-by: Brian Paul <brianp@vmware.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomain/version: make sure all the output variables get set in get_gl_override
Martin Peres [Fri, 5 Jun 2015 12:03:19 +0000 (15:03 +0300)]
main/version: make sure all the output variables get set in get_gl_override

This fixes 2 warnings in gcc 5.1.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agoradeonsi: Add CIK SDMA support
Michel Dänzer [Tue, 26 May 2015 07:27:15 +0000 (16:27 +0900)]
radeonsi: Add CIK SDMA support

Based on the corresponding SI support. Same as that, this is currently
only enabled for one-dimensional buffer copies due to issues with
multi-dimensional SDMA copies.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agor600g,radeonsi: Assert that there's enough space after flushing
Michel Dänzer [Wed, 19 Nov 2014 06:31:24 +0000 (15:31 +0900)]
r600g,radeonsi: Assert that there's enough space after flushing

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agodocs: add news item and link release notes for mesa 10.5.7
Emil Velikov [Sun, 7 Jun 2015 12:44:37 +0000 (13:44 +0100)]
docs: add news item and link release notes for mesa 10.5.7

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agodocs: Add sha256sums for the 10.5.7 release
Emil Velikov [Sun, 7 Jun 2015 10:45:25 +0000 (11:45 +0100)]
docs: Add sha256sums for the 10.5.7 release

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

9 years agoAdd release notes for the 10.5.7 release
Emil Velikov [Sun, 7 Jun 2015 10:13:19 +0000 (11:13 +0100)]
Add release notes for the 10.5.7 release

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

9 years agoprog_to_nir: Fix fragment depth writes.
Kenneth Graunke [Fri, 5 Jun 2015 00:00:17 +0000 (17:00 -0700)]
prog_to_nir: Fix fragment depth writes.

In the ARB_fragment_program specification, the result.depth output
variable is treated as a vec4, where the fragment depth is stored in the
.z component, and the other three components are undefined.

This is different than GLSL, which uses a scalar value (gl_FragDepth).

To make this consistent for driver backends, this patch makes
prog_to_nir use a scalar output variable for FRAG_RESULT_DEPTH,
moving result.depth.z into the first component.

Fixes Glean's fragProg1 "Z-write test" subtest.

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90000
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Set max texture buffer size to hardware limit
Chris Forbes [Wed, 3 Jun 2015 00:11:27 +0000 (12:11 +1200)]
i965: Set max texture buffer size to hardware limit

Previously we were leaving this at the default of 64K, which meets the
spec but is too small for some real uses. The hardware can handle up to
128M.

User was complaining about this on freenode ##OpenGL today.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Add gen8 fast clear perf debug
Ben Widawsky [Fri, 5 Jun 2015 06:59:23 +0000 (23:59 -0700)]
i965: Add gen8 fast clear perf debug

In an ideal world I would just implement this instead of adding the perf debug.
There are some errata involved which lead me to believe it won't be so simple as
flipping a few bits.

There is room to add a thing for Gen9s flexibility, but since I am actively
working on that I have opted to ignore it.

Example:
Multi-LOD fast clear - giving up (256x128x8).

v2: Use braces for if statements because they are multiple lines (Ken)

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Add buffer sizes to perf debug of fast clears
Ben Widawsky [Fri, 5 Jun 2015 05:05:13 +0000 (22:05 -0700)]
i965: Add buffer sizes to perf debug of fast clears

When we cannot do the optimized fast clear it's important to know the buffer
size since a small buffer will have much less performance impact.

A follow-on patch could restrict printing the message to only certain sizes.

Example:
Failed to fast clear 1400x1056 depth because of scissors.  Possible 5% performance win if avoided.

Recommended-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoclover: clarify and fix the EGL interop error case
Marek Olšák [Tue, 12 May 2015 20:53:00 +0000 (22:53 +0200)]
clover: clarify and fix the EGL interop error case

Cc: 10.6 <mesa-stable@lists.freedesktop.org>
9 years agoegl: expose EGL 1.5 if all requirements are met
Marek Olšák [Mon, 11 May 2015 20:18:04 +0000 (22:18 +0200)]
egl: expose EGL 1.5 if all requirements are met

There's no driver support yet, because EGL_KHR_gl_colorspace isn't
implemented.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: return correct invalid-type error from eglCreateSync
Marek Olšák [Tue, 12 May 2015 19:41:32 +0000 (21:41 +0200)]
egl: return correct invalid-type error from eglCreateSync

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: add new platform functions (v2)
Marek Olšák [Tue, 12 May 2015 19:06:41 +0000 (21:06 +0200)]
egl: add new platform functions (v2)

These are just wrappers around the existing extension functions.

v2: return BAD_ALLOC if _eglConvertAttribsToInt fails

Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: add eglCreateImage (v2)
Marek Olšák [Tue, 12 May 2015 18:42:05 +0000 (20:42 +0200)]
egl: add eglCreateImage (v2)

v2: - use calloc
    - return BAD_ALLOC if calloc fails

Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: add eglGetSyncAttrib (v2)
Marek Olšák [Tue, 12 May 2015 16:14:31 +0000 (18:14 +0200)]
egl: add eglGetSyncAttrib (v2)

v2: - don't modify "value" in eglGetSyncAttribKHR after an error
    - rename _egl_api::GetSyncAttribKHR -> GetSyncAttrib
    - rename GetSyncAttribKHR_t -> GetSyncAttrib_t
    - rename _eglGetSyncAttribKHR to _eglGetSyncAttrib

Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: add eglWaitSync
Marek Olšák [Tue, 12 May 2015 16:13:31 +0000 (18:13 +0200)]
egl: add eglWaitSync

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: add EGL 1.5 functions that don't need any changes from extensions
Marek Olšák [Tue, 12 May 2015 18:54:22 +0000 (20:54 +0200)]
egl: add EGL 1.5 functions that don't need any changes from extensions

Declare the functions without the suffix, so that the core names are exported.

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: use EGL 1.5 types without suffixes
Marek Olšák [Tue, 12 May 2015 15:34:57 +0000 (17:34 +0200)]
egl: use EGL 1.5 types without suffixes

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: add context attribs from EGL 1.5
Marek Olšák [Mon, 11 May 2015 22:44:56 +0000 (00:44 +0200)]
egl: add context attribs from EGL 1.5

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: fix setting context flags
Marek Olšák [Mon, 11 May 2015 22:44:20 +0000 (00:44 +0200)]
egl: fix setting context flags

Cc: 10.6 10.5 10.4 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: combine VersionMajor and VersionMinor into one variable
Marek Olšák [Tue, 12 May 2015 14:40:29 +0000 (16:40 +0200)]
egl: combine VersionMajor and VersionMinor into one variable

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: set the EGL version in common code
Marek Olšák [Mon, 11 May 2015 20:16:52 +0000 (22:16 +0200)]
egl: set the EGL version in common code

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: remove unused _egl_global::ClientExtensions
Marek Olšák [Mon, 11 May 2015 19:38:55 +0000 (21:38 +0200)]
egl: remove unused _egl_global::ClientExtensions

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: import platform headers from registry (v2)
Marek Olšák [Fri, 15 May 2015 17:59:59 +0000 (19:59 +0200)]
egl: import platform headers from registry (v2)

v2: don't remove local Mesa changes

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: import eglext.h from registry and cleanup eglmesaext.h (v2)
Marek Olšák [Fri, 15 May 2015 17:58:51 +0000 (19:58 +0200)]
egl: import eglext.h from registry and cleanup eglmesaext.h (v2)

v2: include mesa and chromium extensions in eglext.h so as not to break
    existing users
v3: keep PFNEGLSWAPBUFFERSREGIONNOK because piglit uses it

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agoegl: import egl.h from registry (v2)
Marek Olšák [Fri, 15 May 2015 17:55:24 +0000 (19:55 +0200)]
egl: import egl.h from registry (v2)

v2: split the commit into 3 patches

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
9 years agomesa: remove unused gl_config::colorIndexMode
Marek Olšák [Thu, 28 May 2015 14:13:37 +0000 (16:13 +0200)]
mesa: remove unused gl_config::colorIndexMode

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa: use GL_GEOMETRY_PROGRAM_NV instead of MESA_GEOMETRY_PROGRAM
Marek Olšák [Thu, 28 May 2015 16:14:29 +0000 (18:14 +0200)]
mesa: use GL_GEOMETRY_PROGRAM_NV instead of MESA_GEOMETRY_PROGRAM

There's no reason to use our own definition.
Tessellation will use the NV definitions too.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa: use _mesa_has_geometry_shader in get_programiv
Marek Olšák [Thu, 28 May 2015 16:10:08 +0000 (18:10 +0200)]
mesa: use _mesa_has_geometry_shader in get_programiv

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa: remove useless gl_compute_program_state::Current
Marek Olšák [Thu, 28 May 2015 14:28:39 +0000 (16:28 +0200)]
mesa: remove useless gl_compute_program_state::Current

This is for user assembly shaders only (not GLSL). We won't support those.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa: remove unused geometry shader variables
Marek Olšák [Thu, 28 May 2015 14:09:23 +0000 (16:09 +0200)]
mesa: remove unused geometry shader variables

These states are for GS assembly shaders only. We don't support those.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agotgsi/ureg: fix a coverity defect in emit_decls
Marek Olšák [Tue, 26 May 2015 17:07:35 +0000 (19:07 +0200)]
tgsi/ureg: fix a coverity defect in emit_decls

Reported by Ilia Mirkin.

9 years agor600g: fix a coverity defect in streamout code
Marek Olšák [Tue, 26 May 2015 17:07:35 +0000 (19:07 +0200)]
r600g: fix a coverity defect in streamout code

Reported by Ilia Mirkin.

9 years agoglsl_to_tgsi: use TGSI array declarations for VS,GS arrays of outputs (v2)
Marek Olšák [Wed, 20 May 2015 09:43:55 +0000 (11:43 +0200)]
glsl_to_tgsi: use TGSI array declarations for VS,GS arrays of outputs (v2)

v2: don't use PIPE_MAX_SHADER_ARRAYS

9 years agoglsl_to_tgsi: use TGSI array declarations for GS,FS arrays of inputs (v2)
Marek Olšák [Sun, 10 May 2015 11:03:27 +0000 (13:03 +0200)]
glsl_to_tgsi: use TGSI array declarations for GS,FS arrays of inputs (v2)

v2: don't use PIPE_MAX_SHADER_ARRAYS

9 years agoglsl_to_tgsi: remove some emit functions by using C++ default values
Marek Olšák [Sat, 9 May 2015 21:54:35 +0000 (23:54 +0200)]
glsl_to_tgsi: remove some emit functions by using C++ default values

9 years agoglsl_to_tgsi: rename emit -> emit_asm
Marek Olšák [Sat, 9 May 2015 21:38:52 +0000 (23:38 +0200)]
glsl_to_tgsi: rename emit -> emit_asm

My editor thinks "emit" is a keyword, which breaks code indexing.

9 years agoglsl_to_tgsi: remove memset after calloc
Marek Olšák [Tue, 26 May 2015 13:18:27 +0000 (15:18 +0200)]
glsl_to_tgsi: remove memset after calloc

9 years agoglsl_to_tgsi: don't use a static array size for st_translate::arrays
Marek Olšák [Tue, 26 May 2015 13:09:20 +0000 (15:09 +0200)]
glsl_to_tgsi: don't use a static array size for st_translate::arrays

9 years agoglsl_to_tgsi: don't use a static array size for "array_sizes"
Marek Olšák [Tue, 26 May 2015 13:09:20 +0000 (15:09 +0200)]
glsl_to_tgsi: don't use a static array size for "array_sizes"

9 years agotgsi/ureg: don't emit in/out arrays if drivers don't support ranged declarations
Marek Olšák [Mon, 25 May 2015 17:30:44 +0000 (19:30 +0200)]
tgsi/ureg: don't emit in/out arrays if drivers don't support ranged declarations

Softpipe, llvmpipe, r300g, and radeonsi pass tests. Other drivers need testing.

Freedreno and nv30 are definitely broken. Other drivers seem to be alright.

9 years agotgsi/ureg: add support for output array declarations
Marek Olšák [Wed, 20 May 2015 09:11:43 +0000 (11:11 +0200)]
tgsi/ureg: add support for output array declarations

9 years agotgsi/ureg: add support for GS input array declarations
Marek Olšák [Sun, 10 May 2015 14:17:35 +0000 (16:17 +0200)]
tgsi/ureg: add support for GS input array declarations

9 years agotgsi/ureg: merge input and fs_input arrays
Marek Olšák [Sun, 10 May 2015 14:51:32 +0000 (16:51 +0200)]
tgsi/ureg: merge input and fs_input arrays

9 years agotgsi/ureg: rename and simplify ureg_DECL_gs_input
Marek Olšák [Sun, 10 May 2015 11:10:03 +0000 (13:10 +0200)]
tgsi/ureg: rename and simplify ureg_DECL_gs_input

There is nothing special about it and it's used for tessellation shaders
too.

9 years agotgsi/ureg: add support for FS input array declarations
Marek Olšák [Sun, 10 May 2015 10:52:02 +0000 (12:52 +0200)]
tgsi/ureg: add support for FS input array declarations

9 years agotgsi/scan: get more information about arrays and handle arrays correctly (v2)
Marek Olšák [Sun, 10 May 2015 15:41:26 +0000 (17:41 +0200)]
tgsi/scan: get more information about arrays and handle arrays correctly (v2)

v2: use less memory for the information

9 years agomesa: fix program resource queries for builtin variables
Tapani [Fri, 5 Jun 2015 05:22:07 +0000 (08:22 +0300)]
mesa: fix program resource queries for builtin variables

Patch fixes special cases with gl_VertexID and sets all builtin
variables locations as '-1' as specified by the extension spec.

Fixes ES 3.1 conformance test failure:
ES31-CTS.program_interface_query.input-built-in

v2: comments + use is_gl_identifier() (Martin)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
9 years agoglsl_compiler: Remove unused extra argument to printf in usage_fail
Alan Coopersmith [Sat, 23 May 2015 07:03:53 +0000 (00:03 -0700)]
glsl_compiler: Remove unused extra argument to printf in usage_fail

Flagged by Oracle's parfait static analyzer:

Error: Format string argument mismatch (CWE 628)
   In call to printf with format string "usage: %s [options] <file.vert | file.geom | file.frag>\n\nPossible options are:\n"
      Too many arguments for format string (got more than 1 arguments)
        at line 285 of src/glsl/main.cpp in function 'usage_fail'.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agodocs: add note about llvmpipe supporting GL_ARB_shader_stencil_export
Roland Scheidegger [Fri, 5 Jun 2015 00:25:03 +0000 (02:25 +0200)]
docs: add note about llvmpipe supporting GL_ARB_shader_stencil_export

9 years agodraw: (trivial) fix NULL pointer dereference
Roland Scheidegger [Thu, 4 Jun 2015 12:35:59 +0000 (14:35 +0200)]
draw: (trivial) fix NULL pointer dereference

This probably got broken when the samplers were converted to be indexed
by shader type.
Seen when looking at bug 89819 though I'm not sure if that really was what
the bug was about...

Cc: "10.5 10.6" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoi965/fs: Print mlen in dump_instructions() output.
Kenneth Graunke [Wed, 3 Jun 2015 03:40:54 +0000 (20:40 -0700)]
i965/fs: Print mlen in dump_instructions() output.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoprog_to_nir: Make RSQ properly take the absolute value of its argument.
Kenneth Graunke [Thu, 4 Jun 2015 08:24:07 +0000 (01:24 -0700)]
prog_to_nir: Make RSQ properly take the absolute value of its argument.

I just botched this when writing the original code.

From the ARB_vertex_program specification:
"The RSQ instruction approximates the reciprocal of the square root of
 the absolute value of the scalar operand and replicates it to all four
 components of the result vector."

Fixes a Glean vertProg1 subtest:
RSQ test 2 (reciprocal square root of negative value)

Cc: mesa-stable@lists.freedesktop.org
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90547
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
9 years agomain: fix a regression in uniform handling introduced by 87a4bc5
Martin Peres [Thu, 4 Jun 2015 11:09:31 +0000 (14:09 +0300)]
main: fix a regression in uniform handling introduced by 87a4bc5

The comment was accurate but the condition was reversed...

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agomesa: reference built-in uniforms into gl_uniform_storage
Martin Peres [Thu, 21 May 2015 12:51:09 +0000 (15:51 +0300)]
mesa: reference built-in uniforms into gl_uniform_storage

This change introduces a new field in gl_uniform_storage to
explicitely say that a uniform is built-in. In the case where it is,
no storage is defined to make it clear that it is read-only from the
mesa side. I fixed all the places in the code that made use of the
structure that I changed. Any place making a wrong assumption and using
the storage straight away will just crash.

This patch seems to implement the path of least resistance towards
listing built-in uniforms in GL_ACTIVE_UNIFORM (and other APIs).

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Martin Peres <martin.peres@linux.intel.com>
9 years agollvmpipe: Implement stencil export
Roland Scheidegger [Tue, 2 Jun 2015 23:34:06 +0000 (01:34 +0200)]
llvmpipe: Implement stencil export

Pretty trivial, fixes the issue that we're expected to be able to blit
stencil surfaces (as the blit just relies on util blitter code which needs
stencil export to do it).
2 piglits skip->pass, 11 fail->pass

v2: prettify, keep different stencil ref value handling out of depth/stencil
test itself.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
9 years agoi965: Use UW-typed immediate in multiply inst.
Matt Turner [Wed, 3 Jun 2015 00:46:38 +0000 (17:46 -0700)]
i965: Use UW-typed immediate in multiply inst.

Some hardware reads only the low 16-bits even if the type is UD, but
other hardware like Cherryview can't handle this.

Fixes spec@arb_gpu_shader5@execution@sampler_array_indexing@fs-simple on
Cherryview.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90830
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
9 years agoprogram: Replace gl_inst_opcode with enum prog_opcode.
Matt Turner [Mon, 1 Jun 2015 23:46:29 +0000 (16:46 -0700)]
program: Replace gl_inst_opcode with enum prog_opcode.

Both were introduced at the same time. I'm not sure why we needed two.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoprogram: Remove dead Aux field from prog_instruction.
Matt Turner [Mon, 1 Jun 2015 23:27:46 +0000 (16:27 -0700)]
program: Remove dead Aux field from prog_instruction.

Appears to have been last used by the i965 driver (removed by commit
098acf6c).

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoprogram: Shrink and rename SaturateMode field to Saturate.
Matt Turner [Mon, 1 Jun 2015 23:22:55 +0000 (16:22 -0700)]
program: Shrink and rename SaturateMode field to Saturate.

It was 2 bits to accommodate SATURATE_PLUS_MINUS_ONE (removed by commit
09b566e1). A similar change was made to TGSI recently in commit
e1c4e8aa.

Reducing the size from 2 bits to 1 reduces the size of the bit fields
from 17 bits to 16, which is a much nicer number.

Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agomesa: move no-change glDepthFunc check earlier
Brian Paul [Fri, 15 May 2015 18:12:04 +0000 (12:12 -0600)]
mesa: move no-change glDepthFunc check earlier

If the incoming func matches the current state it must be a legal
value so we can do this before the switch statement.

Signed-off-by: Brian Paul <brianp@vmware.com>
9 years agomesa: restore GL_EXT_depth_bounds_test state in glPopAttrib()
Brian Paul [Fri, 15 May 2015 18:09:54 +0000 (12:09 -0600)]
mesa: restore GL_EXT_depth_bounds_test state in glPopAttrib()

Spotted by inspection.  Untested (no piglit test).

Signed-off-by: Brian Paul <brianp@vmware.com>
9 years agomesa: fix glPushAttrib(0) / glPopAttrib() error
Brian Paul [Fri, 15 May 2015 17:22:25 +0000 (11:22 -0600)]
mesa: fix glPushAttrib(0) / glPopAttrib() error

If the glPushAttrib() mask value was zero we didn't actually push
anything onto the attribute stack.  A subsequent glPopAttrib() call
would generate a GL_STACK_UNDERFLOW error.  Now push a dummy attribute
in that case to prevent the error.

Mesa now matches nvidia's behavior.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agonir: use src for ssa helper
Timothy Arceri [Tue, 2 Jun 2015 09:26:42 +0000 (19:26 +1000)]
nir: use src for ssa helper

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agonir: remove extra semicolon
Timothy Arceri [Sun, 31 May 2015 22:00:14 +0000 (08:00 +1000)]
nir: remove extra semicolon

Reviewed-by: Thomas Helland <thomashelland90@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
9 years agoprog_to_nir: Remove OPCODE_MOV special case.
Matt Turner [Mon, 1 Jun 2015 19:22:54 +0000 (12:22 -0700)]
prog_to_nir: Remove OPCODE_MOV special case.

OPCODE_MOV is in the op_trans[] array.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoprog_to_nir: Remove from op_trans[] opcodes handled in the switch.
Matt Turner [Mon, 1 Jun 2015 19:19:30 +0000 (12:19 -0700)]
prog_to_nir: Remove from op_trans[] opcodes handled in the switch.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agonir: prevent use-after-free condition in should_lower_phi()
Eduardo Lima Mitev [Tue, 2 Jun 2015 11:42:46 +0000 (13:42 +0200)]
nir: prevent use-after-free condition in should_lower_phi()

lower_phis_to_scalar() pass recurses the instruction dependence graph to
determine if all the sources of a given instruction are scalarizable.
To prevent cycles, it temporary marks the phi instruction before recursing in,
then updates the entry with the resulting value. However, it does not consider
that the entry value may have changed after a recursion pass, hence causing
a use-after-free situation and a crash.

This patch fixes this by reloading the entry corresponding to the 'phi'
after recursing and before updating its value.

The crash can be reproduced ~20% of times with the dEQP test:

dEQP-GLES3.functional.shaders.loops.while_constant_iterations.nested_sequence_fragment

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agoi965: Add Gen8+ VS dispatch_mode assertion.
Kenneth Graunke [Sat, 30 May 2015 18:19:28 +0000 (11:19 -0700)]
i965: Add Gen8+ VS dispatch_mode assertion.

Suggested by Ben Widawsky.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965: Drop LOAD_PAYLOAD workaround in fs_visitor::emit_urb_writes().
Kenneth Graunke [Sat, 30 May 2015 06:02:56 +0000 (23:02 -0700)]
i965: Drop LOAD_PAYLOAD workaround in fs_visitor::emit_urb_writes().

Now that Jason's LOAD_PAYLOAD improvements have landed, we don't need
this.  Passing 1 for the number of header registers already takes care
of setting force_writemask_all on the header copy.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
9 years agoi965: Use proper pitch for scalar GS pull constants and UBOs.
Kenneth Graunke [Wed, 13 May 2015 21:45:45 +0000 (14:45 -0700)]
i965: Use proper pitch for scalar GS pull constants and UBOs.

See the corresponding code in brw_vs_surface_state.c.

v2: const more things (requested by Topi Pohjolainen)

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965: Create a shader_dispatch_mode enum to replace VS/GS fields.
Kenneth Graunke [Thu, 12 Mar 2015 04:18:42 +0000 (21:18 -0700)]
i965: Create a shader_dispatch_mode enum to replace VS/GS fields.

We used to store the GS dispatch mode in brw_gs_prog_data while
separately storing the VS dispatch mode in brw_vue_prog_data::simd8.

This patch introduces an enum to represent all possible dispatch modes,
and stores it in brw_vue_prog_data::dispatch_mode, unifying the two.

Based on a suggestion by Matt Turner.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965: Drop "Vector Mask Enable" bit from 3DSTATE_GS on Gen8+.
Kenneth Graunke [Mon, 11 May 2015 06:33:30 +0000 (23:33 -0700)]
i965: Drop "Vector Mask Enable" bit from 3DSTATE_GS on Gen8+.

The documentation makes it pretty clear that we shouldn't use this:

   "Under normal conditions SW shall specify DMask, as the GS stage
    will provide a Dispatch Mask appropriate to SIMD4x2 or SIMD8 thread
    execution (as a function of dispatch mode).  E.g., for SIMD4x2
    execution, the GS stage will generate a Dispatch Mask that is equal
    to what the EU would use as the Vector Mask.  For SIMD8 execution
    there is no known usage model for use of Vector Mask (as there is
    for PS shaders)."

I also managed to find descriptions of DMask and VMask, in the "State
Register" (sr0.2/3) field descriptions:

   "Dispatch Mask (DMask).  This 32-bit field specifies which channels
    are active at Dispatch time."

   "Vector Mask (VMask).  This 32-bit field contains, for each 4-bit
    group, the OR of the corresponding 4-bit group in the dispatch
    mask."

SIMD4x2 shaders process one or two vec4 values, with each 4-bit group
corresponding to xyzw channel enables (either all on, or all off).
Thus, DMask = VMask in SIMD4x2 mode.  But in SIMD8 mode, 4-bit groups
are meaningless, so it just messes up your values.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agodocs: update GL_ARB_copy_image, GL_ARB_clear_texture gallium status
Brian Paul [Mon, 1 Jun 2015 13:40:34 +0000 (07:40 -0600)]
docs: update GL_ARB_copy_image, GL_ARB_clear_texture gallium status

VMware is working on these.

Signed-off-by: Brian Paul <brianp@vmware.com>
9 years agogallium/util: silence silence unused var warnings for non-debug build
Brian Paul [Fri, 29 May 2015 22:02:44 +0000 (16:02 -0600)]
gallium/util: silence silence unused var warnings for non-debug build

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoegl/dri2: silence uninitialized variable warnings
Brian Paul [Fri, 29 May 2015 22:01:37 +0000 (16:01 -0600)]
egl/dri2: silence uninitialized variable warnings

And update assertions to be more informative.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agogallivm: silence unused var warnings for non-debug build
Brian Paul [Fri, 29 May 2015 22:00:52 +0000 (16:00 -0600)]
gallivm: silence unused var warnings for non-debug build

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agopipebuffer: silence unused var warnings for non-debug build
Brian Paul [Fri, 29 May 2015 22:00:14 +0000 (16:00 -0600)]
pipebuffer: silence unused var warnings for non-debug build

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>