mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 12:56:06 +00:00
128 lines
4.1 KiB
Diff
128 lines
4.1 KiB
Diff
diff --git a/src/rendervulkan.cpp b/src/rendervulkan.cpp
|
|
index 54e4efc..024af02 100644
|
|
--- a/src/rendervulkan.cpp
|
|
+++ b/src/rendervulkan.cpp
|
|
@@ -538,6 +538,14 @@ bool CVulkanDevice::createDevice()
|
|
}
|
|
|
|
float queuePriorities = 1.0f;
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+ const char *pszForceRealtime = getenv( "GAMESCOPE_FORCE_VULKAN_REALTIME" );
|
|
+ const bool useRealtimeVulkanQueue = gamescope::Process::HasCapSysNice() || ( pszForceRealtime && atoi( pszForceRealtime ) != 0 );
|
|
+ if ( useRealtimeVulkanQueue && !gamescope::Process::HasCapSysNice() )
|
|
+ fprintf( stderr, "gamescope: requesting realtime-priority Vulkan queues without CAP_SYS_NICE (GAMESCOPE_FORCE_VULKAN_REALTIME)\n" );
|
|
|
|
VkDeviceQueueGlobalPriorityCreateInfoEXT queueCreateInfoEXT = {
|
|
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT,
|
|
@@ -549,14 +557,14 @@ bool CVulkanDevice::createDevice()
|
|
{
|
|
{
|
|
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
|
|
- .pNext = gamescope::Process::HasCapSysNice() ? &queueCreateInfoEXT : nullptr,
|
|
+ .pNext = useRealtimeVulkanQueue ? &queueCreateInfoEXT : nullptr,
|
|
.queueFamilyIndex = m_queueFamily,
|
|
.queueCount = 1,
|
|
.pQueuePriorities = &queuePriorities
|
|
},
|
|
{
|
|
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
|
|
- .pNext = gamescope::Process::HasCapSysNice() ? &queueCreateInfoEXT : nullptr,
|
|
+ .pNext = useRealtimeVulkanQueue ? &queueCreateInfoEXT : nullptr,
|
|
.queueFamilyIndex = m_generalQueueFamily,
|
|
.queueCount = 1,
|
|
.pQueuePriorities = &queuePriorities
|
|
@@ -682,14 +690,14 @@ bool CVulkanDevice::createDevice()
|
|
};
|
|
|
|
VkResult res = vk.CreateDevice(physDev(), &deviceCreateInfo, nullptr, &m_device);
|
|
- if ( res == VK_ERROR_NOT_PERMITTED_KHR && gamescope::Process::HasCapSysNice() )
|
|
+ if ( res == VK_ERROR_NOT_PERMITTED_KHR && useRealtimeVulkanQueue )
|
|
{
|
|
fprintf(stderr, "vkCreateDevice failed with a high-priority queue (general + compute). Falling back to regular priority (general).\n");
|
|
queueCreateInfos[1].pNext = nullptr;
|
|
res = vk.CreateDevice(physDev(), &deviceCreateInfo, nullptr, &m_device);
|
|
|
|
|
|
- if ( res == VK_ERROR_NOT_PERMITTED_KHR && gamescope::Process::HasCapSysNice() )
|
|
+ if ( res == VK_ERROR_NOT_PERMITTED_KHR && useRealtimeVulkanQueue )
|
|
{
|
|
fprintf(stderr, "vkCreateDevice failed with a high-priority queue (compute). Falling back to regular priority (all).\n");
|
|
queueCreateInfos[0].pNext = nullptr;
|
|
diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp
|
|
index 10990b8..08afbc4 100644
|
|
--- a/src/steamcompmgr.cpp
|
|
+++ b/src/steamcompmgr.cpp
|
|
@@ -2025,18 +2025,53 @@ void MouseCursor::UpdatePosition()
|
|
if ( pConstraint && pConstraint->current.cursor_hint.enabled )
|
|
{
|
|
m_bConstrained = true;
|
|
-
|
|
m_x = pConstraint->current.cursor_hint.x;
|
|
m_y = pConstraint->current.cursor_hint.y;
|
|
+ wlserver_unlock();
|
|
+ return;
|
|
}
|
|
- else
|
|
+ m_bConstrained = false;
|
|
+
|
|
+
|
|
+ if ( m_imageEmpty )
|
|
{
|
|
- m_bConstrained = false;
|
|
-
|
|
m_x = wlserver.mouse_surface_cursorx;
|
|
m_y = wlserver.mouse_surface_cursory;
|
|
+ wlserver_unlock();
|
|
+ return;
|
|
}
|
|
wlserver_unlock();
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+ if ( wlserver.bCursorHidden )
|
|
+ {
|
|
+ const uint64_t now = get_time_in_nanos();
|
|
+ if ( now - m_ulLastPointerQuery < 50'000'000ul )
|
|
+ return;
|
|
+ m_ulLastPointerQuery = now;
|
|
+ }
|
|
+ Window root_ret, child_ret;
|
|
+ int root_x = m_x, root_y = m_y, win_x = 0, win_y = 0;
|
|
+ unsigned int mask;
|
|
+ XQueryPointer( m_ctx->dpy, DefaultRootWindow( m_ctx->dpy ),
|
|
+ &root_ret, &child_ret,
|
|
+ &root_x, &root_y,
|
|
+ &win_x, &win_y,
|
|
+ &mask );
|
|
+
|
|
+ if ( root_x != m_x || root_y != m_y )
|
|
+ {
|
|
+ m_x = root_x;
|
|
+ m_y = root_y;
|
|
+ wlserver.ulLastMovedCursorTime = get_time_in_nanos();
|
|
+ wlserver.bCursorHidden = !wlserver.bCursorHasImage;
|
|
+ hasRepaintNonBasePlane = true;
|
|
+ }
|
|
}
|
|
|
|
void MouseCursor::checkSuspension()
|
|
diff --git a/src/steamcompmgr.hpp b/src/steamcompmgr.hpp
|
|
index c428784..bd62fd1 100644
|
|
--- a/src/steamcompmgr.hpp
|
|
+++ b/src/steamcompmgr.hpp
|
|
@@ -109,6 +109,7 @@ private:
|
|
|
|
int m_x = 0, m_y = 0;
|
|
bool m_bConstrained = false;
|
|
+ uint64_t m_ulLastPointerQuery = 0;
|
|
int m_hotspotX = 0, m_hotspotY = 0;
|
|
|
|
gamescope::OwningRc<CVulkanTexture> m_texture;
|