1. 23 Sep, 2020 1 commit
  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 2 commits
  5. 22 Jun, 2020 1 commit
  6. 28 Feb, 2020 2 commits
    • David Edmundson's avatar
      [platforms/drm] Rewrite rotation rendering to use MapTexture · 8ff01fa6
      David Edmundson authored
      Summary:
      The previous code uses a fixed version of GSLS which does not match our suported GL targets. We need both, using kwin's existing MapTexture framework we can achieve the same thing in a better way with less code.
      
      Test Plan:
      Had some slight issues with the rotation, but everything appeared the same
      as when I applied the patchset with the custom shader.
      
      Reviewers: #kwin, zzag
      
      Reviewed By: #kwin, zzag
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D26371
      8ff01fa6
    • Roman Gilg's avatar
      [platforms/drm] Introduce Gl post-process output rotations · 81806622
      Roman Gilg authored
      Summary:
      In case the hardware is not able to rotate the output for the configured
      rotation value do this rotation in a post-process step.
      
      For that rendering the current view into a separate framebuffer bound to a
      texture that then gets sampled to the default framebuffer in an additional
      rendering pass through a simple shader rotating it.
      
      This allows us to leave the Effects system and internal model-view-projection
      matrix untouched. The rotation in the post-processing step is isolated.
      
      BUG: 389665
      FIXED-IN: 5.18
      
      Test Plan: With KScreen all rotations work.
      
      Reviewers: #kwin
      
      Subscribers: davidedmundson, PureTryOut, z3ntu, zzag, univerz, kwin
      
      Tags: #kwin
      
      Maniphest Tasks: T6106
      
      Differential Revision: https://phabricator.kde.org/D25907
      81806622
  7. 16 Jan, 2020 1 commit
  8. 10 Dec, 2019 1 commit
    • Roman Gilg's avatar
      [platforms/drm] Do EglGbmBackend chore · fde3b1f6
      Roman Gilg authored
      Summary:
      This is a small overhaul of the EglGbmBackend. Functions are restructured,
      white space added and variables renamed for better readability and style
      aligned with Frameworks Coding Style.
      
      Test Plan: Session starts.
      
      Reviewers: #kwin, zzag
      
      Reviewed By: #kwin, zzag
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D25830
      fde3b1f6
  9. 26 Nov, 2019 1 commit
  10. 14 Nov, 2019 1 commit
    • Roman Gilg's avatar
      Remove vsync detection and configurability · b3a19f9e
      Roman Gilg authored
      Summary:
      Selecting not to vsync does not make sense for an X11 compositor. In the end
      we want clients to be able to present async if they want to but the compositor
      is supposed to send swaps with vsync to the XServer in order to not generate
      tearing artifacts.
      
      There was also a detection logic which did some questionable things in case
      vsync was not available. I don't think this is necessary at all since we can
      just always run a timer to present with or without vsync.
      
      Test Plan: kwin_x11 tested on i915.
      
      Reviewers: #kwin, zzag
      
      Subscribers: zzag, kwin
      
      Tags: #kwin
      
      Maniphest Tasks: T11071
      
      Differential Revision: https://phabricator.kde.org/D23511
      b3a19f9e
  11. 31 Aug, 2018 1 commit
    • Roman Gilg's avatar
      Introduce generic Output class · fe63e21f
      Roman Gilg authored
      Summary:
      In order to separate high-level properties of individual outputs from
      hardware-specific ones and access these, introduce a new generic class Output.
      
      Also make the DrmOutput class directly a child class of this generic class.
      
      The long-term goal is to get rid of the Screens global object on Wayland and
      instead directly work with Output objects on compositing level.
      
      This should enable us long-term to do direct scanout to hardware planes, what
      I predict needs this generic output representation at one point.
      
      Test Plan: Manually.
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D11781
      fe63e21f
  12. 05 Apr, 2018 1 commit
    • Alexey Min's avatar
      drm backend: choose correct EGL config with mesa-18 · 0ccecbc4
      Alexey Min authored
      Do not blindly select first EGL config from returned list, but choose the one that matches GBM surfaces, that will be created later.
      GBM surfaces are created with GBM_FORMAT_XRGB8888 format, so choose the config that matches it.
      With wrong format EglGbmBackend::resetOutput() will later fail with error EGL_BAD_MATCH.
      
      Test Plan: Compile, run startplasmacompositor. Verify that OpenGL compositing is used, either by kwin debug console, or by kwin support information.
      
      Reviewers: graesslin, davidedmundson, #kwin, #plasma_on_wayland, bshah
      
      Reviewed By: davidedmundson
      
      Subscribers: zzag, kwin, #kwin
      
      Tags: #kwin, #plasma_on_wayland
      
      Differential Revision: https://phabricator.kde.org/D11758
      0ccecbc4
  13. 04 Apr, 2018 1 commit
    • Alexey Min's avatar
      drm backend: choose correct EGL config with mesa-18 · d318cb3b
      Alexey Min authored
      Summary:
      Do not blindly select first EGL config from returned list, but choose the one that matches GBM surfaces, that will be created later.
      GBM surfaces are created with GBM_FORMAT_XRGB8888 format, so choose the config that matches it.
      With wrong format EglGbmBackend::resetOutput() will later fail with error EGL_BAD_MATCH.
      
      Test Plan: Compile, run startplasmacompositor. Verify that OpenGL compositing is used, either by kwin debug console, or by kwin support information.
      
      Reviewers: graesslin, davidedmundson, #kwin, #plasma_on_wayland, bshah
      
      Reviewed By: davidedmundson
      
      Subscribers: zzag, kwin, #kwin
      
      Tags: #kwin, #plasma_on_wayland
      
      Differential Revision: https://phabricator.kde.org/D11758
      d318cb3b
  14. 25 Mar, 2018 1 commit
    • Oleg `Kanedias` Chernovskiy's avatar
      GBM remote access support for KWin · 4d46edd7
      Oleg `Kanedias` Chernovskiy authored
      Summary:
      Implements a KWayland protocol to pass GBM fd from KWin to KRfb and
      addictions to relevant projects from both sides.
      
      Note that this patch does not affect default behaviour of mentioned projects. It can be used
      only with KWIN_REMOTE=1 in env from KWin side and with preferredFrameBufferPlugin=gbm in krfbrc from
      KRfb side. In all other aspects app behaviour remains unchanged.
      
      Test Plan: Launched KWin in Wayland mode, launched KRfb in it, launched KRDC on a laptop, connected in read-only mode, observed a correctly retrieved desktop with Krfb window
      
      Reviewers: graesslin, davidedmundson, romangg, #kwin
      
      Reviewed By: davidedmundson, romangg, #kwin
      
      Subscribers: kossebau, jgrulich, romangg, ngraham, alexeymin, aacid, kwin, #kwin, davidedmundson, plasma-devel
      
      Tags: #plasma_on_wayland, #kwin
      
      Maniphest Tasks: T5653, T7785
      
      Differential Revision: https://phabricator.kde.org/D1230
      4d46edd7
  15. 15 Feb, 2018 1 commit
  16. 13 Nov, 2017 1 commit
  17. 31 Oct, 2017 2 commits
    • Martin Flöser's avatar
      [platforms/drm] Fix typo in cleanup of eglSurface · 7739dea3
      Martin Flöser authored
      When switching modes the wrong surface was destroyed resulting in a
      crash.
      7739dea3
    • Martin Flöser's avatar
      [drm] Implement changing of modes · 33a4cf40
      Martin Flöser authored
      Summary:
      This change hooks up the bits for changing the mode when a request to
      change mode from kscreen is received. This includes:
       * setting new mode in DrmOutput
       * creating new buffers in SceneQPainter backend
       * creating new GbmSurface in SceneOpenGL backend
      
      Room for improvement:
       * detect whether the new mode works and go back to old one if it fails
      
      Test Plan:
      Started both a QPainter/OpenGL session. Used kcmshell5 kscreen
      to modify the resolution. Saw that it got applied, maximized a window to
      verify it's correct. Changed back to original resolution. Verified it looked
      good by maximizing a window.
      
      Reviewers: #kwin, #plasma, subdiff, sebas
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D8398
      33a4cf40
  18. 25 Oct, 2017 1 commit
    • David Edmundson's avatar
      Fix viewport on vertically stacked monitors · 5d7e22e5
      David Edmundson authored
      Summary:
      We want to translate by the monitor position, so that needs to be
      the negative of the position.
      
      But Kwin/KScreen treats 0 as the top of all monitors. GL treats 0 as
      bottom, so that all needs inverting.
      
      Hence this should be a positive y value for the viewport.
      
      BUG: 386099
      BUG: 385655
      
      Test Plan:
      Had two monitors
      Side by side was - fine
      Stacked vertically - still fine
      
      Modded X code to extend in y instead of x.
      3 monitors worked fine.
      
      Nested wayland only seems to support one screen?
      
      Reviewers: #plasma
      
      Subscribers: plasma-devel, kwin, #kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D8479
      5d7e22e5
  19. 12 Oct, 2017 1 commit
    • David Edmundson's avatar
      Fix DRM EGL crash regression · 5bca0588
      David Edmundson authored
      Summary:
      In 47343fb8 we made GBM buffer shared.
      
      What we wanted to do was:
      Unbox the shared_pointer<GBMSurface> to give us a GBMSurface* object
      Call the gbm_surface*() on that operator
      Then cast that to a void* for eglCreatePlatformWindowSurfaceEXT
      
      What we did:
      Cast the std::shared_ptr<GBMSurface> to a gbm_surface*  then cast that
      to void*.
      This is just a garbage value and it crashes in Mesa when we do our first
      paint.
      
      I've replaced that with an explicit method then we can use shared_ptr's
      -> operator rather than get() which does the right thing in a readable
      way.
      
      Test Plan:
      It crashed after rebasing to master (for Aleix too)
      No longer crashes
      
      Reviewers: #plasma
      
      Subscribers: plasma-devel, kwin, #kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D8251
      5bca0588
  20. 11 Oct, 2017 1 commit
    • David Edmundson's avatar
      Fix DRM EGL crash regression · 3d619c99
      David Edmundson authored
      Summary:
      In 47343fb8 we made GBM buffer shared.
      
      What we wanted to do was:
      Unbox the shared_pointer<GBMSurface> to give us a GBMSurface* object
      Call the gbm_surface*() on that operator
      Then cast that to a void* for eglCreatePlatformWindowSurfaceEXT
      
      What we did:
      Cast the std::shared_ptr<GBMSurface> to a gbm_surface*  then cast that
      to void*.
      This is just a garbage value and it crashes in Mesa when we do our first
      paint.
      
      I've replaced that with an explicit method then we can use shared_ptr's
      -> operator rather than get() which does the right thing in a readable
      way.
      
      Test Plan:
      It crashed after rebasing to master (for Aleix too)
      No longer crashes
      
      Reviewers: #plasma
      
      Subscribers: plasma-devel, kwin, #kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D8251
      3d619c99
  21. 05 Oct, 2017 1 commit
    • Martin Flöser's avatar
      [platforms/drm] Use a shared pointer for gbm_surface · 47343fb8
      Martin Flöser authored
      Summary:
      The gbm_surface is owned by the EglGbmBackend, but it's not the only one
      using it. The DrmSurfaceBuffer is also using it and needs it to destroy
      the gbm_bo. Now this can become a problem in the following situation:
      
      * a page flip is still pending
      * the EglGbmBackend destroys the gbm_surface
      
      -> when the page flip happens the DrmSurfaceBuffer will try to destroy
      the gbm_bo and crash as the gbm_surface is no longer valid. This
      situation can happen when switching screens or when switching compositing
      backend (OpenGL 2 -> OpenGL 3).
      
      To address this problem a class GbmSurface is added which wrapps the
      gbm_surface pointer. The EglGbmBackend creates and holds a shared pointer
      to the GbmSurface and passes that one to the DrmSurfaceBuffer. So when
      cleaning up the gbm_surface only the shared pointer is reset and in case
      the DrmSurfaceBuffer still needs it, it can access it without problems.
      
      BUG: 385372
      FIXED-IN: 5.11.0
      
      Test Plan: Not yet
      
      Reviewers: #kwin, #plasma, subdiff
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D8152
      47343fb8
  22. 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
  23. 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
  24. 09 May, 2017 1 commit
    • Roman Gilg's avatar
      [DRM plugin] Remember static kernel objects, amplify use of DrmCrtc · a0571ccf
      Roman Gilg authored
      To get an image from KWin to the screen in the DRM pipeline we combine a CRTC,
      an encoder and a connector. These objects are static in the sense, that they
      represent real hardware on the graphics card, which doesn't change in a
      session. See here for more details:
      https://01.org/linuxgraphics/gfx-docs/drm/gpu/drm-kms.html
      
      Until now we used DrmOutput as the main representation for such an active
      rendering pipeline. I.e. it gets created and destroyed on hot plug events of
      displays. On the other side we had no fixed representation of the static kernel
      objects throughout the lifetime of KWin. This has several disadvantages:
      * We always need to query all available static objects on an hot plug event.
      * We can't manipulate the frame buffer of a CRTC after an output has been
        disconnected
      * Adding functionality for driving multiple displays on a single CRTC (i.e.
        cloning) would be difficult
      * We can't destroy the last frame buffer on display disconnect because the CRTC
        still accesses it and have therefore a memory leak on every display disconnect
      
      This patch  solves these issues by storing representations of all available CRTC
      and Connector objects in DrmBackend on init via DrmCrtc and DrmConnector
      instances. On an hotplug event these vectors are looped for a fitting CRTC and
      Connector combinations. Buffer handling is moved to the respective CRTC
      instance. All changes in overview:
      * Query all available CRTCs and Connectors and save for subsequent hotplug
        events
      * Fix logic errors in `queryResources()`
      * Move framebuffers, buffer flip and blank logic in DrmCrtc
      * Remove `restoreSaved()`. It isn't necessary and is dangerous if the old
        framebuffer was deleted in the meantime. Also could reveal sensitive user
        info from old session.
      
      Test Plan:
      Login, logout, VT switching, connect and disconnect external monitor, energy
      saving mode.
      
      Reviewers: #kwin
      
      Subscribers: kwin, #kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D5118
      a0571ccf
  25. 28 Apr, 2017 1 commit
    • David Edmundson's avatar
      Implment DRM EGL scaling · 86b7189b
      David Edmundson authored
      Summary: We need to set the viewport so that we scale from device pixels to global compositor space.
      
      Test Plan:
      Ran kwin_wayland properly on my laptop without setting KWIN_COMPOSE.
      Most things worked.
      
      Reviewers: #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D3504
      86b7189b
  26. 17 Mar, 2017 1 commit
    • Roman Gilg's avatar
      [DrmBackend] Straighten out EGL surface buffer release logic on page flip · a347d009
      Roman Gilg authored
      The logic on page flips was inconsistent in the sense, that it should never
      release a GBM buffer before it's not used (i.e. viewable on the display)
      anymore. This happened unintended until now (on page flip we never really
      did something useful in the else statement, because if we're here it's not
      a GBM buffer anyway).
      
      With this patch we:
      * delete on page flips always only the old buffer, which is not used anymore
      * release the buffer earlier on interrupts like display disconnect in order
        to be able to destroy the EGL context
      
      Test Plan:
      Tested in non atomic mode (atomic mode is obsolete right now until my other
      WIP patch D4539 is ready to be merged): Login, logout, suspend, normal use.
      
      Reviewers: #kwin, graesslin
      
      Reviewed By: #kwin, graesslin
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D5060
      a347d009
  27. 31 Aug, 2016 1 commit
  28. 19 Aug, 2016 1 commit
    • Martin Flöser's avatar
      [platforms/drm] Pass ownership of gbm_device to Platform · a67ccc35
      Martin Flöser authored
      Just like 4e7392b9:
      the ownership of the gbm_device must be passed to the Platform as
      the ownership of the EGLDisplay is also passed to the Platform and
      we may not destroy the gbm_device for an EGLDisplay we are still using.
      
      With this change I could restart the OpenGL compositor successfully
      and switch from OpenGL 3.1 to OpenGL 2 without a crash or rendering
      issues.
      a67ccc35
  29. 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
  30. 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
  31. 21 Mar, 2016 1 commit
    • Sebastian Kügler's avatar
      Split drm_backend.{h,cpp} into separate files · 629cc701
      Sebastian Kügler authored
      Summary:
      This changes splits up the monster file containing different types used
      in the DRM backend into separate files per class:
      
      - drm_backend.{h,cpp}
      - drm_buffer.{h,cpp}
      - drm_inputeventfilter.{h,cpp}
      - drm_output.{h,cpp}
      - drm_pointer.h
      
      No actual code changes other than build fixes.
      
      Clean up headers in the split files.
      
      Test Plan: Builds with GBM enabled
      
      Reviewers: graesslin
      
      Reviewed By: graesslin
      
      Subscribers: plasma-devel
      
      Projects: #plasma
      
      Differential Revision: https://phabricator.kde.org/D1168
      629cc701
  32. 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
  33. 16 Nov, 2015 1 commit
  34. 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
  35. 17 Jul, 2015 1 commit
  36. 05 May, 2015 1 commit