mesa.git
5 years agoiris: some shader bits
Kenneth Graunke [Mon, 22 Jan 2018 07:55:04 +0000 (23:55 -0800)]
iris: some shader bits

5 years agoiris: scissor slots
Kenneth Graunke [Mon, 22 Jan 2018 05:23:48 +0000 (21:23 -0800)]
iris: scissor slots

5 years agoiris: bind_state -> compute state
Kenneth Graunke [Mon, 22 Jan 2018 05:20:44 +0000 (21:20 -0800)]
iris: bind_state -> compute state

5 years agoiris: 3DPRIMITIVE fields
Kenneth Graunke [Mon, 22 Jan 2018 05:19:26 +0000 (21:19 -0800)]
iris: 3DPRIMITIVE fields

5 years agoiris: fix VF instancing length so we don't get garbage in batch
Kenneth Graunke [Mon, 22 Jan 2018 05:09:30 +0000 (21:09 -0800)]
iris: fix VF instancing length so we don't get garbage in batch

5 years agoiris: vertex packet fixes
Kenneth Graunke [Mon, 22 Jan 2018 05:02:05 +0000 (21:02 -0800)]
iris: vertex packet fixes

5 years agoiris: fix VBs
Kenneth Graunke [Mon, 22 Jan 2018 04:10:57 +0000 (20:10 -0800)]
iris: fix VBs

5 years agoiris: fix assert
Kenneth Graunke [Mon, 22 Jan 2018 04:10:43 +0000 (20:10 -0800)]
iris: fix assert

5 years agoiris: fix indentation
Kenneth Graunke [Mon, 22 Jan 2018 02:12:18 +0000 (18:12 -0800)]
iris: fix indentation

5 years agoiris: hack to stop crashing on samplers for now
Kenneth Graunke [Mon, 22 Jan 2018 02:08:15 +0000 (18:08 -0800)]
iris: hack to stop crashing on samplers for now

5 years agoiris: initialize dirty bits to ~0ull
Kenneth Graunke [Mon, 22 Jan 2018 02:04:05 +0000 (18:04 -0800)]
iris: initialize dirty bits to ~0ull

5 years agoiris: actually advance forward when emitting commands
Kenneth Graunke [Mon, 22 Jan 2018 02:03:58 +0000 (18:03 -0800)]
iris: actually advance forward when emitting commands

5 years agoiris: actually flush the commands
Kenneth Graunke [Mon, 22 Jan 2018 01:44:08 +0000 (17:44 -0800)]
iris: actually flush the commands

5 years agoiris: actually APPEND commands, not stomp over the top and never incr
Kenneth Graunke [Mon, 22 Jan 2018 01:43:49 +0000 (17:43 -0800)]
iris: actually APPEND commands, not stomp over the top and never incr

5 years agoiris: VB fixes
Kenneth Graunke [Mon, 22 Jan 2018 01:34:41 +0000 (17:34 -0800)]
iris: VB fixes

5 years agoiris: DEBUG=bat
Kenneth Graunke [Mon, 22 Jan 2018 00:49:02 +0000 (16:49 -0800)]
iris: DEBUG=bat

Deleted in the interest of making the branch compile at each step

5 years agoiris: VB addresses
Kenneth Graunke [Sun, 21 Jan 2018 23:28:59 +0000 (15:28 -0800)]
iris: VB addresses

5 years agoiris: reference VB BOs
Kenneth Graunke [Sun, 21 Jan 2018 21:14:49 +0000 (13:14 -0800)]
iris: reference VB BOs

5 years agoiris: so, sba then.
Kenneth Graunke [Sun, 21 Jan 2018 20:26:09 +0000 (12:26 -0800)]
iris: so, sba then.

5 years agoiris: try and have an iris address
Kenneth Graunke [Sun, 21 Jan 2018 20:20:30 +0000 (12:20 -0800)]
iris: try and have an iris address

5 years agoiris: flag SBA updates when instruction BO changes
Kenneth Graunke [Sun, 21 Jan 2018 08:36:54 +0000 (00:36 -0800)]
iris: flag SBA updates when instruction BO changes

5 years agoiris: bit of SBA code
Kenneth Graunke [Sun, 21 Jan 2018 08:16:26 +0000 (00:16 -0800)]
iris: bit of SBA code

genxml MOCS is stupid, addresses are hard news at 11

5 years agoiris: move MAX defines to iris_batch.h
Kenneth Graunke [Sun, 21 Jan 2018 08:16:15 +0000 (00:16 -0800)]
iris: move MAX defines to iris_batch.h

for SBA

5 years agoiris: kill iris_new_batch
Kenneth Graunke [Sun, 21 Jan 2018 07:14:24 +0000 (23:14 -0800)]
iris: kill iris_new_batch

reset and new are too similar, and this had exactly one caller

5 years agoiris: make iris_batch target a particular ring
Kenneth Graunke [Sun, 21 Jan 2018 07:11:37 +0000 (23:11 -0800)]
iris: make iris_batch target a particular ring

5 years agoiris: lower io
Kenneth Graunke [Sun, 21 Jan 2018 07:04:02 +0000 (23:04 -0800)]
iris: lower io

5 years agoiris: do the FS...asserts because we don't lower uniforms yet
Kenneth Graunke [Sun, 21 Jan 2018 00:56:59 +0000 (16:56 -0800)]
iris: do the FS...asserts because we don't lower uniforms yet

5 years agoiris: import program cache code
Kenneth Graunke [Sat, 20 Jan 2018 10:47:04 +0000 (02:47 -0800)]
iris: import program cache code

5 years agoiris: reworks, FS compile pieces
Kenneth Graunke [Sat, 20 Jan 2018 10:01:07 +0000 (02:01 -0800)]
iris: reworks, FS compile pieces

5 years agoiris: parse INTEL_DEBUG
Kenneth Graunke [Sat, 20 Jan 2018 09:12:12 +0000 (01:12 -0800)]
iris: parse INTEL_DEBUG

5 years agoiris: draw->restart_index is uninitialized if PR is not enabled
Kenneth Graunke [Sat, 20 Jan 2018 09:09:36 +0000 (01:09 -0800)]
iris: draw->restart_index is uninitialized if PR is not enabled

5 years agoiris: fix bogus index buffer reference
Kenneth Graunke [Sat, 20 Jan 2018 09:07:41 +0000 (01:07 -0800)]
iris: fix bogus index buffer reference

5 years agoiris: fix prim type
Kenneth Graunke [Sat, 20 Jan 2018 09:05:13 +0000 (01:05 -0800)]
iris: fix prim type

5 years agoiris: msaa sample count packing problems
Kenneth Graunke [Sat, 20 Jan 2018 08:59:49 +0000 (00:59 -0800)]
iris: msaa sample count packing problems

0 -> ffffffffffffffffffffffffffff

5 years agoiris: actually save VBs
Kenneth Graunke [Sat, 20 Jan 2018 08:57:01 +0000 (00:57 -0800)]
iris: actually save VBs

5 years agoiris: fix/rework line stipple
Kenneth Graunke [Sat, 20 Jan 2018 08:55:16 +0000 (00:55 -0800)]
iris: fix/rework line stipple

5 years agoiris: init the batch!
Kenneth Graunke [Sat, 20 Jan 2018 05:55:32 +0000 (21:55 -0800)]
iris: init the batch!

5 years agoiris: delete iris_pipe.c, shuffle code around
Kenneth Graunke [Sat, 20 Jan 2018 02:57:30 +0000 (18:57 -0800)]
iris: delete iris_pipe.c, shuffle code around

5 years agoiris: disable execbuf for now
Kenneth Graunke [Sat, 20 Jan 2018 02:35:24 +0000 (18:35 -0800)]
iris: disable execbuf for now

5 years agoiris: make an ice->render_batch field
Kenneth Graunke [Sat, 20 Jan 2018 02:25:55 +0000 (18:25 -0800)]
iris: make an ice->render_batch field

we may want a second one for transfers

5 years agoiris: drop unused field
Kenneth Graunke [Sat, 20 Jan 2018 02:23:59 +0000 (18:23 -0800)]
iris: drop unused field

5 years agoiris: shader debug log
Kenneth Graunke [Fri, 19 Jan 2018 23:41:46 +0000 (15:41 -0800)]
iris: shader debug log

5 years agoiris: maps
Kenneth Graunke [Fri, 19 Jan 2018 23:30:55 +0000 (15:30 -0800)]
iris: maps

5 years agoiris: linear resources
Kenneth Graunke [Fri, 19 Jan 2018 23:09:05 +0000 (15:09 -0800)]
iris: linear resources

5 years agoiris: some program code
Kenneth Graunke [Tue, 16 Jan 2018 09:15:15 +0000 (01:15 -0800)]
iris: some program code

5 years agoiris: basic push constant alloc
Kenneth Graunke [Fri, 12 Jan 2018 07:01:28 +0000 (23:01 -0800)]
iris: basic push constant alloc

5 years agoiris: emit 3DSTATE_SAMPLER_STATE_POINTERS
Kenneth Graunke [Fri, 12 Jan 2018 06:50:12 +0000 (22:50 -0800)]
iris: emit 3DSTATE_SAMPLER_STATE_POINTERS

5 years agoiris: sampler states
Kenneth Graunke [Fri, 12 Jan 2018 06:18:54 +0000 (22:18 -0800)]
iris: sampler states

5 years agoiris: COLOR_CALC_STATE
Kenneth Graunke [Wed, 10 Jan 2018 08:36:44 +0000 (00:36 -0800)]
iris: COLOR_CALC_STATE

5 years agoiris: fix crash - CSO binding can be NULL (when destroying context)
Kenneth Graunke [Wed, 10 Jan 2018 08:21:56 +0000 (00:21 -0800)]
iris: fix crash - CSO binding can be NULL (when destroying context)

5 years agoiris: some draw info, vbs, sample mask
Kenneth Graunke [Wed, 10 Jan 2018 08:19:29 +0000 (00:19 -0800)]
iris: some draw info, vbs, sample mask

5 years agoiris: a bit of depth
Kenneth Graunke [Wed, 10 Jan 2018 07:30:21 +0000 (23:30 -0800)]
iris: a bit of depth

still need to allocate separate stencil

5 years agoiris: fix SF_CL length
Kenneth Graunke [Wed, 10 Jan 2018 07:17:43 +0000 (23:17 -0800)]
iris: fix SF_CL length

5 years agoiris: don't segfault on !old_cso
Kenneth Graunke [Wed, 10 Jan 2018 07:14:10 +0000 (23:14 -0800)]
iris: don't segfault on !old_cso

5 years agoiris: framebuffers
Kenneth Graunke [Wed, 10 Jan 2018 07:13:16 +0000 (23:13 -0800)]
iris: framebuffers

5 years agoiris: stipples and vertex elements
Kenneth Graunke [Wed, 10 Jan 2018 05:29:09 +0000 (21:29 -0800)]
iris: stipples and vertex elements

5 years agoiris: sampler views
Kenneth Graunke [Wed, 10 Jan 2018 01:54:43 +0000 (17:54 -0800)]
iris: sampler views

5 years agoiris: Surfaces!
Kenneth Graunke [Tue, 9 Jan 2018 22:34:15 +0000 (14:34 -0800)]
iris: Surfaces!

5 years agoiris: SF_CLIP_VIEWPORT
Kenneth Graunke [Tue, 9 Jan 2018 19:58:28 +0000 (11:58 -0800)]
iris: SF_CLIP_VIEWPORT

5 years agoiris: scissors
Kenneth Graunke [Tue, 9 Jan 2018 19:51:34 +0000 (11:51 -0800)]
iris: scissors

5 years agoiris: RASTER + SF + some CLIP, fix DIRTY vs. NEW
Kenneth Graunke [Tue, 9 Jan 2018 19:44:04 +0000 (11:44 -0800)]
iris: RASTER + SF + some CLIP, fix DIRTY vs. NEW

5 years agoiris: initial gpu state, merges
Kenneth Graunke [Tue, 9 Jan 2018 19:25:29 +0000 (11:25 -0800)]
iris: initial gpu state, merges

5 years agoiris: merge pack
Kenneth Graunke [Mon, 8 Jan 2018 22:44:22 +0000 (14:44 -0800)]
iris: merge pack

this lets us merge dynamic and pre-baked state, also like anv

5 years agoiris: packing with valgrind.
Kenneth Graunke [Mon, 8 Jan 2018 22:44:14 +0000 (14:44 -0800)]
iris: packing with valgrind.

borrowed macros from anv!

5 years agoiris: initial render state upload
Kenneth Graunke [Wed, 27 Dec 2017 10:54:26 +0000 (02:54 -0800)]
iris: initial render state upload

5 years agoiris: port over batchbuffer updates
Kenneth Graunke [Wed, 27 Dec 2017 10:25:20 +0000 (02:25 -0800)]
iris: port over batchbuffer updates

5 years agoiris: viewport state, sort of
Kenneth Graunke [Sat, 23 Dec 2017 22:33:04 +0000 (14:33 -0800)]
iris: viewport state, sort of

5 years agoiris: Initial commit of a new 'iris' driver for Intel Gen8+ GPUs.
Kenneth Graunke [Fri, 24 Nov 2017 07:15:14 +0000 (23:15 -0800)]
iris: Initial commit of a new 'iris' driver for Intel Gen8+ GPUs.

This commit introduces a new Gallium driver for Intel Gen8+ GPUs,
named 'iris_dri.so' after the hardware.

Developed by:
- Kenneth Graunke (overall driver)
- Dave Airlie (shaders, conditional render, overflow query, Gen8 port)
- Chris Wilson (fencing, pinned memory, ...)
- Jordan Justen (compute shaders)
- Jason Ekstrand (image load store)
- Caio Marcelo de Oliveira Filho (tessellation control passthrough)
- Rafael Antognolli (auxiliary buffer fixes)
- The rest of the i965 contributors and the Mesa community

5 years agogallium/auxiliary/vl: Fix transparent issue on compute shader with rgba
James Zhu [Fri, 15 Feb 2019 20:33:43 +0000 (15:33 -0500)]
gallium/auxiliary/vl: Fix transparent issue on compute shader with rgba

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109646
Problem 1,4: they are caused by imcomplete blend comute shader
implementation. So Reverts rgba back to frament shader.

Fixes: 9364d66cb7f7 (Add video compositor compute shader render)
Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Tested-by: Bruno Milreu <bmilreu@gmail.com>
5 years agovulkan: add an overlay layer
Lionel Landwerlin [Sat, 19 Jan 2019 21:26:12 +0000 (21:26 +0000)]
vulkan: add an overlay layer

Just a starting point to display frame timings & drawcalls/submissions
per frame.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
+1-by: Mike Lothian <mike@fireburn.co.uk>
+1-by: Tapani Pälli <tapani.palli@intel.com>
+1-by: Eric Engestrom <eric.engestrom@intel.com>
+1-by: Yurii Kolesnykov <root@yurikoles.com>
+1-by: myfreeweb <greg@unrelenting.technology>
+1-by: Kenneth Graunke <kenneth@whitecape.org>

5 years agoimgui: make sure our copy of imgui doesn't clash with others in the same process
Lionel Landwerlin [Tue, 22 Jan 2019 13:04:20 +0000 (13:04 +0000)]
imgui: make sure our copy of imgui doesn't clash with others in the same process

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
+1-by: Mike Lothian <mike@fireburn.co.uk>
+1-by: Tapani Pälli <tapani.palli@intel.com>
+1-by: Eric Engestrom <eric.engestrom@intel.com>
+1-by: Yurii Kolesnykov <root@yurikoles.com>
+1-by: myfreeweb <greg@unrelenting.technology>
+1-by: Kenneth Graunke <kenneth@whitecape.org>

5 years agoimgui: bump copy
Lionel Landwerlin [Sat, 19 Jan 2019 21:37:35 +0000 (21:37 +0000)]
imgui: bump copy

Updated at :

commit f977871854af941289f2a9090dcc90f7aa3449a8
Author: omar <omarcornut@gmail.com>
Date:   Fri Feb 15 13:10:22 2019 +0100

    ImFont: Minor adjustment to the structure.
    Examples: Removed unused variable.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
+1-by: Mike Lothian <mike@fireburn.co.uk>
+1-by: Tapani Pälli <tapani.palli@intel.com>
+1-by: Eric Engestrom <eric.engestrom@intel.com>
+1-by: Yurii Kolesnykov <root@yurikoles.com>
+1-by: myfreeweb <greg@unrelenting.technology>
+1-by: Kenneth Graunke <kenneth@whitecape.org>

5 years agobuild: move imgui out of src/intel/tools to be reused
Lionel Landwerlin [Sat, 19 Jan 2019 20:02:13 +0000 (20:02 +0000)]
build: move imgui out of src/intel/tools to be reused

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
+1-by: Mike Lothian <mike@fireburn.co.uk>
+1-by: Tapani Pälli <tapani.palli@intel.com>
+1-by: Eric Engestrom <eric.engestrom@intel.com>
+1-by: Yurii Kolesnykov <root@yurikoles.com>
+1-by: myfreeweb <greg@unrelenting.technology>
+1-by: Kenneth Graunke <kenneth@whitecape.org>

5 years agonir/lower_clip_cull: Fix an incorrect assert
Jason Ekstrand [Thu, 21 Feb 2019 15:53:30 +0000 (09:53 -0600)]
nir/lower_clip_cull: Fix an incorrect assert

Copy+paste error.  It was supposed to test cull and not clip.

Fixes: 4e69fba534e "nir: Rewrite lower_clip_cull_distance_arrays..."
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=109717
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
5 years agonir: Fix a compile warning
Jason Ekstrand [Thu, 21 Feb 2019 15:44:33 +0000 (09:44 -0600)]
nir: Fix a compile warning

5 years agofreedreno/a6xx: enable tiled images
Rob Clark [Thu, 21 Feb 2019 13:26:18 +0000 (08:26 -0500)]
freedreno/a6xx: enable tiled images

Turns out we can write to tiled images as well as read.  This avoids
having to linearize or do the tiling in the shader.

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agonir, glsl: move pixel_center_integer/origin_upper_left to shader_info.fs
Alejandro Piñeiro [Thu, 7 Feb 2019 17:43:58 +0000 (18:43 +0100)]
nir, glsl: move pixel_center_integer/origin_upper_left to shader_info.fs

On GLSL that info is set as a layout qualifier when redeclaring
gl_FragCoord, so somehow tied to a specific variable. But in practice,
they behave as a global of the shader. On ARB programs they are set
using a global OPTION (defined at ARB_fragment_coord_conventions), and
on SPIR-V using ExecutionModes, that are also not tied specifically to
the builtin.

This patch moves that info from nir variable and ir variable to nir
shader and gl_program shader_info respectively, so the map is more
similar to SPIR-V, and ARB programs, instead of more similar to GLSL.

FWIW, shader_info.fs already had pixel_center_integer, so this change
also removes some redundancy. Also, as struct gl_program also includes
a shader_info, we removed gl_program::OriginUpperLeft and
PixelCenterInteger, as it would be superfluous.

This change was needed because recently spirv_to_nir changed the order
in which execution modes and variables are handled, so the variables
didn't get the correct values. Now the info is set on the shader
itself, and we don't need to go back to the builtin variable to set
it.

Fixes: e68871f6a ("spirv: Handle constants and types before execution
                   modes")

v2: (Jason)
   * glsl_to_nir: get the info before glsl_to_nir, while all the rest
     of the info gathering is happening
   * prog_to_nir: gather the info on a general info-gathering pass,
     not on variable setup.

v3: (Jason)
   * Squash with the patch that removes that info from ir variable
   * anv: assert that OriginUpperLeft is true. It should be already
     set by spirv_to_nir.
   * blorp: set origin_upper_left on its core "compile fragment
     shader", not just on some specific places (for this we added an
     helper on a previous patch).
   * prog_to_nir: no need to gather specifically this fragcoord modes
     as the full gl_program shader_info is copied.
   * spirv_to_nir: assert that we are a fragment shader when handling
     this execution modes.

v4: (reported by failing gitlab pipeline #18750)
   * state_tracker: update too due changes on ir.h/gl_program

v5:
   * blorp: minor change after change on previous patch
   * radeonsi: update due this change.

v6: (Timothy Arceri)
   * prog_to_nir: remove extra whitespace
   * shader_info: don't use :1 on origin_upper_left
   * glsl: program.fs.origin_upper_left/pixel_center_integer can be
     move out of the shader list loop

5 years agoblorp: introduce helper method blorp_nir_init_shader
Alejandro Piñeiro [Wed, 13 Feb 2019 11:11:47 +0000 (12:11 +0100)]
blorp: introduce helper method blorp_nir_init_shader

This initializes the nir shader that will be used by blorp. Right now
it doesn't do too much beyond calling nir_builder_init_simple_shader,
and setting a name. More stuff will be added on following patches.

v2: there is a case were it is used a VERTEX_SHADER (Alejandro)

5 years agopanfrost: Verify and print brx condition in disasm
Alyssa Rosenzweig [Mon, 18 Feb 2019 04:29:20 +0000 (04:29 +0000)]
panfrost: Verify and print brx condition in disasm

The condition code in extended branches is repeated 8 times for unclear
reasons; accordingly, the code would be disassembled as "unknown5555",
"unknownAAAA", etc. This patch correctly masks off the lower two bits to
find the true code to print, verifying that the code is repeated as
believed to be necessary (providing some assurance for compiler quality
and an assert trip in case we encounter a shader in the wild that breaks
the convention).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Dynamically set discard branch targets
Alyssa Rosenzweig [Sun, 17 Feb 2019 23:24:39 +0000 (23:24 +0000)]
panfrost: Dynamically set discard branch targets

discard and discard_if are both implemented with the branching pipeline
on Midgard; essentially, we branch to the end of the fragment shader in
a special "discard" mode, setting the condition as necessary.
Previously, we hardcoded the form of this instruction, which worked for
very simple shaders but was incorrect for anything remotely interesting.
This patch instead emits logical branches in the IR, which are flattened
to real discard ops the same way other branches are, allowing targets to
be computed correctly.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost/midgard: Emit extended branches
Alyssa Rosenzweig [Sun, 17 Feb 2019 22:09:09 +0000 (22:09 +0000)]
panfrost/midgard: Emit extended branches

Previously, we only emitted compact branches; however, the offset range
of these branches is too small for many real world shaders. This patch
implements support for emitting extended branches and switches to always
using them for control flow. This incurs a code size and possibly
performance penalty, but expands the range of working shaders and
provides opportunity for further optimization.

Support for emitting compact branches is retained but this code path is
presently unused. In the future, we'll want to heuristically determine
which type of branch should be emitted for optimal codegen.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Rectify doubleplusungood extended branch
Alyssa Rosenzweig [Sun, 17 Feb 2019 22:05:36 +0000 (22:05 +0000)]
panfrost: Rectify doubleplusungood extended branch

Midgard features "compact branches" and "extended branches", i.e.
corresponds to short jumps and far jumps. The form of the extended
branch was previously incorrect in the ISA headers; this patch corrects
it and updates the disassembler (simultaneous to preserve
bisectability).

Additionally, we fix some a corner case in the disassembly of extended
branches, and we now prefix extended branches with "brx", to visually
differentiate from compact branches prefixed with "br".

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost/midgard: Fix nested/chained if-else
Alyssa Rosenzweig [Sun, 17 Feb 2019 05:14:24 +0000 (05:14 +0000)]
panfrost/midgard: Fix nested/chained if-else

An if-else statement is compiled to a conditional branch (from the start
to the second block) and an unconditional branch (from the end of the
first block to the end of the else). We previously incorrectly computed
the block index of the unconditional branch to be exactly one after that
of the conditional branch, valid for a single if-else statement but
nothing fancier. This patch correctly computes the unconditional branch
target, fixing more complex if-else chains.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost/midgard: Refactor tag lookahead code
Alyssa Rosenzweig [Sun, 17 Feb 2019 03:35:03 +0000 (03:35 +0000)]
panfrost/midgard: Refactor tag lookahead code

Each Midgard instruction is scheduled to a particular instruction type
("tag"). Presumably the hardware prefetches memory based on tag, so it
is required to report out the first tag to the command stream and the
next tag of a branch target. This procedure was implemented in two
separate parts of the compiler (one time with a slight bug relating to
empty blocks); this patch refactors to unite the two routines and solve
the bug when branching to empty blocks.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Implement pantrace (command stream dump)
Alyssa Rosenzweig [Wed, 20 Feb 2019 01:33:21 +0000 (01:33 +0000)]
panfrost: Implement pantrace (command stream dump)

Historically, Panfrost debugging entailed the use of the LD_PRELOADable
`panwrap` tool. This setup is a tad fragile; Panfrost can be traced
directly without the intermediate layer. pantrace implements the
quivalent functionality of panwrap into Panfrost proper, allowing dumps
to work regardless of the kernel layer in use.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Add pandecode (command stream debugger)
Alyssa Rosenzweig [Tue, 19 Feb 2019 05:50:14 +0000 (05:50 +0000)]
panfrost: Add pandecode (command stream debugger)

The `panwrap` utility can be LD_PRELOAD'd into a GLES app, intercepting
communication between the driver and the kernel. Modern panwrap versions
do no processing of their own; instead, they create a trace directory.
This directory contains the following files:

 - control.log: a line-by-line plain text file, denoting important
   syscalls (mmaps and job submits) along with their arguments

 - memory_*.bin, shader_*.bin: binary dumps of mapped memory

Together, these files contain enough information to reconstruct the
command stream and shaders of (at minimum) a single frame.

The `pandecode` utility takes this directory structure as input,
reconstructing the mapped memory and using the job submit command as an
entrypoint. It then walks the descriptors as the hardware would, parsing
and pretty-printing. Its final output is the pretty-printed command
stream interleaved with the disassembled shaders, suitable for driver
debugging. For instance, the behaviour of two driver versions (one
working, one broken) can be compared by diff'ing their decoded logs.

pandecode/decode.c was originally a part of `panwrap`; it is the oldest
living code in the project. Its history is generally not worth
preserving.

panwrap itself will continue to live downstream for the foreseeable
future, as it is specifically written for the vendor kernel. It is
possible, however, to produce equivalent traces directly from Panfrost,
bypassing the intermediate wrapping layer for well-behaved drivers.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agopanfrost: Stub out separate stencil functions
Alyssa Rosenzweig [Fri, 15 Feb 2019 23:59:58 +0000 (23:59 +0000)]
panfrost: Stub out separate stencil functions

This is not yet functional, but it resolves a crash in various apps and
provides a framework for further work.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
5 years agoradeonsi: use SDMA for uploading data through const_uploader
Marek Olšák [Thu, 31 Jan 2019 01:56:59 +0000 (20:56 -0500)]
radeonsi: use SDMA for uploading data through const_uploader

v2: use tc.stream_uploader in si buffer_transfer_map if not called from
    the driver thread

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> (v1)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
5 years agogallium/u_upload_mgr: allow use of FLUSH_EXPLICIT with persistent mappings
Marek Olšák [Wed, 30 Jan 2019 22:15:02 +0000 (17:15 -0500)]
gallium/u_upload_mgr: allow use of FLUSH_EXPLICIT with persistent mappings

for radeonsi

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
5 years agogallium/u_threaded: always unmap const_uploader
Marek Olšák [Thu, 31 Jan 2019 01:49:22 +0000 (20:49 -0500)]
gallium/u_threaded: always unmap const_uploader

radeonsi will require this. It's a no-op for drivers supporting persistent
mappings.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
5 years agost/mesa: always unmap the uploader in st_atom_array.c
Marek Olšák [Thu, 31 Jan 2019 01:45:39 +0000 (20:45 -0500)]
st/mesa: always unmap the uploader in st_atom_array.c

This is a no-op for drivers supporting persistent mappings.

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
5 years agonir/xfb: Handle compact arrays in gather_xfb_info
Jason Ekstrand [Wed, 13 Feb 2019 22:34:27 +0000 (16:34 -0600)]
nir/xfb: Handle compact arrays in gather_xfb_info

This makes us properly handle gl_ClipDistance and gl_CullDistance.

Fixes: 19064b8c "nir: Add a pass for gathering transform feedback info"
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
5 years agonir/xfb: Work in terms of components rather than slots
Jason Ekstrand [Wed, 13 Feb 2019 22:22:37 +0000 (16:22 -0600)]
nir/xfb: Work in terms of components rather than slots

We needed to better handle cases where a chunk of a variable starts at
some non-zero location_frac and rolls over into the next slot but may
not be more than 4 dwords.  For example, if gl_CullDistance is an array
of 3 things and has location_frac = 2, it will span across two vec4s but
is not, itself, bigger than a vec4.  If you ignore the clip/cull special
case, it's not allowed to happen for anything else because the only
things that can span more than one slot is dvec3 and dvec4 and they're
both bigger than a vec4.  The current code uses this attrib_slot thing
where we count attribute slots and iterate over them.  However, that
doesn't work in the case above because gl_CullDistance will have an
attrib_slot count of 1 even though it does span two slots.  We could fix
this by adjusting attrib_slot but we already have comp_mask and it's
easier to just handle it that way.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
5 years agonir: Rewrite lower_clip_cull_distance_arrays to do a lot less lowering
Jason Ekstrand [Wed, 13 Feb 2019 22:15:42 +0000 (16:15 -0600)]
nir: Rewrite lower_clip_cull_distance_arrays to do a lot less lowering

Instead of going to all the work of to combine them into one array, just
make two arrays and use location_frac to colocate them within CLIP0.
Then the back-end can sort things out and stack them on top of each
other.  Thanks to ef99f4c8, we also don't need to set compact anymore.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
5 years agonir/xfb: Properly align 64-bit values
Jason Ekstrand [Tue, 12 Feb 2019 18:49:08 +0000 (12:49 -0600)]
nir/xfb: Properly align 64-bit values

Fixes: 19064b8c "nir: Add a pass for gathering transform feedback info"
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
5 years agocompiler/types: Add a contains_64bit helper
Jason Ekstrand [Tue, 12 Feb 2019 19:03:34 +0000 (13:03 -0600)]
compiler/types: Add a contains_64bit helper

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
5 years agofreedreno/a6xx: samplerBuffer fixes
Rob Clark [Wed, 20 Feb 2019 22:33:23 +0000 (17:33 -0500)]
freedreno/a6xx: samplerBuffer fixes

Use the 'UNK31' bit (which should probably be called 'BUFFER') for
samplerBuffer case, which increases the size of supported buffer
texture beyond 2^15 elements.

Also need to fix the 2nd coord injected to handle the tex instructions
that take integer coords.

Fixes dEQP-GLES31.functional.texture.texture_buffer.render.as_fragment_texture.buffer_size_131071
and similar

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/ir3/a6xx: use ldib for ssbo reads
Rob Clark [Wed, 20 Feb 2019 15:31:15 +0000 (10:31 -0500)]
freedreno/ir3/a6xx: use ldib for ssbo reads

... instead of isam.  It seems like when using isam, plus atomics, we
can have the problem of old data being in the texture cache.  Plus this
way we don't have to load a component at a time.

Note that blob still seems to use isam in some cases.  I suppose it might
be preferable in the case of loading a single component, when atomics
are not in the picture (or that the ssbo does not need to otherwise be
coherent).

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/ir3: sync instr/disasm and add ldib encoding
Rob Clark [Wed, 20 Feb 2019 15:21:18 +0000 (10:21 -0500)]
freedreno/ir3: sync instr/disasm and add ldib encoding

Resync disasm and instr header from envytools, and add ldib encoding.
This replaces an opcode from a3xx which was never seen in practice,
since that seemed easier than dealing with the same opc # meaning a
different thing on a6xx.  (Not really sure if 'sti' was actually a
real thing, I think it was only seen in fuzzing.)

Signed-off-by: Rob Clark <robdclark@gmail.com>
5 years agofreedreno/ir3/a6xx: fix load_ssbo barrier type.
Rob Clark [Tue, 19 Feb 2019 19:44:10 +0000 (14:44 -0500)]
freedreno/ir3/a6xx: fix load_ssbo barrier type.

Silly copy/pasta bug, since load_image is actually the same instruction
but different barrier class.

Signed-off-by: Rob Clark <robdclark@gmail.com>