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
Mike Blumenkrantz
b88055f379
zink: add a pipe_screen::resource_create_with_modifiers hook
...
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10782 >
2021-07-13 00:21:52 +00:00
Mike Blumenkrantz
452ffddbff
zink: add fallback for linear modifier use
...
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10782 >
2021-07-13 00:21:52 +00:00
Mike Blumenkrantz
02593a05e2
zink: don't pass modifier count to first image create
...
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10782 >
2021-07-13 00:21:52 +00:00
Mike Blumenkrantz
943ab741e2
zink: explicitly disallow using the modifier image create for non-linear images
...
the first call is just for the base image, the second call is the one that needs
modifiers
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10782 >
2021-07-13 00:21:52 +00:00
Mike Blumenkrantz
b6990f7359
zink: use VkImageDrmFormatModifierListCreateInfoEXT for creating from modifier array
...
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10782 >
2021-07-13 00:21:52 +00:00
Mike Blumenkrantz
9b40fc4892
zink: add a pipe_screen::resource_get_param hook
...
this is used for querying image properties
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10782 >
2021-07-13 00:21:52 +00:00
Mike Blumenkrantz
6e927d1152
zink: store modifier aspect to resource
...
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10782 >
2021-07-13 00:21:52 +00:00
Mike Blumenkrantz
f1f13a110a
zink: start storing modifiers to the base resource struct
...
need these for rebinds
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10782 >
2021-07-13 00:21:51 +00:00
Erik Faye-Lund
8eb91e372b
zink: implement support for non-planar DRM modifiers
...
Planar DRM modifiers are a bit more tricky, so let's kick that ball down
the road. For now, this should help a bit.
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10782 >
2021-07-13 00:21:51 +00:00
Mike Blumenkrantz
c6d677ce3d
zink: ensure sparse allocations aren't marked host-visible
...
Fixes: 5fee58bf59 ("zink: collapse host_visible and non-coherent alignment alloc cases")
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11768 >
2021-07-08 13:26:41 +00:00
Mike Blumenkrantz
c4c279bd7a
zink: remove unnecessary stall during device-local map case
...
this stalls after the copy already, no need to also stall before it
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11749 >
2021-07-07 01:55:45 +00:00
Mike Blumenkrantz
b9ada09ca3
zink: move resource object ref to batch in init_storage_object
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11692 >
2021-07-07 00:22:09 +00:00
Mike Blumenkrantz
08b3847215
zink: move resource object ref to batch in invalidate hook
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11692 >
2021-07-07 00:22:09 +00:00
Mike Blumenkrantz
347163aec2
zink: stop screwing up buffer offsets during for maps
...
stop using the memory bind offset
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11687 >
2021-07-02 03:29:04 +00:00
Mike Blumenkrantz
46695dd938
zink: don't add mem allocation offset when copying buf2image
...
this doesn't apply to any image/buffer operations, it's solely for memory
allocation/binding/mapping
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11687 >
2021-07-02 03:29:04 +00:00
Mike Blumenkrantz
b416b68ef3
zink: use vkresult helper for map return
...
consistency++
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11689 >
2021-07-02 03:10:12 +00:00
Mike Blumenkrantz
936c21d376
zink: attempt to handle some resource unmap cases in 32bit envs
...
address space is limited here, so in some cases it's worthwhile to
unmap resources
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11594 >
2021-06-30 13:07:57 +00:00
Mike Blumenkrantz
9d599ed417
zink: cache visible vram
...
yolo
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11594 >
2021-06-30 13:07:57 +00:00
Mike Blumenkrantz
d4a7b4fef8
zink: uncap mem caching
...
if it fits, it sits
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11594 >
2021-06-30 13:07:57 +00:00
Mike Blumenkrantz
778f325c67
zink: make mem cache limits dynamically scalable
...
this removes the hardcoded count of 5 mem blocks to cache and replaces
it with a value that's based on the number of allocations seen
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11594 >
2021-06-30 13:07:57 +00:00
Mike Blumenkrantz
252afe405f
zink: don't align device-local buffer memory
...
this can't be mapped
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11594 >
2021-06-30 13:07:57 +00:00
Mike Blumenkrantz
93e8494007
zink: try for better buffer allocation heaps
...
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11594 >
2021-06-30 13:07:57 +00:00
Mike Blumenkrantz
d4159963e3
zink: enforce multi-context waiting for unflushed resources on foreign batches
...
this doesn't seem to be a real issue now that tc doesn't break makeCurrent
anymore, but if such a thing were to once again become a problem, at least
there will be handling for it
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11437 >
2021-06-22 20:57:33 +00:00
Mike Blumenkrantz
ef418cfc59
zink: make init_mem_range() a public function
...
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11437 >
2021-06-22 20:57:33 +00:00
Mike Blumenkrantz
18c22f5024
zink: break out offset alignment calculation into helper
...
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11437 >
2021-06-22 20:57:33 +00:00
Mike Blumenkrantz
d574b0a51e
zink: apply zink_resource_object::offset for memory flush/invalidates
...
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11437 >
2021-06-22 20:57:33 +00:00
Mike Blumenkrantz
d80d9e1c93
zink: queue v3.0
...
this uses a pointer to a batch state substruct for timeline tracking,
which provides a few nice benefits:
* explicit ability to detect unflushed batches (even on other contexts)
* the context doesn't need to have a "current" timeline id
* timeline (batch) ids can be distributed during submit, not when recording begins
* an abstracted api which can be more easily changed under the hood
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11437 >
2021-06-22 20:57:33 +00:00
Mike Blumenkrantz
28496f6ff2
zink: remove no-longer-used resource helper functions
...
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11437 >
2021-06-22 20:57:33 +00:00
Mike Blumenkrantz
59ec1794f6
zink: use batch usage api for resource helper function
...
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11437 >
2021-06-22 20:57:33 +00:00
Mike Blumenkrantz
1226628eb6
zink: add and use fencing functions which take batch usage structs
...
this hides the exact mechanics of fencing based on batch usage and makes
the usage a bit more explicit
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11437 >
2021-06-22 20:57:33 +00:00
Mike Blumenkrantz
3c2f343618
zink: check actual mem props to determine if resource object is coherent
...
this was correct for what it has been used for until now, but it will no
longer be correct going forward
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397 >
2021-06-17 01:07:35 +00:00
Mike Blumenkrantz
b1b6aecf9d
zink: key alloc cache on heap index, not heap flags
...
this is a bit more sane
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397 >
2021-06-17 01:07:35 +00:00
Mike Blumenkrantz
c56a100494
zink: avoid caching visible vram allocations
...
the visible vram heap is potentially going to be limited in size, so avoid
caching these allocations since that locks them to a given allocation size
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397 >
2021-06-17 01:07:35 +00:00
Mike Blumenkrantz
18b71c0da3
zink: change a bunch of sparse buffer resource checks to host-visible checks
...
(sparse buffer) is a subset of !host-visible, and !host-visible is actually the
more correct check to be using
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397 >
2021-06-17 01:07:35 +00:00
Mike Blumenkrantz
5fee58bf59
zink: collapse host_visible and non-coherent alignment alloc cases
...
* buffers can use normal mem prop checking to determine host_visible setting
* sparse buffers are never coherent, so this case can be dropped from the conditional
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11397 >
2021-06-17 01:07:35 +00:00
Erik Faye-Lund
a8fc38b276
zink: do not check buffer-format for usage-bits
...
Buffers are created without a format in Vulkan, and we always pass in
R8_UNORM for them in Gallium. It's the view-formats we should have
checked, if anything.
But that's orthogonal to this. We shoudn't keep checking R8_UNORM
capabilities for buffers, all it's going to do is trigger asserts.
Fixes: 00dc0036b ("zink: flatten out buffer creation usage flags codepath")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11416 >
2021-06-16 15:36:59 +00:00
Erik Faye-Lund
662dc70002
zink: drop repeated usage-bit
...
We already set this bit unconditionally right before, no point in
repeating it.
Fixes: 00dc0036b ("zink: flatten out buffer creation usage flags codepath")
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11416 >
2021-06-16 15:36:59 +00:00
Mike Blumenkrantz
0cfcc0602b
zink: set subdata hook as PIPE_MAP_ONCE
...
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11401 >
2021-06-16 14:45:01 +00:00
Mike Blumenkrantz
1108db982e
zink: make batch_usage_matches take a batch state param
...
no functional changes, just some unwinding in some cases
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11399 >
2021-06-16 02:45:45 +00:00
Hoe Hao Cheng
65c8ae6bbd
zink: zero-init structs with ISO C
...
zero-initing with empty braces is a GNU extension, MSVC does not like
it.
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11376 >
2021-06-15 12:33:03 +00:00