Skip to content

Conversation

@itz-me-zappex
Copy link

@itz-me-zappex itz-me-zappex commented Feb 11, 2025

Description

Finally, after previous two PRs I have created (and closed) with chunky workarounds and wild activity in #701, I have found solution and figured out that root of issue is bugged rectangles of child windows (1x1+0+0), which are created by OpenGL games running through Wine/Proton (e.g. Geometry Dash) and even native ones running through Steam (e.g. native Terraria). That does not happen with OpenGL games running completely natively (i.e. w/o Steam container) and does not happen with Vulkan games at all as those are have proper rectangles on child windows as xwininfo -tree -root shows, so solution oriented only at that specific case.

Solution

So, the best way I found to solve this, is just not override currently handled window rectangles with new (child) ones if those are bugged (i.e. resolution of child reported as 1x1), that makes muffin use parent window rectangles which are correct.

That "filter" should be used two times:

  1. in window.c: to allow FLIP unredirection for such windows by handling those with proper rectangles.
  2. in window-x11.c: to avoid unredirection breakage if window mode appears changed e.g. from fullscreen to windowed and back, or when OSD stuff draws over unredirected window.

Also I fixed issue in meta-surface-actor-x11.c related to handling internal unredirect requests if "Disable compositing for full-screen windows" disabled in settings (or through dconf), as those requests always have been handled and fullscreen windows were unredirected.

Closes #701.

@ndiruhniu
Copy link

@mtwebster

@itz-me-zappex
Copy link
Author

itz-me-zappex commented Mar 17, 2025

Update on this, I noticed that screen recording software like OBS Studio breaks in-game VSYNC and enforces BLIT rendering until I close screen recorder in case with such buggy windows, I figured out that I also should avoid overriding of window->depth if window has 1x1 size to prevent this issue from happening (and window->xvisual just in case, but that is not real reason of this issue).

@Enokilis
Copy link

Would it also be possible to fix the root of the issue?
Why does Proton/Wine create a 1x1 window in the first place? I can actually see it in the corner, manifesting as the desktop's background color.

@itz-me-zappex
Copy link
Author

itz-me-zappex commented Mar 29, 2025

Just merged and summarized commits.

@itz-me-zappex
Copy link
Author

As far as I understand, fixing it not planned at all, right? To be more correct - workarounding. And #701 issue is still opened for around 9 months and successfully ignored by development team.

I have found report on Wine's Bugzilla created in 2021
https://bugs.winehq.org/show_bug.cgi?id=50717

And my changes aimed to ignore this 1x1 window, otherwise window will not be unredirected, so that compositor will reduce performance and cause microstuttering on monitor side.

I can confirm that is weird that native games from Steam also have the same issue. And again, I will add that issue is not reproducible with games using Vulkan API (including those running with DXVK or VKD3D), only OpenGL stuff suffers from that.

In case someone uses Arch Linux like me, you can build and install my fork:

# Official PKGBUILD from Arch Linux GitLab
git clone https://gitlab.archlinux.org/archlinux/packaging/packages/muffin

# Go to directory with PKGBUILD
cd muffin/

# Install build dependencies, download and extract source code 
makepkg --syncdeps --nobuild

# Replace extracted source code with one from my fork
rm -rf src/muffin-6.4.1
git clone https://github.com/itz-me-zappex/muffin-fixed-unredirection.git src/muffin-6.4.1

# Build and install
makepkg -i

Or just modify PKGBUILD by skipping checksums and replacing source with one from my repository.

After installation press Ctrl+Alt+Esc to apply changes.

@Enokilis
Copy link

Followed the steps, but I still see a visible 1x1 window in the corner and get no flipping.

@itz-me-zappex
Copy link
Author

Followed the steps, but I still see a visible 1x1 window in the corner and get no flipping.

1x1 window will not disappear.

About flipping, make sure in that you have "Allow flipping" and "Show API indicator" enabled in nvidia-settings app.

The most important: open system settings, then go to General and enable unredirection of fullscreen windows, now this switcher works as it should (in vanilla code this setting appears ignored so that windows appear unredirected despite setting turned on or off).

@itz-me-zappex itz-me-zappex changed the title Fix broken unredirection for OpenGL Wine/Proton and native Steam games, fix ignoreance of disallowed unredirection. [X11] Workaround 1x1 Wine window to allow unredirect, fix not working setting responsible for unredirect. May 25, 2025
@voron00
Copy link

voron00 commented Jun 13, 2025

+1 for this, without this patch gsync isn't working in games.

@clefebvre
Copy link
Member

Thanks for looking into this!

I disagree with the change in src/compositor/meta-surface-actor-x11.c. The configuration option org.cinnamon.muffin unredirect-fullscreen-windows default to False and it's not phrased in a way that means that all windows should be composited by default.

In fact, it kinda implies the opposite.. that muffin knows best by default, and that enabling it prevents composition on all fullscreen apps (which even isn't true, since there are exceptions there as well).

@clefebvre
Copy link
Member

When it's set to False (by default) it composites most fullscreen windows, but not all of them. For instance if a window specially requests to be unredirected, it doesn't composite it. I believe that's a good default for most people.

When it's set to True, it lets most windows be unredirected, but again with some exceptions.

It's a safe setting, not a setting that really empowers the user to force anything for all fullscreen windows. If we want to give users more control over this, or let them troubleshoot better, we need to rethink the configuration options.

I don't agree with changing the default behavior but I'm open to making this easier to troubleshoot and offer options which give users more control.

One way could be to provide a combo instead of just a toggle, with 4 options instead of just 2. Composite-all, composite-most (default, equivalent to false right now), composite-few (equivalent to true right now), composite-none.

Another way could be to list recent windows and let users enforce compositing or unredirection for specific windows.

All in all though, I think that's a feature improvement and it's unlikely to be ready right now for 6.6. It should be considered separate from the issue at hand here, which is how we handle these 1x1px windows.

@itz-me-zappex
Copy link
Author

Okay, no problem, I will revert changes in src/compositor/meta-surface-actor-x11.c.

@itz-me-zappex itz-me-zappex changed the title [X11] Workaround 1x1 Wine window to allow unredirect, fix not working setting responsible for unredirect. [X11] Workaround 1x1 Wine window to allow unredirect. Nov 26, 2025
@clefebvre clefebvre changed the title [X11] Workaround 1x1 Wine window to allow unredirect. [WIP] [X11] Workaround 1x1 Wine window to allow unredirect, fix not working setting responsible for unredirect. Nov 26, 2025
@mtwebster
Copy link
Member

Hi I did some testing on this. For now I reverted the repositioning of that settings check so I could see just how the 1x1 workarounds would affect things.

I can see it had an impact with Geometry Dash, but every other game I've tested (so far) unredirects fine at fullscreen on git master, or wouldn't unredirect, and neither version made a difference.

I also observed the check in meta_window_x11_configure_notify() running into unrelated windows, which was puzzling (but didn't seem to cause an issue).

I'm sort of leaning into trying to make it a bit easier to force a window to un-redirect, as it seems as though there will always be exceptions. I worry about side effects of these small workarounds with other applications (who may also be doing odd things with windows).

@itz-me-zappex
Copy link
Author

itz-me-zappex commented Nov 27, 2025

Hi I did some testing on this. For now I reverted the repositioning of that settings check so I could see just how the 1x1 workarounds would affect things.

Hi, I already reverted changes related to handling unredirect and kept only workaround.

I can see it had an impact with Geometry Dash, but every other game I've tested (so far) unredirects fine at fullscreen on git master, or wouldn't unredirect, and neither version made a difference.

Yes, especially noticeable in Geometry Dash, this is why I started figuring with this out, and as I said in PR's description, issue affects all OpenGL games running through Wine/Proton (Lutris, Steam, Heroic etc.), and even native ones that running from Steam (those are FNA by the way). No idea why to be honest. Vulkan/DXVK/VKD3D games are not affected, WINED3D also not affected, despite a fact this is OpenGL.

Affected OpenGL games in my testing:

  • Wolfenstein: The New Order (Proton)
  • Geometry Dash (Proton)
  • Terraria (native version from Steam, FNA issue?)
  • Starbound (same as with Terraria)

Other games in my libraries using DXVK/VKD3D, so nothing to test anymore.

And I did not check master branch for now, still using outdated source existing in forked repo, will try update on weekends.

I also observed the check in meta_window_x11_configure_notify() running into unrelated windows, which was puzzling (but didn't seem to cause an issue).

¯\_(ツ)_/¯

I'm sort of leaning into trying to make it a bit easier to force a window to un-redirect, as it seems as though there will always be exceptions. I worry about side effects of these small workarounds with other applications (who may also be doing odd things with windows).

When I tinkered with source code (two previous PRs were shitty so I closed them), I noticed that I could not obtain proper window rectangles "manually" using already existing functions (i.e. explicitly, not using ones from event) of parent window when 1x1 window appears. This is why I tried to get those directly from X11.

I still did not notice any side effect of this workaround (despite a fact xwininfo -tree -root shows a lot of 1x1 windows), but yeah, needs more testing, I remember I have seen one PR here which fixed similar issue and caused system lock up on some systems.

Here is one guy who did not report any issue on this workaround and said it fixed not working GSYNC (makes a sense, because window should be unredirected for this), and this comment has 2 thumbs up (mine does not count). Here.

@itz-me-zappex
Copy link
Author

Probably we need to create a function that checks for whether window has 1x1px rectangles or not, so in case something it will be easy to find this workaround in the code, also because these checks look ugly.

@itz-me-zappex itz-me-zappex changed the title [WIP] [X11] Workaround 1x1 Wine window to allow unredirect, fix not working setting responsible for unredirect. [WIP] [X11] Workaround 1x1 Wine window to allow unredirect. Nov 27, 2025
@itz-me-zappex
Copy link
Author

itz-me-zappex commented Nov 27, 2025

Update: installed latest release from releases page (it matches master branch for now, 6ea2c8c), and no issue with native Terraria anymore (don't have Starbound installed now), but Wolfenstein: The New Order, Kingdom Rush(es) and Geometry Dash are still blitting (using BLIT instead of FLIP), those running through Proton.

I'm on Arch, PKGBUILD I used is here:

# Maintainer: Bruno Pagani <[email protected]>
# Contributor: Eli Schwartz <[email protected]>
# Contributor: Alexandre Filgueira <[email protected]>
# Contributor: Adam Hani Schakaki <[email protected]>
# Contributor: Ner0

pkgname=muffin
pkgver=6.4.1
pkgrel=1
pkgdesc="Cinnamon window manager based on Mutter"
arch=(x86_64)
url="https://github.com/linuxmint/${pkgname}"
license=(GPL)
depends=(cinnamon-desktop gobject-introspection-runtime libcanberra libinput
         libsm libxkbcommon-x11 startup-notification zenity graphene pipewire xorg-xwayland)
makedepends=(meson intltool gobject-introspection wayland-protocols glib2-devel egl-wayland)
options=(!emptydirs)
source=(https://github.com/linuxmint/muffin/archive/refs/tags/master.mint22.tar.gz)
sha256sums=('SKIP')
b2sums=('SKIP')

build() {
  arch-meson build muffin-master.mint22 -D egl_device=true -D wayland_eglstream=true
  meson compile -C build
}

package() {
  meson install --destdir="${pkgdir}" -C build
}

P.S.: Vanilla Proton 10.0-3, exactly the same behavior as on Proton 8.0 and 9.0. Neither Valve nor Wine developers seem going to fix this in proper way.

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

Successfully merging this pull request may close these issues.

Wine Fullscreen Apps are not Unredirected Correctly

6 participants