[PATCH xserver] modesetting: resubmit dirty rects on EINVAL

Adam Jackson ajax at redhat.com
Fri Jul 15 15:28:57 UTC 2016


This error code can mean we're submitting more rects at once than the
driver can handle. If that happens, resubmit one at a time.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 hw/xfree86/drivers/modesetting/driver.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index 262a899..2de16f6 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -515,6 +515,17 @@ dispatch_dirty_region(ScrnInfoPtr scrn,
 
         /* TODO query connector property to see if this is needed */
         ret = drmModeDirtyFB(ms->fd, fb_id, clip, num_cliprects);
+
+        /* if we're swamping it with work, try one at a time */
+        if (ret == -EINVAL) {
+            for (i = 0; i < num_cliprects; i++) {
+                if (drmModeDirtyFB(ms->fd, fb_id, &clip[i], 1) == -EINVAL)
+                    break;
+            }
+            if (i == num_cliprects)
+                ret = 0;
+        }
+
         free(clip);
         DamageEmpty(damage);
     }
-- 
2.7.4



More information about the xorg-devel mailing list