diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-03-12 05:13:13 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-03-12 11:16:37 -0400 |
commit | 065f2ec2afc850960dcebc3b00766bc31c4ffd3b (patch) | |
tree | 91f658435bdad397d9d3cbfa1c62af71fe1c6248 /drivers/gpu/drm/i915 | |
parent | 8ac36ec1e370cb8ff9c082972ad0570bba37381a (diff) |
drm/i915: Show cursor status in debugfs/i915_display_info
I have the occasional absent cursor on i845 and I want to know why.
This should help by revealing the last known cursor state.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index a90d31c78643..30fc893dd443 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -2248,24 +2248,67 @@ static void intel_connector_info(struct seq_file *m, | |||
2248 | intel_seq_print_mode(m, 2, mode); | 2248 | intel_seq_print_mode(m, 2, mode); |
2249 | } | 2249 | } |
2250 | 2250 | ||
2251 | static bool cursor_active(struct drm_device *dev, int pipe) | ||
2252 | { | ||
2253 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
2254 | u32 state; | ||
2255 | |||
2256 | if (IS_845G(dev) || IS_I865G(dev)) | ||
2257 | state = I915_READ(_CURACNTR) & CURSOR_ENABLE; | ||
2258 | else if (INTEL_INFO(dev)->gen <= 6 || IS_VALLEYVIEW(dev)) | ||
2259 | state = I915_READ(CURCNTR(pipe)) & CURSOR_MODE; | ||
2260 | else | ||
2261 | state = I915_READ(CURCNTR_IVB(pipe)) & CURSOR_MODE; | ||
2262 | |||
2263 | return state; | ||
2264 | } | ||
2265 | |||
2266 | static bool cursor_position(struct drm_device *dev, int pipe, int *x, int *y) | ||
2267 | { | ||
2268 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
2269 | u32 pos; | ||
2270 | |||
2271 | if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev) || IS_BROADWELL(dev)) | ||
2272 | pos = I915_READ(CURPOS_IVB(pipe)); | ||
2273 | else | ||
2274 | pos = I915_READ(CURPOS(pipe)); | ||
2275 | |||
2276 | *x = (pos >> CURSOR_X_SHIFT) & CURSOR_POS_MASK; | ||
2277 | if (pos & (CURSOR_POS_SIGN << CURSOR_X_SHIFT)) | ||
2278 | *x = -*x; | ||
2279 | |||
2280 | *y = (pos >> CURSOR_Y_SHIFT) & CURSOR_POS_MASK; | ||
2281 | if (pos & (CURSOR_POS_SIGN << CURSOR_Y_SHIFT)) | ||
2282 | *y = -*y; | ||
2283 | |||
2284 | return cursor_active(dev, pipe); | ||
2285 | } | ||
2286 | |||
2251 | static int i915_display_info(struct seq_file *m, void *unused) | 2287 | static int i915_display_info(struct seq_file *m, void *unused) |
2252 | { | 2288 | { |
2253 | struct drm_info_node *node = (struct drm_info_node *) m->private; | 2289 | struct drm_info_node *node = (struct drm_info_node *) m->private; |
2254 | struct drm_device *dev = node->minor->dev; | 2290 | struct drm_device *dev = node->minor->dev; |
2255 | struct drm_crtc *crtc; | 2291 | struct intel_crtc *crtc; |
2256 | struct drm_connector *connector; | 2292 | struct drm_connector *connector; |
2257 | 2293 | ||
2258 | drm_modeset_lock_all(dev); | 2294 | drm_modeset_lock_all(dev); |
2259 | seq_printf(m, "CRTC info\n"); | 2295 | seq_printf(m, "CRTC info\n"); |
2260 | seq_printf(m, "---------\n"); | 2296 | seq_printf(m, "---------\n"); |
2261 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | 2297 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) { |
2262 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 2298 | bool active; |
2299 | int x, y; | ||
2263 | 2300 | ||
2264 | seq_printf(m, "CRTC %d: pipe: %c, active: %s\n", | 2301 | seq_printf(m, "CRTC %d: pipe: %c, active: %s\n", |
2265 | crtc->base.id, pipe_name(intel_crtc->pipe), | 2302 | crtc->base.base.id, pipe_name(crtc->pipe), |
2266 | intel_crtc->active ? "yes" : "no"); | 2303 | yesno(crtc->active)); |
2267 | if (intel_crtc->active) | 2304 | if (crtc->active) |
2268 | intel_crtc_info(m, intel_crtc); | 2305 | intel_crtc_info(m, crtc); |
2306 | |||
2307 | active = cursor_position(dev, crtc->pipe, &x, &y); | ||
2308 | seq_printf(m, "\tcursor visible? %s, position (%d, %d), addr 0x%08x, active? %s\n", | ||
2309 | yesno(crtc->cursor_visible), | ||
2310 | x, y, crtc->cursor_addr, | ||
2311 | yesno(active)); | ||
2269 | } | 2312 | } |
2270 | 2313 | ||
2271 | seq_printf(m, "\n"); | 2314 | seq_printf(m, "\n"); |