platform/upstream/mesa.git
7 years agogallium: correctly manage libsensors link flags
Emil Velikov [Thu, 8 Dec 2016 17:58:21 +0000 (17:58 +0000)]
gallium: correctly manage libsensors link flags

We should be using LIBS rather than the LDFLAGS variable. Furthermore
try to keep the linking to the final stage, rather than intermetent
static library.

Cc: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoegl/wayland: unify dri2_wl_create_surface implementations
Emil Velikov [Mon, 28 Nov 2016 18:25:19 +0000 (18:25 +0000)]
egl/wayland: unify dri2_wl_create_surface implementations

Rather than having two almost identical codepaths (one for HW/wl_drm and
another for SW/wl_shm), just factorise and reuse in both places.

v2: Rebase
v3: Rebase

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com> (v2)
7 years agoegl/wayland: use the destroy_window_callback for swrast
Emil Velikov [Mon, 28 Nov 2016 18:25:18 +0000 (18:25 +0000)]
egl/wayland: use the destroy_window_callback for swrast

As described in commit 690ead4a135 ("egl/wayland-egl: Fix for segfault
in dri2_wl_destroy_surface.") if we attempt to destroy a EGL surface
attached to already destroyed Wayland window we'll get a segfault.

v2: set the correct callback alongside the window->private. (Dan)

Cc: Daniel Stone <daniels@collabora.com>
Cc: "12.0 13.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
7 years agoglx: unify GLX_SGIX_pbuffer aliased declarations
Emil Velikov [Mon, 5 Dec 2016 19:52:45 +0000 (19:52 +0000)]
glx: unify GLX_SGIX_pbuffer aliased declarations

No point in having an identical code in two places.

Not to mention that the Apple one incorrectly uses GLXDrawable as pbuf
type. This change is both API and ABI safe since the header uses the
correct GLXPbufferSGIX and both types are a typedef of the same
primitive XID.

Cc: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jeremy Sequoia <jeremyhu@apple.com>
7 years agoglx: use GLX_ALIAS for glXGetProcAddress
Emil Velikov [Mon, 5 Dec 2016 19:52:44 +0000 (19:52 +0000)]
glx: use GLX_ALIAS for glXGetProcAddress

Use the macro, rather than open-coding it.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa: make use of HAVE_FUNC_ATTRIBUTE_ALIAS macro
Emil Velikov [Mon, 5 Dec 2016 19:52:43 +0000 (19:52 +0000)]
mesa: make use of HAVE_FUNC_ATTRIBUTE_ALIAS macro

We must make sure that xserver has an equivalent one-line
change to its configure.ac as the glx/glapi headers get copied over.

Then again, xserver does _not_ seem to set HAVE_ALIAS to begin with so
one might want to look into that first.

Cc: Adam Jackson <ajax@redhat.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoandroid: set HAVE_FUNC_ATTRIBUTE_ALIAS
Emil Velikov [Mon, 5 Dec 2016 19:52:42 +0000 (19:52 +0000)]
android: set HAVE_FUNC_ATTRIBUTE_ALIAS

Analogous to previous two commits.

Strictly speaking it's not be applicable for Android since we don't
build GLX and related code.

Regardless keep things consistent with the other build systems.

Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoscons: set HAVE_FUNC_ATTRIBUTE_ALIAS
Emil Velikov [Mon, 5 Dec 2016 19:52:41 +0000 (19:52 +0000)]
scons: set HAVE_FUNC_ATTRIBUTE_ALIAS

Analogoust to the previous commit were we did so for autotools

Cc: Jose Fonseca <jfonseca@vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
7 years agoconfigure: use standard check for attribure alias
Emil Velikov [Mon, 5 Dec 2016 19:52:40 +0000 (19:52 +0000)]
configure: use standard check for attribure alias

Currently we have two macros - HAVE_ALIAS and GLX_ALIAS_UNSUPPORTED.
To make it even better former of which is explicitly cleared in some
cases while not in others.

Clear all that up by using a single macro properly set during configure.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoglx: remove always false ifdef GLX_NO_STATIC_EXTENSION_FUNCTIONS
Emil Velikov [Mon, 5 Dec 2016 19:52:39 +0000 (19:52 +0000)]
glx: remove always false ifdef GLX_NO_STATIC_EXTENSION_FUNCTIONS

Quick search through git history (of both mesa and xserver) hows no
instances where this was ever set.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoetnaviv: Fake occlusion query capability
Wladimir J. van der Laan [Mon, 5 Dec 2016 12:43:55 +0000 (13:43 +0100)]
etnaviv: Fake occlusion query capability

This enables the PIPE_CAP_OCCLUSION_QUERY capability without adding an
occlusion query type.

This is necessary to get Mesa to report desktop GL 2.0 support (to run
exciting things such as ioq3's OpenGL 2 renderer), and should be valid
because exposing the capability does not guarantee that any
counters are actually implemented.

Signed-off-by: Wladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agoetnaviv: add flags parameter to texture barrier
Christian Gmeiner [Wed, 18 Jan 2017 15:15:01 +0000 (16:15 +0100)]
etnaviv: add flags parameter to texture barrier

Fixes compile warning introduced by commit a1c848.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agoetnaviv: handle PIPE_CAP_TGSI_FS_FBFETCH
Christian Gmeiner [Wed, 18 Jan 2017 15:12:12 +0000 (16:12 +0100)]
etnaviv: handle PIPE_CAP_TGSI_FS_FBFETCH

Fixes compile warning introduced by commit ee3ebe.

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
7 years agogallivm: (trivial) fix copy/paste bug with big endian code
Roland Scheidegger [Wed, 18 Jan 2017 15:30:50 +0000 (16:30 +0100)]
gallivm: (trivial) fix copy/paste bug with big endian code

8bd67a35c50e68c21aed043de11e095c284d151a introduced using undefined variable
on big endian archs due to copy/paste bug.
(compile hack tested only)

7 years agoconfigure.ac: Revert recent HAVE_LLVM changes.
Jose Fonseca [Wed, 18 Jan 2017 14:42:47 +0000 (14:42 +0000)]
configure.ac: Revert recent HAVE_LLVM changes.

This reverts changes 903eb09b5fb78d47d0f8a4bdf826a113ca2aff40..1a0aa468f354f0ee94dd383cd40ae915584624aa:

  Tobias Droste (5):
    configure.ac: Rename MESA_LLVM to FOUND_LLVM
    configure.ac: Only set LLVM_LIBS if LLVM is used
    configure.ac: Only define HAVE_LLVM if LLVM is used
    configure.ac: Set and use HAVE_GALLIUM_LLVM define
    configure.ac: Don't check LLVM version in gallium_require_llvm

They break scons build, and I'm not convinced this is the right fix.  In
particular changing HAVE_LLVM in the C code is something I'd rather
avoid no matter what.  So it's better to discuss without the pressure of
broken builds.

7 years agodocs: Fix GLSL compiler link
Elie TOURNIER [Wed, 18 Jan 2017 13:50:11 +0000 (13:50 +0000)]
docs: Fix GLSL compiler link

The doc wasn't update since we moved the glsl compiler to src/compiler/glsl.
I also updated the description of the standalone compiler.

v2:
 - Mention that just-log argument removes headers/separators.
 - Mention that version argument is mandatory.
Since version argument is mandatory, add --version to the command line
example.

Signed-off-by: Elie Tournier <tournier.elie@gmail.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
7 years agovulkan: automake: do not use EXTRA_DIST in a conditional
Emil Velikov [Tue, 17 Jan 2017 19:48:37 +0000 (19:48 +0000)]
vulkan: automake: do not use EXTRA_DIST in a conditional

Otherwise the file might not end up in the tarball.

Fixes: dbd677efb42 "vulkan: add API registry"
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure.ac: Respect LLVM_CFLAGS in LLVM version detection
Tomasz Figa [Wed, 14 Dec 2016 08:00:27 +0000 (17:00 +0900)]
configure.ac: Respect LLVM_CFLAGS in LLVM version detection

When compiling LLVM headers, including llvm-config.h, we need to respect
LLVM_CFLAGS. This is especially crucial if LLVM is located in a
non-standard location and it happens that llvm-config.h includes another
header. In such case the detection would fail due to missing header,
because the path is provided in LLVM_CFLAGS.

Let's add LLVM_CFLAGS to global CFLAGS for the time of detection and then
restore the original flags, as done in other places of the script.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure.ac: Don't check LLVM version in gallium_require_llvm
Tobias Droste [Thu, 8 Dec 2016 02:03:40 +0000 (03:03 +0100)]
configure.ac: Don't check LLVM version in gallium_require_llvm

This is actually not needed because the version is checked later.

Line 2609:
if test "x$enable_gallium_llvm" == "xyes"; then
    llvm_require_version $LLVM_REQUIRED_GALLIUM "gallium"
    llvm_add_default_components "gallium"

    HAVE_GALLIUM_LLVM=xyes
    DEFINES="${DEFINES} -DHAVE_GALLIUM_LLVM"
fi

Signed-off-by: Tobias Droste <tdroste@gmx.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure.ac: Set and use HAVE_GALLIUM_LLVM define
Tobias Droste [Thu, 8 Dec 2016 02:03:38 +0000 (03:03 +0100)]
configure.ac: Set and use HAVE_GALLIUM_LLVM define

Gallium code used HAVE_LLVM to check if it needs to compile code for
LLVM in header and source files.

With the new logic HAVE_LLVM is always set. Use extra define to figure
out if LLVM is used.

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

Signed-off-by: Tobias Droste <tdroste@gmx.de>
7 years agoconfigure.ac: Only define HAVE_LLVM if LLVM is used
Tobias Droste [Thu, 8 Dec 2016 02:03:37 +0000 (03:03 +0100)]
configure.ac: Only define HAVE_LLVM if LLVM is used

Make sure that HAVE_LLVM compiler define is only set if LLVM is
actually used.

Signed-off-by: Tobias Droste <tdroste@gmx.de>
v2 [Emil] fold within the existing conditional
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoconfigure.ac: Only set LLVM_LIBS if LLVM is used
Tobias Droste [Thu, 8 Dec 2016 02:03:36 +0000 (03:03 +0100)]
configure.ac: Only set LLVM_LIBS if LLVM is used

This renames llvm_check_version_for to llvm_require_version and let it
set a variable to mark that LLVM will be used.

Use this to make a usefull configure output and to only check if the
libs are found in LLVM if it is actually used.

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

Signed-off-by: Tobias Droste <tdroste@gmx.de>
7 years agoconfigure.ac: Rename MESA_LLVM to FOUND_LLVM
Tobias Droste [Thu, 8 Dec 2016 02:03:35 +0000 (03:03 +0100)]
configure.ac: Rename MESA_LLVM to FOUND_LLVM

This renames MESA_LLVM to FOUND_LLVM and updates the config.log report
to say if LLVM is found or not, to make clear that this does not mean
that it is used.

There are no MESA_LLVM users so drop the AC_SUBST.

v2 [Emil]
 - Polish test: -a over && test, = over ==, unquiote xyes
 - other ?

Signed-off-by: Tobias Droste <tdroste@gmx.de>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agogallivm: Cleanup USE_MCJIT.
Jose Fonseca [Mon, 16 Jan 2017 14:19:36 +0000 (14:19 +0000)]
gallivm: Cleanup USE_MCJIT.

Split USE_MCJIT macro dual nature into a separate constant time define
and a run-time variable.

Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi965: Don't map/unmap in brw_print_program_cache on LLC platforms.
Kenneth Graunke [Sat, 12 Nov 2016 02:05:14 +0000 (18:05 -0800)]
i965: Don't map/unmap in brw_print_program_cache on LLC platforms.

We have a persistent mapping.  Don't map it a second time or try to
unmap it.  Just use the pointer.

This most likely would wreak havoc except that this code is unused
(it's only called from an if (0) debug block).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
7 years agoi965: Move program cache printing to brw_program_cache.c.
Kenneth Graunke [Fri, 11 Nov 2016 22:47:53 +0000 (14:47 -0800)]
i965: Move program cache printing to brw_program_cache.c.

It makes sense to put a function which prints out the entire contents
of the program cache in the file that implements the program cache.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
7 years agoi965: Make a helper for finding an existing shader variant.
Kenneth Graunke [Fri, 11 Nov 2016 21:31:06 +0000 (13:31 -0800)]
i965: Make a helper for finding an existing shader variant.

We had five copies of the same "walk the cache and look for an
existing shader variant for this program" code.  Now we have one
helper function that returns the key.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eduardo Lima Mitev <elima@igalia.com>
7 years agoglsl: Make copy propagation not panic when it sees an intrinsic.
Kenneth Graunke [Sat, 10 Dec 2016 03:06:06 +0000 (19:06 -0800)]
glsl: Make copy propagation not panic when it sees an intrinsic.

A number of games have large arrays of constants, which we promote to
uniforms.  This introduces copies from the uniform array to the original
temporary array.  Normally, copy propagation eliminates those copies,
making everything refer to the uniform array directly.

A number of shaders in "Deus Ex: Mankind Divided" recently exposed a
limitation of copy propagation - if we had any intrinsics (i.e. image
access in a compute shader), we weren't able to get rid of these copies.

That meant that any variable indexing remained on the temporary array
rather being moved to the uniform array.  i965's scalar backend
currently doesn't support indirect addressing of temporary arrays,
which meant lowering it to if-ladders.  This was horrible.

According to Marek, on radeonsi/GCN, "F1 2015" uses 64% less
spilled-temp-array memory.

On i965/Skylake:

total instructions in shared programs: 13362954 -> 13329878 (-0.25%)
instructions in affected programs: 43745 -> 10669 (-75.61%)
helped: 12
HURT: 0

total cycles in shared programs: 248081010 -> 245949178 (-0.86%)
cycles in affected programs: 4597930 -> 2466098 (-46.37%)
helped: 12
HURT: 0

total spills in shared programs: 9493 -> 9507 (0.15%)
spills in affected programs: 25 -> 39 (56.00%)
helped: 0
HURT: 1

total fills in shared programs: 12127 -> 12197 (0.58%)
fills in affected programs: 110 -> 180 (63.64%)
helped: 0
HURT: 1

Helps Deus Ex: Mankind Divided.   The one shader with hurt spills/fills
is from Tomb Raider at Ultra settings, but that same shader has a
-39.55% reduction in instructions and -14.09% reduction in cycle counts,
so it seems like a win there as well.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Make DCE set null destinations on messages with side effects.
Kenneth Graunke [Sun, 15 Jan 2017 07:32:12 +0000 (23:32 -0800)]
i965: Make DCE set null destinations on messages with side effects.

(Co-authored by Matt Turner.)

Image atomics, for example, return a value - but the shader may not
want to use it.  We assigned a useless VGRF destination.  This seemed
harmless, but it can actually be quite harmful.  The register allocator
has to assign that VGRF to a real register.  It may assign the same
actual GRF to the destination of an instruction that follows soon after.

This results in a write-after-write (WAW) dependency, and stall.

A number of "Deus Ex: Mankind Divided" shaders use image atomics, but
don't use the return value.  Several of these were hitting WAW stalls
for nearly 14,000 (poorly estimated) cycles a pop.  Making dead code
elimination null out the destination avoids this issue.

This patch cuts one shader's estimated cycles by -98.39%!  Removing the
message response should also help with data cluster bandwidth.

On Skylake:

(instruction counts remain identical)

total cycles in shared programs: 255413890 -> 248081010 (-2.87%)
cycles in affected programs: 12019948 -> 4687068 (-61.01%)
helped: 24
HURT: 10

v2: Make can_omit_write independent of can_eliminate (Curro).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Combine some dead code elimination NOP'ing code.
Kenneth Graunke [Thu, 15 Dec 2016 01:56:35 +0000 (17:56 -0800)]
i965: Combine some dead code elimination NOP'ing code.

In theory we might have incorrectly NOP'd instructions that write the
flag, but where that flag value isn't used, and yet the instruction
either writes the accumulator or has side effects.

I don't believe any such instructions exist, so this is mostly a
code cleanup.

Curro pointed out that FS_OPCODE_FB_WRITE has a null destination and
actually writes the flag on Gen4-5 to dynamically decide whether to
write some payload data.  The hunk removed in this patch might have
NOP'd it, except that we don't actually mark flags_written() in the
IR, so it doesn't think the flag is touched at all.  That's sketchy,
but it means it wouldn't hit this today (though there are likely other
problems!).

v2: Properly replace the inst->regs_written() check in the second
    hunk with the flag being live (mistake caught by Curro).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Make DCE explicitly not eliminate any control flow instructions.
Kenneth Graunke [Wed, 18 Jan 2017 03:15:50 +0000 (19:15 -0800)]
i965: Make DCE explicitly not eliminate any control flow instructions.

According to Matt, the dead code pass explicitly avoided IF and WHILE
because on Sandybridge, these could have conditional modifiers and
null destination registers.  Normally, those instructions use BAD_FILE
for the destination register.  Nowadays, we don't do that anymore, so
we could technically drop these checks.

However, it's clearer to explicitly leave control flow instructions
alone, so change it to the more generic !inst->is_control_flow().

This should have no actual change.

[This patch implements review feedback from Curro and Matt.]

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoradv: disable vertex reuse when writing viewport index
Dave Airlie [Tue, 17 Jan 2017 20:26:31 +0000 (06:26 +1000)]
radv: disable vertex reuse when writing viewport index

This fixes some issues we'd hit later if using viewport
indexes.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: add support for layered clears (v2)
Dave Airlie [Tue, 17 Jan 2017 00:05:07 +0000 (10:05 +1000)]
radv: add support for layered clears (v2)

Just always use the layer clear pipelines,
the overhead of emitting the layer shouldn't be
too large.

v2: Bas suggested we always use it.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/ac: split part of llvm compile into a separate function
Dave Airlie [Mon, 16 Jan 2017 22:41:03 +0000 (08:41 +1000)]
radv/ac: split part of llvm compile into a separate function

This is needed to have common code for gs copy shader emission.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/ac: switch an if to switch
Dave Airlie [Mon, 16 Jan 2017 22:38:14 +0000 (08:38 +1000)]
radv/ac: switch an if to switch

makes it easier to add other shader stages.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: add support for writing layer/viewport index (v2)
Dave Airlie [Mon, 16 Jan 2017 21:04:52 +0000 (07:04 +1000)]
radv: add support for writing layer/viewport index (v2)

This just adds the infrastructure to allow writing layer
and viewport index. It's just a first patch out of the geom
shader tree, and doesn't do much on its own.

v2: add missing if statement change (Bas)

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoac/debug: Decrease num_dw for type 2 NOP's.
Bas Nieuwenhuizen [Sun, 15 Jan 2017 22:01:03 +0000 (23:01 +0100)]
ac/debug: Decrease num_dw for type 2 NOP's.

Otherwise we read past the end of the buffer.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: for the tess barrier, only use emit_waitcnt on SI and LLVM 3.9+
Marek Olšák [Tue, 17 Jan 2017 12:45:42 +0000 (13:45 +0100)]
radeonsi: for the tess barrier, only use emit_waitcnt on SI and LLVM 3.9+

Cc: 17.0 13.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/vdpau: remove the delayed rendering hack(v1.1)
Nayan Deshmukh [Wed, 11 Jan 2017 16:57:15 +0000 (22:27 +0530)]
st/vdpau: remove the delayed rendering hack(v1.1)

the hack was introduced to avoid an extra copying
but now with dri3 we don't need it anymore

v1.1: rebasing

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Acked-by: Christian König <christian.koenig@amd.com>
7 years agost/vdpau: use dri3 to directly send the buffer to X(v2)
Nayan Deshmukh [Wed, 11 Jan 2017 16:57:14 +0000 (22:27 +0530)]
st/vdpau: use dri3 to directly send the buffer to X(v2)

this avoids an extra copy which occurs in case of dri2

v1.1: fallback to dri2 if dri3 fails to initialize
v2: add PIPE_BIND_SCANOUT to output buffers as they will
    be send to X server directly (Michel)

Suggested-by: Christian König <christian.koenig@amd.com>
Tested-by: Andy Furniss <adf.lists@gmail.com>
Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
7 years agovl/dri3: use external texture as back buffers(v4)
Nayan Deshmukh [Wed, 11 Jan 2017 16:57:13 +0000 (22:27 +0530)]
vl/dri3: use external texture as back buffers(v4)

dri3 allows us to send handle of a texture directly to X
so this patch allows a state tracker to directly send its
texture to X to be used as back buffer and avoids extra
copying

v2: use clip width/height to display a portion of the surface
v3: remove redundant variables, fix wrapping, rename variables
    handle vaapi path
v3.1: we need clip_width/height for every frame so we don't need
      to maintain it for each buffer instead use a global variable
v4: In case of single gpu we can cache the buffers as applications
    use constant number of buffer and we can avoid calls to present
    extension for every frame

Reviewed and Suggested-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Tested-by: Andy Furniss <adf.lists@gmail.com>
Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
7 years agoanv: set UAV coherence required bit when needed
Iago Toral Quiroga [Mon, 16 Jan 2017 10:51:50 +0000 (11:51 +0100)]
anv: set UAV coherence required bit when needed

The same we do in the OpenGL driver (comment copied from there).

This is required to ensure that we execute the fragment shader stage when
side-effects (such as image or ssbo stores) are present but there are no
color writes.

I found this while writing a test to check rendering to a framebuffer
without attachments where the fragment shader does not produce any
color outputs but writes to an image via imageStore(). Without this patch
the fragment shader does not execute and the image is not written,
which is not correct.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv: increase ANV_MAX_STATE_SIZE_LOG2 limit to 1 MB
Samuel Iglesias Gonsálvez [Tue, 10 Jan 2017 11:44:32 +0000 (12:44 +0100)]
anv: increase ANV_MAX_STATE_SIZE_LOG2 limit to 1 MB

Fixes crash in dEQP-VK.ubo.random.all_shared_buffer.48 due to a
fragment shader code bigger than 128 kB.

This patch increases the allocation size limit to 1 MB.

v2:
- Increase it to 1 MB (Jason)
- Increase device->instruction_block_pool allocation size in
  anv_device.c (Jason)

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agonv50/ir: optimize shl + and
Ilia Mirkin [Fri, 13 Jan 2017 05:41:11 +0000 (00:41 -0500)]
nv50/ir: optimize shl + and

Address loading can often end up as shl + shr + shl combinations. The
latter two are equal shifts, which get converted into an and mask.
However if the previous shl is more than the mask is trying to remove
(in terms of low bits), we can just remove the and entirely. This
reduces some large shaders by as many as 3% of instructions (out of 2K).

total instructions in shared programs : 6495509 -> 6491076 (-0.07%)
total gprs used in shared programs    : 954621 -> 954623 (0.00%)

                local        gpr       inst      bytes
    helped           0           0        1014        1014
      hurt           0           2           0           0

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonvc0: enable FBFETCH with a special slot for color buffer 0
Ilia Mirkin [Mon, 2 Jan 2017 05:48:51 +0000 (00:48 -0500)]
nvc0: enable FBFETCH with a special slot for color buffer 0

We don't need to support all the color buffers for advanced blend, just
cb0. For Fermi, we use the special binding slots so that we don't
overlap with user textures, while Kepler+ gets a dedicated position for
the fb handle in the driver constbuf.

This logic is only triggered when a FBFETCH is actually present so it
should be a no-op most of the time.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agost/mesa: add support for advanced blend when fb can be fetched from
Ilia Mirkin [Mon, 2 Jan 2017 04:47:25 +0000 (23:47 -0500)]
st/mesa: add support for advanced blend when fb can be fetched from

This implements support for emitting FBFETCH ops, using the existing
lowering pass for advanced blend logic, and disabling hw blend when
advanced blending is enabled.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium: add flags parameter to texture barrier
Ilia Mirkin [Mon, 2 Jan 2017 04:42:17 +0000 (23:42 -0500)]
gallium: add flags parameter to texture barrier

This is so that we can differentiate between flushing any framebuffer
reading caches from regular sampler caches.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium: add PIPE_CAP_TGSI_FS_FBFETCH
Ilia Mirkin [Mon, 2 Jan 2017 04:10:00 +0000 (23:10 -0500)]
gallium: add PIPE_CAP_TGSI_FS_FBFETCH

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium: add FBFETCH opcode to retrieve the current sample value
Ilia Mirkin [Mon, 2 Jan 2017 04:02:06 +0000 (23:02 -0500)]
gallium: add FBFETCH opcode to retrieve the current sample value

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agomesa: allow BlendBarrier to be used without support for full fb fetch
Ilia Mirkin [Mon, 2 Jan 2017 04:44:25 +0000 (23:44 -0500)]
mesa: allow BlendBarrier to be used without support for full fb fetch

The extension spec is not currently published, so it's a bit premature
to require it for BlendBarrier usage.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: avoid treating fb fetches as output reads to be lowered
Ilia Mirkin [Mon, 2 Jan 2017 04:00:46 +0000 (23:00 -0500)]
glsl: avoid treating fb fetches as output reads to be lowered

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradv/meta: split color renderpass creation out.
Dave Airlie [Mon, 16 Jan 2017 20:44:14 +0000 (06:44 +1000)]
radv/meta: split color renderpass creation out.

This is just prep work for layered clears, it doesn't change
anything.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Support multiple devices.
Bas Nieuwenhuizen [Mon, 16 Jan 2017 20:25:10 +0000 (21:25 +0100)]
radv: Support multiple devices.

Pretty straightforward. Also deleted the big comment block as it
is a pretty standard pattern for filling in arrays.

Also removed the error message on non-existent devices, as getting
7 errors printed to the console each time you enumerate the
devices is pretty confusing.

v2: Add constant for number of DRM devices.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: Get physical device from radv_device instead of the instance.
Bas Nieuwenhuizen [Mon, 16 Jan 2017 20:23:48 +0000 (21:23 +0100)]
radv: Get physical device from radv_device instead of the instance.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
7 years agonvc0: true up exposing of the HW_METRIC_QUERY_GROUP for maxwell
Ilia Mirkin [Sun, 15 Jan 2017 18:19:04 +0000 (13:19 -0500)]
nvc0: true up exposing of the HW_METRIC_QUERY_GROUP for maxwell

This had been updated in one place but not the other.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
7 years agoradv/ac: use ctx->voidt in more places. (v2)
Dave Airlie [Mon, 16 Jan 2017 20:48:23 +0000 (06:48 +1000)]
radv/ac: use ctx->voidt in more places. (v2)

Just noticed this while in the area.

v2: one replacement was incorrect.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/meta: consolidate the depth stencil clear renderpasses
Dave Airlie [Mon, 16 Jan 2017 20:37:36 +0000 (06:37 +1000)]
radv/meta: consolidate the depth stencil clear renderpasses

We only need one per samples (maybe not even that), reduce
all the unneeded ones.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agonv50/ir: handle new DDIV op which will be used for double divisions
Ilia Mirkin [Mon, 16 Jan 2017 19:25:15 +0000 (14:25 -0500)]
nv50/ir: handle new DDIV op which will be used for double divisions

The existing lowering is in place to lower that to RCP + MUL, or fancier
things down the line if necessary.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agotgsi: add DDIV instruction
Nicolai Hähnle [Mon, 16 Jan 2017 15:40:41 +0000 (16:40 +0100)]
tgsi: add DDIV instruction

Double-precision division, to allow more precision than a DRCP + DMUL
sequence.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeonsi: fix R600_DEBUG=nooptvariant
Nicolai Hähnle [Mon, 16 Jan 2017 15:44:08 +0000 (16:44 +0100)]
radeonsi: fix R600_DEBUG=nooptvariant

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Vedran Miletić <vedran@miletic.net>
7 years agoi965: Make BLORP disable the NP Z PMA stall fix.
Kenneth Graunke [Sun, 15 Jan 2017 00:23:10 +0000 (16:23 -0800)]
i965: Make BLORP disable the NP Z PMA stall fix.

This may fix GPU hangs on Gen8.  I don't know if it does though.

Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Enable OpenGL 4.5 on Haswell.
Kenneth Graunke [Sat, 14 Jan 2017 06:53:34 +0000 (22:53 -0800)]
i965: Enable OpenGL 4.5 on Haswell.

Everything is in place and the test results look solid.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
7 years agoradeonsi: implement GL_FIXED vertex format
Marek Olšák [Fri, 6 Jan 2017 00:16:44 +0000 (01:16 +0100)]
radeonsi: implement GL_FIXED vertex format

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: implement 32-bit SNORM/UNORM/SSCALED/USCALED vertex formats
Marek Olšák [Thu, 5 Jan 2017 23:30:12 +0000 (00:30 +0100)]
radeonsi: implement 32-bit SNORM/UNORM/SSCALED/USCALED vertex formats

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: make fix_fetch 64-bit
Marek Olšák [Thu, 5 Jan 2017 23:07:21 +0000 (00:07 +0100)]
radeonsi: make fix_fetch 64-bit

v2: add u_bit_consecutive64

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/hud: avoid buffer overrun
Thomas Hindoe Paaboel Andersen [Sat, 14 Jan 2017 23:28:54 +0000 (00:28 +0100)]
gallium/hud: avoid buffer overrun

Renaming data sources was added in
e8bb97ce30051b999a4a69c9b27884daeb8d71e6
It was possible to use a new name longer than
the name array in hud_graph of 128. This
patch truncates the name to fit the array.

CC: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
7 years agogallium/radeon: add GPU-shaders-busy HUD query
Marek Olšák [Sun, 15 Jan 2017 22:59:00 +0000 (23:59 +0100)]
gallium/radeon: add GPU-shaders-busy HUD query

It should be close to the GPU load, but it can be much lower if something
is stalling shader execution (e.g. CP DMA).

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/radeon: make the GPU load / GRBM_STATUS monitoring extensible
Marek Olšák [Sun, 15 Jan 2017 22:51:29 +0000 (23:51 +0100)]
gallium/radeon: make the GPU load / GRBM_STATUS monitoring extensible

The next patch will add SPI_BUSY monitoring.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoradeonsi: show average results per frame for perf counters in HUD
Marek Olšák [Sun, 15 Jan 2017 20:50:54 +0000 (21:50 +0100)]
radeonsi: show average results per frame for perf counters in HUD

so that the graphs are independent from FPS.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/hud: disable queries during HUD draw calls
Marek Olšák [Sun, 15 Jan 2017 21:28:15 +0000 (22:28 +0100)]
gallium/hud: disable queries during HUD draw calls

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agogallium/hud: increase the vertex buffer size for background quads
Marek Olšák [Sun, 15 Jan 2017 21:01:39 +0000 (22:01 +0100)]
gallium/hud: increase the vertex buffer size for background quads

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agost/va: delay calling begin_frame until we have all parameters
Nayan Deshmukh [Fri, 13 Jan 2017 13:15:31 +0000 (18:45 +0530)]
st/va: delay calling begin_frame until we have all parameters

If begin_frame is called before setting intra_matrix and
non_intra_matrix it leads to segmentation faults when
vl_mpeg12_decoder.c is used.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92634
Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
7 years agoi965: Use align1 mode for barrier messages.
Kenneth Graunke [Sun, 15 Jan 2017 08:58:20 +0000 (00:58 -0800)]
i965: Use align1 mode for barrier messages.

In commit 7428e6f86ab5 we switched the barrier SEND message's
destination type to UW to avoid problems in SIMD16 compute shaders.

Tessellation control shaders also use barriers, and in vec4 mode, we
were emitting them in align16 mode.  The simulator warns that only UD,
D, F, and DF are valid destination types - UW is technically illegal.

So, switch to align1 mode.  Either mode should work fine.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agonvc0/ir: emit FMZ flag when requested on FFMA
Ilia Mirkin [Sun, 15 Jan 2017 17:15:06 +0000 (12:15 -0500)]
nvc0/ir: emit FMZ flag when requested on FFMA

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
7 years agonir/gcm: fix a bug with metadata handling
Connor Abbott [Sat, 14 Jan 2017 23:08:11 +0000 (18:08 -0500)]
nir/gcm: fix a bug with metadata handling

We were using impl->num_blocks, but that isn't guaranteed to be
up-to-date until after the block_index metadata is required. If we were
unlucky, this could lead to overwriting memory.

Noticed by inspection.

Signed-off-by: Connor Abbott <cwabbott0@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoradv: generate entrypoints from vk.xml
Lionel Landwerlin [Thu, 12 Jan 2017 18:56:24 +0000 (18:56 +0000)]
radv: generate entrypoints from vk.xml

v2: rework entry point iteration (Jason)
    cleanup unused imports

v3: don't drop header installation (Emil)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoanv: generate entry points from vk.xml
Lionel Landwerlin [Thu, 12 Jan 2017 17:02:04 +0000 (17:02 +0000)]
anv: generate entry points from vk.xml

v2: rework entry point iteration (Jason)
    cleanup unused imports

v3: don't drop header installation (Emil)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agovulkan: add API registry
Lionel Landwerlin [Thu, 12 Jan 2017 17:01:44 +0000 (17:01 +0000)]
vulkan: add API registry

Signed-off: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoinclude: update Vulkan headers
Lionel Landwerlin [Thu, 12 Jan 2017 15:57:14 +0000 (15:57 +0000)]
include: update Vulkan headers

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoradv: make device extension setup dynamic
Andres Rodriguez [Fri, 13 Jan 2017 23:44:17 +0000 (18:44 -0500)]
radv: make device extension setup dynamic

Each physical device may have different extensions than one another.
Furthermore, depending on the software stack, some extensions may not be
accessible.

If an extension is conditional, it can be registered only when
necessary.

v2: removed unused function and fixed indentation

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: rename global extension properties structs
Andres Rodriguez [Fri, 13 Jan 2017 23:44:16 +0000 (18:44 -0500)]
radv: rename global extension properties structs

All extension arrays are global, but only one of them refers to instance
extensions.

The device extension array refers to extensions that are common across
all physical devices. This disctinction will be more imporant once we
have dynamic extension support for devices.

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agoradv: use a winsys context per-queue, instead of per device v2
Andres Rodriguez [Fri, 13 Jan 2017 23:44:15 +0000 (18:44 -0500)]
radv: use a winsys context per-queue, instead of per device v2

Queues are independent execution streams. The vulkan spec provides no
ordering guarantees for different queues.

By using a single context for all queues, we are forcing all commands
into an unecessary FIFO ordering.

This change is a preparation step to allow our-of-ordering scheduling of
certain work tasks.

v2: Fix a rebase error with radv_QueueSubmit() and trace_bo
Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
7 years agonir: optimise min/max fadd combos
Timothy Arceri [Thu, 12 Jan 2017 10:51:56 +0000 (21:51 +1100)]
nir: optimise min/max fadd combos

shader-db results BDW:

total instructions in shared programs: 13060410 -> 13060313 (-0.00%)
instructions in affected programs: 24533 -> 24436 (-0.40%)
helped: 88
HURT: 0

total cycles in shared programs: 256585692 -> 256586698 (0.00%)
cycles in affected programs: 647290 -> 648296 (0.16%)
helped: 35
HURT: 30

Reviewed-by: Matt Turner <mattst88@gmail.com>
7 years agoi965: Move Gen4-5 interpolation stuff to brw_wm_prog_data.
Kenneth Graunke [Fri, 13 Jan 2017 22:29:52 +0000 (14:29 -0800)]
i965: Move Gen4-5 interpolation stuff to brw_wm_prog_data.

This fixes glxgears rendering, which had surprisingly been broken since
late October!  Specifically, commit 91d61fbf7cb61a44adcaae51ee08ad0dd6b.

glxgears uses glShadeModel(GL_FLAT) when drawing the main portion of the
gears, then uses glShadeModel(GL_SMOOTH) for drawing the Gouraud-shaded
inner portion of the gears.  This results in the same fragment program
having two different state-dependent interpolation maps: one where
gl_Color is flat, and another where it's smooth.

The problem is that there's only one gen4_fragment_program, so it can't
store both.  Each FS compile would trash the last one.  But, the FS
compiles are cached, so the first one would store FLAT, and the second
would see a matching program in the cache and never bother to compile
one with SMOOTH.  (Clearing the program cache on every draw made it
render correctly.)

Instead, move it to brw_wm_prog_data, where we can keep a copy for
every specialization of the program.  The only downside is bloating
the structure a bit, but we can tighten that up a bit if we need to.
This also lets us kill gen4_fragment_program entirely!

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
7 years agoanv: remove some unused macros and functions
Grazvydas Ignotas [Fri, 13 Jan 2017 23:10:08 +0000 (01:10 +0200)]
anv: remove some unused macros and functions

VK_ICD_WSI_PLATFORM_MAX is used, but a duplicate from wsi_common.h .

Acked-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoanv: Default PointSize to 1.0 if not written by the shader
Jason Ekstrand [Fri, 13 Jan 2017 17:30:13 +0000 (09:30 -0800)]
anv: Default PointSize to 1.0 if not written by the shader

The Vulkan rules for point size are a bit whacky.  If you only have a
vertex shader and you use points, then you must write PointSize in your
vertex shader.  If you have a geometry or tessellation shader, then it's
dependent on the shaderTessellationAndGeometryPointSize device feature.
From the Vulkan 1.0.38 specification:

   "shaderTessellationAndGeometryPointSize indicates whether the
   PointSize built-in decoration is available in the tessellation
   control, tessellation evaluation, and geometry shader stages. If this
   feature is not enabled, members decorated with the PointSize built-in
   decoration must not be read from or written to and all points written
   from a tessellation or geometry shader will have a size of 1.0. This
   also indicates whether shader modules can declare the
   TessellationPointSize capability for tessellation control and
   evaluation shaders, or if the shader modules can declare the
   GeometryPointSize capability for geometry shaders. An implementation
   supporting this feature must also support one or both of the
   tessellationShader or geometryShader features."

In other words, if the feature is disbled (the client can disable
features!) then they don't write PointSize and we provide a 1.0 default
but if the feature is enabled, they do write PointSize and we use the
one they wrote in the shader.  There are at least two valid ways we can
implement this:

 1) Track whether or not shaderTessellationAndGeometryPointSize is
    enabled and set the 3DSTATE_SF bits based on that and what stages
    are enabled, ignoring the shader source.

 2) Just look at the last geometry stage VUE map and see if they wrote
    PointSize and set the 3DSTATE_SF accordingly.

The second solution is the easiest and the most robust against invalid
usage of the Vulkan API, so we choose to go with that one.

This fixes all of the dEQP-VK.tessellation.primitive_discard.*point_mode
tests.  The tests are also broken because they unconditionally enable
shaderTessellationAndGeometryPointSize if it's supported by the
implementation and then don't write PointSize in the evaluation shader.
However, since this is the "robust against invalid API usage" solution,
the tests happily pass. :-)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv/pipeline: Replace get_fs_input_map with get_last_vue_prog_data
Jason Ekstrand [Fri, 13 Jan 2017 01:07:08 +0000 (17:07 -0800)]
anv/pipeline: Replace get_fs_input_map with get_last_vue_prog_data

This lets us delete a helper from genX_pipeline.c

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoi965/vec4: Fix mapping attributes
Juan A. Suarez Romero [Fri, 13 Jan 2017 16:47:57 +0000 (17:47 +0100)]
i965/vec4: Fix mapping attributes

This patch reverts 57bab6708f2bbc1ab8a3d202e9a467963596d462, which was
causing issues with ILK and earlier VS programs.

1. brw_nir.c: Revert "i965/vec4/nir: vec4 also needs to remap vs attributes"

   Do not perform a remap in vec4 backend. Rather, do it later when
   setup attributes

2. brw_vec4.cpp: This fixes mapping ATTRx to proper GRFn.

Suggested-by: Kenneth Graunke <kenneth@whitecape.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99391
[jordan.l.justen@intel.com: merge Juan's two patches from bugzilla]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
7 years agoanv: Move nir_lower_wpos_center after dead variable elimination.
Kenneth Graunke [Wed, 11 Jan 2017 23:10:48 +0000 (15:10 -0800)]
anv: Move nir_lower_wpos_center after dead variable elimination.

When multiple shader stages exist in the same SPIR-V module, we compile
all entry points and their inputs/outputs, then dead code eliminate the
ones not related to the specific entry point later.

nir_lower_wpos_center was being run prior to eliminating those random
other variables, which made it trip up, thinking it found gl_FragCoord
when it actually found something else like gl_PerVertex[3].

Fixes dEQP-VK.spirv_assembly.instruction.graphics.module.same_module.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agoi965: Fix textureGather with RG32I/UI on Gen7.
Kenneth Graunke [Thu, 5 Jan 2017 10:51:38 +0000 (02:51 -0800)]
i965: Fix textureGather with RG32I/UI on Gen7.

According to the "Gather4 R32G32_FLOAT Bug" internal documentation
page, the R32G32_UINT and R32G32_SINT formats are affected by the
same bug as R32G32_FLOAT.  Applying the same workarounds should be
viable - apparently the R32G32_FLOAT_LD format shouldn't corrupt
integer data which is NaN or other sketchy floating point values.

One irritating caveat is that, because it's a FLOAT format, the
alpha channel or any set to SCS_ONE return 0x3f8 (1.0) rather than
integer 1.  So we need shader code to whack those channels to 1.

Fixes GL45-CTS.texture_gather.plain-gather-int-cube-rg on Haswell.

v2: Fix swizzle component zeroing (caught by Jordan Justen).

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
7 years agoradv: Support loader interface version 3.
Bas Nieuwenhuizen [Fri, 13 Jan 2017 07:55:59 +0000 (08:55 +0100)]
radv: Support loader interface version 3.

Port of 1e41d7f7b0855934744fe578ba4eae9209ee69f7:
"anv: Support loader interface version 3 (patch v2)"

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomesa/get: Remove unused extra_ARB_viewport_array
Boyan Ding [Mon, 9 Jan 2017 14:48:38 +0000 (22:48 +0800)]
mesa/get: Remove unused extra_ARB_viewport_array

Unused since 0a7691ee (mesa: Enable enums for OES_viewport_array).
Silence a warning of unused variable.

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoxlib: Unify the style of function pointer calls in structs
Boyan Ding [Wed, 25 Nov 2015 05:43:06 +0000 (13:43 +0800)]
xlib: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
[Emil Velikov: handle the final case in glXCreateContextAttribsARB]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoradeon: Unify the style of function pointer calls in structs
Boyan Ding [Wed, 25 Nov 2015 05:27:07 +0000 (13:27 +0800)]
radeon: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
[Emil Velikov: handle the all cases]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agonouveau: Unify the style of function pointer calls in structs
Boyan Ding [Wed, 25 Nov 2015 05:27:06 +0000 (13:27 +0800)]
nouveau: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
7 years agoglX_proto_send.py: Unify the style of function pointer calls in structs
Boyan Ding [Wed, 25 Nov 2015 05:27:05 +0000 (13:27 +0800)]
glX_proto_send.py: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
7 years agoloader/dri3: Unify the style of function pointer calls in structs
Boyan Ding [Wed, 25 Nov 2015 05:27:04 +0000 (13:27 +0800)]
loader/dri3: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
7 years agoegl/dri2: Unify the style of function pointer calls in structs
Boyan Ding [Wed, 25 Nov 2015 05:27:02 +0000 (13:27 +0800)]
egl/dri2: Unify the style of function pointer calls in structs

Signed-off-by: Boyan Ding <boyan.j.ding@gmail.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
[Emil Velikov: address platform_surfaceless]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoi915: Add XRGB8888 format to intel_screen_make_configs
Derek Foreman [Wed, 23 Nov 2016 23:01:43 +0000 (17:01 -0600)]
i915: Add XRGB8888 format to intel_screen_make_configs

This is a copy of commit 536003c11e4cb1172c540932ce3cce06f03bf44e
except for i915.

Original log for the i965 commit follows:

 Some application, such as drm backend of weston, uses XRGB8888 config as
 default. i965 doesn't provide this format, but before commit 65c8965d,
 the drm platform of EGL takes ARGB8888 as XRGB8888. Now that commit
 65c8965d makes EGL recognize format correctly so weston won't start
 because it can't find XRGB8888. Add XRGB8888 format to i965 just as
 other drivers do.

Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Acked-by: Boyan Ding <boyan.j.ding@gmail.com>
Tested-by: Mark Janes <mark.a.janes@intel.com>
7 years agogbm/drm: Pick the oldest available buffer in get_back_bo
Derek Foreman [Wed, 23 Nov 2016 22:40:42 +0000 (16:40 -0600)]
gbm/drm: Pick the oldest available buffer in get_back_bo

Applications may query the back buffer age to efficiently perform
partial updates. Generally the application will keep a fixed length
damage history, and use this to calculate what needs to be redrawn
based on the age of the back buffer it's about to render to.

If presented with a buffer that has an age greater than the
length of the damage history, the application will likely have
to completely repaint the buffer.

Our current buffer selection strategy is to pick the first available
buffer without considering its age.  If an application frequently
manages to fit within two buffers but occasionally requires a third,
this extra buffer will almost always be old enough to fall outside
of a reasonably long damage history, and require a full repaint.

This patch changes the buffer selection behaviour to prefer the oldest
available buffer.

By selecting the oldest available buffer, the application will likely
always be able to use its damage history, at a cost of having to
perform slightly more work every frame.  This is an improvement if
the cost of a full repaint is heavy, and the surface damage between
frames is relatively small.

It should be noted that since we don't currently trim our queue in
any way, an application that briefly needs a large number of buffers
will continue to receive older buffers than it would if it only ever
needed two buffers.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: Derek Foreman <derekf@osg.samsung.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>