Commit Graph

96672 Commits

Author SHA1 Message Date
Dave Airlie 96e85709df r600: cleanup llvm ir target selection.
Only r600 target used now for compute IR.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-10-11 07:40:04 +10:00
Dave Airlie ce0ee31890 r600: drop tc_L2_dirty bit, this was SI only.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-10-11 07:39:32 +10:00
Dave Airlie 80bbdb1483 radeonsi: lower ffma in nir to mad.
This lowers ffma to a * b + c.

This seems like it should keep Marek happiest, so
we'd never get to the fma instruction emission code.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-10-11 07:33:32 +10:00
Dave Airlie 2c61594d84 radv: lower ffma in nir.
So it appears the Vulkan SPIR-V fma opcode can be equivalent to a
mad operation, and the fma hw opcode on AMD hw is issued like a double
opcode so is slower. Also the radeonsi stack does this.

This appears to improve performance on a number of games from Feral,
and thanks to Feral for noticing the problem.

I'm reposting this one as Marek indicated he thinks this is what
we should be doing on AMD hw.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: "17.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-10-11 07:31:27 +10:00
Alex Smith 25d76fd658 radv: Add R16G16B16A16_SNORM fast clear support
Signed-off-by: Alex Smith <asmith@feralinteractive.com>
Cc: "17.2" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Dave Airlie <airlied@redhat.com>
2017-10-11 07:29:43 +10:00
Eric Anholt 2687183a34 broadcom/vc5: Fix handling of 5551 textures using the new gallium format.
Like vc4, we have the alpha in the low bit.  Fixes a bunch of piglit
texwrap failures.
2017-10-10 11:42:06 -07:00
Eric Anholt f4b5158874 broadcom/vc5: Set the RCL's MSAA mode to match the BCL's MSAA state. 2017-10-10 11:42:06 -07:00
Eric Anholt ae9a56db6a braodcom/vc5: Set up clear color for higher-bpp formats.
Fixes arb_color_buffer_float-clear
2017-10-10 11:42:06 -07:00
Eric Anholt c0561808c0 broadcom/vc5: Set up per-MRT clear colors.
Fixes fbo-mrt-alphatest.
2017-10-10 11:42:06 -07:00
Eric Anholt 5208d2889e broadcom/vc5: Fix blendfactor zero handling.
I cut the line out to move it up to the top, when putting "0" in the
switch made the compiler complain that that wasn't a valid enum.
2017-10-10 11:42:06 -07:00
Eric Anholt ffdba7fd4c broadcom/vc5: Fix Rendering Mode Common Config's color store bitmask.
This controls the RTs that get stored by the default resolved store, the
same way that the extended resolved store packet has a RT bitmask.
2017-10-10 11:42:06 -07:00
Eric Anholt 4b7de2a360 broadcom/vc5: Add support for f32 render targets.
The TLB write code is getting ugly and needs a refactoring (that will
hopefully handle TLBU uniform coalescing as well).
2017-10-10 11:42:06 -07:00
Eric Anholt f2e6e1bbc3 broadcom/vc5: Fix color masks for non-independent blending.
This gets fbo-mrt-alphatest working except for the second RT's clear color.
2017-10-10 11:42:06 -07:00
Eric Anholt 476db7e66b broadcom/vc5: Make the BCL's number of render targets setup match the RCL. 2017-10-10 11:42:06 -07:00
Eric Anholt 8b4c00a7b2 braodcom/vc5: Fix tile size setup for MRTs.
We need to divide the TLB in two for the 2nd color buffer, and again if
the 3rd or 4th are present.
2017-10-10 11:42:06 -07:00
Eric Anholt dc25a83a7a broadcom/vc5: Start hooking up multiple render targets support.
We now emit as many TLB color writes as there are color buffers.
2017-10-10 11:42:05 -07:00
Eric Anholt f0ee7d6ba8 broadcom/vc5: Add support for GL_EXT_provoking_vertex.
The bit was missing from the spec, but it's there in the simulator.  Fixes
the piglit clipflat test.
2017-10-10 11:42:05 -07:00
Eric Anholt f4133865d1 braodcom/vc5: Find the actual first TF output for our TF spec.
This doesn't yet support PSIZ, but gets us at least some of TF working.
2017-10-10 11:42:05 -07:00
Eric Anholt bd94f6821e broadcom/vc5: Fix translation of transform feedback's output_register field.
It's a NIR driver_location, not a slot offset.
2017-10-10 11:42:05 -07:00
Eric Anholt d8bc9c71df broadcom/vc5: Mark our primitives as needing TF processing.
The TF enable state appears to stick around until the next TF enable
packet is sent, so we only want to request TF when the shader is using it.
2017-10-10 11:42:05 -07:00
Eric Anholt 28105560f7 broadcom/vc5: Fix setup of TF dword output count.
I missed the "- 1" when reading the spec.
2017-10-10 11:42:05 -07:00
Eric Anholt 3ac8a2a4ba broadcom/vc5: Fix up a comment from vc4 about the predraw texture setup. 2017-10-10 11:42:05 -07:00
Eric Anholt ec5af12b5d broadcom/vc5: Flush the job when mapping a transform feedback buffer.
We will want something fancier for reusing a TF output within the same
frame, but we at least need this in order for piglit tests to work.
2017-10-10 11:42:05 -07:00
Eric Anholt 361c5f28bd broadcom/vc5: Fix handling of interp qualifiers on builtin color inputs.
The interpolation qualifier, if specified, is supposed to take precedence
over glShadeModel().
2017-10-10 11:42:05 -07:00
Eric Anholt d0dfc4bd5f broadcom/vc5: Fix CLIF dumping of lists that aren't capped by a HALT.
The HW will halt when you hit a HALT packet, or when you hit the end
address.  Tell CLIF if there's an end address is so that it can stop
correctly.  (There was usually a 0 byte after the CL, so it would stop
anyway).
2017-10-10 11:42:05 -07:00
Eric Anholt 7f3b890697 broadcom/vc5: Fix depth and stencil clear values.
I had misread the packet description: We always have a 32f depth, and a
separate u8 stencil.
2017-10-10 11:42:05 -07:00
Eric Anholt be11251e3c broadcom/vc5: Add missing Z16 format.
We can render to and sample from it just fine.
2017-10-10 11:42:05 -07:00
Eric Anholt e20c82c550 braodcom/vc5: Fix incorrect early Z writes in discard shaders.
Fixes glsl-fs-discard-02.
2017-10-10 11:42:05 -07:00
Eric Anholt 732a3a72cb broadcom/compiler: Set up passthrough Z when doing FS discards.
In order to keep early-Z from writing early in a discard shader, you need
to set the "modifies Z" bit in the shader state (which the new
prog_data.discards will indicate).  Then, in the shader we do a TLB write
to make Z passthrough happen (the QPU result is ignored, so we use a NULL
source).
2017-10-10 11:42:05 -07:00
Eric Anholt 4c4fbab345 broadcom/compiler: Don't forget the discard state on TLB Z writes.
We don't want to write Z for discarded fragments.
2017-10-10 11:42:05 -07:00
Eric Anholt 84939552d0 broadcom/compiler: Use defines instead of magic values in TLB write setup. 2017-10-10 11:42:05 -07:00
Eric Anholt c25de31824 broadcom/vc5: Add proper support for base_vertex and base_instance.
I had base_vertex hacked into the shader state setup like in vc4, but it's
not correct for big offsets.  Using the proper packet is easier and
hopefully means we can re-emit shader state setup less frequently.
2017-10-10 11:42:05 -07:00
Eric Anholt e74a9e8def broadcom/xml: Add the vc5 Base Vertex/Base Instance packet.
This lets us do index_bias and ARB_base_instance.
2017-10-10 11:42:05 -07:00
Eric Anholt 24c8bbbb75 broadcom/vc5: Use supertiles and generic tile lists.
This massively reduces the size of our RCL setup.  It also gets us closer
to supporting multicore platforms.
2017-10-10 11:42:05 -07:00
Eric Anholt 4b2cf771e6 broadcom/xml: Add a bunch more vc5 tile list management packets.
We're going to need these for MSAA, and to use the generic per-tile list.
2017-10-10 11:42:04 -07:00
Eric Anholt efa329ab4f broadcom/xml: Remove vc5 base packet for tile bin/render mode config.
These existed so I could unpack just the sub-id field to switch on in the
old manual CLIF dumper.  The new codegen handles sub-id automatically, but
only if these stub packets aren't there with an implicit sub-id=0.
2017-10-10 11:42:04 -07:00
Eric Anholt afb31a9e87 braodcom/xml: Fix a pasteo in vc5 store tile buffer general. 2017-10-10 11:42:04 -07:00
Eric Anholt 45bb8f2957 broadcom: Add V3D 3.3 gallium driver called "vc5", for BCM7268.
V3D 3.3 is a continuation of the 3D implementation in VC4 (v2.1 and v2.6).
V3D 3.3 introduces an MMU (no more CMA allocations) and support for
GLES3.1.  This driver is not currently conformant, though that will be a
target as soon as possible.

V3D 3.x parts use a new texture tiling layout common across many Broadcom
graphics parts including and the HVS scanout engine.  It also massively
changes the QPU instructions, introducing a common physical register file
(no more A/B split) and half-float instructions, while removing the 4x8
unorm instructions in favor of half-float for talking to fixed function
interfaces.  Because so much has changed, vc5 is implemented in a separate
gallium driver, using only the XML code-generation support from vc4.

v2: Fix tile layout for 64bpp textures.  Fix texture swizzling for 32-bit
    returns.  Fix up a bit of MRT setup.  Sync the simulator to kernel
    behavior a bit more.  Improve uniform debugging code.  Rebase on
    QIR->VIR rename.  Move texture state mostly to the CSOs.  Improve
    cache flushing on the simulator.  Fix program deletion
    use-after-frees.

Acked-by: Dave Airlie <airlied@gmail.com> (uabi plan)
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> (uabi plan)
2017-10-10 11:42:04 -07:00
Eric Anholt ade416d023 broadcom: Add VC5 NIR compiler.
This is a pretty straightforward fork of VC4's NIR compiler to VC5.  The
condition codes, registers, and I/O have all changed, making the backend
hard to share, though their heritage is still recognizable.

v2: Move to src/broadcom/compiler to match intel's layout, rename more
    "vc5" to "v3d", rename QIR to VIR ("V3D IR") to avoid symbol conflicts
    with vc4, use new v3d_debug header, add compiler init/free functions,
    do texture swizzling in NIR to allow optimization.
2017-10-10 11:42:04 -07:00
Eric Anholt f71364f297 broadcom: Add vc5 CLIF dumping
This will be usable with "VC5_DEBUG=cl" on the vc5 driver to stream a CLIF
file (the Broadcom equivalent of i965's AUB) to stderr.  I haven't tested
that this is actually usable with the internal CLIF-consuming tools, but
is close enough as a baseline and is useful for visually inspecting the
command stream.
2017-10-10 11:42:04 -07:00
Eric Anholt 05c7d9715b broadcom: Add V3D 3.3 QPU instruction pack, unpack, and disasm.
Unlike VC4, I've defined an unpacked instruction format with pack/unpack
functions to convert to 64-bit encoded instructions.  This will let us
incrementally put together our instructions and validate them in a more
natural way than the QPU_GET_FIELD/QPU_SET_FIELD used to.

The pack/unpack unfortuantely are written by hand.  While I could define
genxml for parts of it, there are many special cases (like operand order
of commutative binops choosing which binop is being performed!) and it
probably wouldn't come out much cleaner.

The disasm unit test ensures that we have the same assembly format as
Broadcom's internal tools, other than whitespace changes.

v2: Fix automake variable redefinition complaints, add test to .gitignore
2017-10-10 11:42:04 -07:00
Eric Anholt 59257c35eb broadcom: Introduce a v3d_debug.h header for vc5 and broadcom Vulkan.
Unlike vc4, where the compiler and gallium driver live together, for vc5
the compiler will live up in the shared broadcom directory, and need
access to the debug flags.  Define a set of debug flags and helpers there,
so it can be shared between compiler, vc5, and vulkan.
2017-10-10 11:42:04 -07:00
Eric Anholt ae106592a6 configure: Add the new "vc5" driver to the list, requiring a simulator.
My intent is to develop the vc5 driver in-tree for some time to build the
CL generation and shader compiler code, and keep out-of-tree patches for
talking to an actual kernel driver until the kernel driver can be
stabilized on the hardware.

v2: Define a HAVE_BROADCOM_DRIVERS, like HAVE_INTEL or HAVE_AMD.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2017-10-10 11:42:04 -07:00
Eric Anholt c34295b1a3 nir: Move vc4's alpha test lowering to core NIR.
I've been doing this inside of vc4, but vc5 wants it as well and it may be
useful for other drivers (Intel has a related path for pre-gen6 with MRT,
and freedreno had a TGSI path for it at one point).

This required defining a common enum for the standard comparison
functions, but other lowering passes are likely to also want that enum.

v2: Add to meson.build as well.

Acked-by: Rob Clark <robdclark@gmail.com>
2017-10-10 11:42:04 -07:00
Eric Anholt e37b32f80c mesa: Alphabetize GL_MESA_tile_raster_order in the extensions list.
trivial, fixes make check.
2017-10-10 11:42:04 -07:00
Eric Anholt e676434856 mesa: Implement a new GL_MESA_tile_raster_order extension.
The intent is to use this extension on vc4 to allow X11 to do overlapping
CopyArea() within a pixmap without first blitting the pixmap to a
temporary.  With associated glamor patches, improves x11perf
-copywinwin100 performance on a Raspberry Pi 3 from ~4700/sec to
~5130/sec, and is an even larger boost to uncomposited window movement
performance (most copywinwin100 copies don't overlap).

v2: Fix glIsEnabled() on the new enums.
v3: Drop the local spec since I'm upstreaming the spec.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-10-10 10:45:22 -07:00
Eric Anholt 087b39a346 broadcom/vc4: Expose PIPE_CAP_TILE_RASTER_ORDER
Because vc4 can control the order that tiles are rasterized in, we can use
it to implement overlapping blits using normal drawing and
GL_ARB_texture_barrier, as long as we can tell the kernel what order to
render the tiles in.

v2: Fix on the simulator.
v3: Add the cap (disabled) to other drivers, add rst docs for the cap.
v4: Rebase on PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS
v5: Split from the core gallium commit, drop some unnecessary code related
    to glBlitFramebuffer(), fix a crash with clears before state has been
    bound.
2017-10-10 10:45:22 -07:00
Eric Anholt ac0051a507 gallium: Create a new PIPE_CAP_TILE_RASTER_ORDER for vc4.
Because vc4 can control the order that tiles are rasterized in, we can use
it to implement overlapping blits using normal drawing and
GL_ARB_texture_barrier, as long as we can tell the kernel what order to
render the tiles in.

This commit introduces the core gallium support, vc4 changes will follow.

v2: Fix on the simulator.
v3: Add the cap (disabled) to other drivers, add rst docs for the cap.
v4: Rebase on PIPE_CAP_TGSI_ANY_REG_AS_ADDRESS
v5: Drop vc4 changes from this commit, for clarity.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v3)
2017-10-10 10:45:22 -07:00
Eric Anholt 4aa700e0e0 broadcom/vc4: Implement GL_ARB_texture_barrier.
Improves x11perf -copywinwin100 from ~2000/sec to ~4700/sec.  More
importantly, this is a prerequisite for the new GL_MESA_tile_raster_order
extension.
2017-10-10 10:45:22 -07:00
Eric Anholt 13b303ff92 docs: Update the list of used MESA GL enums.
Acked-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2017-10-10 10:45:22 -07:00