mesa.git
6 years agobroadcom/vc5: Print the buffer name in simulator overflow checks.
Eric Anholt [Fri, 12 Jan 2018 01:22:58 +0000 (17:22 -0800)]
broadcom/vc5: Print the buffer name in simulator overflow checks.

Revealed that I was writing past the TSDA, not the Z buffer as I expected.

6 years agobroadcom/vc5: Add support for loading varyings in V3D 4.1.
Eric Anholt [Thu, 11 Jan 2018 19:53:13 +0000 (11:53 -0800)]
broadcom/vc5: Add support for loading varyings in V3D 4.1.

The LDVARY signal now writes an arbitrary register, so I took out the
magic src register file and replaced it with an instruction with LDVARY
set so we have somewhere to hang a QFILE_TEMP destination for register
allocation.

6 years agobroadcom/vc5: Update state setup for V3D 4.1.
Eric Anholt [Wed, 10 Jan 2018 23:49:47 +0000 (15:49 -0800)]
broadcom/vc5: Update state setup for V3D 4.1.

6 years agobroadcom/vc5: Add compiler support for V3D 4.x texturing.
Eric Anholt [Wed, 10 Jan 2018 20:51:08 +0000 (12:51 -0800)]
broadcom/vc5: Add compiler support for V3D 4.x texturing.

6 years agobroadcom/vc5: Add the new TMU write addresses for V3D 4.x (and r5rep).
Eric Anholt [Wed, 10 Jan 2018 21:56:11 +0000 (13:56 -0800)]
broadcom/vc5: Add the new TMU write addresses for V3D 4.x (and r5rep).

The V3D 3.x series of TMU writes with meaning depending on the texture
type is replaced with writes to specific registers for each texture
argument semantic.

6 years agobroadcom/vc5: Move V3D 3.3 texturing to a separate file.
Eric Anholt [Wed, 10 Jan 2018 20:48:05 +0000 (12:48 -0800)]
broadcom/vc5: Move V3D 3.3 texturing to a separate file.

V3D 4.x texturing changes enough that #ifdefs would just make a mess of
it.

6 years agobroadcom/vc5: Move V3D 3.3 VPM write setup to a separate file.
Eric Anholt [Wed, 10 Jan 2018 20:22:38 +0000 (12:22 -0800)]
broadcom/vc5: Move V3D 3.3 VPM write setup to a separate file.

For V4.1 texturing, I need the V4.1 XML, so the main compiler needs to
stop including V3.3 XML.

6 years agobroadcom/vc5: Set up depth formats for V3D 4.x.
Eric Anholt [Wed, 10 Jan 2018 00:02:44 +0000 (16:02 -0800)]
broadcom/vc5: Set up depth formats for V3D 4.x.

We no longer have the small depth-specific output format enum, and instead
depth is just at the end of the output image format enum.

6 years agobroadcom/vc5: Always use the RGBA8 formats for RGBX8.
Eric Anholt [Wed, 10 Jan 2018 00:09:10 +0000 (16:09 -0800)]
broadcom/vc5: Always use the RGBA8 formats for RGBX8.

The RGBX8 formats were dropped from V3D 4.x, but we don't really need them
anyway (we already handle other non-alpha formats by forcing A to 1).

6 years agobroadcom/vc5: Move the formats table to per-V3D-version compile.
Eric Anholt [Tue, 9 Jan 2018 23:46:34 +0000 (15:46 -0800)]
broadcom/vc5: Move the formats table to per-V3D-version compile.

6 years agobroadcom/vc5: Add support for V3D 4.1 CLIF dumping.
Eric Anholt [Tue, 9 Jan 2018 23:23:21 +0000 (15:23 -0800)]
broadcom/vc5: Add support for V3D 4.1 CLIF dumping.

6 years agobroadcom/vc5: Move the body of CLIF dumping to a per-version file.
Eric Anholt [Tue, 9 Jan 2018 23:13:27 +0000 (15:13 -0800)]
broadcom/vc5: Move the body of CLIF dumping to a per-version file.

I want the library's entrypoints to still be unversioned, but the actual
packet dumping needs to be per-version.

6 years agobroadcom/vc5: Use THRSW to enable multi-threaded shaders.
Eric Anholt [Mon, 8 Jan 2018 19:55:31 +0000 (11:55 -0800)]
broadcom/vc5: Use THRSW to enable multi-threaded shaders.

This is a major performance boost on all of V3D, but is required on V3D
4.x where shaders are always either 2- or 4-threaded.

6 years agobroadcom/vc5: Properly schedule the thread-end THRSW.
Eric Anholt [Tue, 9 Jan 2018 17:40:57 +0000 (09:40 -0800)]
broadcom/vc5: Properly schedule the thread-end THRSW.

This fills in the delay slots of thread end as much as we can (other than
being cautious about potential TLBZ writes).

In the process, I moved the thread end THRSW instruction creation to the
scheduler.  Once we start emitting THRSWs in the shader, we need to
schedule the thread-end one differently from other THRSWs, so having it in
there makes that easy.

6 years agobroadcom/vc5: Implement GFXH-1684 workaround.
Eric Anholt [Sat, 6 Jan 2018 01:23:13 +0000 (17:23 -0800)]
broadcom/vc5: Implement GFXH-1684 workaround.

Apparently the VPM writes need to be flushed out before we end the shader.

6 years agobroadcom/vc5: Port drawing commands to V3D 4.x.
Eric Anholt [Fri, 5 Jan 2018 07:19:08 +0000 (23:19 -0800)]
broadcom/vc5: Port drawing commands to V3D 4.x.

This required extending the CL submit ioctl, because the tile alloc/state
buffer setup has moved from the BCL to register writes.

6 years agobroadcom/vc5: Add a test for .ifb in ADD ops.
Eric Anholt [Fri, 5 Jan 2018 00:01:19 +0000 (16:01 -0800)]
broadcom/vc5: Add a test for .ifb in ADD ops.

I had a .ifb being decoded weird in sampid, so this is to check that .ifb
is fine.

6 years agobroadcom/vc5: Add the new tesselation opcodes in V3D 4.1.
Eric Anholt [Thu, 4 Jan 2018 23:41:11 +0000 (15:41 -0800)]
broadcom/vc5: Add the new tesselation opcodes in V3D 4.1.

6 years agobroadcom/vc5: Use a physical-reg-only register class for LDVPM.
Eric Anholt [Fri, 5 Jan 2018 22:34:51 +0000 (14:34 -0800)]
broadcom/vc5: Use a physical-reg-only register class for LDVPM.

This is needed for LDVPM on V3D 4.x, but will also be needed for keeping
values out of the accumulators across THRSW.

6 years agobroadcom/vc5: Use the new LDVPM/STVPM opcodes on V3D 4.1.
Eric Anholt [Thu, 4 Jan 2018 23:35:28 +0000 (15:35 -0800)]
broadcom/vc5: Use the new LDVPM/STVPM opcodes on V3D 4.1.

Now, instead of a magic write register for VPM stores we have an
instruction to do them (which means no packing of other ALU ops into it),
with the ability to reorder the VPM stores due to the offset being baked
into the instruction.

VPM loads also gain the ability to be reordered by packing the row into
the A argument.  They also no longer write to the r3 accumulator, and
instead must be stored to a physical register.

6 years agobroadcom/vc5: Drop dead VC5_QPU_* defines from qpu_instr.c.
Eric Anholt [Thu, 11 Jan 2018 18:46:09 +0000 (10:46 -0800)]
broadcom/vc5: Drop dead VC5_QPU_* defines from qpu_instr.c.

I had all the packing code in this file at one point, but these defines
now live in qpu_pack.c.

6 years agobroadcom/vc5: Add support for QPU pack/unpack/disasm of small immediates.
Eric Anholt [Fri, 5 Jan 2018 06:47:54 +0000 (22:47 -0800)]
broadcom/vc5: Add support for QPU pack/unpack/disasm of small immediates.

6 years agobroadcom/vc5: Enable the driver on V3D 4.1
Eric Anholt [Thu, 4 Jan 2018 19:33:16 +0000 (11:33 -0800)]
broadcom/vc5: Enable the driver on V3D 4.1

6 years agobroadcom/vc5: Port the simulator to support V3D 4.1
Eric Anholt [Thu, 4 Jan 2018 19:32:46 +0000 (11:32 -0800)]
broadcom/vc5: Port the simulator to support V3D 4.1

This required moving the register accesses to a separate v3dx file, since
the register definitions for each V3D version collide.  It seems that
initializing the v3d_hw from a file dictating 3.3
(v3d_simulator_wrapper.cpp) is safe, though.

6 years agobroadcom/vc5: Drop signal bit #defines.
Eric Anholt [Thu, 4 Jan 2018 19:21:33 +0000 (11:21 -0800)]
broadcom/vc5: Drop signal bit #defines.

Signals are more complicated than that, and tables ended up being better.

6 years agobroadcom/vc5: Add support for V3Dv4 signal bits.
Eric Anholt [Thu, 4 Jan 2018 05:42:33 +0000 (21:42 -0800)]
broadcom/vc5: Add support for V3Dv4 signal bits.

The WRTMUC replaces the implicit uniform loads in the first two texture
instructions.  LDVPM disappears in favor of an ALU op.  LDVARY, LDTMU,
LDTLB, and LDUNIF*RF now write to arbitrary registers, which required
passing the devinfo through to a few more functions.

6 years agobroadcom/vc5: Fix pack/unpack of vfmul input unpack flags.
Eric Anholt [Thu, 4 Jan 2018 18:34:36 +0000 (10:34 -0800)]
broadcom/vc5: Fix pack/unpack of vfmul input unpack flags.

6 years agobroadcom/vc5: Port the RCL setup to V3D4.1.
Eric Anholt [Thu, 28 Dec 2017 22:00:15 +0000 (14:00 -0800)]
broadcom/vc5: Port the RCL setup to V3D4.1.

The TLB load/store path is rebuilt in this version.  There is no longer a
single-byte resolved store or the 3-byte extended store.  Instead, you get
to always use general loads/stores (which, honestly, was tempting even in
previous versions).

6 years agobroadcom/vc5: Fix per-tile extra clear packet.
Eric Anholt [Tue, 9 Jan 2018 22:59:19 +0000 (14:59 -0800)]
broadcom/vc5: Fix per-tile extra clear packet.

I accidentally emitted this into the RCL instead of the per-tile generic
list, so we wouldn't get tiles after the first cleared.

6 years agobroadcom/vc5: Move the TLB loads and stores to helper functions.
Eric Anholt [Wed, 3 Jan 2018 19:08:53 +0000 (11:08 -0800)]
broadcom/vc5: Move the TLB loads and stores to helper functions.

This is going to get more complicated with V3D 4.1 support, which redoes
all the TLB packets.

6 years agobroadcom/vc5: Convert vc5_cl.h to use the V3DX() macros.
Eric Anholt [Wed, 3 Jan 2018 20:42:13 +0000 (12:42 -0800)]
broadcom/vc5: Convert vc5_cl.h to use the V3DX() macros.

To conditionally compile cl_emit() macros per V3D version, we need it to
expand to whatever V3D we're building for.  This required emitting #define
V3D_VERSION 33 in all our currently 3.3-only code.

6 years agobroadcom/vc5: Introduce v3dx_macros.h and v3dx_pack.h headers.
Eric Anholt [Tue, 10 Oct 2017 20:25:45 +0000 (13:25 -0700)]
broadcom/vc5: Introduce v3dx_macros.h and v3dx_pack.h headers.

This will be used by vc5 for prefixing functions and including the pack
header in v3d-version-dependent code, following the model of anv.

6 years agobroadcom/cle: Fix error path of missing a "type" in the XML.
Eric Anholt [Thu, 28 Dec 2017 21:51:36 +0000 (13:51 -0800)]
broadcom/cle: Fix error path of missing a "type" in the XML.

We try to emit a #error and continue so that you can debug the missing
type at C compile time, but were missing a couple of definitions in that
path (sigh, python).

6 years agobroadcom/vc5: Add XML for V3D v4.1 (BCM7278)
Eric Anholt [Thu, 28 Dec 2017 00:18:02 +0000 (16:18 -0800)]
broadcom/vc5: Add XML for V3D v4.1 (BCM7278)

6 years agoac: add 'const' qualifiers to the shader info pass
Samuel Pitoiset [Thu, 11 Jan 2018 21:07:25 +0000 (22:07 +0100)]
ac: add 'const' qualifiers to the shader info pass

For clarification purposes.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoac: remove unused ac_nir_compiler_options from gather_info_input_decl()
Samuel Pitoiset [Thu, 11 Jan 2018 21:07:24 +0000 (22:07 +0100)]
ac: remove unused ac_nir_compiler_options from gather_info_input_decl()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agonir: add a 'const' qualifier to nir_ssa_def_components_read()
Samuel Pitoiset [Thu, 11 Jan 2018 21:07:23 +0000 (22:07 +0100)]
nir: add a 'const' qualifier to nir_ssa_def_components_read()

To avoid compilation warnings and because this helper
shouldn't update anything.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoloader/dri3: Avoid freeing renderbuffers in use
Thomas Hellstrom [Thu, 11 Jan 2018 09:19:23 +0000 (10:19 +0100)]
loader/dri3: Avoid freeing renderbuffers in use

Upon reception of an event that lowered the number of active back buffers,
the code would immediately try to free all back buffers with an id equal to or
higher than the new number of active back buffers.

However, that could lead to an active or to-be-active back buffer being freed,
since the old number of back buffers was used when obtaining an idle back
buffer for use.

This lead to crashes when lowering the number of active back buffers by
transitioning from page-flipping to non-page-flipping presents.

Fix this by computing the number of active back buffers only when trying to
obtain a new back buffer.

Fixes: 15e208c4cc ("loader/dri3: Don't accidently free buffer holding new back content")
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104214
Cc: "17.3" <mesa-stable@lists.freedesktop.org>
Tested-by: Andriy.Khulap <andriy.khulap@globallogic.com>
Tested-by: Vadym Shovkoplias <vadym.shovkoplias@globallogic.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
6 years agoanv: VkDescriptorSetLayoutBinding can have descriptorCount == 0
Samuel Iglesias Gonsálvez [Thu, 11 Jan 2018 10:15:30 +0000 (11:15 +0100)]
anv: VkDescriptorSetLayoutBinding can have descriptorCount == 0

From Vulkan spec:

"descriptorCount is the number of descriptors contained in the binding,
accessed in a shader as an array. If descriptorCount is zero this
binding entry is reserved and the resource must not be accessed from
any stage via this binding within any pipeline using the set layout."

Fixes:

dEQP-VK.binding_model.descriptor_update.empty_descriptor.uniform_buffer

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: mesa-stable@lists.freedesktop.org
6 years agomesa: require at least 14 UBOs for GL 4.3
Roland Scheidegger [Thu, 11 Jan 2018 01:10:25 +0000 (02:10 +0100)]
mesa: require at least 14 UBOs for GL 4.3

ARB_ubo requires 12 UBOs (per stage) at least, but this limit has been
raised by GL 4.3 to 14, so don't advertize GL 4.3 without it (only checking
the vertex stage since all drivers probably have the same limit anyway for
other stages). (piglit has minmax tests for that kind of thing, but they go
only up to 3.3, so this won't really be noticed.)
I think this currently should not affect any driver - r600 until very
recently only supported 12 but now advertizes 14 too.

Reviewed-by: Brian Paul <brianp@vmware.com>
6 years agoutil: fix NORETURN for msvc, add HAVE_FUNC_ATTRIBUTE_NORETURN to c99_compat.h
Roland Scheidegger [Thu, 11 Jan 2018 00:49:00 +0000 (01:49 +0100)]
util: fix NORETURN for msvc, add HAVE_FUNC_ATTRIBUTE_NORETURN to c99_compat.h

We've seen some problems internally due to macro redefinition.
Fix this by adding HAVE_FUNC_ATTRIBUTE_NORETURN to c99_compat.h,
and defining it for msvc.
And avoid redefinition just in case.

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
6 years agoradv: don't emit unneeded vertex state.
Dave Airlie [Wed, 10 Jan 2018 22:02:52 +0000 (08:02 +1000)]
radv: don't emit unneeded vertex state.

If the number of instances hasn't changed and we've already
emitted it, don't emit it again.

If the vertex shader is the same and the first_instance, vertex_offset
haven't changed don't emit them again.

This increases the fps in GL_vs_VK -t 1 -m -api vk from around 40
to around 60 here, it may not impact anything else.

Dieter also reported smoketest going from 1060->1200 fps.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: trim buffer load result (fixes dota2)
Dave Airlie [Thu, 11 Jan 2018 02:10:23 +0000 (02:10 +0000)]
radv: trim buffer load result (fixes dota2)

Running dota2 since the below commit crashes with an llvm assert.

Trim the vector like the other user. This possible could also be
avoided by not padding inside the load vec3->vec4.

Fixes: 41c36c4549 (amd/common: use ac_build_buffer_load() for emitting UBO loads)
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
6 years agomeson: add variable for including include/GL/internal
Dylan Baker [Wed, 3 Jan 2018 20:37:34 +0000 (12:37 -0800)]
meson: add variable for including include/GL/internal

Signed-off-by: <dylan.c.baker@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: define inc_gbm as empty if not otherwise assigned
Dylan Baker [Wed, 3 Jan 2018 20:33:55 +0000 (12:33 -0800)]
meson: define inc_gbm as empty if not otherwise assigned

Otherwise this could be undefined in the egl directory.

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: move libsensors dependency to libgallium
Dylan Baker [Tue, 12 Dec 2017 20:25:34 +0000 (12:25 -0800)]
meson: move libsensors dependency to libgallium

This simplifies the build by removing the need to link targets against
libsensors.

Suggested-by: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
6 years agomeson: Use dependencies for nir
Dylan Baker [Tue, 12 Dec 2017 20:22:56 +0000 (12:22 -0800)]
meson: Use dependencies for nir

This creates two new internal dependencies, idep_nir_headers and
idep_nir. The former encapsulates the generation of nir_opcodes.h and
nir_builder_opcodes.h and adding src/compiler/nir as an include path.
This ensures that any target that needs nir headers will have the
includes and that the generated headers will be generated before the
target is build. The second, idep_nir, includes the first and
additionally links to libnir.

This is intended to make it easier to avoid race conditions in the build
when using nir, since the number of consumers for libnir and it's
headers are quite high.

Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
6 years agomeson: don't use intermediate variables that are immediately discarded
Dylan Baker [Tue, 12 Dec 2017 00:16:56 +0000 (16:16 -0800)]
meson: don't use intermediate variables that are immediately discarded

For things like:
loop
    x = func()
    list += x
end

just do:
loop
    list += func()
end

Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
6 years agomeson: Use consistent style for tests
Dylan Baker [Tue, 12 Dec 2017 00:13:31 +0000 (16:13 -0800)]
meson: Use consistent style for tests

Don't use intermediate variables, use consistent whitespace.

Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
6 years agomeson: Use include variables
Dylan Baker [Mon, 11 Dec 2017 23:58:00 +0000 (15:58 -0800)]
meson: Use include variables

These were added after adderlib was mesonified, but it still good to use
them instead of open coding them.

Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
6 years agomeson: Use consistent style
Dylan Baker [Mon, 11 Dec 2017 23:56:08 +0000 (15:56 -0800)]
meson: Use consistent style

Currently the meosn build has a mix of two styles:
arg : [foo, ...
       bar],

and
arg : [
  foo, ...,
  bar,
]

For consistency let's pick one. I've picked the later style, which I
think is more readable, and is more common in the mesa code base.

v2: - fix commit message

Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
6 years agoi965: Use UD types for gl_SampleID setup
Jason Ekstrand [Sat, 6 Jan 2018 02:50:14 +0000 (18:50 -0800)]
i965: Use UD types for gl_SampleID setup

We already had to switch all of the W types to UW to prevent issues
with vector immediates on gen10.  We may as well use unsigned types
everywhere.

Reviewed-by: Matt Turner <mattst88@gmail.com>
6 years agoi965/fs: Use UW types when using V immediates
Jason Ekstrand [Sat, 6 Jan 2018 02:26:58 +0000 (18:26 -0800)]
i965/fs: Use UW types when using V immediates

Gen 10 has a strange hardware bug involving V immediates with W types.
It appears that a mov(8) g2<1>W 0x76543210V will actually result in g2
getting the value {3, 2, 1, 0, 3, 2, 1, 0}.  In particular, the bottom
four nibbles are repeated instead of the top four being taken.  (A mov
of 0x00003210V yields the same result.)  This bug does not appear in any
hardware documentation as far as we can tell and the simulator does not
implement the bug either.

Commit 6132992cdb858268af0e985727d80e4140be389c was mostly a no-op
except that it changed the type of the subgroup invocation from UW to W
and caused us to tickle this bug with basically every compute shader
that uses any sort of invocation ID (which is most of them).  This is
also potentially an issue for geometry shader input pulls and SampleID
setup.  The easy solution is just to change the few places where we use
a vector integer immediate with a W type to use a UW type.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Cc: mesa-stable@lists.freedesktop.org
Fixes: 6132992cdb858268af0e985727d80e4140be389c
6 years agoac/nir: fix translation of nir_op_fsign for doubles
Timothy Arceri [Thu, 11 Jan 2018 11:10:47 +0000 (22:10 +1100)]
ac/nir: fix translation of nir_op_fsign for doubles

Without this we end up with the llvm error message:

"Both operands to a binary operator are not of the same type!"

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoac: add f64_0 to the llvm build context
Timothy Arceri [Thu, 11 Jan 2018 11:09:35 +0000 (22:09 +1100)]
ac: add f64_0 to the llvm build context

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoac/nir: fix translation of nir_op_frcp for doubles
Timothy Arceri [Thu, 11 Jan 2018 10:11:00 +0000 (21:11 +1100)]
ac/nir: fix translation of nir_op_frcp for doubles

Without this we end up with the llvm error message:

"Both operands to a binary operator are not of the same type!"

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoac/nir: fix translation of nir_op_frsq for doubles
Timothy Arceri [Thu, 11 Jan 2018 06:04:22 +0000 (17:04 +1100)]
ac/nir: fix translation of nir_op_frsq for doubles

Without this we end up with the llvm error message:

"Both operands to a binary operator are not of the same type!"

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoac: add f64_1 to the llvm build context
Timothy Arceri [Thu, 11 Jan 2018 06:03:36 +0000 (17:03 +1100)]
ac: add f64_1 to the llvm build context

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoradv: reset semaphores & fences on sync_file export.
Bas Nieuwenhuizen [Thu, 4 Jan 2018 01:55:39 +0000 (02:55 +0100)]
radv: reset semaphores & fences on sync_file export.

Per spec:

"Additionally, exporting a fence payload to a handle with copy transference has the same side effects
on the source fence’s payload as executing a fence reset operation. If the fence was using a
temporarily imported payload, the fence’s prior permanent payload will be restored."

And similar for semaphores:

"Additionally, exporting a semaphore payload to a handle with copy transference has the same side
effects on the source semaphore’s payload as executing a semaphore wait operation. If the
semaphore was using a temporarily imported payload, the semaphore’s prior permanent payload
will be restored."

Fixes: 42bc25a79c "radv: Advertise sync fd import and export."
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agointel: Add more Coffee Lake PCI IDs
Anuj Phogat [Fri, 5 Jan 2018 17:17:36 +0000 (09:17 -0800)]
intel: Add more Coffee Lake PCI IDs

More Coffee Lake PCI IDs have been added to the spec.

Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
6 years agoRevert "Revert "i965/fs: Use align1 mode on ternary instructions on Gen10+""
Matt Turner [Fri, 5 Jan 2018 17:46:11 +0000 (09:46 -0800)]
Revert "Revert "i965/fs: Use align1 mode on ternary instructions on Gen10+""

This reverts commit 2d0457203871c843ebfc90fb895b65a9b14cd9bb.

Acked-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoi965/fs: Add/use functions to convert to 3src_align1 vstride/hstride
Matt Turner [Mon, 11 Dec 2017 19:44:48 +0000 (11:44 -0800)]
i965/fs: Add/use functions to convert to 3src_align1 vstride/hstride

Some cases weren't handled, such as stride 4 which is needed for 64-bit
operations. Presumably fixes the assertion failure mentioned in commit
2d0457203871 (Revert "i965/fs: Use align1 mode on ternary instructions
on Gen10+") but who can really say since the commit neglected to list
any of them!

Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
6 years agoanv: Make sure state on primary is correct after CmdExecuteCommands
Alex Smith [Tue, 9 Jan 2018 16:49:02 +0000 (08:49 -0800)]
anv: Make sure state on primary is correct after CmdExecuteCommands

After executing a secondary command buffer, we need to update certain
state on the primary command buffer to reflect changes by the secondary.
Otherwise subsequent commands may not have the correct state set.

This fixes various issues (rendering errors, GPU hangs) seen after
executing secondary command buffers in some cases.

v2 (Jason Ekstrand):
 - Reset to invalid values instead of pulling from the secondary
 - Change the comment to be more descriptive

Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Cc: mesa-stable@lists.freedesktop.org
6 years agosvga: simplify failure code in emit_rss_vgpu9()
Brian Paul [Fri, 29 Dec 2017 17:03:43 +0000 (10:03 -0700)]
svga: simplify failure code in emit_rss_vgpu9()

No need for a goto.

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agosvga: remove unused fail parameter to EMIT_RS(), EMIT_RS_FLOAT()
Brian Paul [Fri, 29 Dec 2017 17:02:10 +0000 (10:02 -0700)]
svga: remove unused fail parameter to EMIT_RS(), EMIT_RS_FLOAT()

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agosvga: add assertion in svga_queue_rs()
Brian Paul [Fri, 29 Dec 2017 16:59:02 +0000 (09:59 -0700)]
svga: add assertion in svga_queue_rs()

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agosvga: whitespace/formatting fixes in svga_state_rss.c
Brian Paul [Fri, 29 Dec 2017 16:54:26 +0000 (09:54 -0700)]
svga: whitespace/formatting fixes in svga_state_rss.c

Reviewed-by: Neha Bhende <bhenden@vmware.com>
Reviewed-by: Charmaine Lee <charmainel@vmware.com>
6 years agoanv: Import mako templates only during execution of anv_extensions
Andres Gomez [Wed, 10 Jan 2018 21:11:51 +0000 (23:11 +0200)]
anv: Import mako templates only during execution of anv_extensions

anv_extensions usage from anv_icd was bringing the unwanted dependency
of mako templates for the latter. We don't want that since it will
force the dependency even for distributable tarballs which was not
needed until now.

Jason suggested this approach.

v2: Patch simplification (Jason).

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104551
Fixes: 0ab04ba979b ("anv: Use python to generate ICD json files")
Cc: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: Emil Velikov <emil.velikov@collabora.com>
Signed-off-by: Andres Gomez <agomez@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoglsl: cleanup shader_cache header guard
Tapani Pälli [Thu, 28 Dec 2017 07:30:08 +0000 (09:30 +0200)]
glsl: cleanup shader_cache header guard

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agoanv: fix maxDescriptorSet* limits
Samuel Iglesias Gonsálvez [Wed, 10 Jan 2018 08:15:50 +0000 (09:15 +0100)]
anv: fix maxDescriptorSet* limits

"The maxDescriptorSet* limit is n times the corresponding
maxPerStageDescriptor* limit, where n is the number of shader stages
supported by the VkPhysicalDevice. If all shader stages are supported,
n = 6 (vertex, tessellation control, tessellation evaluation,
geometry, fragment, compute)."

Fixes:

dEQP-VK.api.info.device.properties

Signed-off-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoac: add load_patch_vertices_in() to the abi
Timothy Arceri [Wed, 10 Jan 2018 06:01:10 +0000 (17:01 +1100)]
ac: add load_patch_vertices_in() to the abi

Fixes the follow test for radeonsi nir:

tests/spec/arb_tessellation_shader/execution/quads.shader_test

Also stops 8 other tests from crashing, they now just fail e.g.

tcs-output-array-float-index-rd-after-barrier.shader_test

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
6 years agoac/nir: Sanitize location_frac for local variables.
Bas Nieuwenhuizen [Wed, 10 Jan 2018 16:05:10 +0000 (17:05 +0100)]
ac/nir: Sanitize location_frac for local variables.

If they were promoted from inputs/outputs, they could have a
non-zero value left over, which messed with our store handling.

Fixes: 06f05040eb "radv: Link shaders."
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
6 years agotgsi: include struct definitions for tgsi_build declarations
Rob Herring [Mon, 8 Jan 2018 21:17:48 +0000 (15:17 -0600)]
tgsi: include struct definitions for tgsi_build declarations

Many of the functions declared in tgsi_build.h return structs (not struct
pointers). Therefore the full struct definitions are needed to avoid
warnings or errors:

In file included from src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp:23:
external/mesa3d/src/gallium/auxiliary/tgsi/tgsi_build.h:47:1: error: 'tgsi_build_header' has C-linkage specified, but returns incomplete type 'struct tgsi_header' which could be incompatible with C [-Werror,-Wreturn-type-c-linkage]

This error shows up on Android builds using clang and -Werror.

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Rob Herring <robh@kernel.org>
6 years agoswr: Handle indirect indices in GS
George Kyriazis [Wed, 20 Dec 2017 19:56:45 +0000 (13:56 -0600)]
swr: Handle indirect indices in GS

BuilderSWR::swr_gs_llvm_fetch_input() (and consequently
 swr_gs_llvm_fetch_input()), did not handle the case where
is_vindex_indirect or is_aindex_direct is set.

Implement it, using the code in draw_llvm.c as a guideline.

Fixes the following piglit tests:
dynamic_input_array_index (crash)
gs-input-array-vec4-index-rd
vs-output-array-vec4-index-wr-before-gs

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoamd/common: use ac_build_buffer_load() for emitting UBO loads
Samuel Pitoiset [Wed, 10 Jan 2018 11:57:20 +0000 (12:57 +0100)]
amd/common: use ac_build_buffer_load() for emitting UBO loads

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoamd/common: import get_{load,store}_intr_attribs() from RadeonSI
Samuel Pitoiset [Wed, 10 Jan 2018 11:57:19 +0000 (12:57 +0100)]
amd/common: import get_{load,store}_intr_attribs() from RadeonSI

v2: move those helpers to the header and use static inline

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> (v1)
6 years agodri_util: remove ALLOW_RGB10_CONFIGS option (v2)
Marek Olšák [Mon, 8 Jan 2018 16:58:27 +0000 (17:58 +0100)]
dri_util: remove ALLOW_RGB10_CONFIGS option (v2)

This is unused because it's for libGL/libEGL, not drivers.

v2: i965 was wrong, because it used dri_util instead of its own config.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
6 years agoswr/rast: switch win32 jit format to COFF
Tim Rowley [Thu, 4 Jan 2018 16:27:13 +0000 (10:27 -0600)]
swr/rast: switch win32 jit format to COFF

Allows for call-stack and exception handling for jitted functions.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: don't use 32-bit gathers for elements < 32-bits in size
Tim Rowley [Wed, 3 Jan 2018 17:58:50 +0000 (11:58 -0600)]
swr/rast: don't use 32-bit gathers for elements < 32-bits in size

Using a gather for elements less than 32-bits in size can cause
pagefaults when loading the last elements in a page-aligned-sized
buffer.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: autogenerate named structs instead of literal structs
Tim Rowley [Thu, 28 Dec 2017 23:56:03 +0000 (17:56 -0600)]
swr/rast: autogenerate named structs instead of literal structs

Results in far smaller and useful IR output.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: SIMD16 fetch shader jitter cleanup
Tim Rowley [Fri, 22 Dec 2017 19:58:08 +0000 (13:58 -0600)]
swr/rast: SIMD16 fetch shader jitter cleanup

Bake in USE_SIMD16_BUILDER code paths (for USE_SIMD16_SHADER defined),
remove USE_SIMD16_BUILDER define, remove deprecated psuedo-SIMD16 code
paths.

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: shuffle header files for msvc pre-compiled header usage
Tim Rowley [Thu, 21 Dec 2017 17:01:37 +0000 (11:01 -0600)]
swr/rast: shuffle header files for msvc pre-compiled header usage

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoswr/rast: SIMD16 builder - cleanup naming (simd2 -> simd16)
Tim Rowley [Tue, 19 Dec 2017 19:39:09 +0000 (13:39 -0600)]
swr/rast: SIMD16 builder - cleanup naming (simd2 -> simd16)

Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
6 years agoglsl/linker: Safely generate mask of possible locations
Ian Romanick [Sat, 6 Jan 2018 02:43:32 +0000 (18:43 -0800)]
glsl/linker: Safely generate mask of possible locations

If MaxAttribs were ever raised to 32, undefined behavior would occur.
We had already gone to the effort (albeit incorrectly) handle this in
one case, so fix them all.

CID: 1369628
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
6 years agoglsl/linker: Mark no locations as invalid instead of marking all locations
Ian Romanick [Sat, 6 Jan 2018 02:40:21 +0000 (18:40 -0800)]
glsl/linker: Mark no locations as invalid instead of marking all locations

If max_index were ever 32, the linker would have marked all 32
locations as invalid instead of marking none of them as invalid.  It's
a good thing the maximum value actually set by any driver for
MaxAttribs is 16.

Found by inspection while investigating CID 1369628.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
6 years agoglsl: Don't handle visit_stop in several ::accept methods
Ian Romanick [Sat, 6 Jan 2018 02:19:42 +0000 (18:19 -0800)]
glsl: Don't handle visit_stop in several ::accept methods

All cases where the result could be non-visit_continue would have
already returned.

CID: 401351, 12244651224466
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
6 years agoglsl: Remove unnecessary assignments to type
Ian Romanick [Sat, 6 Jan 2018 01:50:24 +0000 (17:50 -0800)]
glsl: Remove unnecessary assignments to type

None of these are necessary because result->type is the only thing used
outside the giant switch-statement.

CID: 12309831230984
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
6 years agonir: Silence unused parameter warnings
Ian Romanick [Thu, 4 Jan 2018 23:28:30 +0000 (15:28 -0800)]
nir: Silence unused parameter warnings

In file included from src/compiler/nir/nir_opt_algebraic.c:4:0:
src/compiler/nir/nir_search_helpers.h: In function ‘is_not_const’:
src/compiler/nir/nir_search_helpers.h:118:59: warning: unused parameter
‘num_components’ [-Wunused-parameter]
 is_not_const(nir_alu_instr *instr, unsigned src, unsigned num_components,
                                                           ^~~~~~~~~~~~~~
src/compiler/nir/nir_search_helpers.h:119:29: warning: unused parameter
‘swizzle ’ [-Wunused-parameter]
              const uint8_t *swizzle)
                             ^~~~~~~

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
6 years agoradv: Remove some typos.
Bas Nieuwenhuizen [Wed, 10 Jan 2018 12:01:29 +0000 (13:01 +0100)]
radv: Remove some typos.

Trivial.

6 years agoradv: Implement VK_EXT_discard_rectangles.
Bas Nieuwenhuizen [Wed, 10 Jan 2018 01:41:30 +0000 (02:41 +0100)]
radv: Implement VK_EXT_discard_rectangles.

Tested with a modified deferred demo and no regressions in a 1.0.2
mustpass run.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoradv: Add mapping between dynamic state mask and external enum.
Bas Nieuwenhuizen [Tue, 9 Jan 2018 21:22:59 +0000 (22:22 +0100)]
radv: Add mapping between dynamic state mask and external enum.

The EXT values are really large, e.g.
VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, so 1 << value
is not going to fit into a 32-bit mask.

Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
6 years agoamd/common: bump the number of available user SGPRS to 32 on GFX9
Samuel Pitoiset [Mon, 8 Jan 2018 14:19:34 +0000 (15:19 +0100)]
amd/common: bump the number of available user SGPRS to 32 on GFX9

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv: remove radv_pipeline_layout::push_constant_stages field
Samuel Pitoiset [Tue, 9 Jan 2018 17:09:44 +0000 (18:09 +0100)]
radv: remove radv_pipeline_layout::push_constant_stages field

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoamd/common: do not rely on the pipeline for the push constants logic
Samuel Pitoiset [Tue, 9 Jan 2018 17:09:43 +0000 (18:09 +0100)]
amd/common: do not rely on the pipeline for the push constants logic

It makes more sense to rely on nir_intrinsic_load_push_constant
instead of the pipeline layout.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv/gfx9: calculate the number of ES VGPRs for merged shaders
Samuel Pitoiset [Tue, 9 Jan 2018 15:01:10 +0000 (16:01 +0100)]
radv/gfx9: calculate the number of ES VGPRs for merged shaders

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoradv/gfx9: enable LDS for GS only if the ES type is TES
Samuel Pitoiset [Tue, 9 Jan 2018 15:01:09 +0000 (16:01 +0100)]
radv/gfx9: enable LDS for GS only if the ES type is TES

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoamd/common: determine the ES type (VS or TES) for the GS on GFX9
Samuel Pitoiset [Tue, 9 Jan 2018 15:01:08 +0000 (16:01 +0100)]
amd/common: determine the ES type (VS or TES) for the GS on GFX9

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
6 years agoi965/nir: lower TES PatchVerticesIn to a constant when a TCS is present
Iago Toral Quiroga [Tue, 9 Jan 2018 10:14:01 +0000 (11:14 +0100)]
i965/nir: lower TES PatchVerticesIn to a constant when a TCS is present

When a TCS is present at link time we know the number of vertices in the
patch and we can lower gl_PatchVerticesIn in the TesEval stage directly
to a constant. We already have a pass for this that we use in the
Vulkan pipeline, so we just reuse that.

Notice that the GLSL linker also implements this optimization, which
we are not removing because other drivers may still depend on it, so
this should only be useful for OpenGL SPIR-V shaders for now.

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoglsl: remove Lower{TCS,TES}PatchVerticesIn
Iago Toral Quiroga [Mon, 8 Jan 2018 08:45:15 +0000 (09:45 +0100)]
glsl: remove Lower{TCS,TES}PatchVerticesIn

Intel was the only user and now NIR can do the lowering.

v2: do not try to handle it as a system value directly for the SPIR-V
    path. In GL we rather handle it as a uniform like we do for the
    GLSL path (Jason).

v3: drop LowerTESPatchVerticesIn as well (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
6 years agoi965: lower gl_PatchVerticesIn to a uniform
Iago Toral Quiroga [Tue, 9 Jan 2018 08:29:17 +0000 (09:29 +0100)]
i965: lower gl_PatchVerticesIn to a uniform

We want this here instead of nir_lower_system_values because for
Vulkan we don't want this lowering to take place.

v2: do not try to handle it as a system value directly for the SPIR-V
    path. In GL we rather handle it as a uniform like we do for the
    GLSL path (Jason).

v3: do this also for the TessEval stage (Jason)

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>