platform/upstream/mesa.git
3 years agopanfrost: Move arch-independent pan_format code
Alyssa Rosenzweig [Thu, 8 Jul 2021 00:08:40 +0000 (20:08 -0400)]
panfrost: Move arch-independent pan_format code

Now pan_format.c is just tables.

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

3 years agopanfrost: Inline panfrost_get_z_internal_format
Alyssa Rosenzweig [Thu, 8 Jul 2021 00:06:33 +0000 (20:06 -0400)]
panfrost: Inline panfrost_get_z_internal_format

Trivial, get it out of the way so pan_format can focus on the tables.

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

3 years agopanfrost: Assert that injected jobs are for blits
Alyssa Rosenzweig [Tue, 6 Jul 2021 23:33:55 +0000 (19:33 -0400)]
panfrost: Assert that injected jobs are for blits

Remove a level of indentation.

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

3 years agopanfrost: Inline away pan_invocation.c
Alyssa Rosenzweig [Tue, 6 Jul 2021 23:31:25 +0000 (19:31 -0400)]
panfrost: Inline away pan_invocation.c

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

3 years agopanfrost: Express pack_work_groups more concisely
Alyssa Rosenzweig [Tue, 6 Jul 2021 23:28:33 +0000 (19:28 -0400)]
panfrost: Express pack_work_groups more concisely

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

3 years agopanfrost: Inline away pan_pool.c
Alyssa Rosenzweig [Tue, 6 Jul 2021 23:19:02 +0000 (19:19 -0400)]
panfrost: Inline away pan_pool.c

Just noise now that it's been abstracted for panvk.

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

3 years agopanfrost: Move panfrost_vertex/instance_id to per-gen
Alyssa Rosenzweig [Tue, 6 Jul 2021 23:16:29 +0000 (19:16 -0400)]
panfrost: Move panfrost_vertex/instance_id to per-gen

Now the rest of pan_attributes.c is GenXML-independent.

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

3 years agopanfrost: Inline flip_compare_func into pan_encoder.h
Alyssa Rosenzweig [Tue, 6 Jul 2021 23:12:24 +0000 (19:12 -0400)]
panfrost: Inline flip_compare_func into pan_encoder.h

This will become the home for little GenXML-aware helpers, suitable to
be #include'd from pan_cmdstream.c (or panvk equivalent).

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

3 years agolavapipe: expose strict-lines feature
Erik Faye-Lund [Wed, 7 Jul 2021 09:54:32 +0000 (11:54 +0200)]
lavapipe: expose strict-lines feature

The strictLines-feature requires lines to be rasterized as rectangles
by default instead of using the parallelograms you get from extending
bresenham lines along their minor axis.

Now that we can specify the line mode fully we can actually express
this, so let's do so.

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

3 years agolavapipe: re-expose line-rasterization extension
Erik Faye-Lund [Wed, 7 Jul 2021 15:06:47 +0000 (17:06 +0200)]
lavapipe: re-expose line-rasterization extension

While we're at it, let's also enable rectangular line support, now that
we can properly control it.

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

3 years agollvmpipe: respect rectangular_lines
Erik Faye-Lund [Wed, 7 Jul 2021 09:50:45 +0000 (11:50 +0200)]
llvmpipe: respect rectangular_lines

With the new rectangular_lines state, we can now support rasterizing
wide lines correctly according to the vulkan spec, where this can be
specified independently of the rest of the state.

Because rectangular lines are orthogonal to multi-sampling, we now need
to also adjust with the pixel-offset in the rectangle code-path as well.

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

3 years agodraw: respect line_rectangular state
Erik Faye-Lund [Wed, 7 Jul 2021 21:44:44 +0000 (23:44 +0200)]
draw: respect line_rectangular state

Now that we have a separate flag to signal rectangular lines, let's use
that instead of the smooth-flag.

This should have the benefit of also drawing rectangular lines when
multisampling stippled, non-smooth lines. But it seems there were no
test for that, so no results to update.

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

3 years agogallium: explicitly specify line rasterization mode
Erik Faye-Lund [Wed, 7 Jul 2021 09:44:20 +0000 (11:44 +0200)]
gallium: explicitly specify line rasterization mode

Currently, drivers infer the line rasterization mode from the
multisampling and line_smooth rasterization state. This is always
correct for OpenGL, but is subtly incorrect for DirectX 9, 10 and
Vulkan (when VK_EXT_line_rasterization is supported).

So let's allow front-ends to choose freely between rectangle and
paralellogram rendering.

The reason why there's no added cap for this, is that the implicit
selection that drivers currently do will work just as well (or more
correclty, just as subtly wrong) as before. And there's nothing
reasonable the front-ends can do to get the correct behavior, so
there's really no fall-back code to write either.

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

3 years agolavapipe: fix disable_multisample condition
Erik Faye-Lund [Wed, 7 Jul 2021 09:34:39 +0000 (11:34 +0200)]
lavapipe: fix disable_multisample condition

There's two of the line-modes that warrants disabling multisampling,
and that's bresenham and smooth lines.

The reason we need this for the smooth lines case, is that multisampling
overrides the smooth-flag.

Fixes: 9fbf6b2abff ("lavapipe: implement VK_EXT_line_rasterization")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11782>

3 years agolavapipe: do not disable multisampling for smooth lines
Erik Faye-Lund [Wed, 7 Jul 2021 10:02:39 +0000 (12:02 +0200)]
lavapipe: do not disable multisampling for smooth lines

Smooth lines are also rasterized with rectangles instead of using
bresenham-style lines, so let's make sure we exclude those as well
from this test.

Fixes: 9fbf6b2abff ("lavapipe: implement VK_EXT_line_rasterization")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11782>

3 years agoaco/meson: remove inc_gallium from include_directories
Daniel Schürmann [Mon, 12 Jul 2021 17:46:25 +0000 (19:46 +0200)]
aco/meson: remove inc_gallium from include_directories

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11258>

3 years agoaco: Format.
Daniel Schürmann [Wed, 9 Jun 2021 08:14:54 +0000 (10:14 +0200)]
aco: Format.

Manually adjusted some comments for more intuitive line breaks.

Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11258>

3 years agoaco: add .clang-format file
Daniel Schürmann [Wed, 9 Jun 2021 06:53:11 +0000 (08:53 +0200)]
aco: add .clang-format file

Based on src/amd/.clang-format with following changes:
Language: Cpp
Standard: c++14
PointerAlignment: Left
IndentAccessModifiers: False
SpaceBeforeCtorInitializerColon: True
AllowShortCaseLabelsOnASingleLine: True
AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortBlocksOnASingleLine: Empty
AllowShortLambdasOnASingleLine: All
BraceWrapping:
  SplitEmptyFunction: false
  SplitEmptyRecord: false
  BeforeLambdaBody: true
IncludeBlocks: Regroup (with specified IncludeCategories)

Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11258>

3 years agozink: ci updates
Mike Blumenkrantz [Mon, 12 Jul 2021 16:59:53 +0000 (12:59 -0400)]
zink: ci updates

this one no longer flakes

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

3 years agozink: zero out sampler/image descriptor surface info for null descriptor updates
Mike Blumenkrantz [Mon, 12 Jul 2021 16:57:29 +0000 (12:57 -0400)]
zink: zero out sampler/image descriptor surface info for null descriptor updates

this is the surface struct used by the caching manager to generate a ref update template,
which means it must be kept in sync with the current state of descriptors

when the struct is zeroed, it implies that no refs need to be taken for the cached set

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

3 years agoir3/print: Manual formatting fixups
Connor Abbott [Mon, 12 Jul 2021 17:01:06 +0000 (19:01 +0200)]
ir3/print: Manual formatting fixups

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11801>

3 years agoir3: Reformat source with clang-format
Connor Abbott [Fri, 9 Jul 2021 12:50:05 +0000 (14:50 +0200)]
ir3: Reformat source with clang-format

Generated using:

cd src/freedreno/ir3 && clang-format -i {**,.}/*.c {**,.}/*.h -style=file

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11801>

3 years agofreedreno: Add some options to .clang-format
Connor Abbott [Mon, 12 Jul 2021 10:42:40 +0000 (12:42 +0200)]
freedreno: Add some options to .clang-format

In preparation for reformatting ir3.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11801>

3 years agoir3: Manually reformat some places
Connor Abbott [Fri, 9 Jul 2021 11:34:26 +0000 (13:34 +0200)]
ir3: Manually reformat some places

clang-format does a bad job with a few tables and macros, and there were
some places it was doing wonky things because comments were longer than
80 characters and it tries to fix that without reformatting the comment
itself. Add magic comments to tell it to turn itself off and retab those
places manually (well, with a regex!).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11801>

3 years agoir3: Update .editorconfig and .dir-locals.el
Connor Abbott [Mon, 12 Jul 2021 13:03:38 +0000 (15:03 +0200)]
ir3: Update .editorconfig and .dir-locals.el

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11801>

3 years agoir3/lower_parallelcopy: Don't manually set wrmask
Connor Abbott [Mon, 12 Jul 2021 13:09:20 +0000 (15:09 +0200)]
ir3/lower_parallelcopy: Don't manually set wrmask

It's automatically set. This avoids some weird line wrapping with
clang-format.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11801>

3 years agoir3: Add ir3_collect() for fixed-size collects
Connor Abbott [Mon, 12 Jul 2021 16:11:21 +0000 (18:11 +0200)]
ir3: Add ir3_collect() for fixed-size collects

This avoids having the specify the size, and fixes weird formatting with
clang-format.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11801>

3 years agoir3: Add missing include to ir3_parser.y
Connor Abbott [Fri, 9 Jul 2021 13:33:12 +0000 (15:33 +0200)]
ir3: Add missing include to ir3_parser.y

This prevents build errors in the generated ir3_parser.h when
clang-format reshuffles the header includes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11801>

3 years agovulkan/wsi/wl: add wl_shm support for lavapipe.
Dave Airlie [Mon, 12 Jul 2021 00:29:28 +0000 (10:29 +1000)]
vulkan/wsi/wl: add wl_shm support for lavapipe.

This adds swrast support for rendering from lavapipe.

Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11819>

3 years agoRevert "ci/panfrost: Temporarily disable sun50i/RK3288"
Daniel Stone [Mon, 12 Jul 2021 16:55:04 +0000 (17:55 +0100)]
Revert "ci/panfrost: Temporarily disable sun50i/RK3288"

Back by popular demand etc

This reverts commit 9868b15164488f3a87d3204ff8788e9ce2f9c132.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11828>

3 years agokmsro: Add mali-dp
Michael Walle [Fri, 28 May 2021 12:29:52 +0000 (14:29 +0200)]
kmsro: Add mali-dp

The NXP LS1028A SoC includes a mali-dp display controller and a vivante
GPU. This allows using the Etnaviv driver on this SoC.

Signed-off-by: Michael Walle <michael@walle.cc>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11419>

3 years agost/xa: Mark default xa_get_pipe_format case unreachable.
Vinson Lee [Sun, 14 Feb 2021 04:56:43 +0000 (20:56 -0800)]
st/xa: Mark default xa_get_pipe_format case unreachable.

Fix defect reported by Coverity Scan.

Uninitialized scalar variable (UNINIT)
uninit_use: Using uninitialized value fdesc. Field fdesc.format is uninitialized.

Fixes: 9f2f5b3d7fd ("st/xa: Initial import of the xa state-tracker and the xa-vmwgfx target.")
Suggested-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9035>

3 years agoutil/meson: include inc_gallium
Daniel Schürmann [Fri, 9 Jul 2021 20:19:23 +0000 (22:19 +0200)]
util/meson: include inc_gallium

There are several dependencies on headers from
   /gallium/include/pipe/

which currently mean that dependencies on util
must include gallium to compile.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11811>

3 years agoi915g: Fix backface stencil when front_ccw is set.
Emma Anholt [Sun, 4 Jul 2021 05:12:21 +0000 (22:12 -0700)]
i915g: Fix backface stencil when front_ccw is set.

If we're doing separate front/back stencil ops, then in the absence of a
hardware bit for setting front_ccw (which you can already see from how we
manage cull face) we need to flip front/back stencil register settings.

Closes: #4974, #4975
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11706>

3 years agoi915g: Fix dumping of 3DSTATE_BACKFACE_STENCIL_OPS.
Emma Anholt [Sun, 4 Jul 2021 04:58:57 +0000 (21:58 -0700)]
i915g: Fix dumping of 3DSTATE_BACKFACE_STENCIL_OPS.

Its length was overly long and it meant we skipped the name of
3DSTATE_BACKFACE_STENCIL_MASKS.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11706>

3 years agoradv: lower primitive shading rate in NIR
Samuel Pitoiset [Thu, 24 Jun 2021 13:59:45 +0000 (15:59 +0200)]
radv: lower primitive shading rate in NIR

This allows more potential compiler optimizations if the value is a
constant or from a scalar load.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11579>

3 years agoturnip: Fix allocation size for vkCmdUpdateBuffer.
Emma Anholt [Tue, 6 Jul 2021 20:35:38 +0000 (13:35 -0700)]
turnip: Fix allocation size for vkCmdUpdateBuffer.

tu_cs_alloc() takes a size in dwords, not bytes.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11743>

3 years agolavapipe: expose more storage-image features
Erik Faye-Lund [Wed, 21 Apr 2021 07:49:05 +0000 (09:49 +0200)]
lavapipe: expose more storage-image features

I believe these Gallium caps imply these Vulkan features. If they don't,
then we got things wrong on the Zink side as well ;)

While we're at it, query shaderStorageImageWriteWithoutFormat based on
the PIPE_SHADER_CAP_MAX_SHADER_IMAGES cap. This matches what the gallium
OpenGL frontend does.

This brings Zink on Lavapipe up to OpenGL 4.5.

For some reason, a bunch of PBO tests starts failing on CI for Zink, but
that doesn't seem like a Lavapipe problem...

Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10467>

3 years agollvmpipe: only report supported shader-image formats
Erik Faye-Lund [Mon, 31 May 2021 15:41:12 +0000 (17:41 +0200)]
llvmpipe: only report supported shader-image formats

LLVMpipe has a rather limited implementation of shader-images, so let's
limit what we report to the formats required by the spec, as all of
those seems to work fine.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10467>

3 years agolavapipe: query formats for shader-image support
Erik Faye-Lund [Mon, 31 May 2021 15:39:03 +0000 (17:39 +0200)]
lavapipe: query formats for shader-image support

Assuming all formats are supported here isn't a good plan; we
don't actually support all formats.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10467>

3 years agollvmpipe: reject unsupported shader-image formats
Erik Faye-Lund [Mon, 31 May 2021 15:43:45 +0000 (17:43 +0200)]
llvmpipe: reject unsupported shader-image formats

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10467>

3 years agoci/panfrost: Temporarily disable sun50i/RK3288
Daniel Stone [Mon, 12 Jul 2021 15:07:07 +0000 (16:07 +0100)]
ci/panfrost: Temporarily disable sun50i/RK3288

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11825>

3 years agodocs: Add docs for running a local Mesa build
Jason Ekstrand [Fri, 9 Jul 2021 17:52:55 +0000 (12:52 -0500)]
docs: Add docs for running a local Mesa build

I'm tired of explaining this to people.  Let's put it in the actual
project docs.

Reviewed-by: Chia-I Wu <olvaffe@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11809>

3 years agointel/compiler: document register types
Marcin Ślusarz [Thu, 1 Jul 2021 12:46:48 +0000 (14:46 +0200)]
intel/compiler: document register types

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11677>

3 years agoaco: remove (wrong) GCC array-bounds warning
Daniel Schürmann [Fri, 9 Jul 2021 18:54:53 +0000 (20:54 +0200)]
aco: remove (wrong) GCC array-bounds warning

Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11271>

3 years agoaco: refactor SDWA opcode validation
Daniel Schürmann [Fri, 11 Jun 2021 12:55:09 +0000 (14:55 +0200)]
aco: refactor SDWA opcode validation

Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11271>

3 years agoaco/meson: remove unnecessary dependencies
Daniel Schürmann [Mon, 14 Jun 2021 10:58:24 +0000 (12:58 +0200)]
aco/meson: remove unnecessary dependencies

Also moves idep_vulkan_util_headers to /tests/meson.build

Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11271>

3 years agoaco: add 'common/' and 'llvm/' prefix to #includes
Daniel Schürmann [Thu, 10 Jun 2021 09:33:15 +0000 (11:33 +0200)]
aco: add 'common/' and 'llvm/' prefix to #includes

Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11271>

3 years agoaco: add missing Licenses and remove Authors from files
Daniel Schürmann [Wed, 9 Jun 2021 15:54:53 +0000 (17:54 +0200)]
aco: add missing Licenses and remove Authors from files

Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11271>

3 years agoaco: reorder and cleanup #includes
Daniel Schürmann [Wed, 9 Jun 2021 13:40:03 +0000 (15:40 +0200)]
aco: reorder and cleanup #includes

Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11271>

3 years agoaco/util: replace DIV_ROUND_UP(n+1,m) by n/m+1
Daniel Schürmann [Wed, 9 Jun 2021 13:35:08 +0000 (15:35 +0200)]
aco/util: replace DIV_ROUND_UP(n+1,m) by n/m+1

Reviewed-by: Tony Wasserka <tony.wasserka@gmx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11271>

3 years agobroadcom/compiler: fix add vs. mul
Thomas H.P. Andersen [Wed, 7 Jul 2021 14:50:05 +0000 (16:50 +0200)]
broadcom/compiler: fix add vs. mul

Spotted by a compile warning

Fixes: 7f61ff7b4d1 ("broadcom/compiler: Merge instructions more efficiently")

Reviewed-by: Iago Torral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11764>

3 years agobroadcom/compiler: use correct flag enum
Thomas H.P. Andersen [Wed, 7 Jul 2021 14:48:03 +0000 (16:48 +0200)]
broadcom/compiler: use correct flag enum

They have the same value, so no functional change

Reviewed-by: Iago Torral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11764>

3 years agointel/compiler: Track latency/perf of LSC fences
Lionel Landwerlin [Tue, 25 May 2021 08:31:10 +0000 (11:31 +0300)]
intel/compiler: Track latency/perf of LSC fences

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11759>

3 years agopanfrost: Fix GPU ID for t76x in get_perf_config
Icecream95 [Mon, 12 Jul 2021 08:33:55 +0000 (20:33 +1200)]
panfrost: Fix GPU ID for t76x in get_perf_config

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11824>

3 years agov3dv: expose geometry shaders
Iago Toral Quiroga [Thu, 1 Jul 2021 07:42:24 +0000 (09:42 +0200)]
v3dv: expose geometry shaders

A run of dEQP-VK.*geom* has 6328 test passes and 16 failures. 14 of
these failures are related to a CTS bug affecting atomic operations
for which I submitted a CL to Khronos. Another fail looks like it might
be a case of the error threshold in CTS being slightly low. There is
only one test fail in that list that looks like it might be an actual
driver bug, but it is a variable pointers test, so it might be unrelated
to geometry shaders in the end.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agobroadcom/ci: update expected fails for v3dv after enabling geometry shaders
Iago Toral Quiroga [Tue, 6 Jul 2021 12:56:17 +0000 (14:56 +0200)]
broadcom/ci: update expected fails for v3dv after enabling geometry shaders

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agov3dv: remove deferred vkCmdClearAtachments path
Iago Toral Quiroga [Thu, 8 Jul 2021 11:35:34 +0000 (13:35 +0200)]
v3dv: remove deferred vkCmdClearAtachments path

This was required to handle the case of secondary command buffers that
did not have framebuffer information available from the primary, since
we used to have an implementation that required this information to
be available for the fallback path of vkCmdClearAttachments. Now that
we can handle our our attachment clears in the current subpass by
emitting draw calls, we no longer need the framebuffer information to
be available and we can remove this.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agov3dv: remove fallback path for vkCmdClearAttachments
Iago Toral Quiroga [Thu, 8 Jul 2021 11:13:17 +0000 (13:13 +0200)]
v3dv: remove fallback path for vkCmdClearAttachments

Now that we support layered clears this code is dead.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agov3dv: implement layered attachment clears
Iago Toral Quiroga [Thu, 8 Jul 2021 10:42:22 +0000 (12:42 +0200)]
v3dv: implement layered attachment clears

Now that we have geometry shaders, we can leverage this to implement
clears of layered framebuffers by adding a geometry shader in our
clear pipelines that redirects the clear rect to the appropriate
layer in the framebuffer, instead of falling back to emitting separate
clear jobs for each layer, which is a lot slower.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agobroadcom/compiler: don't ignore constant offset on per-vertex input loads
Iago Toral Quiroga [Wed, 7 Jul 2021 08:56:32 +0000 (10:56 +0200)]
broadcom/compiler: don't ignore constant offset on per-vertex input loads

Fixes:
dEQP-VK.clipping.user_defined.clip_distance.vert_geom.{5,6,7,8}

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agobroadcom/compiler: handle compact input arrays for geometry shaders
Iago Toral Quiroga [Wed, 7 Jul 2021 08:54:57 +0000 (10:54 +0200)]
broadcom/compiler: handle compact input arrays for geometry shaders

Clip distance arrays will come as compact array variables, so we need
to handle them as such, like we did for vertex inputs.

Fixes:
dEQP-VK.clipping.user_defined.clip_distance.vert_geom.{1,2,3,4}

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agov3dv: fix copy buffer to image TFU path for 3D images
Iago Toral Quiroga [Tue, 6 Jul 2021 05:53:31 +0000 (07:53 +0200)]
v3dv: fix copy buffer to image TFU path for 3D images

This bug was exposed by the following CTS tests (requires
geometry shaders):
dEQP-VK.geometry.layered.3d.*.readback

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agov3dv: handle QUNIFORM_FB_LAYERS
Iago Toral Quiroga [Thu, 1 Jul 2021 07:39:17 +0000 (09:39 +0200)]
v3dv: handle QUNIFORM_FB_LAYERS

There is a bit of a corner case here for secondary buffers that
don't inherit framebuffer information, since those won't have
access to the number of layers in the framebuffer by the time
we get here. Since we only emit this to sanitize the value of
gl_Layer produced from geometry shaders, I think it is probably
fine to lie about it and just use the maximum number of layers
we support. The only issue with that is that broken shaders that
emit out of bounds layer indices (which the spect states may lead
to unfined shading results) may cause undefined results.

In the future we could do better and patch the uniform streams
later when the secondary is executed inside a primary, since we
will have the required framebuffer information at that point,
but for now this seems like a reasonable compromise.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agov3dv: emit state packets for geometry shaders
Iago Toral Quiroga [Thu, 1 Jul 2021 07:08:02 +0000 (09:08 +0200)]
v3dv: emit state packets for geometry shaders

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agobroadcom/compiler: create a helper for computing VPM config
Iago Toral Quiroga [Thu, 1 Jul 2021 11:05:44 +0000 (13:05 +0200)]
broadcom/compiler: create a helper for computing VPM config

This code is the same across drivers.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agov3dv: add support for geometry shaders to pipelines
Iago Toral Quiroga [Wed, 30 Jun 2021 08:43:54 +0000 (10:43 +0200)]
v3dv: add support for geometry shaders to pipelines

This gets our graphics pipelines (and pipeline cache) to accept
and compile geometry shader modules.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agobroadcom/compiler: track if geometry shaders write gl_PointSize
Iago Toral Quiroga [Tue, 6 Jul 2021 10:01:53 +0000 (12:01 +0200)]
broadcom/compiler: track if geometry shaders write gl_PointSize

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agov3dv: add a few more broadcom shader stage helpers
Iago Toral Quiroga [Wed, 30 Jun 2021 08:39:04 +0000 (10:39 +0200)]
v3dv: add a few more broadcom shader stage helpers

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agov3dv: define a generic helper to create binning pipeline stages
Iago Toral Quiroga [Wed, 30 Jun 2021 08:12:30 +0000 (10:12 +0200)]
v3dv: define a generic helper to create binning pipeline stages

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agov3dv: extend broadcom stages to include geometry
Iago Toral Quiroga [Wed, 30 Jun 2021 08:11:10 +0000 (10:11 +0200)]
v3dv: extend broadcom stages to include geometry

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agov3dv: always free pipeline stages after compiling
Iago Toral Quiroga [Thu, 1 Jul 2021 12:05:55 +0000 (14:05 +0200)]
v3dv: always free pipeline stages after compiling

We were not freeing this when the pipeline was loaded from the cache.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11783>

3 years agocrocus: add GL_CLAMP emulation in driver again.
Dave Airlie [Mon, 12 Jul 2021 05:12:02 +0000 (15:12 +1000)]
crocus: add GL_CLAMP emulation in driver again.

I removed this because I thought the state tracker could handle it,
and it really should handle it, but it has some minecraft side effects
I'm unsure about. This fixes the problem for now, we can revisit it later.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11822>

3 years agocrocus/gen8: fix wrap mode needs border color.
Dave Airlie [Mon, 12 Jul 2021 04:21:03 +0000 (14:21 +1000)]
crocus/gen8: fix wrap mode needs border color.

missing piece here.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11821>

3 years agoagx: Flip point coordinates because OpenGL
Alyssa Rosenzweig [Sun, 11 Jul 2021 22:07:53 +0000 (18:07 -0400)]
agx: Flip point coordinates because OpenGL

Fixes dEQP-GLES2.functional.shaders.builtin_variable.pointcoord

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

3 years agoasahi: Handle point coordinates
Alyssa Rosenzweig [Sun, 11 Jul 2021 21:27:55 +0000 (17:27 -0400)]
asahi: Handle point coordinates

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

3 years agoasahi: Identify triangle/lines vs point varyings
Alyssa Rosenzweig [Sun, 11 Jul 2021 21:10:29 +0000 (17:10 -0400)]
asahi: Identify triangle/lines vs point varyings

Seems to allow skipping over point coords?

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

3 years agoasahi: Unpack varying descriptors (1x)
Alyssa Rosenzweig [Sun, 11 Jul 2021 21:05:03 +0000 (17:05 -0400)]
asahi: Unpack varying descriptors (1x)

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

3 years agoasahi: Lower PIPE_CAPF_MAX_POINT_WIDTH to hw limit
Alyssa Rosenzweig [Sun, 11 Jul 2021 20:45:06 +0000 (16:45 -0400)]
asahi: Lower PIPE_CAPF_MAX_POINT_WIDTH to hw limit

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

3 years agoasahi: Set bit for psiz
Alyssa Rosenzweig [Sun, 11 Jul 2021 20:42:33 +0000 (16:42 -0400)]
asahi: Set bit for psiz

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

3 years agoasahi: Set point magic bit in rasterizer
Alyssa Rosenzweig [Sun, 11 Jul 2021 20:37:39 +0000 (16:37 -0400)]
asahi: Set point magic bit in rasterizer

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

3 years agoasahi: Set bits in UNK11 needed for points
Alyssa Rosenzweig [Sun, 11 Jul 2021 20:35:54 +0000 (16:35 -0400)]
asahi: Set bits in UNK11 needed for points

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

3 years agozink: fix mem info query to be more permissive
Mike Blumenkrantz [Fri, 9 Jul 2021 14:17:48 +0000 (10:17 -0400)]
zink: fix mem info query to be more permissive

airlied was right, this was way too conservative

Fixes: ff4ba3d4a77 ("zink: support PIPE_CAP_QUERY_MEMORY_INFO")

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

3 years agoasahi/decode: Print some IOGPU stuff
Alyssa Rosenzweig [Sun, 11 Jul 2021 18:48:03 +0000 (14:48 -0400)]
asahi/decode: Print some IOGPU stuff

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

3 years agoasahi/decode: Print clear/store pipelines
Alyssa Rosenzweig [Sun, 11 Jul 2021 18:43:37 +0000 (14:43 -0400)]
asahi/decode: Print clear/store pipelines

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

3 years agoasahi: Garbage collect senseless cmdbuf struct
Alyssa Rosenzweig [Sun, 11 Jul 2021 18:13:46 +0000 (14:13 -0400)]
asahi: Garbage collect senseless cmdbuf struct

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

3 years agoasahi: Consolidate some magic numbers
Alyssa Rosenzweig [Sun, 11 Jul 2021 17:37:11 +0000 (13:37 -0400)]
asahi: Consolidate some magic numbers

This is a bunch of software data structures concatenated, not a true command
buffer like previously thought.

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

3 years agoasahi: Allocate global IDs
Alyssa Rosenzweig [Sun, 11 Jul 2021 17:28:40 +0000 (13:28 -0400)]
asahi: Allocate global IDs

Use the same UABI as Metal. One less hack, trying to rule out possible
differences to Metal...

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

3 years agoasahi: Allow specifying an encoder ID
Alyssa Rosenzweig [Sun, 11 Jul 2021 17:17:30 +0000 (13:17 -0400)]
asahi: Allow specifying an encoder ID

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

3 years agoasahi/decode: Fix decoding of draw calls
Alyssa Rosenzweig [Sat, 10 Jul 2021 16:32:10 +0000 (12:32 -0400)]
asahi/decode: Fix decoding of draw calls

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

3 years agoasahi/decode: Handle CULL packets
Alyssa Rosenzweig [Sat, 10 Jul 2021 16:30:27 +0000 (12:30 -0400)]
asahi/decode: Handle CULL packets

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

3 years agoasahi/decode: Fix up high word
Alyssa Rosenzweig [Sat, 10 Jul 2021 16:30:09 +0000 (12:30 -0400)]
asahi/decode: Fix up high word

Not sure what's happening here, there's some magic for sure.

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

3 years agoasahi: Identify more unknown fields in the memmap
Alyssa Rosenzweig [Sat, 10 Jul 2021 16:05:34 +0000 (12:05 -0400)]
asahi: Identify more unknown fields in the memmap

From validating the memory map of a Metal sample and seeing what goes wrong.

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

3 years agoasahi: Reserve more space to stop a command buffer
Alyssa Rosenzweig [Sat, 10 Jul 2021 15:24:32 +0000 (11:24 -0400)]
asahi: Reserve more space to stop a command buffer

Let's be safer.

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

3 years agoasahi/decode: Check fewer zeroes after a command buffer
Alyssa Rosenzweig [Sat, 10 Jul 2021 15:23:50 +0000 (11:23 -0400)]
asahi/decode: Check fewer zeroes after a command buffer

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

3 years agoasahi: Make track_free safer
Alyssa Rosenzweig [Sat, 10 Jul 2021 15:16:56 +0000 (11:16 -0400)]
asahi: Make track_free safer

Ensure that we don't free the same BO multiple times, which can lead to later
segfaults in decode.

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

3 years agoasahi/decode: Only dump mapped allocations
Alyssa Rosenzweig [Sat, 10 Jul 2021 15:04:45 +0000 (11:04 -0400)]
asahi/decode: Only dump mapped allocations

This matches the hardware's view of memory and helps catch spurious reads. (One
symptom of messing this up -- besides broken rendering -- is a kernel warning
about a "bogus texture handle 0".)

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

3 years agoasahi: Remove unused bo_access property
Alyssa Rosenzweig [Sat, 10 Jul 2021 15:01:25 +0000 (11:01 -0400)]
asahi: Remove unused bo_access property

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

3 years agoasahi: Add missing copyright/guards for magic.c/h
Alyssa Rosenzweig [Sat, 10 Jul 2021 14:51:06 +0000 (10:51 -0400)]
asahi: Add missing copyright/guards for magic.c/h

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

3 years agoasahi: Move fixed internal shaders to agx_blit.c
Alyssa Rosenzweig [Sat, 10 Jul 2021 14:48:56 +0000 (10:48 -0400)]
asahi: Move fixed internal shaders to agx_blit.c

A more natural place to put them, as the clear/store shaders use a similar
mechanism as the reload shaders. Now magic.c is exclusively kernel side piping.

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