mesa.git
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>
9 years agost/mesa: silence unused var warnings for non-debug build
Brian Paul [Fri, 29 May 2015 21:59:50 +0000 (15:59 -0600)]
st/mesa: silence unused var warnings for non-debug build

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agodraw: silence unused var warnings for non-debug build
Brian Paul [Fri, 29 May 2015 21:59:27 +0000 (15:59 -0600)]
draw: silence unused var warnings for non-debug build

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agogallivm: Remove stub disassemblerSymbolLookupCB.
Jose Fonseca [Fri, 29 May 2015 13:33:18 +0000 (14:33 +0100)]
gallivm: Remove stub disassemblerSymbolLookupCB.

It's incompletete -- it wasn't filling ReferenceType so it was causing
garbagge on the disassembly.  Furthermore it seems impossible to get the
jump information through this interface.

The solution for function size problem is to effectively book-keep the
machine code start and end address while JIT'ing.

9 years agoi965: Don't add base_binding_table_index if it's zero
Neil Roberts [Fri, 29 May 2015 12:41:48 +0000 (13:41 +0100)]
i965: Don't add base_binding_table_index if it's zero

When calculating the binding table index for non-constant sampler
array indexing it needs to add the base binding table index which is a
constant within the generated code. Often this base is zero so we can
avoid a redundant instruction in that case.

It looks like nothing in shader-db is doing non-constant sampler array
indexing so this patch doesn't make any difference but it might be
worth having anyway.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965: Don't use a temporary when generating an indirect sample
Neil Roberts [Thu, 28 May 2015 14:27:31 +0000 (15:27 +0100)]
i965: Don't use a temporary when generating an indirect sample

Previously when generating the send instruction for a sample
instruction with an indirect sampler it would use the destination
register as a temporary store. This breaks when used in combination
with the opt_sampler_eot optimisation because that forces the
destination to be null. This patch fixes that by avoiding the temp
register altogether.

The reason the temporary register was needed was because it was trying
to ensure the binding table index doesn't overflow a byte by and'ing
it with 0xff. The result is then or'd with samper_index<<8. This patch
instead just and's the whole thing by 0xfff. This will ensure that a
bogus sampler index won't overflow into the rest of the message
descriptor but unlike the previous code it won't ensure that the
binding table index doesn't overflow into the sampler index. It
doesn't seem like that should matter very much though because if the
shader is generating a bogus sampler index then it's going to just get
garbage out either way.

Instead of doing sampler_index<<8|(sampler_index+base_table_index) the
new code avoids one operation by doing
sampler_index*0x101+base_table_index which should be equivalent.
However if we wanted to avoid the multiply for some reason we could do
this by adding an extra or instruction still without needing the
temporary register.

This fixes a number of Piglit tests on Skylake that were using
indirect samplers such as:

 spec@arb_gpu_shader5@execution@sampler_array_indexing@fs-simple

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
Acked-by: Ben Widawsky <ben@bwidawsk.net>
Tested-by: Anuj Phogat <anuj.phogat@gmail.com>
9 years agovc4: Don't bother with safe list traversal in CSE.
Eric Anholt [Sat, 30 May 2015 04:27:53 +0000 (21:27 -0700)]
vc4: Don't bother with safe list traversal in CSE.

We don't remove or move instructions.

9 years agovc4: Convert from simple_list.h to list.h
Eric Anholt [Sat, 30 May 2015 01:19:42 +0000 (18:19 -0700)]
vc4: Convert from simple_list.h to list.h

list.h is a nicer and more familiar set of list functions/macros.

9 years agovc4: Make sure we allocate idle BOs from the cache.
Eric Anholt [Sat, 30 May 2015 01:06:32 +0000 (18:06 -0700)]
vc4: Make sure we allocate idle BOs from the cache.

We were returning the most recently freed BO, without checking if it
was idle yet.  This meant that we generally stalled immediately on the
previous frame when generating a new one.  Instead, allocate new BOs
when the *oldest* BO is still busy, so that the cache scales with how
much is needed to keep some frames outstanding, as originally
intended.

Note that if you don't have some throttling happening, this means that
you can accidentally run the system out of memory.  The kernel is now
applying some throttling on all execs, to hopefully avoid this.

9 years agovc4: Fix return value handling for BO waits.
Eric Anholt [Sat, 30 May 2015 00:21:15 +0000 (17:21 -0700)]
vc4: Fix return value handling for BO waits.

If the wait ever returned -ETIME, we'd abort because the errno was
stored in errno and not drmIoctl()'s return value.

9 years agomesa: remove unused function declaration
Timothy Arceri [Fri, 29 May 2015 11:47:53 +0000 (21:47 +1000)]
mesa: remove unused function declaration

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agodri_util: make version var unsigned to silence warnings
Brian Paul [Fri, 29 May 2015 17:28:58 +0000 (11:28 -0600)]
dri_util: make version var unsigned to silence warnings

_mesa_override_gl_version_contextless() takes an unsigned version
parameter.

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Disable compaction for EOT send messages
Ben Widawsky [Thu, 28 May 2015 00:55:02 +0000 (17:55 -0700)]
i965: Disable compaction for EOT send messages

AFAICT, there is no real way to make sure a send message with EOT is properly
ignored from compact, nor can I see a way to actually encode EOT while
compacting. Before the single send optimization we'd always bail because we hit
the is_immediate && !is_compactable_immediate case. However, with single send,
is_immediate is not true, and so we end up trying to compact the un-compactible.

Without this, any compacting single send instruction will hang because the EOT
isn't there. I am not sure how I didn't hit this when I originally enabled the
optimization.  I didn't check if some surrounding code changed.

I know Neil and Matt were both looking into this. I did a quick search and
didn't see any patches out there to handle this. Please ignore if this has
already been sent by someone. (Direct me to it and I will review it).

Reported-by: Neil Roberts <neil@linux.intel.com>
Reported-by: Mark Janes <mark.a.janes@intel.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agogallivm: make sampling more robust when the sampler setup is bogus
Roland Scheidegger [Fri, 29 May 2015 16:17:24 +0000 (18:17 +0200)]
gallivm: make sampling more robust when the sampler setup is bogus

Pure integer formats cannot be sampled with linear tex / mip filters. In GL
such a setup would make the texture incomplete.
We shouldn't rely on the state tracker though to filter that out, just return
all zeros instead of dying in the lerp.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
9 years agoconfigure.ac: Link mcdisassembler component.
Jose Fonseca [Fri, 29 May 2015 11:13:36 +0000 (12:13 +0100)]
configure.ac: Link mcdisassembler component.

gallivm now depends on it. And depending on particular LLVM version /
configure options, the build can fail without this change due to
undefined reference to `LLVM*Disasm*' symbols.

Trivial.

9 years agoconfigure.ac: Don't bother checking whether LLVM's MCJIT component is available.
Jose Fonseca [Fri, 29 May 2015 10:58:58 +0000 (11:58 +0100)]
configure.ac: Don't bother checking whether LLVM's MCJIT component is available.

Now that we require LLVM 3.3, MCJIT is guaranteed to be available.

Trvial.

9 years agogallivm: Use the LLVM's C disassembly interface.
Jose Fonseca [Thu, 28 May 2015 15:55:10 +0000 (16:55 +0100)]
gallivm: Use the LLVM's C disassembly interface.

It doesn't do everything we want.  In particular it doesn't allow to
detect jumps or return opcodes.  Currently we detect the x86's RET
opcode.

Even though it's worse for LLVM 3.3, it's an improvement for LLVM 3.7,
which was totally busted.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agogallivm: Disable frame pointer omission on LLVM 3.7.
Jose Fonseca [Thu, 28 May 2015 14:35:14 +0000 (15:35 +0100)]
gallivm: Disable frame pointer omission on LLVM 3.7.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agoconfigure.ac: enable building GLES1 and GLES2 by default
Marek Olšák [Tue, 26 May 2015 10:47:03 +0000 (12:47 +0200)]
configure.ac: enable building GLES1 and GLES2 by default

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agost/dri: fix postprocessing crash when there's no depth buffer
Marek Olšák [Tue, 26 May 2015 17:32:36 +0000 (19:32 +0200)]
st/dri: fix postprocessing crash when there's no depth buffer

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

Cc: 10.6 10.5 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoradeon/llvm: reset temps_count on deallocation
Marek Olšák [Tue, 26 May 2015 22:15:16 +0000 (00:15 +0200)]
radeon/llvm: reset temps_count on deallocation

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeon/llvm: don't use a static array size for radeon_llvm_context::arrays (v2)
Marek Olšák [Tue, 26 May 2015 13:35:10 +0000 (15:35 +0200)]
radeon/llvm: don't use a static array size for radeon_llvm_context::arrays (v2)

v2: - don't use realloc (tgsi_shader_info provides the size)

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agosoftpipe: fix offset wrapping calculations (v2)
Dave Airlie [Wed, 27 May 2015 01:11:06 +0000 (11:11 +1000)]
softpipe: fix offset wrapping calculations (v2)

Roland pointed out my previous attempt was lacking, so I enhanced the
texwrap piglit test, and tested them. This fixes the offset calculations
in a number of areas by adding the offset first, it also fixes the fastpaths,
which I forgot to address in the previous commit.

v2: try and avoid divides in most paths, the repeat mirror path
really was ugly no matter which way I went, so I left it having
the divide.
Also fix the gather lod calculation bug.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi965/vs: Rework the logic for generating NIR from ARB vertex programs
Jason Ekstrand [Wed, 20 May 2015 19:03:33 +0000 (12:03 -0700)]
i965/vs: Rework the logic for generating NIR from ARB vertex programs

Whether or not to use NIR is now equivalent to brw->scalar_vs.  We can
simplify the logic and make it far less confusing.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Remove the ir_visitor code
Jason Ekstrand [Wed, 20 May 2015 17:35:34 +0000 (10:35 -0700)]
i965/fs: Remove the ir_visitor code

Now that everything is running through NIR, this is all dead.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Remove the old fragment program code
Jason Ekstrand [Wed, 20 May 2015 17:39:03 +0000 (10:39 -0700)]
i965: Remove the old fragment program code

Now that everything is running through NIR, this is all dead.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Make NIR non-optional for scalar shaders
Jason Ekstrand [Wed, 20 May 2015 17:03:50 +0000 (10:03 -0700)]
i965: Make NIR non-optional for scalar shaders

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Make fs/vec4_visitor inherit from ir_visitor directly
Jason Ekstrand [Wed, 20 May 2015 16:45:47 +0000 (09:45 -0700)]
i965: Make fs/vec4_visitor inherit from ir_visitor directly

This is using multiple inheritance in C++.  However, ir_visitor is really
just an interface with no data so it shouldn't be so bad.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Rename backend_visitor to backend_shader
Jason Ekstrand [Wed, 20 May 2015 16:44:01 +0000 (09:44 -0700)]
i965: Rename backend_visitor to backend_shader

The backend_shader class really is a representation of a shader.  The fact
that it inherits from ir_visitor is somewhat immaterial.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: Enable ARB_direct_state_access by default for core profile
Ian Romanick [Mon, 18 May 2015 20:56:45 +0000 (13:56 -0700)]
mesa: Enable ARB_direct_state_access by default for core profile

And core profile only.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agodispatch_sanity: Validate the compatibility profile dispatch table too
Ian Romanick [Thu, 21 May 2015 03:19:07 +0000 (20:19 -0700)]
dispatch_sanity: Validate the compatibility profile dispatch table too

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Suggested-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agodispatch_sanity: Split list of GL 3.1 functions in to core and common
Ian Romanick [Thu, 21 May 2015 03:17:19 +0000 (20:17 -0700)]
dispatch_sanity: Split list of GL 3.1 functions in to core and common

The next patch will add a test for compatibility profile dispatch, and
it seems to make more sense to share the lists.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agomesa: Don't install glVertexAttribL* functions in compatibility profile
Ian Romanick [Thu, 21 May 2015 03:13:12 +0000 (20:13 -0700)]
mesa: Don't install glVertexAttribL* functions in compatibility profile

GL_ARB_vertex_attrib_64bit is exclusive to core profile, and none of the
other functions added by the extension are advertised in other profiles.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoglapi: Make GL_ARB_direct_state_access functions exclusive to core profile
Ian Romanick [Tue, 19 May 2015 18:48:11 +0000 (11:48 -0700)]
glapi: Make GL_ARB_direct_state_access functions exclusive to core profile

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Dylan Baker <baker.dylan.c@gmail.com>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoglapi: Store exec table version info outside the XML
Ian Romanick [Tue, 19 May 2015 18:24:26 +0000 (11:24 -0700)]
glapi: Store exec table version info outside the XML

Currently on the functions that are exclusive to core-profile are
implemented.  The remainder continue to live in the XML.  Additional
functions can be moved later.

The functions for GL_ARB_draw_indirect and GL_ARB_multi_draw_indirect
are put in the dispatch table inside the VBO module, so they do not need
to be moved over.

The diff of src/mesa/main/api_exec.c before and after this patch is as
expected.  All of the functions listed in apiexec.py moved out of a 'if
(_mesa_is_desktop(ctx))' block into a new 'if (ctx->API ==
API_OPENGL_CORE)' block.

v2: Remove stray shebang line in apiexec.py.  Suggested by Ilia.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Dylan Baker <baker.dylan.c@gmail.com>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoRevert "mesa: Add an extension flag for ARB_direct_state_access"
Ian Romanick [Mon, 18 May 2015 20:55:04 +0000 (13:55 -0700)]
Revert "mesa: Add an extension flag for ARB_direct_state_access"

This reverts commit 30dcaaec356cc117d7227c6680620cd50ff534e7.

Acked-by: Fredrik Höglund <fredrik@kde.org>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agomesa: Use the profile instead of an extension bit to validate GL_TEXTURE_CUBE_MAP
Ian Romanick [Thu, 21 May 2015 00:19:29 +0000 (17:19 -0700)]
mesa: Use the profile instead of an extension bit to validate GL_TEXTURE_CUBE_MAP

The extension on which this depends will always be enabled in core
profile, and the extension bit is about to be removed.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoRevert "mesa: Add ARB_direct_state_access checks in XFB functions"
Ian Romanick [Mon, 18 May 2015 20:54:55 +0000 (13:54 -0700)]
Revert "mesa: Add ARB_direct_state_access checks in XFB functions"

This reverts commit 7d212765a470972f4712e42caf6406b257220369.

Acked-by: Fredrik Höglund <fredrik@kde.org>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoRevert "mesa: Add ARB_direct_state_access checks in buffer object functions"
Ian Romanick [Mon, 18 May 2015 20:54:39 +0000 (13:54 -0700)]
Revert "mesa: Add ARB_direct_state_access checks in buffer object functions"

This reverts commit 339ed0984d4f54fca91235a1df2ce3a850f6123f.

Acked-by: Fredrik Höglund <fredrik@kde.org>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoRevert "mesa: Add ARB_direct_state_access checks in FBO functions"
Ian Romanick [Mon, 18 May 2015 20:54:35 +0000 (13:54 -0700)]
Revert "mesa: Add ARB_direct_state_access checks in FBO functions"

This reverts commit 6ad0b7e07a0445e9e0f368e079c4f7b8a6757bb3.

Acked-by: Fredrik Höglund <fredrik@kde.org>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoRevert "mesa: Add ARB_direct_state_access checks in renderbuffer functions"
Ian Romanick [Mon, 18 May 2015 20:54:29 +0000 (13:54 -0700)]
Revert "mesa: Add ARB_direct_state_access checks in renderbuffer functions"

This reverts commit cb49940766b581c6656473d89c221653c69fa0f9.

Acked-by: Fredrik Höglund <fredrik@kde.org>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoRevert "mesa: Add ARB_direct_state_access checks in texture functions"
Ian Romanick [Mon, 18 May 2015 20:54:25 +0000 (13:54 -0700)]
Revert "mesa: Add ARB_direct_state_access checks in texture functions"

This reverts commit 8940957238e8584ce27295791cee4cc3d6f7cf1e.

Acked-by: Fredrik Höglund <fredrik@kde.org>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoRevert "mesa: Add ARB_direct_state_access checks in VAO functions"
Ian Romanick [Mon, 18 May 2015 20:54:21 +0000 (13:54 -0700)]
Revert "mesa: Add ARB_direct_state_access checks in VAO functions"

This reverts commit 36b05793372b86b914d9b95d0188f5f387e01d68.

Acked-by: Fredrik Höglund <fredrik@kde.org>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>
9 years agoRevert "mesa: Add ARB_direct_state_access checks in sampler object functions"
Ian Romanick [Mon, 18 May 2015 20:54:18 +0000 (13:54 -0700)]
Revert "mesa: Add ARB_direct_state_access checks in sampler object functions"

This reverts commit 9e7149c8986348bf9567f049444783ef52775f4e.

Acked-by: Fredrik Höglund <fredrik@kde.org>
Cc: "10.6" <mesa-stable@lists.freedesktop.org>