xserver: Branch 'server-1.20-branch' - 9 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 18 04:19:18 UTC 2020


 doc/dtrace/Xserver-DTrace.xml                    |   16 ++++----
 hw/dmx/man/Xdmx.man                              |    2 -
 hw/xfree86/ddc/edid.h                            |   17 ++++++++-
 hw/xfree86/ddc/interpret_edid.c                  |   27 +++++++++++++++
 hw/xfree86/ddc/xf86DDC.h                         |    3 +
 hw/xfree86/drivers/modesetting/drmmode_display.c |    2 -
 hw/xfree86/man/Xorg.man                          |    8 ++--
 hw/xfree86/man/xorg.conf.man                     |    2 -
 hw/xfree86/modes/xf86Crtc.c                      |    3 -
 hw/xfree86/ramdac/xf86CursorRD.c                 |    3 +
 hw/xquartz/man/Xquartz.man                       |    2 -
 hw/xwayland/xwayland-glamor-gbm.c                |   28 +++++++++++++--
 hw/xwayland/xwayland-input.c                     |    7 +++
 hw/xwayland/xwayland-output.c                    |   41 +----------------------
 hw/xwayland/xwayland-present.c                   |    4 +-
 hw/xwayland/xwayland.c                           |    7 +++
 present/present_wnmd.c                           |   10 +++--
 17 files changed, 112 insertions(+), 70 deletions(-)

New commits:
commit 2720b871575504349d9f4dffbc73539f1626bd78
Author: Aaron Ma <aaron.ma at canonical.com>
Date:   Thu Jul 30 11:02:39 2020 +0200

    xfree86: add drm modes on non-GTF panels
    
    EDID1.4 replaced GTF Bit with Continuous or Non-Continuous Frequency Display.
    
    Check the "Display Range Limits Descriptor" for GTF support.
    If panel doesn't support GTF, then add gtf modes.
    
    Otherwise X will only show the modes in "Detailed Timing Descriptor".
    
    V2: Coding style changes.
    V3: Coding style changes, remove unused variate.
    V4: remove unused variate.
    
    BugLink: https://gitlab.freedesktop.org/drm/intel/issues/313
    Signed-off-by: Aaron Ma <aaron.ma at canonical.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 6a79a737e2c0bc730ee693b4ea4a1530c108be4e)

diff --git a/hw/xfree86/ddc/edid.h b/hw/xfree86/ddc/edid.h
index 750e4270b..b884d8212 100644
--- a/hw/xfree86/ddc/edid.h
+++ b/hw/xfree86/ddc/edid.h
@@ -262,6 +262,10 @@
 #define MAX_H (_MAX_H(c) + _MAX_H_OFFSET(c))
 #define _MAX_CLOCK(x) x[9]
 #define MAX_CLOCK _MAX_CLOCK(c)
+#define _DEFAULT_GTF(x) (x[10] == 0x00)
+#define DEFAULT_GTF _DEFAULT_GTF(c)
+#define _RANGE_LIMITS_ONLY(x) (x[10] == 0x01)
+#define RANGE_LIMITS_ONLY _RANGE_LIMITS_ONLY(c)
 #define _HAVE_2ND_GTF(x) (x[10] == 0x02)
 #define HAVE_2ND_GTF _HAVE_2ND_GTF(c)
 #define _F_2ND_GTF(x) (x[12] * 2)
@@ -477,6 +481,16 @@ struct detailed_timings {
 #define DS_VENDOR 0x101
 #define DS_VENDOR_MAX 0x110
 
+/*
+ * Display range limit Descriptor of EDID version1, reversion 4
+ */
+typedef enum {
+	DR_DEFAULT_GTF,
+	DR_LIMITS_ONLY,
+	DR_SECONDARY_GTF,
+	DR_CVT_SUPPORTED = 4,
+} DR_timing_flags;
+
 struct monitor_ranges {
     int min_v;
     int max_v;
@@ -495,6 +509,7 @@ struct monitor_ranges {
     char supported_blanking;
     char supported_scaling;
     int preferred_refresh;      /* in hz */
+    DR_timing_flags display_range_timing_flags;
 };
 
 struct whitePoints {
@@ -524,7 +539,7 @@ struct detailed_monitor_section {
         Uchar serial[13];
         Uchar ascii_data[13];
         Uchar name[13];
-        struct monitor_ranges ranges;   /* 56 */
+        struct monitor_ranges ranges;   /* 60 */
         struct std_timings std_t[5];    /* 80 */
         struct whitePoints wp[2];       /* 32 */
         /* color management data */
diff --git a/hw/xfree86/ddc/interpret_edid.c b/hw/xfree86/ddc/interpret_edid.c
index 17a8f81c0..19630471c 100644
--- a/hw/xfree86/ddc/interpret_edid.c
+++ b/hw/xfree86/ddc/interpret_edid.c
@@ -672,6 +672,9 @@ get_monitor_ranges(Uchar * c, struct monitor_ranges *r)
     r->max_clock = 0;
     if (MAX_CLOCK != 0xff)      /* is specified? */
         r->max_clock = MAX_CLOCK * 10 + 5;
+
+    r->display_range_timing_flags = c[10];
+
     if (HAVE_2ND_GTF) {
         r->gtf_2nd_f = F_2ND_GTF;
         r->gtf_2nd_c = C_2ND_GTF;
@@ -751,6 +754,30 @@ validate_version(int scrnIndex, struct edid_version *r)
     return TRUE;
 }
 
+Bool
+gtf_supported(xf86MonPtr mon)
+{
+    int i;
+
+    if (!mon)
+        return FALSE;
+
+    if ((mon->ver.version == 1) && (mon->ver.revision < 4)) {
+        if (mon->features.msc & 0x1)
+	    return TRUE;
+    } else {
+        for (i = 0; i < DET_TIMINGS; i++) {
+            struct detailed_monitor_section *det_timing_des = &(mon->det_mon[i]);
+            if (det_timing_des && (det_timing_des->type == DS_RANGES) &&
+                (det_timing_des->section.ranges.display_range_timing_flags == DR_DEFAULT_GTF
+		|| det_timing_des->section.ranges.display_range_timing_flags == DR_SECONDARY_GTF))
+		    return TRUE;
+	}
+    }
+
+    return FALSE;
+}
+
 /*
  * Returns true if HDMI, false if definitely not or unknown.
  */
diff --git a/hw/xfree86/ddc/xf86DDC.h b/hw/xfree86/ddc/xf86DDC.h
index 7d81ab911..6eb2f0ba2 100644
--- a/hw/xfree86/ddc/xf86DDC.h
+++ b/hw/xfree86/ddc/xf86DDC.h
@@ -48,6 +48,9 @@ extern _X_EXPORT Bool xf86SetDDCproperties(ScrnInfoPtr pScreen, xf86MonPtr DDC);
 extern _X_EXPORT Bool
  xf86MonitorIsHDMI(xf86MonPtr mon);
 
+extern _X_EXPORT Bool
+gtf_supported(xf86MonPtr mon);
+
 extern _X_EXPORT DisplayModePtr
 FindDMTMode(int hsize, int vsize, int refresh, Bool rb);
 
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index 59abb6cc7..9dd8c5573 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -2439,7 +2439,7 @@ drmmode_output_add_gtf_modes(xf86OutputPtr output, DisplayModePtr Modes)
     int max_x = 0, max_y = 0;
     float max_vrefresh = 0.0;
 
-    if (mon && GTF_SUPPORTED(mon->features.msc))
+    if (mon && gtf_supported(mon))
         return Modes;
 
     if (!has_panel_fitter(output))
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 37a45bb3a..17d4ef103 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -1719,11 +1719,10 @@ xf86ProbeOutputModes(ScrnInfoPtr scrn, int maxX, int maxY)
 
         if (edid_monitor) {
             struct det_monrec_parameter p;
-            struct disp_features *features = &edid_monitor->features;
             struct cea_data_block *hdmi_db;
 
             /* if display is not continuous-frequency, don't add default modes */
-            if (!GTF_SUPPORTED(features->msc))
+            if (!gtf_supported(edid_monitor))
                 add_default_modes = FALSE;
 
             p.mon_rec = &mon_rec;
commit 7da8e7babee16f7d518cd9ee2a71c950fe2c3c3f
Author: Roman Gilg <subdiff at gmail.com>
Date:   Fri Jul 24 12:21:37 2020 +0200

    present: Check valid region in window mode flips
    
    For Pixmap flips to have well defined outcomes the window must be contained by
    the valid region if such region was specified.
    
    The valid region is inserted as an argument to the check in window mode.
    Setting this argument is missing in screen mode as well but we ignore it for now
    and only add it to window mode.
    
    It seems there are none or only very few clients actually making use of valid
    regions at the moment. For simplicity we therefore just check if a valid region
    was set by the client and in this case do never flip, independently of the
    window being contained by the region or not.
    
    Signed-off-by: Roman Gilg <subdiff at gmail.com>
    (cherry picked from commit 591916ea9e7a77f68f436b4a541402d9deadfe64)

diff --git a/present/present_wnmd.c b/present/present_wnmd.c
index 82bae4022..32c4d55f1 100644
--- a/present/present_wnmd.c
+++ b/present/present_wnmd.c
@@ -278,7 +278,9 @@ present_wnmd_check_flip(RRCrtcPtr           crtc,
     if (x_off || y_off)
         return FALSE;
 
-    // TODO: Check for valid region?
+    /* Valid area must contain window (for simplicity for now just never flip when one is set). */
+    if (valid)
+        return FALSE;
 
     /* Flip pixmap must have same dimensions as window */
     if (window->drawable.width != pixmap->drawable.width ||
@@ -325,11 +327,11 @@ present_wnmd_check_flip_window (WindowPtr window)
 
     if (flip_pending) {
         if (!present_wnmd_check_flip(flip_pending->crtc, flip_pending->window, flip_pending->pixmap,
-                                flip_pending->sync_flip, NULL, 0, 0, NULL))
+                                flip_pending->sync_flip, flip_pending->valid, 0, 0, NULL))
             present_wnmd_set_abort_flip(window);
     } else if (flip_active) {
         if (!present_wnmd_check_flip(flip_active->crtc, flip_active->window, flip_active->pixmap,
-                                     flip_active->sync_flip, NULL, 0, 0, NULL))
+                                     flip_active->sync_flip, flip_active->valid, 0, 0, NULL))
             present_wnmd_flips_stop(window);
     }
 
@@ -337,7 +339,7 @@ present_wnmd_check_flip_window (WindowPtr window)
     xorg_list_for_each_entry(vblank, &window_priv->vblank, window_list) {
         if (vblank->queued && vblank->flip &&
                 !present_wnmd_check_flip(vblank->crtc, window, vblank->pixmap,
-                                         vblank->sync_flip, NULL, 0, 0, &reason)) {
+                                         vblank->sync_flip, vblank->valid, 0, 0, &reason)) {
             vblank->flip = FALSE;
             vblank->reason = reason;
             if (vblank->sync_flip)
commit 4a65b6617ecc43b754885894f6575fb7dc4bb74d
Author: Michel Dänzer <mdaenzer at redhat.com>
Date:   Thu Jul 23 19:14:28 2020 +0200

    xwayland: Handle NULL xwl_seat in xwl_seat_can_emulate_pointer_warp
    
    This can happen e.g. with weston's headless backend.
    
    Reviewed-by: Olivier Fourdan <ofourdan at redhat.com>
    (cherry picked from commit e33453f9111b21e4814d628e6ae00bc7b200f404)

diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 9b3b46ba7..a05d178ff 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -2783,11 +2783,16 @@ xwl_seat_create_pointer_warp_emulator(struct xwl_seat *xwl_seat)
 static Bool
 xwl_seat_can_emulate_pointer_warp(struct xwl_seat *xwl_seat)
 {
-    struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
+    struct xwl_screen *xwl_screen;
+
+    if (!xwl_seat)
+        return FALSE;
 
     if (!xwl_seat->pointer)
         return FALSE;
 
+    xwl_screen = xwl_seat->xwl_screen;
+
     if (!xwl_screen->relative_pointer_manager)
         return FALSE;
 
commit 10cabe0b978677cfac4bfb405295a16ee8eedb34
Author: Michel Dänzer <mdaenzer at redhat.com>
Date:   Tue Mar 17 12:58:12 2020 +0100

    xwayland: Propagate damage x1/y1 coordinates in xwl_present_flip
    
    This couldn't have worked correctly for non-0 x1/y1.
    
    Noticed by inspection.
    
    Reviewed-by: Simon Ser <contact at emersion.fr>
    (cherry picked from commits 9141196d3104ab37385c3e385deaa70c002dd184)
    (cherry picked fixup from commit 85a6fd11c723888ca093785a3df43066fdca9c33)

diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index f003170a9..6076f6498 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -497,7 +497,9 @@ xwl_present_flip(WindowPtr present_window,
     /* Realign timer */
     xwl_present_reset_timer(xwl_present_window);
 
-    wl_surface_damage(xwl_window->surface, 0, 0,
+    wl_surface_damage(xwl_window->surface,
+                      damage_box->x1 - present_window->drawable.x,
+                      damage_box->y1 - present_window->drawable.y,
                       damage_box->x2 - damage_box->x1,
                       damage_box->y2 - damage_box->y1);
 
commit 3b51978b9ca8cdc71508f6db2411255ca6406c3a
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Jul 21 18:34:28 2020 +0200

    doc: Update URLs in Xserver-DTrace.xml
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 0006aecba097b437f96a462075494d68bdad24c1)

diff --git a/doc/dtrace/Xserver-DTrace.xml b/doc/dtrace/Xserver-DTrace.xml
index 91ca254d7..ee594ac7c 100644
--- a/doc/dtrace/Xserver-DTrace.xml
+++ b/doc/dtrace/Xserver-DTrace.xml
@@ -15,8 +15,8 @@
       </affiliation>
     </author>
     <releaseinfo>X Server Version &xserver.version;</releaseinfo>
-    <copyright><year>2005</year><year>2006</year><year>2007</year><year>2010</year>
-      <holder>Oracle and/or its affiliates. All rights reserved.</holder>
+    <copyright><year>2005</year><year>2006</year><year>2007</year><year>2010</year><year>2020</year>
+      <holder>Oracle and/or its affiliates.</holder>
     </copyright>
     <legalnotice id="copyright">
       <para>
@@ -46,9 +46,9 @@ DEALINGS IN THE SOFTWARE.
     <title>Introduction</title>
     <para>
       This page provides details on a
-      <ulink url="http://wikis.sun.com/display/DTrace/Statically+Defined+Tracing+for+User+Applications">statically defined user application tracing provider</ulink>
+      <ulink url="http://dtrace.org/guide/chp-usdt.html">statically defined user application tracing provider</ulink>
       for the
-      <ulink url="http://hub.opensolaris.org/bin/view/Community+Group+dtrace/">DTrace</ulink>
+      <ulink url="http://dtrace.org/blogs/about/">DTrace</ulink>
       facility in <productname>Solaris</productname> 10,
       <productname>MacOS X</productname> 10.5, and later releases.  This
       provider instruments various points in the X server, to allow
@@ -235,9 +235,9 @@ DEALINGS IN THE SOFTWARE.
 
     <para>
       To access data in arguments of type <type>string</type>, you will need
-      to use <ulink url="http://wikis.sun.com/display/DTrace/Actions+and+Subroutines#ActionsandSubroutines-{{copyinstr}}"><function>copyinstr()</function></ulink>.
+      to use <ulink url="http://dtrace.org/guide/chp-actsub.html#chp-actsub-copyinstr"><function>copyinstr()</function></ulink>.
       To access data buffers referenced via <type>uintptr_t</type>'s, you will
-      need to use <ulink url="http://wikis.sun.com/display/DTrace/Actions+and+Subroutines#ActionsandSubroutines-{{copyin}}"><function>copyin()</function></ulink>.
+      need to use <ulink url="http://dtrace.org/guide/chp-actsub.html#chp-actsub-copyin"><function>copyin()</function></ulink>.
 
     <table id="Probe_Arguments">
       <title>Probe Arguments</title>
@@ -286,7 +286,7 @@ DEALINGS IN THE SOFTWARE.
 	    <entry><type>uintptr_t</type></entry>
 	    <entry>Pointer to buffer containing X event - decode using
 	      structures in
-	      <<ulink url="http://cgit.freedesktop.org/xorg/proto/xproto/tree/Xproto.h"><filename class="headerfile">X11/Xproto.h</filename></ulink>>
+	      <<ulink url="https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/blob/master/include/X11/Xproto.h"><filename class="headerfile">X11/Xproto.h</filename></ulink>>
 	      and similar headers for each extension</entry>
 	  </row>
 	  <row>
@@ -325,7 +325,7 @@ DEALINGS IN THE SOFTWARE.
 	    <entry><type>uintptr_t</type></entry>
 	    <entry>Pointer to buffer containing X request - decode using
 	      structures in
-	      <<ulink url="http://cgit.freedesktop.org/xorg/proto/xproto/tree/Xproto.h"><filename class="headerfile">X11/Xproto.h</filename></ulink>>
+	      <<ulink url="https://gitlab.freedesktop.org/xorg/proto/xorgproto/-/blob/master/include/X11/Xproto.h"><filename class="headerfile">X11/Xproto.h</filename></ulink>>
 	      and similar headers for each extension</entry>
 	  </row>
 	  <row>
commit 6cbd6a09b9037c6e6074127324978a51442ca375
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Tue Jun 2 11:23:46 2020 +0200

    xwayland: Use a fixed DPI value for core protocol
    
    The way Xwayland works (like all Wayland clients), it first queries the
    Wayland registry, set up all relevant protocols and then initializes its
    own structures.
    
    That means Xwayland will get the Wayland outputs from the Wayland
    compositor, compute the physical size of the combined outputs and set
    the corresponding Xwayland screen properties accordingly.
    
    Then it creates the X11 screen using fbScreenInit() but does so by using
    a default DPI value of 96. That value is used to set the physical size
    of the X11 screen, hence overriding the value computed from the actual
    physical size provided by the Wayland compositor.
    
    As a result, the DPI computed by tools such as xdpyinfo will always be
    96 regardless of the actual screen size and resolution.
    
    However, if the Wayland outputs get reconfigured, or new outputs added,
    or existing outputs removed, Xwayland will recompute and update the
    physical size of the screen, leading to an unexpected change of DPI.
    
    To avoid that discrepancy, use a fixed size DPI (defaults to 96, and can
    be set using the standard command lime option "-dpi") and compute a
    physical screen size to match that DPI setting.
    
    Note that only affects legacy core protocols, X11 clients can still get
    the actual physical output size as reported by the Wayland compositor
    using the RandR protocol, which also allows for the size to be 0 if the
    size is unknown or meaningless.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Simon Ser <contact at emersion.fr>
    Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/731
    (cherry picked from commit b0413b6e99c6b5fbc04229ce64ddf1f41b08e63e)

diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index aa6f37864..ae646c663 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -30,7 +30,6 @@
 #include "xwayland.h"
 #include <randrstr.h>
 
-#define DEFAULT_DPI 96
 #define ALL_ROTATIONS (RR_Rotate_0   | \
                        RR_Rotate_90  | \
                        RR_Rotate_180 | \
@@ -143,34 +142,6 @@ output_get_new_size(struct xwl_output *xwl_output,
         *height = xwl_output->y + output_height;
 }
 
-/* Approximate some kind of mmpd (m.m. per dot) of the screen given the outputs
- * associated with it.
- *
- * It either calculates the mean mmpd of all the outputs or, if no reasonable
- * value could be calculated, defaults to the mmpd of a screen with a DPI value
- * of DEFAULT_DPI.
- */
-static double
-approximate_mmpd(struct xwl_screen *xwl_screen)
-{
-    struct xwl_output *it;
-    int total_width_mm = 0;
-    int total_width = 0;
-
-    xorg_list_for_each_entry(it, &xwl_screen->output_list, link) {
-        if (it->randr_output->mmWidth == 0)
-            continue;
-
-        total_width_mm += it->randr_output->mmWidth;
-        total_width += it->width;
-    }
-
-    if (total_width_mm != 0)
-        return (double)total_width_mm / total_width;
-    else
-        return 25.4 / DEFAULT_DPI;
-}
-
 static int
 xwl_set_pixmap_visit_window(WindowPtr window, void *data)
 {
@@ -209,7 +180,6 @@ static void
 update_screen_size(struct xwl_output *xwl_output, int width, int height)
 {
     struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
-    double mmpd;
 
     if (xwl_screen->root_clip_mode == ROOT_CLIP_FULL)
         SetRootClip(xwl_screen->screen, ROOT_CLIP_NONE);
@@ -221,15 +191,8 @@ update_screen_size(struct xwl_output *xwl_output, int width, int height)
     xwl_screen->height = height;
     xwl_screen->screen->width = width;
     xwl_screen->screen->height = height;
-
-    if (xwl_output->width == width && xwl_output->height == height) {
-        xwl_screen->screen->mmWidth = xwl_output->randr_output->mmWidth;
-        xwl_screen->screen->mmHeight = xwl_output->randr_output->mmHeight;
-    } else {
-        mmpd = approximate_mmpd(xwl_screen);
-        xwl_screen->screen->mmWidth = width * mmpd;
-        xwl_screen->screen->mmHeight = height * mmpd;
-    }
+    xwl_screen->screen->mmWidth = (width * 25.4) / monitorResolution;
+    xwl_screen->screen->mmHeight = (height * 25.4) / monitorResolution;
 
     SetRootClip(xwl_screen->screen, xwl_screen->root_clip_mode);
 
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index d435fd32f..d02934cd5 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -87,6 +87,8 @@ ddxInputThreadInit(void)
 }
 #endif
 
+#define DEFAULT_DPI 96
+
  _X_NORETURN
 static void _X_ATTRIBUTE_PRINTF(1, 2)
 xwl_give_up(const char *f, ...)
@@ -1195,6 +1197,9 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
     xorg_list_init(&xwl_screen->damage_window_list);
     xwl_screen->depth = 24;
 
+    if (!monitorResolution)
+        monitorResolution = DEFAULT_DPI;
+
     xwl_screen->display = wl_display_connect(NULL);
     if (xwl_screen->display == NULL) {
         ErrorF("could not connect to wayland server\n");
@@ -1225,7 +1230,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
 
     ret = fbScreenInit(pScreen, NULL,
                        xwl_screen->width, xwl_screen->height,
-                       96, 96, 0,
+                       monitorResolution, monitorResolution, 0,
                        BitsPerPixel(xwl_screen->depth));
     if (!ret)
         return FALSE;
commit d4e8c4622890b0cdcfe5f4b9c5608d15ce976901
Author: Simon Ser <contact at emersion.fr>
Date:   Tue Jul 21 18:28:01 2020 +0200

    xwayland: only use linux-dmabuf if format/modifier was advertised
    
    Previously, linux-dmabuf was used unconditionally if the buffer had a
    modifier. However creating a linux-dmabuf buffer with a format/modifier
    which hasn't been advertised will fail.
    
    Change xwl_glamor_gbm_get_wl_buffer_for_pixmap to use linux-dmabuf when
    the format/modifier has been advertised only.
    
    Signed-off-by: Simon Ser <contact at emersion.fr>
    Closes: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1035
    Tested-by: Emmanuel Gil Peyrot <linkmauve at linkmauve.fr>
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
    (cherry picked from commit c0e13cbf5a56e1fdd1e4ce58ebdefb6d2904e4b3)

diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c
index 4f590cd43..ebff70a00 100644
--- a/hw/xwayland/xwayland-glamor-gbm.c
+++ b/hw/xwayland/xwayland-glamor-gbm.c
@@ -285,6 +285,9 @@ xwl_glamor_gbm_get_wl_buffer_for_pixmap(PixmapPtr pixmap,
     struct xwl_gbm_private *xwl_gbm = xwl_gbm_get(xwl_screen);
     unsigned short width = pixmap->drawable.width;
     unsigned short height = pixmap->drawable.height;
+    uint32_t format;
+    struct xwl_format *xwl_format = NULL;
+    Bool modifier_supported = FALSE;
     int prime_fd;
     int num_planes;
     uint32_t strides[4];
@@ -309,6 +312,8 @@ xwl_glamor_gbm_get_wl_buffer_for_pixmap(PixmapPtr pixmap,
     if (!xwl_pixmap->bo)
        return NULL;
 
+    format = wl_drm_format_for_depth(pixmap->drawable.depth);
+
     prime_fd = gbm_bo_get_fd(xwl_pixmap->bo);
     if (prime_fd == -1)
         return NULL;
@@ -327,7 +332,23 @@ xwl_glamor_gbm_get_wl_buffer_for_pixmap(PixmapPtr pixmap,
     offsets[0] = 0;
 #endif
 
-    if (xwl_gbm->dmabuf && modifier != DRM_FORMAT_MOD_INVALID) {
+    for (i = 0; i < xwl_screen->num_formats; i++) {
+       if (xwl_screen->formats[i].format == format) {
+          xwl_format = &xwl_screen->formats[i];
+          break;
+       }
+    }
+
+    if (xwl_format) {
+        for (i = 0; i < xwl_format->num_modifiers; i++) {
+            if (xwl_format->modifiers[i] == modifier) {
+                modifier_supported = TRUE;
+                break;
+            }
+        }
+    }
+
+    if (xwl_gbm->dmabuf && modifier_supported) {
         struct zwp_linux_buffer_params_v1 *params;
 
         params = zwp_linux_dmabuf_v1_create_params(xwl_gbm->dmabuf);
@@ -339,13 +360,12 @@ xwl_glamor_gbm_get_wl_buffer_for_pixmap(PixmapPtr pixmap,
 
         xwl_pixmap->buffer =
            zwp_linux_buffer_params_v1_create_immed(params, width, height,
-                                                   wl_drm_format_for_depth(pixmap->drawable.depth),
-                                                   0);
+                                                   format, 0);
         zwp_linux_buffer_params_v1_destroy(params);
     } else if (num_planes == 1) {
         xwl_pixmap->buffer =
             wl_drm_create_prime_buffer(xwl_gbm->drm, prime_fd, width, height,
-                                       wl_drm_format_for_depth(pixmap->drawable.depth),
+                                       format,
                                        0, gbm_bo_get_stride(xwl_pixmap->bo),
                                        0, 0,
                                        0, 0);
commit c726ceacc1a39c56d2b054ac5f35798d0c3640d7
Author: Martin Weber <martin.weber at secunet.com>
Date:   Tue Jul 21 18:24:41 2020 +0200

    hw/xfree86: Avoid cursor use after free
    
    During a VT-Switch a raw pointer to the shared cursor object
    is saved which is then freed (in case of low refcount) by a call to
    xf86CursorSetCursor with argument pCurs = NullCursor.
    This leads to a dangling pointer which can follow in a use after free.
    
    This fix ensures that there is a shared handle saved for the VT-Switch cycle.
    
    Reviewed-by: Michel Dänzer <mdaenzer at redhat.com>
    (cherry picked from commit 7ae221ad5774756766dc78a73d71f4163ac7b1c6)

diff --git a/hw/xfree86/ramdac/xf86CursorRD.c b/hw/xfree86/ramdac/xf86CursorRD.c
index afcce5353..ee1d98916 100644
--- a/hw/xfree86/ramdac/xf86CursorRD.c
+++ b/hw/xfree86/ramdac/xf86CursorRD.c
@@ -212,7 +212,7 @@ xf86CursorEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable)
                                                xf86CursorScreenKey);
 
     if (!enable && ScreenPriv->CurrentCursor != NullCursor) {
-        CursorPtr currentCursor = ScreenPriv->CurrentCursor;
+        CursorPtr currentCursor = RefCursor(ScreenPriv->CurrentCursor);
 
         xf86CursorSetCursor(pDev, pScreen, NullCursor, ScreenPriv->x,
                             ScreenPriv->y);
@@ -231,6 +231,7 @@ xf86CursorEnableDisableFBAccess(ScrnInfoPtr pScrn, Bool enable)
          */
         xf86CursorSetCursor(pDev, pScreen, ScreenPriv->SavedCursor,
                             ScreenPriv->x, ScreenPriv->y);
+        UnrefCursor(ScreenPriv->SavedCursor);
         ScreenPriv->SavedCursor = NULL;
     }
 }
commit 0679d4660579d0f399b5a9b8140d0c0d3483fa9f
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date:   Tue Jul 21 18:14:51 2020 +0200

    Update URL's in man pages
    
    Mostly http->https conversions, but also replaces gitweb.fd.o
    with gitlab.fd.o, and xquartz.macosforge.org with xquartz.org.
    
    Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit a5151f58cf98d1696d60a3577dc50851f159da8a)

diff --git a/hw/dmx/man/Xdmx.man b/hw/dmx/man/Xdmx.man
index ef62a02f5..2ca9fb59f 100644
--- a/hw/dmx/man/Xdmx.man
+++ b/hw/dmx/man/Xdmx.man
@@ -729,4 +729,4 @@ Portions of
 are based on code from The XFree86 Project
 .RI ( http://www.xfree86.org )
 and X.Org
-.RI ( http://www.x.org ).
+.RI ( https://www.x.org ).
diff --git a/hw/xfree86/man/Xorg.man b/hw/xfree86/man/Xorg.man
index 13a9dc3b3..888e87b53 100644
--- a/hw/xfree86/man/Xorg.man
+++ b/hw/xfree86/man/Xorg.man
@@ -557,7 +557,7 @@ vesa(@drivermansuffix@),
 vmware(@drivermansuffix@),
 .br
 Web site
-.IR <http://www.x.org> .
+.IR <https://www.x.org> .
 
 .SH AUTHORS
 Xorg has many contributors world wide.  The names of most of them
@@ -610,9 +610,9 @@ Orest Zborowski    \fIorestz at eskimo.com\fP
 .PP
 Xorg source is available from the FTP server
 \fI<ftp://ftp.x.org/>\fP, and from the X.Org
-server \fI<http://gitweb.freedesktop.org/>\fP.  Documentation and other
+server \fI<https://gitlab.freedesktop.org/xorg/>\fP.  Documentation and other
 information can be found from the X.Org web site
-\fI<http://www.x.org/>\fP.
+\fI<https://www.x.org/>\fP.
 
 .SH LEGAL
 .PP
@@ -622,7 +622,7 @@ and redistribution in source and binary form without fee.
 .B Xorg is copyright by numerous authors and
 contributors from around the world.  Licensing information can be found
 at
-.IR <http://www.x.org> .
+.IR <https://www.x.org> .
 Refer to the source code for specific copyright notices.
 .PP
 .B XFree86(TM)
diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man
index 958926243..80215ead6 100644
--- a/hw/xfree86/man/xorg.conf.man
+++ b/hw/xfree86/man/xorg.conf.man
@@ -2500,7 +2500,7 @@ section for a dual headed configuration with two mice:
 This optional section is used to provide some information for the
 Direct Rendering Infrastructure.
 Details about the format of this section can be found on-line at
-.IR <http://dri.freedesktop.org/> .
+.IR <https://dri.freedesktop.org/> .
 .SH "VENDOR SECTION"
 The optional
 .B Vendor
diff --git a/hw/xquartz/man/Xquartz.man b/hw/xquartz/man/Xquartz.man
index df7ab25aa..65a75d584 100644
--- a/hw/xquartz/man/Xquartz.man
+++ b/hw/xquartz/man/Xquartz.man
@@ -136,7 +136,7 @@ instead of -d.
 .PP
 X(@miscmansuffix@), Xserver(1), xdm(1), xinit(1), syslog(1), syslogd(8)
 .PP
-http://xquartz.macosforge.org
+https://www.xquartz.org/
 .PP
 .SH AUTHORS / HISTORY
 X11 was originally ported to Mac OS X Server by John Carmack.  Dave


More information about the xorg-commit mailing list