[PATCH 1/2] modesetting: Fix damage tracking auto-disable code

Keith Packard keithp at keithp.com
Fri Dec 19 19:40:16 PST 2014


dispatch_dirty_region was only returning -EINVAL error codes,
otherwise it would return 0. The kernel returns -ENOSYS when the
driver doesn't support damage tracking, so dispatch_dirty would never
see the error and never disable damage tracking.

Pass all errors back from dispatch_dirty_region and let dispatch_dirty
deal with them.

Signed-off-by: Keith Packard <keithp at keithp.com>
---
 hw/xfree86/drivers/modesetting/driver.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index d9a2982..5929c03 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -453,11 +453,12 @@ dispatch_dirty_region(ScrnInfoPtr scrn,
     modesettingPtr ms = modesettingPTR(scrn);
     RegionPtr dirty = DamageRegion(damage);
     unsigned num_cliprects = REGION_NUM_RECTS(dirty);
+    int ret = 0;
 
     if (num_cliprects) {
         drmModeClip *clip = malloc(num_cliprects * sizeof(drmModeClip));
         BoxPtr rect = REGION_RECTS(dirty);
-        int i, ret;
+        int i;
 
         if (!clip)
             return -ENOMEM;
@@ -474,12 +475,8 @@ dispatch_dirty_region(ScrnInfoPtr scrn,
         ret = drmModeDirtyFB(ms->fd, fb_id, clip, num_cliprects);
         free(clip);
         DamageEmpty(damage);
-        if (ret) {
-            if (ret == -EINVAL)
-                return ret;
-        }
     }
-    return 0;
+    return ret;
 }
 
 static void
-- 
2.1.3



More information about the xorg-devel mailing list