[Openchrome-devel] drm-openchrome: Branch 'drm-next-4.13' - drivers/gpu/drm

Kevin Brace kevinbrace at kemper.freedesktop.org
Mon Aug 28 05:50:36 UTC 2017


 drivers/gpu/drm/openchrome/via_crtc.c |   62 +++++++++++++++++-----------------
 1 file changed, 31 insertions(+), 31 deletions(-)

New commits:
commit 2a17f5ed61655f5ef33f8afc03ffc27fb1c50dd0
Author: Kevin Brace <kevinbrace at gmx.com>
Date:   Sun Aug 27 22:10:34 2017 -0700

    Error handling improvements to *mode_set_base callbacks
    
    Signed-off-by: Kevin Brace <kevinbrace at gmx.com>

diff --git a/drivers/gpu/drm/openchrome/via_crtc.c b/drivers/gpu/drm/openchrome/via_crtc.c
index 645e00451d41..08157c9b721a 100644
--- a/drivers/gpu/drm/openchrome/via_crtc.c
+++ b/drivers/gpu/drm/openchrome/via_crtc.c
@@ -1241,33 +1241,30 @@ via_iga1_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
     struct drm_gem_object *gem_obj = via_fb->gem_obj;
     int ret = 0;
 
-    DRM_DEBUG("Entered via_iga1_crtc_mode_set_base.\n");
+    DRM_DEBUG_KMS("Entered %s.\n", __func__);
 
-    /* no fb bound */
+    /* No FB found. */
     if (!new_fb) {
-        DRM_DEBUG_KMS("No FB bound\n");
-        return ret;
+        ret = -ENOMEM;
+        DRM_DEBUG_KMS("No FB found.\n");
+        goto exit;
     }
 
-    /* No reason to reset the display surface again */
-    if (new_fb == old_fb)
-        return ret;
-
     gem_obj = via_fb->gem_obj;
     bo = ttm_gem_mapping(gem_obj);
 
     ret = via_bo_pin(bo, NULL);
     if (unlikely(ret)) {
-        DRM_DEBUG("failed to pin FB\n");
-        return ret;
+        DRM_DEBUG_KMS("Failed to pin FB.\n");
+        goto exit;
     }
 
     ret = crtc->helper_private->mode_set_base_atomic(crtc, new_fb, x, y,
             ENTER_ATOMIC_MODE_SET);
     if (unlikely(ret)) {
-        DRM_DEBUG("failed to set new framebuffer\n");
+        DRM_DEBUG_KMS("Failed to set a new FB.\n");
         via_bo_unpin(bo, NULL);
-        return ret;
+        goto exit;
     }
 
     /* Free the old framebuffer if it exist */
@@ -1278,11 +1275,14 @@ via_iga1_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
         bo = ttm_gem_mapping(gem_obj);
 
         ret = via_bo_unpin(bo, NULL);
-        if (unlikely(ret))
-            DRM_ERROR("framebuffer still locked\n");
+        if (unlikely(ret)) {
+            DRM_DEBUG_KMS("FB still locked.\n");
+            goto exit;
+        }
     }
 
-    DRM_DEBUG("Exiting via_iga1_crtc_mode_set_base.\n");
+exit:
+    DRM_DEBUG_KMS("Exiting %s.\n", __func__);
     return ret;
 }
 
@@ -1544,7 +1544,7 @@ exit:
 
 static int
 via_iga2_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
-                        struct drm_framebuffer *old_fb)
+                            struct drm_framebuffer *old_fb)
 {
     struct ttm_buffer_object *bo;
     struct via_framebuffer *via_fb =
@@ -1553,33 +1553,30 @@ via_iga2_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
     struct drm_gem_object *gem_obj = via_fb->gem_obj;
     int ret = 0;
 
-    DRM_DEBUG("Entered via_iga2_crtc_mode_set_base.\n");
+    DRM_DEBUG_KMS("Entered %s.\n", __func__);
 
-    /* no fb bound */
+    /* No FB found. */
     if (!new_fb) {
-        DRM_DEBUG_KMS("No FB bound\n");
-        return ret;
+        ret = -ENOMEM;
+        DRM_DEBUG_KMS("No FB found.\n");
+        goto exit;
     }
 
-    /* No reason to reset the display surface again */
-    if (new_fb == old_fb)
-        return ret;
-
     gem_obj = via_fb->gem_obj;
     bo = ttm_gem_mapping(gem_obj);
 
     ret = via_bo_pin(bo, NULL);
     if (unlikely(ret)) {
-        DRM_DEBUG("failed to pin FB\n");
-        return ret;
+        DRM_DEBUG_KMS("Failed to pin FB.\n");
+        goto exit;
     }
 
     ret = crtc->helper_private->mode_set_base_atomic(crtc, new_fb, x, y,
             ENTER_ATOMIC_MODE_SET);
     if (unlikely(ret)) {
-        DRM_DEBUG("failed to set new framebuffer\n");
+        DRM_DEBUG_KMS("Failed to set a new FB.\n");
         via_bo_unpin(bo, NULL);
-        return ret;
+        goto exit;
     }
 
     /* Free the old framebuffer if it exist */
@@ -1590,11 +1587,14 @@ via_iga2_crtc_mode_set_base(struct drm_crtc *crtc, int x, int y,
         bo = ttm_gem_mapping(gem_obj);
 
         ret = via_bo_unpin(bo, NULL);
-        if (unlikely(ret))
-            DRM_ERROR("framebuffer still locked\n");
+        if (unlikely(ret)) {
+            DRM_DEBUG_KMS("FB still locked.\n");
+            goto exit;
+        }
     }
 
-    DRM_DEBUG("Exiting via_iga2_crtc_mode_set_base.\n");
+exit:
+    DRM_DEBUG_KMS("Exiting %s.\n", __func__);
     return ret;
 }
 


More information about the Openchrome-devel mailing list