qxl: limit monitor config read retries
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 1 Mar 2017 10:12:32 +0000 (11:12 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 7 Mar 2017 06:09:14 +0000 (07:09 +0100)
When reading the monitor config fails, don't retry forever.  If it fails
ten times in a row just give up to avoid the driver hangs.  Also add a
small delay after each attempt, so the host has a chance to complete a
partial update.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@collabora.co.uk>
Link: http://patchwork.freedesktop.org/patch/msgid/1488363154-6889-3-git-send-email-kraxel@redhat.com
drivers/gpu/drm/qxl/qxl_display.c

index 2cd14bebc49ca060fe35457d5bf3d591ae8bfad5..2b99496d881ae1d032f3cb69f0349caf0ee8fcd6 100644 (file)
@@ -157,19 +157,23 @@ static void qxl_update_offset_props(struct qxl_device *qdev)
 
 void qxl_display_read_client_monitors_config(struct qxl_device *qdev)
 {
-
        struct drm_device *dev = &qdev->ddev;
-       int status;
+       int status, retries;
 
-       status = qxl_display_copy_rom_client_monitors_config(qdev);
-       while (status == MONITORS_CONFIG_BAD_CRC) {
-               qxl_io_log(qdev, "failed crc check for client_monitors_config,"
-                                " retrying\n");
+       for (retries = 0; retries < 10; retries++) {
                status = qxl_display_copy_rom_client_monitors_config(qdev);
+               if (status != MONITORS_CONFIG_BAD_CRC)
+                       break;
+               udelay(5);
+       }
+       if (status == MONITORS_CONFIG_BAD_CRC) {
+               qxl_io_log(qdev, "config: bad crc\n");
+               DRM_DEBUG_KMS("ignoring client monitors config: bad crc");
+               return;
        }
        if (status == MONITORS_CONFIG_UNCHANGED) {
-               qxl_io_log(qdev, "config unchanged\n");
-               DRM_DEBUG("ignoring unchanged client monitors config");
+               qxl_io_log(qdev, "config: unchanged\n");
+               DRM_DEBUG_KMS("ignoring client monitors config: unchanged");
                return;
        }