1. 22 Sep, 2020 1 commit
    • Aleix Pol Gonzalez's avatar
      Centralize WindowPixmap buffer updating code · 61e655f7
      Aleix Pol Gonzalez authored
      Uses a setter and clear method pattern rather than having the code
      repeated.
      Instead of keeping a QPointer, now we are a QObject and we get notified
      about destruction intention directly, so we can clear the pointer when
      necessary.
      61e655f7
  2. 19 Aug, 2020 1 commit
    • Aleix Pol Gonzalez's avatar
      Implement EGL_KHR_partial_update and EGL_EXT_swap_buffers_with_damage · eeeac049
      Aleix Pol Gonzalez authored
      Summary:
      Notify the driver about the parts of the screen that will be repainted.
      In some cases this can be benefitial. This is especially useful on lima
      and panfrost devices (e.g. pinephone, pinebook, pinebook pro).
      
      Test Plan:
      Tested on a pinebook pro with a late mesa version.
      Basically I implemented it, then it didn't work and I fixed it.
      Maybe next step we want to look into our damage algorithm.
      eeeac049
  3. 07 Aug, 2020 2 commits
    • Vlad Zahorodnii's avatar
      Prettify license headers · 4ce853e8
      Vlad Zahorodnii authored
      4ce853e8
    • Vlad Zahorodnii's avatar
      Switch to SPDX license markers · 1fb9f6f1
      Vlad Zahorodnii authored
      The main advantage of SPDX license identifiers over the traditional
      license headers is that it's more difficult to overlook inappropriate
      licenses for kwin, for example GPL 3. We also don't have to copy a
      lot of boilerplate text.
      
      In order to create this change, I ran licensedigger -r -c from the
      toplevel source directory.
      1fb9f6f1
  4. 23 Jul, 2020 1 commit
  5. 03 Jun, 2020 1 commit
    • Vlad Zahorodnii's avatar
      [wayland] Add support for cropped and scaled surfaces · de2c4cb4
      Vlad Zahorodnii authored
      The wp_viewporter compositor extension allows clients to crop and scale
      their surfaces. It can be especially useful for applications wishing to
      reduce their power consumption, e.g. video players, etc.
      
      Given that there is no any direct relationship between the surface size
      and the buffer size anymore, we have to use specialized helper methods
      for converting coordinates from the surface-local space to buffer pixel
      space and vice versa.
      de2c4cb4
  6. 29 May, 2020 1 commit
  7. 04 May, 2020 1 commit
  8. 30 Apr, 2020 1 commit
  9. 22 Apr, 2020 1 commit
  10. 30 Nov, 2019 1 commit
    • Roman Gilg's avatar
      Destroy dmabuf implementation on EGL backend going down · e2d5ec60
      Roman Gilg authored
      Summary:
      We leak memory if we do not destroy the dmabuf implementation on EGL backend
      going down.
      
      Also this makes sure everything is cleaned up on shutdown.
      
      FIXED-IN: 5.17.4
      
      BUG: 413637
      
      Test Plan: Compiles, settings change and shutdown ok.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: davidedmundson, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D25577
      e2d5ec60
  11. 29 Oct, 2019 1 commit
    • Roman Gilg's avatar
      Dmabuf recovery on EGL reset · 7459aabc
      Roman Gilg authored
      Summary:
      The EGL platform might go away at any time through reconfiguration or because
      of a graphic error. KWin then resets the graphics. The dmabuf implementation
      must respect that and recover from a graphics reset by recreating all EGL
      images for existing buffer.
      
      This assumes that we won't change our graphics API mid-session and that
      supported plane and modifier configuration stays constant.
      
      In practise we remember all current dmabufs in a single map and only remove
      them if the client did destroy the resource.
      
      BUG: 411980
      CCBUG: 413403
      FIXED-IN: 5.17.2
      
      Test Plan: Applied screenedge configuration without crash.
      
      Reviewers: #kwin, zzag
      
      Reviewed By: #kwin, zzag
      
      Subscribers: fvogt, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D24954
      7459aabc
  12. 23 Sep, 2019 1 commit
    • Vlad Zahorodnii's avatar
      Port QPA away from Wayland · bebe8120
      Vlad Zahorodnii authored
      Summary:
      So far wayland was used by internal clients to submit raster buffers
      and position themselves on the screen. While we didn't have issues with
      submitting raster buffers, there were some problems with positioning
      task switchers. Mostly, because we had effectively two paths that may
      alter geometry.
      
      A better approach to deal with internal clients is to let our QPA use
      kwin core api directly. This way we can eliminate unnecessary roundtrips
      as well make geometry handling much easier and comprehensible.
      
      The last missing piece is shadows. Both Plasma::Dialog and Breeze widget
      style use platform-specific APIs to set and unset shadows. We need to
      add shadows API to KWindowSystem. Even though some internal clients lack
      drop-shadows at the moment, I don't consider it to be a blocker. We can
      add shadows back later on.
      
      CCBUG: 386304
      
      Reviewers: #kwin, davidedmundson, romangg
      
      Reviewed By: #kwin, romangg
      
      Subscribers: romangg, kwin
      
      Tags: #kwin
      
      Maniphest Tasks: T9600
      
      Differential Revision: https://phabricator.kde.org/D22810
      bebe8120
  13. 31 Aug, 2019 1 commit
    • Vlad Zahorodnii's avatar
      Switch to Q_ASSERT · 7a3722b4
      Vlad Zahorodnii authored
      Summary:
      Switch to Q_ASSERT in order to make code a bit more consistent. We have
      places where both assert and Q_ASSERT are used next to each other. Also,
      distributions like Ubuntu don't strip away assert(), let's hope that
      things are a bit different with Q_ASSERT.
      
      Test Plan: Compiles.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: romangg, davidedmundson, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D23605
      7a3722b4
  14. 06 Aug, 2019 1 commit
    • Roman Gilg's avatar
      [wayland] Add support for zwp_linux_dmabuf · 6613327a
      Roman Gilg authored
      Summary: This adds support for LinuxDmabufUnstableV1Interface in kwin.
      
      Test Plan: Session starts. `weston-simple-dmabuf-egl` and `weston-simple-dmabuf-drm` execute without errors.
      
      Reviewers: #kwin, #plasma, davidedmundson, mart, graesslin, fredrik
      
      Subscribers: meven, zzag, romangg, anthonyfieroni, plasma-devel, kwin
      
      Tags: #kwin
      
      Maniphest Tasks: T8067
      
      Differential Revision: https://phabricator.kde.org/D10750
      6613327a
  15. 09 Jul, 2019 1 commit
  16. 21 Feb, 2019 1 commit
  17. 29 Mar, 2018 1 commit
    • Eike Hein's avatar
      Request a high-priority EGL contexts · 2c26215d
      Eike Hein authored
      Summary:
      This patch implements using EGL_IMG_context_priority to request
      high-priority rendering contexts if the extension is available.
      
      EGL_IMG_context_priority is currently used in this fashion by
      e.g. Android's SurfaceFlinger (RenderEngine.cpp) and libweston
      (gl-renderer.c) and seems promising given this widespread
      acceptance.
      
      Reviewers: #kwin, graesslin, romangg, davidedmundson
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D11572
      2c26215d
  18. 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
  19. 07 Sep, 2017 2 commits
    • 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
    • Martin Flöser's avatar
      Pass EGL information from AbstractEglBackend to Platform instead of query · 9381411b
      Martin Flöser authored
      Summary:
      So far the Platform performed a deep query into the AbstractEglBackend
      to get information such as EGLContext, EGLConfig, EGLSurface. This
      change adjusts this so that the AbstractEGLPlatform forwards it directly
      whenever it gets informed about one following the approach already used
      for EGLDisplay. This simplifies the code a lot and allows to remove the
      dependency on the actual scene backend from the Platform (in order to
      split out the SceneOpenGL into a plugin).
      
      Test Plan:
      Run nested kwin_wayland, triggered Outline which requires all
      those methods.
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D7698
      9381411b
  20. 26 Jun, 2017 1 commit
    • Martin Flöser's avatar
      Refactor the specification of OpenGL context attributes · 3f4995fb
      Martin Flöser authored
      Summary:
      The current way to specify the OpenGL context attributes does no longer
      scale as can be seen in D6344. There are too many different context
      attribute sets and with every addition we grow lots of copied code. The
      chances to introduce errors in that code which is difficult to debug are
      very high. As can be seen in the glx backend which defines major 1,
      minor 2, but it should be major 2, minor 1.
      
      This change reworks this code by creating a builder class which contains
      only an abstract definition of what needs to be in the attributes.
      E.g. the version, whether it's robust and so on.
      
      Now we can just have a list of possible attributes in a well described
      way:
          auto builder;
          builder.setVersion(3, 1);
          builder.setRobust(true);
      
      All possible builders are added to a list and operated on in a for loop
      which tries to creat a context. Once it succeeded it breaks the list.
      In addition a debug statement is added which prints out the set of
      options which went into the context.
      
      So far this is only done for EGL, GLX can follow once D6344 is merged.
      
      Test Plan: New unit test added, kwin_wayland OpenGL tests run and verified
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D6396
      3f4995fb
  21. 29 Mar, 2017 1 commit
  22. 17 Nov, 2016 1 commit
    • Martin Flöser's avatar
      Move querying the egl extensions into the AbstractEglBackend · d1de6899
      Martin Flöser authored
      Summary:
      Instead of having the egl extensions in the global kwinglutils lib it
      becomes private to the AbstractEglBackend. Just like on glx the
      glxextensions are moved into the platform.
      
      The extensions are queried from initEglAPI, that is as early as possible
      after initializing the EGLDisplay. This ensures that any implementing
      subclass can access the extensions early enough.
      
      As a note: the EglOnXBackend had a potentially wrong sequence for
      initializing the buffer age extension. It is now moved to the correct
      place where the result is needed for the first time.
      
      From the global API eglExtensions are removed from hasGLExtension and
      the eglExtensions function is dropped. As by that initEGL did not do
      anything it is also dropped.
      
      Test Plan:
      Tested nested kwin on Wayland, still works, extensions shown
      in debug console
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D3396
      d1de6899
  23. 16 Nov, 2016 1 commit
    • Martin Flöser's avatar
      Pass function ptr to resolve glFunctions to initGL · d7fa8276
      Martin Flöser authored
      Summary:
      KWin still resolves some OpenGL function pointers. For that it needs to
      use either eglGetProcAddress or glxGetProcAddress. With other words the
      method to resolve needs to know whether it is egl or glx and needs both
      a dependency to egl and glx. Especially the dependency to glx is ugly as
      that pulls in XLib into our library.
      
      The way so far was to pass an enum value to the initGL method to know
      whether it's EGL or GLX. With this change the enum value is removed and
      replaced by a function pointer to resolve the methods.
      
      This simplifies the resolve code and allows to completely remove the glx
      variant we still had in the library. Thus kwinglutils library is now glx
      and XLib free.
      
      Test Plan: nested KWin with OpenGL/EGL still works
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D3336
      d7fa8276
  24. 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...
      996ee34e
  25. 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
  26. 15 Jul, 2016 1 commit
  27. 14 Jun, 2016 1 commit
    • Martin Flöser's avatar
      Move the loadTexture for X11 pixmap functionality to the EglOnXBackend · 2b196bfa
      Martin Flöser authored
      Summary:
      To use eglCreateImageKhr for an X11 pixmap we need an EGLDisplay created
      for the same XDisplay as the X11 pixmap. This means if we created an
      EGLDisplay for a GBM device, we are not allowed to load a texture from
      the X11 pixmap and can result in a crash in the driver.
      
      Similar in the nested X11 setup the EGLDisplay is created for the
      rendering window, but the X11 pixmaps are from the Xwayland server KWin
      started. They don't belong to the same windowing system.
      
      This change addresses this problem by moving the loading of X11 pixmaps
      from AbstractEglTexture to EglTexture of the EglOnX11Backend. Thus for
      any usage on a non X11 platform we cannot hit the code path any more.
      In addition the nested X11 platform can indicate that it doesn't support
      it and thus also doesn't go through the code path.
      
      Test Plan: Tested standalone and nested X11 platform
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D1857
      2b196bfa
  28. 07 Apr, 2016 1 commit
  29. 16 Nov, 2015 2 commits
  30. 03 Nov, 2015 2 commits
  31. 09 Oct, 2015 1 commit
  32. 25 Aug, 2015 1 commit
    • Martin Flöser's avatar
      Composite windows from a QOpenGLFramebufferObject · c56bbc0d
      Martin Flöser authored
      This change introduces a mechanism for internal windows to be rendered
      to a QOpenGLFramebufferObject to be composited using the texture bound
      to the FBO. This is useful for in-process rendering (e.g. QtQuick) and
      at the same time bypassing the windowing system.
      
      The OpenGL context of the QOpenGLFramebufferObject needs to be sharing
      with the compositing OpenGL context.
      c56bbc0d
  33. 12 Aug, 2015 1 commit
  34. 21 May, 2015 1 commit
  35. 11 May, 2015 1 commit
  36. 08 May, 2015 1 commit