Commit Graph

23 Commits

Author SHA1 Message Date
Mike Blumenkrantz f6c6320a5f zink: break out batch id finding for resource usage into util function
this is generally helpful for figuring out the last batch a resource was
used for

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9544>
2021-03-15 22:08:06 -04:00
Mike Blumenkrantz 980a8b3fc0 zink: implement an extremely dumb resource memory cache
this stores a number (currently 5) of backing allocations for resources
for later reuse when creating matching resources

because this is on the screen object it requires locking, but this is still
far faster than allocating new memory each time

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9540>
2021-03-12 17:21:40 +00:00
Mike Blumenkrantz 3d4e6c641b zink: break out descriptor stuff into new files
this is getting to be enough code that it's getting to be a hassle to
keep with the program stuff

also rename a couple of the moved functions

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9348>
2021-03-12 16:32:53 +00:00
Mike Blumenkrantz 3f561bbc83 zink: improve descriptor cache invalidation
we can pass the offset of the 'invalid' flag directly to the resources
to let them run through and invalidate their sets in time for us to detect
it when we recycle the set during batch reset and throw it onto our allocation array

additionally, by adding refs for the actual objects used in a descriptor set, we can
ensure that our cache is as accurate as possible

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9348>
2021-03-12 16:32:53 +00:00
Mike Blumenkrantz 6c4c995836 zink: add caching for descriptor sets
this is a lot of churn that more or less amounts to hashing the descriptor
state during draw and then performing lookups with this to determine whether
we can reuse an existing descriptor set instead of allocating one

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9348>
2021-03-12 16:32:52 +00:00
Mike Blumenkrantz 211437c938 zink: simplify barrier usage
this simplifies the barrier helper callsites as we no longer need
to check whether a barrier is needed beforehand in order to avoid potentially
ending a renderpass too early

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9205>
2021-02-23 01:44:34 +00:00
Mike Blumenkrantz ab3a2fa690 zink: add access param for image resource barriers
we need more detail on some of these to ensure proper synchronization
and availability/visibility of image data between commands/stages

the signature for needs_barrier() is still funky here to avoid breaking
usage in update_descriptors()

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8945>
2021-02-19 02:05:13 +00:00
Mike Blumenkrantz 73e84c33a2 zink: rework xfb barrier transitions when reusing as vertex inputs
if we have proper barrier usage to start with, then we don't need to do
any kind of weird flushing upon changing vertex inputs and can also remove
a flag from zink_resource

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8945>
2021-02-19 02:05:13 +00:00
Mike Blumenkrantz de6ed18584 zink: hook up valid_buffer_range for buffer resources using util_range
this lets us avoid stalling during transfer map in some cases

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9062>
2021-02-17 02:16:59 +00:00
Erik Faye-Lund 708327472b zink: do not use extra staging resource unless needed
The reason we check for staging-resources here is really because they
are the only images guaranteed to be host-visible.

But on UMA architectures, it's quite likely to have memory that is
*both* host-visible *and* device-local, so let's see what we found
instead.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8858>
2021-02-12 11:24:50 +00:00
Mike Blumenkrantz b92ba0100e zink: track persistent, non-coherent, writable transfer map count for resources
these require explicit memory flushes before being submitted to a batch

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8942>
2021-02-10 13:28:10 +00:00
Mike Blumenkrantz e196c471a4 zink: make get_resource_usage() public
also cover compute batch id (still not yet used)

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8781>
2021-02-10 00:19:38 +00:00
Mike Blumenkrantz 079fae8822 zink: bump resource usage flags to allow 5 batches
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8781>
2021-02-10 00:19:38 +00:00
Mike Blumenkrantz 36ee845cd4 zink: add defines for compute batch and gfx batch count
this will be used for handling batch usage with compute

also bump some struct field sizes based on this

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8781>
2021-02-10 00:19:38 +00:00
Mike Blumenkrantz 1077bd0c64 zink: add a stage param for buffer resource barriers
it's useful to be able to set this more granularly when doing resource
barriers

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8669>
2021-01-29 13:21:37 +00:00
Mike Blumenkrantz 37cd4070e8 zink: add barrier helper for buffer resources
Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8669>
2021-01-29 13:21:36 +00:00
Vinson Lee c0f2a19aee zink: Fix typos.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8071>
2020-12-14 20:13:47 -08:00
Mike Blumenkrantz c6687eef2d zink: add a mechanism to track current resource usage in batches
this is really primitive, but it at least gives an idea of whether a
resource has been submitted for writing in a pending batch

Reviewed-by: Erik Faye-Lun <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6924>
2020-10-14 09:20:24 -04:00
Mike Blumenkrantz e31381ac26 zink: combine all surface layout-setting for src/dst into util function
we do a lot of src/dst layout-setting, so ensure that we use the same code
everywhere to avoid cases where src==dst and we aren't setting GENERAL
layout as we should

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6922>
2020-09-29 20:49:15 +00:00
Mike Blumenkrantz d84a75466c zink: use u_transfer_helper to split/merge interleaved depth/stencil formats
EXT_packed_depth_stencil adds GL_UNSIGNED_INT_24_8_EXT which is an interleaved format,
but vulkan spec states that reading/writing the corresponding format provides only the
D24 component, which requires that we perform separate operations for each component
using separate buffers

fixes mesa/mesa#3031

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6266>
2020-08-31 13:45:42 +00:00
Mike Blumenkrantz 37778fcd9a zink: implement transform feedback support to finish off opengl 3.0
this adds:
* context hooks for gallium stream output methods
* handling for xfb-related queries
* barrier management for pausing and resuming xfb

loosely based on patches originally written by Dave Airlie <airlied@redhat.com>

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5163>
2020-06-17 20:42:01 +00:00
Erik Faye-Lund 499bf41487 zink: do not use both depth and stencil aspects for sampler-views
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
2019-10-28 08:51:46 +00:00
Erik Faye-Lund 8d46e35d16 zink: introduce opengl over vulkan
Here's zink, a so far pretty simple vulkan-gallium driver that is able
to translate some applications from OpenGL to Vulkan.

The compiler is quite limited for now, this will be improved on later.

Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
2019-10-28 08:51:43 +00:00