ValveSoftware / gamescope

SteamOS session compositing window manager
Other
3.18k stars 213 forks source link

[Feature Request] Support Wine's native wayland driver #1107

Open KyunLFA opened 10 months ago

KyunLFA commented 10 months ago

Not sure if Wine bug or a Gamescope bug.

Wine's wayland driver works correctly, but not under gamescope by using the flag --expose-wayland

Forcing a new enough (or patched) wine to use (non x)wayland with "wine reg.exe add HKCU\\Software\\Wine\\Drivers /v Graphics /d wayland" (does not need to unset DISPLAY in this way) makes it so launching under gamescope --expose-wayland -- wine (insert program) cannot produce a viable window with the following logs:

For notepad or gamescope --expose-wayland --debug-layers --debug-focus --debug-events -- wine notepad :

vblank: Using timerfd.
wlserver: [backend/headless/backend.c:67] Creating headless backend
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
vulkan: selecting physical device 'AMD Radeon RX 7800 XT (RADV NAVI32)': queue family 1 (general queue family 0)
vulkan: physical device supports DRM format modifiers
vulkan: supported DRM formats for sampling usage:
vulkan:   AR24 (0x34325241)
vulkan:   XR24 (0x34325258)
vulkan:   AB24 (0x34324241)
vulkan:   XB24 (0x34324258)
vulkan:   RG16 (0x36314752)
vulkan:   NV12 (0x3231564E)
vulkan:   AB4H (0x48344241)
vulkan:   XB4H (0x48344258)
vulkan:   AB48 (0x38344241)
vulkan:   XB48 (0x38344258)
vulkan:   AB30 (0x30334241)
vulkan:   XB30 (0x30334258)
vulkan:   AR30 (0x30335241)
vulkan:   XR30 (0x30335258)
vulkan: Creating Gamescope nested swapchain with format 64 and colorspace 0
wlserver: Running compositor on wayland display 'gamescope-0'
wlserver: [backend/headless/backend.c:17] Starting headless backend
wlserver: [xwayland/server.c:108] Starting Xwayland on :1
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Could not resolve keysym XF86CameraAccessEnable
> Warning:          Could not resolve keysym XF86CameraAccessDisable
> Warning:          Could not resolve keysym XF86CameraAccessToggle
> Warning:          Could not resolve keysym XF86NextElement
> Warning:          Could not resolve keysym XF86PreviousElement
> Warning:          Could not resolve keysym XF86AutopilotEngageToggle
> Warning:          Could not resolve keysym XF86MarkWaypoint
> Warning:          Could not resolve keysym XF86Sos
> Warning:          Could not resolve keysym XF86NavChart
> Warning:          Could not resolve keysym XF86FishingChart
> Warning:          Could not resolve keysym XF86SingleRangeRadar
> Warning:          Could not resolve keysym XF86DualRangeRadar
> Warning:          Could not resolve keysym XF86RadarOverlay
> Warning:          Could not resolve keysym XF86TraditionalSonar
> Warning:          Could not resolve keysym XF86ClearvuSonar
> Warning:          Could not resolve keysym XF86SidevuSonar
> Warning:          Could not resolve keysym XF86NavInfo
Errors from xkbcomp are not fatal to the X server
wlserver: [types/wlr_compositor.c:692] New wlr_surface 0x574e034be620 (res 0x574e0327c350)
wlserver: [xwayland/server.c:273] Xserver is ready
pipewire: stream state changed: connecting
pipewire: stream state changed: paused
pipewire: stream available on node ID: 66
event 28
event 88
event 28
event 28
event 28
event 28
event 28
event 28
event 28
event 28
event 28
event 28
event 28
event 28
vulkan: Creating Gamescope nested swapchain with format 64 and colorspace 0
pipewire: renegotiating stream params (size: 1280x720)
event 28
03a8:err:waylanddrv:wayland_process_init Wayland compositor doesn't support wl_subcompositor
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03a8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03c0:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
03c0:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
03a0:fixme:ver:GetCurrentPackageId (000000000021FEB0 0000000000000000): stub

Log without gamescope (opens correctly):


0468:fixme:ver:GetCurrentPackageId (000000000021FEB0 0000000000000000): stub
0440:fixme:ver:GetCurrentPackageId (000000000021FEB0 0000000000000000): stub

For a game running on DXVK/Vulkan or gamescope --expose-wayland --debug-layers --debug-focus --debug-events -- wine DBXV2.exe :

vblank: Using timerfd.
wlserver: [backend/headless/backend.c:67] Creating headless backend
ATTENTION: default value of option vk_khr_present_wait overridden by environment.
vulkan: selecting physical device 'AMD Radeon RX 7800 XT (RADV NAVI32)': queue family 1 (general queue family 0)
vulkan: physical device supports DRM format modifiers
vulkan: supported DRM formats for sampling usage:
vulkan:   AR24 (0x34325241)
vulkan:   XR24 (0x34325258)
vulkan:   AB24 (0x34324241)
vulkan:   XB24 (0x34324258)
vulkan:   RG16 (0x36314752)
vulkan:   NV12 (0x3231564E)
vulkan:   AB4H (0x48344241)
vulkan:   XB4H (0x48344258)
vulkan:   AB48 (0x38344241)
vulkan:   XB48 (0x38344258)
vulkan:   AB30 (0x30334241)
vulkan:   XB30 (0x30334258)
vulkan:   AR30 (0x30335241)
vulkan:   XR30 (0x30335258)
vulkan: Creating Gamescope nested swapchain with format 64 and colorspace 0
wlserver: Running compositor on wayland display 'gamescope-0'
wlserver: [backend/headless/backend.c:17] Starting headless backend
wlserver: [xwayland/server.c:108] Starting Xwayland on :1
The XKEYBOARD keymap compiler (xkbcomp) reports:
> Warning:          Could not resolve keysym XF86CameraAccessEnable
> Warning:          Could not resolve keysym XF86CameraAccessDisable
> Warning:          Could not resolve keysym XF86CameraAccessToggle
> Warning:          Could not resolve keysym XF86NextElement
> Warning:          Could not resolve keysym XF86PreviousElement
> Warning:          Could not resolve keysym XF86AutopilotEngageToggle
> Warning:          Could not resolve keysym XF86MarkWaypoint
> Warning:          Could not resolve keysym XF86Sos
> Warning:          Could not resolve keysym XF86NavChart
> Warning:          Could not resolve keysym XF86FishingChart
> Warning:          Could not resolve keysym XF86SingleRangeRadar
> Warning:          Could not resolve keysym XF86DualRangeRadar
> Warning:          Could not resolve keysym XF86RadarOverlay
> Warning:          Could not resolve keysym XF86TraditionalSonar
> Warning:          Could not resolve keysym XF86ClearvuSonar
> Warning:          Could not resolve keysym XF86SidevuSonar
> Warning:          Could not resolve keysym XF86NavInfo
Errors from xkbcomp are not fatal to the X server
wlserver: [types/wlr_compositor.c:692] New wlr_surface 0x60af6e1447f0 (res 0x60af6e01d210)
wlserver: [xwayland/server.c:273] Xserver is ready
pipewire: stream state changed: connecting
pipewire: stream state changed: paused
pipewire: stream available on node ID: 66
event 28
event 88
event 28
event 28
event 28
event 28
event 28
event 28
event 28
event 28
event 28
event 28
event 28
event 28
vulkan: Creating Gamescope nested swapchain with format 64 and colorspace 0
pipewire: renegotiating stream params (size: 1280x720)
event 28
03d8:err:waylanddrv:wayland_process_init Wayland compositor doesn't support wl_subcompositor
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
03d8:fixme:bitmap:NtGdiCreateBitmap planes = 0
info:  Game: DBXV2.exe
info:  DXVK: v2.3-34-g1568c263-gplasync
info:  Vulkan: Found vkGetInstanceProcAddr in winevulkan.dll @ 0x6ffffb103b40
info:  Built-in extension providers:
info:    Win32 WSI
info:    OpenVR
info:    OpenXR
info:  OpenVR: could not open registry key, status 2
info:  OpenVR: Failed to locate module
03f0:err:vulkan:init_vulkan Failed to load Wine graphics driver supporting Vulkan.
03f0:err:vulkan:init_vulkan Failed to load Wine graphics driver supporting Vulkan.
info:  Required Vulkan extension VK_KHR_surface not supported
err:   DxvkInstance: Required instance extensions not supported
03f0:err:ole:CoUninitialize Mismatched CoUninitialize
03f0:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
03f0:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
03f0:fixme:ver:GetCurrentPackageId (000000000011FEB0 0000000000000000): stub
03d0:fixme:ver:GetCurrentPackageId (000000000021FEB0 0000000000000000): stub

Log without gamescope (opens correctly) :


info:  Game: DBXV2.exe
info:  DXVK: v2.3-34-g1568c263-gplasync
info:  Vulkan: Found vkGetInstanceProcAddr in winevulkan.dll @ 0x6ffffb0d3b40
info:  Built-in extension providers:
info:    Win32 WSI
info:    OpenVR
info:    OpenXR
info:  OpenVR: could not open registry key, status 2
info:  OpenVR: Failed to locate module
info:  Enabled instance extensions:
info:    VK_EXT_surface_maintenance1
info:    VK_KHR_get_surface_capabilities2
info:    VK_KHR_surface
info:    VK_KHR_win32_surface
warn:  Skipping CPU adapter: llvmpipe (LLVM 18.0.0, 256 bits)
info:  AMD Radeon RX 7800 XT (RADV NAVI32):
info:    Driver : radv 24.0.99
info:    Memory Heap[0]: 
info:      Size: 48083 MiB
info:      Flags: 0x0
info:      Memory Type[2]: Property Flags = 0x6
info:      Memory Type[5]: Property Flags = 0xe
info:      Memory Type[6]: Property Flags = 0xe
info:      Memory Type[8]: Property Flags = 0xc6
info:      Memory Type[10]: Property Flags = 0xce
info:    Memory Heap[1]: 
info:      Size: 16368 MiB
info:      Flags: 0x1
info:      Memory Type[0]: Property Flags = 0x1
info:      Memory Type[1]: Property Flags = 0x1
info:      Memory Type[3]: Property Flags = 0x7
info:      Memory Type[4]: Property Flags = 0x7
info:      Memory Type[7]: Property Flags = 0xc1
info:      Memory Type[9]: Property Flags = 0xc7
warn:  DXGI: Found monitors not associated with any adapter, using fallback
info:  Adapter LUID 0: 0:430
warn:  D3D11DeviceFeatures: External memory features not supported
info:  D3D11InternalCreateDevice: Maximum supported feature level: D3D_FEATURE_LEVEL_12_1
info:  D3D11InternalCreateDevice: Using feature level D3D_FEATURE_LEVEL_11_0
info:  Device properties:
info:    Device : AMD Radeon RX 7800 XT (RADV NAVI32)
info:    Driver : radv 24.0.99
info:  Enabled device extensions:
info:    VK_AMD_memory_overallocation_behavior
info:    VK_EXT_attachment_feedback_loop_layout
info:    VK_EXT_conservative_rasterization
info:    VK_EXT_custom_border_color
info:    VK_EXT_depth_bias_control
info:    VK_EXT_depth_clip_enable
info:    VK_EXT_extended_dynamic_state3
info:    VK_EXT_fragment_shader_interlock
info:    VK_EXT_graphics_pipeline_library
info:    VK_EXT_memory_priority
info:    VK_EXT_non_seamless_cube_map
info:    VK_EXT_robustness2
info:    VK_EXT_shader_module_identifier
info:    VK_EXT_shader_stencil_export
info:    VK_EXT_swapchain_maintenance1
info:    VK_EXT_transform_feedback
info:    VK_EXT_vertex_attribute_divisor
info:    VK_KHR_maintenance5
info:    VK_KHR_pipeline_library
info:    VK_KHR_swapchain
info:  Device features:
info:    robustBufferAccess                     : 1
info:    fullDrawIndexUint32                    : 1
info:    imageCubeArray                         : 1
info:    independentBlend                       : 1
info:    geometryShader                         : 1
info:    tessellationShader                     : 1
info:    sampleRateShading                      : 1
info:    dualSrcBlend                           : 1
info:    logicOp                                : 1
info:    multiDrawIndirect                      : 1
info:    drawIndirectFirstInstance              : 1
info:    depthClamp                             : 1
info:    depthBiasClamp                         : 1
info:    fillModeNonSolid                       : 1
info:    depthBounds                            : 1
info:    wideLines                              : 1
info:    multiViewport                          : 1
info:    samplerAnisotropy                      : 1
info:    textureCompressionBC                   : 1
info:    occlusionQueryPrecise                  : 1
info:    pipelineStatisticsQuery                : 1
info:    vertexPipelineStoresAndAtomics         : 1
info:    fragmentStoresAndAtomics               : 1
info:    shaderImageGatherExtended              : 1
info:    shaderClipDistance                     : 1
info:    shaderCullDistance                     : 1
info:    shaderFloat64                          : 1
info:    shaderInt64                            : 1
info:    variableMultisampleRate                : 1
info:    shaderResourceResidency                : 1
info:    shaderResourceMinLod                   : 1
info:    sparseBinding                          : 1
info:    sparseResidencyBuffer                  : 1
info:    sparseResidencyImage2D                 : 1
info:    sparseResidencyImage3D                 : 1
info:    sparseResidency2Samples                : 0
info:    sparseResidency4Samples                : 0
info:    sparseResidency8Samples                : 0
info:    sparseResidency16Samples               : 0
info:    sparseResidencyAliased                 : 1
info:  Vulkan 1.1
info:    shaderDrawParameters                   : 1
info:  Vulkan 1.2
info:    samplerMirrorClampToEdge               : 1
info:    drawIndirectCount                      : 1
info:    samplerFilterMinmax                    : 1
info:    hostQueryReset                         : 1
info:    timelineSemaphore                      : 1
info:    bufferDeviceAddress                    : 0
info:    shaderOutputViewportIndex              : 1
info:    shaderOutputLayer                      : 1
info:    vulkanMemoryModel                      : 1
info:  Vulkan 1.3
info:    robustImageAccess                      : 0
info:    pipelineCreationCacheControl           : 1
info:    shaderDemoteToHelperInvocation         : 1
info:    shaderZeroInitializeWorkgroupMemory    : 0
info:    synchronization2                       : 1
info:    dynamicRendering                       : 1
info:  VK_AMD_shader_fragment_mask
info:    extension supported                    : 0
info:  VK_EXT_attachment_feedback_loop_layout
info:    attachmentFeedbackLoopLayout           : 0
info:  VK_EXT_conservative_rasterization
info:    extension supported                    : 1
info:  VK_EXT_custom_border_color
info:    customBorderColors                     : 1
info:    customBorderColorWithoutFormat         : 1
info:  VK_EXT_depth_clip_enable
info:    depthClipEnable                        : 1
info:  VK_EXT_depth_bias_control
info:    depthBiasControl                       : 1
info:    leastRepresentableValueForceUnormRepresentation : 1
info:    floatRepresentation                    : 0
info:    depthBiasExact                         : 1
info:  VK_EXT_extended_dynamic_state3
info:    extDynamicState3AlphaToCoverageEnable  : 1
info:    extDynamicState3DepthClipEnable        : 1
info:    extDynamicState3RasterizationSamples   : 1
info:    extDynamicState3SampleMask             : 1
info:    extDynamicState3LineRasterizationMode  : 1
info:  VK_EXT_fragment_shader_interlock
info:    fragmentShaderSampleInterlock          : 1
info:    fragmentShaderPixelInterlock           : 1
info:  VK_EXT_full_screen_exclusive
info:    extension supported                    : 0
info:  VK_EXT_graphics_pipeline_library
info:    graphicsPipelineLibrary                : 1
info:  VK_EXT_line_rasterization
info:    rectangularLines                       : 1
info:    smoothLines                            : 1
info:  VK_EXT_memory_budget
info:    extension supported                    : 1
info:  VK_EXT_memory_priority
info:    memoryPriority                         : 1
info:  VK_EXT_non_seamless_cube_map
info:    nonSeamlessCubeMap                     : 0
info:  VK_EXT_robustness2
info:    robustBufferAccess2                    : 1
info:    robustImageAccess2                     : 1
info:    nullDescriptor                         : 1
info:  VK_EXT_shader_module_identifier
info:    shaderModuleIdentifier                 : 1
info:  VK_EXT_shader_stencil_export
info:    extension supported                    : 1
info:  VK_EXT_swapchain_colorspace
info:    extension supported                    : 0
info:  VK_EXT_swapchain_maintenance1
info:    swapchainMaintenance1                  : 1
info:  VK_EXT_hdr_metadata
info:    extension supported                    : 0
info:  VK_EXT_transform_feedback
info:    transformFeedback                      : 1
info:    geometryStreams                        : 1
info:  VK_EXT_vertex_attribute_divisor
info:    vertexAttributeInstanceRateDivisor     : 1
info:    vertexAttributeInstanceRateZeroDivisor : 1
info:  VK_KHR_external_memory_win32
info:    extension supported                    : 0
info:  VK_KHR_external_semaphore_win32
info:    extension supported                    : 0
info:  VK_KHR_maintenance5
info:    maintenance5                           : 1
info:  VK_KHR_present_id
info:    presentId                              : 0
info:  VK_KHR_present_wait
info:    presentWait                            : 0
info:  VK_NVX_binary_import
info:    extension supported                    : 0
info:  VK_NVX_image_view_handle
info:    extension supported                    : 0
info:  VK_KHR_win32_keyed_mutex
info:    extension supported                    : 0
info:  Queue families:
info:    Graphics : 0
info:    Transfer : 1
info:    Sparse   : 2
info:  Memory type mask for sparse resources: 0x7ad
warn:  DXVK: No state cache file found
info:  DXVK: Graphics pipeline libraries supported
info:  DXGI: VK_FORMAT_D24_UNORM_S8_UINT -> VK_FORMAT_D32_SFLOAT_S8_UINT
04a4:fixme:system:NtUserQueryDisplayConfig flags 0x2, paths_count 0x11be38, paths 0x12bd500, modes_count 0x11be3c, modes 0x12b7770, topology_id (nil) semi-stub
err:   readMonitorEdidFromKey: Failed to get EDID reg key size
err:   DXGI: Failed to parse display metadata + colorimetry info, using blank.
info:  AMD Radeon RX 7800 XT (RADV NAVI32):
info:    Driver : radv 24.0.99
info:    Memory Heap[0]: 
info:      Size: 48083 MiB
info:      Flags: 0x0
info:      Memory Type[2]: Property Flags = 0x6
info:      Memory Type[5]: Property Flags = 0xe
info:      Memory Type[6]: Property Flags = 0xe
info:      Memory Type[8]: Property Flags = 0xc6
info:      Memory Type[10]: Property Flags = 0xce
info:    Memory Heap[1]: 
info:      Size: 16368 MiB
info:      Flags: 0x1
info:      Memory Type[0]: Property Flags = 0x1
info:      Memory Type[1]: Property Flags = 0x1
info:      Memory Type[3]: Property Flags = 0x7
info:      Memory Type[4]: Property Flags = 0x7
info:      Memory Type[7]: Property Flags = 0xc1
info:      Memory Type[9]: Property Flags = 0xc7
warn:  DXGI: Found monitors not associated with any adapter, using fallback
04a4:fixme:system:NtUserQueryDisplayConfig flags 0x2, paths_count 0x11ba68, paths 0x12bd500, modes_count 0x11ba6c, modes 0x12b7920, topology_id (nil) semi-stub
err:   readMonitorEdidFromKey: Failed to get EDID reg key size
err:   DXGI: Failed to parse display metadata + colorimetry info, using blank.
04a4:fixme:system:NtUserSystemParametersInfo Unimplemented action: 59 (SPI_SETSTICKYKEYS)
04a4:fixme:system:NtUserSystemParametersInfo Unimplemented action: 53 (SPI_SETTOGGLEKEYS)
04a4:fixme:system:NtUserSystemParametersInfo Unimplemented action: 51 (SPI_SETFILTERKEYS)
04a4:fixme:wbemprox:client_security_SetBlanket 00006FFFFB097E80, 000000000031F5A0, 10, 0, (null), 3, 3, 0000000000000000, 0
04a4:fixme:wbemprox:client_security_Release 00006FFFFB097E80
04a4:fixme:wbemprox:enum_class_object_Next timeout not supported
warn:  DXGI: MakeWindowAssociation: Ignoring flags
info:  Presenter: Actual swap chain properties:
info:    Format:       VK_FORMAT_R8G8B8A8_UNORM
info:    Color space:  VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
info:    Present mode: VK_PRESENT_MODE_MAILBOX_KHR (dynamic: yes)
info:    Buffer size:  800x600
info:    Image count:  5
info:    Exclusive FS: 1
warn:  DXGI: MakeWindowAssociation: Ignoring flags
info:  DXVK: Using 24 compiler threads
0538:fixme:ver:GetCurrentPackageId (000000001C2FFF50 0000000000000000): stub
0534:fixme:avrt:AvSetMmThreadCharacteristicsW (L"Pro Audio",000000001C1FFE6C): stub
info:  Presenter: Actual swap chain properties:
info:    Format:       VK_FORMAT_R8G8B8A8_UNORM
info:    Color space:  VK_COLOR_SPACE_SRGB_NONLINEAR_KHR
info:    Present mode: VK_PRESENT_MODE_FIFO_KHR (dynamic: yes)
info:    Buffer size:  949x1004
info:    Image count:  5
info:    Exclusive FS: 1
0534:fixme:avrt:AvRevertMmThreadCharacteristics (0000000012345678): stub
047c:fixme:ver:GetCurrentPackageId (000000000021FEB0 0000000000000000): stub

Setting WAYLAND_DISPLAY and/or DISPLAY on the right side of gamescope command to various strings including blank, wayland-0 and gamescope-0 does not help like it does to Firefox for example (#808). Foregoing --expose-wayland doesn't help either as, as stated above, with this registry edit wine will ONLY use native wayland, which rules out the DISPLAY="" requirement and associated interfecences with gamescope.

I have observed the same behavior from at least one other user, and I'm waiting on a second. A quick and dirty way to get access to a precompiled wine with wayland driver ability if your distro does not offer it is to grab one of the binaries over at Tk-Glitch's wine-tkg avaiable for a variety of distros: link

gamescope: git master (dc81258cec01ad137056191b8db990adcbba6341) wine: 9.0.r2.ge045af48 ( TkG Staging Esync Fsync ) wm: sway 1.9-dev-ae33f4eb mesa: 24.1.0-devel (git-c3a64f8dd1) kernel: 6.7.1 (CachyOS)

sharkautarch commented 10 months ago

wayland_process_init Wayland compositor doesn't support wl_subcompositor

hmmm looks like wine is complaining that gamescope doesn’t implement wl_subcompositor, which apparently is a feature that allows applications to offload compositing-related work to the compositor.

Not sure if that is the sole reason wayland wine isn’t running w/ gamescope… But if it is the underlying issue, the two solutions I can think of would be either:

OR a partial solution (would only work in nested sessions, on wayland hosts):

KyunLFA commented 7 months ago

Since I won't be creating a new issue, I don't feel too bad tagging some potential parties of interest. Not requesting the feature here, it's just the data for posterity. If you are one of the tagged, please disregard if occupied or simply uninterested. Apologies in advance for pinging. Barebones UGLY HACKY diff for getting a window running in the post below. TL;DR in the end.

@Joshua-Ashton @emersion @romangg @sharkautarch

Here are the findings:

0 (skip if caught up). Originally this was about announcing that Wine waylanddrv wasn't rendering in Gamescope due to missing wl_subcompositor. See the reg edit above to enable on newer Wine.

  1. It already works on git HEAD. But only for nested, with an envvar override. Use gamescope --expose-wayland -- env WAYLAND_DISPLAY=wayland-foo wine PROGRAMHERE (foo = 0 for Plasma 6, 1 for Sway, depends on the compositor);

  2. wl_subcompositor is needed for embedded mode. It's very straightforward to "implement" in Gamescope;

  3. zwp_pointer_constraints_v1, turns out is another hard requirement that reared after wl_subcompositor. With a quick&dirty diff (subcompositor+contraints hack, see the post below), it's enough to render a window in embedded mode...

  4. ...That will quickly segfault on (an invisible) cursor movement. You may then think it would be due to hacky unimplemented constraints, yet after I attempted to port back https://github.com/ValveSoftware/gamescope/pull/28, although it proved too difficult to do properly with my extremely limited skills, turns out the cause of the segfaults was not the wrong contraints, but a C++ stdlib runtime throw, std::get bad variant access with a wrong index (full backtrace below), from xwayland() calls in steamcompmgr.cpp in MouseCursor::paint, in the following lines:

uint32_t sourceWidth = window->xwayland().a.width;
uint32_t sourceHeight = window->xwayland().a.height;

Additionally, after applying a hack to proceed, same throw in the lines:

scaledX = (winX - window->xwayland().a.x) * currentScaleRatio_x + cursorOffsetX;
scaledY = (winY - window->xwayland().a.y) * currentScaleRatio_y + cursorOffsetY;
  1. After hacking some resolution values to sourceWidth/Height and scaledX/Y, finally, at last we're rendering on Gamescope embedded without segfaulting, but since I could not implement valid pointer constraints, the cursor was stuck to the leftmost top side (only appears after moving);

  2. Visual bugs plague the window in my system. Some of the text flashes in and out, window elements may be drawn as black rectangles or flicker, window is never fullscreen (pillarboxed) unless it randomly is, and popups like context menus fill the window. Here I'm at a loss what is causing it;

  3. There is already a micro-compositor (Wayland kiosk) with Wine Wayland support (kind of)! That could be useful for figuring out exactly what is happening by checking their work. Cage, with the https://github.com/cage-kiosk/cage/pull/300 PR applied on top, renders a wine notepad.exe window correctly in fullscreen.

TL;DR. 1.Nested already works; 2.wl_subcompositor is missing; 3/5.zwp_pointer_constraints_v1 implementation is needed; 4.There's a C++ runtime throw in MouseCursor::paint; 6.Text and window elements flicker and black textures where there aren't any; 7.Cage Kiosk already works embedded, looking there may prove useful.

Note: I will be away from the PC soon, so likely I won't be able to reply for a few hours, so sorry.

KyunLFA commented 7 months ago

HACKHACKHACK

diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index 82dc230..29f58eb 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -27,8 +27,10 @@
 #include <wlr/render/wlr_renderer.h>
 #include <wlr/render/timeline.h>
 #include <wlr/types/wlr_compositor.h>
+#include <wlr/types/wlr_subcompositor.h>
 #include <wlr/types/wlr_keyboard.h>
 #include <wlr/types/wlr_pointer.h>
+#include <wlr/types/wlr_pointer_constraints_v1.h>
 #include <wlr/types/wlr_seat.h>
 #include <wlr/types/wlr_touch.h>
 #include <wlr/types/wlr_drm.h>
@@ -1594,6 +1596,10 @@ bool wlserver_init( void ) {

    wlserver.wlr.compositor = wlr_compositor_create(wlserver.display, 5, wlserver.wlr.renderer);

+   wlserver.wlr.subcompositor = wlr_subcompositor_create(wlserver.display);
+
+   wlserver.wlr.constraints = wlr_pointer_constraints_v1_create(wlserver.display);
+
    wl_signal_add( &wlserver.wlr.compositor->events.new_surface, &new_surface_listener );

    create_ime_manager( &wlserver );
diff --git a/src/wlserver.hpp b/src/wlserver.hpp
index aa018dd..020ea81 100644
--- a/src/wlserver.hpp
+++ b/src/wlserver.hpp
@@ -127,6 +127,8 @@ struct wlserver_t {

        struct wlr_renderer *renderer;
        struct wlr_compositor *compositor;
+       struct wlr_subcompositor *subcompositor;
+       struct wlr_pointer_constraints_v1 *constraints;
        struct wlr_session *session;
        struct wlr_seat *seat;
        struct wlr_linux_drm_syncobj_manager_v1 *drm_syncobj_manager_v1;
KyunLFA commented 7 months ago

Full backtrace of 4.:

#0  0x00007c826a4a053b in pthread_kill () at /usr/lib/libc.so.6
#1  0x00007c826a442048 in raise () at /usr/lib/libc.so.6
#2  0x00007c826a424478 in abort () at /usr/lib/libc.so.6
#3  0x00007c826a897b42 in __gnu_cxx::__verbose_terminate_handler () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#4  0x00007c826a8acbfc in __cxxabiv1::__terminate (handler=<optimized out>) at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:48
#5  0x00007c826a8acc69 in std::terminate () at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:58
#6  0x00007c826a8acefc in __cxxabiv1::__cxa_throw
    (obj=<optimized out>, tinfo=0x5c7e32737c00 <typeinfo for std::bad_variant_access>, dest=0x5c7e32528130 <std::bad_variant_access::~bad_variant_access()>)
    at /usr/src/debug/gcc/gcc/libstdc++-v3/libsupc++/eh_throw.cc:98
#7  0x00005c7e325280ed in std::__throw_bad_variant_access (__what=0x5c7e3237a1d0 "std::get: wrong index for variant")
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/variant:1325
#8  0x00005c7e32528067 in std::__throw_bad_variant_access (__valueless=false) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/variant:1333
#9  0x00005c7e32527ff3 in std::get<0ul, steamcompmgr_xwayland_win_t, steamcompmgr_xdg_win_t>
    (__v=std::variant<steamcompmgr_xwayland_win_t, steamcompmgr_xdg_win_t> [index 1] = {...})
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/variant:1692
#10 0x00005c7e32527fad in std::get<steamcompmgr_xwayland_win_t, steamcompmgr_xwayland_win_t, steamcompmgr_xdg_win_t>
    (__v=std::variant<steamcompmgr_xwayland_win_t, steamcompmgr_xdg_win_t> [index 1] = {...})
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/variant:1128
#11 0x00005c7e32521b9c in steamcompmgr_win_t::xwayland (this=0x5c7e604b4ec0) at ../gamescope/src/steamcompmgr_shared.hpp:141
#12 0x00005c7e324ec27f in MouseCursor::paint (this=0x7c8248248e50, window=0x5c7e604b4ec0, fit=0x0, frameInfo=0x7c82517ff350) at ../gamescope/src/steamcompmgr.cpp:1998
#13 0x00005c7e324fbf19 in paint_all (async=false) at ../gamescope/src/steamcompmgr.cpp:2574
#14 0x00005c7e324f9428 in steamcompmgr_main (argc=5, argv=0x7ffd1068d8c8) at ../gamescope/src/steamcompmgr.cpp:7886
#15 0x00005c7e32552d8f in steamCompMgrThreadRun (argc=5, argv=0x7ffd1068d8c8) at ../gamescope/src/main.cpp:933
#16 0x00005c7e325538fa in std::__invoke_impl<void, void (*)(int, char**), int, char**>
    (__f=@0x5c7e6050d3a8: 0x5c7e32552d60 <steamCompMgrThreadRun(int, char**)>, __args=@0x5c7e6050d3a0: 5, __args=@0x5c7e6050d398: 0x7ffd1068d8c8)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/invoke.h:61
#17 0x00005c7e32553865 in std::__invoke<void (*)(int, char**), int, char**>
    (__fn=@0x5c7e6050d3a8: 0x5c7e32552d60 <steamCompMgrThreadRun(int, char**)>, __args=@0x5c7e6050d3a0: 5, __args=@0x5c7e6050d398: 0x7ffd1068d8c8)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/invoke.h:96
#18 0x00005c7e32553833 in std::thread::_Invoker<std::tuple<void (*)(int, char**), int, char**> >::_M_invoke<0ul, 1ul, 2ul> (this=0x5c7e6050d398)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/std_thread.h:292
#19 0x00005c7e325537e5 in std::thread::_Invoker<std::tuple<void (*)(int, char**), int, char**> >::operator() (this=0x5c7e6050d398)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/std_thread.h:299
#20 0x00005c7e32553669 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (*)(int, char**), int, char**> > >::_M_run (this=0x5c7e6050d390)
    at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/13.2.1/../../../../include/c++/13.2.1/bits/std_thread.h:244
#21 0x00007c826a8f3843 in std::execute_native_thread_routine (__p=0x5c7e6050d390) at /usr/src/debug/gcc/gcc/libstdc++-v3/src/c++11/thread.cc:104
#22 0x00007c826a49e55c in ??? () at /usr/lib/libc.so.6
#23 0x00007c826a52b95c in ??? () at /usr/lib/libc.so.6
KyunLFA commented 6 months ago

Update!! Wine wayland on embedded mode progress thanks to @sharkautarch !! The solution (for now) of the bad variant access was adding && input->type == steamcompmgr_win_type_t::XWAYLAND to the line if (input && !bForceHideCursor in steamcompmgr.cpp!! Will now move on to attempt to get a working cursor... Updates to be posted shortly over at my fork.

edit: Nope, couldn't get a working cursor :/ Not skilled enough atm

KyunLFA commented 5 months ago

I just realized, setting WAYLAND_DISPLAY to something other than gamescope's wayland display just runs the app without gamescope :/