diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2010-02-05 15:42:41 -0500 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2010-02-22 11:46:57 -0500 |
commit | b5e50c3f56ee4aa0d0168eab5ece413ac5df76aa (patch) | |
tree | eb6ee1777dc52a00d3981e4a7a208bbe6a136263 | |
parent | 357b13c3e498bb658f511f91a9e4f09c9553be6e (diff) |
drm/i915: provide FBC status in debugfs
Tools like powertop want to check the current FBC status and report it
to the user. So add a debugfs file indicating whether FBC is enabled,
and if not, why.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 49 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_dma.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 5 |
4 files changed, 66 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index 55340de618ea..96e8b9b2cb32 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -477,6 +477,54 @@ static int i915_drpc_info(struct seq_file *m, void *unused) | |||
477 | return 0; | 477 | return 0; |
478 | } | 478 | } |
479 | 479 | ||
480 | static int i915_fbc_status(struct seq_file *m, void *unused) | ||
481 | { | ||
482 | struct drm_info_node *node = (struct drm_info_node *) m->private; | ||
483 | struct drm_device *dev = node->minor->dev; | ||
484 | struct drm_crtc *crtc; | ||
485 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
486 | bool fbc_enabled = false; | ||
487 | |||
488 | if (!dev_priv->display.fbc_enabled) { | ||
489 | seq_printf(m, "FBC unsupported on this chipset\n"); | ||
490 | return 0; | ||
491 | } | ||
492 | |||
493 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
494 | if (!crtc->enabled) | ||
495 | continue; | ||
496 | if (dev_priv->display.fbc_enabled(crtc)) | ||
497 | fbc_enabled = true; | ||
498 | } | ||
499 | |||
500 | if (fbc_enabled) { | ||
501 | seq_printf(m, "FBC enabled\n"); | ||
502 | } else { | ||
503 | seq_printf(m, "FBC disabled: "); | ||
504 | switch (dev_priv->no_fbc_reason) { | ||
505 | case FBC_STOLEN_TOO_SMALL: | ||
506 | seq_printf(m, "not enough stolen memory"); | ||
507 | break; | ||
508 | case FBC_UNSUPPORTED_MODE: | ||
509 | seq_printf(m, "mode not supported"); | ||
510 | break; | ||
511 | case FBC_MODE_TOO_LARGE: | ||
512 | seq_printf(m, "mode too large"); | ||
513 | break; | ||
514 | case FBC_BAD_PLANE: | ||
515 | seq_printf(m, "FBC unsupported on plane"); | ||
516 | break; | ||
517 | case FBC_NOT_TILED: | ||
518 | seq_printf(m, "scanout buffer not tiled"); | ||
519 | break; | ||
520 | default: | ||
521 | seq_printf(m, "unknown reason"); | ||
522 | } | ||
523 | seq_printf(m, "\n"); | ||
524 | } | ||
525 | return 0; | ||
526 | } | ||
527 | |||
480 | static int | 528 | static int |
481 | i915_wedged_open(struct inode *inode, | 529 | i915_wedged_open(struct inode *inode, |
482 | struct file *filp) | 530 | struct file *filp) |
@@ -599,6 +647,7 @@ static struct drm_info_list i915_debugfs_list[] = { | |||
599 | {"i915_delayfreq_table", i915_delayfreq_table, 0}, | 647 | {"i915_delayfreq_table", i915_delayfreq_table, 0}, |
600 | {"i915_inttoext_table", i915_inttoext_table, 0}, | 648 | {"i915_inttoext_table", i915_inttoext_table, 0}, |
601 | {"i915_drpc_info", i915_drpc_info, 0}, | 649 | {"i915_drpc_info", i915_drpc_info, 0}, |
650 | {"i915_fbc_status", i915_fbc_status, 0}, | ||
602 | }; | 651 | }; |
603 | #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) | 652 | #define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) |
604 | 653 | ||
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index 3afe361ec552..47805a41395e 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -1249,6 +1249,7 @@ static void i915_setup_compression(struct drm_device *dev, int size) | |||
1249 | /* Leave 1M for line length buffer & misc. */ | 1249 | /* Leave 1M for line length buffer & misc. */ |
1250 | compressed_fb = drm_mm_search_free(&dev_priv->vram, size, 4096, 0); | 1250 | compressed_fb = drm_mm_search_free(&dev_priv->vram, size, 4096, 0); |
1251 | if (!compressed_fb) { | 1251 | if (!compressed_fb) { |
1252 | dev_priv->no_fbc_reason = FBC_STOLEN_TOO_SMALL; | ||
1252 | i915_warn_stolen(dev); | 1253 | i915_warn_stolen(dev); |
1253 | return; | 1254 | return; |
1254 | } | 1255 | } |
@@ -1256,6 +1257,7 @@ static void i915_setup_compression(struct drm_device *dev, int size) | |||
1256 | compressed_fb = drm_mm_get_block(compressed_fb, size, 4096); | 1257 | compressed_fb = drm_mm_get_block(compressed_fb, size, 4096); |
1257 | if (!compressed_fb) { | 1258 | if (!compressed_fb) { |
1258 | i915_warn_stolen(dev); | 1259 | i915_warn_stolen(dev); |
1260 | dev_priv->no_fbc_reason = FBC_STOLEN_TOO_SMALL; | ||
1259 | return; | 1261 | return; |
1260 | } | 1262 | } |
1261 | 1263 | ||
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 7df89ae8172f..953ad64e0553 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -192,6 +192,14 @@ struct intel_device_info { | |||
192 | u8 cursor_needs_physical : 1; | 192 | u8 cursor_needs_physical : 1; |
193 | }; | 193 | }; |
194 | 194 | ||
195 | enum no_fbc_reason { | ||
196 | FBC_STOLEN_TOO_SMALL, /* not enough space to hold compressed buffers */ | ||
197 | FBC_UNSUPPORTED_MODE, /* interlace or doublescanned mode */ | ||
198 | FBC_MODE_TOO_LARGE, /* mode too large for compression */ | ||
199 | FBC_BAD_PLANE, /* fbc not supported on plane */ | ||
200 | FBC_NOT_TILED, /* buffer not tiled */ | ||
201 | }; | ||
202 | |||
195 | typedef struct drm_i915_private { | 203 | typedef struct drm_i915_private { |
196 | struct drm_device *dev; | 204 | struct drm_device *dev; |
197 | 205 | ||
@@ -597,6 +605,8 @@ typedef struct drm_i915_private { | |||
597 | u8 cur_delay; | 605 | u8 cur_delay; |
598 | u8 min_delay; | 606 | u8 min_delay; |
599 | u8 max_delay; | 607 | u8 max_delay; |
608 | |||
609 | enum no_fbc_reason no_fbc_reason; | ||
600 | } drm_i915_private_t; | 610 | } drm_i915_private_t; |
601 | 611 | ||
602 | /** driver private structure attached to each drm_gem_object */ | 612 | /** driver private structure attached to each drm_gem_object */ |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index e879885f4754..a483f41e9f22 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -1188,25 +1188,30 @@ static void intel_update_fbc(struct drm_crtc *crtc, | |||
1188 | if (intel_fb->obj->size > dev_priv->cfb_size) { | 1188 | if (intel_fb->obj->size > dev_priv->cfb_size) { |
1189 | DRM_DEBUG_KMS("framebuffer too large, disabling " | 1189 | DRM_DEBUG_KMS("framebuffer too large, disabling " |
1190 | "compression\n"); | 1190 | "compression\n"); |
1191 | dev_priv->no_fbc_reason = FBC_STOLEN_TOO_SMALL; | ||
1191 | goto out_disable; | 1192 | goto out_disable; |
1192 | } | 1193 | } |
1193 | if ((mode->flags & DRM_MODE_FLAG_INTERLACE) || | 1194 | if ((mode->flags & DRM_MODE_FLAG_INTERLACE) || |
1194 | (mode->flags & DRM_MODE_FLAG_DBLSCAN)) { | 1195 | (mode->flags & DRM_MODE_FLAG_DBLSCAN)) { |
1195 | DRM_DEBUG_KMS("mode incompatible with compression, " | 1196 | DRM_DEBUG_KMS("mode incompatible with compression, " |
1196 | "disabling\n"); | 1197 | "disabling\n"); |
1198 | dev_priv->no_fbc_reason = FBC_UNSUPPORTED_MODE; | ||
1197 | goto out_disable; | 1199 | goto out_disable; |
1198 | } | 1200 | } |
1199 | if ((mode->hdisplay > 2048) || | 1201 | if ((mode->hdisplay > 2048) || |
1200 | (mode->vdisplay > 1536)) { | 1202 | (mode->vdisplay > 1536)) { |
1201 | DRM_DEBUG_KMS("mode too large for compression, disabling\n"); | 1203 | DRM_DEBUG_KMS("mode too large for compression, disabling\n"); |
1204 | dev_priv->no_fbc_reason = FBC_MODE_TOO_LARGE; | ||
1202 | goto out_disable; | 1205 | goto out_disable; |
1203 | } | 1206 | } |
1204 | if ((IS_I915GM(dev) || IS_I945GM(dev)) && plane != 0) { | 1207 | if ((IS_I915GM(dev) || IS_I945GM(dev)) && plane != 0) { |
1205 | DRM_DEBUG_KMS("plane not 0, disabling compression\n"); | 1208 | DRM_DEBUG_KMS("plane not 0, disabling compression\n"); |
1209 | dev_priv->no_fbc_reason = FBC_BAD_PLANE; | ||
1206 | goto out_disable; | 1210 | goto out_disable; |
1207 | } | 1211 | } |
1208 | if (obj_priv->tiling_mode != I915_TILING_X) { | 1212 | if (obj_priv->tiling_mode != I915_TILING_X) { |
1209 | DRM_DEBUG_KMS("framebuffer not tiled, disabling compression\n"); | 1213 | DRM_DEBUG_KMS("framebuffer not tiled, disabling compression\n"); |
1214 | dev_priv->no_fbc_reason = FBC_NOT_TILED; | ||
1210 | goto out_disable; | 1215 | goto out_disable; |
1211 | } | 1216 | } |
1212 | 1217 | ||