]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
drm: Print bad user modes
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 11 Jun 2018 19:34:02 +0000 (22:34 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Fri, 15 Jun 2018 20:31:07 +0000 (23:31 +0300)
Print out the modeline when we reject a bad user mode. Avoids having to
guess why it was rejected.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180611193403.16118-2-ville.syrjala@linux.intel.com
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
drivers/gpu/drm/drm_atomic.c
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_crtc_internal.h
drivers/gpu/drm/drm_modes.c

index 0ae280aaa12479b1a17340b7fbac7e8c77dd3731..0fb25bfe381d31159cd8bfd6ffff15091268ab84 100644 (file)
@@ -392,10 +392,24 @@ int drm_atomic_set_mode_prop_for_crtc(struct drm_crtc_state *state,
        memset(&state->mode, 0, sizeof(state->mode));
 
        if (blob) {
-               if (blob->length != sizeof(struct drm_mode_modeinfo) ||
-                   drm_mode_convert_umode(state->crtc->dev, &state->mode,
-                                          blob->data))
+               int ret;
+
+               if (blob->length != sizeof(struct drm_mode_modeinfo)) {
+                       DRM_DEBUG_ATOMIC("[CRTC:%d:%s] bad mode blob length: %zu\n",
+                                        crtc->base.id, crtc->name,
+                                        blob->length);
+                       return -EINVAL;
+               }
+
+               ret = drm_mode_convert_umode(crtc->dev,
+                                            &state->mode, blob->data);
+               if (ret) {
+                       DRM_DEBUG_ATOMIC("[CRTC:%d:%s] invalid mode (ret=%d, status=%s):\n",
+                                        crtc->base.id, crtc->name,
+                                        ret, drm_get_mode_status_name(state->mode.status));
+                       drm_mode_debug_printmodeline(&state->mode);
                        return -EINVAL;
+               }
 
                state->mode_blob = drm_property_blob_get(blob);
                state->enable = true;
index 53828fc8d9115f683da38c213fee22ff1f882370..163d82ac7d76321a268484b6ae3e0c4392b4402e 100644 (file)
@@ -649,7 +649,9 @@ retry:
 
                ret = drm_mode_convert_umode(dev, mode, &crtc_req->mode);
                if (ret) {
-                       DRM_DEBUG_KMS("Invalid mode\n");
+                       DRM_DEBUG_KMS("Invalid mode (ret=%d, status=%s)\n",
+                                     ret, drm_get_mode_status_name(mode->status));
+                       drm_mode_debug_printmodeline(mode);
                        goto out;
                }
 
index 5d307b23a4e66f176b8ce83cfd2119935a7da597..34499800932a2eb5deca0ae7b75bc7793f05cf3c 100644 (file)
@@ -56,6 +56,9 @@ int drm_mode_setcrtc(struct drm_device *dev,
 int drm_modeset_register_all(struct drm_device *dev);
 void drm_modeset_unregister_all(struct drm_device *dev);
 
+/* drm_modes.c */
+const char *drm_get_mode_status_name(enum drm_mode_status status);
+
 /* IOCTLs */
 int drm_mode_getresources(struct drm_device *dev,
                          void *data, struct drm_file *file_priv);
index c78ca0e84ffdc312860dc49805cc3b8e95bacce7..7f552d5fa88ee55b23cacfc8c8610da9a44c22f3 100644 (file)
@@ -1257,7 +1257,7 @@ static const char * const drm_mode_status_names[] = {
 
 #undef MODE_STATUS
 
-static const char *drm_get_mode_status_name(enum drm_mode_status status)
+const char *drm_get_mode_status_name(enum drm_mode_status status)
 {
        int index = status + 3;