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
ecf5d706ef
zink: move barrier info to resource object struct
...
this is a bit more accurate
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12845 >
2021-09-14 04:19:13 +00:00
Mike Blumenkrantz
9ec9289385
zink: add dmabuf fd handling
...
just gotta get it out of the underlying graphics layer
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11967 >
2021-09-14 03:14:12 +00:00
Mike Blumenkrantz
7d2de96847
zink: fix import pNext attachment during image creation
...
there's better checks for this now, so the weird pNext handling here
can be simplified
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11967 >
2021-09-14 03:14:12 +00:00
Mike Blumenkrantz
5b827b0a39
zink: handle image creation for dmabufs
...
these use PREINIT layout
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11967 >
2021-09-14 03:14:12 +00:00
Mike Blumenkrantz
2a63f38cb1
zink: set a flag for dmabuf init
...
this will be useful for barrier handling
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11967 >
2021-09-14 03:14:12 +00:00
Mike Blumenkrantz
3bd98d4bf6
zink: split import and export fd handle types
...
these can maybe be different
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11967 >
2021-09-14 03:14:12 +00:00
Mike Blumenkrantz
18866dc733
zink: remove ZINK_RESOURCE_USAGE_STREAMOUT
...
we can use a bool flag for this instead to be more sensible
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12822 >
2021-09-13 03:40:54 +00:00
Mike Blumenkrantz
b483faccb6
zink: remove batch params from barrier functions
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12770 >
2021-09-13 00:53:02 +00:00
Mike Blumenkrantz
ec2cce6d60
zink: remove batch params from resource copy functions
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12770 >
2021-09-13 00:53:02 +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
cf8997ab58
zink: store some image creation metadata to object struct
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12661 >
2021-09-02 15:53:16 +00:00
Mike Blumenkrantz
0b2b2a4783
zink: remove ZINK_HEAP_HOST_VISIBLE_ANY
...
this was just the coherent heap but splitting the slabs more to make
suballocating worse
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12659 >
2021-09-01 04:24:03 +00:00
Mike Blumenkrantz
e53e5165b1
zink: create inner scanout object without scanout binds
...
this restores mutable formats to the inner object to work with scanout
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12629 >
2021-09-01 03:07:55 +00:00
Mike Blumenkrantz
052f85ea1b
zink: flag color attachment images as input attachments at creation
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12603 >
2021-08-31 19:45:29 +00:00
Mike Blumenkrantz
849033e6d8
zink: implement PIPE_RESOURCE_FLAG_DONT_MAP_DIRECTLY when resizable bar not present
...
this helps in some cases to avoid allocating and mapping large staging resources
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
Erik Faye-Lund
e3239dff05
zink: avoid overflow when calculating size
...
If we multiply before we (implicitly) cast the result to the target
type, we needlessly risk overflowing the result.
CID: 1490790, 1475922
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559 >
2021-08-27 18:32:03 +00:00
Erik Faye-Lund
c96afa9fc8
zink: initialize pQueueFamilyIndices
...
This silences a Coverity warning about an uninitialized variable.
CID: 1490800
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12559 >
2021-08-27 18:32:03 +00:00
Mike Blumenkrantz
bdbcf256a1
zink: return early when getting resource modifer if no modifier is used
...
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12534 >
2021-08-25 21:14:11 +00:00
Mike Blumenkrantz
403acd299f
zink: handle map failures more effectively
...
the transfer object needs to be destroyed
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422 >
2021-08-17 17:00:32 -04:00
Mike Blumenkrantz
afa867b973
zink: break out transfer map destroy
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422 >
2021-08-17 17:00:32 -04:00
Mike Blumenkrantz
97545a0a1f
zink: remove unused variable from image map
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422 >
2021-08-17 17:00:32 -04:00
Mike Blumenkrantz
c5a6ebc605
zink: split buffer and image map functions
...
this is a bit nicer to read
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422 >
2021-08-17 17:00:32 -04:00
Mike Blumenkrantz
b19bff17f4
zink: split out zink_transfer allocation
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12422 >
2021-08-17 17:00:32 -04:00
Mike Blumenkrantz
9e6916fb00
zink: remove duplicated zink_resource_object::mem member
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12421 >
2021-08-17 20:43:18 +00:00
Mike Blumenkrantz
67239cf754
zink: collapse 'dedicated' allocation into zink_bo
...
this simplifies all the map and memory management code
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12421 >
2021-08-17 20:43:18 +00:00
Mike Blumenkrantz
97d04c2bc5
zink: rejigger PIPE_MAP_ONCE for internal qbo reads
...
DONTBLOCK is only used internally for this case, and promoting it over
the staging buffer case ensures that it's always reached when it should be
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410 >
2021-08-17 19:40:27 +00:00
Mike Blumenkrantz
7d39ef49bd
zink: remove PIPE_MAP_ONCE from subdata
...
subdata calls that happen once for a buffer are likely to happen again,
so just leave them mapped
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410 >
2021-08-17 19:40:27 +00:00
Mike Blumenkrantz
daff597940
zink: make map_count useful for dedicated image allocations
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410 >
2021-08-17 19:40:27 +00:00
Mike Blumenkrantz
89e2591e8d
zink: split mem unmap logic for images and buffers
...
buffers should only be unmapped if they're explicitly marked for unmap,
but images should only be unmapped when running in 32bit, in which case
they need to always be unmapped
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410 >
2021-08-17 19:40:27 +00:00
Mike Blumenkrantz
6001ebc1b6
zink: split transfer_unmap for images and buffers
...
these should be separate
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410 >
2021-08-17 19:40:27 +00:00
Mike Blumenkrantz
5fedce7bfb
zink: stop zeroing structs during resource allocation
...
some of these show up in profiling
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12410 >
2021-08-17 19:40:27 +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
461662bf3c
zink: simplify some dumb code in invalidate_buffer (v2)
...
the ref has to be preserved so that rebind doesn't destroy it prematurely
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12118 >
2021-07-28 23:56:06 +00:00
Mike Blumenkrantz
2668489cf9
Revert "zink: simplify some dumb code in invalidate_buffer"
...
This reverts commit 6bda555cc0 .
this needs to stay dumb in order to preserve the ref on the resource
without destroying it during rebind
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12118 >
2021-07-28 23:56:06 +00:00
Mike Blumenkrantz
5ff0f4a901
zink: never use staging buffer for unsynchronized buffer maps
...
this is ultra broken, do not attempt
Fixes: 6bfbce0447 ("zink: rework buffer mapping")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12111 >
2021-07-28 21:15:26 +00:00
Mike Blumenkrantz
6bfbce0447
zink: rework buffer mapping
...
this collects a bunch of changes which need to be made but which can't
be split up incrementally without breaking things:
* move map offset to zink_transfer::offset for consistent handling
* fix stream uploader map rules to only apply for discard cases so
the stream uploader doesn't explode
* fix the staging buffer map rules to apply to any non-staging readback
* stop making huge staging buffers for readback
* break out the DONTBLOCK case since this is only coming from qbo readback
* add explicit read-only sync for maps to stall on writes
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12090 >
2021-07-28 00:42:56 +00:00
Mike Blumenkrantz
7665e656c1
zink: remove no longer used internal resource function
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12008 >
2021-07-26 19:52:49 -04:00
Mike Blumenkrantz
3137795e38
zink: replace some direct batch_usage calls with resource abstractions
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12008 >
2021-07-26 19:52:47 -04:00
Mike Blumenkrantz
6bda555cc0
zink: simplify some dumb code in invalidate_buffer
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12008 >
2021-07-26 19:51:53 -04:00
Mike Blumenkrantz
79ccc17da5
zink: use resource batch usage helpers in invalidate_buffer()
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12008 >
2021-07-26 19:48:07 -04:00
Mike Blumenkrantz
13d732ec5b
zink: add some resource util functions for batch usage
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12008 >
2021-07-26 19:48:07 -04: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
Mike Blumenkrantz
7aca74e219
zink: inline mem cache hash table
...
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
Mike Blumenkrantz
fdfa155f2b
zink: move mem cache to sub-struct
...
no functional changes
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
Mike Blumenkrantz
ba3c4ce385
zink: add mechanism for generating VkBuffers for rebinding
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11836 >
2021-07-22 00:04:58 +00:00
Michel Zou
4c36224f95
zink: Fix unused-variable warning
...
Fixes: 9b40fc48
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11920 >
2021-07-20 18:44:39 +00:00
Bas Nieuwenhuizen
785b4728cf
zink: set dedicated allocation when needed
...
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11958 >
2021-07-19 23:34:21 +00:00
Mike Blumenkrantz
e9516a4edd
zink: check for dedicated allocation requirements during image alloc
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11958 >
2021-07-19 23:34:21 +00:00
Mike Blumenkrantz
d29c086fb9
zink: simplify modifier ifdefs
...
these are the only two defines referenced, so they can be defined to 0
for platforms that don't support modifiers in order to remove a ton of
ifdefs and make the code more readable
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11847 >
2021-07-13 14:59:18 +00:00