1. 08 Jun, 2020 1 commit
    • Uday Kiran Pichika's avatar
      Add support for VRR in modesetting DDX · 7089ceda
      Uday Kiran Pichika authored
      This patch adds support for setting the CRTC variable refresh property
      for suitable windows flipping via the Present extension.
      The "VariableRefresh" Option is added to modesetting backend in this patch. This
      option defaults to false, and must be set to "true" in an X conf
      file for variable refresh support in the driver. Also DRM connector should
      be VRR capable.
      In order for a window to be suitable for variable refresh it must have
      the _VARIABLE_REFRESH property with a 32-bit CARDINAL value of 1.
      Then the window must pass the checks required to be suitable for
      Present extension flips - it must cover the entire X screen and no
      other window may already be flipping.
      With these conditions met every CRTC for the X screen will have their
      variable refresh property set to true.
      Signed-off-by: default avatarUday Kiran Pichika <pichika.uday.kiran@intel.com>
  2. 15 Apr, 2020 9 commits
    • Jon Turney's avatar
      hw/xwin: Drop call to setlocale() · 2fe13a1f
      Jon Turney authored
      Since we now only work with UTF-8 (or ISO8859-1) text in the clipboard,
      we don't need to setlocale().
    • Jon Turney's avatar
      hw/xwin: Consistently use BOOL type from Xmd.h · f269e01e
      Jon Turney authored
      This avoids including Xdefs.h, which means we avoid all the issues with
      _XSERVER64 effecting how types are defined by that.
    • Jon Turney's avatar
      hw/xwin: Remove XSetAuthorization() for helper clients · 4055fed1
      Jon Turney authored
      All helper client code now uses xcb, so calling XSetAuthorization() is
      no longer needed.
      This is the last reference to libX11 from helper clients, so linking
      with x11-xcb and libX11 is no longer required.
      Also drop (unneeded?) linking with libXau.
      Also drop installing these prerequistes on AppvVeyor.
      Also move prototypes for functions in winauth.c from win.h into a new
      header, winauth.h, and include that where needed.
    • Jon Turney's avatar
      hw/xwin: xcbify clipboard integration · 9e02e023
      Jon Turney authored
      Convert clipboard integration code from libX11 to xcb
      This drops support for COMPOUND_TEXT.  Presumably some ancient
      (pre-2000) clients exist which support that, but not UTF8_STRING, but we
      don't have an example to test with. (Given the nature of the thing, the
      users of those clients probably work in CJK languages)
      Supporting COMPOUND_TEXT would also involve writing (or extracting from
      Xlib) support for the ISO 2022 encoding.
      Fix the length of text property set by a SelectionRequest
      The length of the text property is not neccessarily the same as the
      length of the clipboard text before it is d2u converted (specifically,
      if that contains any '\r\n' sequences, it will be shorter as they are
      now just '\n')
    • Jon Turney's avatar
      hw/xwin: Remove nounicodeclipboard option · f4936de7
      Jon Turney authored
      Always use CF_UNICODETEXT clipboard format.  Windows will automatically
      down-convert to CF_TEXT for clients which request that.
      This is subtly different in one way: if CF_TEXT is requested, we now
      post CF_UNICODETEXT and it is converted to CF_TEXT *in the locale of the
      requesting process*.  Previously, we would convert to CF_TEXT *in our
      locale* and post that.
      It looks like the code in the !X_HAVE_UTF8_STRING case didn't actually
      work correctly, but fortunately that has never been true...
    • Jon Turney's avatar
      hw/xwin: Remove support for pre-Vista Win32 clipboard API · 9f51dfde
      Jon Turney authored
      The original Win32 clipboard API is widely regarded as terrible, since
      it relies on clients co-operatively managing the clipboard viewer chain,
      and a single buggy client can break it for all other clients.
      The last Windows version only supporting that API was Windows XP (5.1),
      EOLed in 2014.
      (This requires MinGW-w64 w32api 6.0.0 or later for
      Add/RemoveClipboardListener correctly exported by the x86_64 user32
    • Jon Turney's avatar
    • Jon Turney's avatar
      hw/xwin: Warn about too large Windows -> X clipboard pastes · d7010cd9
      Jon Turney authored
      XChangeProperty() requests larger than the ~16MB permitted even with
      BigReq will fail BadLength
    • Jon Turney's avatar
      hw/xwin: Implement INCR protocol for X clipboard -> Windows clipboard · 56a91f20
      Jon Turney authored
      Also, relax the timeout mechanism so it allows 1 second between events,
      rather than 1 second for the entire transfer, as transfers of large
      pastes can take more than 1 second.
      Also, prefer UTF8_STRING encoding to COMPOUND_TEXT encoding
  3. 10 Apr, 2020 1 commit
    • Michael Stapelberg's avatar
      Xorg: honor AutoRepeat option · 4f95d87d
      Michael Stapelberg authored
      This option was implemented before the drivers were split in ≈2006,
      and e.g. XWin still supports it.
      With this commit, Xorg regains support, so that the following configuration can
      be used to set the repeat rate for all keyboard devices without having to modify
      Xorg command-line flags or having to automate xset(1):
      Section "InputClass"
              Identifier "system-keyboard"
              MatchIsKeyboard "on"
              Option "XkbLayout" "de"
              Option "XkbVariant" "neo"
      	Option "AutoRepeat" "250 30"
      Signed-off-by: default avatarMichael Stapelberg <stapelberg@google.com>
  4. 30 Mar, 2020 3 commits
  5. 23 Mar, 2020 1 commit
    • Vasily Khoruzhick's avatar
      glx: fixup symbol name for get_extensions function · b56e5010
      Vasily Khoruzhick authored
      glxProbeDriver() concatenates __DRI_DRIVER_GET_EXTENSIONS with driver name
      to get symbol name for get_extension function. Unfortunately that doesn't
      work for drivers that have hyphen in their name, e.g. sun4i-drm --
      get_extensions() for these uses underscore instead.
      As result dlsym() doesn't find get_extension() function and AIGLX
      initialization fails resulting in following message in Xorg.0.log:
      (EE) AIGLX error: sun4i-drm does not export required DRI extension
      Replace all non-alpha-numeric characters with underscore to fix the issue.
      Signed-off-by: Vasily Khoruzhick's avatarVasily Khoruzhick <anarsoul@gmail.com>
  6. 17 Mar, 2020 1 commit
  7. 13 Mar, 2020 2 commits
  8. 28 Feb, 2020 1 commit
    • mntmn's avatar
      xwayland: port rooted xwayland from wl_shell to xdg-shell protocol · 3d6efc4a
      mntmn authored
      Recently, rooted Xwayland crashes on wlroots-based compositors, because
      wlroots removed the deprecated wl_shell protocol.
      This MR fixes this by changing the code in question to the xdg-shell
      protocol. My motivation do this: on etnaviv-based embedded platforms,
      rooted Xwayland is much faster and doesn't cause UI rendering bugs
      compared to rootless Xwayland.
      Signed-off-by: default avatarLukas F. Hartmann <lukas@mntre.com>
  9. 25 Feb, 2020 2 commits
    • Peter Harris's avatar
      xkb: fix key type index check in _XkbSetMapChecks · de940e06
      Peter Harris authored
      This code block was moved from a function that returns 0 for failure to a
      function that returns 0 for Success in commit
      . Change the return value to
      BadValue to match the other checks in _XkbSetMapChecks.
      Set nTypes to xkb->map->num_types when XkbKeyTypesMask is not set, to
      allow requests with the XkbKeyTypesMask flag unset in stuff->present to
      Fixes a potential heap smash when client->swapped is true, because the
      remainder of the request will not be swapped after "return 0", but
      _XkbSetMap will be called anyway (because 0 is Success).
      Signed-off-by: Peter Harris's avatarPeter Harris <pharris@opentext.com>
    • Peter Harris's avatar
      xkb: only swap once in XkbSetMap · 270e4397
      Peter Harris authored
      The server swaps part of the request in _XkbSetMapChecks instead of
      SProcXkbSetMap (presumably because walking the XkbSetMap request is hard,
      and we don't want to maintain another copy of that code).
      Swap the first time _XkbSetMapChecks is called, not the second time.
      Signed-off-by: Peter Harris's avatarPeter Harris <pharris@opentext.com>
  10. 23 Feb, 2020 11 commits
    • Hans de Goede's avatar
      xwayland: Remove unnecessary xwl_window_is_toplevel() check from... · d4faab87
      Hans de Goede authored
      xwayland: Remove unnecessary xwl_window_is_toplevel() check from xwl_output_set_window_randr_emu_props()
      Since the recent fix to call xwl_output_set_window_randr_emu_props() from
      ensure_surface_for_window(), it is now only called on a toplevel window,
      so the is-toplevel check is not necessary for the
      xwl_output_set_window_randr_emu_props() case.
      This commit moves the check to xwl_output_set_randr_emu_prop_callback()
      so that we only do it when we are walking over all Windows of a client
      to update the property on a change of the emulated resolution.
      Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    • Hans de Goede's avatar
      xwayland: Fix setting of _XWAYLAND_RANDR_EMU_MONITOR_RECTS prop on new windows · 148f428d
      Hans de Goede authored
      For window-manager managed windows, xwl_realize_window is only called for
      the window-manager's decoration window and not for the actual client window
      on which we should set the _XWAYLAND_RANDR_EMU_MONITOR_RECTS prop.
      Usualy this is not a problem since we walk all client windows to update
      the property when the resolution is changed through a randr call.
      But for apps which first do the randr change and only then create their
      window this does not work, and our xwl_output_set_window_randr_emu_props
      call in xwl_realize_window is a no-op as that is only called for the wm
      decoration window and not for the actual client's window.
      This commit fixes this by making ensure_surface_for_window() call
      xwl_output_set_window_randr_emu_props on the first and only child of
      window-manager managed windows.
      Note this also removes the non-functional xwl_output_set_window_randr_emu_props
      call from xwl_realize_window, which was intended to do this, but does not
      This fixes apps using the ogre3d library always running at the
      monitors native resolution.
      Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    • Hans de Goede's avatar
      xwayland: Call xwl_window_check_resolution_change_emulation() on newly created O-R windows · 4cfc2677
      Hans de Goede authored
      Some clients, which use vidmode to change the resolution when going fullscreen,
      create an override-redirect window and never trigger the screen->ResizeWindow
      callback we rely on to do the xwl_window_check_resolution_change_emulation().
      This causes us to not apply a viewport to them, causing the fullscreen window
      to not fill the entire monitor.
      This commit adds a call to xwl_window_check_resolution_change_emulation()
      at the end of ensure_surface_for_window() to fix this. Note that
      ensure_surface_for_window() exits early without creating an xwl_window
      for new windows which will not be backed by a wayland surface and which
      thus will not have an xwl_window.
      This fixes ClanLib-0.6.x and alleggl-4.4.x using apps not properly
      Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    • Hans de Goede's avatar
      xwayland: Fix emulated modes not being removed when screen rotation is used · 88342353
      Hans de Goede authored
      The code building the mode-list does the following to deal with screen
          if (need_rotate || xwl_output->rotation & (RR_Rotate_0 | RR_Rotate_180)) {
              mode_width = xwl_output->width;
              mode_height = xwl_output->height;
          } else {
              mode_width = xwl_output->height;
              mode_height = xwl_output->width;
      This means we need to do something similar in xwl_output_set_emulated_mode()
      to determine if the mode being set is the actual (not-emulated) output mode
      and we this should remove any emulated modes set by the client.
      All callers of xwl_output_set_emulated_mode always pass a mode pointer
      to a member of xwl_output->randr_output->modes, so we do not need to
      duplicate this code, instead we can simply check that the passed in mode
      is modes[0] which always is the actual output mode.
      Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    • Hans de Goede's avatar
      xwayland: Also hook screen's MoveWindow method · 10df0437
      Hans de Goede authored
      Not only hook the ResizeWindow method of the screen (which really is
      MoveAndResize) but also hook the MoveWindow method for checking if we
      need to setup a viewport for resolution change emulation.
      Our resolution change emulation check if the windows origin matches
      the monitors origin and the windows origin can also be changed by just
      a move without being resized.
      Also checking on a move becomes esp. important when we move to checking
      on changes to the top-level non-window-manager client (X11)Window instead
      of on changes to the xwl_window later on in this patch series.
      Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    • Hans de Goede's avatar
      xwayland: Also check resolution-change-emulation when the xwl_window itself moves · 4fc10746
      Hans de Goede authored
      The recent change to use the top-level non-window-manager Window drawable
      coordinates from xwl_window_check_resolution_change_emulation() in
      combination with only calling it on a resize when the top-level window
      is moved breaks things with mutter/gnome-shell.
      When fullscreening a X11 window, mutter moves its window-decoration Window
      wrapping the top-level Window to the monitor's origin coordinates (e.g. 0x0)
      last. This updates the top-level's drawable coordinates, but as the
      actual MoveWindow is called on the wrapper Window and not on the toplevel
      we do not call xwl_window_check_resolution_change_emulation() and we never
      enable the viewport.
      This commit fixes this by also calling
      xwl_window_check_resolution_change_emulation() if the Window being moved
      is an xwl_window itself.
      Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    • Roman Gilg's avatar
      xwayland: Check emulation on client toplevel resize · 6d98f840
      Roman Gilg authored
      When a reparented window is resized directly check the emulation instead of
      doing this only when the window manager parent window is resized, what might
      never happen.
      For that to work we need to make sure that we compare the current size of the
      client toplevel when looking for an emulated mode.
      Changes by Hans de Goede:
      - Remove xwl_window x, y, width and height members as those are no longer used.
      - Add check for xwl_window_from_window() returning NULL.
      Signed-off-by: Roman Gilg's avatarRoman Gilg <subdiff@gmail.com>
      Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    • Roman Gilg's avatar
      xwayland: Make window_get_none_wm_owner return a Window instead of a Client · 060f1006
      Roman Gilg authored
      Make window_get_none_wm_owner return the first non-wm-window instead of the
      owner (client) of the first non-wm-window and rename it to
      window_get_client_toplevel to match its new behavior.
      This is a preparation patch for switching to using the drawable coordinates
      in xwl_window_should_enable_viewport()
      Changes by Hans de Goede:
      - Split this change out into a separate patch for easier reviewing
      - Rename window_get_none_wm_owner to window_get_client_toplevel to match
        its new behavior
      Signed-off-by: Roman Gilg's avatarRoman Gilg <subdiff@gmail.com>
      Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    • Roman Gilg's avatar
      xwayland: Recurse on finding the none-wm owner · a69f7fbb
      Roman Gilg authored
      An X11 window manager might add a chain of parent windows when reparenting to a
      decoration window.
      That is for example the case for KWin, which reparents client windows to one
      decoration and another wrapper parent window.
      Account for that by a recursion into the tree. For now assume as before that
      all X11 window managers reparent with one child only for these parent windows.
      Changes by Hans de Goede:
      - Move the xwl_window_is_toplevel() from a later patch in this series here
        as it really belongs together with these changes
      - Drop no longer necessary xwl_window argument from window_get_none_wm_owner
      Signed-off-by: Roman Gilg's avatarRoman Gilg <subdiff@gmail.com>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    • Roman Gilg's avatar
      xwayland: Reuse viewport instead of recreating · 948e0287
      Roman Gilg authored
      When a viewport is already created we can reuse this object instead of
      destroying it and getting a new one for updating the source rectangle and
      destination size.
      Signed-off-by: Roman Gilg's avatarRoman Gilg <subdiff@gmail.com>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    • Hans de Goede's avatar
      xwayland: Cache client-id for the window-manager client · ded89300
      Hans de Goede authored
      Instead of iterating over all clients which are listening for events on the
      root window and checking if the client we are dealing with is the one
      listening for SubstructureRedirectMask | ResizeRedirectMask events and thus
      is the window-manager, cache the client-id of the window-manager in
      xwl_screen and use that when checking if a client is the window-manager.
      Note that we cache and compare the client-id rather then the ClienPtr,
      this saves reading the ClientPtr from the global clients array when doing
      the comparison.
      Suggested-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Acked-by: default avatarOlivier Fourdan <ofourdan@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
  11. 18 Feb, 2020 5 commits
  12. 14 Feb, 2020 1 commit
  13. 12 Feb, 2020 2 commits
    • Adam Jackson's avatar
      meson: Add support for libunwind · ee9f6e20
      Adam Jackson authored
    • Zoltán Böszörményi's avatar
      Fix modesetting device matching through kmsdev device path · 42aaf372
      Zoltán Böszörményi authored
      xf86platformProbeDev didn't check the device path, fix it.
      This is a problem when trying to set up a non-PCI device via
      explicit xorg.conf.d configuration.
      An USB DisplayLink device, being non-PCI was always set up
      as a GPU device assigned to screen 0 instead of a regular
      framebuffer, potentially having its own dedicated screen,
      despite such configuration as below. Only the relevant parts
      of the configuration are quoted, it's part of a larger context
      with an Intel chip that has 3 outputs:
      * DP1 connected to an LCD panel,
      * VGA1 connected to an external monitor,
      * HDMI1 unconnected and having no user visible connector
      Section "ServerFlags"
              Option          "AutoBindGPU" "false"
      Section "Device"
              Identifier      "Intel2"
              Driver          "intel"
              BusID           "PCI:0:2:0"
              Screen          2
              Option          "Monitor-HDMI1" "HDMI1"
              Option          "ZaphodHeads" "HDMI1"
      Section "Device"
              Identifier      "UDL"
              Driver          "modesetting"
              Option          "kmsdev" "/dev/dri/card0"
              #BusID          "usb:0:1.2:1.0"
              Option          "Monitor-DVI-I-1" "DVI-I-1"
              Option          "ShadowFB" "on"
              Option          "DoubleShadow" "on"
      Section "Screen"
              Identifier      "SCREEN2"
              Option          "AutoServerLayout" "on"
              Device          "UDL"
              GPUDevice       "Intel2"
              Monitor         "Monitor-DVI-I-1"
              SubSection      "Display"
                      Modes   "1024x768"
                      Depth   24
      Section "ServerLayout"
              Identifier      "LAYOUT"
              Option          "AutoServerLayout" "on"
              Screen          0 "SCREEN"
              Screen          1 "SCREEN1" RightOf "SCREEN"
              Screen          2 "SCREEN2" RightOf "SCREEN1"
      On the particular machine I was trying to set up an UDL device,
      I found the following structure was being used to match
      the device to a platform device while I was debugging the issue:
      xf86_platform_devices[0] == Intel, /dev/dri/card1, primary platform device
      xf86_platform_devices[1] == UDL, /dev/dri/card0
      devList[0] == "Intel0", ZaphodHeads: DP1
      devList[1] == "Intel1", ZaphodHeads: VGA1
      devList[2] == "UDL"
      devList[3] == "Intel2", ZaphodHeads: HDMI1 (intended GPU device to UDL)
      When xf86platformProbeDev() matched the UDL device, the BusID
      check failed in both cases of:
      * BusID "usb:0:1.2:1.0" was specified
      * Option "kmsdev" "/dev/dri/card0" was specified
      As a result, xf86platformProbeDev() went on to call probeSingleDevice()
      with xf86_platform_devices[0] and devList[2], resulting in the
      UDL device being set up as a GPU device assigned to the first screen
      instead of as a framebuffer on the third screen as the configuration
      Checking Option "kmsdev" in code code may be a layering violation.
      But the modesetting driver is actually part of the Xorg sources
      instead of being an external driver, so he "kmsdev" path knowledge
      may be used here.
      Signed-off-by: default avatarBöszörményi Zoltán <zboszor@pr.hu>