Commit Graph

164643 Commits

Author SHA1 Message Date
Yiwei Zhang 553c0a3067 venus: fix VK_EXT_pci_bus_info support
Natively support it for virtgpu while passthrough renderer support for
vtest. This is a must support to avoid prime blit in common wsi.

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20310>
2022-12-17 21:34:47 -08:00
Yiwei Zhang 63cb570ef3 venus: sync protocol fixes and support for VK_EXT_pci_bus_info
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20310>
2022-12-17 21:34:47 -08:00
Marek Vasut 18f4dc6b75 etnaviv: Do expose 2D texture support on pre-halti GPUs
Commit d08bd9a8d8 ("etnaviv: don't expose array and 3D texture support on pre-halti GPUs")
started returning 0 from PIPE_CAP_MAX_TEXTURE_2D_SIZE as well due to switch
case fallthrough. Reinstate the behavior of PIPE_CAP_MAX_TEXTURE_2D_SIZE,
while at the same time, retain the new behavior introduced by commit
d08bd9a8d8 , Otherwise not even kmscube displays the spinning cube,
weston does not display desktop and so on.

Triggered on "Vivante GC600 rev 4653" , i.MX8M Mini .

Fixes: d08bd9a8d8 ("etnaviv: don't expose array and 3D texture support on pre-halti GPUs")
Closes: #7898
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20373>
2022-12-17 22:54:11 +01:00
Alyssa Rosenzweig 486c341769 panfrost: Add architecture description XML for v10
Add the GenXML hardware description for Mali architecture v10, as implemented in
Mali-G610. This is not 100% complete but it should be good enough for parity
with v9.

The XML itself is forked off of v9, with all Job Managerisms replaced with
CSFisms. This notably includes a large number of new structures defining the
instructions that run on the Command Execution Unit (CEU).

This is the first step towards supporting Mali-G610 (i.e. RK3588) upstream. Next
up will be pandecode support.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20360>
2022-12-17 20:33:39 +00:00
Rob Clark a9cdbed5a2 freedreno/drm: Short-circuit kernel for timeout=0 waits
We already know from the userspace fence whether the fence has signaled
or not.  No need to do a syscall if we aren't going to wait.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 90b9b1330d freedreno/drm/virtio: Guest side fence waits
Now that fd_fence and fd_submit_fence are unified, we can wait on the
fence fd rather than needing to poll the host.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 995c64ddcb freedreno/drm/virtio: More tracepoints
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark be6d21ed56 freedreno: Limit cached staging BOs to PIPE_MAP_READ
WC is fine for staging upload buffers, and will let us hit the default
heap.  Probably introducing a separate cached-coherent heap is overkill,
and given that staging uploads are common (but downloads uncommon, out-
side of dEQP/piglit), it is better to just ask for WC.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 4be235af7c freedreno/drm/virtio: Remove prealloc_list
Now that we are allocating cmdstream from the heap, we shouldn't need
this.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 4861067689 freedreno/drm: Add sub-allocator
Add a heap that we can use for allocations of small mappable buffers.
This avoids the churn of mmap/unmap, which is especially expensive in
a VM.  It also allows packing more smaller allocations together in a
page, which is useful for PIPE_BUFFERs (which are also mappable).

This avoid jank caused by the overhead of setting up or tearing down
guest mappings when running in a VM.  And also significantly reduces
the # of BOs referenced on a submit.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 7d0d82f25f util/vma: Add "nospan"
Add a way to request that allocations do not span a specified PoT
boundary.  This can be used, for ex, to ensure that allocations do
not span 4GB boundaries to work around hw/fw bugs.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 793741c936 freedreno/drm: Merge in_fence_fd's
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 137cd3b0fa freedreno/drm: Move no_implicit_sync accounting
No need to duplicate this.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 7b02bc6139 freedreno/drm: Drop fd_bo_fence
Remove the last fence-like-struct that isn't fd_fence.  Now that
fences are refcnt'd we can just attach them directly to BOs.  This
will simplify busy-ness tracking for suballoc BOs.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 434a8412e8 freedreno/drm: Re-enable submit fence merging
Now that we (a) create the fence ourselves, returning a reference from
fd_submit_flush(), and (b) refcnt the fences, we can now merge submits
with on out-fence by just attaching the same fence to all the submits.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 932ce591ac freedreno/drm: Simplify deferred submit flushing
Once we are sharing an out-fence for multiple deferred/merged submits
the complicated logic in fd_pipe_sp_flush() no longer works (or makes
sense), so just simplify all the paths into a single helper.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 48b5164356 freedreno/drm: Return fence from submit flush
This moves away from embedding the submit fence inside the pipe fence,
which lets us start refcnt'ing the fence.  This will enable several
cleanups and improvements:

1. Get rid of fd_bo_fence, and just have fd_bo hold pending fd_fence
   refs instead, which will be needed for cpu_prep implementation of
   sub-allocated buffers.
2. For merged submits, we can just return a new reference to an
   existing fence.

Note that this temporarily defeats submit-merging, which will be
fixed (and improved) in a following commit.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 7469574814 freedreno: Rename fd_fence -> fd_pipe_fence
So we don't have namespace clashes in the next commit.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark c1a621813b freedreno/drm: Combine fd_fence and fd_submit_fence
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 803df07d9e freedreno/drm: Replace shared/nosync fields
These are redundent with the alloc_flags.  A following commit will map
alloc_flags directly to bo heap that should be used, and adding the
FD_BO_SHARED bit when a BO is exported neatly avoids returning it to
the pool to be potentially erroneously reused.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark e6b364f924 freedreno/drm: Reorg BO alloc flags
And drop the unneeded _FD_BO_RING flag.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark fd20df8f09 freedreno/drm: Invert BO destruction
Sub-alloc'd heap BOs will need to do something a bit more special, ie.
not immediately cleanup fences (because those will be needed to know
when the BO is actually idle and vma node can be released), not tear
down the mmap (because the BO doesn't own it), and not close the handle
(also because the BO doesn't own it).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 84f44137ff freedreno/drm: Shuffle around BO init
Suballocated heap BOs will bypass the rest of bo_new() (as they skip the
BO cache, don't get an entry in the handle table, etc).  So move more of
the initialization into fd_bo_init_common().

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark db0f273cfb freedreno/drm: Drop pipe ref to device
The context and screen already holds refs to the device.  But since
fd_bo_fence holds a ref to the pipe, anyone anywhere leaking a single
bo with unwaited fences could cause the device to leak indirectly.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark c196e13e1f freedreno/drm: Get rid of fd_bo_del_locked()
This moves the table_lock into a small critical section in the BO delete
path when we are actually removing the entries from the handle/name
tables, so finally table_lock isn't the big-bo-lock!

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 5136f25667 freedreno/drm: Rework batch BO delete
Get rid of the per-device table of deferred handles, and instead keep
this on the stack so that no additional locking is needed.  This will
simplify getting rid of table_lock in the bo delete path.  For the BO
cache, add fd_bo_del_list_nocache() which works like fd_bo_del_array()
except that it bypasses returning BOs to the cache.  This gets rid of
the BO cache calls to private fd_bo fxns (which is useful now that the
bo_del/close_handles() dance has become a bit more complicated).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 75a4d90280 freedreno/drm: Start prying apart table_lock
We want to get back to the point where table_lock is only doing what
it's named for (ie. protecting handle/name tables).  This is the first
step.  Add new locks to protect fencing and the bo caches.  A single
global lock for fences, to avoid atomic instructions in the loop per
submit bo attaching fences.

This couldn't be broken appart into different commits, otherwise there
would have been an ABBA deadlock in BO cache's call to fd_bo_state()
to check if a BO is idle.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 2ee7012c2c freedreno/drm: Simplify cleanup_fences()
To prepare for moving fence state out from under table_lock, simplify
cleanup_fences() and stop trying to re-use it in the bo destruction
path (which otherwise wouldn't need the fence lock, since there is
no other owner of the bo ref at that point, and simply needs to drop
pipe refs).

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 73ab83d228 freedreno/drm: Add bo list iterator macros
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 8c355c7cbc freedreno/drm: Add BO cache stats
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 1bf88d0bf9 freedreno/drm: Allow submit merging with explicit sync
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 87f89a0383 freedreno/drm: Move no_implicit_sync to base
No need to duplicate between backends.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 9372f11c81 freedreno/drm: Remove cpu_fini
It has been unused since nearly forever.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Rob Clark 5c96dea638 freedreno: Update obsolete comment
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20263>
2022-12-17 19:14:12 +00:00
Yiwei Zhang 8a16c5283c venus: fix signaled fence creation under multiple timeline
Fixes: 3beb4f055e ("venus: allow renderer submissions on per-context virtgpu rings")

Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20366>
2022-12-17 18:58:58 +00:00
Alyssa Rosenzweig 3827c465e1 asahi: Implement anisotropy
Passes KHR-GLES3.texture_filter_anisotropic.*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Alyssa Rosenzweig 0347d1c358 asahi: Identify seamful cube map bit
Fixes

   dEQP-GLES2.functional.texture.mipmap.cube.basic.linear_nearest

when run with a GLES2 version.

We wire up seamless cube maps for GLES3+ only, working around an obscure
mesa/st limitation. See 6148e3aae7 ("mesa: Fix
ctx->Texture.CubeMapSeamless") for the full context.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Alyssa Rosenzweig dc87d83a29 asahi: Set flatshading controls appropriately
Fixes dEQP-GLES3.functional.rasterization.flatshading.*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Alyssa Rosenzweig 623a2bf488 asahi: Identify XML for more flatshading controls
Names from PowerVR <3

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Asahi Lina 3091f5a7f4 asahi: Enable VS_INSTANCEID and VERTEX_ELEMENT_INSTANCE_DIVISOR caps
These two should be functional at this point. The latter is required
(and quite well tested) by Darwinia.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Alyssa Rosenzweig 8ba44b6492 asahi: Implement depth and stencil export
For gl_FragDepth, passes dEQP-GLES3.functional.shaders.fragdepth.* and piglit
fragdepth_gles2.

For stencil export, passes piglit glsl-fs-shader-stencil-export.

For gl_FragDepth together with stencil export, passes
dEQP-GLES3.functional.fbo.blit.*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Alyssa Rosenzweig 9578b47af3 agx: Implement depth and stencil export
Lower FRAG_RESULT_DEPTH and FRAG_RESULT_STENCIL writes to a combnied zs_emit
instruction with a multisampling index. To be used in the following commit.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Alyssa Rosenzweig 15155268de asahi: Allow texturing S8 portion of combined Z/S
Comes up in gles3.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Asahi Lina 9fc2c0f341 asahi: Put meta shader keys into the meta shader itself
The hash table needs a key pointer with at least the lifetime of the
hash entry, which the key pointer we get does not have (since it is
stack-allocated by agx_build_meta). Copy it into the shader struct
itself and use that for the hash table.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Asahi Lina c12153cd89 asahi: Identify & disable triangle merging for shaders using derivatives
It seems triangle merging is incompatible with calculating derivatives
along primitive edges correctly. Take the appropriate NIR shader info
flags in the compiler and pass them down as a flag to the driver, so it
can set the disable triangle merging flag (formerly called "lines or
points").

TODO: Is this what macOS does when you set a sample mask there (which
apparently fixes the same bug on the Darwinia Metal backend)? Do we
also need to set this when sample masks are used?

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fixes Darwinia and dEQP2 projected tests.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Asahi Lina 005f556065 asahi: Fix include guard comment on decode.h
Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Asahi Lina b80fb31678 asahi: Allocate enough push ranges for the worst possible case
We need one for every possible sysval, plus up to 16 VBOs.

Fixes plasma-systemmonitor.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Asahi Lina 440601dead asahi: Fix off-by-one assert in agx_create_vertex_elements
Needed to fix plasma-systemmonitor.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Asahi Lina d4270531c4 asahi: Consider shared resources always valid
Shared resources are in an unknown state, so we have to assume they
may contain valid data.

Fixes Xorg+Kwin random full-screen garbage on mouse cursor present.

However, we still get black flashing in some circumstances (that was
garbage flashing before this commit), which indicates that something
is reading an uninitialized/fresh shared framebuffer and expecting
valid data (prior screen contents?) TBD.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00
Asahi Lina 0042f2beb2 asahi: Ensure we always have space for stream links + padding
It seems VDM can overread (maybe it does blockwise transfers?), so we
always need to leave space at the end of encoder buffers to avoid
faults.

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20365>
2022-12-17 18:10:28 +00:00