platform/upstream/mesa.git
9 years agoautomake: Use AM_DISTCHECK_CONFIGURE_FLAGS
Emil Velikov [Thu, 12 Feb 2015 15:27:28 +0000 (15:27 +0000)]
automake: Use AM_DISTCHECK_CONFIGURE_FLAGS

Currently we use DISTCHECK_CONFIGURE_FLAGS, which is reserved for
the user. As with other variables, one should use the AM_ variable
within the makefile.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglx: do not leak the dri2 extension information
Emil Velikov [Thu, 22 Jan 2015 17:35:40 +0000 (17:35 +0000)]
glx: do not leak the dri2 extension information

The XExtensionInfo is allocated dynamically (if the pointer is NULL)
in the XEXT_GENERATE_FIND_DISPLAY macro. On the other hand the
macro XEXT_GENERATE_CLOSE_DISPLAY does not check/free the memory.

Follow the example set by dri1 and appledri, and use a static variable.

Spotted while hunting "still reachable" leaks in Waffle.

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
9 years agoRevert "radeon/llvm: enable unsafe math for graphics shaders"
Michel Dänzer [Tue, 17 Feb 2015 08:03:35 +0000 (17:03 +0900)]
Revert "radeon/llvm: enable unsafe math for graphics shaders"

This reverts commit 0e9cdedd2e3943bdb7f3543a3508b883b167e427.

It caused the grass to disappear in The Talos Principle.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89069
Cc: "10.5 10.4" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agost/mesa: add ARB_pipeline_statistics_query support
Ilia Mirkin [Wed, 11 Feb 2015 05:36:47 +0000 (00:36 -0500)]
st/mesa: add ARB_pipeline_statistics_query support

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agoi965: implement ARB_pipeline_statistics_query
Ben Widawsky [Wed, 3 Dec 2014 02:33:12 +0000 (18:33 -0800)]
i965: implement ARB_pipeline_statistics_query

NOTE: The implementation was initially one patch, this. All the history is kept
here, even though all the core mesa changes were moved to the parent of this
patch.

This patch implements ARB_pipeline_statistics_query. This addition to GL does
not add a new API. Instead, it adds new tokens to the existing query APIs. The
work to hook up the new tokens is trivial due to it's similarity to the previous
work done for the query APIs. I've implemented all the new tokens to some
degree, but have stubbed out the untested ones at the entry point for Begin().
Doing this should allow the remainder of the code to be left in.

The new tokens give GL clients a way to obtain stats about the GL pipeline.
Generally, you get the number of things going in, invocations, and number of
things coming out, primitives, of the various stages. There are two immediate
uses for this, performance information, and debugging various types of
misrendering. I doubt one can use these for debugging very complex applications,
but for piglit tests, it should be quite useful.

Tessellation shaders, and compute shaders are not addressed in this patch
because there is no upstream implementation. I've implemented how I believe
tessellation shader stats will work for Intel hardware (though there is a bit of
ambiguity). Compute shaders are a bit more interesting though, and I don't yet
know what we'll do there.

For the lazy, here is a link to the relevant part of the spec:
https://www.opengl.org/registry/specs/ARB/pipeline_statistics_query.txt

Running the piglit tests
http://lists.freedesktop.org/archives/piglit/2014-November/013321.html
(http://cgit.freedesktop.org/~bwidawsk/piglit/log/?h=pipe_stats)
yield the following results:

> piglit-run.py -t stats tests/all.py output/pipeline_stats
> [5/5] pass: 5 Running Test(s): 5

v2:
- Don't allow pipeline_stats to be per stream (Ilia). This may (not sure) be
  needed for AMD_transform_feedback4, which we do not support.
   > If AMD_transform_feedback4 is supported then GEOMETRY_SHADER_PRIMITIVES_-
   > EMITTED_ARB counts primitives emitted to any of the vertex streams for
   > which STREAM_RASTERIZATION_AMD is enabled.
- Remove comment from GL3.txt because it is only used for extensions that are
  part of required versions (Ilia)
- Move the new tokens to a new XML doc instead of using the main GL4x.xml (Ilia)
- Add a fallthrough comment (Ilia)
- Only divide PS invocations by 4 on HSW+ (Ben)

v3:
- Add ARB_pipeline_statistics_query to relnotes.html
- Add ARB_pipeline_statistics_query.xml to the Makefile.am, and master XML (Ilia)
- Correct extension number (Ilia)
- Add link to xml in the main GL API xml (Ilia)
- remove special GS case from gen6_end_query (Ian)
- Make lookup table static so gcc doesn't initialized it on every call (Ian)
- Use if (_mesa_has_geometry_shaders(ctx)) instead of explicit checks (Ian)
- Core mesa parts moved into a prep patch (Ilia)

v4:
- Change to 10.6 relnotes since we missed 10.5 window
- Moved compute shader stuff into the switch statement (Jordan)
- Jordan: Add compute shader support

v5:
- Fixed relnote style (Ilia)

v6:
- Rebased on master which beat me to adding the first relnotes - essentially
  this undoes v5 (which had a typo anyway)
- Some code style fixes (Ken)
- Remove some excess comments (Ken)
- Unify tessellation failure style - unreachable (Ken)
- Fix workaround comment for PS invocations (Ken)

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: Add support for the ARB_pipeline_statistics_query extension
Ben Widawsky [Fri, 2 Jan 2015 20:13:53 +0000 (12:13 -0800)]
mesa: Add support for the ARB_pipeline_statistics_query extension

This was originally part of a single patch which added the extension, and
implemented it for i965 classic. For information about the evolution of the
patch, please see the subsequent commit.

One difference here as compared to the original mega patch is this does build
support for the compute shader query. Since it cannot be tested on any platform,
it will always return NULL for now. Jordan has already written a patch to
address this, and when that patch lands, this logic can be modified.

v2: Fix typo in subject (Brian Paul)
Add checks for desktop gl (Ilia)
Fail for any callers for now (Ilia)
Update QueryCounterBits for new tokens (Ilia)
Jordan: Use _mesa_has_compute_shaders

Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
v3: Rebased on patch which adds the proper information to unstub tessellation
shaders.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agomesa: Add _mesa_has_compute_shaders
Jordan Justen [Sat, 14 Feb 2015 20:53:42 +0000 (12:53 -0800)]
mesa: Add _mesa_has_compute_shaders

v2 (Ben): Change GLboolean to bool as requested by Ian

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
9 years agomesa: Add ARB_tessellation_shader to extension table.
Fabian Bieler [Sun, 21 Sep 2014 01:40:42 +0000 (13:40 +1200)]
mesa: Add ARB_tessellation_shader to extension table.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Prefer Meta over the BLT for BlitFramebuffer.
Kenneth Graunke [Thu, 15 Jan 2015 09:41:14 +0000 (01:41 -0800)]
i965: Prefer Meta over the BLT for BlitFramebuffer.

There's some debate about whether we should use Meta or BLORP,
but either should run circles around the BLT engine.

In particular, this means that Gen8+ will use the 3D engine for blits,
like we do on Gen6-7.

Improves performance in "copypixrate -blit -back" (from Mesa demos)
by 232.037% +/- 3.15795% (n=10) on Broadwell GT3e.

v2: Rebase on Laura's changes.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
9 years agoi965/fs: Add algebraic optimizations for MAD.
Matt Turner [Mon, 10 Nov 2014 01:27:52 +0000 (17:27 -0800)]
i965/fs: Add algebraic optimizations for MAD.

total instructions in shared programs: 5764176 -> 5763808 (-0.01%)
instructions in affected programs:     25121 -> 24753 (-1.46%)
helped:                                164
HURT:                                  2

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Emit MAD instructions when possible.
Matt Turner [Mon, 27 Oct 2014 05:08:15 +0000 (22:08 -0700)]
i965/fs: Emit MAD instructions when possible.

Previously we didn't emit MAD instructions since they cannot take
immediate arguments, but with the opt_combine_constants() pass we can
handle this properly.

total instructions in shared programs: 5920017 -> 5733278 (-3.15%)
instructions in affected programs:     3625153 -> 3438414 (-5.15%)
helped:                                22017
HURT:                                  870
GAINED:                                91
LOST:                                  49

Without constant pooling, this patch is a complete loss:

total instructions in shared programs: 5912589 -> 5987888 (1.27%)
instructions in affected programs:     3190050 -> 3265349 (2.36%)
helped:                                1564
HURT:                                  17827
GAINED:                                27
LOST:                                  101

And since the constant pooling patch by itself hurt a bunch of things,
from before constant pooling to this patch the results are:

total instructions in shared programs: 5895414 -> 5747946 (-2.50%)
instructions in affected programs:     3617993 -> 3470525 (-4.08%)
helped:                                20478
HURT:                                  4469
GAINED:                                54
LOST:                                  146

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Allow immediates in MAD and LRP instructions.
Matt Turner [Mon, 27 Oct 2014 05:07:06 +0000 (22:07 -0700)]
i965/fs: Allow immediates in MAD and LRP instructions.

And then the opt_combine_constants() pass will pull them out into
registers. This will allow us to do some algebraic optimizations on MAD
and LRP.

total instructions in shared programs: 5946656 -> 5931320 (-0.26%)
instructions in affected programs:     778247 -> 762911 (-1.97%)
helped:                                3780
HURT:                                  6
GAINED:                                12
LOST:                                  12

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Add pass to combine immediates.
Matt Turner [Wed, 12 Feb 2014 19:00:46 +0000 (11:00 -0800)]
i965/fs: Add pass to combine immediates.

total instructions in shared programs: 5885407 -> 5940958 (0.94%)
instructions in affected programs:     3617311 -> 3672862 (1.54%)
helped:                                3
HURT:                                  23556
GAINED:                                31
LOST:                                  165

... but will allow us to always emit MAD instructions.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/fs: Remove force_writemask_all assertion for execsize < 8.
Matt Turner [Mon, 27 Oct 2014 05:10:53 +0000 (22:10 -0700)]
i965/fs: Remove force_writemask_all assertion for execsize < 8.

This doesn't seem to be necessary.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86974
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/cfg: Add function to generate a dot file of the dominator tree.
Matt Turner [Thu, 27 Feb 2014 00:15:52 +0000 (16:15 -0800)]
i965/cfg: Add function to generate a dot file of the dominator tree.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/cfg: Add function to generate a dot file of the CFG.
Matt Turner [Thu, 27 Feb 2014 00:07:52 +0000 (16:07 -0800)]
i965/cfg: Add function to generate a dot file of the CFG.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/cfg: Calculate the immediate dominators.
Matt Turner [Wed, 19 Feb 2014 00:35:56 +0000 (16:35 -0800)]
i965/cfg: Calculate the immediate dominators.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965/cfg: Allow cfg::dump to be called without a visitor.
Matt Turner [Wed, 19 Feb 2014 00:38:07 +0000 (16:38 -0800)]
i965/cfg: Allow cfg::dump to be called without a visitor.

The fs_visitor's dump_instruction() implementation calls cfg_t()
indirectly through calculate_live_intervals, so if you have an infinite
loop in the CFG code, you can't call cfg::dump(fs_visitor *) to debug
it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoi965: Allow exec_list sentinels as arguments to insert functions.
Matt Turner [Wed, 18 Feb 2015 02:01:41 +0000 (18:01 -0800)]
i965: Allow exec_list sentinels as arguments to insert functions.

To insert an instruction at the end of a basic block, we typically do
something like

   inst = block->last_non_control_flow_inst();
   inst->insert_after(block, new_inst);

But blocks can consist of a single control flow instruction, so inst
will actually be the exec_list's head sentinel. We shouldn't use it as
if it were a regular instruction, but it is safe to insert something after
it.

This patch avoids assert-failing because an exec_list sentinel wasn't in
the basic block's instruction list.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoMake _mesa_swizzle_and_convert argument types in .c match those in .h
Alan Coopersmith [Mon, 16 Feb 2015 00:20:25 +0000 (16:20 -0800)]
Make _mesa_swizzle_and_convert argument types in .c match those in .h

Caused Solaris Studio compilers to fail to build with errors about
incompatible function redefinitions.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoUse __typeof instead of typeof with Solaris Studio compilers
Alan Coopersmith [Mon, 16 Feb 2015 00:19:06 +0000 (16:19 -0800)]
Use __typeof instead of typeof with Solaris Studio compilers

While the C compiler accepts typeof, C++ requires __typeof.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=86944
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoAvoid fighting with Solaris headers over isnormal()
Alan Coopersmith [Mon, 16 Feb 2015 00:16:15 +0000 (16:16 -0800)]
Avoid fighting with Solaris headers over isnormal()

When compiling in C99 or C++11 modes, Solaris defines isnormal() as
a macro via <math.h>, which causes the function definition to become
too mangled to compile.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoRemove extraneous ; after DECL_TYPE usage
Alan Coopersmith [Sun, 15 Feb 2015 22:46:29 +0000 (14:46 -0800)]
Remove extraneous ; after DECL_TYPE usage

The macro is defined to provide a trailing ; so this caused the expansion
to end in ";;" which made the Solaris Studio compilers issue warnings for
every line of:
  "builtin_type_macros.h", line 113: Warning: extra ";" ignored.
for every file that included the header, filling build logs with thousands
of useless warnings.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoBracket arguments to tr so they work with Solaris tr
Alan Coopersmith [Thu, 1 Jan 2015 20:55:27 +0000 (12:55 -0800)]
Bracket arguments to tr so they work with Solaris tr

https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Limitations-of-Usual-Tools.html#index-g_t_0040command_007btr_007d-1842

Without this fix, egl fails to build on Solaris, with the error:

<command-line>:0:22: error: '_EGL_PLATFORM_x11' undeclared (first use in this function)
egldisplay.c:207:31: note: in expansion of macro '_EGL_NATIVE_PLATFORM'
             native_platform = _EGL_NATIVE_PLATFORM;
                               ^

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
9 years agoglsl: Reduce memory consumption of copy propagation passes.
Kenneth Graunke [Wed, 17 Dec 2014 02:33:39 +0000 (18:33 -0800)]
glsl: Reduce memory consumption of copy propagation passes.

opt_copy_propagation and opt_copy_propagation_elements create new ACP
and Kill sets each time they enter a new control flow block.  For if
blocks, they also copy the entire existing ACP set contents into the
new set.

When we exit the control flow block, we discard the new sets.  However,
we weren't freeing them - so they lived on until the pass finished.
This can waste a lot of memory (57MB on one pessimal shader).

This patch makes the pass allocate ACP entries using this->acp as the
memory context, and Kill entries out of this->kill.  It also steals
kill entries when moving them from the inner kill list to the parent.

It then frees the lists, including their contents.

v2: Move ralloc_free(this->acp) just before this->acp = orig_acp
    (suggested by Eric Anholt).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.5 10.4" <mesa-stable@lists.freedesktop.org>
9 years agoi965: Add device limits for tess threads & URB entries
Chris Forbes [Tue, 9 Sep 2014 09:28:46 +0000 (21:28 +1200)]
i965: Add device limits for tess threads & URB entries

This should cover all platforms prior to Skylake.

Signed-off-by: Chris Forbes <chrisf@ijw.co.nz>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Acked-by: Ben Widawsky <ben@bwidawsk.net>
9 years agor600g/sb: treat undefined values like constants
Dave Airlie [Wed, 18 Feb 2015 00:13:20 +0000 (10:13 +1000)]
r600g/sb: treat undefined values like constants

When we schedule an instructions with undefined value, we
eventually will use 0, which is a constant, however sb wasn't
taking this into account and creating ops with illegal scalar
swizzles.

this replaces my fix for op3 in t slots.

Reviewed-by: Glenn Kennard <glenn.kennard@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoi915c: Use the actual MIN instruction.
Kenneth Graunke [Tue, 10 Feb 2015 11:36:48 +0000 (03:36 -0800)]
i915c: Use the actual MIN instruction.

Matt Turner noticed that the hardware has always had a MIN
instruction, but the driver always used MAX+MOV for no
apparent reason.

This should cut an instruction, and a temporary, allowing
more programs to run in hardware.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi915g: Use the actual MIN instruction.
Kenneth Graunke [Tue, 10 Feb 2015 11:36:47 +0000 (03:36 -0800)]
i915g: Use the actual MIN instruction.

Matt Turner noticed that the hardware has always had a MIN
instruction, but the driver always used MAX+MOV for no
apparent reason.

This should cut an instruction, and a temporary, allowing
more programs to run in hardware.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Add a function to disassemble an instruction from the 4 dwords.
Kenneth Graunke [Fri, 6 Feb 2015 08:36:26 +0000 (00:36 -0800)]
i965: Add a function to disassemble an instruction from the 4 dwords.

I used this a while back when debugging GPU hangs, and it seems like it
could be useful, so I figured I'd add it so people can use it in the
debugger.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965: Do Sandybridge workaround flushes before each primitive.
Kenneth Graunke [Sat, 10 Jan 2015 07:07:56 +0000 (23:07 -0800)]
i965: Do Sandybridge workaround flushes before each primitive.

Sandybridge requires the post-sync non-zero workaround in a ton of
places, and if you ever miss one, the GPU usually hangs.

Currently, we try to track exactly when a workaround flush is
necessary (via the brw->batch.need_workaround_flush flag).  This is
tricky to get right, and we've botched it several times in the past.

This patch unconditionally performs the post-sync non-zero flush at the
start of each primitive's state upload (including BLORP).  We drop the
needs_workaround_flush flag, and drop all the other callers, as the
flush has already been performed.

We have no data to indicate that simply flushing all the time will
hurt performance, and it has the potential to help stability.

v2: Add post-sync workaround to initial GPU state upload to be extra
    cautious (suggested by Chad Versace).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chad Versace <chad.versace@linux.intel.com>
9 years agomain: Fixed _mesa_GetCompressedTexImage_sw to copy slices correctly.
Laura Ekstrand [Mon, 16 Feb 2015 22:29:57 +0000 (14:29 -0800)]
main: Fixed _mesa_GetCompressedTexImage_sw to copy slices correctly.

Previously array textures were not working with GetCompressedTextureImage,
leading to failures in the test
arb_direct_state_access/getcompressedtextureimage.c.

Tested-by: Laura Ekstrand <laura@jlekstrand.net>
Reviewed-by: Brian Paul <brianp@vmware.com>
Cc: "10.4, 10.5" <mesa-stable@lists.freedesktop.org>
9 years agoi965/vec4: Silence unused parameter warnings
Ian Romanick [Wed, 11 Feb 2015 17:23:41 +0000 (09:23 -0800)]
i965/vec4: Silence unused parameter warnings

brw_vec4_copy_propagation.cpp:243:59: warning: unused parameter 'reg' [-Wunused-parameter]
                    int arg, struct copy_entry *entry, int reg)
                                                           ^

brw_vec4_generator.cpp:869:57: warning: unused parameter 'inst' [-Wunused-parameter]
 vec4_generator::generate_unpack_flags(vec4_instruction *inst,
                                                         ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agomesa/main: Silence unused parameter warning
Ian Romanick [Tue, 10 Feb 2015 16:58:01 +0000 (08:58 -0800)]
mesa/main: Silence unused parameter warning

Just remove the _mesa_free_lighting_data function.  The body has been
empty since the shine table was moved into the tnl module (commit
ba1d921).

main/light.c:1216:46: warning: unused parameter 'ctx' [-Wunused-parameter]
 _mesa_free_lighting_data( struct gl_context *ctx )
                                              ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoutil/hash: Silence comparison between signed and unsigned integer warnings in tests
Ian Romanick [Tue, 10 Feb 2015 16:05:12 +0000 (08:05 -0800)]
util/hash: Silence comparison between signed and unsigned integer warnings in tests

delete_management.c:56:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size; i++) {
                  ^
delete_management.c:69:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = size - 100; i < size; i++) {
                           ^
delete_management.c:79:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       assert(key_value(entry->key) >= size - 100 &&
                               ^
delete_management.c:79:70: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       assert(key_value(entry->key) >= size - 100 &&
                                                                      ^
insert_many.c:56:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size; i++) {
                  ^
insert_many.c:62:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size; i++) {
                  ^
insert_many.c:67:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    assert(ht->entries == size);
                  ^
random_entry.c:62:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (i = 0; i < size; i++) {
                  ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoutil/hash: Silence unused parameter warnings in tests
Ian Romanick [Tue, 10 Feb 2015 16:02:28 +0000 (08:02 -0800)]
util/hash: Silence unused parameter warnings in tests

delete_and_lookup.c:37:21: warning: unused parameter ‘key’ [-Wunused-parameter]
 badhash(const void *key)
                     ^
delete_and_lookup.c:43:10: warning: unused parameter ‘argc’ [-Wunused-parameter]
 main(int argc, char **argv)
          ^
delete_and_lookup.c:43:23: warning: unused parameter ‘argv’ [-Wunused-parameter]
 main(int argc, char **argv)
                       ^
collision.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter]
 main(int argc, char **argv)
          ^
collision.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter]
 main(int argc, char **argv)
                       ^
destroy_callback.c:50:10: warning: unused parameter ‘argc’ [-Wunused-parameter]
 main(int argc, char **argv)
          ^
destroy_callback.c:50:23: warning: unused parameter ‘argv’ [-Wunused-parameter]
 main(int argc, char **argv)
                       ^
insert_many.c:46:10: warning: unused parameter ‘argc’ [-Wunused-parameter]
 main(int argc, char **argv)
          ^
insert_many.c:46:23: warning: unused parameter ‘argv’ [-Wunused-parameter]
 main(int argc, char **argv)
                       ^
insert_and_lookup.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter]
 main(int argc, char **argv)
          ^
insert_and_lookup.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter]
 main(int argc, char **argv)
                       ^
null_destroy.c:32:10: warning: unused parameter ‘argc’ [-Wunused-parameter]
 main(int argc, char **argv)
          ^
null_destroy.c:32:23: warning: unused parameter ‘argv’ [-Wunused-parameter]
 main(int argc, char **argv)
                       ^
random_entry.c:52:10: warning: unused parameter ‘argc’ [-Wunused-parameter]
 main(int argc, char **argv)
          ^
random_entry.c:52:23: warning: unused parameter ‘argv’ [-Wunused-parameter]
 main(int argc, char **argv)
                       ^
remove_null.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter]
 main(int argc, char **argv)
          ^
remove_null.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter]
 main(int argc, char **argv)
                       ^
replacement.c:34:10: warning: unused parameter ‘argc’ [-Wunused-parameter]
 main(int argc, char **argv)
          ^
replacement.c:34:23: warning: unused parameter ‘argv’ [-Wunused-parameter]
 main(int argc, char **argv)
                       ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoglcpp: Silence GCC warning
Ian Romanick [Tue, 10 Feb 2015 15:57:08 +0000 (07:57 -0800)]
glcpp: Silence GCC warning

glcpp/glcpp.c:124:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
 const static struct option
 ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoradeonsi: fix a crash if a stencil ref state is set before a DSA state
Marek Olšák [Sun, 15 Feb 2015 17:12:06 +0000 (18:12 +0100)]
radeonsi: fix a crash if a stencil ref state is set before a DSA state

+ minor indentation fixes

Discovered by Axel Davy.

This can't be reproduced with any app, because all state trackers set a DSA
state first.

Cc: 10.5 10.4 10.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Axel Davy <axel.davy@ens.fr>
9 years agor600g,radeonsi: implement GL_AMD_pinned_memory
Marek Olšák [Tue, 10 Feb 2015 15:02:54 +0000 (16:02 +0100)]
r600g,radeonsi: implement GL_AMD_pinned_memory

v2: update release notes

Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agowinsys/radeon: test the userptr ioctl to see if it's present
Marek Olšák [Wed, 11 Feb 2015 19:25:16 +0000 (20:25 +0100)]
winsys/radeon: test the userptr ioctl to see if it's present

There is no other way to check for support.

Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agowinsys/radeon: allow unaligned size for user-memory buffers
Marek Olšák [Tue, 10 Feb 2015 21:27:21 +0000 (22:27 +0100)]
winsys/radeon: allow unaligned size for user-memory buffers

This is not required, but being user-friendly doesn't hurt.

Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agowinsys/radeon: allow mapping a user buffer
Marek Olšák [Tue, 10 Feb 2015 15:41:53 +0000 (16:41 +0100)]
winsys/radeon: allow mapping a user buffer

OpenGL requires this.

Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agogallium: add interface and state tracker support for GL_AMD_pinned_memory
Marek Olšák [Tue, 10 Feb 2015 13:00:57 +0000 (14:00 +0100)]
gallium: add interface and state tracker support for GL_AMD_pinned_memory

v2: add alignment restrictions to docs, fix indentation in headers

Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agomesa: implement GL_AMD_pinned_memory
Marek Olšák [Tue, 10 Feb 2015 00:39:41 +0000 (01:39 +0100)]
mesa: implement GL_AMD_pinned_memory

It's not possible to query the current buffer binding, because the extension
doesn't define GL_..._BUFFER__BINDING_AMD.

Drivers should check the target parameter of Drivers.BufferData. If it's
equal to GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD, the memory should be pinned.
That's all there is to it.

A piglit test is on the piglit mailing list.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
9 years agowinsys/radeon: add user pointer support
Christian König [Thu, 5 Feb 2015 17:34:51 +0000 (18:34 +0100)]
winsys/radeon: add user pointer support

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
9 years agomesa: fix AtomicBuffer typo in _mesa_DeleteBuffers
Marek Olšák [Tue, 10 Feb 2015 00:35:23 +0000 (01:35 +0100)]
mesa: fix AtomicBuffer typo in _mesa_DeleteBuffers

Cc: 10.5 10.4 10.3 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
9 years agoradeonsi: initialize TC_L2_dirty to false after buffer allocation
Marek Olšák [Tue, 10 Feb 2015 13:16:56 +0000 (14:16 +0100)]
radeonsi: initialize TC_L2_dirty to false after buffer allocation

I forgot to do this, though "true" should have no effect on correctness.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agoradeonsi: small fix in SPI state
Marek Olšák [Fri, 6 Feb 2015 17:00:50 +0000 (18:00 +0100)]
radeonsi: small fix in SPI state

Cc: 10.5 10.4 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agor600g,radeonsi: use fences to implement PIPE_QUERY_GPU_FINISHED
Marek Olšák [Sat, 7 Feb 2015 12:19:38 +0000 (13:19 +0100)]
r600g,radeonsi: use fences to implement PIPE_QUERY_GPU_FINISHED

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

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agor600g,radeonsi: demote TIMESTAMP_DISJOINT query to be a software query
Marek Olšák [Fri, 6 Feb 2015 16:18:11 +0000 (17:18 +0100)]
r600g,radeonsi: demote TIMESTAMP_DISJOINT query to be a software query

The query result is always constant.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
9 years agost/glsl_to_tgsi: fix whitespace
Dave Airlie [Tue, 17 Feb 2015 00:05:45 +0000 (10:05 +1000)]
st/glsl_to_tgsi: fix whitespace

everytime I open this file in emacs with show trailing whitespace
or git add from it my screen flares with red.

Just do a general cleanup, makes working on fp64 support not as
jarring.

I'm not saying this is perfect, its just better than before.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoglsl/tests: add IMAGE type.
Ilia Mirkin [Tue, 17 Feb 2015 01:25:16 +0000 (11:25 +1000)]
glsl/tests: add IMAGE type.

This fixes a warning when running make check.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
9 years agoilo: always set up BLEND_STATE on Gen8
Chia-I Wu [Mon, 16 Feb 2015 20:45:03 +0000 (04:45 +0800)]
ilo: always set up BLEND_STATE on Gen8

There is now an DW0 that seems to be always referenced.

9 years agoilo: fix alpha test on Gen8
Chia-I Wu [Mon, 16 Feb 2015 20:54:17 +0000 (04:54 +0800)]
ilo: fix alpha test on Gen8

Shoudl use GEN8_BLEND_DW0_ALPHA_TEST_ENABLE instead of
GEN6_RT_DW1_ALPHA_TEST_ENABLE (and others).

9 years agoi965/simd8vs: Fix SIMD8 atomics
Ben Widawsky [Mon, 16 Feb 2015 04:06:59 +0000 (20:06 -0800)]
i965/simd8vs: Fix SIMD8 atomics

The short version: we need to set bits in R0.7 which provide a mask to be used
for PS kill samples/pixels. Since the VS has no such concept, we just need to
set all 1.

The longer version...
Execution for SIMD8 atomics is defined as follows:
SIMD8: The low 8 bits of the execution mask are ANDed with 8 bits of the
Pixel/Sample Mask from the message header. For the typed messages, the Slot
Group in the message descriptor selects either the low or high 8 bits. For the
untyped messages, the low 8 bits are always selected. The resulting mask is used
to determine which slots are read into the destination GRF register (for read),
or which slots are written to the surface (for write). If the header is not
present, only the low 8 bits of the execution mask are used.

The message header for untyped messages is defined in R0.7 "This field contains
the 16-bit pixel/sample mask to be used for SIMD16 and SIMD8 messages. All 16
bits are used for SIMD16 messages.  For typed SIMD8 messages, Slot Group selects
which 8 bits of this field are used. For untyped SIMD8 messages, the low 8 bits
of this field are used." Furthermore, "The message header for the untyped
messages only needs to be delivered for pixel shader threads, where the
execution mask may indicate pixels/samples that are enabled only due to
derivative (LOD) calculations, but the corresponding slot on the surface must
not be accessed." We're not using a pixel shader here, but AFAICT, this mask is
used for all stages.

This leaves two options, Remove the header, or make the VS code emit the correct
thing for the header. I believe one of the goals of using SIMD8 VS was to get as
much code reuse as possible, and so I chose the latter. Since the VS has no such
thing as kill instructions, the mask is derived simple as all 1's.

v2:
Add a comment to the code (stolen from Curro on the mailing list)
Change the control flow style (Curro + Jason)

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87258
Cc: Kristian Høgsberg <krh@bitplanet.net>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
9 years agomesa: move assertion after declarations in texstore.c
Brian Paul [Mon, 16 Feb 2015 15:38:56 +0000 (08:38 -0700)]
mesa: move assertion after declarations in texstore.c

To fix MSVC build.

9 years agomesa: silence uninitialized var warning in get_tex_rgba_uncompressed()
Brian Paul [Tue, 10 Feb 2015 19:17:18 +0000 (12:17 -0700)]
mesa: silence uninitialized var warning in get_tex_rgba_uncompressed()

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agometa: Fix saving the results of the current occlusion query
Neil Roberts [Tue, 25 Nov 2014 17:52:27 +0000 (17:52 +0000)]
meta: Fix saving the results of the current occlusion query

When restoring the current state in _mesa_meta_end it was previously trying to
copy the on-going sample count of the current occlusion query into the new
query after restarting it so that the driver will continue adding to the
previous value. This wouldn't work for two reasons. Firstly, the query might
not be ready yet so the Result member will usually be zero. Secondly the saved
query is stored as a pointer to the query object, not a copy of the struct, so
it is actually restarting the exact same object. Copying the result value is
just copying between identical addresses with no effect. The call to
_mesa_BeginQuery will have always reset it back to zero.

This patch fixes it by making it actually wait for the query object to be
ready before grabbing the previous result. The downside of doing this is that
it could introduce a stall but I think this situation is unlikely so it might
not matter too much. A better solution might be to introduce a real
suspend/resume mechanism to the driver interface. This could be implemented in
the i965 driver by saving the depth count multiple times like it does in the
i945 driver.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88248
Reviewed-by: Carl Worth <cworth@cworth.org>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
9 years agoi965/vec4: Override destination register writemask in sampler message send.
Francisco Jerez [Thu, 12 Feb 2015 08:20:49 +0000 (10:20 +0200)]
i965/vec4: Override destination register writemask in sampler message send.

This line was removed by accident in commit
16b911257440afbd77a6eb762e28df62e3c19bc7 causing a regression in the
ES3-CTS.gtf.GL3Tests.shadow.shadow_execution_vert Khronos conformance
test.  It's necessary because the swizzle_result() code below expects
all four components of the vector to be valid.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89094
Tested-by: Lu Hua <huax.lu@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965: Fix a crash in the texture gradient lowering pass with cube samplers
Iago Toral Quiroga [Fri, 13 Feb 2015 07:29:32 +0000 (08:29 +0100)]
i965: Fix a crash in the texture gradient lowering pass with cube samplers

We need to swizzle the rhs to match the number of components in the writemask,
otherwise we'll hit an assertion in ir_assignment.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agomesa: Fix element count for byte-swaps in texstore, readpix and texgetimage
Iago Toral Quiroga [Fri, 13 Feb 2015 11:56:26 +0000 (12:56 +0100)]
mesa: Fix element count for byte-swaps in texstore, readpix and texgetimage

Some old format conversion code in pack.c implemented byte-swapping like this:

GLint comps = _mesa_components_in_format(dstFormat);
GLint swapSize = _mesa_sizeof_packed_type(dstType);
if (swapSize == 2)
   _mesa_swap2((GLushort *) dstAddr, n * comps);
else if (swapSize == 4)
   _mesa_swap4((GLuint *) dstAddr, n * comps);

where n is the pixel count. But this is incorrect for packed formats,
where _mesa_sizeof_packed_type is already returning the size of a pixel
instead of the size of a single component, so multiplying this by the
number of components in the format results in a larger element count
for _mesa_swap than we want.

Unfortunately, we followed the same implementation for byte-swapping
in the rewrite of the format conversion code for texstore, readpixels
and texgetimage.

This patch computes the correct element counts for _mesa_swap calls
by computing the bytes per pixel in the image and dividing that by the
swap size to obtain the number of swaps required per pixel. Then multiplies
that by the number of pixels in the image to obtain the swap count that
we need to use.

Also, when handling byte-swapping in texstore_rgba, we were ignoring
the image's depth. This patch fixes this too.

Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
9 years agomesa: Handle transferOps in texstore_rgba
Iago Toral Quiroga [Fri, 13 Feb 2015 09:23:26 +0000 (10:23 +0100)]
mesa: Handle transferOps in texstore_rgba

In the recent rewrite of the format conversion code we did not handle this.
This patch adds the missing support.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89068
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
9 years agoi965/fs: Handle U/UW-type immediates in the generator.
Matt Turner [Fri, 9 Jan 2015 06:56:44 +0000 (22:56 -0800)]
i965/fs: Handle U/UW-type immediates in the generator.

9 years agoi965/fs: Handle W/UW-type immediates in dump_instructions().
Matt Turner [Fri, 9 Jan 2015 06:55:16 +0000 (22:55 -0800)]
i965/fs: Handle W/UW-type immediates in dump_instructions().

9 years agoi965: Let dump_instructions() work before calculate_cfg().
Matt Turner [Fri, 13 Feb 2015 18:46:32 +0000 (10:46 -0800)]
i965: Let dump_instructions() work before calculate_cfg().

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965/fs: Call calculate_cfg() before optimize().
Matt Turner [Fri, 13 Feb 2015 18:34:39 +0000 (10:34 -0800)]
i965/fs: Call calculate_cfg() before optimize().

The CFG is fundamental to the FS IR, not merely a piece of optimization.

Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
9 years agoi965: Optimize multiplication by -1 into a negated MOV.
Matt Turner [Thu, 5 Feb 2015 02:08:30 +0000 (18:08 -0800)]
i965: Optimize multiplication by -1 into a negated MOV.

instructions in affected programs:     968 -> 942 (-2.69%)
helped:                                4

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965: Add an is_negative_one() method.
Matt Turner [Thu, 5 Feb 2015 02:08:21 +0000 (18:08 -0800)]
i965: Add an is_negative_one() method.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965/vec4/vp: Use vec4_visitor::CMP.
Matt Turner [Thu, 12 Feb 2015 02:01:49 +0000 (02:01 +0000)]
i965/vec4/vp: Use vec4_visitor::CMP.

... instead of emit(BRW_OPCODE_CMP, ...). In commit 6b3a301f I changed
vec4_visitor::CMP to set the destination's type to that of src0. In the
following commit (2335153f) I removed an apparently now unnecessary work
around for Gen8 that did the same thing.

But there was a single place that emitted a CMP instruction without
using the vec4_visitor::CMP function. Use it there.

And change dst_null_d to dst_null_f for good measure, since ARB vp
doesn't have integers.

Cc: "10.5" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89032
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoilo: fix some state pointer commands on Gen8
Chia-I Wu [Sun, 15 Feb 2015 05:21:51 +0000 (13:21 +0800)]
ilo: fix some state pointer commands on Gen8

3DSTATE_CC_STATE_POINTERS seems to be ignored when bit 0 of DW1 is not set.
Follow i965 and set the bit for 3DSTATE_CC_STATE_POINTERS and
3DSTATE_BLEND_STATE_POINTERS.  Add gen checks for all state pointer commands.

9 years agonvc0: allow holes in xfb target lists
Ilia Mirkin [Sat, 14 Feb 2015 06:43:31 +0000 (01:43 -0500)]
nvc0: allow holes in xfb target lists

Tested with a modified xfb-streams test which outputs to streams 0, 2,
and 3.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
9 years agost/mesa: treat resource-less xfb buffers as if they weren't there
Ilia Mirkin [Sat, 14 Feb 2015 06:27:19 +0000 (01:27 -0500)]
st/mesa: treat resource-less xfb buffers as if they weren't there

If a transform feedback buffer's size is 0, st_bufferobj_data doesn't
end up creating a buffer for it. There's no point in trying to write to
such a buffer, so just pretend as if it's not really there.

This fixes arb_gpu_shader5-xfb-streams-without-invocations on nvc0.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
9 years agonvc0: bail out of 2d blits with non-A8_UNORM alpha formats
Ilia Mirkin [Sat, 14 Feb 2015 04:21:36 +0000 (23:21 -0500)]
nvc0: bail out of 2d blits with non-A8_UNORM alpha formats

This fixes the teximage-colors uploads with GL_ALPHA format and
non-GL_UNSIGNED_BYTE type.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.4 10.5" <mesa-stable@lists.freedesktop.org>
9 years agoi965/nir: Don't support gl_FrontFacing as an input variable
Jason Ekstrand [Sat, 14 Feb 2015 20:16:03 +0000 (12:16 -0800)]
i965/nir: Don't support gl_FrontFacing as an input variable

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir: Make gl_FrontFacing a system_value
Jason Ekstrand [Sat, 14 Feb 2015 20:10:32 +0000 (12:10 -0800)]
nir: Make gl_FrontFacing a system_value

GLSL IR labels gl_FrontFacing as an input variable and not a system value.
This commit makes NIR silently translate gl_FrontFacing to a system value
so that it properly gets translated into a load_system_value intrinsic.

Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agoi965/nir: Add support for nir_intrinsic_load_front_face
Jason Ekstrand [Sat, 14 Feb 2015 20:09:31 +0000 (12:09 -0800)]
i965/nir: Add support for nir_intrinsic_load_front_face

Reviewed-by: Matt Turner <mattst88@gmail.com>
9 years agonir/lower_phis_to_scalar: Fix some logic in is_phi_scalarizable
Jason Ekstrand [Mon, 9 Feb 2015 22:22:14 +0000 (14:22 -0800)]
nir/lower_phis_to_scalar: Fix some logic in is_phi_scalarizable

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
9 years agoclover: Use Legacy PassManager for LLVM trunk (3.7)
Shawn Starr [Sat, 14 Feb 2015 02:16:17 +0000 (21:16 -0500)]
clover: Use Legacy PassManager for LLVM trunk (3.7)

Reviewed-by: Tom Stellard <thomas.stellard@amd.com>
Signed-off-by: Shawn Starr <shawn.starr@rogers.com>
9 years agoilo: fix JIP/UIP on Gen8
Chia-I Wu [Fri, 13 Feb 2015 22:28:12 +0000 (06:28 +0800)]
ilo: fix JIP/UIP on Gen8

UIP is in DW2 and JIP is in DW3 on Gen8.  Also, the units are in bytes.

9 years agoilo: do not set GEN6_THREADCTRL_SWITCH
Chia-I Wu [Fri, 13 Feb 2015 22:25:27 +0000 (06:25 +0800)]
ilo: do not set GEN6_THREADCTRL_SWITCH

It is not needed on Gen6+, and it appears to be broken on Gen8.

9 years agoilo: correct ISA UIP/JIP decoding for Gen8
Chia-I Wu [Fri, 13 Feb 2015 19:07:51 +0000 (03:07 +0800)]
ilo: correct ISA UIP/JIP decoding for Gen8

JIP is int32_t and UIP is in DW2 on Gen8.

9 years agoilo: prepare for 64-bit immediates decoding
Chia-I Wu [Fri, 13 Feb 2015 19:05:47 +0000 (03:05 +0800)]
ilo: prepare for 64-bit immediates decoding

Replace imm32 by imm64.  Add more ways (UD, D, etc) to access the immediate.

9 years agoilo: cleanup ISA DW1 decoding
Chia-I Wu [Fri, 13 Feb 2015 18:23:53 +0000 (02:23 +0800)]
ilo: cleanup ISA DW1 decoding

Decode the higher and lower 16 bits separately.

9 years agoilo: cleanup ISA DW0 decoding
Chia-I Wu [Fri, 13 Feb 2015 18:18:55 +0000 (02:18 +0800)]
ilo: cleanup ISA DW0 decoding

Add disasm_inst_decode_dw0_opcode_gen6() to decode the opcode.  Simplify
branch_ctrl/acc_wr_ctrl decoding.

9 years agoilo: update some outdated gen checks
Chia-I Wu [Thu, 12 Feb 2015 20:04:18 +0000 (04:04 +0800)]
ilo: update some outdated gen checks

Update gen checks for 3DSTATE_POLY_STIPPLE_OFFSET,
3DSTATE_POLY_STIPPLE_PATTERN, 3DSTATE_LINE_STIPPLE, and
3DSTATE_AA_LINE_PARAMETERS.

9 years agoilo: fix rectlist length on Gen8
Chia-I Wu [Thu, 12 Feb 2015 19:59:45 +0000 (03:59 +0800)]
ilo: fix rectlist length on Gen8

5 PIPE_CONTROLs, 2 3DSTATE_WM_HZ_OP, and depth buffer setup require 65 DWords.

9 years agoilo: fix 3DSTATE_VF_TOPOLOGY
Chia-I Wu [Thu, 12 Feb 2015 19:54:32 +0000 (03:54 +0800)]
ilo: fix 3DSTATE_VF_TOPOLOGY

The pipe primitive type was wrongly translated twice.

9 years agoos,llvmpipe: Set rasterizer thread names on Linux.
Jose Fonseca [Fri, 13 Feb 2015 13:51:28 +0000 (13:51 +0000)]
os,llvmpipe: Set rasterizer thread names on Linux.

To help identify llvmpipe rasterizer threads -- especially when there
can be so many.

We can eventually generalize this to other OSes, but for that we must
restrict the function to be called from the current thread.  See also
http://stackoverflow.com/a/7989973

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agouti/u_atomic: Don't test p_atomic_add with booleans.
Jose Fonseca [Fri, 13 Feb 2015 09:46:44 +0000 (09:46 +0000)]
uti/u_atomic: Don't test p_atomic_add with booleans.

Add another class of tests.

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

I failed to spot this in my previous change, because bool was a typedef
for char on the system I tested.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agomesa: fix OES_texture_float texture render target behavior
Tapani Pälli [Thu, 12 Feb 2015 12:33:53 +0000 (14:33 +0200)]
mesa: fix OES_texture_float texture render target behavior

Current implementation allowed usage of unsized type texture GL_FLOAT
and GL_HALF_FLOAT as a render target as this was 'expected behavior' by
WEBGL_oes_texture_float and is also allowed by the oes-texture-float
WebGL test. However this broke some ES3 conformance tests that do not
accept such behavior. Patch sets such an fbo incomplete as expected by
the ES3 conformance tests. Textures with sized types like RGBA32F will
still continue to work as render targets.

v2: code style cleanups (Ian Romanick, Matt Turner)

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88905
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Cc: "10.5" <mesa-stable@lists.freedesktop.org>
9 years agovc4: Make SF be a flag on the QIR instructions.
Eric Anholt [Thu, 12 Feb 2015 22:17:21 +0000 (14:17 -0800)]
vc4: Make SF be a flag on the QIR instructions.

Right now the places that used to emit a mov.sf just put the SF on the
previous instruction when it generated the source of the SF value.  Even
without optimization to push the sf up further (and kill thus potentially
kill more MOVs), this gets us:

total uniforms in shared programs: 13455 -> 13457 (0.01%)
uniforms in affected programs:     3 -> 5 (66.67%)
total instructions in shared programs: 40296 -> 40198 (-0.24%)
instructions in affected programs:     12595 -> 12497 (-0.78%)

9 years agor200: Drop unused variable.
Eric Anholt [Wed, 11 Feb 2015 22:55:42 +0000 (14:55 -0800)]
r200: Drop unused variable.

Quiets compiler warning since e7f2f2dea5acdbd1a12ed88914e64a38a97432f0.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
9 years agoi965: Quiet another compiler warning about uninitialized values.
Eric Anholt [Wed, 11 Feb 2015 22:54:33 +0000 (14:54 -0800)]
i965: Quiet another compiler warning about uninitialized values.

The compiler can't tell that we're always going to hit the first if block
on the first time through the loop.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965: Move some asserts to unreachable.
Eric Anholt [Wed, 11 Feb 2015 22:53:08 +0000 (14:53 -0800)]
i965: Move some asserts to unreachable.

If execution was supposed to be supported in this case, we'd run into
trouble from completely uninitialized sat_imm values.

v2: Drop the '!' before the string.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoi965: Shut up a compiler warning about uninitialized var.
Eric Anholt [Wed, 11 Feb 2015 22:50:35 +0000 (14:50 -0800)]
i965: Shut up a compiler warning about uninitialized var.

We always pass this argument, even if it won't be used by the particular
texture op.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
9 years agoRevert use of Mesa IR optimizer for ARB_fragment_programs
Carl Worth [Thu, 12 Feb 2015 18:14:24 +0000 (10:14 -0800)]
Revert use of Mesa IR optimizer for ARB_fragment_programs

Commit f82f2fb3dc770902f1657ab1c22e6004faa3afab added use of the Mesa
IR optimizer for both ARB_fragment_program and ARB_vertex_program, but
only justified the vertex-program portions with measured performance
improvements.

Meanwhile, the optimizer was seen to generate hundreds of unused
immediates without discarding them, causing failures.

Discard the use of the optimizer for now to fix the regression. (In
the future, we anticpate things moving from Mesa IR to NIR for better
optimization anyway.)

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

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
CC: "10.3 10.4 10.5" <mesa-stable@lists.freedesktop.org>
9 years agoutil/u_atomic: Use lower-case variables in _Interlocked* helpers.
Jose Fonseca [Thu, 12 Feb 2015 19:31:20 +0000 (19:31 +0000)]
util/u_atomic: Use lower-case variables in _Interlocked* helpers.

9 years agoutil/u_atomic: Add _InterlockedExchangeAdd8/16 for older MSVC.
Jose Fonseca [Wed, 11 Feb 2015 15:30:39 +0000 (15:30 +0000)]
util/u_atomic: Add _InterlockedExchangeAdd8/16 for older MSVC.

We need to build certain parts of Mesa (namely gallium, llvmpipe, and
therefore util) with Windows SDK 7.0.7600, which includes MSVC 2008.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agoutil/u_atomic: Test p_atomic_add() for 8bit integers.
Jose Fonseca [Wed, 11 Feb 2015 15:21:25 +0000 (15:21 +0000)]
util/u_atomic: Test p_atomic_add() for 8bit integers.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
9 years agodocs: add ARB_draw_indirect to ES 3.1 list
Ilia Mirkin [Thu, 12 Feb 2015 11:16:27 +0000 (06:16 -0500)]
docs: add ARB_draw_indirect to ES 3.1 list

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>