1. 02 Jul, 2018 1 commit
  2. 08 Feb, 2018 1 commit
  3. 05 Nov, 2017 1 commit
    • Martin Flöser's avatar
      Force Software QtQuick rendering when starting with QPainter compositor · 53f6a337
      Martin Flöser authored
      Summary:
      If KWin/Wayland starts up with the QPainter compositor we force software
      rendering in QtQuick. It doesn't make sense to try to use the OpenGL
      renderer as that normally just results in an abort when trying to create
      the QOpenGLContext.
      
      Test Plan:
      Run KWin with KWIN_COMPOSE=Q, tried to quick tile a window and
      used Alt+Tab. Worked fine, didn't crash anymore.
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D8663
      53f6a337
  4. 19 Oct, 2017 2 commits
    • Martin Flöser's avatar
      Drop the explicit fallback to XRender · 8f4b6a89
      Martin Flöser authored
      Summary:
      With the new try of all compositor types supported there is an automatic
      fallback from OpenGL to XRender/QPainter in case OpenGL setup failed.
      So there is no need to invoke a method to do just that.
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D8364
      8f4b6a89
    • Martin Flöser's avatar
      Try all supported Compositor Types of the current Platform · 729bfd04
      Martin Flöser authored
      Summary:
      The Compositor now tries to create a Scene not just once but every
      type supported by the Platform till it finds one which works. The user's
      configuration is only used as a preferred hint and tried first if the
      platform supports it.
      
      This brings as an advantage that on platforms such as framebuffer the
      user does not need to specify which compositor to use: KWin uses QPainter
      automatically.
      
      Also we don't need to do the "translation" from XRender to QPainter any
      more. XRender is not supported by any platform using QPainter, so the
      user configuration is ignored anyway.
      
      BUG: 350159
      FIXED-IN: 5.12.0
      
      Test Plan: Run on framebuffer, verified debug output.
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D8363
      729bfd04
  5. 16 Oct, 2017 1 commit
    • Martin Flöser's avatar
      Move X11-only specific part of EffectsHandlerImpl to x11 platform plugin · 7ef84091
      Martin Flöser authored
      Summary:
      The Platform API is extended by a call to create the EffectsHandler. In
      X11 standalone Platform a new EffectsHandlerImplX11 is added which
      contains the X11 only parts of the EffectsHandler, such as grabbing the
      X keyboard and the X11 mouse interception window.
      
      The EffectsHandlerImpl gains some virtual methods for the parts which
      are now done in the X11 specific implementation. In return we get rid of
      lots of if-else structures checking for the operation mode.
      
      Test Plan: Only compile tested.
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D7955
      7ef84091
  6. 30 Sep, 2017 1 commit
    • Martin Flöser's avatar
      Move SceneOpenGL into a dedicated plugin · 8ae37c42
      Martin Flöser authored
      Summary:
      Unfortunately a rather large change which required more refactoring than
      initially expected. The main problem was that some parts needed to go
      into platformsupport so that the platform plugins can link them. Due to
      the rather monolithic nature of scene_opengl.h a few changes were
      required:
      * SceneOpenGL::Texture -> SceneOpenGLTexture
      * SceneOpenGL::TexturePrivate -> SceneOpenGLTexturePrivate
      * texture based code into dedicated files
      * SwapProfiler code into dedicated files
      * SwapProfiler only used in x11 variants
      * Safety checks for OpenGL scene moved into the new plugin
      * signal declared in SceneOpenGL moved to Scene, so that we don't need
      to include SceneOpenGL in composite
      
      Test Plan: Nested OpenGL compositor works
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D7740
      8ae37c42
  7. 21 Sep, 2017 1 commit
  8. 07 Sep, 2017 1 commit
    • Martin Flöser's avatar
      Make AbstractEglBackend a QObject · 01ddbe7d
      Martin Flöser authored
      Summary:
      Several of the subclasses are already derived from QObject.
      
      The main reason is that the class should be moved out of KWin core in
      order to move the OpenGL scene into a plugin. As Compositor calls into
      the AbstractEglBackend to unbind the wayland display this creates a
      problem which is easily solved by turning the AbstractEglBackend into a
      QObject and connect to the signal emitted by the Compositor.
      
      Test Plan: Compiles
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D7669
      01ddbe7d
  9. 01 Sep, 2017 3 commits
    • Martin Flöser's avatar
      Do not hard runtime depend on X11 in composite startup · 2892fad5
      Martin Flöser authored
      Summary:
      The compositor needs to claim the X11 compositor selection and redirect
      the X11 windows. This of course only makes sense when having X11 support.
      
      This change refactors the code so that if X11 support is missing the code
      is not executed, but as soon as X11 support comes available the selection
      gets claimed.
      
      Also if the connection goes away the selection is deleted, though it
      might be that this does not work as KSelectionOwner might call into xcb
      and cause a crash. This needs to be tested once we start supporting
      XWayland going away.
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D7504
      2892fad5
    • Martin Flöser's avatar
      Move QPainter compositor into plugin · 535b1079
      Martin Flöser authored
      This change is similar to D7232 and moves the scene_qpainter into a
      dedicated plugin. Compared to the XRender case it's more complicated as
      the platform plugins need to implement a platform specific backend.
      
      The base implementation for this part used to be in scene_qpainter. As
      the idea is to completly move it away from KWin core it would be point
      less to still have the backend definition in KWin core, but it cannot
      be in the scene plugin as otherwise all platforms need to link the
      plugin.
      
      To solve this a new platformsupport subdirectory is added which contains
      the scene platform backend as a static library. For the OpenGL scene such
      a static library will also be required.
      
      Test Plan: SceneQPainter test still passes, nested compositor still works
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D7259
      535b1079
    • Martin Flöser's avatar
      Move SceneXRender into a plugin · 054d9234
      Martin Flöser authored
      Summary:
      First step for loading the compositor Scenes through plugins. The general
      idea is that we currently needlessly pull in all the Scenes although only
      one will be used.
      
      E.g. on X11 we pull in QPainter, although they are not compatible. On
      Wayland we pull in XRender although they are not compatible.
      
      Furthermore our current Scene creation strategy is not really fault
      tolerant and can create situations where we don't get a compositor. E.g
      on fbdev backend the default settings won't work as it does not support
      OpenGL.
      
      Long term I want to tackle those conceptional problems together:
      we try to load all plugins supported by the current platform till we have
      a scene which works. Thus on Wayland we don't end up in a situation where
      we don't have a working compositor because the configuration is bad.
      
      To make this possible the switch statement in the Scene needs to go and
      needs to be replaced by a for loop iterating over all the available
      scenes on the platform. If we go there it makes sense to replace it
      directly with a plugin based approach.
      
      So this is a change which tackles the problem by first introducing the
      plugin loading. The xrender based scene (as it's the most simple one)
      is moved into a plugin. It is first tried to find a scene plugin and only
      if there is none the existing code is used.
      
      Test Plan: Tested all scenes
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D7232
      054d9234
  10. 23 Aug, 2017 1 commit
  11. 12 Aug, 2017 1 commit
  12. 01 Jul, 2017 1 commit
    • Martin Flöser's avatar
      Remove roundtrip to XServer from Workspace::xStackingOrder · 630514d5
      Martin Flöser authored
      Introduce a method Workspace::markXStackingOrderAsDirty
      
      Summary:
      This method replaces the calls x_stacking_dirty = true in the code base
      allowing for further refactoring of that functionality.
      
      Remove roundtrip to XServer from Workspace::xStackingOrder
      
      The method xStackingOrder is only used during a Compositor paint pass.
      If the stacking order had changed, the method updated the stacking order
      from X by performing a sync XQueryTree. With other words we had a round
      trip to the X server directly in the paint pass.
      
      This change rearchitectures this area by making better use of xcb. When
      we notice that the stacking order changed and an XQueryTree is needed,
      we directly send out the request. When xStackingOrder is finally called,
      which normally happens a few milliseconds later, the reply is retreived.
      In the worst case it still blocks, but in most cases the roundtrip is
      gone.
      
      If the stacking order changed again before accessing xStackingOrder the
      running request is cancelled and a new request is issued. So whenever we
      get into xStackingOrder it will have the current state.
      
      The updating of the xStackingOrder is moved into a dedicated method and
      xStackingOrder invokes it through a const_cast instead of operating on
      mutable variables.
      
      Test Plan: Normal system usage, no issues
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D6323
      630514d5
  13. 14 Apr, 2017 1 commit
  14. 25 Nov, 2016 1 commit
    • Martin Flöser's avatar
      Port Compositor::windowRepaintsPending to use std::any_of · ec2d862d
      Martin Flöser authored
      Summary:
      While investigating a repaint issue I had a hard time to work with the
      code and decided to change it to a more modern variant.
      
      Instead of duplicating the same logic for each of the lists it's now
      moved into a dedicated templated method which used std::any_of. Which is
      exactly the algorithm we need: if there is any window with a non empty
      repaints region it should return true.
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D3397
      ec2d862d
  15. 25 Oct, 2016 1 commit
    • Antonio Larrosa Jimenez's avatar
      [platformx/x11] Add a freeze protection against OpenGL · 19147f5f
      Antonio Larrosa Jimenez authored
      Summary:
      With nouveau driver it can happen that KWin gets frozen when first trying
      to render with OpenGL. This results in a freeze of the complete desktop
      as the compositor is non functional.
      
      Our OpenGL breakage detection is only able to detect crashes, but not
      freezes. This change improves it by also added a freeze protection.
      
      In the PreInit stage a thread is started with a QTimer of 15 sec. If the
      timer fires, qFatal is triggered to terminate KWin. This can only happen
      if the creation of the OpenGL compositor takes longer than said 15 sec.
      
      In the PostInit stage the timer gets deleted and the thread stopeed
      again.
      
      Thus if a freeze is detected the OpenGL unsafe protection is written into
      the config. KWin aborts and gets restarted by DrKonqui. The new KWin
      instance will no longer try to activate the freezing OpenGL as the
      protection is set.
      
      If KWin doesn't freeze the protection is removed from the config as
      we are used to.
      
      Check for freezes for the first n frames, not just the first
      
      This patch changes the freeze detection code to detect freezes in the
      first 30 frames (by default, users can change that with the
      KWIN_MAX_FRAMES_TESTED environment variable). This detects
      successfully the freezes associated to nouveau drivers
      in https://bugzilla.suse.com/show_bug.cgi?id=1005323
      
      Reviewers: davidedmundson, #plasma, #kwin, graesslin
      
      Reviewed By: #plasma, #kwin, graesslin
      
      Subscribers: luebking, graesslin, kwin, plasma-devel, davidedmundson
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D3132
      19147f5f
  16. 19 Aug, 2016 2 commits
    • Martin Flöser's avatar
      Call setupCompositing on internal clients on startup of Compositor · 01ee957c
      Martin Flöser authored
      This fixes a regression found in TestSceneQPainter for restarting the
      Compositor. The internal clients were never added to the Scene.
      
      We cannot just call setupCompositing because there is a phase during
      startup where setupCompositing already passes but the Compositor is not
      yet fully initialized. Thus it could happen that it's called twice which
      makes the Scene assert.
      
      To solve that setupCompositing and finishCompositing are now overriden
      in ShellClient and track whether they successfully called
      setupCompositing.
      01ee957c
    • Martin Flöser's avatar
      Also finishCompositing for Wayland windows in Compositor::finish · facca936
      Martin Flöser authored
      We should be able to restart the Compositor also on Wayland.
      
      As the Compositor might be terminated after Workspace we need to
      ensure to not call into Workspace while doing finishCompositing.
      
      Reviewed-By: bshah
      facca936
  17. 04 Aug, 2016 1 commit
    • Martin Flöser's avatar
      Remove the unredirect fullscreen windows functionality · 996ee34e
      Martin Flöser authored
      Summary:
      Rational: unredirect fullscreen windows is a weird beast. It's intended
      to make fullscreen windows "faster" by not compositing that screen. But
      that doesn't really work as KWin jumps out of that condition pretty
      quickly. E.g. whenever a tooltip window is shown. KWin itself has a
      better functionality by supporting to block compositing completely.
      The complete code was full of hacks around it to try to ensure that
      things don't break.
      
      Overall unredirect fullscreen has always been the odd one. We had it
      because a compositor needs to have it, but it never got truly integrated.
      E.g. effects don't interact with it properly so that some things randomly
      work, others don't. Will it trigger the screenedge, probably yes, but
      will it show the highlight: properly no.
      
      By removing the functionality we finally acknowledge that this mode is
      not maintained and has not been maintained for years and that we do not
      intend to support it better in future. Over the years we tried to make
      it more and more hidden: it's disabled for Intel GPUs, because it used
      to crash KWin. It's marked as an "expert" option, etc.
      
      It's clearly something we tried to hide from the user that it exists.
      
      For Wayland the whole unredirect infrastructure doesn't make sense
      either. There is no such thing as "unredirecting". We might make use
      of passing buffers directly to the underlying stack, but that will be
      done automatically when we know it can be done, not by some magic is
      this a window of specific size.
      
      Test Plan:
      Compiles, cannot really test as I am an Intel user who never
      had that working.
      
      Reviewers: #kwin, #plasma, #vdg
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D2180
      996ee34e
  18. 21 Jul, 2016 2 commits
    • Martin Flöser's avatar
      Handle restart of Compositor Scene correctly for Wayland client · 0286882b
      Martin Flöser authored
      Summary:
      This change ensures that KWin doesn't crash in the QPainter scene if
      the compositor gets restarted and if there are Wayland clients.
      
      Cherry-picked from master
      
      BUG: 365471
      FIXED-IN: 5.7.3
      
      Test Plan:
      Test case added to scene qpainter which triggers a restart
      of the Compositor with a window being shown. Verifies that rendering
      is correct afterwards.
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D2185
      0286882b
    • Martin Flöser's avatar
      Handle restart of Compositor Scene correctly for Wayland client · 3308f359
      Martin Flöser authored
      Summary:
      This change ensures that KWin doesn't crash in the QPainter scene if
      the compositor gets restarted and if there are Wayland clients.
      
      BUG: 365471
      
      Test Plan:
      Test case added to scene qpainter which triggers a restart
      of the Compositor with a window being shown. Verifies that rendering
      is correct afterwards.
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D2185
      3308f359
  19. 20 Jul, 2016 1 commit
    • Martin Flöser's avatar
      Support restarting the OpenGL compositor on Wayland · 9d7ef58b
      Martin Flöser authored
      Summary:
      KWin needs to support restarting the OpenGL compositor in case of a
      graphics reset event.
      
      On Wayland the tricky part is that the applications should not notice
      this. Most importantly KWin cannot just destroy the EGLDisplay and create
      a new one. But this is how a restart works: the complete compositor gets
      torn down and recreated - including the EGLDisplay.
      
      This change moves ownership of the EGLDisplay to the Platform.
      The AbstractEglBackend subclasses query the Platform whether there is
      already an EGLDisplay. Only if there is no EGLDisplay the EGLDisplay is
      created and only if no EGLDisplay is registered with Wayland the bind
      is performed.
      
      Another change is regarding the destruction: the AbstractEglDisplay does
      no longer unbind the Wayland display and does no longer destroy the
      EGLDisplay. The EGLDisplay is destroyed by the Platform - so very late
      on application exit. The Wayland display is unbound when the Compositor
      terminates.
      
      Test Plan:
      Limited testing with the added auto-test. This one needs to
      be extended to fully verify that OpenGL applications continue to work.
      But this requires build.kde.org to support OpenGL on Wayland.
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D2202
      9d7ef58b
  20. 19 Jul, 2016 1 commit
  21. 13 Jul, 2016 1 commit
    • Martin Flöser's avatar
      Use hiddenInternal() for a ShellClient which got unmapped · a35ffa93
      Martin Flöser authored
      Summary:
      So far when a ShellClient got unmapped ready_for_painting was set to
      false. That is the ShellClient was treated in the same way as a not
      yet shown window. It was completely excluded from painting, a close
      animation impossible.
      
      This change makes use of the functionality available in
      Client::hiddenInternal(). The window is considered as hidden, thus
      still excluded from e.g. getting input events, but could be rendered
      any time as we still have a previous window pixmap (if referenced).
      This allows to have it considered in the rendering pass, but effects
      still cannot make use of it as that state is not yet exposed to the
      effects.
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D2083
      a35ffa93
  22. 29 Jun, 2016 1 commit
    • Martin Flöser's avatar
      Stop composite timer when Workspace gets destroyed · 3c6dff75
      Martin Flöser authored
      On Wayland tear down the Workspace gets destroyed before the Compositor
      gets destroyed. If the timer fires in that area, the Compositor would
      crash. It's not possible to start the timer if the Workspace is
      destroyed, thus it should also be stoped on Workspace destroy.
      
      Reviewed-By: Bhushan Shah
      3c6dff75
  23. 17 May, 2016 4 commits
    • Martin Flöser's avatar
      Move the OpenGL unsafe check into the Platform · 7c822fad
      Martin Flöser authored
      Summary:
      A new virtual method createOpenGLSafePoint is added to Platform.
      This is invoked through the Compositor with a PreInit and a PostInit
      argument pre and post creating the SceneOpenGL.
      
      The Platform plugin can implement this and use it for detecting whether
      creating the OpenGL compositor on this platform crashed in the past.
      Thus it's the base for the openGLIsBroken platform check.
      
      The x11 standalone plugin is the first to implement this functionality
      using the previous code which was designed for X11.
      
      This also means that a crash of the OpenGL compositor during init on
      Wayland won't result in OpenGL being disabled.
      
      Reviewers: #plasma
      
      Subscribers: plasma-devel
      
      Projects: #plasma
      
      Differential Revision: https://phabricator.kde.org/D1582
      7c822fad
    • Martin Flöser's avatar
      If glx is not available try to create egl backend · 48e69b77
      Martin Flöser authored
      Summary:
      So far the OpenGL is unsafe check functionality in Compositor disabled
      OpenGL compositing if glx is not available and we are in standalone X11
      mode.
      
      This is technically no longer correct for quite some time. Just because
      GLX is not available doesn't mean that OpenGL doesn't work. We have an
      EGL backend. So let's try to use that if glx is not available.
      
      This change removes the check completely from Compositor. Instead the
      standalone x11 plugin checks whether glx is available prior to createing
      the glx backend. If not available it falls through to the egl backend.
      
      Reviewers: #plasma
      
      Subscribers: plasma-devel
      
      Projects: #plasma
      
      Differential Revision: https://phabricator.kde.org/D1581
      48e69b77
    • Martin Flöser's avatar
      Provide functionality of CompositingPrefs through Platform · d15d3a5f
      Martin Flöser authored
      Summary:
      CompositingPrefs is only relevant for X11 standalone. It had some
      "hacks" to make it not block Compositing on Wayland. Thus it was in
      its current form not really useful.
      
      Now all the functionality is provided through Platform with a default
      implementation which is sensible for Wayland platforms.
      
      The X11 standalone platform implements the new methods with the
      Wayland checks removed.
      
      In addition all calls to CompositingPrefs now go through the platform
      directly and CompositingPrefs is completely dropped.
      
      Reviewers: #plasma
      
      Subscribers: plasma-devel
      
      Projects: #plasma
      
      Differential Revision: https://phabricator.kde.org/D1576
      d15d3a5f
    • Martin Flöser's avatar
      Move requiresCompositing from Application to Platform · c45942a7
      Martin Flöser authored
      Summary:
      This change reduces the windowing system specific code pathes. Instead
      of checking whether we are on X11 or Wayland to decide whether
      compositing is required, we just ask the Platform.
      
      The default is true, only x11 standalone allows to not require
      compositing.
      
      Reviewers: #plasma
      
      Subscribers: plasma-devel
      
      Projects: #plasma
      
      Differential Revision: https://phabricator.kde.org/D1575
      c45942a7
  24. 13 May, 2016 1 commit
  25. 02 May, 2016 3 commits
  26. 15 Apr, 2016 1 commit
  27. 14 Apr, 2016 1 commit
    • Martin Flöser's avatar
      Only start Xwayland server if Compositor created a Scene · df2c26e3
      Martin Flöser authored
      So far if the Scene creation failed kwin_wayland went into a shutdown,
      but didn't succeed because the thread to start Xwayland was already
      running: it froze.
      
      This change introduces a new signal in Compositor: sceneCreated. The
      startup of Xwayland is bound to this signal. If it gets fired KWin can
      startup Xwayland. If it does not get fired, KWin terminates correctly.
      df2c26e3
  28. 07 Apr, 2016 3 commits