Commit Graph

107 Commits

Author SHA1 Message Date
Mike Blumenkrantz 49cc3696bd zink: track ssbo bind counts
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17192>
2022-06-24 01:56:27 +00:00
Mike Blumenkrantz 32c34e93aa zink: add flag to indicate if a resource is a dmabuf
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15810>
2022-06-22 20:42:02 +00:00
Mike Blumenkrantz 80569f9e5f zink: track image binds
track all the things

Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-By: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17111>
2022-06-20 00:50:48 +00:00
Mike Blumenkrantz db0fda6f36 zink: track vertex buffer bind counts on resources
Acked-by: Dave Airlie <airlied@redhat.com>
Reviewed-By: Tatsuyuki Ishi <ishitatsuyuki@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17111>
2022-06-20 00:50:48 +00:00
Mike Blumenkrantz 3e2c65281d zink: track invalidation for image resources
an image only has valid data if:
* it's imported
* it's written to
* it's mapped for write

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16877>
2022-06-06 00:36:20 +00:00
Mike Blumenkrantz b17aa29793 zink: handle aux plane imports
basically do nothing here and it magically works

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16822>
2022-06-04 01:05:43 +00:00
Mike Blumenkrantz 08116638fd zink: represent plane offsets using offset from plane 0 vs size of plane
this is a bit easier to keep track of

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16822>
2022-06-04 01:05:43 +00:00
Mike Blumenkrantz 5513597305 zink: add a bind flag to indicate a resource is exported as a dmabuf
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 1c20688dcc zink: add a flag to indicate whether a resource is exportable
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 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 c025cb9ee9 zink: fix dmabuf plane returns
use the actual drm format plane count, not the resource format

cc: mesa-stable

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
Mike Blumenkrantz 4af98df955 zink: flag swapchain resources as swapchains
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16038>
2022-04-27 21:50:16 +00:00
Mike Blumenkrantz b86c814347 zink: add a util function for finding swapchain resource
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16038>
2022-04-27 21:50:16 +00:00
Mike Blumenkrantz 64d5f71bbc zink: move the kopper present fence to the displaytarget object
this is otherwise broken when front/back buffers share the same dt

Fixes: 8ade5588e3 ("zink: add kopper api")

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16070>
2022-04-21 19:25:51 +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 be5311972f zink: remove tmp buffer rebinds
this is no longer used/necessary

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14689>
2022-01-28 14:40:31 +00:00
Mike Blumenkrantz 94afa1632f zink: always create a separate VkBuffer for storage use
bufferview objects must be created with or without the storage bit as
the driver permits, so create two buffer objects that can be used as needed

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14689>
2022-01-28 14:40:31 +00:00
Mike Blumenkrantz 129e31cd4f zink: hook up planar image format creation
it'll explode if used for anything, but this is how it's done

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13865>
2022-01-21 01:02:18 +00:00
Mike Blumenkrantz d320e8328d zink: set up image create bits for sparse textures
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 b1a32d1432 zink: implement multiplanar modifier handling
it turns out this is trivial as long as dri gives usable resource templates

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13799>
2021-11-17 19:22:02 +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 f16961f222 zink: add notes about binding points which aren't counted in util funcs
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13490>
2021-10-26 15:07:22 +00:00
Mike Blumenkrantz f00ad70bfb zink: remove reads/writes members from zink_resource_object
these haven't been used in a while

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13259>
2021-10-08 03:33:03 +00:00
Mike Blumenkrantz bc202553e9 zink: implement bindless textures
this works by tracking 1024-member arrays of images and textures using idalloc
for indexing. each idalloc id is an index into the array that is returned as a handle,
and this handle is used to index into the array in shaders.

in the driver, VK_EXT_descriptor_indexing features are used to enable updates on the live
bindless descriptor set and leave unused members of the arrays unbound, which works as
long as no member is updated while it is in use. to avoid this, idalloc ids must cycle through
a batch once the image/texture handle is destroyed before being returned to the available pool

in shaders, bindless ops come in one of two types:
- i/o variables
- bindless instructions

for i/o, the image/texture variables have to be rewritten back to the integer
handles which represent them so that the successive shader stage utilizing them
can perform the indexing

for instructions, the src representing the image/texture has to be rewritten as a deref
into the bindless image/texture array

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12855>
2021-09-27 01:40:54 +00:00
Mike Blumenkrantz 9dbf1ba21d zink: add ZINK_BIND_TRANSIENT
this is used to create lazily allocated images for use as transient
renderpass attachments

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12934>
2021-09-24 21:00:21 +00: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 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 cb65ac9bdf zink: add return values for resource usage unsetting
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 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 3db5c1bfc5 zink: remove bind_stages and bind_history from zink_resource
these are no longer used

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 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 107866cf7a zink: add inline for checking whether a resource has any binds
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 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 95a67ede54 zink: add bind counts for so bindings
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 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 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 2857267b88 zink: repack zink_resource_object struct
this makes better use of cachelines and eliminates holes

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 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 d5dd1259c5 zink: change vbo_bind_count to a mask of slots
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
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
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
Mike Blumenkrantz 9603f3bd01 zink: make image_bind_count work for buffers
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11747>
2021-07-06 20:40:32 -04:00
Mike Blumenkrantz de903ae0c7 zink: make samplerview bind mask apply to buffer resources too
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11747>
2021-07-06 20:39:38 -04:00
Mike Blumenkrantz d48367fbad zink: add a per-stage bind mask for ssbos
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11747>
2021-07-06 20:39:33 -04:00
Mike Blumenkrantz 4a194b7bbf zink: add a per-stage mask for ubo binds
optimizing buffer replacement was never so difficult

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11747>
2021-07-06 20:39:30 -04: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