mesa.git
6 years agonir: move ends_in_break() helper to nir_loop_analyze.h
Timothy Arceri [Fri, 1 Jun 2018 05:37:27 +0000 (15:37 +1000)]
nir: move ends_in_break() helper to nir_loop_analyze.h

We will use the helper while simplifying potential loop terminators
in the following patch.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agoradv: fix Coverity no effect control flow issue
Timothy Arceri [Wed, 6 Jun 2018 23:49:37 +0000 (09:49 +1000)]
radv: fix Coverity no effect control flow issue

swizzle is unsigned so "desc->swizzle[c] < 0" is never true.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agointel/blorp: Don't vertex fetch directly from clear values
Jason Ekstrand [Tue, 5 Jun 2018 00:27:53 +0000 (17:27 -0700)]
intel/blorp: Don't vertex fetch directly from clear values

On gen8+, we have to VF cache flush whenever a vertex binding aliases a
previous binding at the same index modulo 4GiB.  We deal with this in
Vulkan by ensuring that vertex buffers and the dynamic state (from which
BLORP pulls its vertex buffers) are in the same 4GiB region of the
address space.  That doesn't work if we're reading clear colors with the
VF unit.  In order to work around this we switch to using MI commands to
copy the clear value into the vertex buffer we allocate for the normal
constant data.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agodri: add missing 16bits formats mapping
Lionel Landwerlin [Wed, 6 Jun 2018 11:57:18 +0000 (12:57 +0100)]
dri: add missing 16bits formats mapping

i965 advertises the 16-bit R and RG formats through
eglQueryDmaBufFormatsEXT but falls over when a client tries to use or
asks more information about such a format because
driImageFormatToGLFormat returns MESA_FORMAT_NONE.

Found by Eero Tamminen.

v2: Add G16R16 formats (Lionel)

v3: Fix G16R16 mapping to mesa format (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106642
Reviewed-by: Plamena Manolova <plamena.manolova@intel.com> (v2)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agonir: Look into uniform structs for samplers when counting num_textures.
Eric Anholt [Fri, 30 Mar 2018 23:04:34 +0000 (16:04 -0700)]
nir: Look into uniform structs for samplers when counting num_textures.

mesa/st decides whether to update samplers after a program change based on
whether num_textures is nonzero.  By not counting samplers in a uniform
struct, we would segfault in
KHR-GLES3.shaders.struct.uniform.sampler_vertex if it was run in the same
context after a non-vertex-shader-uniform testcase (as is the case during
a full conformance run).

v2: Implement using two separate pure functions instead of updating
    pointers.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agov3d: Work around GFXH-1461/GFXH-1689 by using CLEAR_TILE_BUFFERS.
Eric Anholt [Wed, 2 May 2018 18:45:07 +0000 (11:45 -0700)]
v3d: Work around GFXH-1461/GFXH-1689 by using CLEAR_TILE_BUFFERS.

This doesn't seem to have done anything to my test results.  However,
given that we've still got a class of GPU hangs, following the workarounds
that the closed driver does so that we get the same command sequences
seems like a good idea.

6 years agov3d: Enable the new NIR bitfield operation lowering paths.
Eric Anholt [Wed, 2 May 2018 21:17:07 +0000 (14:17 -0700)]
v3d: Enable the new NIR bitfield operation lowering paths.

These together get the GLSL 3.00 unorm/snorm pack functions and
MESA_shader_integer operations working.

v2: Fix commit message typo.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: Add lowering for nir_op_bit_count.
Eric Anholt [Tue, 8 May 2018 20:04:37 +0000 (13:04 -0700)]
nir: Add lowering for nir_op_bit_count.

This is basically the same as the GLSL lowering path.

v2: Fix typo in the link

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: Add lowering for nir_op_bitfield_reverse.
Eric Anholt [Tue, 8 May 2018 19:47:48 +0000 (12:47 -0700)]
nir: Add lowering for nir_op_bitfield_reverse.

This is basically the same as the GLSL lowering path.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: Add an ALU lowering pass for mul_high.
Eric Anholt [Tue, 8 May 2018 18:24:40 +0000 (11:24 -0700)]
nir: Add an ALU lowering pass for mul_high.

This is based on the glsl/lower_instructions.cpp implementation, but
should be much more readable.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: Add lowering for find_lsb.
Eric Anholt [Fri, 4 May 2018 21:02:55 +0000 (14:02 -0700)]
nir: Add lowering for find_lsb.

There is a fairly simple relation to turn this into ufind_msb.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: Add lowering for ifind_msb to ufind_msb.
Eric Anholt [Fri, 4 May 2018 20:33:47 +0000 (13:33 -0700)]
nir: Add lowering for ifind_msb to ufind_msb.

ufind_msb is easily expressed in terms of clz, and we can reduce ifind_msb
to that.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: Add lowering from ibitfield_extract/ubitfield_extract to shifts.
Eric Anholt [Wed, 2 May 2018 20:02:21 +0000 (13:02 -0700)]
nir: Add lowering from ibitfield_extract/ubitfield_extract to shifts.

V3D doesn't have opcodes for ibfe/ubfe, so we need to lower similarly to
glsl/lower_instructions.cpp.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: Add lowering for bitfieldInsert without using bfi.
Eric Anholt [Wed, 2 May 2018 21:13:23 +0000 (14:13 -0700)]
nir: Add lowering for bitfieldInsert without using bfi.

If you don't have HW to do bfi, then lowering bitfieldInsert to bfi makes
things harder than keeping the "bits" argument around.

This still uses bfm, but I've added the obvious lowering of bfm if you
need it.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agodocs: add note about moving to libwayland-egl in 18.2.0
Eric Engestrom [Tue, 29 May 2018 14:41:30 +0000 (15:41 +0100)]
docs: add note about moving to libwayland-egl in 18.2.0

Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Daniel Stone <daniels@collabora.com>
Cc: Andres Gomez <agomez@igalia.com>
Cc: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoegl: remove wayland-egl now that we're using libwayland-egl
Eric Engestrom [Tue, 29 May 2018 14:41:29 +0000 (15:41 +0100)]
egl: remove wayland-egl now that we're using libwayland-egl

Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Daniel Stone <daniels@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoegl: rewire the build systems to use libwayland-egl
Eric Engestrom [Tue, 29 May 2018 14:41:28 +0000 (15:41 +0100)]
egl: rewire the build systems to use libwayland-egl

Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Daniel Stone <daniels@collabora.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoglsl: Take 'double' as reserved after GLSL ES 1.0
zhaowei yuan [Mon, 4 Jun 2018 21:33:59 +0000 (05:33 +0800)]
glsl: Take 'double' as reserved after GLSL ES 1.0

GLSL ES 1.0.17 specifies that "double" is a keyword reserved

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106823
Signed-off-by: zhaowei yuan <zhaowei.yuan@samsung.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agor300g/swtcl: make pipe_context uploaders use malloc'd memory as before
Marek Olšák [Tue, 5 Jun 2018 00:39:07 +0000 (20:39 -0400)]
r300g/swtcl: make pipe_context uploaders use malloc'd memory as before

Discovered by Roland Scheidegger.

The resource_create code uses GPU memory for PIPE_BIND_CUSTOM, but
malloc'd memory otherwise. Vertex and index buffers should use malloc'd
memory.

Cc: 18.0 18.1 <mesa-stable@lists.freedesktop.org>
6 years agointel/eu: Use a struct copy instead of a memcpy
Jason Ekstrand [Tue, 5 Jun 2018 21:33:12 +0000 (14:33 -0700)]
intel/eu: Use a struct copy instead of a memcpy

The memcpy had the wrong size and this was causing crashes on 32-bit
builds of the driver.

Fixes: 6a9525bf6729a8 "intel/eu: Switch to a logical state stack"
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106830
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoradv: Use correct color format for fast clears
Philip Rebohle [Mon, 28 May 2018 12:10:41 +0000 (14:10 +0200)]
radv: Use correct color format for fast clears

Using the image format is incorrect when the view has a different
format than the image. Instead, the view format needs to be used.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
CC: 18.1 <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106687

6 years agov3d: Be more explicit about include directory from our generated code.
Eric Anholt [Tue, 5 Jun 2018 15:50:55 +0000 (08:50 -0700)]
v3d: Be more explicit about include directory from our generated code.

You'd need src/broadcom/cle/ in the -I previously, for srcdir != builddir.
nir was fine at that, but automake didn't have it.

Bugzilla: https://github.com/anholt/mesa/issues/104

6 years agoradv: Do not hardcode fast clear formats.
Bas Nieuwenhuizen [Mon, 4 Jun 2018 22:52:34 +0000 (00:52 +0200)]
radv: Do not hardcode fast clear formats.

except for the odd one out.

This should support many more formats.

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agointel/tools: add intel_sanitize_gpu to EXTRA_DIST
Scott D Phillips [Tue, 5 Jun 2018 16:33:49 +0000 (09:33 -0700)]
intel/tools: add intel_sanitize_gpu to EXTRA_DIST

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106778
Fixes: cc41603d6d ("intel/tools: new intel_sanitize_gpu tool")
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agoutil/tests/vma: Fix warning c++11-narrowing
Scott D Phillips [Tue, 5 Jun 2018 16:29:43 +0000 (09:29 -0700)]
util/tests/vma: Fix warning c++11-narrowing

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106801
Fixes: 943fecc569 ("util: Add a randomized test for the virtual memory allocator")
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agoutil: tests: vma test depends on C++11 support
Scott D Phillips [Fri, 1 Jun 2018 23:26:56 +0000 (16:26 -0700)]
util: tests: vma test depends on C++11 support

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106776
Fixes: 943fecc569 ("util: Add a randomized test for the virtual memory allocator")
Tested-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agoglx: Fix number of property values to read in glXImportContextEXT
Michel Dänzer [Fri, 1 Jun 2018 16:59:36 +0000 (18:59 +0200)]
glx: Fix number of property values to read in glXImportContextEXT

We were trying to read twice as many as the X server sent us, which
upset XCB:

[xcb] Too much data requested from _XRead
[xcb] This is most likely caused by a broken X extension library
[xcb] Aborting, sorry about that.
glx-free-context: ../../src/xcb_io.c:732: _XRead: Assertion `!xcb_xlib_too_much_data_requested' failed.

Fixing this takes 3 GLX piglit tests from crash to pass.

Fixes: 085216295033 "glx: Be more tolerant in glXImportContext (v2)"
Reviewed-by: Adam Jackson <ajax@redhat.com>
6 years agoconfigure: radv depends on mako
Eric Engestrom [Mon, 4 Jun 2018 11:08:15 +0000 (12:08 +0100)]
configure: radv depends on mako

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=106784
Fixes: 17201a2eb0b1b85387136 "radv: port to using updated anv
                              entrypoint/extension generator."
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agotravis: use correct form for array options
Eric Engestrom [Tue, 5 Jun 2018 10:42:02 +0000 (11:42 +0100)]
travis: use correct form for array options

I'd like to eventually drop support for the confusing "an array of
a single empty string is meant to be interpreted as an empty array", so
let's start by not using it anymore.

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoanv: intel: add softpin flag on imported BOs
Lionel Landwerlin [Mon, 4 Jun 2018 08:54:29 +0000 (09:54 +0100)]
anv: intel: add softpin flag on imported BOs

Looks like we forgot to update this bit of the driver for softpin.

Fixes: 4affeba1e9eb42 ("anv: Soft-pin everything else")
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoautotools: add missing android file to package
Eric Engestrom [Mon, 4 Jun 2018 17:06:30 +0000 (18:06 +0100)]
autotools: add missing android file to package

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=106779
Fixes: ff904978a1d299a36b587 "gallium/util: Android backtrace support"
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: fix platforms check for `-D egl=true`
Eric Engestrom [Mon, 4 Jun 2018 10:26:10 +0000 (11:26 +0100)]
meson: fix platforms check for `-D egl=true`

Fixes: 0ed6a87a106b6e2266e0 "meson: fix platforms=[]"
Reported-by: Christoph Haag <haagch@frickel.club>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomesa: Make sure that imm draws are flushed before other draws execute.
Mathias Fröhlich [Fri, 1 Jun 2018 17:10:08 +0000 (19:10 +0200)]
mesa: Make sure that imm draws are flushed before other draws execute.

The recent patch

    mesa: Remove FLUSH_VERTICES from VAO state changes.

    Pending draw calls on immediate mode or display list calls do
    not depend on changes of the VAO state. So, remove calls to
    FLUSH_VERTICES and flag _NEW_ARRAY as appropriate.

uncovered a problem that non immediate mode draw calls do only
flush outstanding immediate mode draws if FLUSH_UPDATE_CURRENT
is set in ctx->Driver.NeedFlush.
In that case, due to the sequence of _mesa_set_draw_vao commands
we could end up with the VAO from the FLUSH_VERTICES call set
into gl_context::Array._DrawVAO when the array draw is executed.
So the change pulls FLUSH_CURRENT out of _mesa_validate_* calls
into the array draw calls being validated.
The change introduces a new macro FLUSH_FOR_DRAW beside FLUSH_VERTICES
and FLUSH_CURRENT that flushes on changed current attributes as well
as on outstanding immediate mode draw calls. Use FLUSH_FOR_DRAW
in the non immediate mode draw code paths.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Kai Wasserbäch <kai@dev.carbon-project.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106594
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
6 years agovirgl: use bits in caps set v2
gurchetansingh@chromium.org [Mon, 4 Jun 2018 17:25:20 +0000 (10:25 -0700)]
virgl: use bits in caps set v2

Let's add another field to caps v2, that can help report boolean
values.

Suggested-by: Gert Wollny <gert.wollny@collabora.com>
Suggested-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agovirgl: add shader offset alignment to to v2 caps struct
gurchetansingh@chromium.org [Mon, 4 Jun 2018 16:03:37 +0000 (09:03 -0700)]
virgl: add shader offset alignment to to v2 caps struct

This is the SSBO analogue to fe0647. User supplied data must
be a multiple of GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT.

This fixes 44 GLES31 tests on airlied@'s GLES31 sketch branches with
Nvidia hardware, but this patch standalone can applied to master. The
alignment restriction on Nvidia is 32, hence the default value.

Example tests:
   dEQP-GLES31.functional.ssbo.layout.random.all_shared_buffer.0
   dEQP-GLES31.functional.ssbo.layout.multi_basic_types.single_buffer.std430

v2: Move to a better place in case statement
v3: Rebase

Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoi965: Prepare batchbuffer module for softpin support.
Kenneth Graunke [Thu, 5 Apr 2018 08:37:31 +0000 (01:37 -0700)]
i965: Prepare batchbuffer module for softpin support.

If EXEC_OBJECT_PINNED is set, we don't want to emit any relocations.
We simply want to add the BO to the validation list, and possibly mark
it as writeable.  The new brw_use_pinned_bo() interface does just that.

To avoid having to make every caller consider both the relocation and
softpin cases, we make emit_reloc() call brw_use_pinned_bo() when given
a softpinned buffer.

We also can't grow buffers that are softpinned - the mechanism places a
larger BO at the same offset as the original, which requires moving BOs
around in the VMA.  With softpin, we only allocate enough VMA for the
original size of the BO.

v2: Assert that BOs aren't pinned if the kernel says we should move them
    (feedback from Chris Wilson)

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoi965: Add virtual memory allocator infrastructure to brw_bufmgr.
Kenneth Graunke [Tue, 10 Apr 2018 07:39:40 +0000 (00:39 -0700)]
i965: Add virtual memory allocator infrastructure to brw_bufmgr.

This introduces a new fast virtual memory allocator integrated with our
BO cache bucketing.  For larger objects, it falls back to the simple
free-list allocator (util_vma).

This puts the allocators in place but doesn't enable softpin yet.

v2:
 (feedback from Chris Wilson)
 - Check (bo->kflags & EXEC_OBJECT_PINNED) instead of a global flag
 - Avoid vma_free(0ull) on the err_free path.
 - Only enable if the kernel says we have full PPGTT support
 - Make bucketing allocators more resistant to failing to grow arrays
 (feedback from Scott Phillips)
 - Don't use node after popping it from the list.
 - Avoid undefined behavior in canonicalization by reusing new helper
 - Comment updates
 (feedback from myself)
 - Avoid __vma_alloc vs. vma_alloc by making a zero_high_bits helper
   to return a non-canonical address with the high bits zeroed.
 - Don't shadow loop variable 'i' when destroying things (ugly; worked)
v3:
 - Replace zero_high_bits with new common gen_48b_address helper.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoi965: Disable internal CCS for shadows of multi-sampled windows
Jason Ekstrand [Fri, 1 Jun 2018 00:00:35 +0000 (17:00 -0700)]
i965: Disable internal CCS for shadows of multi-sampled windows

If window system supports Y-tiling but not CCS_E, we currently create an
internal CCS for any window system buffers and then resolve right before
handing it off to X or Wayland.  In the case of the single-sampled
shadow of a multi-sampled window system buffer, this is pointless
because the only thing we do with it is use it as a MSAA resolve target
so we do MSAA resolve -> CCS resolve -> hand to the window system.
Instead, just disable CCS for the shadow and then the MSAA resolve will
write uncompressed directly into it.  If the window system supports
CCS_E, we will still use CCS_E, we just won't do internal CCS.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agoi965/miptree: Rename a parameter to create_for_dri_image
Jason Ekstrand [Thu, 31 May 2018 18:42:17 +0000 (11:42 -0700)]
i965/miptree: Rename a parameter to create_for_dri_image

Instead of having it be a general "is this a winsys image" boolean, make
it more specific to the actual purpose.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agointel/eu: Switch to a logical state stack
Jason Ekstrand [Tue, 29 May 2018 21:37:35 +0000 (14:37 -0700)]
intel/eu: Switch to a logical state stack

Instead of the state stack that's based on copying a dummy instruction
around, we start using a logical stack of brw_insn_states.  This uses a
bit less memory and is way less conceptually bogus.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agointel/eu: Set flag [sub]register number differently for 3src
Jason Ekstrand [Tue, 29 May 2018 22:28:36 +0000 (15:28 -0700)]
intel/eu: Set flag [sub]register number differently for 3src

Prior to gen8, the flag [sub]register number is in a different spot on
3src instructions than on other instructions.  Starting with Broadwell,
they made it consistent.  This commit fixes bugs that occur when a
conditional modifier gets propagated into a 3src instruction such as a
MAD.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agointel/eu: Copy fields manually in brw_next_insn
Jason Ekstrand [Tue, 29 May 2018 20:45:57 +0000 (13:45 -0700)]
intel/eu: Copy fields manually in brw_next_insn

Instead of doing a memcpy, this moves us to start with a blank
instruction (memset to zero) and copy the fields over one at a time.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agointel/eu: Add some brw_get_default_ helpers
Jason Ekstrand [Tue, 29 May 2018 21:50:46 +0000 (14:50 -0700)]
intel/eu: Add some brw_get_default_ helpers

This is much cleaner than everything that wants a default value poking
at the bits of p->current directly.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
6 years agotrace: Fix parsing of recent traces.
Jose Fonseca [Thu, 24 May 2018 15:51:38 +0000 (16:51 +0100)]
trace: Fix parsing of recent traces.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agotrace: Fix trace_context_transfer_unmap methods.
Jose Fonseca [Thu, 24 May 2018 15:50:58 +0000 (16:50 +0100)]
trace: Fix trace_context_transfer_unmap methods.

The emitted buffer_subdata/texture_subdata call didn't match the
respective signatures.

v2: Actually emit buffer_subdata call.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agoamd/common: use the dimension-aware image intrinsics on LLVM 7+
Nicolai Hähnle [Fri, 16 Feb 2018 17:44:25 +0000 (18:44 +0100)]
amd/common: use the dimension-aware image intrinsics on LLVM 7+

Requires LLVM trunk r329166.

Acked-by: Marek Olšák <marek.olsak@amd.com>
6 years agoi965: Fix batch-last mode to properly swap BOs.
Kenneth Graunke [Mon, 4 Jun 2018 10:09:59 +0000 (03:09 -0700)]
i965: Fix batch-last mode to properly swap BOs.

On pre-4.13 kernels, which don't support I915_EXEC_BATCH_FIRST, we move
the validation list entry to the end...but incorrectly left the exec_bo
array alone, causing a mismatch where exec_bos[0] no longer corresponded
with validation_list[0] (and similarly for the last entry).

One example of resulting breakage is that we'd update bo->gtt_offset
based on the wrong buffer.  This wreaked total havoc when trying to use
softpin, and likely caused unnecessary relocations in the normal case.

Fixes: 29ba502a4e28471f67e4e904ae503157087efd20 (i965: Use I915_EXEC_BATCH_FIRST when available.)
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
6 years agoradv: fix a GPU hang when MRTs are sparse
Samuel Pitoiset [Fri, 1 Jun 2018 14:22:32 +0000 (16:22 +0200)]
radv: fix a GPU hang when MRTs are sparse

When the i-th target format is set, all previous target formats
must be non-zero to avoid hangs. In other words, without this
if a fragment shader exports mrt0, mrt2 and mrt3, the GPU hangs
because the target format of mrt1 is zero.

This fixes DXVK GPU hangs with "Seven: The Days Long Gone",
"GTA V" and probably more games.

Cc: "18.0" 18.1" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: Don't pass a TESS_EVAL shader when tesselation is not enabled.
Bas Nieuwenhuizen [Sat, 2 Jun 2018 12:25:45 +0000 (14:25 +0200)]
radv: Don't pass a TESS_EVAL shader when tesselation is not enabled.

Otherwise on pre-GFX9, if the constant layout allows both TESS_EVAL and
GEOMETRY shaders, but the PIPELINE has only GEOMETRY, it would return the
GEOMETRY shader for the TESS_EVAL shader.

This would cause the flush_constants code to emit the GEOMETRY constants
to the TESS_EVAL registers and then conclude that it did not need to set
the GEOMETRY shader registers.

Fixes: dfff9fb6f8d "radv: Handle GFX9 merged shaders in radv_flush_constants()"
CC: 18.1 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agonir: implement the GLSL equivalent of if simplication in nir_opt_if
Samuel Pitoiset [Wed, 30 May 2018 12:21:42 +0000 (14:21 +0200)]
nir: implement the GLSL equivalent of if simplication in nir_opt_if

This pass turns:

   if (cond) {
   } else {
      do_work();
   }

into:

   if (!cond) {
      do_work();
   } else {
   }

Here's the vkpipeline-db stats (from affected shaders) on Polaris10:

Totals from affected shaders:
SGPRS: 17272 -> 17296 (0.14 %)
VGPRS: 18712 -> 18740 (0.15 %)
Spilled SGPRs: 1179 -> 1142 (-3.14 %)
Code Size: 1503364 -> 1515176 (0.79 %) bytes
Max Waves: 916 -> 911 (-0.55 %)

This pass only affects Serious Sam 2017 (Vulkan) on my side. The
stats are not really good for now. Some shaders look quite dumb
but this will be improved with further NIR passes, like ifs
combination.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: make is_comparison() a non-static helper function
Samuel Pitoiset [Wed, 30 May 2018 12:21:41 +0000 (14:21 +0200)]
nir: make is_comparison() a non-static helper function

Rename and change the prototype for consistency regarding
nir_tex_instr_is_query(). This function will be used in the
following patch.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
6 years agonir: use num_components wrappers in print/validate.
Dave Airlie [Tue, 15 May 2018 01:11:12 +0000 (11:11 +1000)]
nir: use num_components wrappers in print/validate.

These wrappers were introduces, so start using them.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agodoc: update calendar, add news and link release notes for 18.0.5
Juan A. Suarez Romero [Sun, 3 Jun 2018 10:19:32 +0000 (10:19 +0000)]
doc: update calendar, add news and link release notes for 18.0.5

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
6 years agodocs: add sha256 checksums for 18.0.5
Juan A. Suarez Romero [Sun, 3 Jun 2018 10:11:25 +0000 (10:11 +0000)]
docs: add sha256 checksums for 18.0.5

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
(cherry picked from commit aba161e63a25a07c3c24fec01b6c63c43874b805)

6 years agodocs: add release notes for 18.0.5
Juan A. Suarez Romero [Sun, 3 Jun 2018 09:26:20 +0000 (09:26 +0000)]
docs: add release notes for 18.0.5

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
(cherry picked from commit ca0037aaefcb06ff8e1eb6fbde8f313c45789921)

6 years agoscons: Fix MinGW cross compilation with LLVM 5.0.
Jose Fonseca [Fri, 1 Jun 2018 18:57:31 +0000 (19:57 +0100)]
scons: Fix MinGW cross compilation with LLVM 5.0.

LLVM 5.0 requires additional Win32 libraries, and MinGW with pthreads.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
6 years agoanv: Don't even bother processing relocs if we have softpin
Jason Ekstrand [Fri, 1 Jun 2018 21:26:45 +0000 (14:26 -0700)]
anv: Don't even bother processing relocs if we have softpin

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Refactor reloc handling in execbuf_add_bo
Jason Ekstrand [Fri, 1 Jun 2018 21:59:14 +0000 (14:59 -0700)]
anv: Refactor reloc handling in execbuf_add_bo

This just separates the reloc list vs. BO set cases and lets us avoid an
allocation if relocs->deps->entries == 0.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Assert that the kernel leaves pinned BO addresses alone
Jason Ekstrand [Fri, 1 Jun 2018 21:05:53 +0000 (14:05 -0700)]
anv: Assert that the kernel leaves pinned BO addresses alone

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Soft-pin everything else
Scott D Phillips [Thu, 31 May 2018 03:16:30 +0000 (20:16 -0700)]
anv: Soft-pin everything else

v2 (Jason Ekstrand):
 - Break up Scott's mega-patch

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Soft-pin batch buffers
Scott D Phillips [Thu, 31 May 2018 03:16:04 +0000 (20:16 -0700)]
anv: Soft-pin batch buffers

Co-authored-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv/batch_chain: Simplify secondary batch return chaining
Jason Ekstrand [Thu, 31 May 2018 05:07:30 +0000 (22:07 -0700)]
anv/batch_chain: Simplify secondary batch return chaining

Previously, we did this weird thing where we left space and an empty
relocation for use in a hypothetical MI_BATCH_BUFFER_START that would be
added to the secondary later.  Then, when it came time to chain it into
the primary, we would back that out and emit an MI_BATCH_BUFFER_START.
This worked well but it was always a bit hacky, fragile and ugly.  This
commit instead adds a helper for rewriting the MI_BATCH_BUFFER_START at
the end of an anv_batch_bo and we use that helper for both batch bo list
cloning and handling returns from secondaries.  The new helper doesn't
actually modify the batch in any way but instead just adjusts the
relocation as needed.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv/batch_chain: Call batch_bo_finish at the end of end_batch_buffer
Jason Ekstrand [Thu, 31 May 2018 05:01:46 +0000 (22:01 -0700)]
anv/batch_chain: Call batch_bo_finish at the end of end_batch_buffer

The only reason we were calling it in the middle was that one of the
cases for figuring out the secondary command buffer execution type
wanted batch_bo->length which gets set by batch_bo_finish.  It's easy
enough to recalculate and now batch_bo_finish is called in a sensible
location.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Soft-pin client-allocated memory
Jason Ekstrand [Wed, 30 May 2018 23:06:39 +0000 (16:06 -0700)]
anv: Soft-pin client-allocated memory

Now that we've done all that refactoring, addresses are now being
directly written into surface states by ISL and BLORP whenever a BO is
pinned so there's really nothing to do besides enable it.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv/allocator: Support softpin in the BO cache
Jason Ekstrand [Wed, 30 May 2018 22:25:04 +0000 (15:25 -0700)]
anv/allocator: Support softpin in the BO cache

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv/allocator: Set the BO flags in bo_cache_alloc/import
Jason Ekstrand [Wed, 30 May 2018 22:34:25 +0000 (15:34 -0700)]
anv/allocator: Set the BO flags in bo_cache_alloc/import

It's safer to set them there because we have the opportunity to properly
handle combining flags if a BO is imported more than once.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: For pinned BOs, skip relocations, but track bo usage
Scott D Phillips [Tue, 13 Mar 2018 17:57:39 +0000 (10:57 -0700)]
anv: For pinned BOs, skip relocations, but track bo usage

References to pinned BOs won't need to be relocated at a later
point, so just write the final value of the reference into the bo
directly.

Add a `set` to the relocation lists for tracking dependencies that
were previously tracked by relocations. When a batch is executed, we
add the referenced pinned BOs to the exec list.

v2: - visit bos from the dependency set in a deterministic order (Jason)
v3: - compar => compare, drat (Jason)
    - Reworded commit message, provided by (Jordan)

Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv: Use a separate pool for binding tables when soft pinning
Scott D Phillips [Wed, 14 Mar 2018 17:31:16 +0000 (10:31 -0700)]
anv: Use a separate pool for binding tables when soft pinning

Soft pinning lets us satisfy the binding table address
requirements without using both sides of a growing state_pool.

If you do use both sides of a state pool, then you need to read
the state pool's center_bo_offset (with the device mutex held) to
know the final offset of relocations that target the state pool
bo.

By having a separate pool for binding tables that only grows in
the forward direction, the center_bo_offset is always 0 and
relocations don't need an update pass to adjust relocations with
the mutex held.

v2: - don't introduce a separate state flag for separate binding tables (Jason)
    - replace bo and map accessors with a single binding_table_pool accessor (Jason)
v3: - assert bt_block->offset >= 0 for the separate binding table (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agoanv: Soft-pin state pools
Scott D Phillips [Thu, 1 Mar 2018 17:25:44 +0000 (09:25 -0800)]
anv: Soft-pin state pools

The state_pools reserve virtual address space of the full
BLOCK_POOL_MEMFD_SIZE, but maintain the current behavior of
growing from the middle.

v2: - rename block_pool::offset to block_pool::start_address (Jason)
    - assign state pool start_address statically (Jason)
v3: - remove unnecessary bo_flags tampering for the dynamic pool (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
6 years agonir: Lower !f2b(x) to x == 0.0
Ian Romanick [Thu, 31 May 2018 19:56:00 +0000 (12:56 -0700)]
nir: Lower !f2b(x) to x == 0.0

Some trivial help now, but it also prevents ~40 regressions caused by
Samuel's "nir: implement the GLSL equivalent of if simplication in
nir_opt_if" patch.

All Gen4+ platforms had similar results. (Skylake shown)
total instructions in shared programs: 14369557 -> 14369555 (<.01%)
instructions in affected programs: 442 -> 440 (-0.45%)
helped: 2
HURT: 0

total cycles in shared programs: 532425772 -> 532425743 (<.01%)
cycles in affected programs: 6086 -> 6057 (-0.48%)
helped: 2
HURT: 0

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
6 years agonir: Add some missing "optimization undo" patterns
Ian Romanick [Thu, 31 May 2018 01:06:57 +0000 (18:06 -0700)]
nir: Add some missing "optimization undo" patterns

d8d18516b0a and 03fb13f6467 added some patterns to undo conversions like

   (('ior', ('flt', a, b), ('flt', a, c)), ('flt', a, ('fmax', b, c)))

If further optimization cause some of the operands to either be the same
or be constants, undoing the transformation can lead to further savings.

I don't know why these patterns were not added in those patches.  I did
not check to see which specific patterns actually helped.  I just added
all of them for symmetry.  This prevents some loop unrolling regressions
Plane Shift caused by Samuel's "nir: implement the GLSL equivalent of if
simplication in nir_opt_if" patch.

Skylake and Broadwell had similar results. (Skylake shown)
total instructions in shared programs: 14369768 -> 14369557 (<.01%)
instructions in affected programs: 44076 -> 43865 (-0.48%)
helped: 141
HURT: 0
helped stats (abs) min: 1 max: 5 x̄: 1.50 x̃: 1
helped stats (rel) min: 0.07% max: 1.52% x̄: 0.66% x̃: 0.60%
95% mean confidence interval for instructions value: -1.67 -1.32
95% mean confidence interval for instructions %-change: -0.72% -0.59%
Instructions are helped.

total cycles in shared programs: 532430629 -> 532425772 (<.01%)
cycles in affected programs: 1170832 -> 1165975 (-0.41%)
helped: 101
HURT: 5
helped stats (abs) min: 1 max: 160 x̄: 48.54 x̃: 32
helped stats (rel) min: <.01% max: 8.49% x̄: 2.76% x̃: 2.03%
HURT stats (abs)   min: 2 max: 22 x̄: 9.20 x̃: 4
HURT stats (rel)   min: <.01% max: 0.05% x̄: 0.02% x̃: <.01%
95% mean confidence interval for cycles value: -53.64 -38.00
95% mean confidence interval for cycles %-change: -3.06% -2.20%
Cycles are helped.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agodocs/meson: mention how to use array options
Eric Engestrom [Mon, 14 May 2018 15:39:42 +0000 (16:39 +0100)]
docs/meson: mention how to use array options

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: drop unused empty string array element
Eric Engestrom [Thu, 10 May 2018 15:12:12 +0000 (16:12 +0100)]
meson: drop unused empty string array element

Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: fix platforms=[]
Eric Engestrom [Thu, 10 May 2018 15:11:29 +0000 (16:11 +0100)]
meson: fix platforms=[]

Fixes: 5608d0a2cee47c7d037f ("meson: use array type options")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: fix vulkan-drivers=[]
Eric Engestrom [Thu, 10 May 2018 15:05:05 +0000 (16:05 +0100)]
meson: fix vulkan-drivers=[]

Fixes: 5608d0a2cee47c7d037f ("meson: use array type options")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: fix gallium-drivers=[]
Eric Engestrom [Thu, 10 May 2018 15:04:26 +0000 (16:04 +0100)]
meson: fix gallium-drivers=[]

Fixes: 5608d0a2cee47c7d037f ("meson: use array type options")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agomeson: fix dri-drivers=[]
Eric Engestrom [Thu, 10 May 2018 15:03:30 +0000 (16:03 +0100)]
meson: fix dri-drivers=[]

Fixes: 5608d0a2cee47c7d037f ("meson: use array type options")
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoREVIEWERS: add root meson.build to the Meson reviewers group
Eric Engestrom [Thu, 31 May 2018 10:18:31 +0000 (11:18 +0100)]
REVIEWERS: add root meson.build to the Meson reviewers group

Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
6 years agoglsl: Add ir_binop_vector_extract in NIR
Juan A. Suarez Romero [Wed, 9 May 2018 15:17:59 +0000 (15:17 +0000)]
glsl: Add ir_binop_vector_extract in NIR

Implement ir_binop_vector_extract using NIR operations. Based on SPIR-V
to NIR approach.

This fixes:
dEQP-GLES3.functional.shaders.indexing.moredynamic.with_value_from_indexing_expression_fragment
Piglit's glsl-fs-vec4-indexing-8.shader_test

CC: mesa-stable@lists.freedesktop.org
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Iago Toral <itoral@igalia.com>
6 years agodoc: update calendar, add news and link release notes for 18.1.1
Dylan Baker [Fri, 1 Jun 2018 15:36:12 +0000 (08:36 -0700)]
doc: update calendar, add news and link release notes for 18.1.1

6 years agodocs/relnotes: Add sha256 sums for mesa 18.1.1
Dylan Baker [Fri, 1 Jun 2018 15:34:21 +0000 (08:34 -0700)]
docs/relnotes: Add sha256 sums for mesa 18.1.1

6 years agodocs: Add release notes for 18.1.1
Dylan Baker [Thu, 31 May 2018 22:22:49 +0000 (15:22 -0700)]
docs: Add release notes for 18.1.1

6 years agoi965: Add ARB_fragment_shader_interlock support.
Plamena Manolova [Fri, 27 Apr 2018 14:06:56 +0000 (15:06 +0100)]
i965: Add ARB_fragment_shader_interlock support.

Adds suppport for ARB_fragment_shader_interlock. We achieve
the interlock and fragment ordering by issuing a memory fence
via sendc.

Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
6 years agomesa: Add GL/GLSL plumbing for ARB_fragment_shader_interlock.
Plamena Manolova [Fri, 27 Apr 2018 13:12:30 +0000 (14:12 +0100)]
mesa: Add GL/GLSL plumbing for ARB_fragment_shader_interlock.

This extension provides new GLSL built-in functions
beginInvocationInterlockARB() and endInvocationInterlockARB()
that delimit a critical section of fragment shader code. For
pairs of shader invocations with "overlapping" coverage in a
given pixel, the OpenGL implementation will guarantee that the
critical section of the fragment shader will be executed for
only one fragment at a time.

Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
6 years agocompiler/spirv: reject invalid shader code properly
Martin Pelikán [Fri, 1 Jun 2018 12:27:24 +0000 (14:27 +0200)]
compiler/spirv: reject invalid shader code properly

After bebe3d626e5, b->fail_jump is prepared after vtn_create_builder
which can longjmp(3) to it through its vtx_assert()s.  This corrupts
the stack and creates confusing core dumps, so we need to avoid it.

While there, I decided to print the offending values for debugability.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agodocs: change release manager for 18.1
Juan A. Suarez Romero [Thu, 31 May 2018 11:13:16 +0000 (11:13 +0000)]
docs: change release manager for 18.1

Dylan will replace Emil as the release manager for 18.1.x series.

CC: Emil Velikov <emil.l.velikov@gmail.com>
CC: Dylan Baker <dylan@pnwbakers.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
6 years agovirgl: Always assume that ORIGIN_UPPER_LEFT and PIXEL_CENTER* are supported
Gert Wollny [Wed, 16 May 2018 16:35:29 +0000 (18:35 +0200)]
virgl: Always assume that ORIGIN_UPPER_LEFT and PIXEL_CENTER* are supported

The driver must support at least one of

  PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT
  PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT

and one of

  PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER
  PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER

otherwise glsl_to_tgsi will fire an assert.

ORIGIN_UPPER_LEFT is the default convention, and is supported by
all mesa drivers, hence it seems reasonable to always report the caps
to be enabled.  On gles ORIGIN_LOWER_LEFT is generally not supported,
so we rely on the caps reported by the host that depend on whether we
run on an GL or an EGL host.

For PIXEL_CENTER it is completely host driver dependend on what is
supported, and since we do not report the actual host driver capabilities
it is best to mark both as supported, this is how it works for a GL
host too.

Fixes:
   dEQP-GLES3.functional.shaders.builtin_variable.fragcoord_xyz
   dEQP-GLES3.functional.shaders.metamorphic.bubblesort_flag.variant_1
   dEQP-GLES3.functional.shaders.metamorphic.bubblesort_flag.variant_2

Reviewed-by: Gurchetan Singh <gurcetansingh@chromium.org>
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Jakob Bornecrantz <jakob@collabora.com>
6 years agoradeonsi: Fix crash on shaders using MSAA image load/store
Alex Smith [Wed, 30 May 2018 08:39:27 +0000 (09:39 +0100)]
radeonsi: Fix crash on shaders using MSAA image load/store

The value returned by tgsi_util_get_texture_coord_dim() does not
account for the sample index. This means image_fetch_coords() will not
fetch it, leading to a null deref in ac_build_image_opcode() which
expects it to be present (the return value of ac_num_coords() *does*
include the sample index).

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Cc: "18.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
6 years agoradv: Handle GFX9 merged shaders in radv_flush_constants()
Alex Smith [Thu, 31 May 2018 14:28:27 +0000 (15:28 +0100)]
radv: Handle GFX9 merged shaders in radv_flush_constants()

This was not previously handled correctly. For example,
push_constant_stages might only contain MESA_SHADER_VERTEX because
only that stage was changed by CmdPushConstants or
CmdBindDescriptorSets.

In that case, if vertex has been merged with tess control, then the
push constant address wouldn't be updated since
pipeline->shaders[MESA_SHADER_VERTEX] would be NULL.

Use radv_get_shader() instead of getting the shader directly so that
we get the right shader if merged. Also, skip emitting the address
redundantly - if two merged stages are set in push_constant_stages
this change would have made the address get emitted twice.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Cc: "18.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: Consolidate GFX9 merged shader lookup logic
Alex Smith [Thu, 31 May 2018 14:18:52 +0000 (15:18 +0100)]
radv: Consolidate GFX9 merged shader lookup logic

This was being handled in a few different places, consolidate it into a
single radv_get_shader() function.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Cc: "18.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: Set active_stages the same whether or not shaders were cached
Alex Smith [Thu, 31 May 2018 14:02:32 +0000 (15:02 +0100)]
radv: Set active_stages the same whether or not shaders were cached

With GFX9 merged shaders, active_stages would be set to the original
stages specified if shaders were not cached, but to the stages still
present after merging if they were.

Be consistent and use the original stages.

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Cc: "18.1" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agost/mesa: relax requirements for ARB_ES3_compatibility
Marek Olšák [Thu, 31 May 2018 19:20:48 +0000 (15:20 -0400)]
st/mesa: relax requirements for ARB_ES3_compatibility

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

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoanv/blorp: Write relocated values into surface states
Scott D Phillips [Thu, 31 May 2018 03:24:15 +0000 (20:24 -0700)]
anv/blorp: Write relocated values into surface states

v2 (Jason Ekstrand):
 - Split the blorp bit into it's own patch and re-order a bit
 - Use anv_address helpers

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoanv: Use an address for each anv_image plane
Jason Ekstrand [Thu, 31 May 2018 01:55:00 +0000 (18:55 -0700)]
anv: Use an address for each anv_image plane

This is better than having BO and offset fields.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv/cmd_buffer: Rework surface relocation helpers
Jason Ekstrand [Thu, 31 May 2018 01:30:50 +0000 (18:30 -0700)]
anv/cmd_buffer: Rework surface relocation helpers

This commit renames add_surface_state_reloc to add_surface_reloc and
makes it takes an address.  We also rename add_image_view_relocs to
add_surface_state_relocs because it takes an anv_surface_state and
doesn't really care about the image view anymore.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Use an anv_address in anv_buffer
Jason Ekstrand [Thu, 31 May 2018 01:05:54 +0000 (18:05 -0700)]
anv: Use an anv_address in anv_buffer

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv/cmd_buffer: Use anv_address for handling indirect parameters
Jason Ekstrand [Thu, 31 May 2018 01:02:43 +0000 (18:02 -0700)]
anv/cmd_buffer: Use anv_address for handling indirect parameters

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Use an anv_address in anv_buffer_view
Jason Ekstrand [Thu, 31 May 2018 00:36:49 +0000 (17:36 -0700)]
anv: Use an anv_address in anv_buffer_view

Instead of storing a BO and offset separately, use an anv_address.  This
changes anv_fill_buffer_surface_state to use anv_address and we now call
anv_address_physical and pass that into ISL.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Use full anv_addresses in anv_surface_state
Jason Ekstrand [Thu, 31 May 2018 00:16:52 +0000 (17:16 -0700)]
anv: Use full anv_addresses in anv_surface_state

This refactors surface state filling to work entirely in terms of
anv_addresses instead of offsets.  This should make things simpler for
when we go to soft-pin image buffers.  Among other things,
add_image_view_relocs now only cares about the addresses in the surface
state and doesn't really need the image view anymore.

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Add some anv_address helpers
Jason Ekstrand [Thu, 31 May 2018 01:16:50 +0000 (18:16 -0700)]
anv: Add some anv_address helpers

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>