OpenGL changes in KWin compositing


Debug information


OpenGL information in Debug Console


Support for llvmpipe






Removal of GLX/EGL selection


Removal of unredirect fullscreen windows





Support for render devices


Support for restarting the compositor on Wayland


90 Replies to “OpenGL changes in KWin compositing”

  1. > There is a standardized way for applications to request [blocking compositing] and we see that many games and applications (e.g. Kodi) make use of it.

    Even those closed source games on steam? Otherwise it’s a pretty useless feature imho, since you hardly need this performance benefit for most open source games anyway.

    1. Well this is KWin, if applications are broken you can fix them 🙂 E.g there is the game mode script and of course window specific settings also support this feature. So if the proprietary game does not support it: just create a rule.

        1. These bugs need to be fixed. We don’t do our software design decisions based on bugs we currently have. We expect those bugs to be fixed till Plasma 5.8, though we need help with them (read: I’m not able to reproduce them).

    2. Unlike KWin 4.x, I had very good experiences with XRender on KWin 5.x. So good, in fact, that I just wanted to try it once and soon forgot that I was using it and kept using it for months without noticing.

      I didn’t do scientific FPS comparisons in games but it should result in similar FPS gains than blocked compositing.

    3. Dota 2 and Civilization V does that (the games I play, can’t tell about others), even with Steam Overlay. In fact, kwin is the only windows manager which didn’t gave me headaches.

    4. Can confirm that most most games on steam makes use of this infrastructure to disable compo when they start and reactivate it when they close.

      SOURCE: there is a bug that makes all your screen flicker with black frames when the compositor is suspended and than re enabled in this way… Easy solution is to manually disable it before launching the game with CTRL-ALT-F12.

  2. Past posts of yours made it sound that QPainter is better than XRender for software compositing. I wonder why the drop-down menu does not offer QPainter.

  3. What’s the difference between “unredirection” and “blocking by request” ? I.e. if you’re going to only block by request, that wouldn’t solve broken drivers; unless the whole idea is that not much apps would probably use the feature, artificially reducing number of bugreports.

    1. The difference is that blocking compositing means the compositor gets completely disabled. Not just the unredirection being in place. It’s the same as if you use an uncomposited window manager again. We know that this is not causing problems with drivers, because it’s something which happens all the time: when KWin shuts down the compositor gets first terminated, then the rest is terminated. Thus there is always a short time where we are in exactly the same condition as with blocking compositing. Or similar if a user presses Alt+Shift+F12 twice, or changes configuration settings related to compositing.


      Erm of course not. I hope that nobody gets such an idea.

      1. Ah, nice. So, “unredirection” is an absolutely different thing.

        But then, why not to disable compositioning for every full-screen window; given it doesn’t cause as much problems as “unredirection”, that seem to be a great replacement.

        1. You don’t want to disable compositing for every fullscreen window. That would for example cause severe issues on multi-screen systems: why disable compositing just because on the other screen there’s a fullscreen window?

          You want to disable compositing when it’s required. E.g. when playing a game, when doing something which really needs the GPU. Or although a CAD application – which is not necessarily running as fullscreen. It’s just nothing which should be bound to the fullscreen state.

    1. You didn’t read my blog post, right? We have something which compiz never supported: blocking compositing.

      1. But I don’t want ‘blocking compositing’, it’s just awful. I wan compositing always on, regardless of what applications think of it.

        1. If you want use-case: multiple screens. I don’t want all compositing/effects gone on all of my screens just because I have some fullscreen application running. No way!

          1. Sure. If you don’t want that: create a window specific rule to disallow it. Also we are considering to add a dedicated config option to allow whether applications can block compositing.

            1. Then maybe someday you (I mean all of KDE devs) consider adding a config option to make plasmashell crashes gone? Or an option to squeeze these horrible Qt themes to make them fit 13″ laptop screens again? Or a big desktop button ‘KILL Akonadi’ because it won’t start properly 1/5 times?

              Seriously, I’ve read so many posts of how much better designed software KF/Plasma5 is, compared to KDE4, but it’s just not working correctly when you try using it. That’s really disappointing.

              1. I’m sorry that our software doesn’t satisfy your needs. As there are multiple Desktop Environments available I suggest to give them a try. Maybe you are better served there.

                1. Don’t be sorry, I’m just another jerk you met on the internets.
                  And for now (kwin 4.7), after compositing was restored from ‘blocked’ state, the screen would flicker when some new windows appear (like, on spectacle start) and some minor desktop corruption occurs (black rectangles). It doesn’t matter if compositing was blocked by a rule, or you’ve just changed something in System settings, which cause compositing restart. I’m almost sure I’ve seen a bug on bugzilla, but I cannot find it now. Is this fixed?

                  1. That sounds like – unfortunately I’m not able to reproduce the issue which makes it really difficult to investigate. If you have any further information on how to trigger it: please tell! That’s currently one of our top priority bugs, but without a way to reproduce there is just nothing I can do about it.

                    1. I can’t tell anything specific, but my desktop corruptions do not look anything like on screenshots provides with that bug. The desktop corruption is black series of black rectangles outside of active window. They’re usually located in upper left corner of the screen, and disappear if that section of the screen is redrawed. I tried to make a screenshot, but failed, it seems that entire screen gets redrawed just before the shot. Maybe I need other tools.
                      What information you want me to provide? And where should I put it? I can’t send you my entire laptop, but I could think of giving you a remote access to it if that would help.

                    2. I can always reproduce it by starting the Shadow Warrior game, the latest one, on steam.
                      Make sure it’s running in full screen on one screen, and whilst the game is running, have another screen showing a youtube video in a chrome browser window.
                      Once you exit the game, there will be corruption on the window borders.

            2. Please add that option with all haste.

              I absolutely hate that I’ve had to make a global window rule to override the option simply to preserve my sanity, and keep the desktop in a usable state while games were running.
              Just look at the plasma5 shell; the last time I allowed SDL2 to inhibit compositing, plasma was stuck in complete visual stasis until the game exited and compositing was restored.
              It just makes for a awful user experience when programs can just disable the compositor and cause such problems.

  4. So you don’t only get irate comments about unredirect fullscreen…

    About “Support for render devices” – is that fully functioning for desktop use? For wayland? I ask because on Tegra K1 chromebooks there is basically one “GPU” that is connected to the display and as far as I know it can only do very basic 2D. And then there is the beefier nvidia GPU that is not connected to the display at all. The problem is: The modesetting ddx on that hardware doesn’t have dri3 yet and xf86-video-nouveau apparently has some trouble starting up, so DRI_PRIME can not really be used.

    Now there are hacked solutions.
    1. For X: It’s basically hardcoded to open /dev/dri/renderD128 and do graphics acceleration through that. Works surprisingly well. Plasma and other KDE programs have a tendency to lock the whole thing up, but that might be a nouveau bug, not sure.

    2. For weston: That’s my real question. Weston with these patches works fine, but kwin and mutter etc. still use llvmpipe because they’d need to do patches like these too. Is this Support for render devices a working solution for that situation on wayland?

    1. Unfortunately not. Render device support is only available in the virtual rendering platform. That is when no output is supposed to be rendered at all. KWin does not support DRI_PRIME at all yet. So yes similar patches are probably needed.

  5. Hi !

    A bit sad about the unredirection of fullscreen… A lot of applications will never add the standardized way you are speaking about 🙁 So watching a video in fullscreen without glittering won’t be possible anymore with a 6 or 7 years old PC.

    1. Saying the obvious: you don’t need to update to the latest version with your 7 years old system. You can continue to use older software which is better suited for such hardware. Especially considering that the web requires all resources it can get.

      1. Unless, you have your new 4k screen laptop and you want watch youtube.
        In that case you have to buy another older PC with smaller resolution to comfortable watch stupid cats on the internet…

        from 5.5 this DE is so unstable ;/
        but gnome have so ridiculous UX…
        I hoped that this project will be better in new version, but 5.6 was worse, and 5.7 also anything better… now you removing options that allowed me to watch youtube…

        1. I’m sorry that our software doesn’t meet your expectations. As there are multiple available desktop environments I hope you find one which will suit your needs.

          1. And this is why KDE loosing community,
            because of those nicely said “f..k you”‘s
            And you can expect anything in new release, no public roadmap, just random blog posts where you can read what was already changed and when it is already too late to report objections.
            This isn’t how open source project should be working…

            1. I’ve not had any problems with stability for a long time, if you are reading these posts then you must be using bleeding edge stuff (or close to it) so you need to expect to have to deal with issues. If you don’t want to deal with issues then you’ll need to roll back to a stable release. Hopefully you’ve logged all your issues on bugzilla to help open source work as you expect it to…

            2. Can we get one thing clear: we don’t break stuff deliberately. Do you think we go “ah let’s break gaming experience today”? Do you think we did not evaluate the situation properly and only did this change if we are absolutely sure that it’s the right thing to do?

              Do you think I did not know how the gamers would react if I announce the change? Nevertheless I did it. I expected a shit storm, nothing less.

              1. Yes, I think you didn’t evaluated the situation properly, because you don’t have any telemetry or other usage statistics, therefore you cannot say that this is rarely used feature.
                None of our developers isn’t using that, so we remove it because this shouldn’t be implemented like that in the first place.
                Ok there is an api for applications to do that, but there isn’t any announcement in advance for other developers to have any change to adapt that in their application.
                Instead of that lets just remove some features and users can live with for few months before it became supported by other applications.

                It sounds just irresponsible. “I know it will be breaking change, so lets introduce it without notice”

                1. But we have the metric. We saw the bug reports and complaints in support channel when we introduces the blocks compositing hint gets honored.

                  1. Also we have another kind of metrics. I do know which areas related to unredirection of fullscreen windows have been broken for years. And if you don’t get bug reports for those, well it says something. Also we ask for support information in every single bug report and that also tells us a lot. In addition we have the support information which we ask for in every bug. From that we get how many users have it set.

      2. I dare to disagree. While you don’t necessarily need the latest version of a desktop environment, you DO need the latest versions of the base GNU system components, network services, web browser and whatever applications you use to open files downloaded from the Internet. Otherwise your system’s security is swiss cheese and you can look forward to it becoming a botnet zombie and having all your bitcoins stolen.

        Now, please tell me which distribution provides all the newest apps and system components, while keeping, say, KDE4 desktop in the repositories?

        There is none. You either get everything updated, or keep everything Shellshocked and Heartbleeding.

  6. When you said “but we can ideally just pass the buffer to the DRM device” does that mean you could, for one screen, pass directly the buffer of an application to that screen? Or it would not work for a multi screen desktop and will go through normal compositing. Thanks.

    1. Yes the idea is that we pass the buffer directly from an application to that screen and that fully multi screen aware.

  7. > Removal of unredirect fullscreen windows

    Am i reading this correctly? If one application does the “blocking compositing” request then all compositing is blocked?

    So in a dual screen setup just having one application in fullscreen stops all compositing on both screens? Basically throwing the other monitor back to software rendering.

    Please tell me i’m not reading this correctly.

      1. Hi Martin,

        I kinda fail to see how the standardized way is any better then “unredirect fullscreen”. Specially for multi screen users (i’m one of them) will most certainly see a big benefit in unredirecting fullscreen applications.

        From a maintenance point of view (ans as a developer) i perfectly understand why you did this.

        From a user point of view i’d like to ask you to reconsider this change. It might be on the level of the legacy system tray. It was removed for perfectly fine technical reasons, but turned out to be a quite a bad user experience. This change can have the same effect only with a smaller userbase (since there simply are less dual screen users then single screen ones).

        Also, i hate it when my screen moves to compositing -> software and then compositing again. I’ve had that in the past due to driver bugs. Now it’s going to be a “feature” when a (fullscreen) app sets some flag.

        1. I’m very sure that this is not an issue on multi-screen in practice. Unlike unredirect-fullscreen where I’m aware of many bugs in multi-screen setups and none of them got reported. It says a lot.

  8. Hi Martin,

    Correct me if I’m wrong, but isn’t the “block by request” the same as pressing alt-shift-f12 ?
    So in a multiscreen scenario will KWin ignore the request or fulfill it ? I mean in one case you lose performance but other screens stay unaffected while in the other case other screens won’t be composited anymore. Both cases have drawbacks in my opinion.

    Unredirect sure wasn’t perfect but was an okay compromise for the drivers that didn’t suck with it (like proprietary NVIDIA ones). I can understand if you want to remove this for code maintainability/refactoring reasons, but in the other case, if it’s just about avoiding bug reports due to bad drivers/hardware maybe it would be wiser to flag it as unsupported but still leave it possible to be enabled via environment variable/config file ?

    Again thanks so much for the effort you have put in KWin and for your very insightful blog posts.

    1. KWin honors the request also in multi screen. Though I don’t think that is a realistic scenario.

      1. What isn’t a realistic scenario? I have three monitors, and often play a game on a single monitor with the other two still on, sometimes with a full screen video on one of the others.

        How will that be handled? The game will either be fully composited, or if it requests, the compositor will completely shut down for all screens?

        Kwin has probably been the most stable and reliable pieces of kde 4/5 since they were released. Things just worked nearly all of the time (the early days of kde 4 had issues, but let us never speak of them again >:( ). I wish there was some way to get kwin to notice a full screen window on a screen, and disable compositing on that screen alone.

        Oh hey, just remembered one thing that’s been bugging me. Sometimes menus from plasma show up on the wrong screen. Is that a kwin issue or plasma? Plasma’s multi display support is super buggy, so it very well could be plasma’s fault. That said, plasma in general is pretty buggy. Right now plasma is OOMing itself on a machine with 32GB ram after only a day. Then there’s random CPU issues, and the aforementioned multi display issues 🙁 I know you don’t have much to do with plasma, i just wanted to vent 😉

      1. But why? In OS X El Capitan, Aqua has rendering through the Metal API, and shows better performance then OpenGL. In my opinion is a good idea to add Vulkan backend to KWin, along side with OpenGL and Xrender.

        1. Because I currently don’t have any plans to support Vulkan. I’m busy with Wayland, I don’t have time for yet another compositor. Thus currently no plans for Vulkan.

        2. Also, in order to benefit from Vulkan, rendering should be rewritten in more parallelized fashion. And that means a lot of changes to the compositor architecture (KWin doesn’t have parallelized rendering at present). It’s not a simple “switch to new API” update.

  9. I tried to make a rule for individual window (a game), but after the game is opened, the whole desktop loses compositing, even when that window is minimized. So it’s not a proper substitute for “disable compositing for fullscreen windows”. Or I’m doing something wrong? How can it be disabled only when that window is not minimized?

    1. For that you would need a KWin script which disables the blocking when minimizing the window.

      1. So, basically your position is: “We will do everything right in software-engineering aspect, and if users want nice user-experience, just like it was in previous versions of our software, let them make their own user-scripts. We don’t care if that would be non-trivial task for average user.”
        Don’t you see why this suc^W unsuitable?

      2. Is it possible to extend window rules based on certain conditions? I.e. it would be way more flexible if the rule said:

        -> apply the rule when “window is not minimized” and X or Z etc.

        Would you consider this as an enhancement to KWin window rules setting? It would make it more user friendly than writing scripts for that purpose (even though it would still be pretty advanced feature).

        I’d say it could be useful in general, besides just solving this particular issue.

          1. Alright, I’ll take a look at scripting. Still, while I don’t agree with the tone of the commenter above, I wouldn’t dispute the point that in this case certain functionality was removed, and replacing it would be beyond the capabilities of common user (i.e. non programmer).

            I can understand that the whole feature is transitory if you consider Wayland to be the ultimate goal (where this is handled differently altogether), but at the same time Wayland support isn’t fully ready yet. I.e. it’s “in development”. Do you think it’s a good practice to remove actively used features, before usable replacement is ready? I.e. sure, there are quirks with this but this feature is used at present by those who are still on X11.

            1. A feature that is broken on the latest you vendor can hardly be considered as used presently

              1. You mean it’s broken on Intel GPUs? I suppose, most gaming happens on discreet (AMD / Nvidia) cards anyway, where this feature is actively used. I know for sure that I use it for gaming, and I’ve heard many others using it too for the same purpose.

                Interestingly, in some games like those based on Unity, I on the contrary, keep compositing on even in fullscreen. Because Unity is horrible with tearing, and its internal vsync settings have don’t help. KWin composting does a good job of fixing tearing in such games. But Unity games tend to be not very demanding / high performance ones, so it doesn’t matter much there.

  10. Thanks for your work and for your blogs, always very interesting to read.
    Wayland is the future. If removing badly supported features from X11 reduce the maintenance work and leave you more time to work on Wayland, then go ahead regardless of what some people say.
    Regarding passing directly the buffer of fullscreen windows to the DRM device on Wayland, is there a standardised way for wayland clients to do that ? What would happen in case of a notification for instance ?

    1. Our idea is to evaluate in every frame whether we can directly pass the buffer to DRM device or need to go through rendering. E.g. if there is a notification we see that we need to go through the compositing pipeline. If we notice that we can pass the buffer directly, we will do so. The clients are not involved in that at all. If we can do it, we will do it.

      1. As I understand it, the compositing pipeline takes the application-provided frame as a texture and draws a new frame from scratch, effectively blitting fullscreen app’s frame from one buffer to another. This adds latency and eats a significant amount of memory bandwidth, especially on low-power SoCs and APUs where bandwidth is usually scarce and a significant bottleneck for 3D performance. For the end user it means animation stuttering whenever a notification or whatever forces the compositing path.

        What if a special compositing mode was implemented in KWin for fullscreen apps, where the app-provided fullscreen frame would be used not as a source but as a destination onto which the notifications are blended? Say we make a compute shader that imports the FB as a R/W image buffer and manually blends in the notification windows to affected pixels, bypassing the normal 3D rendering pipeline. This way, only the pixels covered by the notifications (which are normally at most a few percent of screen area) would need to be touched; the remaining screen area would not be uselessly read and written, saving heaps of memory bandwidth and reducing latency. If a large enough overlay window appeared (maybe Yakuake?) or an effect was triggered that requires the 3D pipeline, then we could fall back to the traditional compositing path.

        I believe modern game consoles display notifications in a similar way. There is no stutter when the PlayStation 4’s OS displays a notification over a running game, and I see no reason why Linux desktop should be worse.

  11. Lets hope this will change plasmas bad gaming performance compared to all other desktops (cinnamon excluded, it has the same laggy effect on games)

  12. How do I disable this ‘composite blocking’ globally? Maybe some kwinrc option? I don’t want programs being able to turn effects off on their own accord.

    1. You can create a window rule to disallow blocking of compositing. For Plasma 5.8 I plan to add a config option.

      1. Thank you. Is it possible to add a window rule that would match all windows, or I should add rules for each program?

  13. Martin, I did some testing (Plasma 5.7) with the different permutations re demanding games. This is what I found:
    1) Compositing using OpenGL3.1 is definitely very light, and has minimal effect on the game performance. (Game is Victor Vran, GPU is radeon 7770M using radeonsi)
    2) If tearing prevention is set to anything but “None”, performance tanks to about 1/3 of before. Everything is sluggish and slow even when game is minimised. I had a look at the GPU usage, and it dropped down to about 40% usage in my test case. This drop is surprisingly large.

    So, could you for Plasma 5.8 please investigate adding a different behaviour to tearing prevention?
    e.g. an option to only disable vsync if the fame rate goes below a threshold? e.g. it drops under refresh-rate of monitor (it would be fine if only adjusted this every few seconds)

    And the option where you disable blocking of compisiting, to disable vsync instead?

    Because I prefer the smoothness of regular tearing prevention, but it severely impacts the performance of games.

    Do I make sense here?

    1. No, I don’t think the majority of users would appreciate tearing. Here we should not forget that gaming is just one use case. If you watch a video you don’t want tearing – ever! From a compositor perspective those two usages look very similar.

      What’s important is that tearing prevention works well, e.g. that the driver supports buffer age and that KWin can make use of it. I do not know whether radeonsi driver supports buffer age.

      1. Exactly, I want to leave vsync on (especially for videos), except if I play games that struggle on my system (which is getting more common).

        If I have some way of disabling vsync only when a certain app is running, possibly through window rules, that would make it much better for me?

        Unfortunately I have no idea what buffer age could buy us?

        1. possibly through window rules, that would make it much better for me?

          Maybe just use the window specific rule to block compositing? Then KWin’s compositing is removed from the equation and vsync in KWin doesn’t matter as not used.

          But no, that won’t be added to the rules system. In general the compositing rendering is not linked to the rules system at all.

          1. I tested blocking compositing with a window rule on my gentoo plasma 5.7.3 installation and it did nothing that I could discern.

            Another question, do you know if an OpenGL app/window requests vsync to be force disabled?

  14. Wait what? If I have multiple monitors, kwin will then suspend compositing on both if an application goes fullscreen on one, even though those two monitors can trigger a new vertical blank at different points in time and otherwise also are pretty independent of each other?

    Why? Who would want that? Instead of doing the unredirect fullscreen stuff or the blocking compositing stuff, can’t you provide a way where you’ll automatically block compositing on only the monitor an application goes fullscreen on, if the user or the application requests this?

    When an application wants to have control of vsync (hence why they block compositing), what it usually means is “I want to have control of vsync on the monitor I’m running on”.

  15. Very sad to see the removal of unredirection of fullscreen windows. To me, this was the most essential feature of KDE, I have a hard time continuing to use KDE without it. The reason is that I have never seen smooth, stutter-free video playback on when compositing is enabled (on AMD and Intel cards). The inherent stuttering is kind of semi-acceptable for regular windows, but in fullscreen, playback has to be perfect, choppy video is unacceptable. And for me, the only way to get stutter-free fullscreen playback on, or namely Plasma/KWin, was either to disable compositing, or use the unredirection of fullscreen windows. I vastly prefer the latter, as it’s so much more user-friendly, plus disabling/blocking compositing can bring undesired bugs or effects, too (like tearing or flickering).

    So while I respect the decision, I would certainly prefer it the option stayed there at least as an unsupported option (even if it was hidden in a config file somewhere), as I cannot see a comparably good alternative.

  16. Some days ago (Oct/2016) I upgraded my Plasma to 5.8.x version. I am running Gentoo/Linux and I really can’t find a way to properly launch wayland session. I use xinit to start Plasma from tty, but startplasmacompositor doesn’t work for me. I don’t use sddm to start wayland, because that doesn’t work either.

    The only way to fire up a (windowed) wayland session is within another X-session and then enter in a console:
    export $(dbus-launch) ; kwin_wayland –xwayland plasmashell

    I use OpenRC if that matters.

      1. Thank you very much! I think I should bug report about it though – I can’t find something relative to logind in Gentoo.

        1. I decided to install systemd (GNOME and other reasons) and SDDM once again failes to login me in plasma wayland. When I try from a tty to run either “startplasmacompositor” or “export KWIN_COMPOSE=Q ; export $(dbus-launch) ; kwin_wayland –xwayland plasmashell” I get exactly the same error:

          No backend specified though command line, trying auto resolution
          kwin_xkbcommon :XKB: /usr/share/X11/locale/iso8859-7/Compose:85:29 string literal is not a valid UTF-8 string
          kwin_xkbcommon : too many errors

          Once again I can start a nested wayland session from inside kwin_x11. What am I missing?

          1. Sorry I don’t know and honestly the comment section of my blog post is not the right place to investigate.

              1. Maybe you should file a bug report with Gentoo and whatever they mess up with packaging.

                Under openSUSE I can just install the Plasma Waylang session package, select it from SDDM and it just works but openSUSE. Obviously with their insistence to use OpenRC by default, they need to take extra care to get dependencies and permissions right.

                Gentoo caused problems in the past as well with their weird eudev thing that messed up Plasma’s device notifier.

Comments are closed.