[PATCH] drm/atomic: Use DRM_DEBUG_KMS instead of DRM_DEBUG_ATOMIC in error paths

Jani Nikula jani.nikula at linux.intel.com
Mon May 16 07:47:48 UTC 2016


On Fri, 13 May 2016, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> DRM_DEBUG_ATOMIC generates a lot of noise that no one normally cares
> about. However error paths everyone cares about, so hiding thea error
> debugs under DRM_DEBUG_ATOMIC is a bad idea. Let's use DRM_DEBUG_KMS
> for those instead.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

Agreed.

Reviewed-by: Jani Nikula <jani.nikula at intel.com>

> ---
>  drivers/gpu/drm/drm_atomic.c        | 60 ++++++++++++++++++-------------------
>  drivers/gpu/drm/drm_atomic_helper.c | 60 ++++++++++++++++++-------------------
>  2 files changed, 60 insertions(+), 60 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> index 86e89db02ed7..1479bfd8744b 100644
> --- a/drivers/gpu/drm/drm_atomic.c
> +++ b/drivers/gpu/drm/drm_atomic.c
> @@ -554,8 +554,8 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,
>  	 */
>  
>  	if (state->active && !state->enable) {
> -		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] active without enabled\n",
> -				 crtc->base.id, crtc->name);
> +		DRM_DEBUG_KMS("[CRTC:%d:%s] active without enabled\n",
> +			      crtc->base.id, crtc->name);
>  		return -EINVAL;
>  	}
>  
> @@ -564,15 +564,15 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,
>  	 * be able to trigger. */
>  	if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) &&
>  	    WARN_ON(state->enable && !state->mode_blob)) {
> -		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] enabled without mode blob\n",
> -				 crtc->base.id, crtc->name);
> +		DRM_DEBUG_KMS("[CRTC:%d:%s] enabled without mode blob\n",
> +			      crtc->base.id, crtc->name);
>  		return -EINVAL;
>  	}
>  
>  	if (drm_core_check_feature(crtc->dev, DRIVER_ATOMIC) &&
>  	    WARN_ON(!state->enable && state->mode_blob)) {
> -		DRM_DEBUG_ATOMIC("[CRTC:%d:%s] disabled with mode blob\n",
> -				 crtc->base.id, crtc->name);
> +		DRM_DEBUG_KMS("[CRTC:%d:%s] disabled with mode blob\n",
> +			      crtc->base.id, crtc->name);
>  		return -EINVAL;
>  	}
>  
> @@ -587,8 +587,8 @@ static int drm_atomic_crtc_check(struct drm_crtc *crtc,
>  	 * pipe.
>  	 */
>  	if (state->event && !state->active && !crtc->state->active) {
> -		DRM_DEBUG_ATOMIC("[CRTC:%d] requesting event but off\n",
> -				 crtc->base.id);
> +		DRM_DEBUG_KMS("[CRTC:%d] requesting event but off\n",
> +			      crtc->base.id);
>  		return -EINVAL;
>  	}
>  
> @@ -802,10 +802,10 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
>  
>  	/* either *both* CRTC and FB must be set, or neither */
>  	if (WARN_ON(state->crtc && !state->fb)) {
> -		DRM_DEBUG_ATOMIC("CRTC set but no FB\n");
> +		DRM_DEBUG_KMS("CRTC set but no FB\n");
>  		return -EINVAL;
>  	} else if (WARN_ON(state->fb && !state->crtc)) {
> -		DRM_DEBUG_ATOMIC("FB set but no CRTC\n");
> +		DRM_DEBUG_KMS("FB set but no CRTC\n");
>  		return -EINVAL;
>  	}
>  
> @@ -815,15 +815,15 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
>  
>  	/* Check whether this plane is usable on this CRTC */
>  	if (!(plane->possible_crtcs & drm_crtc_mask(state->crtc))) {
> -		DRM_DEBUG_ATOMIC("Invalid crtc for plane\n");
> +		DRM_DEBUG_KMS("Invalid crtc for plane\n");
>  		return -EINVAL;
>  	}
>  
>  	/* Check whether this plane supports the fb pixel format. */
>  	ret = drm_plane_check_pixel_format(plane, state->fb->pixel_format);
>  	if (ret) {
> -		DRM_DEBUG_ATOMIC("Invalid pixel format %s\n",
> -				 drm_get_format_name(state->fb->pixel_format));
> +		DRM_DEBUG_KMS("Invalid pixel format %s\n",
> +			      drm_get_format_name(state->fb->pixel_format));
>  		return ret;
>  	}
>  
> @@ -832,9 +832,9 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
>  	    state->crtc_x > INT_MAX - (int32_t) state->crtc_w ||
>  	    state->crtc_h > INT_MAX ||
>  	    state->crtc_y > INT_MAX - (int32_t) state->crtc_h) {
> -		DRM_DEBUG_ATOMIC("Invalid CRTC coordinates %ux%u+%d+%d\n",
> -				 state->crtc_w, state->crtc_h,
> -				 state->crtc_x, state->crtc_y);
> +		DRM_DEBUG_KMS("Invalid CRTC coordinates %ux%u+%d+%d\n",
> +			      state->crtc_w, state->crtc_h,
> +			      state->crtc_x, state->crtc_y);
>  		return -ERANGE;
>  	}
>  
> @@ -846,18 +846,18 @@ static int drm_atomic_plane_check(struct drm_plane *plane,
>  	    state->src_x > fb_width - state->src_w ||
>  	    state->src_h > fb_height ||
>  	    state->src_y > fb_height - state->src_h) {
> -		DRM_DEBUG_ATOMIC("Invalid source coordinates "
> -				 "%u.%06ux%u.%06u+%u.%06u+%u.%06u\n",
> -				 state->src_w >> 16, ((state->src_w & 0xffff) * 15625) >> 10,
> -				 state->src_h >> 16, ((state->src_h & 0xffff) * 15625) >> 10,
> -				 state->src_x >> 16, ((state->src_x & 0xffff) * 15625) >> 10,
> -				 state->src_y >> 16, ((state->src_y & 0xffff) * 15625) >> 10);
> +		DRM_DEBUG_KMS("Invalid source coordinates "
> +			      "%u.%06ux%u.%06u+%u.%06u+%u.%06u\n",
> +			      state->src_w >> 16, ((state->src_w & 0xffff) * 15625) >> 10,
> +			      state->src_h >> 16, ((state->src_h & 0xffff) * 15625) >> 10,
> +			      state->src_x >> 16, ((state->src_x & 0xffff) * 15625) >> 10,
> +			      state->src_y >> 16, ((state->src_y & 0xffff) * 15625) >> 10);
>  		return -ENOSPC;
>  	}
>  
>  	if (plane_switching_crtc(state->state, plane, state)) {
> -		DRM_DEBUG_ATOMIC("[PLANE:%d:%s] switching CRTC directly\n",
> -				 plane->base.id, plane->name);
> +		DRM_DEBUG_KMS("[PLANE:%d:%s] switching CRTC directly\n",
> +			      plane->base.id, plane->name);
>  		return -EINVAL;
>  	}
>  
> @@ -1330,8 +1330,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
>  	for_each_plane_in_state(state, plane, plane_state, i) {
>  		ret = drm_atomic_plane_check(plane, plane_state);
>  		if (ret) {
> -			DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic core check failed\n",
> -					 plane->base.id, plane->name);
> +			DRM_DEBUG_KMS("[PLANE:%d:%s] atomic core check failed\n",
> +				      plane->base.id, plane->name);
>  			return ret;
>  		}
>  	}
> @@ -1339,8 +1339,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
>  	for_each_crtc_in_state(state, crtc, crtc_state, i) {
>  		ret = drm_atomic_crtc_check(crtc, crtc_state);
>  		if (ret) {
> -			DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic core check failed\n",
> -					 crtc->base.id, crtc->name);
> +			DRM_DEBUG_KMS("[CRTC:%d:%s] atomic core check failed\n",
> +				      crtc->base.id, crtc->name);
>  			return ret;
>  		}
>  	}
> @@ -1351,8 +1351,8 @@ int drm_atomic_check_only(struct drm_atomic_state *state)
>  	if (!state->allow_modeset) {
>  		for_each_crtc_in_state(state, crtc, crtc_state, i) {
>  			if (drm_atomic_crtc_needs_modeset(crtc_state)) {
> -				DRM_DEBUG_ATOMIC("[CRTC:%d:%s] requires full modeset\n",
> -						 crtc->base.id, crtc->name);
> +				DRM_DEBUG_KMS("[CRTC:%d:%s] requires full modeset\n",
> +					      crtc->base.id, crtc->name);
>  				return -EINVAL;
>  			}
>  		}
> diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c
> index 43a0b3dfa846..18ebb1a08d6c 100644
> --- a/drivers/gpu/drm/drm_atomic_helper.c
> +++ b/drivers/gpu/drm/drm_atomic_helper.c
> @@ -115,9 +115,9 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
>  
>  		if (new_encoder) {
>  			if (encoder_mask & (1 << drm_encoder_index(new_encoder))) {
> -				DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] on [CONNECTOR:%d:%s] already assigned\n",
> -					new_encoder->base.id, new_encoder->name,
> -					connector->base.id, connector->name);
> +				DRM_DEBUG_KMS("[ENCODER:%d:%s] on [CONNECTOR:%d:%s] already assigned\n",
> +					      new_encoder->base.id, new_encoder->name,
> +					      connector->base.id, connector->name);
>  
>  				return -EINVAL;
>  			}
> @@ -151,11 +151,11 @@ static int handle_conflicting_encoders(struct drm_atomic_state *state,
>  			continue;
>  
>  		if (!disable_conflicting_encoders) {
> -			DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] in use on [CRTC:%d:%s] by [CONNECTOR:%d:%s]\n",
> -					 encoder->base.id, encoder->name,
> -					 connector->state->crtc->base.id,
> -					 connector->state->crtc->name,
> -					 connector->base.id, connector->name);
> +			DRM_DEBUG_KMS("[ENCODER:%d:%s] in use on [CRTC:%d:%s] by [CONNECTOR:%d:%s]\n",
> +				      encoder->base.id, encoder->name,
> +				      connector->state->crtc->base.id,
> +				      connector->state->crtc->name,
> +				      connector->base.id, connector->name);
>  			return -EINVAL;
>  		}
>  
> @@ -302,17 +302,17 @@ update_connector_routing(struct drm_atomic_state *state,
>  		new_encoder = funcs->best_encoder(connector);
>  
>  	if (!new_encoder) {
> -		DRM_DEBUG_ATOMIC("No suitable encoder found for [CONNECTOR:%d:%s]\n",
> -				 connector->base.id,
> -				 connector->name);
> +		DRM_DEBUG_KMS("No suitable encoder found for [CONNECTOR:%d:%s]\n",
> +			      connector->base.id,
> +			      connector->name);
>  		return -EINVAL;
>  	}
>  
>  	if (!drm_encoder_crtc_ok(new_encoder, connector_state->crtc)) {
> -		DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] incompatible with [CRTC:%d]\n",
> -				 new_encoder->base.id,
> -				 new_encoder->name,
> -				 connector_state->crtc->base.id);
> +		DRM_DEBUG_KMS("[ENCODER:%d:%s] incompatible with [CRTC:%d]\n",
> +			      new_encoder->base.id,
> +			      new_encoder->name,
> +			      connector_state->crtc->base.id);
>  		return -EINVAL;
>  	}
>  
> @@ -388,7 +388,7 @@ mode_fixup(struct drm_atomic_state *state)
>  		ret = drm_bridge_mode_fixup(encoder->bridge, &crtc_state->mode,
>  				&crtc_state->adjusted_mode);
>  		if (!ret) {
> -			DRM_DEBUG_ATOMIC("Bridge fixup failed\n");
> +			DRM_DEBUG_KMS("Bridge fixup failed\n");
>  			return -EINVAL;
>  		}
>  
> @@ -396,16 +396,16 @@ mode_fixup(struct drm_atomic_state *state)
>  			ret = funcs->atomic_check(encoder, crtc_state,
>  						  conn_state);
>  			if (ret) {
> -				DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] check failed\n",
> -						 encoder->base.id, encoder->name);
> +				DRM_DEBUG_KMS("[ENCODER:%d:%s] check failed\n",
> +					      encoder->base.id, encoder->name);
>  				return ret;
>  			}
>  		} else if (funcs && funcs->mode_fixup) {
>  			ret = funcs->mode_fixup(encoder, &crtc_state->mode,
>  						&crtc_state->adjusted_mode);
>  			if (!ret) {
> -				DRM_DEBUG_ATOMIC("[ENCODER:%d:%s] fixup failed\n",
> -						 encoder->base.id, encoder->name);
> +				DRM_DEBUG_KMS("[ENCODER:%d:%s] fixup failed\n",
> +					      encoder->base.id, encoder->name);
>  				return -EINVAL;
>  			}
>  		}
> @@ -425,8 +425,8 @@ mode_fixup(struct drm_atomic_state *state)
>  		ret = funcs->mode_fixup(crtc, &crtc_state->mode,
>  					&crtc_state->adjusted_mode);
>  		if (!ret) {
> -			DRM_DEBUG_ATOMIC("[CRTC:%d:%s] fixup failed\n",
> -					 crtc->base.id, crtc->name);
> +			DRM_DEBUG_KMS("[CRTC:%d:%s] fixup failed\n",
> +				      crtc->base.id, crtc->name);
>  			return -EINVAL;
>  		}
>  	}
> @@ -549,8 +549,8 @@ drm_atomic_helper_check_modeset(struct drm_device *dev,
>  			return ret;
>  
>  		if (crtc_state->enable != has_connectors) {
> -			DRM_DEBUG_ATOMIC("[CRTC:%d:%s] enabled/connectors mismatch\n",
> -					 crtc->base.id, crtc->name);
> +			DRM_DEBUG_KMS("[CRTC:%d:%s] enabled/connectors mismatch\n",
> +				      crtc->base.id, crtc->name);
>  
>  			return -EINVAL;
>  		}
> @@ -597,8 +597,8 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
>  
>  		ret = funcs->atomic_check(plane, plane_state);
>  		if (ret) {
> -			DRM_DEBUG_ATOMIC("[PLANE:%d:%s] atomic driver check failed\n",
> -					 plane->base.id, plane->name);
> +			DRM_DEBUG_KMS("[PLANE:%d:%s] atomic driver check failed\n",
> +				      plane->base.id, plane->name);
>  			return ret;
>  		}
>  	}
> @@ -613,8 +613,8 @@ drm_atomic_helper_check_planes(struct drm_device *dev,
>  
>  		ret = funcs->atomic_check(crtc, state->crtc_states[i]);
>  		if (ret) {
> -			DRM_DEBUG_ATOMIC("[CRTC:%d:%s] atomic driver check failed\n",
> -					 crtc->base.id, crtc->name);
> +			DRM_DEBUG_KMS("[CRTC:%d:%s] atomic driver check failed\n",
> +				      crtc->base.id, crtc->name);
>  			return ret;
>  		}
>  	}
> @@ -2367,8 +2367,8 @@ retry:
>  	/* Make sure we don't accidentally do a full modeset. */
>  	state->allow_modeset = false;
>  	if (!crtc_state->active) {
> -		DRM_DEBUG_ATOMIC("[CRTC:%d] disabled, rejecting legacy flip\n",
> -				 crtc->base.id);
> +		DRM_DEBUG_KMS("[CRTC:%d] disabled, rejecting legacy flip\n",
> +			      crtc->base.id);
>  		ret = -EINVAL;
>  		goto fail;
>  	}

-- 
Jani Nikula, Intel Open Source Technology Center


More information about the dri-devel mailing list