Commit Graph

47128 Commits

Author SHA1 Message Date
Mike Blumenkrantz 4cb5bb72be zink: add util function for checking whether shader descriptor is buffer from program
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9543>
2021-03-16 10:45:32 -04:00
Mike Blumenkrantz 12243f682d zink: add util function for checking whether a shader descriptor is a buffer
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9543>
2021-03-16 10:45:32 -04:00
Mike Blumenkrantz 2b18105ff7 zink: add some asserts for pipeline barriers to check renderpass state
it's illegal to emit barriers during a renderpass

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9543>
2021-03-16 10:45:32 -04:00
Mike Blumenkrantz f4a53287de zink: handle cached descriptor set punting
if an active set gets invalidated, it needs to be punted from the active
hash table so it doesn't get reused

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9543>
2021-03-16 10:45:32 -04:00
Mike Blumenkrantz 616720d6ae zink: track resource_object usage instead of resource usage
the resource object is now a state tracker for the inner resource_object,
so it can safely be destroyed even if the backing resource is still in use

this also requires updating various things to keep descriptor states/caches working

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 708f19317c zink: split out backing resource object create/destroy
moving towards these being able to exist semi-independently...

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 46bbc835c1 zink: move resource internals to a separate struct
this starts the path towards being able to replace the backing objects for
a resource

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 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 c699cc0f9b zink: avoid looping for non-ubo descriptor updates based on set usage
if we know that the descriptor set is cached and already in use by a given
batch, then we also know that all the resources in the set are tracked, which
means that we can skip over some looping  during descriptor updates which would
otherwise be used to add tracking for sampler/image views/states

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9567>
2021-03-16 01:01:57 +00:00
Mike Blumenkrantz 839d609b8c zink: add batch usage flags for sampler views/states and desc sets
this massively cuts down cpu time for hashing and lookups, resulting in
a noticeable performance increase

the sampler_state batch usage for now is just being set for future use when
it will be leveraged to permit immediate deletion

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9567>
2021-03-16 01:01:57 +00:00
Mike Blumenkrantz c3db26a6f6 lavapipe: use common interfaces for shader modules
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9508>
2021-03-15 21:47:44 +00:00
Dave Airlie b0de4468c2 lavapipe: add host query reset
This just resets the queries on the host size.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9594>
2021-03-16 06:50:37 +10:00
Dave Airlie 6865ec210b lavapipe: fix writing availability for queries.
If the availability has to be written it needs to be written
 to the correct place.

The host query reset tests fall over this.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9594>
2021-03-16 06:50:33 +10:00
Dave Airlie 774bbc299f lavapipe: add missing break
No effect as-is but annoying later.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9594>
2021-03-16 06:50:28 +10:00
Mike Blumenkrantz edcad555f8 zink: stop leaking programs
gfx and compute programs both end up with an extra ref from creation,
so they both need to lose a ref during creation after they get their
shader refs

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9470>
2021-03-15 15:37:46 +00:00
Mike Blumenkrantz 46b356ca2d zink: unset ctx->program pointers when an unref destroys the object
if we destroy a program object which is currently the "active" program then
we need to unset the pointer to avoid invalid access

also unset injected tcs pointers where appropriate

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9470>
2021-03-15 15:37:46 +00:00
Mike Blumenkrantz ddb807e5c9 zink: return true from program ref functions upon free
this lets us unset the context pointer accurately

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9470>
2021-03-15 15:37:46 +00:00
Mike Blumenkrantz 25d895747c zink: use internal api for first-frame fence
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9290>
2021-03-15 11:19:16 -04:00
Mike Blumenkrantz e93ca92d4a zink: force explicit fence only on first frame flush
we have implicit sync hooked up for drivers now so we don't need to worry
about drawing over our frontbuffer unexpectedly

still a weird issue remaining where we miss the first frame without an explicit
fence, but I expect that will get resolved eventually by wsi

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9290>
2021-03-15 11:18:59 -04:00
Mike Blumenkrantz bbfeebabfd zink: force mesa flush implicit fencing on ANV
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9290>
2021-03-15 10:58:21 -04:00
Mike Blumenkrantz 6fb4e1345d zink: determine whether the vulkan driver requires mesa flush wsi
this is used for ANV's implicit fencing (until we get wsi)

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9290>
2021-03-15 10:58:21 -04:00
Mike Blumenkrantz 86bd643d6a zink: use a safer iteration for fb surfaces during rp init
doing a pointer iteration looks cool, but if the array is full, then it
goes out of bounds and we crash

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9542>
2021-03-15 14:10:52 +00:00
Mike Blumenkrantz 38f7faa8a4 zink: implement a surface cache
this is a global cache for all surface objects, enabling some memory
optimizations as well as improved reuse of cached descriptors

loosely based on patches from Antonio Caggiano

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9541>
2021-03-15 09:42:30 -04:00
Mike Blumenkrantz 2643f9ed28 zink: ralloc screen objects
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9541>
2021-03-15 09:42:30 -04:00
Michel Zou 6083ebe078 swr: fix array-bounds warning
Reviewed-by: Jan Zielinski <jan.zielinski@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9502>
2021-03-15 13:19:09 +00:00
Michel Zou 12af7f97ee swr: fix deprecated llvm 11 declaration warning
Reviewed-by: Jan Zielinski <jan.zielinski@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9502>
2021-03-15 13:19:09 +00:00
Michel Zou c58a7c7108 swr: fix unused SplitString warning
Reviewed-by: Jan Zielinski <jan.zielinski@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9502>
2021-03-15 13:19:09 +00:00
Michel Zou 17441cf92f swr: Fix SWR_CONTEXT pre-declaration
Silents a warning on msvc

Reviewed-by: Jan Zielinski <jan.zielinski@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9502>
2021-03-15 13:19:09 +00:00
Michel Zou 0e8cdea6d9 swr: fix win32 intrinsics
The doc doesnt mention Index is altered when mask is null.
This is consistent with both llvm & migw implementations.

Reviewed-by: Jan Zielinski <jan.zielinski@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9502>
2021-03-15 13:19:09 +00:00
Michel Zou 31dbef02a0 swr: extern declaration for win32 intrinsics
This fixes compilation on msvc because llvm redefines these too
Closes #4417

Reviewed-by: Jan Zielinski <jan.zielinski@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9502>
2021-03-15 13:19:09 +00:00
Pierre-Eric Pelloux-Prayer 9e5623ccc3 frontends/va: fix protected slice data buffer read size
Read vlVaBuffer->size bytes instead of an hardcoded value.

Fixes: deb7dc82f6 ("frontends/va: handle protected slice data buffer")
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9553>
2021-03-15 09:43:15 +01:00
Pierre-Eric Pelloux-Prayer 4668cd30d9 radeonsi/sqtt: fix user event max size
Larger strings can corrupt rgp files.

Fixes: 5dc823304b ("radeonsi/sqtt: forward string markers to sqtt")
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Boyuan Zhang <Boyuan.Zhang@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9553>
2021-03-15 09:42:40 +01:00
Mike Blumenkrantz 1819283413 zink: use _mesa_set_search_and_add() for set management
this avoids extra hash lookups

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9565>
2021-03-14 21:57:00 -04:00
Mike Blumenkrantz c5029ddf8c zink: optimize resource usage tracking
we already have the batch usage info here for the resource, so if we know
the resource is already used on the batch then we don't need to also perform
a hash lookup to double check that it's really there

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9565>
2021-03-14 21:57:00 -04:00
Dave Airlie db0a71c9ae lavapipe: enable EXT_scalar_block_layout
The frontend should handle this.

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9590>
2021-03-15 00:06:58 +00:00
Dave Airlie db8e2aad5e lavapipe: enable KHR_uniform_buffer_standard_layout
I think the frontend should handle all of this fine.

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9590>
2021-03-15 00:06:58 +00:00
Vinson Lee 7e412a5d33 iris: Fix typos.
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Sagar Ghuge <sagar.ghuge@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9382>
2021-03-15 00:01:30 +00:00
Vinson Lee 1193f2bd74 nv50/ir: Add constructor for NV50LegalizePostRA.
Fix defect reported by Coverity Scan.

Uninitialized pointer field (UNINIT_CTOR)
member_not_init_in_gen_ctor: The compiler-generated constructor
for this class does not initialize r63.

Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9326>
2021-03-14 16:49:49 -07:00
Mike Blumenkrantz 09d53d63ad zink: ci updates
disabling qbo piglit test for now due to lots of brokenness in zink which
makes them flaky, will be reenabled soon

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9566>
2021-03-14 19:22:39 -04:00
Mike Blumenkrantz 4e14c3dcb1 zink: remove extraneous flush in transfer_map_region_flush
this was only needed to cover up some other bugs:
* missing barriers for buffer sampler/image descriptors
* weirdness with first frame handling

there's better ways of handling both cases, and now they're handled better

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9566>
2021-03-14 18:51:58 -04:00
Mike Blumenkrantz d40e372fe9 zink: move buffer<->image copying to pipe_context::resource_copy_region hook
that's a todo item off the list

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9566>
2021-03-14 18:51:58 -04:00
Dave Airlie 585b5fcf44 lavapipe: add single ssbo variable pointer support.
Multiple buffer seems to break with tess eval only,
something to investigate later.

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8222>
2021-03-15 06:20:54 +10:00
Dave Airlie c843e3b5b4 lavapipe: move to common create render pass code
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9550>
2021-03-14 20:03:13 +00:00
Dave Airlie 8475ab7f92 lavapipe: move to the common casting interfaces
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9550>
2021-03-14 20:03:13 +00:00
Dave Airlie bd623d6cd6 lavapipe: move queue to base object
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9550>
2021-03-14 20:03:13 +00:00
Dave Airlie 3a466bfc1c lavapipe: add support for VK_KHR_create_renderpass2
Also move to the common code for create renderpass

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9550>
2021-03-14 20:03:13 +00:00
Vasily Khoruzhick 951788b560 lima/ppir: don't use list_length() in loop in regalloc and liveness analysis
list_length() complexity is O(n), so it's better to store number of regs
separately and use it instead of list_length().

Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9570>
2021-03-14 16:39:26 +00:00
Vasily Khoruzhick d2ca8be998 lima: add precompile debug flag
This flag will be used by run from mesa-shader-db to trigger shader
compilation with default settings.

Tested-by: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
Reviewed-by: Erico Nunes <nunes.erico@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9583>
2021-03-14 16:16:03 +00:00
Gert Wollny 7c2c60ad67 r600/sfn remove some leftover debug output
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9584>
2021-03-14 13:28:44 +00:00
Gert Wollny 4459fc224b r600/sfn: lower idiv, imod, etc in nir
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9584>
2021-03-14 13:28:44 +00:00
Gert Wollny 7f020afcd6 r600/sfn: lower bitfield_extract and bitfield_insert in NIR
v2: lower bitfield insert to bitfield_select (Rhys Perry

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9584>
2021-03-14 13:28:44 +00:00
Gert Wollny 585eebdd0f r600/sfn: Fix including/not including c++ parts of header
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9584>
2021-03-14 13:28:44 +00:00
Gert Wollny 944f132578 r600/sfn: fix buffer offset for ssbo writes
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9584>
2021-03-14 13:28:44 +00:00
Gert Wollny a47a12b37c r600/sfn: remove unused code
Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9584>
2021-03-14 13:28:44 +00:00
Gert Wollny 2e1cff0e85 r600/sfn: sort alu opcodes in switch statememt
This makes it easier to figure out which ops are already handled.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9584>
2021-03-14 13:28:44 +00:00
Axel Davy 8283ed65cf radeonsi: Limit the size of the in-memory shader cache
The in-memory shader cache can get significantly
huge in some rare cases.
Limit its size to 64MB on 32 bits, and 1GB else.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9578>
2021-03-13 21:51:38 +00:00
Axel Davy c23c3b7a77 st/nine: detect worker threads syncs for systemmem
If we detect too many syncs, use the stream_uploader,
which avoid syncs.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Axel Davy 205201c968 st/nine: Use stream_uploader for bad cases of systemmem
Using stream_uploader in case we cannot use unsynchronized
improves performance.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Axel Davy 05e6b0f200 st/nine: Always use DYNAMIC with SYSTEMMEM
The disadvantages of the DYNAMIC path over the
non-dynamic path are minor.
The advantages are many.

As we don't know if bad behaving apps use
non-dynamic SYSTEMMEM in a dynamic fashion,
let's be safe and always be dynamic.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Axel Davy 67c401b112 st/nine: Force DYNAMIC SYSTEMMEM for sw vertex processing
SW vertex processing buffers are supposed to be sorted in RAM
and to be immediately idle after use (thus you can write at the
same location again immediately).

DYNAMIC SYSTEMMEM is by far the best fit for now for these kind
of buffers, though it can be improved further. Indeed the use
pattern will cause a lot of syncs with csmt actived.
Thus disable csmt when full sw vertex processing is requested.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Axel Davy 380c2bf887 st/nine: Optimize dynamic systemmem buffers
Some apps use DYNAMIC SYSTEMMEM buffers and fill them in a
dynamic fashion with discard and nooverwrite locking flags.

To prevent uploading the whole buffer every draw call,
track the region needed for the draw call, and
upload only that region (or a bit more in order
to ease valid region tracking).

Try to aggressively upload with discard/unsynchronized.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Axel Davy 01c8071f93 st/nine: Track pending MANAGED buffer uploads
The tracking enables to avoid flushing the csmt thread
when locking repeatedly the same buffer, as long
as the locks are non-overlapping.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Axel Davy 26a9e2bb15 gallium/util: Add new u_box helpers
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Axel Davy a5819e1b49 st/nine: Use correct bind flag at buffer creation
The buffer bind creation flag was incorrect for index buffers

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Axel Davy a2c3db34d1 st/nine: Optimize DrawPrimitiveUp
Try to keep the same vertex buffer state when
having several consecutive DrawPrimitiveUp.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>

Nicer DrawPrimUp opt patch

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Axel Davy 9168a37692 st/nine: Refactor DrawPrimitiveUp
. Use the same fonction as DrawPrimitive
. Drop the user vbuf path
. Avoid setting NULL vertexbuffer to the context

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Axel Davy 247d135f67 st/nine: Implement SYSTEMMEM buffers same as MANAGED
Use the MANAGED path for SYSTEMMEM buffers.

Tests point out the locking behaviour of SYSTEMEMM
buffers is very close to MANAGED.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Axel Davy 634adfa253 st/nine: Optimize EndScene
So far we did nothing on EndScene, but the API
doc says it flushes the GPU command queue.
The doc implies one can optimize CPU usage
by calling EndScene long before Present() is called.

Implementing the flush behaviour gives me +15-20%
on the CPU limited Halo. On the other hand, do limit
the flush to only once per frame.
3DMark03/3Mark05 get a 2% perf hit with the patch,
but 5% if I allow more flushes.

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9451>
2021-03-13 21:23:24 +00:00
Mike Blumenkrantz 7b2e35128c lavapipe: set more resource bind flags using image/buffer usage bits
we have this info available, so we can be more precise about it

stop the printf spam!

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9573>
2021-03-13 04:14:17 +00:00
Eric Anholt 87c85139ea virgl: Update GLES expectations.
These are only used in manual runs, and I noticed in a recent run that
something on master had fixed them.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9509>
2021-03-12 21:14:27 +00:00
Mike Blumenkrantz 536533f556 lavapipe: fix push descriptor set indexing
the push set index isn't always 0, so the offsets need to be updated
in order to avoid clobbering other sets

Fixes: 6be19765cf ("lavapipe: add support for VK_KHR_push_descriptor")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9558>
2021-03-12 21:02:23 +00:00
Lionel Landwerlin f08f8eaa48 iris: use gen_device_info helper to get subslice total
gen_device_info will try to use the most recent uAPI to get this
number and will fallback to this get_param. So just use what was
queries by gen_device_info_from_fd().

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9052>
2021-03-12 18:54:07 +00:00
Mike Blumenkrantz 45e6fcef4b zink: remove debug printf
accidentally left this in while bisecting

Fixes: 929a748401 ("zink: avoid hashing states without descriptors")

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9564>
2021-03-12 17:45:44 +00:00
Mike Blumenkrantz bf0c5988b2 zink: ci updates
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9540>
2021-03-12 17:21:40 +00: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
Axel Davy 6205400612 st/nine: Fix compilation issue in nine_debug
Some compilers complain of the implicit conversion.
Make it explicit.

Reported by:
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6121
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9250

Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9563>
2021-03-12 17:12:58 +00:00
Mike Blumenkrantz 378bb07110 zink: optimize pipeline hashing
we can reorder the pipeline state and avoid hashing the big arrays based
on context states that we already have available to us

also we can do incremental hashes for the shader modules to further reduce
hashing

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9539>
2021-03-12 17:02:20 +00:00
Mike Blumenkrantz da08d67364 zink: move vertex_buffers_enabled_mask to non-hashed part of pipeline state
we can use this to optimize pipeline hashing

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9539>
2021-03-12 17:02:20 +00:00
Mike Blumenkrantz 0f7d32073d zink: ci updates
some flakes here that will be resolved in the very near future

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 a5984bdf78 zink: fix arrays of texel buffer descriptors
these need to pass a constructed array of buffers, not a single buffer per
descriptor

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 929a748401 zink: avoid hashing states without descriptors
this is unnecessary hashing which decreases the accuracy of the states

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 72a06746bf zink: remove image layouts from descriptor states
these are always the same value, so there's no need to track them

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 5700cbfa1a zink: always use VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL for sampler bindings
if a resource is used multiple times with different samplers then this can result
in conflicting layouts, so it's better to just use the general case here

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 e4421c4b82 zink: don't create descriptor barrier hash tables for cached descriptor set
this won't be used, so there's no point in allocating it

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 38e6e44262 zink: remove struct zink_descriptor_resource from descriptor updating
this can be inferred from a resource's barrier usage, and then by merging
the batch-tracking for resources into the barrier loop, this deduplicates
calls for resources which are bound for multiple stages as well as removing
another iteration during descriptor updating

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 4a3b344b23 zink: directly use resource count from pool instead of accumulating every time
this is a surprisingly impactful speedup

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 201cd1a8c0 zink: track resource count on descriptor pool object
we can do this once here instead of accumulating the count all over later

also remove the debug value on the set which duplicated this

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 d9793a8a60 zink: reuse descriptor barriers across draws
if we aren't invalidating the descriptor set then we can safely reuse its
barriers to avoid doing any sort of hashing during descriptor updating

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 c55e2fb59c zink: move descriptor binding out of the update codepath
we won't always need to update sets that we bind

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 dc020db723 zink: pre-size descriptor transition hash table
this avoids costly rehashing

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 80d9f3aa34 zink: simplify check for knowing whether descriptor updating is needed
if a program has at least one pool object set then it will have descriptors

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 fe31566fbb zink: remove intermediate func for descriptor set getting
we can simplify this a bit by just getting the objects in the function

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 141ff0e091 zink: allow reuse of zink_descriptor_pools between programs
now that we've split these into their own objects, we can reuse them across
programs with matching binding layouts for a given type, giving even more value to
the descriptor set cache by increasing reuse

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 ee40550b87 zink: move descriptor type to pool object from set
this is a little less memory usage

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 58500979a8 zink: track number of sets currently allocated per descriptor pool
if we're going to be sharing pools across programs, it's no longer sufficient
to check the hash populations, so we need a separate counter to know when we have
to flush

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 871022dc84 zink: change program pointer on struct zink_descriptor_set to pool pointer
the program using the set isn't very relevant now that there's the intermediate
pool struct which stores the sets

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 817de3c776 zink: break out all the descriptor pool/layout stuff into a new struct
by pushing these into a separate struct, we can eventually reuse them between
programs to make the descriptor set caches even more valuable

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 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 eee488abad zink: deduplicate VkWriteDescriptorSet setup
no functional changes

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 ce0524f009 zink: break out image descriptor updating
all the descriptor updates are now broken out, so update_descriptors is now just
a dispatch for calling the other update 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