blob: 52d2306249cb900d5acb579234607d7c0a4ab6eb [file] [log] [blame]
Ben Gamari20172632009-02-17 20:08:50 -05001/*
2 * Copyright © 2008 Intel Corporation
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 *
23 * Authors:
24 * Eric Anholt <eric@anholt.net>
25 * Keith Packard <keithp@keithp.com>
26 *
27 */
28
29#include <linux/seq_file.h>
Chris Wilsonf3cd4742009-10-13 22:20:20 +010030#include <linux/debugfs.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090031#include <linux/slab.h>
Ben Gamari20172632009-02-17 20:08:50 -050032#include "drmP.h"
33#include "drm.h"
Simon Farnsworth4e5359c2010-09-01 17:47:52 +010034#include "intel_drv.h"
Chris Wilsone5c65262010-11-01 11:35:28 +000035#include "intel_ringbuffer.h"
Ben Gamari20172632009-02-17 20:08:50 -050036#include "i915_drm.h"
37#include "i915_drv.h"
38
39#define DRM_I915_RING_DEBUG 1
40
41
42#if defined(CONFIG_DEBUG_FS)
43
Chris Wilsonf13d3f72010-09-20 17:36:15 +010044enum {
Chris Wilson69dc4982010-10-19 10:36:51 +010045 ACTIVE_LIST,
Chris Wilsonf13d3f72010-09-20 17:36:15 +010046 FLUSHING_LIST,
47 INACTIVE_LIST,
Chris Wilsond21d5972010-09-26 11:19:33 +010048 PINNED_LIST,
49 DEFERRED_FREE_LIST,
Chris Wilsonf13d3f72010-09-20 17:36:15 +010050};
Ben Gamari433e12f2009-02-17 20:08:51 -050051
Chris Wilson70d39fe2010-08-25 16:03:34 +010052static const char *yesno(int v)
53{
54 return v ? "yes" : "no";
55}
56
57static int i915_capabilities(struct seq_file *m, void *data)
58{
59 struct drm_info_node *node = (struct drm_info_node *) m->private;
60 struct drm_device *dev = node->minor->dev;
61 const struct intel_device_info *info = INTEL_INFO(dev);
62
63 seq_printf(m, "gen: %d\n", info->gen);
64#define B(x) seq_printf(m, #x ": %s\n", yesno(info->x))
65 B(is_mobile);
Chris Wilson70d39fe2010-08-25 16:03:34 +010066 B(is_i85x);
67 B(is_i915g);
Chris Wilson70d39fe2010-08-25 16:03:34 +010068 B(is_i945gm);
Chris Wilson70d39fe2010-08-25 16:03:34 +010069 B(is_g33);
70 B(need_gfx_hws);
71 B(is_g4x);
72 B(is_pineview);
73 B(is_broadwater);
74 B(is_crestline);
Chris Wilson70d39fe2010-08-25 16:03:34 +010075 B(has_fbc);
Chris Wilson70d39fe2010-08-25 16:03:34 +010076 B(has_pipe_cxsr);
77 B(has_hotplug);
78 B(cursor_needs_physical);
79 B(has_overlay);
80 B(overlay_needs_physical);
Chris Wilsona6c45cf2010-09-17 00:32:17 +010081 B(supports_tv);
Chris Wilson549f7362010-10-19 11:19:32 +010082 B(has_bsd_ring);
83 B(has_blt_ring);
Chris Wilson70d39fe2010-08-25 16:03:34 +010084#undef B
85
86 return 0;
87}
Ben Gamari433e12f2009-02-17 20:08:51 -050088
Chris Wilson05394f32010-11-08 19:18:58 +000089static const char *get_pin_flag(struct drm_i915_gem_object *obj)
Chris Wilsona6172a82009-02-11 14:26:38 +000090{
Chris Wilson05394f32010-11-08 19:18:58 +000091 if (obj->user_pin_count > 0)
Chris Wilsona6172a82009-02-11 14:26:38 +000092 return "P";
Chris Wilson05394f32010-11-08 19:18:58 +000093 else if (obj->pin_count > 0)
Chris Wilsona6172a82009-02-11 14:26:38 +000094 return "p";
95 else
96 return " ";
97}
98
Chris Wilson05394f32010-11-08 19:18:58 +000099static const char *get_tiling_flag(struct drm_i915_gem_object *obj)
Chris Wilsona6172a82009-02-11 14:26:38 +0000100{
Chris Wilson05394f32010-11-08 19:18:58 +0000101 switch (obj->tiling_mode) {
Chris Wilsona6172a82009-02-11 14:26:38 +0000102 default:
103 case I915_TILING_NONE: return " ";
104 case I915_TILING_X: return "X";
105 case I915_TILING_Y: return "Y";
106 }
107}
108
Chris Wilson93dfb402011-03-29 16:59:50 -0700109static const char *cache_level_str(int type)
Chris Wilson08c18322011-01-10 00:00:24 +0000110{
111 switch (type) {
Chris Wilson93dfb402011-03-29 16:59:50 -0700112 case I915_CACHE_NONE: return " uncached";
113 case I915_CACHE_LLC: return " snooped (LLC)";
114 case I915_CACHE_LLC_MLC: return " snooped (LLC+MLC)";
Chris Wilson08c18322011-01-10 00:00:24 +0000115 default: return "";
116 }
117}
118
Chris Wilson37811fc2010-08-25 22:45:57 +0100119static void
120describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
121{
Chris Wilson08c18322011-01-10 00:00:24 +0000122 seq_printf(m, "%p: %s%s %8zd %04x %04x %d %d%s%s%s",
Chris Wilson37811fc2010-08-25 22:45:57 +0100123 &obj->base,
124 get_pin_flag(obj),
125 get_tiling_flag(obj),
126 obj->base.size,
127 obj->base.read_domains,
128 obj->base.write_domain,
129 obj->last_rendering_seqno,
Chris Wilsoncaea7472010-11-12 13:53:37 +0000130 obj->last_fenced_seqno,
Chris Wilson93dfb402011-03-29 16:59:50 -0700131 cache_level_str(obj->cache_level),
Chris Wilson37811fc2010-08-25 22:45:57 +0100132 obj->dirty ? " dirty" : "",
133 obj->madv == I915_MADV_DONTNEED ? " purgeable" : "");
134 if (obj->base.name)
135 seq_printf(m, " (name: %d)", obj->base.name);
136 if (obj->fence_reg != I915_FENCE_REG_NONE)
137 seq_printf(m, " (fence: %d)", obj->fence_reg);
138 if (obj->gtt_space != NULL)
Chris Wilsona00b10c2010-09-24 21:15:47 +0100139 seq_printf(m, " (gtt offset: %08x, size: %08x)",
140 obj->gtt_offset, (unsigned int)obj->gtt_space->size);
Chris Wilson6299f992010-11-24 12:23:44 +0000141 if (obj->pin_mappable || obj->fault_mappable) {
142 char s[3], *t = s;
143 if (obj->pin_mappable)
144 *t++ = 'p';
145 if (obj->fault_mappable)
146 *t++ = 'f';
147 *t = '\0';
148 seq_printf(m, " (%s mappable)", s);
149 }
Chris Wilson69dc4982010-10-19 10:36:51 +0100150 if (obj->ring != NULL)
151 seq_printf(m, " (%s)", obj->ring->name);
Chris Wilson37811fc2010-08-25 22:45:57 +0100152}
153
Ben Gamari433e12f2009-02-17 20:08:51 -0500154static int i915_gem_object_list_info(struct seq_file *m, void *data)
Ben Gamari20172632009-02-17 20:08:50 -0500155{
156 struct drm_info_node *node = (struct drm_info_node *) m->private;
Ben Gamari433e12f2009-02-17 20:08:51 -0500157 uintptr_t list = (uintptr_t) node->info_ent->data;
158 struct list_head *head;
Ben Gamari20172632009-02-17 20:08:50 -0500159 struct drm_device *dev = node->minor->dev;
160 drm_i915_private_t *dev_priv = dev->dev_private;
Chris Wilson05394f32010-11-08 19:18:58 +0000161 struct drm_i915_gem_object *obj;
Chris Wilson8f2480f2010-09-26 11:44:19 +0100162 size_t total_obj_size, total_gtt_size;
163 int count, ret;
Chris Wilsonde227ef2010-07-03 07:58:38 +0100164
165 ret = mutex_lock_interruptible(&dev->struct_mutex);
166 if (ret)
167 return ret;
Ben Gamari20172632009-02-17 20:08:50 -0500168
Ben Gamari433e12f2009-02-17 20:08:51 -0500169 switch (list) {
170 case ACTIVE_LIST:
171 seq_printf(m, "Active:\n");
Chris Wilson69dc4982010-10-19 10:36:51 +0100172 head = &dev_priv->mm.active_list;
Ben Gamari433e12f2009-02-17 20:08:51 -0500173 break;
174 case INACTIVE_LIST:
Ben Gamaria17458f2009-07-01 15:01:36 -0400175 seq_printf(m, "Inactive:\n");
Ben Gamari433e12f2009-02-17 20:08:51 -0500176 head = &dev_priv->mm.inactive_list;
177 break;
Chris Wilsonf13d3f72010-09-20 17:36:15 +0100178 case PINNED_LIST:
179 seq_printf(m, "Pinned:\n");
180 head = &dev_priv->mm.pinned_list;
181 break;
Ben Gamari433e12f2009-02-17 20:08:51 -0500182 case FLUSHING_LIST:
183 seq_printf(m, "Flushing:\n");
184 head = &dev_priv->mm.flushing_list;
185 break;
Chris Wilsond21d5972010-09-26 11:19:33 +0100186 case DEFERRED_FREE_LIST:
187 seq_printf(m, "Deferred free:\n");
188 head = &dev_priv->mm.deferred_free_list;
189 break;
Ben Gamari433e12f2009-02-17 20:08:51 -0500190 default:
Chris Wilsonde227ef2010-07-03 07:58:38 +0100191 mutex_unlock(&dev->struct_mutex);
192 return -EINVAL;
Ben Gamari433e12f2009-02-17 20:08:51 -0500193 }
194
Chris Wilson8f2480f2010-09-26 11:44:19 +0100195 total_obj_size = total_gtt_size = count = 0;
Chris Wilson05394f32010-11-08 19:18:58 +0000196 list_for_each_entry(obj, head, mm_list) {
Chris Wilson37811fc2010-08-25 22:45:57 +0100197 seq_printf(m, " ");
Chris Wilson05394f32010-11-08 19:18:58 +0000198 describe_obj(m, obj);
Eric Anholtf4ceda82009-02-17 23:53:41 -0800199 seq_printf(m, "\n");
Chris Wilson05394f32010-11-08 19:18:58 +0000200 total_obj_size += obj->base.size;
201 total_gtt_size += obj->gtt_space->size;
Chris Wilson8f2480f2010-09-26 11:44:19 +0100202 count++;
Ben Gamari20172632009-02-17 20:08:50 -0500203 }
Chris Wilsonde227ef2010-07-03 07:58:38 +0100204 mutex_unlock(&dev->struct_mutex);
Carl Worth5e118f42009-03-20 11:54:25 -0700205
Chris Wilson8f2480f2010-09-26 11:44:19 +0100206 seq_printf(m, "Total %d objects, %zu bytes, %zu GTT size\n",
207 count, total_obj_size, total_gtt_size);
Ben Gamari20172632009-02-17 20:08:50 -0500208 return 0;
209}
210
Chris Wilson6299f992010-11-24 12:23:44 +0000211#define count_objects(list, member) do { \
212 list_for_each_entry(obj, list, member) { \
213 size += obj->gtt_space->size; \
214 ++count; \
215 if (obj->map_and_fenceable) { \
216 mappable_size += obj->gtt_space->size; \
217 ++mappable_count; \
218 } \
219 } \
220} while(0)
221
Chris Wilson73aa8082010-09-30 11:46:12 +0100222static int i915_gem_object_info(struct seq_file *m, void* data)
223{
224 struct drm_info_node *node = (struct drm_info_node *) m->private;
225 struct drm_device *dev = node->minor->dev;
226 struct drm_i915_private *dev_priv = dev->dev_private;
Chris Wilson6299f992010-11-24 12:23:44 +0000227 u32 count, mappable_count;
228 size_t size, mappable_size;
229 struct drm_i915_gem_object *obj;
Chris Wilson73aa8082010-09-30 11:46:12 +0100230 int ret;
231
232 ret = mutex_lock_interruptible(&dev->struct_mutex);
233 if (ret)
234 return ret;
235
Chris Wilson6299f992010-11-24 12:23:44 +0000236 seq_printf(m, "%u objects, %zu bytes\n",
237 dev_priv->mm.object_count,
238 dev_priv->mm.object_memory);
239
240 size = count = mappable_size = mappable_count = 0;
241 count_objects(&dev_priv->mm.gtt_list, gtt_list);
242 seq_printf(m, "%u [%u] objects, %zu [%zu] bytes in gtt\n",
243 count, mappable_count, size, mappable_size);
244
245 size = count = mappable_size = mappable_count = 0;
246 count_objects(&dev_priv->mm.active_list, mm_list);
247 count_objects(&dev_priv->mm.flushing_list, mm_list);
248 seq_printf(m, " %u [%u] active objects, %zu [%zu] bytes\n",
249 count, mappable_count, size, mappable_size);
250
251 size = count = mappable_size = mappable_count = 0;
252 count_objects(&dev_priv->mm.pinned_list, mm_list);
253 seq_printf(m, " %u [%u] pinned objects, %zu [%zu] bytes\n",
254 count, mappable_count, size, mappable_size);
255
256 size = count = mappable_size = mappable_count = 0;
257 count_objects(&dev_priv->mm.inactive_list, mm_list);
258 seq_printf(m, " %u [%u] inactive objects, %zu [%zu] bytes\n",
259 count, mappable_count, size, mappable_size);
260
261 size = count = mappable_size = mappable_count = 0;
262 count_objects(&dev_priv->mm.deferred_free_list, mm_list);
263 seq_printf(m, " %u [%u] freed objects, %zu [%zu] bytes\n",
264 count, mappable_count, size, mappable_size);
265
266 size = count = mappable_size = mappable_count = 0;
267 list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) {
268 if (obj->fault_mappable) {
269 size += obj->gtt_space->size;
270 ++count;
271 }
272 if (obj->pin_mappable) {
273 mappable_size += obj->gtt_space->size;
274 ++mappable_count;
275 }
276 }
277 seq_printf(m, "%u pinned mappable objects, %zu bytes\n",
278 mappable_count, mappable_size);
279 seq_printf(m, "%u fault mappable objects, %zu bytes\n",
280 count, size);
281
282 seq_printf(m, "%zu [%zu] gtt total\n",
283 dev_priv->mm.gtt_total, dev_priv->mm.mappable_gtt_total);
Chris Wilson73aa8082010-09-30 11:46:12 +0100284
285 mutex_unlock(&dev->struct_mutex);
286
287 return 0;
288}
289
Chris Wilson08c18322011-01-10 00:00:24 +0000290static int i915_gem_gtt_info(struct seq_file *m, void* data)
291{
292 struct drm_info_node *node = (struct drm_info_node *) m->private;
293 struct drm_device *dev = node->minor->dev;
294 struct drm_i915_private *dev_priv = dev->dev_private;
295 struct drm_i915_gem_object *obj;
296 size_t total_obj_size, total_gtt_size;
297 int count, ret;
298
299 ret = mutex_lock_interruptible(&dev->struct_mutex);
300 if (ret)
301 return ret;
302
303 total_obj_size = total_gtt_size = count = 0;
304 list_for_each_entry(obj, &dev_priv->mm.gtt_list, gtt_list) {
305 seq_printf(m, " ");
306 describe_obj(m, obj);
307 seq_printf(m, "\n");
308 total_obj_size += obj->base.size;
309 total_gtt_size += obj->gtt_space->size;
310 count++;
311 }
312
313 mutex_unlock(&dev->struct_mutex);
314
315 seq_printf(m, "Total %d objects, %zu bytes, %zu GTT size\n",
316 count, total_obj_size, total_gtt_size);
317
318 return 0;
319}
320
Chris Wilson73aa8082010-09-30 11:46:12 +0100321
Simon Farnsworth4e5359c2010-09-01 17:47:52 +0100322static int i915_gem_pageflip_info(struct seq_file *m, void *data)
323{
324 struct drm_info_node *node = (struct drm_info_node *) m->private;
325 struct drm_device *dev = node->minor->dev;
326 unsigned long flags;
327 struct intel_crtc *crtc;
328
329 list_for_each_entry(crtc, &dev->mode_config.crtc_list, base.head) {
Jesse Barnes9db4a9c2011-02-07 12:26:52 -0800330 const char pipe = pipe_name(crtc->pipe);
331 const char plane = plane_name(crtc->plane);
Simon Farnsworth4e5359c2010-09-01 17:47:52 +0100332 struct intel_unpin_work *work;
333
334 spin_lock_irqsave(&dev->event_lock, flags);
335 work = crtc->unpin_work;
336 if (work == NULL) {
Jesse Barnes9db4a9c2011-02-07 12:26:52 -0800337 seq_printf(m, "No flip due on pipe %c (plane %c)\n",
Simon Farnsworth4e5359c2010-09-01 17:47:52 +0100338 pipe, plane);
339 } else {
340 if (!work->pending) {
Jesse Barnes9db4a9c2011-02-07 12:26:52 -0800341 seq_printf(m, "Flip queued on pipe %c (plane %c)\n",
Simon Farnsworth4e5359c2010-09-01 17:47:52 +0100342 pipe, plane);
343 } else {
Jesse Barnes9db4a9c2011-02-07 12:26:52 -0800344 seq_printf(m, "Flip pending (waiting for vsync) on pipe %c (plane %c)\n",
Simon Farnsworth4e5359c2010-09-01 17:47:52 +0100345 pipe, plane);
346 }
347 if (work->enable_stall_check)
348 seq_printf(m, "Stall check enabled, ");
349 else
350 seq_printf(m, "Stall check waiting for page flip ioctl, ");
351 seq_printf(m, "%d prepares\n", work->pending);
352
353 if (work->old_fb_obj) {
Chris Wilson05394f32010-11-08 19:18:58 +0000354 struct drm_i915_gem_object *obj = work->old_fb_obj;
355 if (obj)
356 seq_printf(m, "Old framebuffer gtt_offset 0x%08x\n", obj->gtt_offset);
Simon Farnsworth4e5359c2010-09-01 17:47:52 +0100357 }
358 if (work->pending_flip_obj) {
Chris Wilson05394f32010-11-08 19:18:58 +0000359 struct drm_i915_gem_object *obj = work->pending_flip_obj;
360 if (obj)
361 seq_printf(m, "New framebuffer gtt_offset 0x%08x\n", obj->gtt_offset);
Simon Farnsworth4e5359c2010-09-01 17:47:52 +0100362 }
363 }
364 spin_unlock_irqrestore(&dev->event_lock, flags);
365 }
366
367 return 0;
368}
369
Ben Gamari20172632009-02-17 20:08:50 -0500370static int i915_gem_request_info(struct seq_file *m, void *data)
371{
372 struct drm_info_node *node = (struct drm_info_node *) m->private;
373 struct drm_device *dev = node->minor->dev;
374 drm_i915_private_t *dev_priv = dev->dev_private;
375 struct drm_i915_gem_request *gem_request;
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100376 int ret, count;
Chris Wilsonde227ef2010-07-03 07:58:38 +0100377
378 ret = mutex_lock_interruptible(&dev->struct_mutex);
379 if (ret)
380 return ret;
Ben Gamari20172632009-02-17 20:08:50 -0500381
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100382 count = 0;
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000383 if (!list_empty(&dev_priv->ring[RCS].request_list)) {
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100384 seq_printf(m, "Render requests:\n");
385 list_for_each_entry(gem_request,
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000386 &dev_priv->ring[RCS].request_list,
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100387 list) {
388 seq_printf(m, " %d @ %d\n",
389 gem_request->seqno,
390 (int) (jiffies - gem_request->emitted_jiffies));
391 }
392 count++;
393 }
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000394 if (!list_empty(&dev_priv->ring[VCS].request_list)) {
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100395 seq_printf(m, "BSD requests:\n");
396 list_for_each_entry(gem_request,
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000397 &dev_priv->ring[VCS].request_list,
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100398 list) {
399 seq_printf(m, " %d @ %d\n",
400 gem_request->seqno,
401 (int) (jiffies - gem_request->emitted_jiffies));
402 }
403 count++;
404 }
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000405 if (!list_empty(&dev_priv->ring[BCS].request_list)) {
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100406 seq_printf(m, "BLT requests:\n");
407 list_for_each_entry(gem_request,
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000408 &dev_priv->ring[BCS].request_list,
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100409 list) {
410 seq_printf(m, " %d @ %d\n",
411 gem_request->seqno,
412 (int) (jiffies - gem_request->emitted_jiffies));
413 }
414 count++;
Ben Gamari20172632009-02-17 20:08:50 -0500415 }
Chris Wilsonde227ef2010-07-03 07:58:38 +0100416 mutex_unlock(&dev->struct_mutex);
417
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100418 if (count == 0)
419 seq_printf(m, "No requests\n");
420
Ben Gamari20172632009-02-17 20:08:50 -0500421 return 0;
422}
423
Chris Wilsonb2223492010-10-27 15:27:33 +0100424static void i915_ring_seqno_info(struct seq_file *m,
425 struct intel_ring_buffer *ring)
426{
427 if (ring->get_seqno) {
428 seq_printf(m, "Current sequence (%s): %d\n",
429 ring->name, ring->get_seqno(ring));
430 seq_printf(m, "Waiter sequence (%s): %d\n",
431 ring->name, ring->waiting_seqno);
432 seq_printf(m, "IRQ sequence (%s): %d\n",
433 ring->name, ring->irq_seqno);
434 }
435}
436
Ben Gamari20172632009-02-17 20:08:50 -0500437static int i915_gem_seqno_info(struct seq_file *m, void *data)
438{
439 struct drm_info_node *node = (struct drm_info_node *) m->private;
440 struct drm_device *dev = node->minor->dev;
441 drm_i915_private_t *dev_priv = dev->dev_private;
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000442 int ret, i;
Chris Wilsonde227ef2010-07-03 07:58:38 +0100443
444 ret = mutex_lock_interruptible(&dev->struct_mutex);
445 if (ret)
446 return ret;
Ben Gamari20172632009-02-17 20:08:50 -0500447
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000448 for (i = 0; i < I915_NUM_RINGS; i++)
449 i915_ring_seqno_info(m, &dev_priv->ring[i]);
Chris Wilsonde227ef2010-07-03 07:58:38 +0100450
451 mutex_unlock(&dev->struct_mutex);
452
Ben Gamari20172632009-02-17 20:08:50 -0500453 return 0;
454}
455
456
457static int i915_interrupt_info(struct seq_file *m, void *data)
458{
459 struct drm_info_node *node = (struct drm_info_node *) m->private;
460 struct drm_device *dev = node->minor->dev;
461 drm_i915_private_t *dev_priv = dev->dev_private;
Jesse Barnes9db4a9c2011-02-07 12:26:52 -0800462 int ret, i, pipe;
Chris Wilsonde227ef2010-07-03 07:58:38 +0100463
464 ret = mutex_lock_interruptible(&dev->struct_mutex);
465 if (ret)
466 return ret;
Ben Gamari20172632009-02-17 20:08:50 -0500467
Eric Anholtbad720f2009-10-22 16:11:14 -0700468 if (!HAS_PCH_SPLIT(dev)) {
Zhenyu Wang5f6a1692009-08-10 21:37:24 +0800469 seq_printf(m, "Interrupt enable: %08x\n",
470 I915_READ(IER));
471 seq_printf(m, "Interrupt identity: %08x\n",
472 I915_READ(IIR));
473 seq_printf(m, "Interrupt mask: %08x\n",
474 I915_READ(IMR));
Jesse Barnes9db4a9c2011-02-07 12:26:52 -0800475 for_each_pipe(pipe)
476 seq_printf(m, "Pipe %c stat: %08x\n",
477 pipe_name(pipe),
478 I915_READ(PIPESTAT(pipe)));
Zhenyu Wang5f6a1692009-08-10 21:37:24 +0800479 } else {
480 seq_printf(m, "North Display Interrupt enable: %08x\n",
481 I915_READ(DEIER));
482 seq_printf(m, "North Display Interrupt identity: %08x\n",
483 I915_READ(DEIIR));
484 seq_printf(m, "North Display Interrupt mask: %08x\n",
485 I915_READ(DEIMR));
486 seq_printf(m, "South Display Interrupt enable: %08x\n",
487 I915_READ(SDEIER));
488 seq_printf(m, "South Display Interrupt identity: %08x\n",
489 I915_READ(SDEIIR));
490 seq_printf(m, "South Display Interrupt mask: %08x\n",
491 I915_READ(SDEIMR));
492 seq_printf(m, "Graphics Interrupt enable: %08x\n",
493 I915_READ(GTIER));
494 seq_printf(m, "Graphics Interrupt identity: %08x\n",
495 I915_READ(GTIIR));
496 seq_printf(m, "Graphics Interrupt mask: %08x\n",
497 I915_READ(GTIMR));
498 }
Ben Gamari20172632009-02-17 20:08:50 -0500499 seq_printf(m, "Interrupts received: %d\n",
500 atomic_read(&dev_priv->irq_received));
Chris Wilson9862e602011-01-04 22:22:17 +0000501 for (i = 0; i < I915_NUM_RINGS; i++) {
502 if (IS_GEN6(dev)) {
503 seq_printf(m, "Graphics Interrupt mask (%s): %08x\n",
504 dev_priv->ring[i].name,
505 I915_READ_IMR(&dev_priv->ring[i]));
506 }
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000507 i915_ring_seqno_info(m, &dev_priv->ring[i]);
Chris Wilson9862e602011-01-04 22:22:17 +0000508 }
Chris Wilsonde227ef2010-07-03 07:58:38 +0100509 mutex_unlock(&dev->struct_mutex);
510
Ben Gamari20172632009-02-17 20:08:50 -0500511 return 0;
512}
513
Chris Wilsona6172a82009-02-11 14:26:38 +0000514static int i915_gem_fence_regs_info(struct seq_file *m, void *data)
515{
516 struct drm_info_node *node = (struct drm_info_node *) m->private;
517 struct drm_device *dev = node->minor->dev;
518 drm_i915_private_t *dev_priv = dev->dev_private;
Chris Wilsonde227ef2010-07-03 07:58:38 +0100519 int i, ret;
520
521 ret = mutex_lock_interruptible(&dev->struct_mutex);
522 if (ret)
523 return ret;
Chris Wilsona6172a82009-02-11 14:26:38 +0000524
525 seq_printf(m, "Reserved fences = %d\n", dev_priv->fence_reg_start);
526 seq_printf(m, "Total fences = %d\n", dev_priv->num_fence_regs);
527 for (i = 0; i < dev_priv->num_fence_regs; i++) {
Chris Wilson05394f32010-11-08 19:18:58 +0000528 struct drm_i915_gem_object *obj = dev_priv->fence_regs[i].obj;
Chris Wilsona6172a82009-02-11 14:26:38 +0000529
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100530 seq_printf(m, "Fenced object[%2d] = ", i);
531 if (obj == NULL)
532 seq_printf(m, "unused");
533 else
Chris Wilson05394f32010-11-08 19:18:58 +0000534 describe_obj(m, obj);
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100535 seq_printf(m, "\n");
Chris Wilsona6172a82009-02-11 14:26:38 +0000536 }
537
Chris Wilson05394f32010-11-08 19:18:58 +0000538 mutex_unlock(&dev->struct_mutex);
Chris Wilsona6172a82009-02-11 14:26:38 +0000539 return 0;
540}
541
Ben Gamari20172632009-02-17 20:08:50 -0500542static int i915_hws_info(struct seq_file *m, void *data)
543{
544 struct drm_info_node *node = (struct drm_info_node *) m->private;
545 struct drm_device *dev = node->minor->dev;
546 drm_i915_private_t *dev_priv = dev->dev_private;
Chris Wilson4066c0a2010-10-29 21:00:54 +0100547 struct intel_ring_buffer *ring;
Chris Wilson311bd682011-01-13 19:06:50 +0000548 const volatile u32 __iomem *hws;
Chris Wilson4066c0a2010-10-29 21:00:54 +0100549 int i;
Ben Gamari20172632009-02-17 20:08:50 -0500550
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000551 ring = &dev_priv->ring[(uintptr_t)node->info_ent->data];
Chris Wilson311bd682011-01-13 19:06:50 +0000552 hws = (volatile u32 __iomem *)ring->status_page.page_addr;
Ben Gamari20172632009-02-17 20:08:50 -0500553 if (hws == NULL)
554 return 0;
555
556 for (i = 0; i < 4096 / sizeof(u32) / 4; i += 4) {
557 seq_printf(m, "0x%08x: 0x%08x 0x%08x 0x%08x 0x%08x\n",
558 i * 4,
559 hws[i], hws[i + 1], hws[i + 2], hws[i + 3]);
560 }
561 return 0;
562}
563
Chris Wilson5cdf5882010-09-27 15:51:07 +0100564static void i915_dump_object(struct seq_file *m,
565 struct io_mapping *mapping,
Chris Wilson05394f32010-11-08 19:18:58 +0000566 struct drm_i915_gem_object *obj)
Ben Gamari6911a9b2009-04-02 11:24:54 -0700567{
Chris Wilson5cdf5882010-09-27 15:51:07 +0100568 int page, page_count, i;
Ben Gamari6911a9b2009-04-02 11:24:54 -0700569
Chris Wilson05394f32010-11-08 19:18:58 +0000570 page_count = obj->base.size / PAGE_SIZE;
Ben Gamari6911a9b2009-04-02 11:24:54 -0700571 for (page = 0; page < page_count; page++) {
Chris Wilson5cdf5882010-09-27 15:51:07 +0100572 u32 *mem = io_mapping_map_wc(mapping,
Chris Wilson05394f32010-11-08 19:18:58 +0000573 obj->gtt_offset + page * PAGE_SIZE);
Ben Gamari6911a9b2009-04-02 11:24:54 -0700574 for (i = 0; i < PAGE_SIZE; i += 4)
575 seq_printf(m, "%08x : %08x\n", i, mem[i / 4]);
Chris Wilson5cdf5882010-09-27 15:51:07 +0100576 io_mapping_unmap(mem);
Ben Gamari6911a9b2009-04-02 11:24:54 -0700577 }
578}
579
580static int i915_batchbuffer_info(struct seq_file *m, void *data)
581{
582 struct drm_info_node *node = (struct drm_info_node *) m->private;
583 struct drm_device *dev = node->minor->dev;
584 drm_i915_private_t *dev_priv = dev->dev_private;
Chris Wilson05394f32010-11-08 19:18:58 +0000585 struct drm_i915_gem_object *obj;
Ben Gamari6911a9b2009-04-02 11:24:54 -0700586 int ret;
587
Chris Wilsonde227ef2010-07-03 07:58:38 +0100588 ret = mutex_lock_interruptible(&dev->struct_mutex);
589 if (ret)
590 return ret;
Ben Gamari6911a9b2009-04-02 11:24:54 -0700591
Chris Wilson05394f32010-11-08 19:18:58 +0000592 list_for_each_entry(obj, &dev_priv->mm.active_list, mm_list) {
593 if (obj->base.read_domains & I915_GEM_DOMAIN_COMMAND) {
594 seq_printf(m, "--- gtt_offset = 0x%08x\n", obj->gtt_offset);
595 i915_dump_object(m, dev_priv->mm.gtt_mapping, obj);
Ben Gamari6911a9b2009-04-02 11:24:54 -0700596 }
597 }
598
Chris Wilsonde227ef2010-07-03 07:58:38 +0100599 mutex_unlock(&dev->struct_mutex);
Ben Gamari6911a9b2009-04-02 11:24:54 -0700600 return 0;
601}
602
603static int i915_ringbuffer_data(struct seq_file *m, void *data)
604{
605 struct drm_info_node *node = (struct drm_info_node *) m->private;
606 struct drm_device *dev = node->minor->dev;
607 drm_i915_private_t *dev_priv = dev->dev_private;
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100608 struct intel_ring_buffer *ring;
Chris Wilsonde227ef2010-07-03 07:58:38 +0100609 int ret;
610
611 ret = mutex_lock_interruptible(&dev->struct_mutex);
612 if (ret)
613 return ret;
Ben Gamari6911a9b2009-04-02 11:24:54 -0700614
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000615 ring = &dev_priv->ring[(uintptr_t)node->info_ent->data];
Chris Wilson05394f32010-11-08 19:18:58 +0000616 if (!ring->obj) {
Ben Gamari6911a9b2009-04-02 11:24:54 -0700617 seq_printf(m, "No ringbuffer setup\n");
Chris Wilsonde227ef2010-07-03 07:58:38 +0100618 } else {
Chris Wilson311bd682011-01-13 19:06:50 +0000619 const u8 __iomem *virt = ring->virtual_start;
Chris Wilsonde227ef2010-07-03 07:58:38 +0100620 uint32_t off;
Ben Gamari6911a9b2009-04-02 11:24:54 -0700621
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100622 for (off = 0; off < ring->size; off += 4) {
Chris Wilsonde227ef2010-07-03 07:58:38 +0100623 uint32_t *ptr = (uint32_t *)(virt + off);
624 seq_printf(m, "%08x : %08x\n", off, *ptr);
625 }
Ben Gamari6911a9b2009-04-02 11:24:54 -0700626 }
Chris Wilsonde227ef2010-07-03 07:58:38 +0100627 mutex_unlock(&dev->struct_mutex);
Ben Gamari6911a9b2009-04-02 11:24:54 -0700628
629 return 0;
630}
631
632static int i915_ringbuffer_info(struct seq_file *m, void *data)
633{
634 struct drm_info_node *node = (struct drm_info_node *) m->private;
635 struct drm_device *dev = node->minor->dev;
636 drm_i915_private_t *dev_priv = dev->dev_private;
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100637 struct intel_ring_buffer *ring;
Ben Gamari6911a9b2009-04-02 11:24:54 -0700638
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000639 ring = &dev_priv->ring[(uintptr_t)node->info_ent->data];
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100640 if (ring->size == 0)
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000641 return 0;
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100642
643 seq_printf(m, "Ring %s:\n", ring->name);
644 seq_printf(m, " Head : %08x\n", I915_READ_HEAD(ring) & HEAD_ADDR);
645 seq_printf(m, " Tail : %08x\n", I915_READ_TAIL(ring) & TAIL_ADDR);
646 seq_printf(m, " Size : %08x\n", ring->size);
647 seq_printf(m, " Active : %08x\n", intel_ring_get_active_head(ring));
Chris Wilson1ec14ad2010-12-04 11:30:53 +0000648 seq_printf(m, " NOPID : %08x\n", I915_READ_NOPID(ring));
649 if (IS_GEN6(dev)) {
650 seq_printf(m, " Sync 0 : %08x\n", I915_READ_SYNC_0(ring));
651 seq_printf(m, " Sync 1 : %08x\n", I915_READ_SYNC_1(ring));
652 }
Chris Wilsonc2c347a92010-10-27 15:11:53 +0100653 seq_printf(m, " Control : %08x\n", I915_READ_CTL(ring));
654 seq_printf(m, " Start : %08x\n", I915_READ_START(ring));
Ben Gamari6911a9b2009-04-02 11:24:54 -0700655
656 return 0;
657}
658
Chris Wilsone5c65262010-11-01 11:35:28 +0000659static const char *ring_str(int ring)
660{
661 switch (ring) {
Chris Wilson36850922010-11-23 08:49:38 +0000662 case RING_RENDER: return " render";
663 case RING_BSD: return " bsd";
664 case RING_BLT: return " blt";
Chris Wilsone5c65262010-11-01 11:35:28 +0000665 default: return "";
666 }
667}
668
Chris Wilson9df30792010-02-18 10:24:56 +0000669static const char *pin_flag(int pinned)
670{
671 if (pinned > 0)
672 return " P";
673 else if (pinned < 0)
674 return " p";
675 else
676 return "";
677}
678
679static const char *tiling_flag(int tiling)
680{
681 switch (tiling) {
682 default:
683 case I915_TILING_NONE: return "";
684 case I915_TILING_X: return " X";
685 case I915_TILING_Y: return " Y";
686 }
687}
688
689static const char *dirty_flag(int dirty)
690{
691 return dirty ? " dirty" : "";
692}
693
694static const char *purgeable_flag(int purgeable)
695{
696 return purgeable ? " purgeable" : "";
697}
698
Chris Wilsonc724e8a2010-11-22 08:07:02 +0000699static void print_error_buffers(struct seq_file *m,
700 const char *name,
701 struct drm_i915_error_buffer *err,
702 int count)
703{
704 seq_printf(m, "%s [%d]:\n", name, count);
705
706 while (count--) {
Chris Wilson833bcb02011-01-12 12:14:13 +0000707 seq_printf(m, " %08x %8u %04x %04x %08x%s%s%s%s%s%s",
Chris Wilsonc724e8a2010-11-22 08:07:02 +0000708 err->gtt_offset,
709 err->size,
710 err->read_domains,
711 err->write_domain,
712 err->seqno,
713 pin_flag(err->pinned),
714 tiling_flag(err->tiling),
715 dirty_flag(err->dirty),
716 purgeable_flag(err->purgeable),
Chris Wilsona779e5a2011-01-09 21:07:49 +0000717 ring_str(err->ring),
Chris Wilson93dfb402011-03-29 16:59:50 -0700718 cache_level_str(err->cache_level));
Chris Wilsonc724e8a2010-11-22 08:07:02 +0000719
720 if (err->name)
721 seq_printf(m, " (name: %d)", err->name);
722 if (err->fence_reg != I915_FENCE_REG_NONE)
723 seq_printf(m, " (fence: %d)", err->fence_reg);
724
725 seq_printf(m, "\n");
726 err++;
727 }
728}
729
Jesse Barnes63eeaf32009-06-18 16:56:52 -0700730static int i915_error_state(struct seq_file *m, void *unused)
731{
732 struct drm_info_node *node = (struct drm_info_node *) m->private;
733 struct drm_device *dev = node->minor->dev;
734 drm_i915_private_t *dev_priv = dev->dev_private;
735 struct drm_i915_error_state *error;
736 unsigned long flags;
Chris Wilson9df30792010-02-18 10:24:56 +0000737 int i, page, offset, elt;
Jesse Barnes63eeaf32009-06-18 16:56:52 -0700738
739 spin_lock_irqsave(&dev_priv->error_lock, flags);
740 if (!dev_priv->first_error) {
741 seq_printf(m, "no error state collected\n");
742 goto out;
743 }
744
745 error = dev_priv->first_error;
746
Jesse Barnes8a905232009-07-11 16:48:03 -0400747 seq_printf(m, "Time: %ld s %ld us\n", error->time.tv_sec,
748 error->time.tv_usec);
Chris Wilson9df30792010-02-18 10:24:56 +0000749 seq_printf(m, "PCI ID: 0x%04x\n", dev->pci_device);
Chris Wilson1d8f38f2010-10-29 19:00:51 +0100750 seq_printf(m, "EIR: 0x%08x\n", error->eir);
751 seq_printf(m, "PGTBL_ER: 0x%08x\n", error->pgtbl_er);
Chris Wilsonf4068392010-10-27 20:36:41 +0100752 if (INTEL_INFO(dev)->gen >= 6) {
753 seq_printf(m, "ERROR: 0x%08x\n", error->error);
Chris Wilson1d8f38f2010-10-29 19:00:51 +0100754 seq_printf(m, "Blitter command stream:\n");
755 seq_printf(m, " ACTHD: 0x%08x\n", error->bcs_acthd);
Chris Wilson1d8f38f2010-10-29 19:00:51 +0100756 seq_printf(m, " IPEIR: 0x%08x\n", error->bcs_ipeir);
Chris Wilsone5c65262010-11-01 11:35:28 +0000757 seq_printf(m, " IPEHR: 0x%08x\n", error->bcs_ipehr);
Chris Wilson1d8f38f2010-10-29 19:00:51 +0100758 seq_printf(m, " INSTDONE: 0x%08x\n", error->bcs_instdone);
759 seq_printf(m, " seqno: 0x%08x\n", error->bcs_seqno);
Chris Wilsonadd354d2010-10-29 19:00:51 +0100760 seq_printf(m, "Video (BSD) command stream:\n");
761 seq_printf(m, " ACTHD: 0x%08x\n", error->vcs_acthd);
Chris Wilsonadd354d2010-10-29 19:00:51 +0100762 seq_printf(m, " IPEIR: 0x%08x\n", error->vcs_ipeir);
Chris Wilsone5c65262010-11-01 11:35:28 +0000763 seq_printf(m, " IPEHR: 0x%08x\n", error->vcs_ipehr);
Chris Wilsonadd354d2010-10-29 19:00:51 +0100764 seq_printf(m, " INSTDONE: 0x%08x\n", error->vcs_instdone);
765 seq_printf(m, " seqno: 0x%08x\n", error->vcs_seqno);
Chris Wilsonf4068392010-10-27 20:36:41 +0100766 }
Chris Wilson1d8f38f2010-10-29 19:00:51 +0100767 seq_printf(m, "Render command stream:\n");
768 seq_printf(m, " ACTHD: 0x%08x\n", error->acthd);
Jesse Barnes63eeaf32009-06-18 16:56:52 -0700769 seq_printf(m, " IPEIR: 0x%08x\n", error->ipeir);
770 seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr);
771 seq_printf(m, " INSTDONE: 0x%08x\n", error->instdone);
Chris Wilsona6c45cf2010-09-17 00:32:17 +0100772 if (INTEL_INFO(dev)->gen >= 4) {
Jesse Barnes63eeaf32009-06-18 16:56:52 -0700773 seq_printf(m, " INSTDONE1: 0x%08x\n", error->instdone1);
Chris Wilson1d8f38f2010-10-29 19:00:51 +0100774 seq_printf(m, " INSTPS: 0x%08x\n", error->instps);
Jesse Barnes63eeaf32009-06-18 16:56:52 -0700775 }
Chris Wilson1d8f38f2010-10-29 19:00:51 +0100776 seq_printf(m, " INSTPM: 0x%08x\n", error->instpm);
777 seq_printf(m, " seqno: 0x%08x\n", error->seqno);
Chris Wilson9df30792010-02-18 10:24:56 +0000778
Chris Wilson748ebc62010-10-24 10:28:47 +0100779 for (i = 0; i < 16; i++)
780 seq_printf(m, " fence[%d] = %08llx\n", i, error->fence[i]);
781
Chris Wilsonc724e8a2010-11-22 08:07:02 +0000782 if (error->active_bo)
783 print_error_buffers(m, "Active",
784 error->active_bo,
785 error->active_bo_count);
Chris Wilson9df30792010-02-18 10:24:56 +0000786
Chris Wilsonc724e8a2010-11-22 08:07:02 +0000787 if (error->pinned_bo)
788 print_error_buffers(m, "Pinned",
789 error->pinned_bo,
790 error->pinned_bo_count);
Chris Wilson9df30792010-02-18 10:24:56 +0000791
792 for (i = 0; i < ARRAY_SIZE(error->batchbuffer); i++) {
793 if (error->batchbuffer[i]) {
794 struct drm_i915_error_object *obj = error->batchbuffer[i];
795
Chris Wilsonbcfb2e22011-01-07 21:06:07 +0000796 seq_printf(m, "%s --- gtt_offset = 0x%08x\n",
797 dev_priv->ring[i].name,
798 obj->gtt_offset);
Chris Wilson9df30792010-02-18 10:24:56 +0000799 offset = 0;
800 for (page = 0; page < obj->page_count; page++) {
801 for (elt = 0; elt < PAGE_SIZE/4; elt++) {
802 seq_printf(m, "%08x : %08x\n", offset, obj->pages[page][elt]);
803 offset += 4;
804 }
805 }
806 }
807 }
808
Chris Wilsone2f973d2011-01-27 19:15:11 +0000809 for (i = 0; i < ARRAY_SIZE(error->ringbuffer); i++) {
810 if (error->ringbuffer[i]) {
811 struct drm_i915_error_object *obj = error->ringbuffer[i];
812 seq_printf(m, "%s --- ringbuffer = 0x%08x\n",
813 dev_priv->ring[i].name,
814 obj->gtt_offset);
815 offset = 0;
816 for (page = 0; page < obj->page_count; page++) {
817 for (elt = 0; elt < PAGE_SIZE/4; elt++) {
818 seq_printf(m, "%08x : %08x\n",
819 offset,
820 obj->pages[page][elt]);
821 offset += 4;
822 }
Chris Wilson9df30792010-02-18 10:24:56 +0000823 }
824 }
825 }
Jesse Barnes63eeaf32009-06-18 16:56:52 -0700826
Chris Wilson6ef3d422010-08-04 20:26:07 +0100827 if (error->overlay)
828 intel_overlay_print_error_state(m, error->overlay);
829
Chris Wilsonc4a1d9e2010-11-21 13:12:35 +0000830 if (error->display)
831 intel_display_print_error_state(m, dev, error->display);
832
Jesse Barnes63eeaf32009-06-18 16:56:52 -0700833out:
834 spin_unlock_irqrestore(&dev_priv->error_lock, flags);
835
836 return 0;
837}
Ben Gamari6911a9b2009-04-02 11:24:54 -0700838
Jesse Barnesf97108d2010-01-29 11:27:07 -0800839static int i915_rstdby_delays(struct seq_file *m, void *unused)
840{
841 struct drm_info_node *node = (struct drm_info_node *) m->private;
842 struct drm_device *dev = node->minor->dev;
843 drm_i915_private_t *dev_priv = dev->dev_private;
844 u16 crstanddelay = I915_READ16(CRSTANDVID);
845
846 seq_printf(m, "w/ctx: %d, w/o ctx: %d\n", (crstanddelay >> 8) & 0x3f, (crstanddelay & 0x3f));
847
848 return 0;
849}
850
851static int i915_cur_delayinfo(struct seq_file *m, void *unused)
852{
853 struct drm_info_node *node = (struct drm_info_node *) m->private;
854 struct drm_device *dev = node->minor->dev;
855 drm_i915_private_t *dev_priv = dev->dev_private;
Jesse Barnesf97108d2010-01-29 11:27:07 -0800856
Jesse Barnes3b8d8d92010-12-17 14:19:02 -0800857 if (IS_GEN5(dev)) {
858 u16 rgvswctl = I915_READ16(MEMSWCTL);
859 u16 rgvstat = I915_READ16(MEMSTAT_ILK);
860
861 seq_printf(m, "Requested P-state: %d\n", (rgvswctl >> 8) & 0xf);
862 seq_printf(m, "Requested VID: %d\n", rgvswctl & 0x3f);
863 seq_printf(m, "Current VID: %d\n", (rgvstat & MEMSTAT_VID_MASK) >>
864 MEMSTAT_VID_SHIFT);
865 seq_printf(m, "Current P-state: %d\n",
866 (rgvstat & MEMSTAT_PSTATE_MASK) >> MEMSTAT_PSTATE_SHIFT);
867 } else if (IS_GEN6(dev)) {
868 u32 gt_perf_status = I915_READ(GEN6_GT_PERF_STATUS);
869 u32 rp_state_limits = I915_READ(GEN6_RP_STATE_LIMITS);
870 u32 rp_state_cap = I915_READ(GEN6_RP_STATE_CAP);
Jesse Barnesccab5c82011-01-18 15:49:25 -0800871 u32 rpstat;
872 u32 rpupei, rpcurup, rpprevup;
873 u32 rpdownei, rpcurdown, rpprevdown;
Jesse Barnes3b8d8d92010-12-17 14:19:02 -0800874 int max_freq;
875
876 /* RPSTAT1 is in the GT power well */
Chris Wilson91355832011-03-04 19:22:40 +0000877 __gen6_gt_force_wake_get(dev_priv);
Jesse Barnes3b8d8d92010-12-17 14:19:02 -0800878
Jesse Barnesccab5c82011-01-18 15:49:25 -0800879 rpstat = I915_READ(GEN6_RPSTAT1);
880 rpupei = I915_READ(GEN6_RP_CUR_UP_EI);
881 rpcurup = I915_READ(GEN6_RP_CUR_UP);
882 rpprevup = I915_READ(GEN6_RP_PREV_UP);
883 rpdownei = I915_READ(GEN6_RP_CUR_DOWN_EI);
884 rpcurdown = I915_READ(GEN6_RP_CUR_DOWN);
885 rpprevdown = I915_READ(GEN6_RP_PREV_DOWN);
886
Jesse Barnes3b8d8d92010-12-17 14:19:02 -0800887 seq_printf(m, "GT_PERF_STATUS: 0x%08x\n", gt_perf_status);
Jesse Barnesccab5c82011-01-18 15:49:25 -0800888 seq_printf(m, "RPSTAT1: 0x%08x\n", rpstat);
Jesse Barnes3b8d8d92010-12-17 14:19:02 -0800889 seq_printf(m, "Render p-state ratio: %d\n",
890 (gt_perf_status & 0xff00) >> 8);
891 seq_printf(m, "Render p-state VID: %d\n",
892 gt_perf_status & 0xff);
893 seq_printf(m, "Render p-state limit: %d\n",
894 rp_state_limits & 0xff);
Jesse Barnesccab5c82011-01-18 15:49:25 -0800895 seq_printf(m, "CAGF: %dMHz\n", ((rpstat & GEN6_CAGF_MASK) >>
Jesse Barnese281fca2011-03-18 10:32:07 -0700896 GEN6_CAGF_SHIFT) * 50);
Jesse Barnesccab5c82011-01-18 15:49:25 -0800897 seq_printf(m, "RP CUR UP EI: %dus\n", rpupei &
898 GEN6_CURICONT_MASK);
899 seq_printf(m, "RP CUR UP: %dus\n", rpcurup &
900 GEN6_CURBSYTAVG_MASK);
901 seq_printf(m, "RP PREV UP: %dus\n", rpprevup &
902 GEN6_CURBSYTAVG_MASK);
903 seq_printf(m, "RP CUR DOWN EI: %dus\n", rpdownei &
904 GEN6_CURIAVG_MASK);
905 seq_printf(m, "RP CUR DOWN: %dus\n", rpcurdown &
906 GEN6_CURBSYTAVG_MASK);
907 seq_printf(m, "RP PREV DOWN: %dus\n", rpprevdown &
908 GEN6_CURBSYTAVG_MASK);
Jesse Barnes3b8d8d92010-12-17 14:19:02 -0800909
910 max_freq = (rp_state_cap & 0xff0000) >> 16;
911 seq_printf(m, "Lowest (RPN) frequency: %dMHz\n",
Jesse Barnese281fca2011-03-18 10:32:07 -0700912 max_freq * 50);
Jesse Barnes3b8d8d92010-12-17 14:19:02 -0800913
914 max_freq = (rp_state_cap & 0xff00) >> 8;
915 seq_printf(m, "Nominal (RP1) frequency: %dMHz\n",
Jesse Barnese281fca2011-03-18 10:32:07 -0700916 max_freq * 50);
Jesse Barnes3b8d8d92010-12-17 14:19:02 -0800917
918 max_freq = rp_state_cap & 0xff;
919 seq_printf(m, "Max non-overclocked (RP0) frequency: %dMHz\n",
Jesse Barnese281fca2011-03-18 10:32:07 -0700920 max_freq * 50);
Jesse Barnes3b8d8d92010-12-17 14:19:02 -0800921
Chris Wilson91355832011-03-04 19:22:40 +0000922 __gen6_gt_force_wake_put(dev_priv);
Jesse Barnes3b8d8d92010-12-17 14:19:02 -0800923 } else {
924 seq_printf(m, "no P-state info available\n");
925 }
Jesse Barnesf97108d2010-01-29 11:27:07 -0800926
927 return 0;
928}
929
930static int i915_delayfreq_table(struct seq_file *m, void *unused)
931{
932 struct drm_info_node *node = (struct drm_info_node *) m->private;
933 struct drm_device *dev = node->minor->dev;
934 drm_i915_private_t *dev_priv = dev->dev_private;
935 u32 delayfreq;
936 int i;
937
938 for (i = 0; i < 16; i++) {
939 delayfreq = I915_READ(PXVFREQ_BASE + i * 4);
Jesse Barnes7648fa92010-05-20 14:28:11 -0700940 seq_printf(m, "P%02dVIDFREQ: 0x%08x (VID: %d)\n", i, delayfreq,
941 (delayfreq & PXVFREQ_PX_MASK) >> PXVFREQ_PX_SHIFT);
Jesse Barnesf97108d2010-01-29 11:27:07 -0800942 }
943
944 return 0;
945}
946
947static inline int MAP_TO_MV(int map)
948{
949 return 1250 - (map * 25);
950}
951
952static int i915_inttoext_table(struct seq_file *m, void *unused)
953{
954 struct drm_info_node *node = (struct drm_info_node *) m->private;
955 struct drm_device *dev = node->minor->dev;
956 drm_i915_private_t *dev_priv = dev->dev_private;
957 u32 inttoext;
958 int i;
959
960 for (i = 1; i <= 32; i++) {
961 inttoext = I915_READ(INTTOEXT_BASE_ILK + i * 4);
962 seq_printf(m, "INTTOEXT%02d: 0x%08x\n", i, inttoext);
963 }
964
965 return 0;
966}
967
968static int i915_drpc_info(struct seq_file *m, void *unused)
969{
970 struct drm_info_node *node = (struct drm_info_node *) m->private;
971 struct drm_device *dev = node->minor->dev;
972 drm_i915_private_t *dev_priv = dev->dev_private;
973 u32 rgvmodectl = I915_READ(MEMMODECTL);
Jesse Barnes88271da2011-01-05 12:01:24 -0800974 u32 rstdbyctl = I915_READ(RSTDBYCTL);
Jesse Barnes7648fa92010-05-20 14:28:11 -0700975 u16 crstandvid = I915_READ16(CRSTANDVID);
Jesse Barnesf97108d2010-01-29 11:27:07 -0800976
977 seq_printf(m, "HD boost: %s\n", (rgvmodectl & MEMMODE_BOOST_EN) ?
978 "yes" : "no");
979 seq_printf(m, "Boost freq: %d\n",
980 (rgvmodectl & MEMMODE_BOOST_FREQ_MASK) >>
981 MEMMODE_BOOST_FREQ_SHIFT);
982 seq_printf(m, "HW control enabled: %s\n",
983 rgvmodectl & MEMMODE_HWIDLE_EN ? "yes" : "no");
984 seq_printf(m, "SW control enabled: %s\n",
985 rgvmodectl & MEMMODE_SWMODE_EN ? "yes" : "no");
986 seq_printf(m, "Gated voltage change: %s\n",
987 rgvmodectl & MEMMODE_RCLK_GATE ? "yes" : "no");
988 seq_printf(m, "Starting frequency: P%d\n",
989 (rgvmodectl & MEMMODE_FSTART_MASK) >> MEMMODE_FSTART_SHIFT);
Jesse Barnes7648fa92010-05-20 14:28:11 -0700990 seq_printf(m, "Max P-state: P%d\n",
Jesse Barnesf97108d2010-01-29 11:27:07 -0800991 (rgvmodectl & MEMMODE_FMAX_MASK) >> MEMMODE_FMAX_SHIFT);
Jesse Barnes7648fa92010-05-20 14:28:11 -0700992 seq_printf(m, "Min P-state: P%d\n", (rgvmodectl & MEMMODE_FMIN_MASK));
993 seq_printf(m, "RS1 VID: %d\n", (crstandvid & 0x3f));
994 seq_printf(m, "RS2 VID: %d\n", ((crstandvid >> 8) & 0x3f));
995 seq_printf(m, "Render standby enabled: %s\n",
996 (rstdbyctl & RCX_SW_EXIT) ? "no" : "yes");
Jesse Barnes88271da2011-01-05 12:01:24 -0800997 seq_printf(m, "Current RS state: ");
998 switch (rstdbyctl & RSX_STATUS_MASK) {
999 case RSX_STATUS_ON:
1000 seq_printf(m, "on\n");
1001 break;
1002 case RSX_STATUS_RC1:
1003 seq_printf(m, "RC1\n");
1004 break;
1005 case RSX_STATUS_RC1E:
1006 seq_printf(m, "RC1E\n");
1007 break;
1008 case RSX_STATUS_RS1:
1009 seq_printf(m, "RS1\n");
1010 break;
1011 case RSX_STATUS_RS2:
1012 seq_printf(m, "RS2 (RC6)\n");
1013 break;
1014 case RSX_STATUS_RS3:
1015 seq_printf(m, "RC3 (RC6+)\n");
1016 break;
1017 default:
1018 seq_printf(m, "unknown\n");
1019 break;
1020 }
Jesse Barnesf97108d2010-01-29 11:27:07 -08001021
1022 return 0;
1023}
1024
Jesse Barnesb5e50c32010-02-05 12:42:41 -08001025static int i915_fbc_status(struct seq_file *m, void *unused)
1026{
1027 struct drm_info_node *node = (struct drm_info_node *) m->private;
1028 struct drm_device *dev = node->minor->dev;
Jesse Barnesb5e50c32010-02-05 12:42:41 -08001029 drm_i915_private_t *dev_priv = dev->dev_private;
Jesse Barnesb5e50c32010-02-05 12:42:41 -08001030
Adam Jacksonee5382a2010-04-23 11:17:39 -04001031 if (!I915_HAS_FBC(dev)) {
Jesse Barnesb5e50c32010-02-05 12:42:41 -08001032 seq_printf(m, "FBC unsupported on this chipset\n");
1033 return 0;
1034 }
1035
Adam Jacksonee5382a2010-04-23 11:17:39 -04001036 if (intel_fbc_enabled(dev)) {
Jesse Barnesb5e50c32010-02-05 12:42:41 -08001037 seq_printf(m, "FBC enabled\n");
1038 } else {
1039 seq_printf(m, "FBC disabled: ");
1040 switch (dev_priv->no_fbc_reason) {
Chris Wilsonbed4a672010-09-11 10:47:47 +01001041 case FBC_NO_OUTPUT:
1042 seq_printf(m, "no outputs");
1043 break;
Jesse Barnesb5e50c32010-02-05 12:42:41 -08001044 case FBC_STOLEN_TOO_SMALL:
1045 seq_printf(m, "not enough stolen memory");
1046 break;
1047 case FBC_UNSUPPORTED_MODE:
1048 seq_printf(m, "mode not supported");
1049 break;
1050 case FBC_MODE_TOO_LARGE:
1051 seq_printf(m, "mode too large");
1052 break;
1053 case FBC_BAD_PLANE:
1054 seq_printf(m, "FBC unsupported on plane");
1055 break;
1056 case FBC_NOT_TILED:
1057 seq_printf(m, "scanout buffer not tiled");
1058 break;
Jesse Barnes9c928d12010-07-23 15:20:00 -07001059 case FBC_MULTIPLE_PIPES:
1060 seq_printf(m, "multiple pipes are enabled");
1061 break;
Jesse Barnesb5e50c32010-02-05 12:42:41 -08001062 default:
1063 seq_printf(m, "unknown reason");
1064 }
1065 seq_printf(m, "\n");
1066 }
1067 return 0;
1068}
1069
Jesse Barnes4a9bef32010-02-05 12:47:35 -08001070static int i915_sr_status(struct seq_file *m, void *unused)
1071{
1072 struct drm_info_node *node = (struct drm_info_node *) m->private;
1073 struct drm_device *dev = node->minor->dev;
1074 drm_i915_private_t *dev_priv = dev->dev_private;
1075 bool sr_enabled = false;
1076
Yuanhan Liu13982612010-12-15 15:42:31 +08001077 if (HAS_PCH_SPLIT(dev))
Chris Wilson5ba2aaa2010-08-19 18:04:08 +01001078 sr_enabled = I915_READ(WM1_LP_ILK) & WM1_LP_SR_EN;
Chris Wilsona6c45cf2010-09-17 00:32:17 +01001079 else if (IS_CRESTLINE(dev) || IS_I945G(dev) || IS_I945GM(dev))
Jesse Barnes4a9bef32010-02-05 12:47:35 -08001080 sr_enabled = I915_READ(FW_BLC_SELF) & FW_BLC_SELF_EN;
1081 else if (IS_I915GM(dev))
1082 sr_enabled = I915_READ(INSTPM) & INSTPM_SELF_EN;
1083 else if (IS_PINEVIEW(dev))
1084 sr_enabled = I915_READ(DSPFW3) & PINEVIEW_SELF_REFRESH_EN;
1085
Chris Wilson5ba2aaa2010-08-19 18:04:08 +01001086 seq_printf(m, "self-refresh: %s\n",
1087 sr_enabled ? "enabled" : "disabled");
Jesse Barnes4a9bef32010-02-05 12:47:35 -08001088
1089 return 0;
1090}
1091
Jesse Barnes7648fa92010-05-20 14:28:11 -07001092static int i915_emon_status(struct seq_file *m, void *unused)
1093{
1094 struct drm_info_node *node = (struct drm_info_node *) m->private;
1095 struct drm_device *dev = node->minor->dev;
1096 drm_i915_private_t *dev_priv = dev->dev_private;
1097 unsigned long temp, chipset, gfx;
Chris Wilsonde227ef2010-07-03 07:58:38 +01001098 int ret;
1099
1100 ret = mutex_lock_interruptible(&dev->struct_mutex);
1101 if (ret)
1102 return ret;
Jesse Barnes7648fa92010-05-20 14:28:11 -07001103
1104 temp = i915_mch_val(dev_priv);
1105 chipset = i915_chipset_val(dev_priv);
1106 gfx = i915_gfx_val(dev_priv);
Chris Wilsonde227ef2010-07-03 07:58:38 +01001107 mutex_unlock(&dev->struct_mutex);
Jesse Barnes7648fa92010-05-20 14:28:11 -07001108
1109 seq_printf(m, "GMCH temp: %ld\n", temp);
1110 seq_printf(m, "Chipset power: %ld\n", chipset);
1111 seq_printf(m, "GFX power: %ld\n", gfx);
1112 seq_printf(m, "Total power: %ld\n", chipset + gfx);
1113
1114 return 0;
1115}
1116
1117static int i915_gfxec(struct seq_file *m, void *unused)
1118{
1119 struct drm_info_node *node = (struct drm_info_node *) m->private;
1120 struct drm_device *dev = node->minor->dev;
1121 drm_i915_private_t *dev_priv = dev->dev_private;
1122
1123 seq_printf(m, "GFXEC: %ld\n", (unsigned long)I915_READ(0x112f4));
1124
1125 return 0;
1126}
1127
Chris Wilson44834a62010-08-19 16:09:23 +01001128static int i915_opregion(struct seq_file *m, void *unused)
1129{
1130 struct drm_info_node *node = (struct drm_info_node *) m->private;
1131 struct drm_device *dev = node->minor->dev;
1132 drm_i915_private_t *dev_priv = dev->dev_private;
1133 struct intel_opregion *opregion = &dev_priv->opregion;
1134 int ret;
1135
1136 ret = mutex_lock_interruptible(&dev->struct_mutex);
1137 if (ret)
1138 return ret;
1139
1140 if (opregion->header)
1141 seq_write(m, opregion->header, OPREGION_SIZE);
1142
1143 mutex_unlock(&dev->struct_mutex);
1144
1145 return 0;
1146}
1147
Chris Wilson37811fc2010-08-25 22:45:57 +01001148static int i915_gem_framebuffer_info(struct seq_file *m, void *data)
1149{
1150 struct drm_info_node *node = (struct drm_info_node *) m->private;
1151 struct drm_device *dev = node->minor->dev;
1152 drm_i915_private_t *dev_priv = dev->dev_private;
1153 struct intel_fbdev *ifbdev;
1154 struct intel_framebuffer *fb;
1155 int ret;
1156
1157 ret = mutex_lock_interruptible(&dev->mode_config.mutex);
1158 if (ret)
1159 return ret;
1160
1161 ifbdev = dev_priv->fbdev;
1162 fb = to_intel_framebuffer(ifbdev->helper.fb);
1163
1164 seq_printf(m, "fbcon size: %d x %d, depth %d, %d bpp, obj ",
1165 fb->base.width,
1166 fb->base.height,
1167 fb->base.depth,
1168 fb->base.bits_per_pixel);
Chris Wilson05394f32010-11-08 19:18:58 +00001169 describe_obj(m, fb->obj);
Chris Wilson37811fc2010-08-25 22:45:57 +01001170 seq_printf(m, "\n");
1171
1172 list_for_each_entry(fb, &dev->mode_config.fb_list, base.head) {
1173 if (&fb->base == ifbdev->helper.fb)
1174 continue;
1175
1176 seq_printf(m, "user size: %d x %d, depth %d, %d bpp, obj ",
1177 fb->base.width,
1178 fb->base.height,
1179 fb->base.depth,
1180 fb->base.bits_per_pixel);
Chris Wilson05394f32010-11-08 19:18:58 +00001181 describe_obj(m, fb->obj);
Chris Wilson37811fc2010-08-25 22:45:57 +01001182 seq_printf(m, "\n");
1183 }
1184
1185 mutex_unlock(&dev->mode_config.mutex);
1186
1187 return 0;
1188}
1189
Ben Widawskye76d3632011-03-19 18:14:29 -07001190static int i915_context_status(struct seq_file *m, void *unused)
1191{
1192 struct drm_info_node *node = (struct drm_info_node *) m->private;
1193 struct drm_device *dev = node->minor->dev;
1194 drm_i915_private_t *dev_priv = dev->dev_private;
1195 int ret;
1196
1197 ret = mutex_lock_interruptible(&dev->mode_config.mutex);
1198 if (ret)
1199 return ret;
1200
1201 seq_printf(m, "power context ");
1202 describe_obj(m, dev_priv->pwrctx);
1203 seq_printf(m, "\n");
1204
1205 seq_printf(m, "render context ");
1206 describe_obj(m, dev_priv->renderctx);
1207 seq_printf(m, "\n");
1208
1209 mutex_unlock(&dev->mode_config.mutex);
1210
1211 return 0;
1212}
1213
Chris Wilsonf3cd4742009-10-13 22:20:20 +01001214static int
1215i915_wedged_open(struct inode *inode,
1216 struct file *filp)
1217{
1218 filp->private_data = inode->i_private;
1219 return 0;
1220}
1221
1222static ssize_t
1223i915_wedged_read(struct file *filp,
1224 char __user *ubuf,
1225 size_t max,
1226 loff_t *ppos)
1227{
1228 struct drm_device *dev = filp->private_data;
1229 drm_i915_private_t *dev_priv = dev->dev_private;
1230 char buf[80];
1231 int len;
1232
1233 len = snprintf(buf, sizeof (buf),
1234 "wedged : %d\n",
1235 atomic_read(&dev_priv->mm.wedged));
1236
Dan Carpenterf4433a82010-09-08 21:44:47 +02001237 if (len > sizeof (buf))
1238 len = sizeof (buf);
1239
Chris Wilsonf3cd4742009-10-13 22:20:20 +01001240 return simple_read_from_buffer(ubuf, max, ppos, buf, len);
1241}
1242
1243static ssize_t
1244i915_wedged_write(struct file *filp,
1245 const char __user *ubuf,
1246 size_t cnt,
1247 loff_t *ppos)
1248{
1249 struct drm_device *dev = filp->private_data;
Chris Wilsonf3cd4742009-10-13 22:20:20 +01001250 char buf[20];
1251 int val = 1;
1252
1253 if (cnt > 0) {
1254 if (cnt > sizeof (buf) - 1)
1255 return -EINVAL;
1256
1257 if (copy_from_user(buf, ubuf, cnt))
1258 return -EFAULT;
1259 buf[cnt] = 0;
1260
1261 val = simple_strtoul(buf, NULL, 0);
1262 }
1263
1264 DRM_INFO("Manually setting wedged to %d\n", val);
Chris Wilson527f9e92010-11-11 01:16:58 +00001265 i915_handle_error(dev, val);
Chris Wilsonf3cd4742009-10-13 22:20:20 +01001266
1267 return cnt;
1268}
1269
1270static const struct file_operations i915_wedged_fops = {
1271 .owner = THIS_MODULE,
1272 .open = i915_wedged_open,
1273 .read = i915_wedged_read,
1274 .write = i915_wedged_write,
Arnd Bergmann6038f372010-08-15 18:52:59 +02001275 .llseek = default_llseek,
Chris Wilsonf3cd4742009-10-13 22:20:20 +01001276};
1277
1278/* As the drm_debugfs_init() routines are called before dev->dev_private is
1279 * allocated we need to hook into the minor for release. */
1280static int
1281drm_add_fake_info_node(struct drm_minor *minor,
1282 struct dentry *ent,
1283 const void *key)
1284{
1285 struct drm_info_node *node;
1286
1287 node = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL);
1288 if (node == NULL) {
1289 debugfs_remove(ent);
1290 return -ENOMEM;
1291 }
1292
1293 node->minor = minor;
1294 node->dent = ent;
1295 node->info_ent = (void *) key;
1296 list_add(&node->list, &minor->debugfs_nodes.list);
1297
1298 return 0;
1299}
1300
1301static int i915_wedged_create(struct dentry *root, struct drm_minor *minor)
1302{
1303 struct drm_device *dev = minor->dev;
1304 struct dentry *ent;
1305
1306 ent = debugfs_create_file("i915_wedged",
1307 S_IRUGO | S_IWUSR,
1308 root, dev,
1309 &i915_wedged_fops);
1310 if (IS_ERR(ent))
1311 return PTR_ERR(ent);
1312
1313 return drm_add_fake_info_node(minor, ent, &i915_wedged_fops);
1314}
Ben Gamari9e3a6d12009-07-01 22:26:53 -04001315
Ben Gamari27c202a2009-07-01 22:26:52 -04001316static struct drm_info_list i915_debugfs_list[] = {
Chris Wilson311bd682011-01-13 19:06:50 +00001317 {"i915_capabilities", i915_capabilities, 0},
Chris Wilson73aa8082010-09-30 11:46:12 +01001318 {"i915_gem_objects", i915_gem_object_info, 0},
Chris Wilson08c18322011-01-10 00:00:24 +00001319 {"i915_gem_gtt", i915_gem_gtt_info, 0},
Ben Gamari433e12f2009-02-17 20:08:51 -05001320 {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST},
1321 {"i915_gem_flushing", i915_gem_object_list_info, 0, (void *) FLUSHING_LIST},
1322 {"i915_gem_inactive", i915_gem_object_list_info, 0, (void *) INACTIVE_LIST},
Chris Wilsonf13d3f72010-09-20 17:36:15 +01001323 {"i915_gem_pinned", i915_gem_object_list_info, 0, (void *) PINNED_LIST},
Chris Wilsond21d5972010-09-26 11:19:33 +01001324 {"i915_gem_deferred_free", i915_gem_object_list_info, 0, (void *) DEFERRED_FREE_LIST},
Simon Farnsworth4e5359c2010-09-01 17:47:52 +01001325 {"i915_gem_pageflip", i915_gem_pageflip_info, 0},
Ben Gamari20172632009-02-17 20:08:50 -05001326 {"i915_gem_request", i915_gem_request_info, 0},
1327 {"i915_gem_seqno", i915_gem_seqno_info, 0},
Chris Wilsona6172a82009-02-11 14:26:38 +00001328 {"i915_gem_fence_regs", i915_gem_fence_regs_info, 0},
Ben Gamari20172632009-02-17 20:08:50 -05001329 {"i915_gem_interrupt", i915_interrupt_info, 0},
Chris Wilson1ec14ad2010-12-04 11:30:53 +00001330 {"i915_gem_hws", i915_hws_info, 0, (void *)RCS},
1331 {"i915_gem_hws_blt", i915_hws_info, 0, (void *)BCS},
1332 {"i915_gem_hws_bsd", i915_hws_info, 0, (void *)VCS},
1333 {"i915_ringbuffer_data", i915_ringbuffer_data, 0, (void *)RCS},
1334 {"i915_ringbuffer_info", i915_ringbuffer_info, 0, (void *)RCS},
1335 {"i915_bsd_ringbuffer_data", i915_ringbuffer_data, 0, (void *)VCS},
1336 {"i915_bsd_ringbuffer_info", i915_ringbuffer_info, 0, (void *)VCS},
1337 {"i915_blt_ringbuffer_data", i915_ringbuffer_data, 0, (void *)BCS},
1338 {"i915_blt_ringbuffer_info", i915_ringbuffer_info, 0, (void *)BCS},
Ben Gamari6911a9b2009-04-02 11:24:54 -07001339 {"i915_batchbuffers", i915_batchbuffer_info, 0},
Jesse Barnes63eeaf32009-06-18 16:56:52 -07001340 {"i915_error_state", i915_error_state, 0},
Jesse Barnesf97108d2010-01-29 11:27:07 -08001341 {"i915_rstdby_delays", i915_rstdby_delays, 0},
1342 {"i915_cur_delayinfo", i915_cur_delayinfo, 0},
1343 {"i915_delayfreq_table", i915_delayfreq_table, 0},
1344 {"i915_inttoext_table", i915_inttoext_table, 0},
1345 {"i915_drpc_info", i915_drpc_info, 0},
Jesse Barnes7648fa92010-05-20 14:28:11 -07001346 {"i915_emon_status", i915_emon_status, 0},
1347 {"i915_gfxec", i915_gfxec, 0},
Jesse Barnesb5e50c32010-02-05 12:42:41 -08001348 {"i915_fbc_status", i915_fbc_status, 0},
Jesse Barnes4a9bef32010-02-05 12:47:35 -08001349 {"i915_sr_status", i915_sr_status, 0},
Chris Wilson44834a62010-08-19 16:09:23 +01001350 {"i915_opregion", i915_opregion, 0},
Chris Wilson37811fc2010-08-25 22:45:57 +01001351 {"i915_gem_framebuffer", i915_gem_framebuffer_info, 0},
Ben Widawskye76d3632011-03-19 18:14:29 -07001352 {"i915_context_status", i915_context_status, 0},
Ben Gamari20172632009-02-17 20:08:50 -05001353};
Ben Gamari27c202a2009-07-01 22:26:52 -04001354#define I915_DEBUGFS_ENTRIES ARRAY_SIZE(i915_debugfs_list)
Ben Gamari20172632009-02-17 20:08:50 -05001355
Ben Gamari27c202a2009-07-01 22:26:52 -04001356int i915_debugfs_init(struct drm_minor *minor)
Ben Gamari20172632009-02-17 20:08:50 -05001357{
Chris Wilsonf3cd4742009-10-13 22:20:20 +01001358 int ret;
1359
1360 ret = i915_wedged_create(minor->debugfs_root, minor);
1361 if (ret)
1362 return ret;
1363
Ben Gamari27c202a2009-07-01 22:26:52 -04001364 return drm_debugfs_create_files(i915_debugfs_list,
1365 I915_DEBUGFS_ENTRIES,
Ben Gamari20172632009-02-17 20:08:50 -05001366 minor->debugfs_root, minor);
1367}
1368
Ben Gamari27c202a2009-07-01 22:26:52 -04001369void i915_debugfs_cleanup(struct drm_minor *minor)
Ben Gamari20172632009-02-17 20:08:50 -05001370{
Ben Gamari27c202a2009-07-01 22:26:52 -04001371 drm_debugfs_remove_files(i915_debugfs_list,
1372 I915_DEBUGFS_ENTRIES, minor);
Kristian Høgsberg33db6792009-11-11 12:19:16 -05001373 drm_debugfs_remove_files((struct drm_info_list *) &i915_wedged_fops,
1374 1, minor);
Ben Gamari20172632009-02-17 20:08:50 -05001375}
1376
1377#endif /* CONFIG_DEBUG_FS */