mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-11-28 00:34:26 +00:00
Dynamically enable VK_KHR_internally_synchronized_queues for libplacebo v7.387.0
This is now disabled by default in libplacebo and must be explicitly enabled when the application knows that all other code sharing the device has been enlightened about the new queue synchronization flags. Since we know that Gamescope's WSI doesn't handle these new flags correctly, we will disable internally synchronized queues when that layer is present. See ValveSoftware/gamescope#2261
This commit is contained in:
1 parent
a6276aa846
commit
3fead131a6
1 file changed
+36
@@ -2,6 +2,7 @@
|
||||
|
||||
#include "streaming/session.h"
|
||||
#include "streaming/streamutils.h"
|
||||
#include "utils.h"
|
||||
|
||||
// Implementation in plvk_c.c
|
||||
#define PL_LIBAV_IMPLEMENTATION 0
|
||||
@@ -375,6 +376,41 @@ bool PlVkRenderer::tryInitializeDevice(VkPhysicalDevice device, VkPhysicalDevice
|
||||
vkParams.extra_queues = VK_QUEUE_FLAG_BITS_MAX_ENUM;
|
||||
}
|
||||
|
||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(60, 31, 101) && defined(VK_KHR_internally_synchronized_queues)
|
||||
// libplacebo needs explicit opt-in to use internally synchronized queues, since
|
||||
// it requires cooperation with the app (ex: using vkGetDeviceQueue2). We know
|
||||
// FFmpeg 9.0+ always wants internally synchronized queues if available, so we
|
||||
// will turn it on when supported by the physical device.
|
||||
if (isExtensionSupportedByPhysicalDevice(device, "VK_KHR_internally_synchronized_queues")) {
|
||||
bool internallySynchronizedQueues;
|
||||
if (!Utils::getEnvironmentVariableOverride("PLVK_INT_SYNC_QUEUES", &internallySynchronizedQueues)) {
|
||||
#if LIBAVUTIL_VERSION_MAJOR < 62
|
||||
// The Gamescope WSI layer currently breaks apps using internally synchronized queues
|
||||
// (failing to use vkGetDeviceQueue2), so we disable this feature when the Gamescope
|
||||
// WSI layer is enabled. See gamescope#2261 for details.
|
||||
internallySynchronizedQueues = (qEnvironmentVariableIntValue("ENABLE_GAMESCOPE_WSI") == 0 ||
|
||||
qEnvironmentVariableIntValue("DISABLE_GAMESCOPE_WSI") == 1);
|
||||
#else
|
||||
// We have no choice but to enable it since the queue locking callbacks are gone
|
||||
internallySynchronizedQueues = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static VkPhysicalDeviceInternallySynchronizedQueuesFeaturesKHR featInternalSyncQueues = {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INTERNALLY_SYNCHRONIZED_QUEUES_FEATURES_KHR,
|
||||
nullptr,
|
||||
internallySynchronizedQueues,
|
||||
};
|
||||
|
||||
static const VkPhysicalDeviceFeatures2 features = {
|
||||
VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2,
|
||||
(void*)&featInternalSyncQueues,
|
||||
};
|
||||
|
||||
vkParams.features = &features;
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
// Don't let Qt take DRM master from us during pl_vulkan_create()
|
||||
DrmMasterLocker locker;
|
||||
|
||||
Reference in new issue
Block a user