Slashdot Mirror


A Proposal To Fix the Full-Screen X11 Window Mess

jones_supa writes "The SDL developers Ryan Gordon and Sam Lantinga have proposed a window manager change to work out the full-screen X11 window mess, primarily for games. The proposal is to come up with a _NET_WM_STATE_FULLSCREEN_EXCLUSIVE window manager hint that works out the shortcomings of the full-screen hint used currently by most games, _NET_WM_STATE_FULLSCREEN. Ryan and Sam have already worked out an initial patch for SDL but they haven't tried hooking it to any window manager yet. Those interested in the details, information is available from this mailing list message. One of the key changes is that software would make the request to the window manager to change the resolution, rather than tapping RandR or XVidMode directly. Martin Gräßlin of KDE was rather wary about the patch and said that games changing the resolution just tend to mess up the desktop." Seems like a reasonable idea, given a bit of time to mature as a spec. In KDE's case, a separate daemon from the window manager handles resolution changes so going through the WM would add complexity, and the plasma shell still has no way to realize that it shouldn't reflow the desktop widgets. Setting window properties seems like a sensible IPC method for communicating intent though (without making yet another aspect of the X desktop reliant upon the not-very-network-transparent dbus): "hey, I need to resize, but just for me so don't reshuffle the desktop and docks."

31 of 358 comments (clear)

  1. Hilarious excuses by dnaumov · · Score: 5, Insightful

    Martin Gräßlin of KDE was rather wary about the patch and said that games changing the resolution just tend to mess up the desktop.

    So, ugh... fix your desktop?

    1. Re:Hilarious excuses by Kjella · · Score: 4, Insightful

      The desktop doesn't know what caused the changes, so you could run into a lot of strange issues. Imagine you lay out your desktop on a 30" 2560x1440 monitor, then switch to a 1920x1080 monitor and added/removed/moved an icon. What happens when you reattach the first monitor, should everything just "snap back" to the places it had - even if you'd arranged your icons completely differently now? To me the solution outlined here seems much smarter, just let the game have it's own "screen" with its own settings, no need to even tell the other windows about it.

      --
      Live today, because you never know what tomorrow brings
    2. Re:Hilarious excuses by Anonymous Coward · · Score: 4, Informative

      This is the exact purpose of this proposal, to create a new signal that would tell the window manager that the change is temporary and only takes effect while a specific window has focus. This way they window manager would know there's no need even to move the icons in the first place.

    3. Re:Hilarious excuses by dgatwood · · Score: 5, Interesting

      Why don't games just spawn a separate X11 window server instance with a different resolution on a separate VC? Adding proper resource sharing between X11 instances seems like it would be a lot easier to do than rearchitecting all the existing apps to do the right thing during a temporary resolution change.

      And there's no benefit to a full-screen app running in the same X11 instance as any other app other than making it possible to transition a window from being a normal window to a full screen window and back, and with a resolution change, that won't work very well anyway, which makes even that argument mostly moot.

      --

      Check out my sci-fi/humor trilogy at PatriotsBooks.

    4. Re:Hilarious excuses by Lord+Byron+II · · Score: 3, Insightful

      It's not that I don't trust the LCD. It's that when you change the resolution, you tend to screw other things up as well.

      I have three monitors and I game on the center one. I like to keep my email and IRC open on the other ones while I play. But if the game adjusts the resolution, the positions of the other windows move around and I can no longer see all of them. This happens in Windows if the game doesn't run at the same resolution as my center monitor.

    5. Re:Hilarious excuses by tyrione · · Score: 4, Insightful

      Why don't games just spawn a separate X11 window server instance with a different resolution on a separate VC? Adding proper resource sharing between X11 instances seems like it would be a lot easier to do than rearchitecting all the existing apps to do the right thing during a temporary resolution change.

      And there's no benefit to a full-screen app running in the same X11 instance as any other app other than making it possible to transition a window from being a normal window to a full screen window and back, and with a resolution change, that won't work very well anyway, which makes even that argument mostly moot.

      Why the hell should the user suffer with resource expansion taken up by X because the damn paradigm is a big pile of hurt that goes back to the early days? I remember all the arrogance of X windows during NeXT's days and decisions with Display Postscript. It's rather clear the NeXT design has always been superior and OS X benefits from it.

    6. Re:Hilarious excuses by hairyfeet · · Score: 4, Insightful

      You do have to admit though its ironic as hell that everyone here complains about "Windows cruft" and yet here we are talking about an obviously creaky backwards ass design going back all the way to the days of NeXT and you have people defending it or coming up with sucky workarounds rather than just admit its broken and probably needs replacing after all these years.

      I mean c'mon guys, X11 has had a good run but it should probably be in the same group as Gopher and Telnet, things you can install when you need legacy support, not something everyone is depending on.

      --
      ACs don't waste your time replying, your posts are never seen by me.
    7. Re:Hilarious excuses by serviscope_minor · · Score: 5, Insightful

      I mean c'mon guys, X11 has had a good run but it should probably be in the same group as Gopher and Telnet,

      Aw geez not this crap again.

      Why whenever anything new comes up do a shrill group of people start shreiking omg omg x11 is so old omg omg scrap it omg omg we can't possibly make a minor tweak to fix a minor problem omg omg omg legacy omg omg omg bloat ong oh the legacy omg won't someone please THINK OF THE CHILDREN omg legacy.

      Without ever stopping to *THINK*.

      Just stop and think. Not about X11, but about any GUI system.

      The GUI runs at the monitor's maximum resolution. Things like windows are spread out over the whole area, as perhaps are icons, widgets etc.

      If the user reduces resolution, a common thing to do is to move all the windows into the new area, otherwise they may become inaccessible.

      So far so good. Nothing specific about X11 in there.

      Any good system will have a protocol or API for changing resolutions so 3rd parts resolution changing programs are possible to write.

      So far so good.

      But in some cases you don't want to rearrange the windows because the resolution change is temporary, so you need to have an extra flag which tells the system that it's temporary and not to bother.

      OK, still nothing about X11 in there.

      Now this is a proposal to add such a flag using a mechanism for adding such flags which has been standardised since 1985. And it will work smoothly and be completely backwards compatible.

      IOW the design of X11 is ideal for this kind of change and it shows how solid the underlying design is.

      Nothing breaks. No need to have a ChangeResolution and ChangeResolution2 API, no need to deprecate the old API no need to break anything.

      Seriously if you scrapped the entire GUI and rendering system whenever a minor tewak is needed you'd never get anywhere.

      --
      SJW n. One who posts facts.
  2. Music to my ears! by DaneM · · Score: 5, Interesting

    With Linux finally becoming a more "proper" gaming platform (i.e. Steam and others), it's "about time" that this is dealt with. _NET_WM_STATE_FULLSCREEN_EXCLUSIVE, where have you been my whole adult life? Gotta hand it to Ryan Gordon ("Icculus," as I recall) for consistently making Linux gaming that much more viable.

    1. Re:Music to my ears! by DaneM · · Score: 4, Informative

      I didn't see any information in the article, but what exactly is the problem with X11 full screen support? I don't game in Linux, and this is the first time I've even heard of this.

      The biggest issue is that when the game goes full-screen, it changes the resolution to whatever the game is set to--which may or may not be what you keep your desktop at. Then, when you exit the game, the icons are usually huge; the taskbars are usually all messed-up (even when "locked!"), and you have to futz around to make it usable again. Also, many games on Linux won't even let you Alt-Tab to other windows! Either nothing happens; or the resolution won't be correct; or the game crashes. It's really unpleasant to deal with. Also, it's worth noting that many games (especially Linux games, sadly) are extremely limited about what resolutions they'll let you use--so even if you want to set the game to your native resolution, it might not work or let you even try.

    2. Re:Music to my ears! by TheRaven64 · · Score: 4, Informative

      The article contained a lot of detail. The current mechanism is a two-step thing where the application first requests full-screen control from the WM. The WM then resizes the window to fit the current screen (which may not make the game happy), removes decorations, and then gets out of the way. Then the game changes the resolution and resizes the window again. The resolution change notification is delivered to the WM, which then propagates it to all of the applications, so if you want to play a fullscreen game at 640x480 then you may find that all of your application windows have resized themselves to fit in this screen when you exit it. The game then runs (hopefully) and if it crashes then in theory the WM is responsible for restoring the video mode, but in practice it doesn't know for certain that the game was responsible for changing it, so it may not.

      With the new proposal, the game resizes its window to the resolution it wants and then requests full screen mode. The WM should then change the screen resolution to the closest to the current window size and doesn't propagate the resolution change notification to any other applications. This means that nothing else gets resized. If the game crashes, or if you do any kind of switching out of the game, then the desktop resolution will be restored.

      And, while it's fashionable to hate X11, it's worth noting that Windows and OS X both suffer from some of the problems that this proposal is intended to fix.

      --
      I am TheRaven on Soylent News
  3. CRT's by mcelrath · · Score: 4, Insightful

    Who is still running a CRT? Who wants any program to change the resolution of their screen?

    This strikes me as the wrong solution to the problem: A program should instead request the "current monitor's resolution" (because there can be more than one!) set its display area to that size, and then tell the window manager to "fullscreen" it by removing title bar and border decorations and moving it to (0,0) of that monitor. But NEVER EVER RESIZE MY MONITORS. Thank you. The window manager should always be superior to the app, and one should always be able to manage the window (task switch, move to another desktop, etc) using the window manager, regardless of what the app thinks it is doing.

    --
    1^2=1; (-1)^2=1; 1^2=(-1)^2; 1=-1; 1=0.
    1. Re:CRT's by EvanED · · Score: 5, Insightful

      Who wants any program to change the resolution of their screen?

      Someone whose graphics card isn't up to the task of running a game at full native resolution? That'd be my guess anyway; I haven't willingly used a lower resolution for a while. (Some games don't support high resolutions, or don't support widescreen resolutions, and there it's "reasonable" that they change it as well. But a program like that probably wouldn't use that in the first place, so whatever.)

      The window manager should always be superior to the app, and one should always be able to manage the window (task switch, move to another desktop, etc) using the window manager, regardless of what the app thinks it is doing.

      I don't know enough about this proposal to say how it interacts with this (indeed, I'm rather disappointed by both the summary and TFA not actually, you know, saying what the problems are in the first place), but there's absolutely no reason why those goals are in conflict. In fact, the proposal specifically addresses this: "If the window loses input focus while fullscreen, the Window Manager MUST revert the resolution change and iconify the window until it regains input focus. The Window Manager MUST protect desktop state (icon positions, geometry of other windows, etc) during resolution change, so that the state will be unchanged when the window ceases to be marked as fullscreen."

    2. Re:CRT's by marcansoft · · Score: 5, Insightful

      This. I came here to say the same thing, but you already had. Every single modern graphics card is very efficient at scaling textures, and in fact, LCD scaling these days most often ends up happening on the GPU anyway. Don't touch my screen resolution. Ever. If the goal is to get better performance by rendering at a lower resolution, then render at a lower-resolution offscreen buffer and scale that up to the screen resolution.

      I wish Wine had a mode that did this for Windows games that expect to change the screen resolution and don't play well with Xinerama. These days I end up using the "virtual desktop" wine mode with per-game settings and KDE's window override support to put it on the right display head and remove the borders, but it's a suboptimal manual solution. The Linux game situation is slightly better (they tend to be configurable to respect the current resolution and usually get the display head right), but still don't have scaling support.

      Need inspiration? Do what video players (particularly mplayer) do. That is how fullscreen games should work.

    3. Re:CRT's by DRJlaw · · Score: 4, Interesting

      Who is still running a CRT?

      This is not a CRT-only problem.

      Who wants any program to change the resolution of their screen?

      Gamers.

      This strikes me as the wrong solution to the problem:

      Not surprising, since you're ignoring the underlying problem. Your 2560x1600 desktop on that 30" LCD is going to kill the ability of your videocard to display a modern game at an acceptable frame rate. Many gamers will not accept windowed half-screen (or whatever fraction is required) gaming on their $1K LCD.

      A program should instead request the "current monitor's resolution" (because there can be more than one!) set its display area to that size, and then tell the window manager to "fullscreen" it by removing title bar and border decorations and moving it to (0,0) of that monitor. But NEVER EVER RESIZE MY MONITORS.

      No. Windows and OSX have figured this out. Linux window managers (at least one popular one) need to as well.

      The window manager should always be superior to the app, and one should always be able to manage the window (task switch, move to another desktop, etc) using the window manager, regardless of what the app thinks it is doing.

      Irrelevant to your desired scheme, where keyboard hotkeys would still be required. In Windows and OSX you can still task switch, move to another desktop, etc. using such hotkeys. Yet the game controls the resolution of the monitor in fullscreen mode.

    4. Re:CRT's by Carewolf · · Score: 3, Insightful

      Not surprising, since you're ignoring the underlying problem. Your 2560x1600 desktop on that 30" LCD is going to kill the ability of your videocard to display a modern game at an acceptable frame rate. Many gamers will not accept windowed half-screen (or whatever fraction is required) gaming on their $1K LCD.

      No, you are missing his point. There is no reason the game could not run at a lower resolution and be scaled by the WM, instead relying on the screen to do the rescaling. Only CRTs are able to do rescaling physically, LCDs end up doing it in software anyway and usually in a crappier maner than what the WM could do.

    5. Re:CRT's by mcelrath · · Score: 3, Informative

      Someone whose graphics card isn't up to the task of running a game at full native resolution?

      For the myriad of responses that brought up this point: the answer is video card hardware scaling. E.g. add a flag _NET_WM_STATE_SCALING_ALLOWED which directs the WM to use hardware scaling from a fixed-size framebuffer, as is done by video players. Not only can you make it full screen, but you can resize it to any arbitrary shape and size (e.g. don't cover your widget bar, etc). Then the Window Manager decides what is "fullscreen". It could even make an app span more than one monitor when "fullscreen", or just one.

      --
      1^2=1; (-1)^2=1; 1^2=(-1)^2; 1=-1; 1=0.
    6. Re:CRT's by UnknownSoldier · · Score: 3, Insightful

      > This strikes me as the wrong solution to the problem: .. set its display area to that size
      *sigh*

      It is sad to see you unfortunately don't know what you the hell you are talking about. Let me explain:

      There are these precious little things called RAM, Video Memory, Video Buffers, DMA speed, and Scaling.

      Games typically use _at least_ *four* buffers:

      * Frame Buffer Front (32-bit)
      * Frame Buffer Back (32-bit)
      * Depth Buffer (24-bit)
      * Stencil Buffer (8-bit)

      Why should the Window Manager force the app to *over* allocate memory say @ 1920x1080 when the user has selected 640x480??

      That is, why would you have the GPU waste a total of 24 MB (8 MB FB Front + 8 MB Back + 6 MB Depth + 2 MB Stencil) compared to ONLY needing 3.6 MB (1200K + 1200K + 900K + 300K) ??

      More memory allocated for the buffers means you have LESS resident textures on the GPU.

      Also, By using a native (lower) resolution you force the monitor to use native *hardware* up-scaling.

      > and then tell the window manager to "fullscreen"
      And this is done for "free" in your fantasy world??

      Why would you force the GPU to do *extra* work of texture-copy up-scaling when it doesn't need to one in the first place if you are running at a 1:1 resolution at full-screen??

      > set its display area to that size, and then tell the window manager to "fullscreen" it by removing title bar and border decorations and moving it to (0,0) of that monitor.

      That is called "Windowed No Border Mode"

      i.e. Gamers want _3_ choices

      * Full-Screen (change resolution)
      * Windowed (don't change resolution)
      * Windowed No Border (don't change resolution)

      Lastly SOME games do NOT support arbitrary resolutions. I *want* them to fill my 22" monitor at whatever resolution they DO support. The *fonts* and the rest of the UI elements are BIGGER and easier to see when running in full-screen mode.

      Likewise, games that *only* run in full-screen mode are BADLY DESIGNED.

      The *proper* thing to do is to give the _user_ choice: Namely the 3 I listed above.

      Hope this helps explains some of the issues and WHY this solution is The Right Thing.

    7. Re:CRT's by obarthelemy · · Score: 4, Insightful

      This is a very nice example of what is wrong with Linux. Not the actual problem. The attitude towards the problem and the users who experience it.

      --
      The Cloud - because you don't care if your apps and data are up in the air.
  4. No assistance required by OhANameWhatName · · Score: 3, Funny

    Martin Gräßlin of KDE was rather wary about the patch and said that games changing the resolution just tend to mess up the desktop

    KDE doesn't need the help.

  5. Dump X by Anonymous Coward · · Score: 5, Insightful

    I still think X needs to go. For truely forward thinking, it needs to be replaced. Just look at Andriod. Andriod would not be useful if it was forced to use X.

    Frankly, X does too many things that too few people need. It was designed for a different era and it scales to modern workflows very clumsily. Multi-monitor desktops and gaming on windows is effortless. On X it's frankly a chore.

    Sorry, no, network transperancy is not an important feature anymore. Probalby implemented by .001% of regular users. VNC/RDP style remote access is the way it's done now. An no, nobody cares if it's tehnically inferior. It's hundreds of times easier to implment and use.

    Modern toolkits pretty much ignore 95% of X's built in features an just pass bitmaps.

    Yeah, X has lots of cool things but you have to realize most of them are impractical or unnecessary. Today we really have the memory, computational power, and bandwith to bang whatever we want on to the screen with out any trouble. The latency and overhead X present are the enemies today.

    Now stop. - Yes you, stop. I know you're about to type up a 10 paragraph screed about how you ported X ap to obscure platform Y, or remotely managed 10,000 servers with facial twitches and GTK. Just stop. Your use case does not represent the vast majority of computer users. It doesn't even represent a full fraction of a percent.

    Legacy baggage and clinging to old ideas spawned x.org. The same thing is what will spawn whatever is to replace X.

    1. Re:Dump X by Anonymous Coward · · Score: 3, Insightful

      This is a lot of FUD.

      Android. Look at the N9 with an award winning UI. It uses X and is really cool (on outdated hardware).

      Network transparency is really useful. VNC/RDP sucks compared to X. And I don't see how it is
      easier to use than X. Maybe there are more GUI for it that make it easier for beginners, but that
      is not for any technical reasons.

      I don't see what overhead X causes. I worked fine decades ago. Latency is an issue over the network,
      but only because the toolkits never cared about that. It's not a problem on a LAN and can also
      be solved with a (local) proxy.

      My use case does not interest you? That was never the Linux philosophy. Please go back to Windows.

      Legacy baggage. There is no legacy baggage. There are some APIs which are not used anymore by
      modern application, but that does not hurt anybody.

  6. Re: rendering lower then scaling up to native by brion · · Score: 5, Interesting

    This is exactly how some games work on Mac OS X, for instance Source-based games like Portal and Half-Life 2. They don't muck with the actual screen resolution, but just render into an offscreen buffer at whatever resolution ant blit it stretched to the full screen. Switching from the game back to other apps doesn't disturb the desktop in any way. Would definitely love to see more Linux games using this technique.

    --

    Chu vi parolas Vikipedion?

  7. Sam Lantinga (from Loki Games) by mattdm · · Score: 4, Informative

    I don't know if kids today remember, but Loki Games was one of the first commercial plays for big name games on Linux. Ended in tragic business troubles and financial doom.

    It warms my heart to see that Sam Lantinga is still working on SDL.

    That is all.

    1. Re:Sam Lantinga (from Loki Games) by bootkiller · · Score: 3, Informative

      Is also working on Valve Linux team now.

  8. Re: rendering lower then scaling up to native by sunderland56 · · Score: 3, Informative

    This works - but wastes both ram space and performance.

  9. Run a dedicated X-server by smugfunt · · Score: 3, Interesting

    Not sure what 'mess' is referred to in the title but I sidestepped the issues I met with Baldur's Gate by running it in its own X-server on a separate VT.
    As I recall it just took a simple script to start the server and the game, and one extra command to make the mouse cursor less fugly. My main desktop remained completely undisturbed and just an Alt-F7 away. A little polish and this approach could be a good general solution, no?

  10. Re:Trying to solve the wrong problem by agrif · · Score: 4, Informative

    X is a very old protocol, with a lot of things that need to be implemented in order for something to say that it "speaks X". Things like font rendering and 2d drawing routines. Things that nobody actually uses anymore.

    X used to be in charge of providing font rendering and such, but now libraries like Freetype and Cairo do it instead (and do it better). X used to be in charge of accelerated video, but now we have good OpenGL support and Kernel Mode Setting. The only thing X really does now is act as a proxy between window managers and applications. But X still has support for all the old stuff, and so it's huge and lumbering.

    Wayland is a new protocol designed to be used between window managers and applications directly. In a new breed of window managers, the window manager itself will set up the screen and draw to it using kernel mode setting and opengl, and it will communicate and delegate windows to applications by talking the Wayland protocol. So there's nothing like the X server sitting between them anymore: the window manager runs directly on the console, and talks directly to applications.

    This might sound like it would cause a lot of duplication of effort, and in one sense that's true. However, the amount boilerplate code needed to set up a simple Wayland-speaking window manager is about the same as the amount of boilerplate code needed to set up a simple X11 window manager. Except with the Wayland case, there's no huge X server sitting between applications and the screen, because Wayland is so simple the window managers can speak it directly.

    One side effect of this is the Wayland library API is *much* simpler to use than the X libraries, so it becomes a lot easier to write new experimental window managers. I expect we'll see a lot of new WM's after Wayland becomes standard. Another plus is that Wayland has built-in support for multiple pointers and arbitrary window transformations, and that's an extremely nice touch for multi-touch screens.

  11. Re:Games are the problem? by Arker · · Score: 3, Insightful

    "Let's not fix the underlaying problem and come up with client-side work arounds"

    Not what I heard. Sounded more like "why the heck are you making the problem more complicated than it needs to be?

    Ideally, I am not sure why the heck a game of the full-screen sort would need X11 to begin with. Perhaps for portability. Wouldnt want to try and run games over remote X either, so why?

    Assuming there are nonetheless plenty of reasons in practice to want to make that work (starting with 'lots of existing games that do require it' of course) then why not just set them to start their own exclusive server instance, tuned for that purpose?

    If it's a game that's supposed to be running full screen and not interacting with a desktop, why then force a desktop to be part of the environment at all? Keep it simple.

    --
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Friends don't let friends enable ecmascript.
  12. Re: rendering lower then scaling up to native by PhrostyMcByte · · Score: 4, Interesting

    Exceedingly little, though.

    Modern games render to more than one off-screen buffers already (necessitated by HDR, deferred shading, and other fun things), only blitting and gamma-correcting the final bits to the screen's framebuffer at the very end.

    The tiny amount of RAM occupied by the 8-bit framebuffer to accommodate a large screen resolution is dwarfed by these several framebuffers, some which will use 16-bit components.

    The amount of GPU needed to draw a solid full-screen quad really is too trivial to care about.

  13. GPU scaling on the Xbox 360 by tepples · · Score: 3, Interesting

    For the myriad of responses that brought up this point: the answer is video card hardware scaling.

    And this is exactly the solution that the Xbox 360 uses. A lot of newer games are fill rate limited. Because of the complexity of the pixel shaders that games use, the AMD Xenos integrated GPU in the Xbox 360 (similar to a Radeon X1800) can't run it with an acceptable frame rate at any resolution over 1024x576. So games use the Xenos's scaler to turn 1024x576 into 1280x720 or 1920x1080 pixels for the component or HDMI output.