1. 28 Oct, 2016 2 commits
  2. 25 Oct, 2016 1 commit
    • Antonio Larrosa Jimenez's avatar
      [platformx/x11] Add a freeze protection against OpenGL · 19147f5f
      Antonio Larrosa Jimenez authored
      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
      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 t...
  3. 24 Oct, 2016 2 commits
  4. 21 Oct, 2016 2 commits
  5. 20 Oct, 2016 1 commit
    • Martin Flöser's avatar
      Add a PlatformCursorImage to Platform and EffectsHandler · ea52ef9e
      Martin Flöser authored
      There are several effects (screenshot, zoom) which need access to the
      cursor image and cursor hotspot. So far these effects used X11
      unconditionally to get the cursor which obviously does not work on
      This change adds a new class PlatformCursorImage to kwinglobals which
      wraps what a cursor is (image and hotspot) and adds a new virtual method
      to Platform to provide such a PlatformCursorImage. By default it's the
      cursor image the Platform tracks. On X11/standalone platform this new
      virtual method is overriden and provides a PlatformCursorImage from X11
      using the code previously used in screenshot effect.
      Screenshot effect and zoom are adjusted to use the new API instead of
      Test Plan:
      Zoom effect tested on Wayland, now gets the proper cursor icon.
      X11 functionality not yet tested.
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D3093
  6. 10 Oct, 2016 1 commit
    • Martin Flöser's avatar
      Add event filter for key press/release events while KWin grabbed keyboard on root window · 66d1a0cc
      Martin Flöser authored
      The modifier-only-shortcuts break as soon as KWin grabs the keyboard
      (e.g. alt+tab, present windows, etc.). The investigation shows that in
      that case KWin does not get any raw key events any more and thus gets
      confused about the state of the hold modifiers. E.g. alt+tab has the
      alt key pressed, but we miss the release as the keyboard is grabbed.
      This change addresses the problem by installing an additional event
      filter for key press and release event which only filters for key events
      on the root window. That way we can be sure that it only operates when
      KWin grabbed the keyboard on the root window.
      Note: the problem only exists when grabbing on the root window. If the
      grab is on another window (e.g. moving a window) we still do get all
      The problem also seems to not happen if another application grabbed
      keys on the root window. E.g. for key combinations grabbed by
      kglobalaccel the correct sequence of key press/release as raw events
      are reported. Also while the screen is locked the evemts are reported
      and kscreenlocker grabs the keyboard on the root window.
      Test Plan:
      Used Alt+Tab and Present Windows and tried to activate launcher
      Reviewers: #kwin, #plasma
      Subscribers: plasma-devel, kwin
      Tags: #kwin
      Differential Revision: https://phabricator.kde.org/D2980
  7. 05 Oct, 2016 1 commit
  8. 04 Oct, 2016 2 commits
  9. 28 Sep, 2016 1 commit
  10. 25 Sep, 2016 1 commit
  11. 24 Sep, 2016 2 commits
  12. 15 Sep, 2016 1 commit
  13. 14 Sep, 2016 1 commit
  14. 31 Aug, 2016 1 commit
  15. 26 Aug, 2016 1 commit
    • Martin Flöser's avatar
      [plugins/qpa] Call makeCurrent on the QOpenGLContext instead of the one in the platform context · 8909f878
      Martin Flöser authored
      SharingPlatformContext::swapBuffers needs to make the context current.
      For this is calls makeCurrent. Later on this tries to bind a fbo, which
      checks calls into the current QOpenGLContext. As we called makeCurrent on
      our own platform context Qt doesn't know that the context is current and
      returns in the worst case a nullptr and crashes.
      This change calls makeCurrent on the QOpenGLContext so that Qt also knows
      that this context is current now. The QOpenGLContext calls makeCurrent on
      the platform context, so what our code tried to do is still being done.
      In addition the method context() in AbstractPlatformContext is renamed to
      eglContext to no longer shadow the method in QPlatformContext.
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D2582
  16. 25 Aug, 2016 1 commit
    • Martin Flöser's avatar
      Forward x11 raw pointer buttons to PointerInputRedirection · 9c5f972c
      Martin Flöser authored
      The raw pointer button events intercepted in the XInput2 input filter
      get sent through the Platform to the PointerInputRedirection. This
      makes the PointerInputRedirection track the pointer button state and
      emit the signals for button changed and axis changed.
      These signals are used by the modifier-only shortcut detection to
      determine whether the shortcut should trigger.
      On X11 the "normal" input handling doesn't use the InputRedirection
      and the emitted signals are not consumed by anything else. As
      PointerInputRedirection is not inited the events are not forwarded
      to the input filter, thus won't be processed by other parts and
      won't interfere with the normal event processing on X11.
      Given that it also doesn't matter that the input filter does not
      apply the left-handed setting. The internal tracking will have a
      wrong mouse button, but nothing is going to do decisions based on
      the value of the pressed mouse button. For the moment all we are
      interested in is that a button is pressed.
      Test Plan:
      Pressed meta, clicked, scrolled, released meta: launcher
      did not open. Pressed meta, released meta: launcher opened
      Reviewers: #kwin, #plasma
      Subscribers: plasma-devel, kwin
      Tags: #kwin
      Differential Revision: https://phabricator.kde.org/D2506
      BUG: 367730
  17. 19 Aug, 2016 4 commits
    • 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
    • Martin Flöser's avatar
      [platforms/virtual] Pass ownership of gbm_device and drm fd to Platform · 4e7392b9
      Martin Flöser authored
      The Egl backend opens the drm device and creates a gbm_device from it.
      From that it creates the EGL device. The EGL device outlives the EGL
      backend (e.g. for compositor restart). So far the EGL backend destroyed
      the gbm_device when going down which mesa did not like at all when a
      new context got created on that EGL device.
      Thus the ownership of gbm_device is also passed to the Platform so that
      the compositor can be restarted.
      This makes the TestSceneOpenGL no longer crash during the restart
      compositor test.
    • Martin Flöser's avatar
      Move X11Cursor into the x11standalone platform plugin · 2a8ab547
      Martin Flöser authored
      At the same time the xinput2 integration is split out of X11Cursor
      and made a standalone part of the platform plugin. XInput integration
      is nowadays not only used by the cursor position polling, but also
      for modifier only shortcuts.
      By splitting it out the modifier shortcuts start to work also when
      one doesn't have anything requesting a mouse position polling.
      This also simplifies the conditional builds: xinput integration is
      only included if we have support for it at compile time without having
      to have many ifdefs in the cursor implementation. For the inclusion of
      cursor in the kcmkwin this also removes all the ifdefs.
      The key events are only requested if we have xinput 2.1. Otherwise we
      would not get all raw events if the input device gets grabbed.
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D2473
    • Martin Flöser's avatar
      Create Cursor instance through Platform · 03700500
      Martin Flöser authored
      By default the InputRedirectionCursor is created and only the X11
      standalone platform creates the X11 specific cursor.
      This is a preparation step for moving the X11 specific cursor
      implementation into the x11standalone platform plugin.
  18. 18 Aug, 2016 1 commit
  19. 17 Aug, 2016 1 commit
    • Bhushan Shah's avatar
      [platforms/hwcomposer] Reset old brightness when turning screen back on · c04e7643
      Bhushan Shah authored
      Now powerdevil can adjust brightness using leds subsystem, however, kwin
      as well sets brightness to 0 for turning off screen and 0xff when
      turning screen back on. This resets the brightness set by the powerdevil
      to 100%.
      As a solution now kwin listens to brightnessChanged dbus signal of
      brightnesscontrol and book-keeps the changed brightness, if screen is
      turned off it sets brightness to 0 and when turning screen on, it resets
      to old brightness.
      If powermanagement service doesn't appear on dbus by default it restores
      100% brightness.
      Test Plan:
      Appearantly this still doesn't work as-it-is on phone, because powerdevil
      doesn't emit brightnessChanged dbus signal because of bug in the driver of
      backlight control, driver doesn't seem to trigger uevents for changes in
      backlight. But with hack in powerdevil to emit brightnessChanged when setting
      brightness, this works
      Reviewers: broulik, #plasma_on_wayland, graesslin
      Reviewed By: #plasma_on_wayland, graesslin
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D2468
  20. 08 Aug, 2016 2 commits
  21. 05 Aug, 2016 1 commit
    • Martin Flöser's avatar
      Set initial count of screens before calling Screens::init · 44e37aac
      Martin Flöser authored
      Screens::init sets up a Qt::QueuedConnection connect from countChanged
      to changed. This means that when first setting up the connection a
      changed signal will be delivered in the next event cycle. This can mess
      with other code. E.g. WaylandServer recreating outputs which can make
      Xwayland crash or KWin internally crash.
      To solve this problem we just need to make sure to set the output count
      to the initial value before performing the init.
      Reviewed-By: bshah
  22. 04 Aug, 2016 1 commit
    • Martin Flöser's avatar
      Remove the unredirect fullscreen windows functionality · 996ee34e
      Martin Flöser authored
      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...
  23. 03 Aug, 2016 1 commit
    • Martin Flöser's avatar
      [platforms/x11-windows] Delay x11 event processing till Workspace is started · b1f6d4b8
      Martin Flöser authored
      If the event processing is started before everything is fully started
      it can happen that we have "evil" events which may crash either Xwayland
      or KWin itself. E.g. if the nested window is too large, the window
      manager on the host X-Server will request a resize. If the backend does
      that it can happen that the wl_output gets destroyed while Xwayland tries
      to bind to it and will crash. Thus let's delay all events till we are
      ready to process them.
  24. 21 Jul, 2016 2 commits
    • Martin Flöser's avatar
      [platforms/x11] Fix init of EGL/X11 · ace506b5
      Martin Flöser authored
      Incorrect variable naming.
    • Martin Flöser's avatar
      [platforms/virtual] Use rendernode or vgem device if available for egl · 56ce6689
      Martin Flöser authored
      The egl implementation for the virtual platform tries to use a render
      node if available. If there is no render node it looks for a virtual
      (kernel driver vgem) device, which unfortunately does not create a
      render node in mainline kernel (there are patches in ChromiumOS).
      For this the Udev wrapper is extended to search for renderNode devices
      and for virtual dri devices.
      If either render node or vgem dri device is found, it is tried to be
      opened (without logind escalation) and on success a gbm device is
      created on it. If any step of this fails the so far default behavior
      of default device is tried for creating the EGLDisplay.
      All of this is compile optional, so that the virtual platform does not
      hard depend on udev and/or gbm.
      Test Plan:
      Auto tests which need OpenGL executed and verified that they
      use the render node or vgem device.
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayl...
  25. 20 Jul, 2016 6 commits
    • Martin Flöser's avatar
      [platforms/x11] Properly reposition nested windows on resize events · 50645e8d
      Martin Flöser authored
      The position of the output being resized was adjusted instead of only
      the other outputs.
      Test Plan: Resized windows, verified xrandr
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D2235
    • Martin Flöser's avatar
      [plugins/qpa] Support SharingPlatformContext on the existing eglSurface and eglconfig · 44843f46
      Martin Flöser authored
      So far SharingPlatformContext was only used if the OpenGL context
      supports EGL_KHR_surfaceless_context. If not supported, KWin tried to
      create a context through the Wayland API. Unfortunately on hwcomposer
      platform this results in a crash as libhybris only supports the init
      of EGLDisplay for one native platform.
      This change tries to also use the SharingPlatformContext if there is
      an OpenGL context in general. It reuses the native EGLSurface created
      for the compositing scene and makes its own OpenGL context current on
      that surface, too. As KWin creates an FBO, it never renders to it, so
      it shouldn't matter at all.
      In order to prevent EGL_BAD_MATCH errors when making Qt's OpenGL context
      current also the EGLConfig from the scene is used to create the context.
      Test Plan: Tested on Nexus5 with qtvirtualkeyboard in KWin
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland...
    • Martin Flöser's avatar
      Support restarting the OpenGL compositor on Wayland · 9d7ef58b
      Martin Flöser authored
      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
      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
    • Martin Flöser's avatar
      Announce output changes to Wayland for platforms not handling outputs · d0c488f4
      Martin Flöser authored
      Most platforms like the nested and virtual do not handle the outputs
      themselves and WaylandServer announces the Outputs to Wayland.
      So far this was static: at startup it got announced once to Wayland
      and any changes were not catched.
      This change makes WaylandServer listen to changes to the Screens and
      sync them to Wayland.
      Unfortunately KWin's internal Screen information is not sufficient to
      properly synchronize this to Wayland and also Wayland by not supporting
      adding/removing modes does not help.
      Thus the solution implemented here is to add new outputs reflecting the
      changes and then removing the old ones. This creates situations with more
      outputs being present than actually there, but prevents that there are
      no outputs at all.
      Test Plan: Auto test added which verifies this for the virtual platform
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D2233
    • Martin Flöser's avatar
      [plugins/hwcomposer] Use an RGBA_8888 format for rendering surface · a95be71e
      Martin Flöser authored
      When sharing surface and config used by the compositor scene with
      QtQuick's OpenGL context an RGBA surface makes Qt way more happy.
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D2232
    • Martin Flöser's avatar
      [platforms/wayland] Use XdgShell if available and prefer it · bec69b57
      Martin Flöser authored
      With this change the Wayland platform plugin uses the XdgShell to
      create the window if available. This allows to close the window and
      thus quit the nested kwin_wayland properly.
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D2201