1. 11 Feb, 2021 2 commits
  2. 10 Feb, 2021 1 commit
    • Vlad Zahorodnii's avatar
      Move source code to src/ directory · 93e0265e
      Vlad Zahorodnii authored
      Once in a while, we receive complaints from other fellow KDE developers
      about the file organization of kwin. This change addresses some of those
      complaints by moving all of source code in a separate directory, src/,
      thus making the project structure more traditional. Things such as tests
      are kept in their own toplevel directories.
      
      This change may wreak havoc on merge requests that add new files to kwin,
      but if a patch modifies an already existing file, git should be smart
      enough to figure out that the file has been relocated.
      
      We may potentially split the src/ directory further to make navigating
      the source code easier, but hopefully this is good enough already.
      93e0265e
  3. 27 Jan, 2021 1 commit
  4. 06 Jan, 2021 3 commits
    • Vlad Zahorodnii's avatar
      Introduce RenderLoop · b8a70e62
      Vlad Zahorodnii authored
      At the moment, our frame scheduling infrastructure is still heavily
      based on Xinerama-style rendering. Specifically, we assume that painting
      is driven by a single timer, etc.
      
      This change introduces a new type - RenderLoop. Its main purpose is to
      drive compositing on a specific output, or in case of X11, on the
      overlay window.
      
      With RenderLoop, compositing is synchronized to vblank events. It
      exposes the last and the next estimated presentation timestamp. The
      expected presentation timestamp can be used by effects to ensure that
      animations are synchronized with the upcoming vblank event.
      
      On Wayland, every outputs has its own render loop. On X11, per screen
      rendering is not possible, therefore the platform exposes the render
      loop for the overlay window. Ideally, the Scene has to expose the
      RenderLoop, but as the first step towards better compositing scheduling
      it's good as is for the time being.
      
      The RenderLoop tries to minimize the latency by delaying compositing as
      close as possible to the next vblank event. One tricky thing about it is
      that if compositing is too close to the next vblank event, animations
      may become a little bit choppy. However, increasing the latency reduces
      the choppiness.
      
      Given that, there is no any "silver bullet" solution for the choppiness
      issue, a new option has been added in the Compositing KCM to specify the
      amount of latency. By default, it's "Medium," but if a user is not
      satisfied with the upstream default, they can tweak it.
      b8a70e62
    • Vlad Zahorodnii's avatar
      platforms/wayland: Present buffers even if nothing has been changed · bc9df67c
      Vlad Zahorodnii authored
      Present buffers event if nothing has been changed on the screen because
      we want to receive the frame callback.
      bc9df67c
    • Vlad Zahorodnii's avatar
      Swap buffers after finishing a compositing cycle · 0ceff5fd
      Vlad Zahorodnii authored
      The compositing timing algorithm assumes that glXSwapBuffers() and
      eglSwapBuffers() block. While this was true long time ago with NVIDIA
      drivers, nowadays, it's not the case. The NVIDIA driver queues
      several buffers in advance and if the application runs out of them,
      it will block. With Mesa driver, swapping buffer was never blocking.
      
      This change makes the render backends swap buffers right after ending
      a compositing cycle. This may potentially block, but it shouldn't be
      an issue with modern drivers. In case it gets proven, we can move
      glXSwapBuffers() and eglSwapBuffers() in a separate thread.
      
      Note that this change breaks the compositing timing algorithm, but
      it's already sort of broken with Mesa drivers.
      0ceff5fd
  5. 08 Dec, 2020 1 commit
  6. 03 Dec, 2020 1 commit
  7. 02 Dec, 2020 1 commit
  8. 24 Nov, 2020 1 commit
  9. 12 Nov, 2020 2 commits
  10. 11 Nov, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Refactor how per screen rendering is handled · 755dd81e
      Vlad Zahorodnii authored
      In order to allow per screen rendering, we need the Compositor to be
      able to drive rendering on each screen. Currently, it's not possible
      because Scene::paint() paints all screen.
      
      With this change, the Compositor will be able to ask the Scene to paint
      only a screen with the specific id.
      755dd81e
  11. 30 Oct, 2020 2 commits
  12. 16 Oct, 2020 1 commit
  13. 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 and Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez committed
      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
  14. 18 Aug, 2020 1 commit
  15. 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
  16. 23 Jul, 2020 1 commit
  17. 21 Jul, 2020 1 commit
  18. 30 Apr, 2020 1 commit
  19. 29 Mar, 2019 1 commit
  20. 20 Mar, 2019 2 commits
    • Aleix Pol Gonzalez's avatar
      RFC: Fix wayland backend initialisation · 6d37ce7f
      Aleix Pol Gonzalez authored
      Summary:
      Otherwise it thinks outputs couldn't be created and it leaves.
      Problem is that after this fix it crashes when it actually does things with:
      kwin_wayland: /home/apol/devel/frameworks/kwin/composite.cpp:646: void KWin::Compositor::aboutToSwapBuffers(): Assertion `!m_bufferSwapPending' failed.
      
      Test Plan: As said, it proceeds correctly and crashes elsewhere
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: davidedmundson, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D19921
      6d37ce7f
    • Roman Gilg's avatar
      [platforms/wayland] Multi output support · 7b13393b
      Roman Gilg authored
      Summary:
      This patch rewrites large parts of the Wayland platform plugin, in order to
      facilitate the testing of multi output behavior in nested KWin sessions.
      
      For that a new class WaylandOutput is introduced, which is based on
      AbstractOutput and by that shares functionality with our virtual and DRM
      platform plugins.
      
      The EGL/GBM and QPainter backends have been remodelled after the DRM one,
      sharing similiarities there as well now.
      
      Pointer grabbing has been rewritten to support multiple outputs, now using
      pointer locking instead of confining and drawing in this case onto a sub-
      surface, which get dynamically recreated in between the different output
      surfaces while the cursor is being moved.
      
      Window resizing is possible if host supports xdg-shell, but currently the
      mode size does not yet fill the new window size.
      
      The number of outputs can be set by command line argument `--output-count`,
      scaling is also supported by setting the argument `--scale`.
      
      Further steps could be:
      * Enabling automatic fill of resized windows via Wayland mode change
      * Multiple diverging initial sizes and scale factors for mulitple outputs
      
      **Watch it in action:** https://youtu.be/FYItn1jvkbI
      
      Test Plan: Tested it in live session.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: davidedmundson, zzag, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D18465
      7b13393b
  21. 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
  22. 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
  23. 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
  24. 12 Apr, 2016 1 commit
    • Martin Flöser's avatar
      Move backends/ to plugins/platforms/ · 2bff9097
      Martin Flöser authored
      Summary:
      Source code reorganization:
      The base class AbstractBackend got renamed to Platform, thus the
      "backends" are "platforms" now. As they are plugins they should go
      together with other KWin plugins which are nowadays in the folder
      plugins.
      
      So new location is plugins/platforms/
      
      Reviewers: #plasma, sebas
      
      Subscribers: plasma-devel
      
      Projects: #plasma
      
      Differential Revision: https://phabricator.kde.org/D1353
      2bff9097
  25. 26 Nov, 2015 1 commit
    • Martin Flöser's avatar
      Add pure virtual OpenGLBackend::init() method · b1914b4b
      Martin Flöser authored
      All backends already have an init method so far called from the ctor.
      This change moves the call to init out of the OpenGL backends and makes
      it the responsibility of the creating code to also call init on the
      backend.
      
      This change makes it easier to have virtual methods being called during
      the initialization.
      b1914b4b
  26. 17 Nov, 2015 1 commit
  27. 16 Nov, 2015 1 commit
  28. 03 Nov, 2015 1 commit
    • Martin Flöser's avatar
      Runtime depend on GLES in all egl backends · 14d943ca
      Martin Flöser authored
      As we don't have GLPLatform before the backend is fully created
      the AbstractEglBackend has a new method isOpenGLES() -> bool
      which determines based on QOpenGLContext::openGLModuleType().
      14d943ca
  29. 05 May, 2015 2 commits
  30. 23 Mar, 2015 1 commit
  31. 20 Mar, 2015 1 commit
    • Martin Flöser's avatar
      Introduce a shared base class for the EGL backends · dae8eed3
      Martin Flöser authored
      There's quite some overlap and duplicated code. This AbstractEglBackend
      tries to merge the two backends a little bit again.
      
      This also introduces an AbstractEglTexture which supports both X11 and
      Wayland "pixmaps" so that EglOnXBackend can support Wayland buffers.
      dae8eed3
  32. 17 Mar, 2015 1 commit
    • Martin Flöser's avatar
      EGLImage -> EGLImageKHR · cd293220
      Martin Flöser authored
      CI system didn't like EGLImage, but always liked EGLImageKHR. So let's
      try whether using EGLImageKHR fixes build.
      cd293220