Commit Graph

147 Commits

Author SHA1 Message Date
Mike Blumenkrantz 6493f6ef79 zink: add an explicit ZINK_DESCRIPTOR_MODE_CACHED
no functional changes, but now AUTO is no longer a mode that gets used

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17636>
2022-07-20 04:24:19 +00:00
Mike Blumenkrantz 9172127057 zink: delete ZINK_DESCRIPTOR_MODE_NOFALLBACK
this was useful for testing but is going to be less useful soon

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17636>
2022-07-20 04:24:19 +00:00
Mike Blumenkrantz 1c2bd27d81 zink: move descriptor_mode to be a global
this can't change once it's been set, so having it per-object is pointless

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17636>
2022-07-20 04:24:19 +00:00
Mike Blumenkrantz d63e04e583 zink: store and reuse memory heap flags for buffer placement
the flags in vk_domain_from_heap() are the MINIMUM required flags for
the heap, but there may be other flags present, so ensure those are picked
up as expected

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17093>
2022-06-17 01:14:45 +00:00
Mike Blumenkrantz 0f9bc1ebe3 zink: detect sparse-only binding queue
still prefer binding on the gfx queue when available, but store a separate
sparse binding queue if necessary

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17066>
2022-06-16 02:01:53 +00:00
Mike Blumenkrantz f5ac058812 zink: remove thread_queue
I had originally intended to hook this up properly with synchronization et al,
but I didn't do it, and now it's seeming less smart anyway, so let's
remove the footgun

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17066>
2022-06-16 02:01:53 +00:00
Mike Blumenkrantz d301883aba zink: use uint64_t for batch_id
this maps directly to the vulkan api and allows removal of timeline
wrapping code

the consequence of this is a ~0.26% reduction in drawoverhead performance
on base cases (n=1000), but the simplification and deletions seem worth it

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17045>
2022-06-16 00:30:45 +00:00
Mike Blumenkrantz ea9e30f9d2 zink: add implicit sync workaround for non-mesa drivers
implicit sync is hard, and many drivers get it wrong, so assume that
anyone who isn't mesa might need some hand-holding

cc: mesa-stable

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17009>
2022-06-13 15:20:21 -04:00
Mike Blumenkrantz b0fe621459 zink: add back kms handling
removing this broke the ability to create system compositors

rework it a bit though so that kms handles are stored and destroyed
when the bo is freed

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16815>
2022-06-04 01:27:53 +00:00
Mike Blumenkrantz b4ef984ef3 Revert "zink: remove drm_fd"
This reverts commit c5960f64b1.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16815>
2022-06-04 01:27:53 +00:00
Mike Blumenkrantz 8636717270 zink: add a "compact" descriptor mode
this compacts the ubo+ssbo and samplerview+image sets, enabling zink
to run fully featured with only 4 descriptor sets used

fixes #4964

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16645>
2022-05-25 04:01:56 +00:00
Mike Blumenkrantz f7eb871efa zink: add screen-based indexing to descriptor sets
this allows indirection for internal descriptor type -> vk descriptor set
and enables more easily altering the descriptor set index at runtime

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16645>
2022-05-25 04:01:56 +00:00
Mike Blumenkrantz 3d145ec7f1 zink: use global image rebind counter for dmabuf export
this is a bit less flimsy and handles more than just framebuffer rebinds

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16476>
2022-05-20 16:42:21 +00:00
Mike Blumenkrantz b54516f944 zink: add ZINK_DEBUG=sync
this is great for debugging

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16544>
2022-05-18 02:47:52 +00:00
Mike Blumenkrantz 5d5b6197e3 zink: add c++ guards for zink_screen.h
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16544>
2022-05-18 02:47:52 +00:00
Erik Faye-Lund 693c723211 zink: use run-time linking to loader
This makes Zink no longer have the vulkan-loader in the import-table,
which can prevent opengl32.dll on Windows from loading on systems
without the loader installed.

Acked-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11550>
2022-05-13 16:23:41 +00:00
Erik Faye-Lund 9e9ead2c15 zink: pass screen to extension getter macro
This is just prep-work to reduce the size of the final commit; this
allows us to store the extension-getter function in the screen object.

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11550>
2022-05-13 16:23:41 +00:00
Mike Blumenkrantz b978761385 zink: create a copy context for the screen on init
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16252>
2022-05-11 01:30:38 +00:00
Mike Blumenkrantz 94d400d5af zink: introduce copy contexts
this is for creating a context which is only used for copying images

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16252>
2022-05-11 01:30:38 +00:00
Mike Blumenkrantz d474229ed1 zink: remove unused headers/struct members/linkage
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16252>
2022-05-11 01:30:37 +00:00
Mike Blumenkrantz c0c69b1be1 zink: semi-handle 1D sparse texture rewrites for drivers that don't support them
nvidia can't do this, but also nothing uses it, so I've gone ahead and
done the bare minimum here to make cts pass

I think the work to do the shader rewrites should be easy, but without a test
case, I see no point in spending the time for it

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16100>
2022-05-10 05:44:56 +00:00
Mike Blumenkrantz c5960f64b1 zink: remove drm_fd
no longer used

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16226>
2022-04-29 00:33:26 +00:00
Yonggang Luo ebb099a9b0 zink: Remove redundant framebuffer_mtx from zink_screen.h
Fixes: beb71504f4 ("zink: remove the worst part of basic framebuffer support")

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16025>
2022-04-19 15:02:33 +00:00
Mike Blumenkrantz b0cbe3d419 zink: remove driver-based max_fences throttling
there are no more fence objects, so there's no need to do driver-specific
clamping on them

the mechanism remains intact to handle ETOOMANYSUBMITS

Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15904>
2022-04-18 23:45:30 +00:00
Mike Blumenkrantz bc2e29accd zink: require timeline semaphores
this allows the removal of tons of awful code

Acked-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15904>
2022-04-18 23:45:30 +00:00
Mike Blumenkrantz 7f56fd9655 zink: it's kopperin' time
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14541>
2022-04-07 00:17:40 +00:00
Mike Blumenkrantz da80beafb2 zink: fix warning text in missing feature macro
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15778>
2022-04-06 22:52:12 +00:00
Mike Blumenkrantz a489b1d936 zink: add a param to warn_missing_feature() macro
this lets the macro be used more programmatically since the variable
is defined externally

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15778>
2022-04-06 22:52:12 +00:00
Mike Blumenkrantz b6f99cf378 zink: switch warn_missing_feature to mesa_logw
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15778>
2022-04-06 22:52:12 +00:00
Mike Blumenkrantz 206d2f3127 zink: add driver workaround for broken EXT_depth_clip_control
for #6186

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15513>
2022-03-30 03:36:33 +00:00
Mike Blumenkrantz 49a20e0981 zink: start a unified driver workarounds struct
eventually anything that checks driverID should be moved here for ease of
reference/updating

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15392>
2022-03-21 22:58:11 -04:00
Mike Blumenkrantz b62b916945 zink: print an error when the device is lost
how many hours were lost to this

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14693>
2022-01-31 04:03:26 +00:00
Mike Blumenkrantz 8bca29dcf0 zink: return 256 for PIPE_CAP_MIN_MAP_BUFFER_ALIGNMENT
this isn't the minimum allowed by the driver, but zink doesn't return
the minimum allowed by the driver anyway and hasn't in a very long time

instead, it suballocates using a minimum alignment of 256 bytes, so use
that instead

fixes (in caselists):
KHR-GL46.map_buffer_alignment.functional

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14720>
2022-01-26 22:05:53 +00:00
Mike Blumenkrantz 2e57c2c029 zink: add get_sparse_texture_virtual_page_size hook
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14381>
2022-01-20 15:51:30 +00:00
Mike Blumenkrantz 35ffadb9e7 zink: clamp to 500 max batch states on nvidia
I've been advised that leaving this unclamped will use up all the fds
allotted to a process

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13844>
2021-11-18 00:00:16 +00:00
Mike Blumenkrantz 86eb1549ef zink: implement pipe_context::draw_vertex_state
rough implementation, but it should be a decent start

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13692>
2021-11-17 03:16:13 +00:00
Mike Blumenkrantz 2ac23b4d58 zink: always inline uniforms when running on a cpu driver
the overhead from creating new inlined shader variants is likely to be less than
the time required to fully optimize and run those variants, so just
inline 100% of the time to cut down shader runs

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13727>
2021-11-10 01:15:39 +00:00
Mike Blumenkrantz 64e0ca15d6 zink: add 1DShadow sampler handling for drivers (radv) that don't support it
some drivers won't create zs textures in any shape but 2D. this can be
handled instead by using 2D textures and then performing shader rewrites to
convert shadow samplers for 1D and 1DArray types to 2D/array

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13583>
2021-11-09 23:59:04 +00:00
Mike Blumenkrantz 3137ff4709 zink: add queue locking
sparse binds have to be processed synchronously with cmdbuf recording to
avoid resource object desync in the vk driver, which means they have to be
done in the driver thread instead of the flush thread. this necessitates
adding locking for the queue since there is now a case when submissions occur
in a different thread

fixes illegal multithread usage in KHR-GL46.CommonBugs.CommonBug_SparseBuffersWithCopyOps

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13597>
2021-11-03 20:34:25 +00:00
Mike Blumenkrantz 6d93729881 zink: fix descriptor interface param for program_deinit
this should match the _init() method and take the context

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13430>
2021-10-19 18:07:00 +00:00
Mike Blumenkrantz b0318216fa zink: store drm fd to screen
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12857>
2021-09-16 12:36:19 -04:00
Mike Blumenkrantz 01f00eb90d zink: move surface and bufferview caches onto resources
this makes the locking smaller in scope and also make the lookups faster
due to having smaller populations in the hash tables

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12843>
2021-09-14 05:47:47 +00:00
Mike Blumenkrantz 7c1b7ded7a zink: add "nofallback" descriptor mode
this disables lazy fallback and forces caching always

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12783>
2021-09-12 23:58:48 +00:00
Mike Blumenkrantz ad584ed34e zink: use dispatch table for (almost) all vulkan calls
try to avoid hitting the loader when possible

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12757>
2021-09-08 04:31:24 +00:00
Mike Blumenkrantz 25fe797104 zink: move alphaToOne warning to a dynamic warning
stop spamming these if they aren't even being used

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12647>
2021-08-31 19:32:26 +00:00
Mike Blumenkrantz 9a8960de53 zink: determine whether the gpu has a resizable BAR at startup
this can be used to make different allocation and mapping decisions

Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12579>
2021-08-30 13:46:04 +00:00
Mike Blumenkrantz 8d9891088f zink: rebind all buffers on replacement
in theory it's possible to trigger cases where rebinds aren't based on the
current context, so ensure that (very unlikely) case is handled

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12425>
2021-08-24 14:17:50 +00:00
Mike Blumenkrantz 40fdb3212c zink: add a suballocator
this is an aux/pipebuffer implementation borrowing heavily from the
one in radeonsi. it currently has the following limitations, which
will be resolved in a followup series:
* 32bit address space still explodes
* swapchain images still have separate memory handling

performance in games like Tomb Raider has been observed to increase by
over 1000%

SQUASHED: simplify get_memory_type_index()

now that the heaps are enumerated, this can be reduced to a simple
array index with a fallback

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12146>
2021-08-17 13:21:28 +00:00
Mike Blumenkrantz 4bd6a0299b zink: change descriptor flushing to assert
there should never be flushing due to pool depletion; instead, trigger an
oom flush and stall to replenish the pool after the draw/compute

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12012>
2021-07-27 22:34:21 +00:00
Mike Blumenkrantz 2736bf4e17 zink: split mem cache per type
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11966>
2021-07-22 00:32:50 +00:00