Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xe/rendervulkan] - No visible image in the DRM backend #1742

Open
3 of 6 tasks
matte-schwartz opened this issue Feb 7, 2025 · 4 comments
Open
3 of 6 tasks

[Xe/rendervulkan] - No visible image in the DRM backend #1742

matte-schwartz opened this issue Feb 7, 2025 · 4 comments

Comments

@matte-schwartz
Copy link

matte-schwartz commented Feb 7, 2025

Is there an existing issue for this?

  • I have searched the existing issues

Are you using any gamescope patches or a forked version of gamescope?

  • The issue occurs on upstream gamescope without any modifications

Current Behavior

On Intel's Xe kernel driver, gamescope does not present a visible image while using the DRM backend. Downstream ChimeraOS has worked around this by removing

gamescope/src/steamcompmgr.cpp

Lines 2456 to 2482 in bafa157

else if ( !GetBackend()->UsesVulkanSwapchain() && GetBackend()->IsSessionBased() )
{
auto tex = vulkan_get_hacky_blank_texture();
if ( tex != nullptr )
{
// HACK! HACK HACK HACK
// To avoid stutter when toggling the overlay on
int curLayer = frameInfo.layerCount++;
FrameInfo_t::Layer_t *layer = &frameInfo.layers[ curLayer ];
layer->scale.x = g_nOutputWidth == tex->width() ? 1.0f : tex->width() / (float)g_nOutputWidth;
layer->scale.y = g_nOutputHeight == tex->height() ? 1.0f : tex->height() / (float)g_nOutputHeight;
layer->offset.x = 0.0f;
layer->offset.y = 0.0f;
layer->opacity = 1.0f; // BLAH
layer->zpos = g_zposOverlay;
layer->applyColorMgmt = g_ColorMgmt.pending.enabled;
layer->colorspace = GAMESCOPE_APP_TEXTURE_COLORSPACE_LINEAR;
layer->ctm = nullptr;
layer->tex = tex;
layer->filter = GamescopeUpscaleFilter::NEAREST;
layer->blackBorder = true;
}
and I think Bazzite puts it behind a convar.

Steps To Reproduce

  1. Enter gamescope -- vkcube or gamescope-session on an Intel GPU running drm/xe

Hardware information

- Distro: CachyOS (Arch Linux)
- APU: Intel Core Ultra 7 258V
- Driver Version: Mesa 24.3.4, mesa-git

Software information

- Desktop environment: N/A
- Session type: DRM backend
- Gamescope version: git from https://github.com/ValveSoftware/gamescope/commit/bafa15766a3488c3c59ef2b558891ae1e26d6efa
- Gamescope launch command(s): gamescope --prefer-output '*,eDP-1' --xwayland-count 2 --default-touch-mode 4 --hide-cursor-delay 3000 --fade-out-duration 200 --steam -R /run/user/1000/gamescope.IwZwiln/startup.socket -T /run/user/1000/gamescope.IwZwiln/stats.pipe

Which gamescope backends have the issue you are reporting?

  • Wayland (default for nested gamescope)
  • DRM (default for embedded gamescope, i.e. gamescope-session)
  • SDL
  • OpenVR

Logging, screenshots, or anything else

This is upstream gamescope's logging where an image is never visible: https://gist.github.com/matte-schwartz/d73baaa86ee1b66ca952eb73976c9c7e

Patched gamescope's logging where it does eventually show a visible image: https://gist.github.com/matte-schwartz/329b50fa9a47c7b36684aebe10972193

@matte-schwartz
Copy link
Author

also: drm_info.log for reference

@matte-schwartz matte-schwartz changed the title [Intel] - No visible image in the DRM background, can only be averted by not using vulkan_get_hacky_blank_texture [Xe] - No visible image in the DRM background, can only be averted by not using vulkan_get_hacky_blank_texture Feb 14, 2025
@matte-schwartz
Copy link
Author

after looking into this further I get the impression this is a drm/xe bug specifically so I've reported it upstream accordingly: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4292

will keep this open for now for tracking purposes on our side

@matte-schwartz matte-schwartz changed the title [Xe] - No visible image in the DRM background, can only be averted by not using vulkan_get_hacky_blank_texture [Xe] - No visible image in the DRM backend, can only be averted by not using vulkan_get_hacky_blank_texture Feb 14, 2025
@matte-schwartz
Copy link
Author

see for the fix we're working on for this here: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12633, closing as not a gamescope issue

@matte-schwartz
Copy link
Author

the first possible fix for this issue was a patch to mesa that marked any images with format modifiers set as scanout: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/4292#note_2784316. this is specifically the patch I've been using in mesa on my lunar lake device for gamescope-session.

after discussions with Mesa and kernel developers, it seems like the consensus is that gamescope is not creating VkImages with swapchains per https://gitlab.freedesktop.org/mesa/mesa/-/issues/12633#note_2804858 which is causing issues with ANV

another possible fix for this that was proposed today is master...jxzgithub:gamescope:add-mesa-wsi-mem-alloc-info which patches gamescope rather than mesa. i can confirm that this patch in gamescope also lets you use both direct scanout and composition within gamescope-session on Xe. however, concerns were brought up that it was too fragile.

@matte-schwartz matte-schwartz changed the title [Xe] - No visible image in the DRM backend, can only be averted by not using vulkan_get_hacky_blank_texture [Xe/rendervulkan] - No visible image in the DRM backend Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant