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

Adam Jackson ajax at kemper.freedesktop.org
Tue Jun 21 14:27:34 UTC 2016


 Xi/exevents.c                                    |    3 ++
 exa/exa_render.c                                 |    3 +-
 hw/xfree86/drivers/modesetting/driver.c          |   30 +++++++++++---------
 hw/xfree86/drivers/modesetting/drmmode_display.c |    8 ++++-
 hw/xfree86/drivers/modesetting/present.c         |    9 ++++++
 hw/xfree86/modes/xf86Crtc.c                      |    3 +-
 include/xkbsrv.h                                 |    4 ++
 present/present.c                                |   33 ++++++++++++++---------
 randr/rrprovider.c                               |    2 +
 render/picture.h                                 |    2 -
 xkb/xkb.c                                        |    3 +-
 xkb/xkbLEDs.c                                    |    2 -
 12 files changed, 71 insertions(+), 31 deletions(-)

New commits:
commit 0dc1a58b9379c79ede8c40b2e6f008dc0868a40e
Author: Lyude Paul <cpaul at redhat.com>
Date:   Mon Jun 13 15:31:02 2016 -0400

    modesetting: Clear drmmode->fb_id before unflipping
    
    [fix copied from 40191d82370e in xf86-video-ati]
    
    Without this, we end up setting rotated CRTCs back to their previous
    framebuffer right after we perform a rotation. Reproducer:
    
    - Have two monitors connected at the same resolution
    - Rotate one monitor from normal straight to inverted
    - Watch as the monitor you didn't rotate either freezes or shows intense
      flickering
    
    Signed-off-by: Lyude <cpaul at redhat.com>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    (cherry picked from commit 848089e0dde38f043c85332785520946103e77c1)

diff --git a/hw/xfree86/drivers/modesetting/present.c b/hw/xfree86/drivers/modesetting/present.c
index d65c8c8..9a596de 100644
--- a/hw/xfree86/drivers/modesetting/present.c
+++ b/hw/xfree86/drivers/modesetting/present.c
@@ -626,6 +626,15 @@ ms_present_unflip(ScreenPtr screen, uint64_t event_id)
 	if (!crtc->enabled)
 	    continue;
 
+	/* info->drmmode.fb_id still points to the FB for the last flipped BO.
+	 * Clear it, drmmode_set_mode_major will re-create it
+	 */
+	if (drmmode_crtc->drmmode->fb_id) {
+		drmModeRmFB(drmmode_crtc->drmmode->fd,
+			    drmmode_crtc->drmmode->fb_id);
+		drmmode_crtc->drmmode->fb_id = 0;
+	}
+
 	if (drmmode_crtc->dpms_mode == DPMSModeOn)
 	    crtc->funcs->set_mode_major(crtc, &crtc->mode, crtc->rotation,
 					crtc->x, crtc->y);
commit 619730cac614ff8306e17edd07ae860051c700b7
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Wed Jun 1 14:59:38 2016 +0200

    modesetting: Properly cleanup fb for reverse-prime-offload
    
    drmmode_set_scanout_pixmap_gpu(pix) adds drmmod->fb_id through a call
    to drmmode_xf86crtc_resize(), but on a subsequent
    drmmode_set_scanout_pixmap_gpu(NULL) it would not remove the fb.
    
    This keeps the crtc marked as busy, which causes the dgpu to not
    being able to runtime suspend, after an output attached to the dgpu
    has been used once. Which causes burning through an additional 10W
    of power and the laptop to run quite hot.
    
    This commit adds the missing remove fb call, allowing the dgpu to runtime
    suspend after an external monitor has been plugged into the laptop.
    
    Note this also makes drmmode_set_scanout_pixmap_gpu(NULL) match the
    behavior of drmmode_set_scanout_pixmap_cpu(NULL) which was already
    removing the fb.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit b8ef71fb07a8ba9587aeaca942b4de20b59266ca)

diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index bb5f56e..bc2ca3d 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -577,11 +577,17 @@ drmmode_set_scanout_pixmap_gpu(xf86CrtcPtr crtc, PixmapPtr ppix)
     PixmapPtr screenpix = screen->GetScreenPixmap(screen);
     xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
     drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+    drmmode_ptr drmmode = drmmode_crtc->drmmode;
     int c, total_width = 0, max_height = 0, this_x = 0;
 
     if (!ppix) {
-        if (crtc->randr_crtc->scanout_pixmap)
+        if (crtc->randr_crtc->scanout_pixmap) {
             PixmapStopDirtyTracking(crtc->randr_crtc->scanout_pixmap, screenpix);
+            if (drmmode->fb_id) {
+                drmModeRmFB(drmmode->fd, drmmode->fb_id);
+                drmmode->fb_id = 0;
+            }
+        }
         drmmode_crtc->prime_pixmap_x = 0;
         return TRUE;
     }
commit 768e40e6c41dba3c7039db437d7b5be36f1477f5
Author: Dave Airlie <airlied at gmail.com>
Date:   Fri Apr 29 14:01:33 2016 +1000

    modesetting: set capabilities up after glamor and enable offload caps.
    
    This moves the capabilites setting to after glamor is initialised, and
    enables the offload caps in cases where they work. This enables DRI2
    PRIME support with modesetting.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 2378adde6770385c06f7efcd32f270d00d49ce3f)

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 0d5bc24..fb05e2e 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -809,18 +809,6 @@ PreInit(ScrnInfoPtr pScrn, int flags)
         return FALSE;
     ms->drmmode.fd = ms->fd;
 
-    pScrn->capabilities = 0;
-#ifdef DRM_CAP_PRIME
-    ret = drmGetCap(ms->fd, DRM_CAP_PRIME, &value);
-    if (ret == 0) {
-        if (value & DRM_PRIME_CAP_IMPORT)
-            pScrn->capabilities |= RR_Capability_SinkOutput;
-#if GLAMOR_HAS_GBM_LINEAR
-        if (value & DRM_PRIME_CAP_EXPORT)
-            pScrn->capabilities |= RR_Capability_SourceOutput;
-#endif
-    }
-#endif
     drmmode_get_default_bpp(pScrn, &ms->drmmode, &defaultdepth, &defaultbpp);
     if (defaultdepth == 24 && defaultbpp == 24)
         bppflags = SupportConvert32to24 | Support24bppFb;
@@ -896,6 +884,22 @@ PreInit(ScrnInfoPtr pScrn, int flags)
         ms->drmmode.pageflip = FALSE;
     }
 
+    pScrn->capabilities = 0;
+#ifdef DRM_CAP_PRIME
+    ret = drmGetCap(ms->fd, DRM_CAP_PRIME, &value);
+    if (ret == 0) {
+        if (value & DRM_PRIME_CAP_IMPORT) {
+            pScrn->capabilities |= RR_Capability_SinkOutput;
+            if (ms->drmmode.glamor)
+                pScrn->capabilities |= RR_Capability_SourceOffload;
+        }
+#if GLAMOR_HAS_GBM_LINEAR
+        if (value & DRM_PRIME_CAP_EXPORT && ms->drmmode.glamor)
+            pScrn->capabilities |= RR_Capability_SourceOutput | RR_Capability_SinkOffload;
+#endif
+    }
+#endif
+
     if (drmmode_pre_init(pScrn, &ms->drmmode, pScrn->bitsPerPixel / 8) == FALSE) {
         xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "KMS setup failed\n");
         goto fail;
commit 69f9319568609f23cf313995cd65400180de9345
Author: Dave Airlie <airlied at gmail.com>
Date:   Fri Apr 29 14:01:32 2016 +1000

    xf86Crtc: don't set the root window property on slave GPUs.
    
    Slave GPUs don't have a root window to set this on, so don't.
    
    This fixes some crashes I saw just playing around.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit 258588224d6b35de12f97d9092efa5cb3e426550)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 6091b5e..4a13c13 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -3285,7 +3285,8 @@ xf86OutputSetEDID(xf86OutputPtr output, xf86MonPtr edid_mon)
     }
 
     /* Set the DDC properties for the 'compat' output */
-    if (output == xf86CompatOutput(scrn))
+    /* GPU screens don't have a root window */
+    if (output == xf86CompatOutput(scrn) && !scrn->is_gpu)
         xf86SetDDCproperties(scrn, edid_mon);
 
 #ifdef RANDR_12_INTERFACE
commit 5b4ced6d3a4c309e1792ac49017fb961a7262e7f
Author: Dave Airlie <airlied at gmail.com>
Date:   Fri Apr 29 14:01:31 2016 +1000

    modesetting: set driverPrivate to NULL after closing fd.
    
    Otherwise ms_ent_priv will return NULL and things will fall apart.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit a41a171bcbae9aeafac2865faa904f15d9b59925)

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 8f60eae..0d5bc24 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -624,7 +624,6 @@ FreeRec(ScrnInfoPtr pScrn)
     ms = modesettingPTR(pScrn);
     if (!ms)
         return;
-    pScrn->driverPrivate = NULL;
 
     if (ms->fd > 0) {
         modesettingEntPtr ms_ent;
@@ -645,6 +644,7 @@ FreeRec(ScrnInfoPtr pScrn)
             ms_ent->fd = 0;
         }
     }
+    pScrn->driverPrivate = NULL;
     free(ms->drmmode.Options);
     free(ms);
 
commit cbbf4b0da098636e3d23407d62c3f41402c3f401
Author: Dave Airlie <airlied at gmail.com>
Date:   Fri Apr 29 14:01:30 2016 +1000

    randr/provider: only allow slave gpu to be offload sources.
    
    The other way around makes no sense.
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
    Signed-off-by: Dave Airlie <airlied at redhat.com>
    (cherry picked from commit fc1f61b75c9712e24ff665f95d62771f39eba1c7)

diff --git a/randr/rrprovider.c b/randr/rrprovider.c
index bbb8e51..5329f41 100644
--- a/randr/rrprovider.c
+++ b/randr/rrprovider.c
@@ -325,6 +325,8 @@ ProcRRSetProviderOffloadSink(ClientPtr client)
     VERIFY_RR_PROVIDER(stuff->provider, provider, DixReadAccess);
     if (!(provider->capabilities & RR_Capability_SourceOffload))
         return BadValue;
+    if (!provider->pScreen->isGPU)
+        return BadValue;
 
     if (stuff->sink_provider) {
         VERIFY_RR_PROVIDER(stuff->sink_provider, sink_provider, DixReadAccess);
commit cc7c0b0e3c7f7af624c3b1bc360f7c6ff99ea3be
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed May 4 20:36:18 2016 +1000

    xkb: after changing the keymap, force an indicator update
    
    When NumLock is on and a new keymap is applied, the next modifier state
    change will turn off that LED (but leave the state enabled). The cause
    for this is a bit convoluted:
    
    * the SLI explicitState is copied from the current state in
      ProcXkbGetKbdByName. Thus, if NumLock is on, that state is 0x2.
    * on the next modifier key press (e.g. Shift), XkbApplyState() calls into
      XkbUpdateIndicators() -> XkbUpdateLedAutoState() to update SLIs (if any)
      for the currently changed modifier. But it does so with a mask only for
      the changed modifier (i.e. for Shift).
    * XkbUpdateLedAutoState() calculates the state based on this mask and
      ends up with 0 because we don't have a Shift LED and we masked out the
      others.
    * XkbUpdateLedAutoState() compares that state with the previous state
      (which is still 0x2) and then proceeds to turn the LED off
    
    This doesn't happen in the normal case because either the mask
    encompasses all modifiers or the state matches of the masked-out
    modifiers matches the old state.
    
    Avoid this issue by forcing an SLI update after changing the keymap.
    This updates the sli->effectiveState and thus restores everything to
    happy working order.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1047151
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Daniel Stone <daniels at collabora.com>
    (cherry picked from commit ac164e58870d70640381e68b776eb95578c7fbd3)

diff --git a/include/xkbsrv.h b/include/xkbsrv.h
index cc6307a..7e71089 100644
--- a/include/xkbsrv.h
+++ b/include/xkbsrv.h
@@ -496,6 +496,10 @@ extern _X_EXPORT void XkbUpdateIndicators(DeviceIntPtr /* keybd */ ,
                                           XkbEventCausePtr      /* cause */
     );
 
+extern _X_EXPORT void XkbUpdateAllDeviceIndicators(XkbChangesPtr /* changes */,
+                                                   XkbEventCausePtr /* cause */
+    );
+
 extern _X_EXPORT XkbSrvLedInfoPtr XkbAllocSrvLedInfo(DeviceIntPtr /* dev */ ,
                                                      KbdFeedbackPtr /* kf */ ,
                                                      LedFeedbackPtr /* lf */ ,
diff --git a/xkb/xkb.c b/xkb/xkb.c
index 294cdf8..3a6ad65 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -5692,7 +5692,6 @@ ProcXkbListComponents(ClientPtr client)
 }
 
 /***====================================================================***/
-
 int
 ProcXkbGetKbdByName(ClientPtr client)
 {
@@ -6017,6 +6016,8 @@ ProcXkbGetKbdByName(ClientPtr client)
         new = NULL;
     }
     XkbFreeComponentNames(&names, FALSE);
+    XkbUpdateAllDeviceIndicators(NULL, NULL);
+
     return Success;
 }
 
diff --git a/xkb/xkbLEDs.c b/xkb/xkbLEDs.c
index 4e16002..5792d9f 100644
--- a/xkb/xkbLEDs.c
+++ b/xkb/xkbLEDs.c
@@ -304,7 +304,7 @@ XkbUpdateLedAutoState(DeviceIntPtr dev,
     return;
 }
 
-static void
+void
 XkbUpdateAllDeviceIndicators(XkbChangesPtr changes, XkbEventCausePtr cause)
 {
     DeviceIntPtr edev;
commit bcb633cae6c976b3416c736acab71c065adf5ee7
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Mar 9 10:45:48 2016 +1000

    Xi: don't deliver emulated motion events for non-emulating touches
    
    The touchpoint knows whether it should be emulating or not and we have a check
    for that later. Check for this before we generate the event and try to deliver
    it, lest we trigger a bug warning.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1282252
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit f641ae412287ecb7a3437987e2ba1646a8443aa4)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index e728310..52b91e8 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1379,6 +1379,9 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
     if (!TouchResourceIsOwner(ti, listener->listener))
         return !Success;
 
+    if (!ti->emulate_pointer)
+        return !Success;
+
     nevents = TouchConvertToPointerEvent(ev, &motion, &button);
     BUG_RETURN_VAL(nevents == 0, BadValue);
 
commit da4c6e1aaae6f564cbde7981898582018108622e
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 14 09:58:44 2015 +0000

    present: Fix presentation of flips out of order
    
    The flip queue currently only holds events submitted to the driver for
    flipping, awaiting the completion notifier. It is short. We therefore
    can speed up interrupt processing by keeping the small number of events
    ready to be flipped on the end of the flip queue. By appending the
    events to the flip_queue in the order that they become ready, we also
    resolve one issue causing Present to display frames out of order.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Reviewed-and-tested-by: Mario Kleiner <mario.kleiner.de at gmail.com>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    (cherry picked from commit bab0f450a719a11799491043b82c2f293fed27fe)

diff --git a/present/present.c b/present/present.c
index 2ae7d3a..cebd2f7 100644
--- a/present/present.c
+++ b/present/present.c
@@ -353,10 +353,10 @@ present_re_execute(present_vblank_ptr vblank)
 static void
 present_flip_try_ready(ScreenPtr screen)
 {
-    present_vblank_ptr  vblank, tmp;
+    present_vblank_ptr  vblank;
 
-    xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) {
-        if (vblank->flip_ready) {
+    xorg_list_for_each_entry(vblank, &present_flip_queue, event_queue) {
+        if (vblank->queued) {
             present_re_execute(vblank);
             return;
         }
@@ -656,6 +656,8 @@ present_execute(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
             DebugPresent(("\tr %lld %p (pending %p unflip %lld)\n",
                           vblank->event_id, vblank,
                           screen_priv->flip_pending, screen_priv->unflip_event_id));
+            xorg_list_del(&vblank->event_queue);
+            xorg_list_append(&vblank->event_queue, &present_flip_queue);
             vblank->flip_ready = TRUE;
             return;
         }
@@ -994,6 +996,7 @@ present_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64
     xorg_list_for_each_entry(vblank, &present_flip_queue, event_queue) {
         if (vblank->event_id == event_id) {
             xorg_list_del(&vblank->event_queue);
+            vblank->queued = FALSE;
             return;
         }
     }
commit 1a3577259f7d3d4c91f8a6eff1a5d466dabb45ee
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Feb 14 09:58:43 2015 +0000

    present: Improve scaling of vblank handler
    
    With large numbers of queued vblank, the list iteration on every
    interupt dominates processing time. If we reorder the list to be in
    ascending event order, then not only is also likely to be in order for
    notification queries (i.e. the notification will be near the start of
    the list), we can also stop iterating when past the target event_id.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
    Reviewed-and-tested-by: Mario Kleiner <mario.kleiner.de at gmail.com>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    (cherry picked from commit fbe660b7652b945bdd8e3eb0780179d83cc7de96)

diff --git a/present/present.c b/present/present.c
index 105e2bf..2ae7d3a 100644
--- a/present/present.c
+++ b/present/present.c
@@ -517,19 +517,22 @@ present_flip_notify(present_vblank_ptr vblank, uint64_t ust, uint64_t crtc_msc)
 void
 present_event_notify(uint64_t event_id, uint64_t ust, uint64_t msc)
 {
-    present_vblank_ptr  vblank, tmp;
+    present_vblank_ptr  vblank;
     int                 s;
 
     if (!event_id)
         return;
     DebugPresent(("\te %lld ust %lld msc %lld\n", event_id, ust, msc));
-    xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) {
-        if (vblank->event_id == event_id) {
+    xorg_list_for_each_entry(vblank, &present_exec_queue, event_queue) {
+        int64_t match = event_id - vblank->event_id;
+        if (match == 0) {
             present_execute(vblank, ust, msc);
             return;
         }
+        if (match < 0)
+            break;
     }
-    xorg_list_for_each_entry_safe(vblank, tmp, &present_flip_queue, event_queue) {
+    xorg_list_for_each_entry(vblank, &present_flip_queue, event_queue) {
         if (vblank->event_id == event_id) {
             present_flip_notify(vblank, ust, msc);
             return;
@@ -943,7 +946,7 @@ present_pixmap(WindowPtr window,
                       vblank->pixmap->drawable.id, vblank->window->drawable.id,
                       target_crtc, vblank->flip, vblank->sync_flip, vblank->serial));
 
-    xorg_list_add(&vblank->event_queue, &present_exec_queue);
+    xorg_list_append(&vblank->event_queue, &present_exec_queue);
     vblank->queued = TRUE;
     if (msc_is_after(target_msc, crtc_msc)) {
         ret = present_queue_vblank(screen, target_crtc, vblank->event_id, target_msc);
@@ -967,7 +970,7 @@ no_mem:
 void
 present_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64_t msc)
 {
-    present_vblank_ptr  vblank, tmp;
+    present_vblank_ptr  vblank;
 
     if (crtc == NULL)
         present_fake_abort_vblank(screen, event_id, msc);
@@ -978,14 +981,17 @@ present_abort_vblank(ScreenPtr screen, RRCrtcPtr crtc, uint64_t event_id, uint64
         (*screen_priv->info->abort_vblank) (crtc, event_id, msc);
     }
 
-    xorg_list_for_each_entry_safe(vblank, tmp, &present_exec_queue, event_queue) {
-        if (vblank->event_id == event_id) {
+    xorg_list_for_each_entry(vblank, &present_exec_queue, event_queue) {
+        int64_t match = event_id - vblank->event_id;
+        if (match == 0) {
             xorg_list_del(&vblank->event_queue);
             vblank->queued = FALSE;
             return;
         }
+        if (match < 0)
+            break;
     }
-    xorg_list_for_each_entry_safe(vblank, tmp, &present_flip_queue, event_queue) {
+    xorg_list_for_each_entry(vblank, &present_flip_queue, event_queue) {
         if (vblank->event_id == event_id) {
             xorg_list_del(&vblank->event_queue);
             return;
commit db258a27f021c80281ed4f89df897dfda0ffce9f
Author: Maarten Lankhorst <maarten.lankhorst at canonical.com>
Date:   Wed Oct 2 15:47:54 2013 +0200

    exa: only draw valid trapezoids
    
    Fixes freedesktop.org bug https://bugs.freedesktop.org/show_bug.cgi?id=67484
    
    If t->bottom is close to MIN_INT, removing top can wraparound, so do the check properly.
    A similar fix should also be applied to pixman.
    
    Signed-off-by: Maarten Lankhorst <maarten.lankhorst at canonical.com>
    Reviewed-by: Hans de Goede <hdegoede at redhat.com>
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    (cherry picked from commit c6511d0142040654140bdedd6f03d43af0abba21)

diff --git a/exa/exa_render.c b/exa/exa_render.c
index fc3ddea..b24bec0 100644
--- a/exa/exa_render.c
+++ b/exa/exa_render.c
@@ -1141,7 +1141,8 @@ exaTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst,
 
         exaPrepareAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
         for (; ntrap; ntrap--, traps++)
-            (*ps->RasterizeTrapezoid) (pPicture, traps, -bounds.x1, -bounds.y1);
+            if (xTrapezoidValid(traps))
+                (*ps->RasterizeTrapezoid) (pPicture, traps, -bounds.x1, -bounds.y1);
         exaFinishAccess(pPicture->pDrawable, EXA_PREPARE_DEST);
 
         xRel = bounds.x1 + xSrc - xDst;
diff --git a/render/picture.h b/render/picture.h
index 087e54d..4499a00 100644
--- a/render/picture.h
+++ b/render/picture.h
@@ -211,7 +211,7 @@ typedef pixman_fixed_t xFixed;
 /* whether 't' is a well defined not obviously empty trapezoid */
 #define xTrapezoidValid(t)  ((t)->left.p1.y != (t)->left.p2.y && \
 			     (t)->right.p1.y != (t)->right.p2.y && \
-			     (int) ((t)->bottom - (t)->top) > 0)
+			     ((t)->bottom > (t)->top))
 
 /*
  * Standard NTSC luminance conversions:


More information about the xorg-commit mailing list