Skip to content

Commit a54746e

Browse files
Vandana Kannandanvet
authored andcommitted
drm/i915: Add debugfs entry for DRRS
Adding a debugfs entry to determine if DRRS is supported or not V2: [By Ram]: Following details about the active crtc will be filled in seq-file of the debugfs 1. Encoder output type 2. DRRS Support on this CRTC 3. DRRS current state 4. Current Vrefresh Format is as follows: CRTC 1: Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_HIGH_RR, Vrefresh: 60 CRTC 2: Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless CRTC 1: Output: eDP, DRRS Supported: Yes (Seamless), DRRS_State: DRRS_LOW_RR, Vrefresh: 40 CRTC 2: Output: HDMI, DRRS Supported : No, VBT DRRS_type: Seamless V3: [By Ram]: Readability is improved. Another error case is covered [Daniel] V4: [By Ram]: Current status of the Idleness DRRS along with the Front buffer bits are added to the debugfs. [Rodrigo] V5: [By Ram]: Rephrased to make it easy to understand. And format is modified. [Rodrigo] V6: [By Ram]: Modeset mutex are acquired for each crtc along with renaming the Idleness detection states [Daniel] Signed-off-by: Vandana Kannan <vandana.kannan@intel.com> Signed-off-by: Ramalingam C <ramalingam.c@intel.com> Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com> [danvet: dump full busy_frontbuffer_bits and remove the dubios computed logical state of DRRS - debugfs is about what is fact, developers should reach their own conclusion when debugging issues.] Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
1 parent 27cd446 commit a54746e

File tree

1 file changed

+110
-0
lines changed

1 file changed

+110
-0
lines changed

drivers/gpu/drm/i915/i915_debugfs.c

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2870,6 +2870,115 @@ static int i915_ddb_info(struct seq_file *m, void *unused)
28702870
return 0;
28712871
}
28722872

2873+
static void drrs_status_per_crtc(struct seq_file *m,
2874+
struct drm_device *dev, struct intel_crtc *intel_crtc)
2875+
{
2876+
struct intel_encoder *intel_encoder;
2877+
struct drm_i915_private *dev_priv = dev->dev_private;
2878+
struct i915_drrs *drrs = &dev_priv->drrs;
2879+
int vrefresh = 0;
2880+
2881+
for_each_encoder_on_crtc(dev, &intel_crtc->base, intel_encoder) {
2882+
/* Encoder connected on this CRTC */
2883+
switch (intel_encoder->type) {
2884+
case INTEL_OUTPUT_EDP:
2885+
seq_puts(m, "eDP:\n");
2886+
break;
2887+
case INTEL_OUTPUT_DSI:
2888+
seq_puts(m, "DSI:\n");
2889+
break;
2890+
case INTEL_OUTPUT_HDMI:
2891+
seq_puts(m, "HDMI:\n");
2892+
break;
2893+
case INTEL_OUTPUT_DISPLAYPORT:
2894+
seq_puts(m, "DP:\n");
2895+
break;
2896+
default:
2897+
seq_printf(m, "Other encoder (id=%d).\n",
2898+
intel_encoder->type);
2899+
return;
2900+
}
2901+
}
2902+
2903+
if (dev_priv->vbt.drrs_type == STATIC_DRRS_SUPPORT)
2904+
seq_puts(m, "\tVBT: DRRS_type: Static");
2905+
else if (dev_priv->vbt.drrs_type == SEAMLESS_DRRS_SUPPORT)
2906+
seq_puts(m, "\tVBT: DRRS_type: Seamless");
2907+
else if (dev_priv->vbt.drrs_type == DRRS_NOT_SUPPORTED)
2908+
seq_puts(m, "\tVBT: DRRS_type: None");
2909+
else
2910+
seq_puts(m, "\tVBT: DRRS_type: FIXME: Unrecognized Value");
2911+
2912+
seq_puts(m, "\n\n");
2913+
2914+
if (intel_crtc->config->has_drrs) {
2915+
struct intel_panel *panel;
2916+
2917+
mutex_lock(&drrs->mutex);
2918+
/* DRRS Supported */
2919+
seq_puts(m, "\tDRRS Supported: Yes\n");
2920+
2921+
/* disable_drrs() will make drrs->dp NULL */
2922+
if (!drrs->dp) {
2923+
seq_puts(m, "Idleness DRRS: Disabled");
2924+
mutex_unlock(&drrs->mutex);
2925+
return;
2926+
}
2927+
2928+
panel = &drrs->dp->attached_connector->panel;
2929+
seq_printf(m, "\t\tBusy_frontbuffer_bits: 0x%X",
2930+
drrs->busy_frontbuffer_bits);
2931+
2932+
seq_puts(m, "\n\t\t");
2933+
if (drrs->refresh_rate_type == DRRS_HIGH_RR) {
2934+
seq_puts(m, "DRRS_State: DRRS_HIGH_RR\n");
2935+
vrefresh = panel->fixed_mode->vrefresh;
2936+
} else if (drrs->refresh_rate_type == DRRS_LOW_RR) {
2937+
seq_puts(m, "DRRS_State: DRRS_LOW_RR\n");
2938+
vrefresh = panel->downclock_mode->vrefresh;
2939+
} else {
2940+
seq_printf(m, "DRRS_State: Unknown(%d)\n",
2941+
drrs->refresh_rate_type);
2942+
mutex_unlock(&drrs->mutex);
2943+
return;
2944+
}
2945+
seq_printf(m, "\t\tVrefresh: %d", vrefresh);
2946+
2947+
seq_puts(m, "\n\t\t");
2948+
mutex_unlock(&drrs->mutex);
2949+
} else {
2950+
/* DRRS not supported. Print the VBT parameter*/
2951+
seq_puts(m, "\tDRRS Supported : No");
2952+
}
2953+
seq_puts(m, "\n");
2954+
}
2955+
2956+
static int i915_drrs_status(struct seq_file *m, void *unused)
2957+
{
2958+
struct drm_info_node *node = m->private;
2959+
struct drm_device *dev = node->minor->dev;
2960+
struct intel_crtc *intel_crtc;
2961+
int active_crtc_cnt = 0;
2962+
2963+
for_each_intel_crtc(dev, intel_crtc) {
2964+
drm_modeset_lock(&intel_crtc->base.mutex, NULL);
2965+
2966+
if (intel_crtc->active) {
2967+
active_crtc_cnt++;
2968+
seq_printf(m, "\nCRTC %d: ", active_crtc_cnt);
2969+
2970+
drrs_status_per_crtc(m, dev, intel_crtc);
2971+
}
2972+
2973+
drm_modeset_unlock(&intel_crtc->base.mutex);
2974+
}
2975+
2976+
if (!active_crtc_cnt)
2977+
seq_puts(m, "No active crtc found\n");
2978+
2979+
return 0;
2980+
}
2981+
28732982
struct pipe_crc_info {
28742983
const char *name;
28752984
struct drm_device *dev;
@@ -4548,6 +4657,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
45484657
{"i915_wa_registers", i915_wa_registers, 0},
45494658
{"i915_ddb_info", i915_ddb_info, 0},
45504659
{"i915_sseu_status", i915_sseu_status, 0},
4660+
{"i915_drrs_status", i915_drrs_status, 0},
45514661
};
45524662
#define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
45534663

0 commit comments

Comments
 (0)