xserver: Branch 'server-1.19-branch' - 11 commits

Adam Jackson ajax at kemper.freedesktop.org
Mon Feb 12 20:03:22 UTC 2018


 composite/compalloc.c        |   21 +++++----
 composite/compint.h          |    2 
 composite/compwindow.c       |    5 ++
 glamor/glamor_gradient.c     |   99 +++++++++++++++++++------------------------
 glx/glxdricommon.c           |    3 +
 hw/xfree86/common/xf86xvmc.c |    1 
 hw/xwayland/xwayland.c       |   10 +++-
 os/inputthread.c             |    1 
 randr/rrscreen.c             |    2 
 9 files changed, 78 insertions(+), 66 deletions(-)

New commits:
commit 56547b196660e246e37132960723819972b99c8c
Author: Mario Kleiner <mario.kleiner.de at gmail.com>
Date:   Mon Feb 5 11:20:41 2018 +0100

    glx: Only assign 8 bpc fbconfigs for composite visuals.
    
    Commit 91c42093b248 ("glx: Duplicate relevant fbconfigs for
    compositing visuals") adds many new depth 32 fbconfigs as
    composite visuals. On a X-Screen running at depth 24, this
    also adds bgra 10-10-10-2 fbconigs, as they also have
    config.rgbBits == 32, but these are not displayable on a
    depth 24 screen, leading to visually corrupted desktops
    under some compositors, e.g., fdo bug 104597 "Compton
    weird colors" when running compton with
    "compton --backend glx".
    
    Be more conservative for now and only select fbconfigs with
    8 bpc red, green, blue components for composite visuals.
    
    Fixes: 91c42093b248 ("glx: Duplicate relevant fbconfigs for
                          compositing visuals")
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104597
    Signed-off-by: Mario Kleiner <mario.kleiner.de at gmail.com>
    Reviewed-by: Thomas Hellstrom <thellstrom at vmware.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit bebcc8477c8070ade9dd4be7299c718baeab3d7a)

diff --git a/glx/glxdricommon.c b/glx/glxdricommon.c
index d3136e87b..dbf199c93 100644
--- a/glx/glxdricommon.c
+++ b/glx/glxdricommon.c
@@ -218,6 +218,9 @@ createModeFromConfig(const __DRIcoreExtension * core,
     if (duplicateForComp &&
         (render_type_is_pbuffer_only(renderType) ||
          config->config.rgbBits != 32 ||
+         config->config.redBits != 8 ||
+         config->config.greenBits != 8 ||
+         config->config.blueBits != 8 ||
          config->config.visualRating != GLX_NONE ||
          config->config.sampleBuffers != 0)) {
         free(config);
commit e96bd477395af3c2c3157ebda0f55ea4b672a114
Author: Lyude Paul <lyude at redhat.com>
Date:   Tue Feb 6 12:41:47 2018 -0500

    xwayland: Don't process cursor warping without an xwl_seat
    
    Unfortunately, on my machine Xwayland immediately crashes when I try to
    start it. gdb backtrace:
    
     #0  0x00007ffff74f0e79 in wl_proxy_marshal () from target:/lib64/libwayland-client.so.0
     #1  0x0000000000413172 in zwp_confined_pointer_v1_destroy (zwp_confined_pointer_v1=0x700000000)
         at hw/xwayland/Xwayland at exe/pointer-constraints-unstable-v1-client-protocol.h:612
     #2  0x0000000000418bc0 in xwl_seat_destroy_confined_pointer (xwl_seat=0x8ba2a0)
         at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-input.c:2839
     #3  0x0000000000418c09 in xwl_seat_unconfine_pointer (xwl_seat=0x8ba2a0)
         at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-input.c:2849
     #4  0x0000000000410d97 in xwl_cursor_confined_to (device=0xa5a000, screen=0x8b9d80, window=0x9bdb70)
         at /home/lyudess/Projects/xserver/hw/xwayland/xwayland.c:328
     #5  0x00000000004a8571 in ConfineCursorToWindow (pDev=0xa5a000, pWin=0x9bdb70, generateEvents=1,
         confineToScreen=0) at /home/lyudess/Projects/xserver/dix/events.c:900
     #6  0x00000000004a94b7 in ScreenRestructured (pScreen=0x8b9d80)
         at /home/lyudess/Projects/xserver/dix/events.c:1387
     #7  0x0000000000502386 in RRScreenSizeNotify (pScreen=0x8b9d80)
         at /home/lyudess/Projects/xserver/randr/rrscreen.c:160
     #8  0x000000000041a83c in update_screen_size (xwl_output=0x8e7670, width=3840, height=2160)
         at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-output.c:203
     #9  0x000000000041a9f0 in apply_output_change (xwl_output=0x8e7670)
         at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-output.c:252
     #10 0x000000000041aaeb in xdg_output_handle_done (data=0x8e7670, xdg_output=0x8e7580)
         at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-output.c:307
     #11 0x00007ffff50e9d1e in ffi_call_unix64 () at ../src/x86/unix64.S:76
     #12 0x00007ffff50e968f in ffi_call (cif=<optimized out>, fn=<optimized out>, rvalue=<optimized out>,
         avalue=<optimized out>) at ../src/x86/ffi64.c:525
     #13 0x00007ffff74f3d8b in wl_closure_invoke () from target:/lib64/libwayland-client.so.0
     #14 0x00007ffff74f0928 in dispatch_event.isra () from target:/lib64/libwayland-client.so.0
     #15 0x00007ffff74f1be4 in wl_display_dispatch_queue_pending () from target:/lib64/libwayland-client.so.0
     #16 0x00007ffff74f200b in wl_display_roundtrip_queue () from target:/lib64/libwayland-client.so.0
     #17 0x0000000000418cad in InitInput (argc=12, argv=0x7fffffffd9c8)
         at /home/lyudess/Projects/xserver/hw/xwayland/xwayland-input.c:2867
     #18 0x00000000004a20e3 in dix_main (argc=12, argv=0x7fffffffd9c8, envp=0x7fffffffda30)
         at /home/lyudess/Projects/xserver/dix/main.c:250
     #19 0x0000000000420cb2 in main (argc=12, argv=0x7fffffffd9c8, envp=0x7fffffffda30)
        at /home/lyudess/Projects/xserver/dix/stubmain.c:34
    
    This appears to be the result of xwl_cursor_confined_to() and
    xwl_screen_get_default_seat(). While not against protocol, mutter ends
    up sending xdg_output before wl_seat. xwl_screen_get_default_seat()
    makes the naïve assumption that we always have a valid seat, we end up
    returning a pointer to the empty list itself instead of an actual seat
    and causing ourselves to segfault.
    
    So, actually return NULL in xwl_screen_get_default_seat() if the seat
    list is empty, and skip any pointer confinement processing in
    xwl_cursor_confined_to() when we don't have a seat setup yet.
    
    Signed-off-by: Lyude Paul <lyude at redhat.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 98edb9a35e2cdd61355656b82975d7f2b6a9f0e6)

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 0e7929715..d0bdf36a4 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -159,6 +159,9 @@ xwl_window_from_window(WindowPtr window)
 static struct xwl_seat *
 xwl_screen_get_default_seat(struct xwl_screen *xwl_screen)
 {
+    if (xorg_list_is_empty(&xwl_screen->seat_list))
+        return NULL;
+
     return container_of(xwl_screen->seat_list.prev,
                         struct xwl_seat,
                         link);
@@ -218,6 +221,10 @@ xwl_cursor_confined_to(DeviceIntPtr device,
     if (!xwl_seat)
         xwl_seat = xwl_screen_get_default_seat(xwl_screen);
 
+    /* xwl_seat hasn't been setup yet, don't do anything just yet */
+    if (!xwl_seat)
+        return;
+
     if (window == screen->root) {
         xwl_seat_unconfine_pointer(xwl_seat);
         return;
commit 61d3f56877b23241757490efcdb759b905caca1d
Author: Alex Goins <agoins at nvidia.com>
Date:   Mon Jan 8 18:44:25 2018 -0800

    randr: Fix rotation check in ProcRRSetScreenSize()
    
    ProcRRSetScreenSize() does bounds checking to ensure that none of the CRTCs have
    a viewport that extends beyond the new screen size. In doing so, it accounts for
    if the CRTC is rotated 90 or 270 degrees, swapping width and height.
    
    However, it does so by testing if crtc->rotation is equal to RR_Rotate_90 or
    RR_Rotate_270. crtc->rotation is a bit mask, and it includes reflection as well
    as rotation. If a CRTC is reflected as well as rotated, it will incorrectly fail
    this test, resulting in incorrect dimensions being used to verify the validity
    of the new screen size. In some cases, this can cause valid uses of
    ProcRRSetScreenSize() to fail with BadMatch.
    
    This patch fixes the issue by testing that the bits RR_Rotate_90 or
    RR_Rotate_270 are set, rather than testing for equality.
    
    Signed-off-by: Alex Goins <agoins at nvidia.com>
    Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
    (cherry picked from commit 6b26a7bda9efa93440734ede0382a3e9a6761365)

diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index 0c70b28dd..d059ce74a 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -272,7 +272,7 @@ ProcRRSetScreenSize(ClientPtr client)
             int source_height = mode->mode.height;
             Rotation rotation = crtc->rotation;
 
-            if (rotation == RR_Rotate_90 || rotation == RR_Rotate_270) {
+            if (rotation & (RR_Rotate_90 | RR_Rotate_270)) {
                 source_width = mode->mode.height;
                 source_height = mode->mode.width;
             }
commit cb908a7840487e4b81aa16c5b3a4b609ff1153fc
Author: Jeff Smith <whydoubt at gmail.com>
Date:   Fri Jan 26 06:25:22 2018 -0600

    glamor: tidy up some gradient color formulas
    
    - Avoid some needlessly complex equations for calculating the color at a
      point in a gradient field.
    - Avoid calculating certain values multiple times.
    - Use similar variable names across the two versions of the get_color
      function where practical.
    
    Signed-off-by: Jeff Smith <whydoubt at gmail.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit ff410c56bfd6dcdf5d252ef0ba3f4c6fde91774b)

diff --git a/glamor/glamor_gradient.c b/glamor/glamor_gradient.c
index 5deaf5ff4..f0b7d129c 100644
--- a/glamor/glamor_gradient.c
+++ b/glamor/glamor_gradient.c
@@ -54,8 +54,9 @@ _glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count,
 	    "vec4 get_color(float stop_len)\n"\
 	    "{\n"\
 	    "    int i = 0;\n"\
-	    "    float new_alpha; \n"\
+	    "    vec4 stop_color_before;\n"\
 	    "    vec4 gradient_color;\n"\
+	    "    float stop_delta;\n"\
 	    "    float percentage; \n"\
 	    "    \n"\
 	    "    if(stop_len < stops[0])\n"\
@@ -67,19 +68,19 @@ _glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count,
 	    "    if(i == n_stop)\n"\
 	    "        return vec4(0.0, 0.0, 0.0, 0.0); \n"\
 	    "    \n"\
-	    "    if(stops[i] - stops[i-1] > 2.0)\n"\
+	    "    stop_color_before = stop_colors[i-1];\n"\
+	    "    stop_delta = stops[i] - stops[i-1];\n"\
+	    "    if(stop_delta > 2.0)\n"\
 	    "        percentage = 0.0;\n" /*For comply with pixman, walker->stepper overflow.*/\
-	    "    else if(stops[i] - stops[i-1] < 0.000001)\n"\
+	    "    else if(stop_delta < 0.000001)\n"\
 	    "        percentage = 0.0;\n"\
 	    "    else \n"\
-	    "        percentage = (stop_len - stops[i-1])/(stops[i] - stops[i-1]);\n"\
-	    "    new_alpha = percentage * stop_colors[i].a + \n"\
-	    "                       (1.0-percentage) * stop_colors[i-1].a; \n"\
-	    "    gradient_color = vec4((percentage * stop_colors[i].rgb \n"\
-	    "                          + (1.0-percentage) * stop_colors[i-1].rgb)*new_alpha, \n"\
-	    "                          new_alpha);\n"\
+	    "        percentage = (stop_len - stops[i-1])/stop_delta;\n"\
 	    "    \n"\
-	    "    return gradient_color;\n"\
+	    "    gradient_color = stop_color_before;\n"\
+	    "    if(percentage != 0.0)\n"\
+	    "        gradient_color += (stop_colors[i] - gradient_color)*percentage;\n"\
+	    "    return vec4(gradient_color.rgb * gradient_color.a, gradient_color.a);\n"\
 	    "}\n"
 
     /* Because the array access for shader is very slow, the performance is very low
@@ -106,73 +107,66 @@ _glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count,
         "\n"
         "vec4 get_color(float stop_len)\n"
         "{\n"
-        "    float stop_after;\n"
-        "    float stop_before;\n"
         "    vec4 stop_color_before;\n"
         "    vec4 stop_color_after;\n"
-        "    float new_alpha; \n"
         "    vec4 gradient_color;\n"
+        "    float stop_before;\n"
+        "    float stop_delta;\n"
         "    float percentage; \n"
         "    \n"
         "    if((stop_len < stop0) && (n_stop >= 1)) {\n"
         "        stop_color_before = vec4(0.0, 0.0, 0.0, 0.0);\n"
-        "        stop_color_after = vec4(0.0, 0.0, 0.0, 0.0);\n"
-        "        stop_after = 0.0;\n"
-        "        stop_before = 0.0;\n"
+        "        stop_delta = 0.0;\n"
         "    } else if((stop_len < stop1) && (n_stop >= 2)) {\n"
         "        stop_color_before = stop_color0;\n"
         "        stop_color_after = stop_color1;\n"
-        "        stop_after = stop1;\n"
         "        stop_before = stop0;\n"
+        "        stop_delta = stop1 - stop0;\n"
         "    } else if((stop_len < stop2) && (n_stop >= 3)) {\n"
         "        stop_color_before = stop_color1;\n"
         "        stop_color_after = stop_color2;\n"
-        "        stop_after = stop2;\n"
         "        stop_before = stop1;\n"
+        "        stop_delta = stop2 - stop1;\n"
         "    } else if((stop_len < stop3) && (n_stop >= 4)){\n"
         "        stop_color_before = stop_color2;\n"
         "        stop_color_after = stop_color3;\n"
-        "        stop_after = stop3;\n"
         "        stop_before = stop2;\n"
+        "        stop_delta = stop3 - stop2;\n"
         "    } else if((stop_len < stop4) && (n_stop >= 5)){\n"
         "        stop_color_before = stop_color3;\n"
         "        stop_color_after = stop_color4;\n"
-        "        stop_after = stop4;\n"
         "        stop_before = stop3;\n"
+        "        stop_delta = stop4 - stop3;\n"
         "    } else if((stop_len < stop5) && (n_stop >= 6)){\n"
         "        stop_color_before = stop_color4;\n"
         "        stop_color_after = stop_color5;\n"
-        "        stop_after = stop5;\n"
         "        stop_before = stop4;\n"
+        "        stop_delta = stop5 - stop4;\n"
         "    } else if((stop_len < stop6) && (n_stop >= 7)){\n"
         "        stop_color_before = stop_color5;\n"
         "        stop_color_after = stop_color6;\n"
-        "        stop_after = stop6;\n"
         "        stop_before = stop5;\n"
+        "        stop_delta = stop6 - stop5;\n"
         "    } else if((stop_len < stop7) && (n_stop >= 8)){\n"
         "        stop_color_before = stop_color6;\n"
         "        stop_color_after = stop_color7;\n"
-        "        stop_after = stop7;\n"
         "        stop_before = stop6;\n"
+        "        stop_delta = stop7 - stop6;\n"
         "    } else {\n"
         "        stop_color_before = vec4(0.0, 0.0, 0.0, 0.0);\n"
-        "        stop_color_after = vec4(0.0, 0.0, 0.0, 0.0);\n"
-        "        stop_after = 0.0;\n"
-        "        stop_before = 0.0;\n"
+        "        stop_delta = 0.0;\n"
         "    }\n"
-        "    if(stop_after - stop_before > 2.0)\n"
+        "    if(stop_delta > 2.0)\n"
         "        percentage = 0.0;\n" //For comply with pixman, walker->stepper overflow.
-        "    else if(stop_after - stop_before < 0.000001)\n"
+        "    else if(stop_delta < 0.000001)\n"
         "        percentage = 0.0;\n"
-        "    else \n"
-        "        percentage = (stop_len - stop_before)/(stop_after - stop_before);\n"
-        "    new_alpha = percentage * stop_color_after.a + \n"
-        "                       (1.0-percentage) * stop_color_before.a; \n"
-        "    gradient_color = vec4((percentage * stop_color_after.rgb \n"
-        "                          + (1.0-percentage) * stop_color_before.rgb)*new_alpha, \n"
-        "                          new_alpha);\n"
+        "    else\n"
+        "        percentage = (stop_len - stop_before)/stop_delta;\n"
         "    \n"
-        "    return gradient_color;\n"
+        "    gradient_color = stop_color_before;\n"
+        "    if(percentage != 0.0)\n"
+        "        gradient_color += (stop_color_after - gradient_color)*percentage;\n"
+        "    return vec4(gradient_color.rgb * gradient_color.a, gradient_color.a);\n"
         "}\n";
 
     if (use_array) {
commit b41bb8147e706cb8e615842e08a548b7e8afd279
Author: Jeff Smith <whydoubt at gmail.com>
Date:   Fri Jan 26 06:25:21 2018 -0600

    glamor: remove unused variables in linear gradient shader
    
    Signed-off-by: Jeff Smith <whydoubt at gmail.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 3bd17dff1ac5a4685a5da92a9982f621effee658)

diff --git a/glamor/glamor_gradient.c b/glamor/glamor_gradient.c
index e9880e79d..5deaf5ff4 100644
--- a/glamor/glamor_gradient.c
+++ b/glamor/glamor_gradient.c
@@ -467,13 +467,6 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
 	    "    float _p1_distance;\n"\
 	    "    float _pt_distance;\n"\
 	    "    float y_dist;\n"\
-	    "    float stop_after;\n"\
-	    "    float stop_before;\n"\
-	    "    vec4 stop_color_before;\n"\
-	    "    vec4 stop_color_after;\n"\
-	    "    float new_alpha; \n"\
-	    "    vec4 gradient_color;\n"\
-	    "    float percentage; \n"\
 	    "    vec3 source_texture_trans = transform_mat * tmp;\n"\
 	    "    \n"\
 	    "    if(hor_ver == 0) { \n" /*Normal case.*/\
commit c715645c14ec00cd49e6bb86340351fa97ab6ea0
Author: Jeff Smith <whydoubt at gmail.com>
Date:   Fri Jan 26 06:25:20 2018 -0600

    glamor: fix no-reflect case for gradients
    
    When compositing a no-reflect gradient, 'before' the gradient is empty,
    but 'after' the gradient is padded with the final color.  Both sides are
    supposed to be empty.
    
    This is fixed by moving the virtual stops to match the first and last
    client-supplied stops for no-reflect gradients, then causing everything
    'before' the initial virtual stop and 'after' the final virtual stop to
    emit rgba(0,0,0,0).  This does not impact gradients using the other
    reflect modes.
    
    Signed-off-by: Jeff Smith <whydoubt at gmail.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 5815c7b5951fd46d69e5c40144b64e516c7afdbf)

diff --git a/glamor/glamor_gradient.c b/glamor/glamor_gradient.c
index 14ff9173f..e9880e79d 100644
--- a/glamor/glamor_gradient.c
+++ b/glamor/glamor_gradient.c
@@ -57,10 +57,15 @@ _glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count,
 	    "    float new_alpha; \n"\
 	    "    vec4 gradient_color;\n"\
 	    "    float percentage; \n"\
-	    "    for(i = 0; i < n_stop - 1; i++) {\n"\
+	    "    \n"\
+	    "    if(stop_len < stops[0])\n"\
+	    "        return vec4(0.0, 0.0, 0.0, 0.0); \n"\
+	    "    for(i = 1; i < n_stop; i++) {\n"\
 	    "        if(stop_len < stops[i])\n"\
 	    "            break; \n"\
 	    "    }\n"\
+	    "    if(i == n_stop)\n"\
+	    "        return vec4(0.0, 0.0, 0.0, 0.0); \n"\
 	    "    \n"\
 	    "    if(stops[i] - stops[i-1] > 2.0)\n"\
 	    "        percentage = 0.0;\n" /*For comply with pixman, walker->stepper overflow.*/\
@@ -110,10 +115,10 @@ _glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count,
         "    float percentage; \n"
         "    \n"
         "    if((stop_len < stop0) && (n_stop >= 1)) {\n"
-        "        stop_color_before = stop_color0;\n"
-        "        stop_color_after = stop_color0;\n"
-        "        stop_after = stop0;\n"
-        "        stop_before = stop0;\n"
+        "        stop_color_before = vec4(0.0, 0.0, 0.0, 0.0);\n"
+        "        stop_color_after = vec4(0.0, 0.0, 0.0, 0.0);\n"
+        "        stop_after = 0.0;\n"
+        "        stop_before = 0.0;\n"
         "    } else if((stop_len < stop1) && (n_stop >= 2)) {\n"
         "        stop_color_before = stop_color0;\n"
         "        stop_color_after = stop_color1;\n"
@@ -150,10 +155,10 @@ _glamor_create_getcolor_fs_source(ScreenPtr screen, int stops_count,
         "        stop_after = stop7;\n"
         "        stop_before = stop6;\n"
         "    } else {\n"
-        "        stop_color_before = stop_color7;\n"
-        "        stop_color_after = stop_color7;\n"
-        "        stop_after = stop7;\n"
-        "        stop_before = stop7;\n"
+        "        stop_color_before = vec4(0.0, 0.0, 0.0, 0.0);\n"
+        "        stop_color_after = vec4(0.0, 0.0, 0.0, 0.0);\n"
+        "        stop_after = 0.0;\n"
+        "        stop_before = 0.0;\n"
         "    }\n"
         "    if(stop_after - stop_before > 2.0)\n"
         "        percentage = 0.0;\n" //For comply with pixman, walker->stepper overflow.
@@ -758,13 +763,13 @@ _glamor_gradient_set_stops(PicturePtr src_picture, PictGradient *pgradient,
         stop_colors[1] = 0.0;   //G
         stop_colors[2] = 0.0;   //B
         stop_colors[3] = 0.0;   //Alpha
-        n_stops[0] = -(float) INT_MAX;  //should be small enough.
+        n_stops[0] = n_stops[1];
 
         stop_colors[0 + (count - 1) * 4] = 0.0; //R
         stop_colors[1 + (count - 1) * 4] = 0.0; //G
         stop_colors[2 + (count - 1) * 4] = 0.0; //B
         stop_colors[3 + (count - 1) * 4] = 0.0; //Alpha
-        n_stops[count - 1] = (float) INT_MAX;   //should be large enough.
+        n_stops[count - 1] = n_stops[count - 2];
         break;
     case PIXMAN_REPEAT_NORMAL:
         REPEAT_FILL_STOPS(0, count - 2);
commit 38e6fb757386e2cb2c51a27e52346473d4ffb9a1
Author: Jeff Smith <whydoubt at gmail.com>
Date:   Fri Jan 26 06:25:19 2018 -0600

    glamor: fix repeat-reflect case in linear gradient shader
    
    If _pt_distance is negative, it causes the final distance to be negative
    in the repeat-reflect case.  Moving the scaling by _pt_distance earlier
    avoids this problem, and simplifies some equations as a bonus.
    
    Bugzilla: https://bugs.freedesktop.org/98508
    Signed-off-by: Jeff Smith <whydoubt at gmail.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 3e377e238f7257fd01e56a4a25dfd77e033673e4)

diff --git a/glamor/glamor_gradient.c b/glamor/glamor_gradient.c
index 0c97ce7cb..14ff9173f 100644
--- a/glamor/glamor_gradient.c
+++ b/glamor/glamor_gradient.c
@@ -458,7 +458,6 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
 	    "float get_stop_len()\n"\
 	    "{\n"\
 	    "    vec3 tmp = vec3(source_texture.x, source_texture.y, 1.0);\n"\
-	    "    float len_percentage;\n"\
 	    "    float distance;\n"\
 	    "    float _p1_distance;\n"\
 	    "    float _pt_distance;\n"\
@@ -484,19 +483,17 @@ _glamor_create_linear_gradient_program(ScreenPtr screen, int stops_count,
 	    "        _pt_distance = pt_distance * source_texture_trans.z;\n"\
 	    "    } \n"\
 	    "    \n"\
-	    "    distance = distance - _p1_distance; \n"\
+	    "    distance = (distance - _p1_distance) / _pt_distance;\n"\
 	    "    \n"\
 	    "    if(repeat_type == %d){\n" /* repeat normal*/\
-	    "        distance = mod(distance, _pt_distance);\n"\
+	    "        distance = fract(distance);\n"\
 	    "    }\n"\
 	    "    \n"\
 	    "    if(repeat_type == %d) {\n" /* repeat reflect*/\
-	    "        distance = abs(mod(distance + _pt_distance, 2.0 * _pt_distance) - _pt_distance);\n"\
+	    "        distance = abs(fract(distance * 0.5 + 0.5) * 2.0 - 1.0);\n"\
 	    "    }\n"\
 	    "    \n"\
-	    "    len_percentage = distance/(_pt_distance);\n"\
-	    "    \n"\
-	    "    return len_percentage;\n"\
+	    "    return distance;\n"\
 	    "}\n"\
 	    "\n"\
 	    "void main()\n"\
commit f6cd99ed79c17e3aa04b8821d10ca95939bd8675
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Wed Jan 24 17:45:37 2018 +0100

    xwayland: remove dirty window unconditionally on unrealize
    
    This is a rare occurrence of a crash in Xwayland for which I don't have
    the reproducing steps, just a core file.
    
    The backtrace looks as follow:
    
      #0  raise () from /usr/lib64/libc.so.6
      #1  abort () from /usr/lib64/libc.so.6
      #2  OsAbort () at utils.c:1361
      #3  AbortServer () at log.c:877
      #4  FatalError () at log.c:1015
      #5  OsSigHandler () at osinit.c:154
      #6  <signal handler called>
      #7  xwl_glamor_pixmap_get_wl_buffer () at xwayland-glamor.c:162
      #8  xwl_screen_post_damage () at xwayland.c:514
      #9  block_handler () at xwayland.c:665
      #10 BlockHandler () at dixutils.c:388
      #11 WaitForSomething () at WaitFor.c:219
      #12 Dispatch () at dispatch.c:422
      #13 dix_main () at main.c:287
    
    The crash is caused by dereferencing “xwl_pixmap->buffer” in
    xwl_glamor_pixmap_get_wl_buffer() because “xwl_pixmap” is NULL.
    
    Reason for this is because the corresponding pixmap is from the root
    window and xwayland is rootless by default.
    
    This can happen if the window was mapped, redirected, damaged and
    unredirected immediately, before the damage is processed by Xwayland.
    
    Make sure to remove the dirty window from the damage list on unrealize
    to prevent this from happening.
    
    Credit goes to Adam Jackson <ajax at nwnk.net> and Daniel Stone
    <daniel at fooishbar.org> for finding the root cause the issue.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Daniel Stone <daniels at collabora.com>
    (cherry picked from commit 3362422e8413dd9f231cfac50ce0a0862525b1bf)

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 939f3392c..0e7929715 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -454,8 +454,7 @@ xwl_unrealize_window(WindowPtr window)
         return ret;
 
     wl_surface_destroy(xwl_window->surface);
-    if (RegionNotEmpty(DamageRegion(xwl_window->damage)))
-        xorg_list_del(&xwl_window->link_damage);
+    xorg_list_del(&xwl_window->link_damage);
     DamageUnregister(xwl_window->damage);
     DamageDestroy(xwl_window->damage);
     if (xwl_window->frame_callback)
commit 9cd243f75dc52e1c649178963ab22583db52cd54
Author: Michal Srb <msrb at suse.com>
Date:   Mon Nov 27 09:59:01 2017 +0100

    os/inputthread: Force unlock when stopping thread.
    
    The inputthread is kept locked all the time while X server's VT is not active.
    If the X server is terminated while not active, it will be stuck forever in
    InputThreadFini waiting for the thread to join, but it wouldn't because it is
    locked.
    
    Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=103782
    Signed-off-by: Michal Srb <msrb at suse.com>
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    (cherry picked from commit 71348e99a8e6a95542e483b93839168ca8f51f81)

diff --git a/os/inputthread.c b/os/inputthread.c
index 721e86312..dc4eb9f20 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -497,6 +497,7 @@ InputThreadFini(void)
 
     /* Close the pipe to get the input thread to shut down */
     close(hotplugPipeWrite);
+    input_force_unlock();
     pthread_join(inputThreadInfo->thread, NULL);
 
     xorg_list_for_each_entry_safe(dev, next, &inputThreadInfo->devs, node) {
commit 5c456b6e2a9a579e67ba577f9147642406f2ce99
Author: Peter Harris <pharris at opentext.com>
Date:   Thu Dec 14 12:21:19 2017 -0500

    composite: Propagate damagedDescendants when reparented
    
    If a window that is fully covered by an automatic-redirected descendant
    (even implicitly, eg. via BackingStores) is reparented, the automatic
    updates could be broken if the new parent is not marked as having
    damaged descendants.
    
    Fix this issue by propagating the damagedDescendants flag whenever a
    window is reparented.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Peter Harris <pharris at opentext.com>
    (cherry picked from commit d5c23b29487d5ff440abf5ed0beb22c00f21e387)

diff --git a/composite/compalloc.c b/composite/compalloc.c
index 05ffc7e85..433dc820a 100644
--- a/composite/compalloc.c
+++ b/composite/compalloc.c
@@ -67,6 +67,18 @@ compBlockHandler(ScreenPtr pScreen, void *pTimeout)
     cs->BlockHandler = NULL;
 }
 
+void
+compMarkAncestors(WindowPtr pWin)
+{
+    pWin = pWin->parent;
+    while (pWin) {
+        if (pWin->damagedDescendants)
+            return;
+        pWin->damagedDescendants = TRUE;
+        pWin = pWin->parent;
+    }
+}
+
 static void
 compReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure)
 {
@@ -81,14 +93,7 @@ compReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure)
     }
     cw->damaged = TRUE;
 
-    /* Mark the ancestors */
-    pWin = pWin->parent;
-    while (pWin) {
-        if (pWin->damagedDescendants)
-            break;
-        pWin->damagedDescendants = TRUE;
-        pWin = pWin->parent;
-    }
+    compMarkAncestors(pWin);
 }
 
 static void
diff --git a/composite/compint.h b/composite/compint.h
index f05c2d8a5..89f6507b9 100644
--- a/composite/compint.h
+++ b/composite/compint.h
@@ -236,6 +236,8 @@ Bool
 compReallocPixmap(WindowPtr pWin, int x, int y,
                   unsigned int w, unsigned int h, int bw);
 
+void compMarkAncestors(WindowPtr pWin);
+
 /*
  * compinit.c
  */
diff --git a/composite/compwindow.c b/composite/compwindow.c
index f88238146..e74ce661a 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -432,6 +432,7 @@ compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
 {
     ScreenPtr pScreen = pWin->drawable.pScreen;
     CompScreenPtr cs = GetCompScreen(pScreen);
+    CompWindowPtr cw = GetCompWindow(pWin);
 
     pScreen->ReparentWindow = cs->ReparentWindow;
     /*
@@ -469,6 +470,10 @@ compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
         (*pScreen->ReparentWindow) (pWin, pPriorParent);
     cs->ReparentWindow = pScreen->ReparentWindow;
     pScreen->ReparentWindow = compReparentWindow;
+
+    if (pWin->damagedDescendants || (cw && cw->damaged))
+        compMarkAncestors(pWin);
+
     compCheckTree(pWin->drawable.pScreen);
 }
 
commit df319f889ddc952dd065bbb3252d045b90baaf8e
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Wed Jan 24 12:28:38 2018 +0100

    xf86XvMCScreenInit: Clear pScreenPriv->dixinfo when freeing pAdapt
    
    Fixes double-free later in xf86XvMCCloseScreen, which would generally
    cause fireworks.
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
    (cherry picked from commit 75408f53d4e203e462b2f13ea4b06264f0e59ad2)

diff --git a/hw/xfree86/common/xf86xvmc.c b/hw/xfree86/common/xf86xvmc.c
index a0a94c74b..c67418bf4 100644
--- a/hw/xfree86/common/xf86xvmc.c
+++ b/hw/xfree86/common/xf86xvmc.c
@@ -187,6 +187,7 @@ xf86XvMCScreenInit(ScreenPtr pScreen,
         }
         if (!pAdapt[i].xv_adaptor) {
             /* no adaptor by that name */
+            pScreenPriv->dixinfo = FALSE;
             free(pAdapt);
             return FALSE;
         }


More information about the xorg-commit mailing list