Commit 29ebf90f authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter

drm/i915: Squelch repeated reasoning for why FBC cannot be activated

Almost invariably the reason why FBC cannot be turned on is the same
every time (disabled via parameter, too many pipes, pipe too large etc)
as modesetting and framebuffer configuration changes less frequently
than trying to enable FBC.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarBen Widawsky <ben@bwidawsk.net>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 135c81b8
...@@ -1099,6 +1099,12 @@ static int i915_fbc_status(struct seq_file *m, void *unused) ...@@ -1099,6 +1099,12 @@ static int i915_fbc_status(struct seq_file *m, void *unused)
} else { } else {
seq_puts(m, "FBC disabled: "); seq_puts(m, "FBC disabled: ");
switch (dev_priv->fbc.no_fbc_reason) { switch (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: case FBC_NO_OUTPUT:
seq_puts(m, "no outputs"); seq_puts(m, "no outputs");
break; break;
......
...@@ -589,7 +589,9 @@ struct i915_fbc { ...@@ -589,7 +589,9 @@ struct i915_fbc {
int interval; int interval;
} *fbc_work; } *fbc_work;
enum { enum no_fbc_reason {
FBC_OK, /* FBC is enabled */
FBC_UNSUPPORTED, /* FBC is not supported by this chipset */
FBC_NO_OUTPUT, /* no outputs enabled to compress */ FBC_NO_OUTPUT, /* no outputs enabled to compress */
FBC_STOLEN_TOO_SMALL, /* not enough space for buffers */ FBC_STOLEN_TOO_SMALL, /* not enough space for buffers */
FBC_UNSUPPORTED_MODE, /* interlace or doublescanned mode */ FBC_UNSUPPORTED_MODE, /* interlace or doublescanned mode */
......
...@@ -421,6 +421,16 @@ void intel_disable_fbc(struct drm_device *dev) ...@@ -421,6 +421,16 @@ void intel_disable_fbc(struct drm_device *dev)
dev_priv->fbc.plane = -1; dev_priv->fbc.plane = -1;
} }
static bool set_no_fbc_reason(struct drm_i915_private *dev_priv,
enum no_fbc_reason reason)
{
if (dev_priv->fbc.no_fbc_reason == reason)
return false;
dev_priv->fbc.no_fbc_reason = reason;
return true;
}
/** /**
* intel_update_fbc - enable/disable FBC as needed * intel_update_fbc - enable/disable FBC as needed
* @dev: the drm_device * @dev: the drm_device
...@@ -450,11 +460,16 @@ void intel_update_fbc(struct drm_device *dev) ...@@ -450,11 +460,16 @@ void intel_update_fbc(struct drm_device *dev)
struct drm_i915_gem_object *obj; struct drm_i915_gem_object *obj;
unsigned int max_hdisplay, max_vdisplay; unsigned int max_hdisplay, max_vdisplay;
if (!i915_powersave) if (!I915_HAS_FBC(dev)) {
set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED);
return; return;
}
if (!I915_HAS_FBC(dev)) if (!i915_powersave) {
if (set_no_fbc_reason(dev_priv, FBC_MODULE_PARAM))
DRM_DEBUG_KMS("fbc disabled per module param\n");
return; return;
}
/* /*
* If FBC is already on, we just have to verify that we can * If FBC is already on, we just have to verify that we can
...@@ -469,9 +484,8 @@ void intel_update_fbc(struct drm_device *dev) ...@@ -469,9 +484,8 @@ void intel_update_fbc(struct drm_device *dev)
if (intel_crtc_active(tmp_crtc) && if (intel_crtc_active(tmp_crtc) &&
!to_intel_crtc(tmp_crtc)->primary_disabled) { !to_intel_crtc(tmp_crtc)->primary_disabled) {
if (crtc) { if (crtc) {
if (set_no_fbc_reason(dev_priv, FBC_MULTIPLE_PIPES))
DRM_DEBUG_KMS("more than one pipe active, disabling compression\n"); DRM_DEBUG_KMS("more than one pipe active, disabling compression\n");
dev_priv->fbc.no_fbc_reason =
FBC_MULTIPLE_PIPES;
goto out_disable; goto out_disable;
} }
crtc = tmp_crtc; crtc = tmp_crtc;
...@@ -479,8 +493,8 @@ void intel_update_fbc(struct drm_device *dev) ...@@ -479,8 +493,8 @@ void intel_update_fbc(struct drm_device *dev)
} }
if (!crtc || crtc->fb == NULL) { if (!crtc || crtc->fb == NULL) {
if (set_no_fbc_reason(dev_priv, FBC_NO_OUTPUT))
DRM_DEBUG_KMS("no output, disabling\n"); DRM_DEBUG_KMS("no output, disabling\n");
dev_priv->fbc.no_fbc_reason = FBC_NO_OUTPUT;
goto out_disable; goto out_disable;
} }
...@@ -491,20 +505,20 @@ void intel_update_fbc(struct drm_device *dev) ...@@ -491,20 +505,20 @@ void intel_update_fbc(struct drm_device *dev)
if (i915_enable_fbc < 0 && if (i915_enable_fbc < 0 &&
INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev)) { INTEL_INFO(dev)->gen <= 7 && !IS_HASWELL(dev)) {
if (set_no_fbc_reason(dev_priv, FBC_CHIP_DEFAULT))
DRM_DEBUG_KMS("disabled per chip default\n"); DRM_DEBUG_KMS("disabled per chip default\n");
dev_priv->fbc.no_fbc_reason = FBC_CHIP_DEFAULT;
goto out_disable; goto out_disable;
} }
if (!i915_enable_fbc) { if (!i915_enable_fbc) {
if (set_no_fbc_reason(dev_priv, FBC_MODULE_PARAM))
DRM_DEBUG_KMS("fbc disabled per module param\n"); DRM_DEBUG_KMS("fbc disabled per module param\n");
dev_priv->fbc.no_fbc_reason = FBC_MODULE_PARAM;
goto out_disable; goto out_disable;
} }
if ((crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) || if ((crtc->mode.flags & DRM_MODE_FLAG_INTERLACE) ||
(crtc->mode.flags & DRM_MODE_FLAG_DBLSCAN)) { (crtc->mode.flags & DRM_MODE_FLAG_DBLSCAN)) {
if (set_no_fbc_reason(dev_priv, FBC_UNSUPPORTED_MODE))
DRM_DEBUG_KMS("mode incompatible with compression, " DRM_DEBUG_KMS("mode incompatible with compression, "
"disabling\n"); "disabling\n");
dev_priv->fbc.no_fbc_reason = FBC_UNSUPPORTED_MODE;
goto out_disable; goto out_disable;
} }
...@@ -517,14 +531,14 @@ void intel_update_fbc(struct drm_device *dev) ...@@ -517,14 +531,14 @@ void intel_update_fbc(struct drm_device *dev)
} }
if ((crtc->mode.hdisplay > max_hdisplay) || if ((crtc->mode.hdisplay > max_hdisplay) ||
(crtc->mode.vdisplay > max_vdisplay)) { (crtc->mode.vdisplay > max_vdisplay)) {
if (set_no_fbc_reason(dev_priv, FBC_MODE_TOO_LARGE))
DRM_DEBUG_KMS("mode too large for compression, disabling\n"); DRM_DEBUG_KMS("mode too large for compression, disabling\n");
dev_priv->fbc.no_fbc_reason = FBC_MODE_TOO_LARGE;
goto out_disable; goto out_disable;
} }
if ((IS_I915GM(dev) || IS_I945GM(dev) || IS_HASWELL(dev)) && if ((IS_I915GM(dev) || IS_I945GM(dev) || IS_HASWELL(dev)) &&
intel_crtc->plane != 0) { intel_crtc->plane != 0) {
if (set_no_fbc_reason(dev_priv, FBC_BAD_PLANE))
DRM_DEBUG_KMS("plane not 0, disabling compression\n"); DRM_DEBUG_KMS("plane not 0, disabling compression\n");
dev_priv->fbc.no_fbc_reason = FBC_BAD_PLANE;
goto out_disable; goto out_disable;
} }
...@@ -533,8 +547,8 @@ void intel_update_fbc(struct drm_device *dev) ...@@ -533,8 +547,8 @@ void intel_update_fbc(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))
DRM_DEBUG_KMS("framebuffer not tiled or fenced, disabling compression\n"); DRM_DEBUG_KMS("framebuffer not tiled or fenced, disabling compression\n");
dev_priv->fbc.no_fbc_reason = FBC_NOT_TILED;
goto out_disable; goto out_disable;
} }
...@@ -543,8 +557,8 @@ void intel_update_fbc(struct drm_device *dev) ...@@ -543,8 +557,8 @@ void intel_update_fbc(struct drm_device *dev)
goto out_disable; goto out_disable;
if (i915_gem_stolen_setup_compression(dev, intel_fb->obj->base.size)) { if (i915_gem_stolen_setup_compression(dev, intel_fb->obj->base.size)) {
if (set_no_fbc_reason(dev_priv, FBC_STOLEN_TOO_SMALL))
DRM_DEBUG_KMS("framebuffer too large, disabling compression\n"); DRM_DEBUG_KMS("framebuffer too large, disabling compression\n");
dev_priv->fbc.no_fbc_reason = FBC_STOLEN_TOO_SMALL;
goto out_disable; goto out_disable;
} }
...@@ -587,6 +601,7 @@ void intel_update_fbc(struct drm_device *dev) ...@@ -587,6 +601,7 @@ void intel_update_fbc(struct drm_device *dev)
} }
intel_enable_fbc(crtc, 500); intel_enable_fbc(crtc, 500);
dev_priv->fbc.no_fbc_reason = FBC_OK;
return; return;
out_disable: 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