platform/upstream/mesa.git
3 years agoinclude: Remove unused i810_pci_ids.h
Adam Jackson [Fri, 30 Apr 2021 18:26:04 +0000 (14:26 -0400)]
include: Remove unused i810_pci_ids.h

Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10554>

3 years agopanfrost: Meson dependency
Antonio Caggiano [Fri, 9 Apr 2021 15:27:12 +0000 (17:27 +0200)]
panfrost: Meson dependency

Declare a meson dependency for libpanfrost and wrap some key functions
within an extern C block allowing proper compilation by C++ compilers.

Signed-off-by: Antonio Caggiano <antonio.caggiano@collabora.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10462>

3 years agovenus: clean up vn_device_fix_create_info
Chia-I Wu [Fri, 30 Apr 2021 19:53:41 +0000 (12:53 -0700)]
venus: clean up vn_device_fix_create_info

The extension list should be more correct now.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>

3 years agovenus: add extension check for ANDROID_native_buffer
Chia-I Wu [Fri, 30 Apr 2021 19:52:52 +0000 (12:52 -0700)]
venus: add extension check for ANDROID_native_buffer

We only do it on Android for now, to keep the driver working with older
renderers on X11.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>

3 years agovenus: init supported extensions in one place
Chia-I Wu [Fri, 30 Apr 2021 18:05:11 +0000 (11:05 -0700)]
venus: init supported extensions in one place

This also guarantees that physical_dev->extension_spec_versions[X] is
set when extension X is supported.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>

3 years agovenus: refactor vn_physical_device_init_supported_extensions
Chia-I Wu [Fri, 30 Apr 2021 16:46:49 +0000 (09:46 -0700)]
venus: refactor vn_physical_device_init_supported_extensions

Native extensions are those do not require direct renderer support.
Passthrough extensions are those require direct renderer support.

Native extensions usually require translation to other extensions that
the renderer supports.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>

3 years agovenus: avoid strcmp for spec version override
Chia-I Wu [Fri, 30 Apr 2021 17:33:32 +0000 (10:33 -0700)]
venus: avoid strcmp for spec version override

Add VN_EXTENSION_TABLE_INDEX for use with VK_ANDROID_native_buffer spec
version override.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>

3 years agovenus: refactor vn_physical_device_init_extensions
Chia-I Wu [Fri, 30 Apr 2021 16:01:28 +0000 (09:01 -0700)]
venus: refactor vn_physical_device_init_extensions

Split up into two functions, one initializes the renderer extension
table and one initializes the supported extension table.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>

3 years agovenus: clarify/fix device renderer version
Chia-I Wu [Thu, 29 Apr 2021 23:28:55 +0000 (16:28 -0700)]
venus: clarify/fix device renderer version

Mostly docs and cleanups, except that renderer_version is now also
capped by the xml version.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>

3 years agovenus: clarify/fix instance renderer versions
Chia-I Wu [Thu, 29 Apr 2021 16:48:02 +0000 (09:48 -0700)]
venus: clarify/fix instance renderer versions

Add vn_instance::renderer_version to indicate the maximum renderer
instance version we can use internally.  It is not all that useful
because we only use 1.1 instance features and VN_MIN_RENDERER_VERSION is
set to 1.1, but whatever.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>

3 years agovenus: rename vn_instance::renderer_version
Chia-I Wu [Thu, 29 Apr 2021 19:08:48 +0000 (12:08 -0700)]
venus: rename vn_instance::renderer_version

Rename renderer_version to renderer_api_version.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>

3 years agovenus: add VN_MAX_API_VERSION
Chia-I Wu [Mon, 3 May 2021 16:46:32 +0000 (09:46 -0700)]
venus: add VN_MAX_API_VERSION

Use VN_MAX_API_VERSION for the instance version such that we don't
suddenly advertise 1.3 when the header is updated to 1.3 for example.

Use it to cap the device version as well.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10556>

3 years agovenus: fix dmabuf import fail path
Chia-I Wu [Mon, 3 May 2021 04:08:00 +0000 (21:08 -0700)]
venus: fix dmabuf import fail path

When we fail, we should not close gem_handle when there is already a bo
with the same gem handle.

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10592>

3 years agovenus: fix dmabuf import mmap_size check
Chia-I Wu [Mon, 3 May 2021 03:38:36 +0000 (20:38 -0700)]
venus: fix dmabuf import mmap_size check

Do not set mmap_size to info.size.  We do not track the size of the BO
anymore.

This fixes
dEQP-VK.api.external.memory.dma_buf.suballocated.device_only.fd_properties
where the test allocates a 1KB VkDeviceMemory, export and call
vkGetMemoryFdPropertiesKHR.  It can happen that bo->mmap_size is less
than the aligned info.size.

FWIW, the test fails because it violates a VU:

  VUID-vkGetMemoryFdPropertiesKHR-fd-00673
  fd must be an external memory handle created outside of the Vulkan API

Fixes: 88f481dd742 ("venus: make sure gem_handle and vn_renderer_bo are 1:1")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10592>

3 years agovenus: fix render pass without attachments
Chia-I Wu [Sat, 1 May 2021 04:15:52 +0000 (21:15 -0700)]
venus: fix render pass without attachments

It was treated as VK_ERROR_OUT_OF_HOST_MEMORY because
vn_get_intercepted_attachments would return NULL.  This fixes various
dEQP tests.

Fixes: 174fca5498e ("venus: handle VK_IMAGE_LAYOUT_PRESENT_SRC_KHR transfer")
Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10592>

3 years agoir3: Don't assume regs[1] exists in ir3_fixup_src_type()
Connor Abbott [Sat, 20 Feb 2021 19:22:50 +0000 (20:22 +0100)]
ir3: Don't assume regs[1] exists in ir3_fixup_src_type()

It won't exist for phi nodes because they are only partially constructed
beforehand. Move it into the switch arguments where we know it's needed.

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

3 years agoir3: Rework outputs
Connor Abbott [Wed, 10 Feb 2021 18:28:37 +0000 (19:28 +0100)]
ir3: Rework outputs

Instead of using a separate outputs array, make the "end" instruction
(or chmask) take the outputs as sources. This works better for the new
RA, because it better models the fact that outputs are consumed all at
the same time. With the old model, each output collect would be assumed
dead after it was processed and subsequent collects could use it when
inserting shuffle code, which wouldn't work, and the new RA also deletes
collect instructions after lowering them to moves so the information
would be gone after RA.

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

3 years agoir3: Make predecessors an array
Connor Abbott [Fri, 29 Jan 2021 14:31:52 +0000 (15:31 +0100)]
ir3: Make predecessors an array

We need a stable order in order to create phi instructions. In the
future we can make this more sophisticated in order to make manipulating
the CFG easier, but for now that only happens after RA, so we won't have
to worry about it.

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

3 years agoir3: Refactor nir->ir3 block handling
Connor Abbott [Fri, 11 Sep 2020 09:48:27 +0000 (11:48 +0200)]
ir3: Refactor nir->ir3 block handling

Originally I wrote this to support multiple ir3 blocks per NIR block,
but this turned out to be more useful for creating a stable ordering to
the predecessors. We compute the predecessors ourselves, rather than
relying on NIR, so that the array of predecessors we create in the next
commit has a stable order we can rely on when creating phi nodes.

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

3 years agoir3/cp_postsched: Fixup SSA use pointer for direct reads
Connor Abbott [Mon, 22 Mar 2021 10:30:53 +0000 (11:30 +0100)]
ir3/cp_postsched: Fixup SSA use pointer for direct reads

There's an optimization here to sink direct (i.e. not relative) reads of
an array past unrelated direct writes. However, since each write
actually reads, modifies, and then writes again to the array, this means
that we need to read the latest updated array. The old RA used the array
id instead of the SSA information, so it didn't care, but the new RA
uses ->instr instead and ignores the array id because arrays are now SSA
so it needs to be correct.

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

3 years agoir3/postsched: Fix ir3_postsched_node::delay calculation
Connor Abbott [Tue, 23 Mar 2021 16:59:04 +0000 (17:59 +0100)]
ir3/postsched: Fix ir3_postsched_node::delay calculation

This wasn't using the same calculation that add_reg_dep() was using to
get the index into state->regs, so it was using the wrong register. Fix
this by folding it into add_reg_dep().

This shouldn't fix anything, because it's just used for scheduler
priorities, but it should reduce nop's and syncs.

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

3 years agoir3/delay: Remove special case for array deps
Connor Abbott [Tue, 23 Mar 2021 17:38:49 +0000 (18:38 +0100)]
ir3/delay: Remove special case for array deps

The case it was trying to handle (array read-after-write depedendencies)
is already handled by the normal SSA source handling, so this is just
useless.

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

3 years agoir3/postsched: Use correct src index
Connor Abbott [Mon, 22 Feb 2021 13:59:28 +0000 (14:59 +0100)]
ir3/postsched: Use correct src index

Match what ir3_delay_calc() does. Caught by an assert later.

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

3 years agoir3/sched: Use correct src index
Connor Abbott [Mon, 22 Feb 2021 14:42:12 +0000 (15:42 +0100)]
ir3/sched: Use correct src index

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

3 years agoir3/cp: Clone registers for compare-folding optimization
Connor Abbott [Mon, 26 Apr 2021 21:07:36 +0000 (23:07 +0200)]
ir3/cp: Clone registers for compare-folding optimization

Sharing the same register between instructions happened to work with the
old RA, but not with the new RA because they may get different register
assignments.

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

3 years agoir3/postsched: Fix dependencies for a0.x/p0.x
Connor Abbott [Tue, 27 Apr 2021 10:44:16 +0000 (12:44 +0200)]
ir3/postsched: Fix dependencies for a0.x/p0.x

a0.x is written as a half-reg, but just interpreting it as "hr61.x" will
result in it overlapping with r30.z in merged mode, which is not what
the hardware does at all. This introduced a spurious dependency on
a write to r30.z which resulted in an assert tripping. Just pretend it's
a full reg instead.

This fixes
spec@arb_tessellation_shader@execution@variable-indexing@vs-output-array-vec3-index-wr-before-tcs
with the new RA.

Fixes: 0f78c32 ("freedreno/ir3: post-RA sched pass")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10591>

3 years agopanfrost: Remove old dEQP workaround
Alyssa Rosenzweig [Mon, 3 May 2021 15:14:19 +0000 (11:14 -0400)]
panfrost: Remove old dEQP workaround

Nobody else needs it.

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

3 years agoRevert "glx: s/Display */struct glx_display */ over internal API"
Adam Jackson [Mon, 3 May 2021 12:38:02 +0000 (08:38 -0400)]
Revert "glx: s/Display */struct glx_display */ over internal API"

This broke texture-from-pixmap in OBS Studio so I must have done
something wrong and also we need better tfp testing.

This reverts commit b02b26b87cd124b05a409b680817ee1950d6d94a.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4718
Acked-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10593>

3 years agoir3: do not fold cmps from different blocks with non-null address
Danylo Piliaiev [Tue, 20 Apr 2021 17:29:21 +0000 (20:29 +0300)]
ir3: do not fold cmps from different blocks with non-null address

Scheduling don't like address being in the different block from
the instruction.

Fixes a crash in the trace of "War Thunder" (DX11)

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10355>

3 years agoiris: fix indirect drawid
Mike Blumenkrantz [Fri, 30 Apr 2021 19:00:02 +0000 (15:00 -0400)]
iris: fix indirect drawid

iteration needs to be added to the offset now

Fixes: dae3113c3d8 ("gallium: split drawid out of pipe_draw_info and as a separate draw_vbo param")

Tested-by: Mark Janes <markjanes@swizzler.org>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10555>

3 years agointel/eu: Set message subtype properly for SIMD8 FB fetch
Jason Ekstrand [Mon, 3 May 2021 14:50:44 +0000 (09:50 -0500)]
intel/eu: Set message subtype properly for SIMD8 FB fetch

There were two bugs which crep in here as part of 64551610d1e6:
forgetting that exec sizes in HW are in log2 space and having the
exec_size condition for the subtype backwards.

Fixes: 64551610d1e6 "intel/compiler: rework message descriptors..."
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10588>

3 years agopanfrost: Don't unroll loops in GLSL
Alyssa Rosenzweig [Fri, 9 Apr 2021 19:53:22 +0000 (15:53 -0400)]
panfrost: Don't unroll loops in GLSL

GLSL loop analysis is trouble. Just use NIR.

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

3 years agopan/bi: Workaround *V2F32_TO_V2F16 erratum
Alyssa Rosenzweig [Tue, 13 Apr 2021 19:56:01 +0000 (15:56 -0400)]
pan/bi: Workaround *V2F32_TO_V2F16 erratum

Exact conditions this workaround is needed unknown. Determined
experimentally.

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

3 years agopan/bi: Don't schedule clamps to +FADD.v2f16
Alyssa Rosenzweig [Tue, 23 Feb 2021 00:26:03 +0000 (00:26 +0000)]
pan/bi: Don't schedule clamps to +FADD.v2f16

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

3 years agopan/bi: Add and use bi_negzero helper
Alyssa Rosenzweig [Tue, 13 Apr 2021 18:36:08 +0000 (14:36 -0400)]
pan/bi: Add and use bi_negzero helper

-0.0 is the additive identity in IEEE 754 arithmetic, not +0.0!

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

3 years agopan/bi: Lower swizzles on CLPER
Alyssa Rosenzweig [Fri, 9 Apr 2021 20:24:54 +0000 (16:24 -0400)]
pan/bi: Lower swizzles on CLPER

Needed for vectorized FP16 derivatives.

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

3 years agopan/bi: Fix loads and stores smaller than 32 bits
Alyssa Rosenzweig [Fri, 9 Apr 2021 21:06:27 +0000 (17:06 -0400)]
pan/bi: Fix loads and stores smaller than 32 bits

Spiritual successor to Icecream95's patch of the same name.

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

3 years agopan/bi: Replace lane0 modifier with lane_dest for load instructions
Icecream95 [Sun, 3 Jan 2021 08:54:26 +0000 (21:54 +1300)]
pan/bi: Replace lane0 modifier with lane_dest for load instructions

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

3 years agopan/bi: Add "lane_dest" modifier
Icecream95 [Sun, 3 Jan 2021 08:53:05 +0000 (21:53 +1300)]
pan/bi: Add "lane_dest" modifier

Similar to the "lane" modifier, but for the instruction destination
instead the sources.

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

3 years agopan/bi: Implement vectorized int downcasts
Alyssa Rosenzweig [Tue, 13 Apr 2021 17:22:01 +0000 (13:22 -0400)]
pan/bi: Implement vectorized int downcasts

Just MKVEC but needs the usual special handling.

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

3 years agopan/bi: Improve assert for vector size errors
Alyssa Rosenzweig [Tue, 13 Apr 2021 17:21:19 +0000 (13:21 -0400)]
pan/bi: Improve assert for vector size errors

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

3 years agopan/bi: Fix 16-bit fsat
Alyssa Rosenzweig [Mon, 4 Jan 2021 23:19:51 +0000 (18:19 -0500)]
pan/bi: Fix 16-bit fsat

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

3 years agopan/bi: Implement vectorized f32_to_f16
Alyssa Rosenzweig [Thu, 31 Dec 2020 21:03:38 +0000 (16:03 -0500)]
pan/bi: Implement vectorized f32_to_f16

f2f16 needs special treatment since it can access multiple 32-bit words.
Corresponds to the two-op instruction V2F32_TO_V2F16.

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

3 years agopan/bi: Emit int CSEL instead of float by default
Alyssa Rosenzweig [Tue, 23 Feb 2021 23:41:32 +0000 (23:41 +0000)]
pan/bi: Emit int CSEL instead of float by default

Will be needed when we use 1-bit booleans.

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

3 years agopan/bi: Support 16-bit load_interpolated_input
Alyssa Rosenzweig [Thu, 31 Dec 2020 23:17:50 +0000 (18:17 -0500)]
pan/bi: Support 16-bit load_interpolated_input

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

3 years agopan/bi: Union modifiers from across variants
Alyssa Rosenzweig [Mon, 4 Jan 2021 23:54:41 +0000 (18:54 -0500)]
pan/bi: Union modifiers from across variants

itertools.groupby depends on sorting, so this code was quietly broken on
cases like FADD.v2f16.

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

3 years agopan/bi: Simplify Python expression
Alyssa Rosenzweig [Mon, 4 Jan 2021 23:20:21 +0000 (18:20 -0500)]
pan/bi: Simplify Python expression

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

3 years agopan/bi: Don't reference nir_lower_mediump_outputs
Alyssa Rosenzweig [Wed, 21 Apr 2021 18:54:00 +0000 (14:54 -0400)]
pan/bi: Don't reference nir_lower_mediump_outputs

Nonexistant.

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

3 years agopan/bi: Add simple constant folding pass
Alyssa Rosenzweig [Tue, 13 Apr 2021 22:47:04 +0000 (18:47 -0400)]
pan/bi: Add simple constant folding pass

Cleans up swizzle lowering, and will be used for other cleanup as
well (fancy texturing tends to create a lot of foldable code).

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

3 years agopan/bi: Don't reference uninit source in ATOM_C1
Alyssa Rosenzweig [Mon, 3 May 2021 15:03:11 +0000 (11:03 -0400)]
pan/bi: Don't reference uninit source in ATOM_C1

Causes it to be live throughout the shader, causing register allocation
failures on some dEQP-GLES31 shaders.

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

3 years agopan/bi: Add missing sr_count to pseudo-atomics
Alyssa Rosenzweig [Mon, 3 May 2021 14:57:40 +0000 (10:57 -0400)]
pan/bi: Add missing sr_count to pseudo-atomics

Fixes missing prints for these.

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

3 years agoradv,ac/llvm: use a dword alignment for descriptor loads
Rhys Perry [Fri, 30 Apr 2021 10:39:12 +0000 (11:39 +0100)]
radv,ac/llvm: use a dword alignment for descriptor loads

RADV doesn't try to keep anything 16 or 32 byte aligned. RADV also seems
to create better code for some reason.

fossil-db (Sienna Cichlid):
Totals from 37693 (30.93% of 121873) affected shaders:
SGPRs: 1762792 -> 1785504 (+1.29%); split: -1.01%, +2.30%
VGPRs: 1761032 -> 1760808 (-0.01%); split: -0.09%, +0.07%
SpillSGPRs: 55793 -> 56011 (+0.39%); split: -3.49%, +3.88%
SpillVGPRs: 16766 -> 16387 (-2.26%); split: -3.99%, +1.73%
CodeSize: 82902228 -> 82781608 (-0.15%); split: -0.29%, +0.14%
Scratch: 3024896 -> 2987008 (-1.25%); split: -3.08%, +1.83%
MaxWaves: 919794 -> 920302 (+0.06%); split: +0.09%, -0.03%

shader-db (Sienna Cichlid):
Totals from affected shaders:
SGPRS: 3976 -> 3976 (0.00 %)
VGPRS: 3392 -> 3392 (0.00 %)
Spilled SGPRs: 0 -> 0 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 0 -> 0 (0.00 %) dwords per thread
Code Size: 178792 -> 178980 (0.11 %) bytes
Max Waves: 1389 -> 1389 (0.00 %)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4715
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10543>

3 years agotu: Fix SP_GS_PRIM_SIZE for large sizes
Connor Abbott [Fri, 30 Apr 2021 16:07:58 +0000 (18:07 +0200)]
tu: Fix SP_GS_PRIM_SIZE for large sizes

Based on the previous commit.

Fixes: 012773b ("turnip: Configure VPC for geometry shaders")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10551>

3 years agofreedreno/a6xx: Fix SP_GS_PRIM_SIZE for large sizes
Connor Abbott [Fri, 30 Apr 2021 16:05:37 +0000 (18:05 +0200)]
freedreno/a6xx: Fix SP_GS_PRIM_SIZE for large sizes

This fixes a few piglit hangs.

Fixes: 0eebedb ("freedreno/a6xx: Emit program state for GS")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10551>

3 years agofreedreno/a6xx: Better document SP_GS_PRIM_SIZE
Connor Abbott [Fri, 30 Apr 2021 16:03:56 +0000 (18:03 +0200)]
freedreno/a6xx: Better document SP_GS_PRIM_SIZE

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

3 years agoradv: Only require DRM 3.23.
Bas Nieuwenhuizen [Sun, 2 May 2021 12:22:43 +0000 (14:22 +0200)]
radv: Only require DRM 3.23.

Turns out kernel 4.15 only goes up to amdgpu 3.23 . 3.35 is way
too new. Too new for e.g. ChromeOS.

Fixes: 1df4f11eb5f ("radv: require DRM 3.35+")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4728
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10576>

3 years agovulkan/wsi: avoid wsi_x11_check_for_dri3 for sw device
Michel Zou [Tue, 20 Apr 2021 13:15:58 +0000 (15:15 +0200)]
vulkan/wsi: avoid wsi_x11_check_for_dri3 for sw device

Disabling the check allows swapchains to be created on a remote
X Server using the xlib backend, which in turn allows Vulkan apps,
such as swapchain_images in Vulkan Samples, to run.

Closes #4323

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Michel Dänzer <mdaenzer@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10349>

3 years agopanfrost: Fix invalid conversions
Antonio Caggiano [Mon, 26 Apr 2021 16:49:14 +0000 (18:49 +0200)]
panfrost: Fix invalid conversions

When compiling with a C++ compiler, invalid conversions are treated as
errors unless the fpermissive flag is provided. These changes fix all
invalid conversions encountered while including libpanfrost in a C++
project.

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

3 years agonir/opcodes: Reword confusing comment
Alyssa Rosenzweig [Sat, 17 Apr 2021 21:43:17 +0000 (17:43 -0400)]
nir/opcodes: Reword confusing comment

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10578>

3 years agoradv/winsys: fix executing huge secondary command buffers on GFX6
Samuel Pitoiset [Fri, 30 Apr 2021 12:50:57 +0000 (14:50 +0200)]
radv/winsys: fix executing huge secondary command buffers on GFX6

If the secondary has a list of CS buffers, it should be copied to
the primary.

Fixes dEQP-VK.api.command_buffers.record_many_draws_secondary_2.

Cc: 21.1 mesa-stable
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/10547>

3 years agoradv/winsys: add GFX6_MAX_CS_SIZE instead of using a magic value
Samuel Pitoiset [Fri, 30 Apr 2021 10:58:02 +0000 (12:58 +0200)]
radv/winsys: add GFX6_MAX_CS_SIZE instead of using a magic value

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

3 years agoaco/spill: Fix improper handling of exec phis
Tony Wasserka [Tue, 27 Apr 2021 15:26:09 +0000 (17:26 +0200)]
aco/spill: Fix improper handling of exec phis

The "continue" was placed in the wrong loop, leading to exec being
counted as a spilled register when it wasn't.

Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: a56ddca4e80a6ef7bb0c44edb4e5b6169510aaca ('aco: make all exec accesses non-temporaries')
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4533
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10486>

3 years agonvc0: fix implicit-fallthrough gcc warning
Karol Herbst [Fri, 30 Apr 2021 11:04:16 +0000 (13:04 +0200)]
nvc0: fix implicit-fallthrough gcc warning

gcc warning:
../src/gallium/drivers/nouveau/nvc0/nvc0_screen.c: In function ‘nvc0_screen_get_compute_param’:
../src/gallium/drivers/nouveau/nvc0/nvc0_screen.c:623:7: warning: this statement may fall through [-Wimplicit-fallthrough=]
  623 |       switch (obj_class) {
      |       ^~~~~~
../src/gallium/drivers/nouveau/nvc0/nvc0_screen.c:634:4: note: here
  634 |    case PIPE_COMPUTE_CAP_MAX_PRIVATE_SIZE: /* l[] */
      |    ^~~~

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10544>

3 years agonv50/query: fix stringop-overflow gcc warning
Karol Herbst [Fri, 30 Apr 2021 11:00:40 +0000 (13:00 +0200)]
nv50/query: fix stringop-overflow gcc warning

gcc warning:
../src/gallium/drivers/nouveau/nv50/nv50_query_hw_metric.c: In function ‘nv50_hw_metric_get_query_result’:
../src/gallium/drivers/nouveau/nv50/nv50_query_hw_metric.c:140:26: warning: ‘sm11_hw_metric_calc_result’ accessing 64 bytes in a region of size 32 [-Wstringop-overflow=]
  140 |    *(uint64_t *)result = sm11_hw_metric_calc_result(hq, res64);
      |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/gallium/drivers/nouveau/nv50/nv50_query_hw_metric.c:140:26: note: referencing argument 2 of type ‘uint64_t *’ {aka ‘long unsigned int *’}
../src/gallium/drivers/nouveau/nv50/nv50_query_hw_metric.c:105:1: note: in a call to function ‘sm11_hw_metric_calc_result’
  105 | sm11_hw_metric_calc_result(struct nv50_hw_query *hq, uint64_t res64[8])
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Pierre Moreau <dev@pmoreau.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10544>

3 years agopanfrost: Split panfrost_batch_submit to prevent stack overflows
Icecream95 [Fri, 23 Apr 2021 11:48:00 +0000 (23:48 +1200)]
panfrost: Split panfrost_batch_submit to prevent stack overflows

panfrost_batch_submit can recurse to hundreds of levels to submit
dependencies, so split the actual submit code from the dependency
recursion, saving over a kilobyte of stack space per recursion
level. Enforce this with ATTRIBUTE_NOINLINE.

Use ATTRIBUTE_NOINLINE on panfrost_batch_submit itself as well to
prevent GCC from inlining the function into itself, which would use a
few hundred bytes of stack.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10574>

3 years agoradv: only keep concurrent MSAA images compressed if TC-compat CMASK
Samuel Pitoiset [Tue, 27 Apr 2021 12:50:35 +0000 (14:50 +0200)]
radv: only keep concurrent MSAA images compressed if TC-compat CMASK

Otherwise, we need a FMASK_DECOMPRESS which is only supported
on the gfx queue.

Fixes rendering with Forza Horizon 4 on Polaris10.

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/10482>

3 years agoradv: check if DCC is enabled when resolving different levels
Samuel Pitoiset [Wed, 28 Apr 2021 15:21:23 +0000 (17:21 +0200)]
radv: check if DCC is enabled when resolving different levels

Fixes an assertion triggered by new CTS:
dEQP-VK.renderpass2.suballocation.multisample_resolve.*_resolve_level_*

Looks like the driver should pass a range to radv_layout_dcc_compressed().

Cc: 21.1 mesa-stable
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/10502>

3 years agoutil: disable glthread in CSGO
Timothy Arceri [Fri, 30 Apr 2021 06:05:23 +0000 (16:05 +1000)]
util: disable glthread in CSGO

Users have reported a rise in trust factor problems [1] since using
mesa builds containing 6f2017205e62. Until we confirm its not a problem
disable glthread.

[1] https://github.com/ValveSoftware/csgo-osx-linux/issues/2630

Fixes: 6f2017205e62 ("dri: enable glthread + radeonsi workaround for CS:GO")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4710

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10540>

3 years agoasahi: Add Gallium driver
Alyssa Rosenzweig [Tue, 20 Apr 2021 19:36:41 +0000 (01:06 +0530)]
asahi: Add Gallium driver

Forked from noop, with some code from Panfrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add vertex formats table
Alyssa Rosenzweig [Sun, 2 May 2021 16:40:39 +0000 (12:40 -0400)]
asahi: Add vertex formats table

This all gets lowers anyway so it's not entirely clear if this is the
best approach, but these map formats that have native device_load
encodings. (and don't need shader unpack code)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add some magic IOGPU routines
Alyssa Rosenzweig [Tue, 27 Apr 2021 22:48:11 +0000 (18:48 -0400)]
asahi: Add some magic IOGPU routines

These turned out to be software defined structures consumed by the macOS
kernel (specifically, by IOGPUCommandQueue). I'm a bit bothered by the
sheer amount of random hex flying about, though Hector made some
progress on deciphering the structure. Nevertheless there's some comfort
knowing it's not actual hardware magic.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add uniform upload routines
Alyssa Rosenzweig [Sun, 25 Apr 2021 19:10:45 +0000 (15:10 -0400)]
asahi: Add uniform upload routines

Effectively everything is treated as a sysval.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add pool data structure
Alyssa Rosenzweig [Sun, 2 May 2021 16:30:39 +0000 (12:30 -0400)]
asahi: Add pool data structure

Lifted from Panfrost.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add device abstraction
Alyssa Rosenzweig [Sun, 2 May 2021 16:30:22 +0000 (12:30 -0400)]
asahi: Add device abstraction

Over IOKit or DRM, primarily for memory allocation. Common between
Gallium and Vulkan.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add tiling routines
Alyssa Rosenzweig [Sat, 24 Apr 2021 23:15:43 +0000 (19:15 -0400)]
asahi: Add tiling routines

For the 64x64 Morton order pattern we know how to use for textures and
framebuffers. (AGX also supports a framebuffer compression scheme. This
is not that.)

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add command buffer decode helpers
Alyssa Rosenzweig [Sat, 24 Apr 2021 23:13:29 +0000 (19:13 -0400)]
asahi: Add command buffer decode helpers

Forked from Panfrost's pandecode. Like pandecode, most of the
heavylifting is generated with GenXML, so this is relatively simple.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add (clean room) IOKit uABI header
Alyssa Rosenzweig [Sat, 24 Apr 2021 23:13:11 +0000 (19:13 -0400)]
asahi: Add (clean room) IOKit uABI header

This only builds on macOS (depends on IOKit), where it is required for
command buffer submission and tracing the Metal blob.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add a GenXML fork
Alyssa Rosenzweig [Sat, 24 Apr 2021 23:10:10 +0000 (19:10 -0400)]
asahi: Add a GenXML fork

Via Panfrost via v3d via Intel. Sour dough!

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add allocation data structure
Alyssa Rosenzweig [Sat, 24 Apr 2021 23:08:51 +0000 (19:08 -0400)]
asahi: Add allocation data structure

Something half-way between what IOKit (macOS) and DRM (Linux) want.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add command buffer XML definitions
Alyssa Rosenzweig [Sat, 24 Apr 2021 23:08:14 +0000 (19:08 -0400)]
asahi: Add command buffer XML definitions

Formatted for GenXML. Incomplete and probably riddled with errors, but a
good start.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoasahi: Add hexdump utility
Alyssa Rosenzweig [Sat, 24 Apr 2021 23:07:59 +0000 (19:07 -0400)]
asahi: Add hexdump utility

Used in our decoder.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Support bcsel
Alyssa Rosenzweig [Sat, 24 Apr 2021 21:41:19 +0000 (17:41 -0400)]
agx: Support bcsel

We're already using cmpsel in lots of places, pipe through the real
thing!

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Pack cmpsel
Alyssa Rosenzweig [Sat, 24 Apr 2021 20:24:17 +0000 (16:24 -0400)]
agx: Pack cmpsel

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Add b2i implementation
Alyssa Rosenzweig [Sun, 2 May 2021 13:36:09 +0000 (09:36 -0400)]
agx: Add b2i implementation

Another icmpsel variant.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Implement b2f
Alyssa Rosenzweig [Sat, 24 Apr 2021 20:23:15 +0000 (16:23 -0400)]
agx: Implement b2f

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Support 1-bit booleans
Alyssa Rosenzweig [Sat, 24 Apr 2021 20:23:01 +0000 (16:23 -0400)]
agx: Support 1-bit booleans

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Add min/max support
Alyssa Rosenzweig [Sun, 18 Apr 2021 19:16:04 +0000 (15:16 -0400)]
agx: Add min/max support

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Pack texture ops
Alyssa Rosenzweig [Sat, 24 Apr 2021 18:01:32 +0000 (14:01 -0400)]
agx: Pack texture ops

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Emit texture ops
Alyssa Rosenzweig [Sat, 24 Apr 2021 18:01:08 +0000 (14:01 -0400)]
agx: Emit texture ops

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Add agx_tex_dim helper
Alyssa Rosenzweig [Sat, 24 Apr 2021 18:00:55 +0000 (14:00 -0400)]
agx: Add agx_tex_dim helper

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Implement vertex_id
Alyssa Rosenzweig [Sun, 18 Apr 2021 00:43:32 +0000 (20:43 -0400)]
agx: Implement vertex_id

Preloaded to r5 in vertex shaders.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Lower load_attr to device memory accesses
Alyssa Rosenzweig [Sat, 17 Apr 2021 23:57:51 +0000 (19:57 -0400)]
agx: Lower load_attr to device memory accesses

This is pretty annoying but not as catastrophic as I feared... at least,
until we need to support indirect access, non-native formats, or instancing.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Set flag on last st_vary instruction
Alyssa Rosenzweig [Sat, 17 Apr 2021 22:09:41 +0000 (18:09 -0400)]
agx: Set flag on last st_vary instruction

Not sure what the point is but let's match the blob.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Implement load_ubo/kernel_input
Alyssa Rosenzweig [Sat, 17 Apr 2021 20:55:45 +0000 (16:55 -0400)]
agx: Implement load_ubo/kernel_input

Lower to a read from global memory at a base address specified in a
sysval.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Add sysval management helper
Alyssa Rosenzweig [Sat, 17 Apr 2021 20:59:51 +0000 (16:59 -0400)]
agx: Add sysval management helper

Will be used for lowering UBO loads, among other applications.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Implement limited case of i2i16/i2i32 as iadd
Alyssa Rosenzweig [Sat, 17 Apr 2021 20:57:01 +0000 (16:57 -0400)]
agx: Implement limited case of i2i16/i2i32 as iadd

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Propagate immediates
Alyssa Rosenzweig [Sat, 17 Apr 2021 15:38:00 +0000 (11:38 -0400)]
agx: Propagate immediates

8-bit integers can be inlined to immediates on integer ops. Likewise,
floats with simple representations can be converted to 8-bit minifloats
and inlined on float ops.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Propagate fmov backwards as well
Alyssa Rosenzweig [Sat, 17 Apr 2021 15:13:32 +0000 (11:13 -0400)]
agx: Propagate fmov backwards as well

Primarily for fsat. Also folds conversions but this is more of an
accident, and it doesn't do so optimally (due to the f2f16/f2f32
orientation issue outlined in the pass comments).

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Add dead code eliminator
Alyssa Rosenzweig [Sat, 17 Apr 2021 14:52:15 +0000 (10:52 -0400)]
agx: Add dead code eliminator

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>

3 years agoagx: Add forward optimizing pass for fmov
Alyssa Rosenzweig [Sat, 17 Apr 2021 14:29:27 +0000 (10:29 -0400)]
agx: Add forward optimizing pass for fmov

Explain the ideas behind our SSA-based optimizer (inspired by ACO's,
thank you to Daniel Schuermann for discussing this with me in the
context of Bifrost), and implement the subset needed to propagate
abs/neg through.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582>