platform/upstream/mesa.git
7 years agoegl/dri3: implement query surface hook
Brendan King [Fri, 17 Feb 2017 15:12:21 +0000 (15:12 +0000)]
egl/dri3: implement query surface hook

This is a DRI3 version of a change made for DRI2
(4d6d4f939e0af4252e0b, "egl/dri2: implement query surface hook"),
that fixed failures in dEQP-EGL.functional.resize.surface_size.grow
and dEQP-EGL.functional.resize.surface_size.shrink.

Cc: Tapani Pälli <tapani.palli@intel.com>
Cc: Mark Janes <mark.a.janes@intel.com>
Cc: Chad Versace <chadversary@chromium.org>
Signed-off-by: Brendan King <Brendan.King@imgtec.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
7 years agogallium/radeon: Add libamd_common.a to TARGET_LIB_DEPS also for r600
Michel Dänzer [Tue, 28 Feb 2017 06:21:39 +0000 (15:21 +0900)]
gallium/radeon: Add libamd_common.a to TARGET_LIB_DEPS also for r600

Fixes build failure with --enable-opencl --enable-xvmc:

make[4]: Entering directory '/home/daenzer/src/mesa-git/mesa/build-amd64/src/gallium/targets/xvmc'
  CXXLD    libXvMCgallium.la
../../../../src/gallium/drivers/r600/.libs/libr600.a(evergreen_compute.o): In function `evergreen_create_compute_state':
/home/daenzer/src/mesa-git/mesa/build-amd64/src/gallium/drivers/r600/../../../../../src/gallium/drivers/r600/evergreen_compute.c:254: undefined reference to `ac_elf_read'
../../../../src/gallium/drivers/r600/.libs/libr600.a(evergreen_compute.o): In function `r600_shader_binary_read_config':
/home/daenzer/src/mesa-git/mesa/build-amd64/src/gallium/drivers/r600/../../../../../src/gallium/drivers/r600/evergreen_compute.c:189: undefined reference to `ac_shader_binary_config_start'
/home/daenzer/src/mesa-git/mesa/build-amd64/src/gallium/drivers/r600/../../../../../src/gallium/drivers/r600/evergreen_compute.c:189: undefined reference to `ac_shader_binary_config_start'
collect2: error: ld returned 1 exit status
Makefile:760: recipe for target 'libXvMCgallium.la' failed

Fixes: dc4c551a345d ("radeon/ac: switch from radeon_elf_read() to ac_elf_read()")
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoi965: Move intel_resolve_map.[ch] from i965_compiler_FILES to i965_FILES
Kenneth Graunke [Mon, 27 Feb 2017 06:35:52 +0000 (22:35 -0800)]
i965: Move intel_resolve_map.[ch] from i965_compiler_FILES to i965_FILES

I have no idea why these were part of the compiler files.  They're
miptree related code, and the compiler doesn't appear to use them.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agogallium/r600: fix r600 build when OpenCL is enabled
Timothy Arceri [Tue, 28 Feb 2017 04:39:08 +0000 (15:39 +1100)]
gallium/r600: fix r600 build when OpenCL is enabled

Fixes build regression caused by d90bf4ef3e1db7

7 years agoradeon: remove unused radeon_elf_util.{c,h}
Timothy Arceri [Mon, 27 Feb 2017 00:48:08 +0000 (11:48 +1100)]
radeon: remove unused radeon_elf_util.{c,h}

We now use the shared code in AMD common instead.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeon/ac: switch to ac_shader_binary_config_start()
Timothy Arceri [Mon, 27 Feb 2017 00:24:54 +0000 (11:24 +1100)]
radeon/ac: switch to ac_shader_binary_config_start()

For radeonsi we could probably switch to
ac_shader_binary_read_config(). However the functions have
diverged so just share this helper for now.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeon/ac: make ac_shader_binary_config_start() available externally
Timothy Arceri [Mon, 27 Feb 2017 00:17:12 +0000 (11:17 +1100)]
radeon/ac: make ac_shader_binary_config_start() available externally

The read config functions are different for r600 and radeonsi so
we can't just share the one in amd common. So just share this
instead.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeon/ac: switch from radeon_elf_read() to ac_elf_read()
Timothy Arceri [Mon, 27 Feb 2017 00:06:51 +0000 (11:06 +1100)]
radeon/ac: switch from radeon_elf_read() to ac_elf_read()

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeon/ac: switch from radeon_shader_binary to ac_shader_binary
Timothy Arceri [Sun, 26 Feb 2017 23:50:29 +0000 (10:50 +1100)]
radeon/ac: switch from radeon_shader_binary to ac_shader_binary

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradeon/ac: add llvm_ir_string to ac_shader_binary struct
Timothy Arceri [Sun, 26 Feb 2017 23:16:18 +0000 (10:16 +1100)]
radeon/ac: add llvm_ir_string to ac_shader_binary struct

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoralloc: Delete autofree handling.
Kenneth Graunke [Fri, 24 Feb 2017 02:05:16 +0000 (02:05 +0000)]
ralloc: Delete autofree handling.

There was exactly one user of this, and I just removed it.

It also accessed an implicit global context, with no locking.  This
meant that it was only safe if all callers of ralloc_autofree_context()
held the same lock...which is a pretty terrible thing for a utility
library to impose.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agocompiler: Free types in _mesa_glsl_release_types() rather than autofree.
Kenneth Graunke [Fri, 24 Feb 2017 01:58:43 +0000 (01:58 +0000)]
compiler: Free types in _mesa_glsl_release_types() rather than autofree.

Instead of using ralloc_autofree_context() to install an atexit()
handler to ralloc_free(glsl_type::mem_ctx), we can simply free them
from _mesa_glsl_release_types().

This is effectively the same, because _mesa_glsl_release_types() is
called from _mesa_destroy_shader_compiler(), which is called from Mesa's
one_time_fini() function, which Mesa installs as an atexit() handler.

The one advantage here is that it ensures the built-in functions are
destroyed before the types.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
7 years agoclover: Dump linked binary to a different file
Jan Vesely [Mon, 13 Feb 2017 20:46:03 +0000 (15:46 -0500)]
clover: Dump linked binary to a different file

this allows to pass the generated files directly to llc or bugpoint

v2: add atomic counter ID
v3: remove extra scope operator, constify

Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
7 years agoradv: fix depth format in blit2d.
Dave Airlie [Mon, 27 Feb 2017 06:59:06 +0000 (16:59 +1000)]
radv: fix depth format in blit2d.

For blitting we need to use the depth or stencil format, never
the combined.

This fixes:
dEQP-VK.texture.shadow.2d.nearest.less_or_equal_d32_sfloat_s8_uint
and a few others.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Cc: "13.0 17.0" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/formats: add fast clear for 8-bit signed ints.
Dave Airlie [Mon, 27 Feb 2017 02:15:03 +0000 (12:15 +1000)]
radv/formats: add fast clear for 8-bit signed ints.

These formats are used by some CTS tests, may as well fill them in.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agomesa/main: refactor sampler parameter error codepath
Samuel Pitoiset [Fri, 24 Feb 2017 11:42:46 +0000 (12:42 +0100)]
mesa/main: refactor sampler parameter error codepath

This is similar to what we do in the texture error codepath.
While we are at it, update the specification comment with
latest GL 4.5 spec.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
7 years agoglsl: reject samplers not declared as uniform/function params earlier
Samuel Pitoiset [Fri, 24 Feb 2017 13:46:08 +0000 (14:46 +0100)]
glsl: reject samplers not declared as uniform/function params earlier

This improves consistency with image variables and atomic
counters which are already rejected the same way.

Note that opaque variables can't be treated as l-values, which
means only the 'in' function parameter is allowed.

v2: rewrite commit message

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> (v1)
Reviewed-by: Marek Olšák <marek.olsak@amd.com> (v2)
7 years agoglsl: use is_sampler() anywhere it's possible
Samuel Pitoiset [Fri, 24 Feb 2017 13:40:21 +0000 (14:40 +0100)]
glsl: use is_sampler() anywhere it's possible

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: use is_image() anywhere it's possible
Samuel Pitoiset [Fri, 24 Feb 2017 13:40:20 +0000 (14:40 +0100)]
glsl: use is_image() anywhere it's possible

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoglsl: add missing blend_support qualifier in validate_flags()
Samuel Pitoiset [Thu, 23 Feb 2017 18:17:37 +0000 (19:17 +0100)]
glsl: add missing blend_support qualifier in validate_flags()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Andres Gomez <agomez@igalia.com>
7 years agoglsl: use an enum for AMD_conservative_depth layout qualifiers
Samuel Pitoiset [Thu, 23 Feb 2017 17:07:58 +0000 (18:07 +0100)]
glsl: use an enum for AMD_conservative_depth layout qualifiers

The main idea behind this is to free some bits in the flags.q
struct because currently all 64-bits are used and we can't
add more layout qualifiers without reaching a static assert.

In order to do that (mainly for ARB_bindless_texture), use an
enumeration for the AMD_conservative_depth layout qualifiers
because it's forbidden to declare more than one depth qualifier
for gl_FragDepth.

Note that ast_type_qualifier::merge_qualifier() will prevent
using duplicate layout qualifiers by returning a compile-time
error.

No piglit regressions found (including compiler tests) with
RX480 on RadeonSI.

v2: use a switch case

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Andres Gomez <agomez@igalia.com> (v1)
7 years agoglsl: add has_shader_image_load_store()
Samuel Pitoiset [Thu, 23 Feb 2017 18:04:52 +0000 (19:04 +0100)]
glsl: add has_shader_image_load_store()

Preliminary work for ARB_bindless_texture which can interact
with ARB_shader_image_load_store.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
7 years agodrirc: add force_glsl_version=440 for The Culling
Samuel Pitoiset [Thu, 23 Feb 2017 11:04:28 +0000 (12:04 +0100)]
drirc: add force_glsl_version=440 for The Culling

This game uses GLSL 430 but the interpolation qualifiers in
some shaders don't match, which ends up in a link error. GLSL
440 spec removed this restriction, force it.

This fixes the following link error, as well as serious
rendering problems.

error: vertex shader output `out_TEXCOORD1' specifies noperspective
interpolation qualifier, but fragment shader input specifies no
interpolation qualifier

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
7 years agoanv: Bump advertised version to 1.0.42
Jason Ekstrand [Mon, 27 Feb 2017 17:25:23 +0000 (09:25 -0800)]
anv: Bump advertised version to 1.0.42

We've been following the spec changes.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Chad Versace <chadversary@chromium.org>
7 years agovulkan: Update registry and headers to 1.0.42
Jason Ekstrand [Mon, 27 Feb 2017 17:15:17 +0000 (09:15 -0800)]
vulkan: Update registry and headers to 1.0.42

This brings in a bunch of new extensions

7 years agonir: Delete unused arg in get_iteration
Elie TOURNIER [Tue, 21 Feb 2017 16:15:16 +0000 (16:15 +0000)]
nir: Delete unused arg in get_iteration

nir_const_value is not needed in get_iteration

Signed-off-by: Elie Tournier <tournier.elie@gmail.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
7 years agodocs: fix a few typos
Eric Engestrom [Sun, 26 Feb 2017 23:58:03 +0000 (23:58 +0000)]
docs: fix a few typos

Noticed a couple, found the rest using vimspell.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agogallium/u_queue: set num_threads correctly if not all threads start
Grazvydas Ignotas [Sun, 26 Feb 2017 00:44:07 +0000 (02:44 +0200)]
gallium/u_queue: set num_threads correctly if not all threads start

If i-th thread could not be created it means we have i threads,
not i+1, because we start from 0.

Fixes: 404d0d5 "gallium/u_queue: add an option to have multiple worker threads"
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
7 years agogallium/u_queue: fix a crash with atexit handlers
Grazvydas Ignotas [Sun, 26 Feb 2017 00:44:06 +0000 (02:44 +0200)]
gallium/u_queue: fix a crash with atexit handlers

Commit 4aea8fe ("gallium/u_queue: fix random crashes when the app calls
exit()") added a atexit handler which calls
util_queue_killall_and_wait() for each queue to stop the threads.
However the app is also free to use atexit handlers to clean up things,
leading to util_queue_destroy() call which will also call
util_queue_killall_and_wait() for the same queue again, causing threads
being joined twice, and that is undefined. This happens with libglut,
for example. A simple fix is to just set num_threads to 0 as there are
no more valid threads after util_queue_killall_and_wait() returns.

Fixes: 4aea8fe "gallium/u_queue: fix random crashes when the app calls exit()"
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
7 years agoradv: Use correct size for availability flag.
Bas Nieuwenhuizen [Sun, 26 Feb 2017 21:36:10 +0000 (22:36 +0100)]
radv: Use correct size for availability flag.

Per spec, VK_QUERY_RESULT_64_BIT specifies the integer size and the
availability flag is an integer. We apparently handled this correctly
already for the copy to buffer case.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
7 years agoradv: Only use PKT3_OCCLUSION_QUERY when it doesn't hang.
Bas Nieuwenhuizen [Sun, 26 Feb 2017 21:26:30 +0000 (22:26 +0100)]
radv: Only use PKT3_OCCLUSION_QUERY when it doesn't hang.

PKT3_OCCLUSION_QUERY hangs when used in a nested IB. This only
calls it when in a primary command buffer and we change
GetQueryPoolResults to not need it. CmdCopyQueryPoolResults
still needs it so we break that behavior for secondary command buffers.
However, that would hang already and using an unitialized value is
better than a hang.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
7 years agoradv: Reset emitted compute pipeline when calling secondary cmd buffer.
Bas Nieuwenhuizen [Sun, 26 Feb 2017 19:01:26 +0000 (20:01 +0100)]
radv: Reset emitted compute pipeline when calling secondary cmd buffer.

Otherwise if the new compute pipeline is the same as the last used
pipeline before the call, we don't emit it again.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
7 years agoradv: add support for NV_dedicated_allocation
Dave Airlie [Sun, 26 Feb 2017 23:52:08 +0000 (23:52 +0000)]
radv: add support for NV_dedicated_allocation

This adds initial support for NV_dedicated_allocation, then
uses it for the wsi image/memory allocation paths internally
in the driver.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/winsys: fix freeing imported memory.
Andres Rodriguez [Sun, 26 Feb 2017 23:50:25 +0000 (23:50 +0000)]
radv/winsys: fix freeing imported memory.

This bo->fd wasn't setting some stuff correctly that could
lead to crashes for anything using this path later.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agovulkan/wsi/radv: add initial prime support (v1.1)
Dave Airlie [Wed, 23 Nov 2016 02:59:55 +0000 (12:59 +1000)]
vulkan/wsi/radv: add initial prime support (v1.1)

This is a complete rewrite of my previous rfc patches.

This adds the ability to present to a different GPU that rendering
using a driver side operation that can copy from the tiled to
linear shared image.

This does prime support completely in the swapchain present code,
and each queue has a precreated command buffer for each image
and for the each queue family. This means presenting should work
on graphics and compute queues and transfer in the future.

v1.1: initialise needs_linear_copy in swapchain.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/ac: Add integer->integer casts.
Bas Nieuwenhuizen [Sun, 26 Feb 2017 01:37:27 +0000 (02:37 +0100)]
radv/ac: Add integer->integer casts.

Signed-off-by: Bas Nieuwenhuizen <basni@google.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Acked-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agocheck: add support for running test as standalone
Eric Engestrom [Sun, 26 Feb 2017 01:17:25 +0000 (01:17 +0000)]
check: add support for running test as standalone

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
7 years agocheck: make any failure fatal
Eric Engestrom [Sun, 26 Feb 2017 00:17:52 +0000 (00:17 +0000)]
check: make any failure fatal

Previously, only the last error code was returned.
Using `set -e` makes the script quit on any unhandled error.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
7 years agocheck: mark two tests are requiring bash
Eric Engestrom [Sun, 26 Feb 2017 13:35:25 +0000 (13:35 +0000)]
check: mark two tests are requiring bash

Requirement was removed just before pushing, but it's actually needed
for heredocs (`<<<`).

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
7 years agost/nine: Drop USER_INDEX_BUFFERS check
Mike Lothian [Sat, 25 Feb 2017 11:50:44 +0000 (11:50 +0000)]
st/nine: Drop USER_INDEX_BUFFERS check

This fixes 4a883966c1f74f43afc145d2c3d27af7b8c5e01a where the
PIPE_CAP was removed.

Now USER_INDEX_BUFFERS are always enabled remove the check and only
check for cmst_active directly.

v2: Axel pointed out the code was still needed when cmst was inactive,
    Rebase on master too
v3: Drop struct member user_ibufs also && fixup shortlog (Edward).
v4: Fix negation
v5: Use the right variable name csmt != cmst

Fixes: 4a883966c1f7 ("gallium: remove PIPE_CAP_USER_INDEX_BUFFERS")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99953
Reported-and-tested-by: Vinson Lee <vlee@freedesktop.org> (v1)
Cc: Marek Olšák <marek.olsak@amd.com>
Cc: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Signed-off-by: Mike Lothian <mike@fireburn.co.uk>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agost/nine: make use of common uploaders v4
Constantine Charlamov [Tue, 21 Feb 2017 04:31:30 +0000 (07:31 +0300)]
st/nine: make use of common uploaders v4

Make use of common uploaders that landed recently to Mesa

v2: fixed formatting, broken due to thunderbird configuration

v3: per Axel comment: added a comment into NineDevice9_DrawPrimitiveUP

v4: per Axel comment: changed style of the comment

7 years agocompiler: style clean-ups in blob.h
Timothy Arceri [Fri, 24 Feb 2017 04:34:51 +0000 (15:34 +1100)]
compiler: style clean-ups in blob.h

Reviewed-by: Elie Tournier <tournier.elie@gmail.com>
7 years agosvga: fix MSVC build error after PIPE_CAP_USER_INDEX_BUFFERS removal
Brian Paul [Sat, 25 Feb 2017 02:02:39 +0000 (19:02 -0700)]
svga: fix MSVC build error after PIPE_CAP_USER_INDEX_BUFFERS removal

Need to specify the zero for the struct initializer.  My earlier test
of the patch series was with MinGW, not MSVC.

Trivial.

7 years agovc4: Lazily emit our FS/VS input loads.
Eric Anholt [Fri, 24 Feb 2017 20:57:03 +0000 (12:57 -0800)]
vc4: Lazily emit our FS/VS input loads.

This reduces register pressure in both types of shaders, by reordering the
input loads from the var->data.driver_location order to whatever order
they appear first in the NIR shader.  These instructions aren't
reorderable at our QIR scheduling level because the FS takes two in
lockstep to do an interpolation, and the VS takes multiple read
instructions in a row to get a whole vec4-level attribute read.

shader-db impact:
total instructions in shared programs: 76666 -> 76590 (-0.10%)
instructions in affected programs:     42945 -> 42869 (-0.18%)
total max temps in shared programs: 9395 -> 9208 (-1.99%)
max temps in affected programs:     2951 -> 2764 (-6.34%)

Some programs get their max temps hurt, depending on the order that the
load_input intrinsics appear, because we end up being unable to copy
propagate an older VPM read into its only use.

7 years agovc4: Refactor the load_input code out of the intrinsic code.
Eric Anholt [Fri, 24 Feb 2017 20:33:38 +0000 (12:33 -0800)]
vc4: Refactor the load_input code out of the intrinsic code.

It's going gain most of ntq_setup_inputs(), so simplify it first.

7 years agovc4: Track the last block we emitted at the top level.
Eric Anholt [Fri, 24 Feb 2017 20:00:38 +0000 (12:00 -0800)]
vc4: Track the last block we emitted at the top level.

This will be used for delaying our VPM reads (which must be unconditional)
until just before they're used.

7 years agovc4: Emit max number of temps in the shader-db output.
Eric Anholt [Fri, 24 Feb 2017 22:18:39 +0000 (14:18 -0800)]
vc4: Emit max number of temps in the shader-db output.

We need to be paying attention to optimization's impact on this -- even if
we reduce instruction count, increasing max temps in general is likely to
cause us to fail to register allocate on some shaders, which means that
those won't run at all.

7 years agoutil/disk_cache: Use backward compatible st_mtime.
Vinson Lee [Thu, 23 Feb 2017 21:48:34 +0000 (13:48 -0800)]
util/disk_cache: Use backward compatible st_mtime.

Fix Mac OS X build error.

  CC       libmesautil_la-disk_cache.lo
In file included from disk_cache.c:46:
./disk_cache.h:57:20: error: no member named 'st_mtim' in 'struct stat'
   *timestamp = st.st_mtim.tv_sec;
                ~~ ^

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=99918
Fixes: 207e3a6e4b ("util/radv: move *_get_function_timestamp() to utils")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
7 years agoglsl: Fix missing-braces warning.
Vinson Lee [Tue, 14 Feb 2017 01:52:59 +0000 (17:52 -0800)]
glsl: Fix missing-braces warning.

  CXX    glsl/ast_to_hir.lo
glsl/ast_to_hir.cpp: In member function 'virtual ir_rvalue* ast_declarator_list::hir(exec_list*, _mesa_glsl_parse_state*)':
glsl/ast_to_hir.cpp:4846:42: warning: missing braces around initializer for 'unsigned int [16]' [-Wmissing-braces]

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Andres Gomez <agomez@igalia.com>
7 years agoac: silence a warning
Marek Olšák [Thu, 23 Feb 2017 00:34:27 +0000 (01:34 +0100)]
ac: silence a warning

trivial

7 years agoradeonsi: fix broken tessellation on Carrizo and Stoney
Marek Olšák [Wed, 22 Feb 2017 18:56:26 +0000 (19:56 +0100)]
radeonsi: fix broken tessellation on Carrizo and Stoney

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

Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
7 years agost/mesa: don't update unrelated states in non-draw calls such as Clear
Marek Olšák [Wed, 22 Feb 2017 18:59:27 +0000 (19:59 +0100)]
st/mesa: don't update unrelated states in non-draw calls such as Clear

If a VAO isn't bound and u_vbuf isn't enabled because of the Core profile,
we'll get user vertex buffers in drivers if we update vertex buffers
in glClear. So don't do that.

This fixes a regression since disabling u_vbuf for Core profiles.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agost/mesa: set blend state for PBO readbacks
Marek Olšák [Wed, 22 Feb 2017 20:39:55 +0000 (21:39 +0100)]
st/mesa: set blend state for PBO readbacks

v2: restore the state

Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agost/mesa: reset sample_mask, min_sample, and render_condition for PBO ops
Marek Olšák [Wed, 22 Feb 2017 23:30:49 +0000 (00:30 +0100)]
st/mesa: reset sample_mask, min_sample, and render_condition for PBO ops

Cc: 13.0 17.0 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agost/mesa: don't check st->vp in update_clip
Marek Olšák [Wed, 22 Feb 2017 23:20:17 +0000 (00:20 +0100)]
st/mesa: don't check st->vp in update_clip

The clip state is updated before VS, so it can be NULL for the first draw
call. Just remove the unnecessary dependency on st->vp.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agotrace: remove pipe_resource wrapping
Marek Olšák [Wed, 22 Feb 2017 22:40:53 +0000 (23:40 +0100)]
trace: remove pipe_resource wrapping

Not needed. ddebug does the same thing. The limitation is that drivers
can only use pipe_resource::screen through pipe_resource_reference.

This unbreaks trace, because pipe_context uploaders aren't wrapped,
so trace doesn't understand buffers returned by them.

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agogallium: remove PIPE_CAP_USER_INDEX_BUFFERS
Marek Olšák [Fri, 17 Feb 2017 01:28:20 +0000 (02:28 +0100)]
gallium: remove PIPE_CAP_USER_INDEX_BUFFERS

all drivers support it

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com> (VMware driver only)
7 years agost/mesa: assume all drivers support user index buffers
Marek Olšák [Fri, 17 Feb 2017 00:20:23 +0000 (01:20 +0100)]
st/mesa: assume all drivers support user index buffers

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com> (VMware driver only)
7 years agosvga: implement user index buffers
Marek Olšák [Fri, 17 Feb 2017 01:21:29 +0000 (02:21 +0100)]
svga: implement user index buffers

Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com> (VMware driver only)
7 years agofreedreno: add support for user index buffers
Marek Olšák [Fri, 17 Feb 2017 01:14:36 +0000 (02:14 +0100)]
freedreno: add support for user index buffers

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agoetnaviv: add support for user index buffers
Marek Olšák [Fri, 17 Feb 2017 00:59:48 +0000 (01:59 +0100)]
etnaviv: add support for user index buffers

Reviewed-by: Brian Paul <brianp@vmware.com>
7 years agogallium/util: add new helpers for user index buffer uploading
Marek Olšák [Wed, 22 Feb 2017 19:52:49 +0000 (20:52 +0100)]
gallium/util: add new helpers for user index buffer uploading

v3: split from the etnaviv patch; fix new_ib.buffer leak

Reviewed-by: Brian Paul <brianp@vmware.com>
Tested-by: Brian Paul <brianp@vmware.com> (VMware driver only)
7 years agonir: delete magic number
Elie TOURNIER [Wed, 8 Feb 2017 22:20:41 +0000 (22:20 +0000)]
nir: delete magic number

Signed-off-by: Elie Tournier <tournier.elie@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
7 years agogallium/util: (trivial) fix util_clear_render_target
Roland Scheidegger [Fri, 24 Feb 2017 17:40:40 +0000 (18:40 +0100)]
gallium/util: (trivial) fix util_clear_render_target

the format of the rt can be different than the one of the texture, so must
propagate the format explicitly to the helper. Broken since
3f9c5d62441eba38e8b1592aba965ed5db6fd89b (but unused by st/mesa).

7 years agoutil: automake: add sha1/README to the tarball
Emil Velikov [Fri, 24 Feb 2017 17:38:16 +0000 (17:38 +0000)]
util: automake: add sha1/README to the tarball

Suggested-by: Andreas Boll <andreas.boll.dev@gmail.com>
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
7 years agomapi: remove unused mapi.[ch]
Emil Velikov [Thu, 23 Feb 2017 16:48:57 +0000 (16:48 +0000)]
mapi: remove unused mapi.[ch]

The final user of it was st/vega.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
7 years agoblorp: automake: add TODO to the tarball
Emil Velikov [Thu, 23 Feb 2017 16:48:56 +0000 (16:48 +0000)]
blorp: automake: add TODO to the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
7 years agoanv: automake: add TODO to the tarball
Emil Velikov [Thu, 23 Feb 2017 16:48:55 +0000 (16:48 +0000)]
anv: automake: add TODO to the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
7 years agovc4: automake: add the kernel/README to the tarball
Emil Velikov [Thu, 23 Feb 2017 16:48:54 +0000 (16:48 +0000)]
vc4: automake: add the kernel/README to the tarball

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
7 years agonir: automake: add the README to the tarball
Emil Velikov [Thu, 23 Feb 2017 16:48:53 +0000 (16:48 +0000)]
nir: automake: add the README to the tarball

Similar to other accompanying documentation we have in-tree.
For example glsl/README.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Andreas Boll <andreas.boll.dev@gmail.com>
7 years agoradv/entrypoints: Only generate entrypoints for supported features
Emil Velikov [Sun, 19 Feb 2017 11:49:22 +0000 (11:49 +0000)]
radv/entrypoints: Only generate entrypoints for supported features

This changes the way radv_entrypoints_gen.py works from generating a
table containing every single entrypoint in the XML to just the ones
that we actually need.  There's no reason for us to burn entrypoint
table space on a bunch of NV extensions we never plan to implement.

RADV implements VK_AMD_draw_indirect_count, so add that to the list.

Port of 114c281e707919a1420d3a20219ce4392d8b360d
"and/entrypoints: Only generate entrypoints for supported features"

Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Acked-by: Dave Airlie <airlied@redhat.com>
7 years agomain/performance_query: s/GLboolean/bool/
Robert Bragg [Thu, 23 Feb 2017 11:16:50 +0000 (11:16 +0000)]
main/performance_query: s/GLboolean/bool/

Ideally would have caught these when adding the interface but this just
switches a few return types for the INTEL_performance_query backend
interface to bool instead of GLboolean.

Signed-off-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoeglapi: replace linear entrypoint search with binary search
Eric Engestrom [Tue, 21 Feb 2017 23:56:52 +0000 (23:56 +0000)]
eglapi: replace linear entrypoint search with binary search

Tested with dEQP-EGL.functional.get_proc_address.*

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: make sure entrypoints list is always sorted
Eric Engestrom [Tue, 21 Feb 2017 23:56:51 +0000 (23:56 +0000)]
egl: make sure entrypoints list is always sorted

Starting with the next commit, badly sorting this list will break the
eglGetProcAddress().

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoegl: distribute all tests
Eric Engestrom [Tue, 21 Feb 2017 23:56:50 +0000 (23:56 +0000)]
egl: distribute all tests

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoeglapi: move entrypoints list out to its own file
Eric Engestrom [Tue, 21 Feb 2017 23:56:49 +0000 (23:56 +0000)]
eglapi: move entrypoints list out to its own file

This will allow us to make sure the list is always sorted in the next
commit.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoeglapi: sort entrypoints list
Eric Engestrom [Tue, 21 Feb 2017 23:56:48 +0000 (23:56 +0000)]
eglapi: sort entrypoints list

Let's make that comment true.
If will also be necessary in a couple commits (using bsearch).

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoeglapi: use macro to map entrypoints to functions
Eric Engestrom [Tue, 21 Feb 2017 23:56:47 +0000 (23:56 +0000)]
eglapi: use macro to map entrypoints to functions

As of the last 3 commits, there's a function for each entrypoint.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoeglapi: add entrypoint for eglClientWaitSyncKHR
Eric Engestrom [Tue, 21 Feb 2017 23:56:46 +0000 (23:56 +0000)]
eglapi: add entrypoint for eglClientWaitSyncKHR

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoeglapi: add entrypoint for eglDestroySyncKHR
Eric Engestrom [Tue, 21 Feb 2017 23:56:45 +0000 (23:56 +0000)]
eglapi: add entrypoint for eglDestroySyncKHR

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agoeglapi: add entrypoint for eglDestroyImageKHR
Eric Engestrom [Tue, 21 Feb 2017 23:56:44 +0000 (23:56 +0000)]
eglapi: add entrypoint for eglDestroyImageKHR

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agost/va: Fix up YV12 to NV12 putImage conversion
Thomas Hellstrom [Wed, 22 Feb 2017 12:07:47 +0000 (13:07 +0100)]
st/va: Fix up YV12 to NV12 putImage conversion

Use the utility u_copy_nv12_from_yv12 to implement this similarly to
how it's been done in the VPAU state tracker. The old code mixed up
planes and fields and didn't correctly handle video surfaces in
interlaced format.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
7 years agost/vdpau: Provide YV12 to NV12 putBits conversion v2
Thomas Hellstrom [Thu, 3 Mar 2016 08:25:44 +0000 (09:25 +0100)]
st/vdpau: Provide YV12 to NV12 putBits conversion v2

mplayer likes putting YV12 data, and if there is a buffer format mismatch,
the vdpau state tracker would try to reallocate the video surface as an
YV12 surface. A virtual driver doesn't like reallocating and doesn't like YV12
surfaces, so if we can't support YV12, try an YV12 to NV12 conversion
instead.

Also advertize that we actually can do the getBits and putBits conversion.

v2: A previous version of this patch prioritized conversion before
reallocating. This has been changed to prioritize reallocating in this version.

Cc: Christian König <christian.koenig@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
7 years agoconfigure.ac: check require_basic_egl only if egl enabled
Leo Liu [Thu, 23 Feb 2017 18:37:58 +0000 (13:37 -0500)]
configure.ac: check require_basic_egl only if egl enabled

Otherwise the configuration fails when building independant libs
like vdpau, vaapi or omx

Fixes: 1ac40173c2a ("configure.ac: simplify EGL requirements for
drivers dependent on EGL")

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
Cc: "17.0" <mesa-stable@lists.freedesktop.org>
7 years agoglx: add GLXdispatchIndex sort check
Eric Engestrom [Tue, 21 Feb 2017 16:49:25 +0000 (16:49 +0000)]
glx: add GLXdispatchIndex sort check

Signed-off-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
7 years agodocs: update features.txt for GL_ARB_clear_texture with llvmpipe and softpipe
Lars Hamre [Wed, 22 Feb 2017 15:56:44 +0000 (10:56 -0500)]
docs: update features.txt for GL_ARB_clear_texture with llvmpipe and softpipe

Signed-off-by: Lars Hamre <chemecse@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agosoftpipe: enable clear_texture with util_clear_texture
Lars Hamre [Wed, 22 Feb 2017 15:56:43 +0000 (10:56 -0500)]
softpipe: enable clear_texture with util_clear_texture

Passes all corresponding piglit tests.

Signed-off-by: Lars Hamre <chemecse@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agollvmpipe: enable clear_texture with util_clear_texture
Lars Hamre [Wed, 22 Feb 2017 15:56:42 +0000 (10:56 -0500)]
llvmpipe: enable clear_texture with util_clear_texture

Passes all corresponding piglit tests.

Signed-off-by: Lars Hamre <chemecse@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agogallium: implement util_clear_texture
Lars Hamre [Wed, 22 Feb 2017 15:56:41 +0000 (10:56 -0500)]
gallium: implement util_clear_texture

v3: have util_clear_texture mirror the pipe function (Roland Scheidegger)
v2: rework util clear functions such that they operate on a resource
    instead of a surface (Roland Scheidegger)

Creates a util_clear_texture function for implementing the GL_ARB_clear_texture
in softpipe and llvmpipe.

Signed-off-by: Lars Hamre <chemecse@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
7 years agohaiku/winsys: fix dt prototype args
Jerome Duval [Wed, 22 Feb 2017 16:02:51 +0000 (16:02 +0000)]
haiku/winsys: fix dt prototype args

7 years agohaiku: build fixes around debug defines
Jerome Duval [Wed, 22 Feb 2017 16:01:24 +0000 (16:01 +0000)]
haiku: build fixes around debug defines

7 years agoradv: add sample mask output support
Dave Airlie [Thu, 23 Feb 2017 06:06:22 +0000 (16:06 +1000)]
radv: add sample mask output support

This adds support to write to sample mask from the fragment shader.

We can optimise this later like radeonsi.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv/ac: refactor our fmask sample index fixup.
Dave Airlie [Thu, 23 Feb 2017 02:20:25 +0000 (12:20 +1000)]
radv/ac: refactor our fmask sample index fixup.

This refactors out the sample index fixup between
txf and image load.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: fetch sample index via fmask for image coord as well.
Dave Airlie [Wed, 22 Feb 2017 04:29:09 +0000 (14:29 +1000)]
radv: fetch sample index via fmask for image coord as well.

This follows the txf_ms code, I can't figure out why amdgpu-pro
doesn't do this in their shaders, they must know someone we don't.

This fixes:
dEQP-VK.pipeline.multisample_shader_builtin.sample_id.*

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: add sample mask input support
Dave Airlie [Mon, 30 Jan 2017 19:30:26 +0000 (05:30 +1000)]
radv: add sample mask input support

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: enable location at sample when persample is forced.
Dave Airlie [Thu, 23 Feb 2017 04:24:20 +0000 (14:24 +1000)]
radv: enable location at sample when persample is forced.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoradv: fix interpolation at wrong place for offset interp
Dave Airlie [Thu, 23 Feb 2017 04:24:20 +0000 (14:24 +1000)]
radv: fix interpolation at wrong place for offset interp

The code was interpolating at the offset from the sample,
not the offset from the center. Also fix for persample interpolation
modes we should force the pixel center to be at the sample.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Dave Airlie <airlied@redhat.com>
7 years agoswr: fix index buffers with non-zero indices
George Kyriazis [Fri, 3 Feb 2017 03:16:47 +0000 (21:16 -0600)]
swr: fix index buffers with non-zero indices

Fix issue with index buffers that do not contain a 0 index.  0 index
can be a non-valid index if the (copied) vertex buffers are a subset of the
user's (which happens because we only copy the range between min & max).
Core will use an index passed in from the driver to replace invalid indices.

Only do this for calls that contain non-zero indices, to minimize performance

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
cost.

7 years agoswr: add fetch shader cache
George Kyriazis [Fri, 10 Feb 2017 16:24:32 +0000 (10:24 -0600)]
swr: add fetch shader cache

For now, the cache key is all of FETCH_COMPILE_STATE.

Use new/delete for swr_vertex_element_state, since we have to call the
constructors/destructors of the struct elements.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
7 years agost/mesa: free shader cache buffer on fallback
Timothy Arceri [Thu, 23 Feb 2017 03:50:58 +0000 (14:50 +1100)]
st/mesa: free shader cache buffer on fallback

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Tested-by: Michel Dänzer <michel.daenzer@amd.com>