qt5base-lts/tests/auto/gui
Laszlo Agocs 0b7aef08dc rhi: vk: Alter command buffer strategy
Reports on the Web have it that there's nothing guaranteeing a
driver does any actual freeing of resources then doing
vkFreeCommandBuffer for a command buffer from a command pool that
does not have VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, thus
leading to continuously growing resource usage with our current
allocate/free pattern. It could be that this is the source of out
of memory problems we are seeing on some Android devices.

Instead of just going straight for said command pool flag and doing
ResetCommandBuffer for the command buffers individually, take one
step further and use per-slot (slot being 0 or 1 if QVK_FRAMES_IN_FLIGHT
is 2) command pools. The current pool is reset in each
beginFrame/beginOffscreenFrame, moving all allocated command buffers
to the initial state (while other command buffers with the other pool
are not affected).

This may be (while impossible to tell from just guessing based on the
spec) our best approach to command buffer allocation since a Vulkan
implementation can likely just use some simple per pool allocator,
knowing that we never want to free or reset individual command buffers,
but we rather only reset the whole pool at once.

The option of importing an existing VkCommandPool when creating the
QRhi instance is now gone, but there was probably no point in offering
that in the first place.

When it comes to VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT it will
not be set unless releaseCachedResources() (in Qt Quick this is hooked
into QQuickWindow::releaseResources()) was called. What this does in
practice is unknown, but have an option to set it now and then if the
application really wants.

While we are at it, rename secondaryCbs to activeSecondaryCbStack to
indicate what it really is. (it's a stack as each call to
beginExternal() pushes a new one, while each endExternal() pops)

Change-Id: I2e5c1fad26d794e1f56c778e38f750998d706d84
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2020-10-02 13:14:31 +02:00
..
image Add logging categories to image handlers 2020-09-30 08:39:45 +02:00
itemmodels CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
kernel tst_qwindow: verify isBeginEvent(), isUpdateEvent() and isEndEvent() 2020-09-30 23:17:57 +02:00
math3d CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
painting CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
qopengl CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
qopenglconfig CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
qvulkan CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
rhi rhi: vk: Alter command buffer strategy 2020-10-02 13:14:31 +02:00
text Fix Qt6 todo in qcssparser 2020-09-23 17:01:29 +02:00
util CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
.prev_CMakeLists.txt Remove winrt 2020-06-06 20:25:49 +02:00
CMakeLists.txt Remove winrt 2020-06-06 20:25:49 +02:00
gui.pro Remove winrt 2020-06-06 20:25:49 +02:00