Commit 2e8144a5 authored by Paulo Zanoni's avatar Paulo Zanoni Committed by Daniel Vetter

drm/i915: unify no_fbc_reason message printing

This commit has two main advantages: simplify intel_fbc_update()
and deduplicate the strings.

v2:
 - Rebase due to changes on P1.
 - set_no_fbc_reason() can now return void (Chris).
Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 87f5ff01
...@@ -1594,52 +1594,11 @@ static int i915_fbc_status(struct seq_file *m, void *unused) ...@@ -1594,52 +1594,11 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
intel_runtime_pm_get(dev_priv); intel_runtime_pm_get(dev_priv);
if (intel_fbc_enabled(dev)) { if (intel_fbc_enabled(dev))
seq_puts(m, "FBC enabled\n"); seq_puts(m, "FBC enabled\n");
} else { else
seq_puts(m, "FBC disabled: "); seq_printf(m, "FBC disabled: %s\n",
switch (dev_priv->fbc.no_fbc_reason) { intel_no_fbc_reason_str(dev_priv->fbc.no_fbc_reason));
case FBC_OK:
seq_puts(m, "FBC actived, but currently disabled in hardware");
break;
case FBC_UNSUPPORTED:
seq_puts(m, "unsupported by this chipset");
break;
case FBC_NO_OUTPUT:
seq_puts(m, "no outputs");
break;
case FBC_STOLEN_TOO_SMALL:
seq_puts(m, "not enough stolen memory");
break;
case FBC_UNSUPPORTED_MODE:
seq_puts(m, "mode not supported");
break;
case FBC_MODE_TOO_LARGE:
seq_puts(m, "mode too large");
break;
case FBC_BAD_PLANE:
seq_puts(m, "FBC unsupported on plane");
break;
case FBC_NOT_TILED:
seq_puts(m, "scanout buffer not tiled");
break;
case FBC_MULTIPLE_PIPES:
seq_puts(m, "multiple pipes are enabled");
break;
case FBC_MODULE_PARAM:
seq_puts(m, "disabled per module param (default off)");
break;
case FBC_CHIP_DEFAULT:
seq_puts(m, "disabled per chip default");
break;
case FBC_ROTATION:
seq_puts(m, "rotation not supported");
break;
default:
seq_puts(m, "unknown reason");
}
seq_putc(m, '\n');
}
if (INTEL_INFO(dev_priv)->gen >= 7) if (INTEL_INFO(dev_priv)->gen >= 7)
seq_printf(m, "Compressing: %s\n", seq_printf(m, "Compressing: %s\n",
......
...@@ -1256,6 +1256,7 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv, ...@@ -1256,6 +1256,7 @@ void intel_fbc_invalidate(struct drm_i915_private *dev_priv,
enum fb_op_origin origin); enum fb_op_origin origin);
void intel_fbc_flush(struct drm_i915_private *dev_priv, void intel_fbc_flush(struct drm_i915_private *dev_priv,
unsigned int frontbuffer_bits); unsigned int frontbuffer_bits);
const char *intel_no_fbc_reason_str(enum no_fbc_reason reason);
/* intel_hdmi.c */ /* intel_hdmi.c */
void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port); void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port);
......
...@@ -432,14 +432,47 @@ void intel_fbc_disable(struct drm_device *dev) ...@@ -432,14 +432,47 @@ void intel_fbc_disable(struct drm_device *dev)
dev_priv->fbc.crtc = NULL; dev_priv->fbc.crtc = NULL;
} }
static bool set_no_fbc_reason(struct drm_i915_private *dev_priv, const char *intel_no_fbc_reason_str(enum no_fbc_reason reason)
{
switch (reason) {
case FBC_OK:
return "FBC enabled but currently disabled in hardware";
case FBC_UNSUPPORTED:
return "unsupported by this chipset";
case FBC_NO_OUTPUT:
return "no output";
case FBC_STOLEN_TOO_SMALL:
return "not enough stolen memory";
case FBC_UNSUPPORTED_MODE:
return "mode incompatible with compression";
case FBC_MODE_TOO_LARGE:
return "mode too large for compression";
case FBC_BAD_PLANE:
return "FBC unsupported on plane";
case FBC_NOT_TILED:
return "framebuffer not tiled or fenced";
case FBC_MULTIPLE_PIPES:
return "more than one pipe active";
case FBC_MODULE_PARAM:
return "disabled per module param";
case FBC_CHIP_DEFAULT:
return "disabled per chip default";
case FBC_ROTATION:
return "rotation unsupported";
default:
MISSING_CASE(reason);
return "unknown reason";
}
}
static void set_no_fbc_reason(struct drm_i915_private *dev_priv,
enum no_fbc_reason reason) enum no_fbc_reason reason)
{ {
if (dev_priv->fbc.no_fbc_reason == reason) if (dev_priv->fbc.no_fbc_reason == reason)
return false; return;
dev_priv->fbc.no_fbc_reason = reason; dev_priv->fbc.no_fbc_reason = reason;
return true; DRM_DEBUG_KMS("Disabling FBC: %s\n", intel_no_fbc_reason_str(reason));
} }
static struct drm_crtc *intel_fbc_find_crtc(struct drm_i915_private *dev_priv) static struct drm_crtc *intel_fbc_find_crtc(struct drm_i915_private *dev_priv)
...@@ -459,8 +492,7 @@ static struct drm_crtc *intel_fbc_find_crtc(struct drm_i915_private *dev_priv) ...@@ -459,8 +492,7 @@ static struct drm_crtc *intel_fbc_find_crtc(struct drm_i915_private *dev_priv)
if (intel_crtc_active(tmp_crtc) && if (intel_crtc_active(tmp_crtc) &&
to_intel_plane_state(tmp_crtc->primary->state)->visible) { to_intel_plane_state(tmp_crtc->primary->state)->visible) {
if (one_pipe_only && crtc) { if (one_pipe_only && crtc) {
if (set_no_fbc_reason(dev_priv, FBC_MULTIPLE_PIPES)) set_no_fbc_reason(dev_priv, FBC_MULTIPLE_PIPES);
DRM_DEBUG_KMS("more than one pipe active, disabling compression\n");
return NULL; return NULL;
} }
crtc = tmp_crtc; crtc = tmp_crtc;
...@@ -471,8 +503,7 @@ static struct drm_crtc *intel_fbc_find_crtc(struct drm_i915_private *dev_priv) ...@@ -471,8 +503,7 @@ static struct drm_crtc *intel_fbc_find_crtc(struct drm_i915_private *dev_priv)
} }
if (!crtc || crtc->primary->fb == NULL) { if (!crtc || crtc->primary->fb == NULL) {
if (set_no_fbc_reason(dev_priv, FBC_NO_OUTPUT)) set_no_fbc_reason(dev_priv, FBC_NO_OUTPUT);
DRM_DEBUG_KMS("no output, disabling\n");
return NULL; return NULL;
} }
...@@ -516,14 +547,12 @@ void intel_fbc_update(struct drm_device *dev) ...@@ -516,14 +547,12 @@ void intel_fbc_update(struct drm_device *dev)
i915.enable_fbc = 0; i915.enable_fbc = 0;
if (i915.enable_fbc < 0) { if (i915.enable_fbc < 0) {
if (set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT)) set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT);
DRM_DEBUG_KMS("disabled per chip default\n");
goto out_disable; goto out_disable;
} }
if (!i915.enable_fbc) { if (!i915.enable_fbc) {
if (set_no_fbc_reason(dev_priv, FBC_MODULE_PARAM)) set_no_fbc_reason(dev_priv, FBC_MODULE_PARAM);
DRM_DEBUG_KMS("fbc disabled per module param\n");
goto out_disable; goto out_disable;
} }
...@@ -547,9 +576,7 @@ void intel_fbc_update(struct drm_device *dev) ...@@ -547,9 +576,7 @@ void intel_fbc_update(struct drm_device *dev)
if ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) || if ((adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE) ||
(adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)) { (adjusted_mode->flags & DRM_MODE_FLAG_DBLSCAN)) {
if (set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE)) set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE);
DRM_DEBUG_KMS("mode incompatible with compression, "
"disabling\n");
goto out_disable; goto out_disable;
} }
...@@ -565,14 +592,12 @@ void intel_fbc_update(struct drm_device *dev) ...@@ -565,14 +592,12 @@ void intel_fbc_update(struct drm_device *dev)
} }
if (intel_crtc->config->pipe_src_w > max_width || if (intel_crtc->config->pipe_src_w > max_width ||
intel_crtc->config->pipe_src_h > max_height) { intel_crtc->config->pipe_src_h > max_height) {
if (set_no_fbc_reason(dev_priv, FBC_MODE_TOO_LARGE)) set_no_fbc_reason(dev_priv, FBC_MODE_TOO_LARGE);
DRM_DEBUG_KMS("mode too large for compression, disabling\n");
goto out_disable; goto out_disable;
} }
if ((INTEL_INFO(dev)->gen < 4 || HAS_DDI(dev)) && if ((INTEL_INFO(dev)->gen < 4 || HAS_DDI(dev)) &&
intel_crtc->plane != PLANE_A) { intel_crtc->plane != PLANE_A) {
if (set_no_fbc_reason(dev_priv, FBC_BAD_PLANE)) set_no_fbc_reason(dev_priv, FBC_BAD_PLANE);
DRM_DEBUG_KMS("plane not A, disabling compression\n");
goto out_disable; goto out_disable;
} }
...@@ -581,14 +606,12 @@ void intel_fbc_update(struct drm_device *dev) ...@@ -581,14 +606,12 @@ void intel_fbc_update(struct drm_device *dev)
*/ */
if (obj->tiling_mode != I915_TILING_X || if (obj->tiling_mode != I915_TILING_X ||
obj->fence_reg == I915_FENCE_REG_NONE) { obj->fence_reg == I915_FENCE_REG_NONE) {
if (set_no_fbc_reason(dev_priv, FBC_NOT_TILED)) set_no_fbc_reason(dev_priv, FBC_NOT_TILED);
DRM_DEBUG_KMS("framebuffer not tiled or fenced, disabling compression\n");
goto out_disable; goto out_disable;
} }
if (INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) && if (INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev) &&
crtc->primary->state->rotation != BIT(DRM_ROTATE_0)) { crtc->primary->state->rotation != BIT(DRM_ROTATE_0)) {
if (set_no_fbc_reason(dev_priv, FBC_ROTATION)) set_no_fbc_reason(dev_priv, FBC_ROTATION);
DRM_DEBUG_KMS("Rotation unsupported, disabling\n");
goto out_disable; goto out_disable;
} }
...@@ -598,8 +621,7 @@ void intel_fbc_update(struct drm_device *dev) ...@@ -598,8 +621,7 @@ void intel_fbc_update(struct drm_device *dev)
if (i915_gem_stolen_setup_compression(dev, obj->base.size, if (i915_gem_stolen_setup_compression(dev, obj->base.size,
drm_format_plane_cpp(fb->pixel_format, 0))) { drm_format_plane_cpp(fb->pixel_format, 0))) {
if (set_no_fbc_reason(dev_priv, FBC_STOLEN_TOO_SMALL)) set_no_fbc_reason(dev_priv, FBC_STOLEN_TOO_SMALL);
DRM_DEBUG_KMS("framebuffer too large, disabling compression\n");
goto out_disable; goto out_disable;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment