mesa.git
4 years agovulkan/wsi: fix cleanup when dup() fails
Eric Engestrom [Tue, 10 Mar 2020 17:54:41 +0000 (18:54 +0100)]
vulkan/wsi: fix cleanup when dup() fails

Fixes: f5433e4d6ce247b86dae ("vulkan/wsi: Add modifiers support to wsi_create_native_image")
Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4137>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4137>

4 years agoRevert "gallium: make handles of set_global_binding 64 bit"
Karol Herbst [Tue, 10 Mar 2020 22:41:26 +0000 (22:41 +0000)]
Revert "gallium: make handles of set_global_binding 64 bit"

This reverts commit e1ffb72a05f9b50ee47767aaadbab3e47896ee14

4 years agogallium: make handles of set_global_binding 64 bit
Karol Herbst [Fri, 28 Feb 2020 14:54:08 +0000 (15:54 +0100)]
gallium: make handles of set_global_binding 64 bit

needed by CL

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4072>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4072>

4 years agopan/bi: Implement comparison opcodes via BI_CMP
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:21:35 +0000 (08:21 -0400)]
pan/bi: Implement comparison opcodes via BI_CMP

Pretty straightforward for the moment. Ideally these would be fused into
csel/branches but that will come a bit later.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Print source types unconditionally
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:47:39 +0000 (08:47 -0400)]
pan/bi: Print source types unconditionally

We track them all now, let's use them.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Specify comparison op for BI_CMP
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:47:20 +0000 (08:47 -0400)]
pan/bi: Specify comparison op for BI_CMP

...and adjust printing so we can use it as an op name.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Lower b2f to bcsel
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:33:11 +0000 (08:33 -0400)]
pan/bi: Lower b2f to bcsel

Since we can get a zero for free and a one inlined into the constant,
the obvious turns out to be efficient (while allowing flexibility for
boolean size).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Implement nir_op_bcsel
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:32:56 +0000 (08:32 -0400)]
pan/bi: Implement nir_op_bcsel

No condition fusing yet.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Import algebraic pass from midgard
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:20:59 +0000 (08:20 -0400)]
pan/bi: Import algebraic pass from midgard

We'll need some of these at least.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Add isub op
Alyssa Rosenzweig [Tue, 10 Mar 2020 12:03:20 +0000 (08:03 -0400)]
pan/bi: Add isub op

Can't be a regular ADD since there's no negate modifier for integers
(it's a different opcode entirely).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Disable lower_sub
Alyssa Rosenzweig [Tue, 10 Mar 2020 11:56:14 +0000 (07:56 -0400)]
pan/bi: Disable lower_sub

For float, fixing up the modifier ourselves is easy. For int, we have a
dedicated isub instruction anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Implement fabs, fneg as fmov with mods
Alyssa Rosenzweig [Tue, 10 Mar 2020 11:52:24 +0000 (07:52 -0400)]
pan/bi: Implement fabs, fneg as fmov with mods

Fusing will come later with the appropriate NIR support.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Handle special ops in NIR->BIR
Alyssa Rosenzweig [Tue, 10 Mar 2020 01:20:20 +0000 (21:20 -0400)]
pan/bi: Handle special ops in NIR->BIR

Only on supported GPUs at the moment; for older Bifrost that don't
support these, I'm not sure yet where the right place to do the lowering
is. NIR algebraic rules would be "nice" but probably impractical -- but
it wouldn't be hard to do it directly in BIR (as a lowering pass or
alternative implementation).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Add BI_SPECIAL_* enum
Alyssa Rosenzweig [Tue, 10 Mar 2020 01:20:03 +0000 (21:20 -0400)]
pan/bi: Add BI_SPECIAL_* enum

To disambiguate the different special ops from each other.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Add a bunch of ALU ops
Alyssa Rosenzweig [Tue, 10 Mar 2020 01:10:41 +0000 (21:10 -0400)]
pan/bi: Add a bunch of ALU ops

These are all regular ALU ops found in GLES2 which makes them
particularly nice targets at the moment. Just translate straight to our
IR.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Implement fsat as mov.sat
Alyssa Rosenzweig [Tue, 10 Mar 2020 01:02:51 +0000 (21:02 -0400)]
pan/bi: Implement fsat as mov.sat

Soon we'll have a NIR support to handle this the Right Way along with
pos and sat_signed support, but we'll always need the fallback anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Allow inlining constants
Alyssa Rosenzweig [Tue, 10 Mar 2020 00:32:00 +0000 (20:32 -0400)]
pan/bi: Allow inlining constants

This will allow us to optimize out the constant moves (although that
will require a DCE pass which has yet to be written).

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Add initial handling of ALU ops
Alyssa Rosenzweig [Tue, 10 Mar 2020 00:19:51 +0000 (20:19 -0400)]
pan/bi: Add initial handling of ALU ops

We do the bare minimum translation, just enough for fmov/fadd/fmul right
now with no modifiers / inlined constants / etc. The rest is to come!
But hopefully I got bitsize handling right this time around.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Lower vec* to writemasks in NIR
Alyssa Rosenzweig [Mon, 9 Mar 2020 23:56:35 +0000 (19:56 -0400)]
pan/bi: Lower vec* to writemasks in NIR

I was hoping not to tread down this path but it seems inevitable now.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Remove bi_load
Alyssa Rosenzweig [Mon, 9 Mar 2020 23:52:56 +0000 (19:52 -0400)]
pan/bi: Remove bi_load

This is now made redundant with writemasks, so let's regularize the IR.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Introduce writemasks
Alyssa Rosenzweig [Mon, 9 Mar 2020 18:25:00 +0000 (14:25 -0400)]
pan/bi: Introduce writemasks

I feel so dirty. But this will let the IR be a lot more flexible seeing
as we really are vector in a certain sense (I/O, small types)

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopan/bi: Generalize swizzles to avoid extracts
Alyssa Rosenzweig [Mon, 9 Mar 2020 18:09:04 +0000 (14:09 -0400)]
pan/bi: Generalize swizzles to avoid extracts

We'd really rather not emit extracts. We are approaching on a vector IR
anyway which is annoying but really necessary to handle I/O and fp16
correctly. So let's just go all the way and deal with swizzles and masks
within reason; it'll still be somewhat saner in the long-term.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agopanfrost: Move mir_to_bytemask to common code
Alyssa Rosenzweig [Tue, 10 Mar 2020 00:19:29 +0000 (20:19 -0400)]
panfrost: Move mir_to_bytemask to common code

...also so we can start sharing code properly between the panfrost
compilers.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4139>

4 years agofreedreno/fdperf: set locale
Rob Clark [Tue, 10 Mar 2020 15:10:22 +0000 (08:10 -0700)]
freedreno/fdperf: set locale

Set local to get numbers printed w/ commas.. much easier to read that
way.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4119>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4119>

4 years agofreedreno/computerator: add performance counter support
Rob Clark [Sun, 8 Mar 2020 23:42:23 +0000 (16:42 -0700)]
freedreno/computerator: add performance counter support

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4119>

4 years agovulkan/wsi: Return an error if dup() fails
Jason Ekstrand [Mon, 2 Mar 2020 23:26:43 +0000 (17:26 -0600)]
vulkan/wsi: Return an error if dup() fails

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4135>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4135>

4 years agovulkan/wsi: Don't leak the FD when GetImageDrmFormatModifierProperties fails
Jason Ekstrand [Mon, 2 Mar 2020 23:05:59 +0000 (17:05 -0600)]
vulkan/wsi: Don't leak the FD when GetImageDrmFormatModifierProperties fails

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4135>

4 years agofreedreno/ir3: try to avoid syncs
Rob Clark [Wed, 4 Mar 2020 17:06:51 +0000 (09:06 -0800)]
freedreno/ir3: try to avoid syncs

Update postsched to be better aware of where costly (ss) syncs would
result.  Sometimes it is better to allow a nop or two, to avoid a
sync quickly after an SFU.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agofreedreno/ir3: round-robin RA
Rob Clark [Fri, 28 Feb 2020 20:48:16 +0000 (12:48 -0800)]
freedreno/ir3: round-robin RA

In the second (scalar pass) use the information about # of registers
used in the first pass as the target max, and round-robin within that
range.  This generally gives the post-RA sched pass more opportunities
to re-order instructions to remove nop's.

Also, we can be a bit clever when assigning dest registers for SFU
instructions, by picking the register used for it's src (if available
and already assigned).  This avoids some (ss) syncs caused by write
after read hazards.  (Ie. the SFU instruction will read it's own src
before writing dest.)

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agofreedreno/ir3: track register usage in first RA pass
Rob Clark [Fri, 28 Feb 2020 19:02:26 +0000 (11:02 -0800)]
freedreno/ir3: track register usage in first RA pass

We'll use the feedback from the first pass to select a target register
usage in the second pass.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agofreedreno/ir3: fix has_latency_to_hide
Rob Clark [Fri, 28 Feb 2020 23:45:53 +0000 (15:45 -0800)]
freedreno/ir3: fix has_latency_to_hide

Also count tex-prefetch instructions.  And only let the no-latency rule
kick in for frag shaders.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agofreedreno/ir3: split out has_latency_to_hide()
Rob Clark [Fri, 28 Feb 2020 20:47:29 +0000 (12:47 -0800)]
freedreno/ir3: split out has_latency_to_hide()

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agoutil/ra: move NO_REG to header
Rob Clark [Mon, 9 Mar 2020 21:20:50 +0000 (14:20 -0700)]
util/ra: move NO_REG to header

In the select_reg callback, I want to be able to determine if a given
node is already assigned, and if so what physical register has been
assigned.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agoutil/ra: spiff out select_reg_callback
Rob Clark [Fri, 28 Feb 2020 18:06:54 +0000 (10:06 -0800)]
util/ra: spiff out select_reg_callback

Add a parameter so the callback can know which node it is selecting a
register for.  And remove the graph parameter, as it is unused by
existing users, and somewhat unnecessary (ie. the callback data could
be used instead).

And add a comment so $future_me remembers how this works.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agofreedreno: fix FD_MESA_DEBUG=inorder
Rob Clark [Sun, 1 Mar 2020 22:16:59 +0000 (14:16 -0800)]
freedreno: fix FD_MESA_DEBUG=inorder

Fixes: 2c07e03b792 ("freedreno: allow ctx->batch to be NULL")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agofreedreno/ir3: add simplified stall estimation
Rob Clark [Wed, 4 Mar 2020 18:51:10 +0000 (10:51 -0800)]
freedreno/ir3: add simplified stall estimation

Doesn't take into account stalls that result from a register written in
a different block, etc.  But this should be more useful than just using
number of (ss)'s by trying to estimate how costly a given sync is.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agofreedreno/ir3: remove extra nops inserted in scheduler
Rob Clark [Tue, 25 Feb 2020 18:42:57 +0000 (10:42 -0800)]
freedreno/ir3: remove extra nops inserted in scheduler

They were inserting a nop between back to back SFU instrucions.  But
that doesn't actually appear to be required.  And they get stripped out
later anyways before legalize.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agofreedreno/computerator: add hrsq/hlog2/hexp2
Rob Clark [Sun, 1 Mar 2020 22:20:56 +0000 (14:20 -0800)]
freedreno/computerator: add hrsq/hlog2/hexp2

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agofreedreno/ir3: also lower lowp frag outputs
Rob Clark [Wed, 4 Mar 2020 20:06:30 +0000 (12:06 -0800)]
freedreno/ir3: also lower lowp frag outputs

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agonir/print: show variable precision
Rob Clark [Wed, 4 Mar 2020 19:54:26 +0000 (11:54 -0800)]
nir/print: show variable precision

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071>

4 years agointel/tools: Fix compilation with UBSan
Danylo Piliaiev [Tue, 10 Mar 2020 14:24:59 +0000 (16:24 +0200)]
intel/tools: Fix compilation with UBSan

Compilation failed with several similar errors:

../src/intel/tools/aub_read.c:322:4: error: case label does not reduce to an integer constant
  322 |    case MAKE_HEADER(TYPE_AUB, OPCODE_AUB, SUBOPCODE_HEADER):

Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4132>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4132>

4 years agoi965: Use gl_vertex_format in brw_vertex_element.
Mathias Fröhlich [Tue, 11 Dec 2018 17:45:43 +0000 (18:45 +0100)]
i965: Use gl_vertex_format in brw_vertex_element.

State upload needs to cope with the vertex format
rather than with the full attribute data.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agoi965: Make use of the vertex format functions in i965.
Mathias Fröhlich [Tue, 11 Dec 2018 17:45:43 +0000 (18:45 +0100)]
i965: Make use of the vertex format functions in i965.

v2: Style fixes.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agomesa: Provide gl_vertex_format accessors.
Mathias Fröhlich [Tue, 11 Dec 2018 17:45:43 +0000 (18:45 +0100)]
mesa: Provide gl_vertex_format accessors.

Provide the same set of VAO and current value gl_vertex_format
accessor functions like we have for the gl_array_attributes.
For most purpose the vertex format is what we need.

v2: Style fixes.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agomesa: Remove now unused _mesa_draw_attrib.
Mathias Fröhlich [Tue, 11 Dec 2018 17:45:43 +0000 (18:45 +0100)]
mesa: Remove now unused _mesa_draw_attrib.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agomesa: Remove now unused _mesa_draw_attrib_and_binding.
Mathias Fröhlich [Tue, 11 Dec 2018 17:45:43 +0000 (18:45 +0100)]
mesa: Remove now unused _mesa_draw_attrib_and_binding.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agoi965: Remove glbinding from brw_vertex_element.
Mathias Fröhlich [Mon, 9 Mar 2020 21:23:31 +0000 (22:23 +0100)]
i965: Remove glbinding from brw_vertex_element.

v2: Rebase.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agoi965: Reorder workaround flags computation.
Mathias Fröhlich [Sat, 20 Apr 2019 05:28:19 +0000 (07:28 +0200)]
i965: Reorder workaround flags computation.

Vertex processing workaround flags can be split into
array and current vertex attributes. By that we
can use specific access functions for these different
vertex attribute kinds. This finally obsoletes
some access functions that I introduced last winter
for a smooth transition.

v2: Style fixes.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agoi965: Split merge_inputs and clear_buffers.
Mathias Fröhlich [Tue, 11 Dec 2018 17:45:43 +0000 (18:45 +0100)]
i965: Split merge_inputs and clear_buffers.

The merge_inputs function handles that part that changes when the
inputs change. The clear_buffers function triggers when we may need
a new upload. Thus the merge_inputs can be limited to be once
per brw_draw_prims.

v2: Move declaration of attribute index into the for scope.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agoi965: Test original vertex array pointer to skip array upload.
Mathias Fröhlich [Sat, 20 Apr 2019 05:39:56 +0000 (07:39 +0200)]
i965: Test original vertex array pointer to skip array upload.

Rather than do a NULL pointer check on a pointer that may be offset by the
min-max index range of an GL draw operation, execute the NULL test on the
original vertex array pointer.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agoi965: Use the VAOs binding information in array setup.
Mathias Fröhlich [Sat, 20 Apr 2019 05:57:15 +0000 (07:57 +0200)]
i965: Use the VAOs binding information in array setup.

The change basically reimplements array setup by walking
the gl_contex::Array._DrawVAO on a per binding sequence.
In this way we can make direct use of the application
provided minimum set of buffer objects and emit fewer relocs.

v2: Rebase onto:
    compiler: Move double_inputs to gl_program::DualSlotInputs
v3: Rebase onto introduction of gl_vertex_format
v4: Reorder and extend patch series.
v5: Split out two hunks into seperate patches.
v6: Avoid using GL* types.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agoi965: Use 32 bit u_bit_scan for vertex attribute setup.
Mathias Fröhlich [Sat, 20 Apr 2019 05:57:12 +0000 (07:57 +0200)]
i965: Use 32 bit u_bit_scan for vertex attribute setup.

The vertex array object contains 32 vertex arrays. By that we cannot
reference more then these in the vertex shader inputs. So, we can use
the 32 bits u_bit_scan function to iterate the vertex shader inputs
and place an assert that only these are present. Also place an other
assert that the vertex array setup in i965 does not overrun the
enabled array in brw_context::vs::enabled.

v2: Style fixes.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agoiris: Move down iris_emit_sbe_swiz in profiles.
Mathias Fröhlich [Sat, 2 Nov 2019 07:06:03 +0000 (08:06 +0100)]
iris: Move down iris_emit_sbe_swiz in profiles.

Harvest the information gathered in the previous patch
inside of iris.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agoi965: Move down genX_upload_sbe in profiles.
Mathias Fröhlich [Tue, 11 Dec 2018 17:45:43 +0000 (18:45 +0100)]
i965: Move down genX_upload_sbe in profiles.

Avoid looping over all VARYING_SLOT_MAX urb_setup array
entries from genX_upload_sbe. Prepare an array indirection
to the active entries of urb_setup already in the compile
step. On upload only walk the active arrays.

v2: Use uint8_t to store the attribute numbers.
v3: Change loop to build up the array indirection.
v4: Rebase.
v5: Style fix.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/308>

4 years agopanfrost: Get rid of ctx->payloads[]
Boris Brezillon [Fri, 6 Mar 2020 10:46:39 +0000 (11:46 +0100)]
panfrost: Get rid of ctx->payloads[]

Now that vertex/tiler payloads are re-initialized at draw/launch_grid
time we can get of of the ctx->payloads[] field and allocate those
payload templates on the stack.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Use ctx->active_prim in panfrost_writes_point_size()
Boris Brezillon [Fri, 6 Mar 2020 10:43:38 +0000 (11:43 +0100)]
panfrost: Use ctx->active_prim in panfrost_writes_point_size()

Check ctx->active_prim instead of prefix.draw_mode so we can eventually
get rid of ctx->payloads.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Re-init the VT payloads at draw/launch_grid() time
Boris Brezillon [Fri, 6 Mar 2020 10:31:06 +0000 (11:31 +0100)]
panfrost: Re-init the VT payloads at draw/launch_grid() time

Doing that should help us avoiding state leaks between draw/launch_grid
calls.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Move panfrost_emit_varying_descriptor() to pan_cmdstream.c
Boris Brezillon [Fri, 6 Mar 2020 08:45:31 +0000 (09:45 +0100)]
panfrost: Move panfrost_emit_varying_descriptor() to pan_cmdstream.c

Move panfrost_emit_varying_descriptor() to pan_cmdstream.c where other
emit functions live and adjust the prototype to be consistent with other
emit helpers.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Move panfrost_emit_vertex_data() to pan_cmdstream.c
Boris Brezillon [Fri, 6 Mar 2020 08:09:03 +0000 (09:09 +0100)]
panfrost: Move panfrost_emit_vertex_data() to pan_cmdstream.c

Move panfrost_emit_vertex_data() to pan_cmdstream.c where other emit
functions live, and adjust the prototype for consistency.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Inline panfrost_queue_draw() and panfrost_emit_for_draw()
Boris Brezillon [Fri, 6 Mar 2020 07:57:31 +0000 (08:57 +0100)]
panfrost: Inline panfrost_queue_draw() and panfrost_emit_for_draw()

Now that panfrost_queue_draw() and panfrost_emit_for_draw() are
small enough, we can move the code to panfrost_draw_vbo() and have all
vt and emit calls grouped in one place.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Move vertex/tiler payload initialization out of panfrost_draw_vbo()
Boris Brezillon [Fri, 6 Mar 2020 07:02:14 +0000 (08:02 +0100)]
panfrost: Move vertex/tiler payload initialization out of panfrost_draw_vbo()

Add a panfrost_vt_set_draw_info() function taking care of the draw
related initialization of the vertex and tiler payloads.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Move streamout offset update out of panfrost_draw_vbo()
Boris Brezillon [Thu, 5 Mar 2020 20:55:01 +0000 (21:55 +0100)]
panfrost: Move streamout offset update out of panfrost_draw_vbo()

That's part of out attempt to shrink panfrost_draw_vbo().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Rename panfrost_stage_attributes()
Boris Brezillon [Thu, 5 Mar 2020 20:48:09 +0000 (21:48 +0100)]
panfrost: Rename panfrost_stage_attributes()

panfrost_stage_attributes() is emitting mali_attr_meta descriptors, so
let's rename it accordingly and move it to pan_cmdstream.c.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Move the mali_attr.src_offset adjustment to a sub-function
Boris Brezillon [Thu, 5 Mar 2020 18:32:01 +0000 (19:32 +0100)]
panfrost: Move the mali_attr.src_offset adjustment to a sub-function

Create a panfrost_vertex_state_upd_attr_offs() helper to adjust
the attr_meta src_offsets.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Emit attribute descriptors after patching the templates
Boris Brezillon [Thu, 5 Mar 2020 18:48:30 +0000 (19:48 +0100)]
panfrost: Emit attribute descriptors after patching the templates

Patching attribute desc when they are in cacheable memory should be
more efficient.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Prepare attribute for builtins at state creation time
Boris Brezillon [Thu, 5 Mar 2020 18:40:15 +0000 (19:40 +0100)]
panfrost: Prepare attribute for builtins at state creation time

The attribute meta slots reserved for gl_VertexID and gl_InstanceID
can be pre-filled at state creation time. Only the index needs to be
adjusted when attributes are generated.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Ignore BO start addr when adjusting src_offset
Boris Brezillon [Thu, 5 Mar 2020 18:26:03 +0000 (19:26 +0100)]
panfrost: Ignore BO start addr when adjusting src_offset

BOs are guaranteed to be aligned on 4K which inherently guarantees the
64 byte alignment.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Drop initial mali_attr_meta.src_offset assignment
Boris Brezillon [Thu, 5 Mar 2020 18:22:26 +0000 (19:22 +0100)]
panfrost: Drop initial mali_attr_meta.src_offset assignment

The mali_attr_meta.src_offset is initialized to
pipe_vertex_element.src_offset at vertex element creation time, but
this field is then adjusted when the descrptors are emitted. Let's
use the pipe_vertex_element data we saved earlier and drop this initial
assignment.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Add an helper to emit a pair of vertex/tiler jobs
Boris Brezillon [Thu, 5 Mar 2020 17:53:08 +0000 (18:53 +0100)]
panfrost: Add an helper to emit a pair of vertex/tiler jobs

Add the panfrost_emit_vertex_tiler_jobs() helper and use it in
panfrost_queue_draw().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Move sampler/tex descs emission helpers to pan_cmdstream.c
Boris Brezillon [Thu, 5 Mar 2020 17:43:13 +0000 (18:43 +0100)]
panfrost: Move sampler/tex descs emission helpers to pan_cmdstream.c

Move panfrost_upload_texture_descriptors() and
panfrost_upload_sampler_descriptors() to pan_cmdstream.c where other
cmdstream related helpers live. While at it, change their prototype
and name to make it consistent with the other helpers and prepare
things for ctx->payloads[] removal.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Add a panfrost_sampler_desc_init() helper
Boris Brezillon [Thu, 5 Mar 2020 15:26:56 +0000 (16:26 +0100)]
panfrost: Add a panfrost_sampler_desc_init() helper

It just makes sense to group all HW descriptor initilization logic in
pan_cmdstream.c, so let's move this code out of
panfrost_create_sampler_state().

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Prepare shader_meta descriptors at emission time
Boris Brezillon [Thu, 5 Mar 2020 15:20:18 +0000 (16:20 +0100)]
panfrost: Prepare shader_meta descriptors at emission time

This way we avoid potential state leaks and keep the shader_meta
initialization in once place. The time spent preparing the shader
descriptors should be negligible compared to the time spent pushing
those descriptors to the transient buffer (remember we are writing to
non-cacheable memory here).

Note that we might get back to some sort of shader_meta descriptor
caching at some point if that proves necessary, but now we have those
panfrost_frag_meta_xxx_update() helpers now where xxx maps directly to
a CSO bind, which should ease desc template updates.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Prepare things to get rid of panfrost_shader_state.tripipe
Boris Brezillon [Thu, 5 Mar 2020 14:17:31 +0000 (15:17 +0100)]
panfrost: Prepare things to get rid of panfrost_shader_state.tripipe

panfrost_shader_state.tripipe is used as a template for shader_meta
desc emission, but shader_meta desc preparation time should be negligible
compared to desc emission time (remember we are writing to non-cacheable
memory here). Let's prepare for generating the the shader_meta desc
entirely at draw time by adding the necessary fields to
panfrost_shader_state.

Note that we might brink back some sort of shader_meta desc caching at
some point, but let's simplify things a bit for now.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Add an helper to update the rasterizer part of a tiler job desc
Boris Brezillon [Thu, 5 Mar 2020 10:52:12 +0000 (11:52 +0100)]
panfrost: Add an helper to update the rasterizer part of a tiler job desc

That's part of our attempt to make panfrost_emit_for_draw() a bit more
dry and eventually get rid of it by inlining the code in
panfrost_draw_vbo(). This is just one step in this direction.

Note that we get rid of the panfrost_rasterizer.tiler_gl_enables field
along the way, as setting/clearing those bits at draw time instead of
doing when the state is created should make a huge difference. We might
get back to pre-computed VT descs at some point, but let's keep things
simple for now.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Add an helper to update the occclusion query part of a tiler job desc
Boris Brezillon [Thu, 5 Mar 2020 10:47:04 +0000 (11:47 +0100)]
panfrost: Add an helper to update the occclusion query part of a tiler job desc

That's part of our attempt to make panfrost_emit_for_draw() a bit more
dry and eventually get rid of it by inlining the code in
panfrost_draw_vbo(). This is just one step in this direction.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Simplify panfrost_emit_for_draw() and make it private
Boris Brezillon [Thu, 5 Mar 2020 10:23:41 +0000 (11:23 +0100)]
panfrost: Simplify panfrost_emit_for_draw() and make it private

Now that panfrost_launch_grid() no longer calls panfrost_emit_for_draw(),
we can keep it private to pan_context.c and drop all compute-related
stuff.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Stop using panfrost_emit_for_draw() for compute jobs
Boris Brezillon [Thu, 5 Mar 2020 10:18:37 +0000 (11:18 +0100)]
panfrost: Stop using panfrost_emit_for_draw() for compute jobs

We actually need a small subset of what's done in
panfrost_emit_for_draw() when emitting compute jobs, so let's copy
what we need directly in panfrost_launch_grid() instead of re-using
this function whose initial purpose was to generate vertex/tiler jobs
for draw operations.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Move panfrost_attach_vt_framebuffer() to pan_cmdstream.c
Boris Brezillon [Fri, 6 Mar 2020 08:59:56 +0000 (09:59 +0100)]
panfrost: Move panfrost_attach_vt_framebuffer() to pan_cmdstream.c

Move panfrost_attach_vt_framebuffer() to pan_cmdstream.c and change its
name to panfrost_vt_attach_framebuffer() so we can use a consistent
prefix (panfrost_vt_) for all helpers initializing/updating
midgard_payload_vertex_tiler fields.

Note that the function only initializes one VT object now.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Dissociate shader meta patching from the desc emission
Boris Brezillon [Thu, 5 Mar 2020 10:02:56 +0000 (11:02 +0100)]
panfrost: Dissociate shader meta patching from the desc emission

Right now we emit two shader descriptors for the fragment shader, one
when panfrost_patch_shader_state() is called, and the final one
including both the shader_meta and the blend RT descriptors.
The first generated fragment shader descriptor is never used, since the
second one overrides the postfix.shader pointer.

Let's dissociate the state patching logic from the descriptor emission
so we don't upload descriptors that are never used.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Move shared mem desc emission out of panfrost_launch_grid()
Boris Brezillon [Thu, 5 Mar 2020 08:57:44 +0000 (09:57 +0100)]
panfrost: Move shared mem desc emission out of panfrost_launch_grid()

Let's move the shared memory descriptor emission to a dedicated function
living with its pairs in pan_cmdstream.c.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Move the const buf emission logic out of panfrost_emit_for_draw()
Boris Brezillon [Thu, 5 Mar 2020 08:46:42 +0000 (09:46 +0100)]
panfrost: Move the const buf emission logic out of panfrost_emit_for_draw()

Let's move the constant buffer emission logic in a dedicated helper
to make panfrost_emit_for_draw() a bit more dry.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Move viewport desc emission out of panfrost_emit_for_draw()
Boris Brezillon [Thu, 5 Mar 2020 08:30:58 +0000 (09:30 +0100)]
panfrost: Move viewport desc emission out of panfrost_emit_for_draw()

Let's move the viewport descriptor emission logic to a dedicated helper
in order to shrink a bit the panfrost_emit_for_draw().

Note that this helper is placed in a new pan_cmdstream.c file where we
will group all cmdstream related helpers (everything that's related to
HW descriptor initialization emission).

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Move the batch stack size adjustment out of panfrost_queue_draw()
Boris Brezillon [Thu, 5 Mar 2020 07:58:10 +0000 (08:58 +0100)]
panfrost: Move the batch stack size adjustment out of panfrost_queue_draw()

That's part of our attempt to sanitize panfrost_queue_draw(),
panfrost_draw_vbo() and panfrost_emit_for_draw(). The new
panfrost_batch_adjust_stack_size() helper is placed in pan_job.c, where
all batch related functions live.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Add an helper to retrieve the currently active shader state
Boris Brezillon [Thu, 5 Mar 2020 09:46:39 +0000 (10:46 +0100)]
panfrost: Add an helper to retrieve the currently active shader state

Doing that improves readability and helps avoiding code duplication.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agopanfrost: Assign primitive_size.pointer only if writes_point_size() returns true
Boris Brezillon [Thu, 5 Mar 2020 16:24:39 +0000 (17:24 +0100)]
panfrost: Assign primitive_size.pointer only if writes_point_size() returns true

Checking vs->writes_point_size is not enough, as we might have a vertex
shader writing point size, but a primitive that's not MALI_POINT. That
currently works because emit_varying_descriptor() is called before the
primitive_size.constant field is update, but let's make the logic more
robust, just in case things are re-ordered at some point.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

4 years agoradv/sqtt: describe pipeline and wait events barriers
Samuel Pitoiset [Tue, 3 Mar 2020 13:24:55 +0000 (14:24 +0100)]
radv/sqtt: describe pipeline and wait events barriers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4031>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4031>

4 years agoradv/rgp: bump the instrumentation spec version to 1
Samuel Pitoiset [Tue, 3 Mar 2020 13:08:30 +0000 (14:08 +0100)]
radv/rgp: bump the instrumentation spec version to 1

RGP expects the version to be 1, otherwise it doesn't display the
barriers (including layout transitions) correctly.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4031>

4 years agoradv/sqtt: describe render pass color/depthstencil clears
Samuel Pitoiset [Tue, 3 Mar 2020 13:06:26 +0000 (14:06 +0100)]
radv/sqtt: describe render pass color/depthstencil clears

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4031>

4 years agoradv/sqtt: describe draw/dispatch and emit event markers
Samuel Pitoiset [Tue, 3 Mar 2020 13:03:25 +0000 (14:03 +0100)]
radv/sqtt: describe draw/dispatch and emit event markers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4031>

4 years agoradv/sqtt: describe begin/end command buffers with user markers
Samuel Pitoiset [Tue, 3 Mar 2020 12:42:41 +0000 (13:42 +0100)]
radv/sqtt: describe begin/end command buffers with user markers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4031>

4 years agoradv: initial implementation of the driver internal layer SQTT
Samuel Pitoiset [Wed, 26 Feb 2020 13:05:15 +0000 (14:05 +0100)]
radv: initial implementation of the driver internal layer SQTT

This layer is used to emit SQTT user markers to command buffers. It
currently only emits API markers but it will consolidated soon with
barrier markers and more.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4031>

4 years agoradv/sqtt: add a helper that emits thread trace userdata markers
Samuel Pitoiset [Wed, 26 Feb 2020 13:12:01 +0000 (14:12 +0100)]
radv/sqtt: add a helper that emits thread trace userdata markers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4031>

4 years agoradv: use device entrypoints from the SQTT layer if enabled
Samuel Pitoiset [Wed, 26 Feb 2020 12:59:05 +0000 (13:59 +0100)]
radv: use device entrypoints from the SQTT layer if enabled

This allows to override RADV device entrypoints if the prefix
is 'sqtt' instead of 'radv'.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4031>

4 years agoradv/entrypoints: declare a driver internal layer for SQTT
Samuel Pitoiset [Wed, 26 Feb 2020 12:52:11 +0000 (13:52 +0100)]
radv/entrypoints: declare a driver internal layer for SQTT

Some Vulkan commands will be overriden to emit user SQTT markers.
These markers are then used by the Radeon GPU Profiler to display
timings, barrier operations (cache flushes, pipeline stalls, layout
transitions) and more.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4031>

4 years agopanfrost: Pass the sampler view format when creating a tex descriptor
Boris Brezillon [Sat, 7 Mar 2020 15:24:03 +0000 (16:24 +0100)]
panfrost: Pass the sampler view format when creating a tex descriptor

A sampler can use a different format than the native texture format.
Let's pass the sampler format instead of the native texture format when
creating a texture descriptor.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4101>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4101>

4 years agoRevert "panfrost: Z24 variants should be sampled as R32UI"
Boris Brezillon [Sat, 7 Mar 2020 14:40:15 +0000 (15:40 +0100)]
Revert "panfrost: Z24 variants should be sampled as R32UI"

Commit 0406ea485649 ("panfrost: Z24 variants should be sampled as
R32UI") causes a regression when depth textures are sampled.

It's still not clear how MALI_Z32 can work for for Z32 and Z24{S,X}8,
but let's leave that question for later.

Reported-by: Icecream95 <ixn@keemail.me>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4101>

4 years agogallium: Add forgotten docs for new CAPs related to transform feedback
Tomeu Vizoso [Mon, 9 Mar 2020 13:17:41 +0000 (14:17 +0100)]
gallium: Add forgotten docs for new CAPs related to transform feedback

These three caps were missing docs.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4115>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4115>

4 years agolima: enable minmax cache for index buffers
Vasily Khoruzhick [Wed, 4 Mar 2020 06:05:52 +0000 (22:05 -0800)]
lima: enable minmax cache for index buffers

Re-use minmax cache for index buffers from panfrost.

Reviewed-by: Andreas Baierl <ichgeh@imkreisrum.de>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4051>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4051>

4 years agopanfrost: split index cache into shared part
Vasily Khoruzhick [Wed, 4 Mar 2020 05:31:51 +0000 (21:31 -0800)]
panfrost: split index cache into shared part

Split it into shared part since we're going to re-use it in lima.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4051>

4 years agost/mesa: fix a possible crash with selection and feedback modes
Marek Olšák [Wed, 12 Feb 2020 22:15:34 +0000 (17:15 -0500)]
st/mesa: fix a possible crash with selection and feedback modes

The index bounds are always valid without an index buffer, but they won't be.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3986>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3986>