aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@virtuousgeek.org>2014-02-07 15:48:15 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-02-12 12:53:04 -0500
commit53f5e3ca258b9027f2effbdbb4512e459456feee (patch)
treec3ea37cf09d871a57976c2cf5f7ff5a5c3970627
parentac1bb36c4e28b53b3494bc8afbe6ffa0588bfe4a (diff)
drm/i915: add a display info file to debugfs v2
Can be expanded up on to include all sorts of things (HDMI infoframe data, more DP status, etc). Should be useful for bug reports to get a baseline on the display config and info. v2: use seq_putc (Rodrigo) describe mode field names (Rodrigo) Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_debugfs.c159
-rw-r--r--drivers/gpu/drm/i915/i915_drv.h4
2 files changed, 163 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 2dc05c30b800..b737583f9011 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -2074,6 +2074,164 @@ static int i915_power_domain_info(struct seq_file *m, void *unused)
2074 return 0; 2074 return 0;
2075} 2075}
2076 2076
2077static void intel_seq_print_mode(struct seq_file *m, int tabs,
2078 struct drm_display_mode *mode)
2079{
2080 int i;
2081
2082 for (i = 0; i < tabs; i++)
2083 seq_putc(m, '\t');
2084
2085 seq_printf(m, "id %d:\"%s\" freq %d clock %d hdisp %d hss %d hse %d htot %d vdisp %d vss %d vse %d vtot %d type 0x%x flags 0x%x\n",
2086 mode->base.id, mode->name,
2087 mode->vrefresh, mode->clock,
2088 mode->hdisplay, mode->hsync_start,
2089 mode->hsync_end, mode->htotal,
2090 mode->vdisplay, mode->vsync_start,
2091 mode->vsync_end, mode->vtotal,
2092 mode->type, mode->flags);
2093}
2094
2095static void intel_encoder_info(struct seq_file *m,
2096 struct intel_crtc *intel_crtc,
2097 struct intel_encoder *intel_encoder)
2098{
2099 struct drm_info_node *node = (struct drm_info_node *) m->private;
2100 struct drm_device *dev = node->minor->dev;
2101 struct drm_crtc *crtc = &intel_crtc->base;
2102 struct intel_connector *intel_connector;
2103 struct drm_encoder *encoder;
2104
2105 encoder = &intel_encoder->base;
2106 seq_printf(m, "\tencoder %d: type: %s, connectors:\n",
2107 encoder->base.id, drm_get_encoder_name(encoder));
2108 for_each_connector_on_encoder(dev, encoder, intel_connector) {
2109 struct drm_connector *connector = &intel_connector->base;
2110 seq_printf(m, "\t\tconnector %d: type: %s, status: %s",
2111 connector->base.id,
2112 drm_get_connector_name(connector),
2113 drm_get_connector_status_name(connector->status));
2114 if (connector->status == connector_status_connected) {
2115 struct drm_display_mode *mode = &crtc->mode;
2116 seq_printf(m, ", mode:\n");
2117 intel_seq_print_mode(m, 2, mode);
2118 } else {
2119 seq_putc(m, '\n');
2120 }
2121 }
2122}
2123
2124static void intel_crtc_info(struct seq_file *m, struct intel_crtc *intel_crtc)
2125{
2126 struct drm_info_node *node = (struct drm_info_node *) m->private;
2127 struct drm_device *dev = node->minor->dev;
2128 struct drm_crtc *crtc = &intel_crtc->base;
2129 struct intel_encoder *intel_encoder;
2130
2131 seq_printf(m, "\tfb: %d, pos: %dx%d, size: %dx%d\n",
2132 crtc->fb->base.id, crtc->x, crtc->y,
2133 crtc->fb->width, crtc->fb->height);
2134 for_each_encoder_on_crtc(dev, crtc, intel_encoder)
2135 intel_encoder_info(m, intel_crtc, intel_encoder);
2136}
2137
2138static void intel_panel_info(struct seq_file *m, struct intel_panel *panel)
2139{
2140 struct drm_display_mode *mode = panel->fixed_mode;
2141
2142 seq_printf(m, "\tfixed mode:\n");
2143 intel_seq_print_mode(m, 2, mode);
2144}
2145
2146static void intel_dp_info(struct seq_file *m,
2147 struct intel_connector *intel_connector)
2148{
2149 struct intel_encoder *intel_encoder = intel_connector->encoder;
2150 struct intel_dp *intel_dp = enc_to_intel_dp(&intel_encoder->base);
2151
2152 seq_printf(m, "\tDPCD rev: %x\n", intel_dp->dpcd[DP_DPCD_REV]);
2153 seq_printf(m, "\taudio support: %s\n", intel_dp->has_audio ? "yes" :
2154 "no");
2155 if (intel_encoder->type == INTEL_OUTPUT_EDP)
2156 intel_panel_info(m, &intel_connector->panel);
2157}
2158
2159static void intel_hdmi_info(struct seq_file *m,
2160 struct intel_connector *intel_connector)
2161{
2162 struct intel_encoder *intel_encoder = intel_connector->encoder;
2163 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&intel_encoder->base);
2164
2165 seq_printf(m, "\taudio support: %s\n", intel_hdmi->has_audio ? "yes" :
2166 "no");
2167}
2168
2169static void intel_lvds_info(struct seq_file *m,
2170 struct intel_connector *intel_connector)
2171{
2172 intel_panel_info(m, &intel_connector->panel);
2173}
2174
2175static void intel_connector_info(struct seq_file *m,
2176 struct drm_connector *connector)
2177{
2178 struct intel_connector *intel_connector = to_intel_connector(connector);
2179 struct intel_encoder *intel_encoder = intel_connector->encoder;
2180
2181 seq_printf(m, "connector %d: type %s, status: %s\n",
2182 connector->base.id, drm_get_connector_name(connector),
2183 drm_get_connector_status_name(connector->status));
2184 if (connector->status == connector_status_connected) {
2185 seq_printf(m, "\tname: %s\n", connector->display_info.name);
2186 seq_printf(m, "\tphysical dimensions: %dx%dmm\n",
2187 connector->display_info.width_mm,
2188 connector->display_info.height_mm);
2189 seq_printf(m, "\tsubpixel order: %s\n",
2190 drm_get_subpixel_order_name(connector->display_info.subpixel_order));
2191 seq_printf(m, "\tCEA rev: %d\n",
2192 connector->display_info.cea_rev);
2193 }
2194 if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT ||
2195 intel_encoder->type == INTEL_OUTPUT_EDP)
2196 intel_dp_info(m, intel_connector);
2197 else if (intel_encoder->type == INTEL_OUTPUT_HDMI)
2198 intel_hdmi_info(m, intel_connector);
2199 else if (intel_encoder->type == INTEL_OUTPUT_LVDS)
2200 intel_lvds_info(m, intel_connector);
2201
2202}
2203
2204static int i915_display_info(struct seq_file *m, void *unused)
2205{
2206 struct drm_info_node *node = (struct drm_info_node *) m->private;
2207 struct drm_device *dev = node->minor->dev;
2208 struct drm_crtc *crtc;
2209 struct drm_connector *connector;
2210
2211 drm_modeset_lock_all(dev);
2212 seq_printf(m, "CRTC info\n");
2213 seq_printf(m, "---------\n");
2214 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
2215 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
2216
2217 seq_printf(m, "CRTC %d: pipe: %c, active: %s\n",
2218 crtc->base.id, pipe_name(intel_crtc->pipe),
2219 intel_crtc->active ? "yes" : "no");
2220 if (intel_crtc->active)
2221 intel_crtc_info(m, intel_crtc);
2222 }
2223
2224 seq_printf(m, "\n");
2225 seq_printf(m, "Connector info\n");
2226 seq_printf(m, "--------------\n");
2227 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
2228 intel_connector_info(m, connector);
2229 }
2230 drm_modeset_unlock_all(dev);
2231
2232 return 0;
2233}
2234
2077struct pipe_crc_info { 2235struct pipe_crc_info {
2078 const char *name; 2236 const char *name;
2079 struct drm_device *dev; 2237 struct drm_device *dev;
@@ -3519,6 +3677,7 @@ static const struct drm_info_list i915_debugfs_list[] = {
3519 {"i915_energy_uJ", i915_energy_uJ, 0}, 3677 {"i915_energy_uJ", i915_energy_uJ, 0},
3520 {"i915_pc8_status", i915_pc8_status, 0}, 3678 {"i915_pc8_status", i915_pc8_status, 0},
3521 {"i915_power_domain_info", i915_power_domain_info, 0}, 3679 {"i915_power_domain_info", i915_power_domain_info, 0},
3680 {"i915_display_info", i915_display_info, 0},
3522}; 3681};
3523#define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list) 3682#define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
3524 3683
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 96601149cab8..49889003feb2 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -164,6 +164,10 @@ enum hpd_pin {
164 list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \ 164 list_for_each_entry((intel_encoder), &(dev)->mode_config.encoder_list, base.head) \
165 if ((intel_encoder)->base.crtc == (__crtc)) 165 if ((intel_encoder)->base.crtc == (__crtc))
166 166
167#define for_each_connector_on_encoder(dev, __encoder, intel_connector) \
168 list_for_each_entry((intel_connector), &(dev)->mode_config.connector_list, base.head) \
169 if ((intel_connector)->base.encoder == (__encoder))
170
167struct drm_i915_private; 171struct drm_i915_private;
168 172
169enum intel_dpll_id { 173enum intel_dpll_id {