diff options
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs.c | 49 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem_context.c | 1 |
3 files changed, 43 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c index d1e0a360558f..2bba4c25c53e 100644 --- a/drivers/gpu/drm/i915/i915_debugfs.c +++ b/drivers/gpu/drm/i915/i915_debugfs.c | |||
@@ -299,28 +299,57 @@ static int i915_gem_stolen_list_info(struct seq_file *m, void *data) | |||
299 | } while (0) | 299 | } while (0) |
300 | 300 | ||
301 | struct file_stats { | 301 | struct file_stats { |
302 | struct drm_i915_file_private *file_priv; | ||
302 | int count; | 303 | int count; |
303 | size_t total, active, inactive, unbound; | 304 | size_t total, global, active, inactive, unbound; |
304 | }; | 305 | }; |
305 | 306 | ||
306 | static int per_file_stats(int id, void *ptr, void *data) | 307 | static int per_file_stats(int id, void *ptr, void *data) |
307 | { | 308 | { |
308 | struct drm_i915_gem_object *obj = ptr; | 309 | struct drm_i915_gem_object *obj = ptr; |
309 | struct file_stats *stats = data; | 310 | struct file_stats *stats = data; |
311 | struct i915_vma *vma; | ||
310 | 312 | ||
311 | stats->count++; | 313 | stats->count++; |
312 | stats->total += obj->base.size; | 314 | stats->total += obj->base.size; |
313 | 315 | ||
314 | if (i915_gem_obj_ggtt_bound(obj)) { | 316 | if (USES_FULL_PPGTT(obj->base.dev)) { |
315 | if (!list_empty(&obj->ring_list)) | 317 | list_for_each_entry(vma, &obj->vma_list, vma_link) { |
316 | stats->active += obj->base.size; | 318 | struct i915_hw_ppgtt *ppgtt; |
317 | else | 319 | |
318 | stats->inactive += obj->base.size; | 320 | if (!drm_mm_node_allocated(&vma->node)) |
321 | continue; | ||
322 | |||
323 | if (i915_is_ggtt(vma->vm)) { | ||
324 | stats->global += obj->base.size; | ||
325 | continue; | ||
326 | } | ||
327 | |||
328 | ppgtt = container_of(vma->vm, struct i915_hw_ppgtt, base); | ||
329 | if (ppgtt->ctx && ppgtt->ctx->file_priv != stats->file_priv) | ||
330 | continue; | ||
331 | |||
332 | if (obj->ring) /* XXX per-vma statistic */ | ||
333 | stats->active += obj->base.size; | ||
334 | else | ||
335 | stats->inactive += obj->base.size; | ||
336 | |||
337 | return 0; | ||
338 | } | ||
319 | } else { | 339 | } else { |
320 | if (!list_empty(&obj->global_list)) | 340 | if (i915_gem_obj_ggtt_bound(obj)) { |
321 | stats->unbound += obj->base.size; | 341 | stats->global += obj->base.size; |
342 | if (obj->ring) | ||
343 | stats->active += obj->base.size; | ||
344 | else | ||
345 | stats->inactive += obj->base.size; | ||
346 | return 0; | ||
347 | } | ||
322 | } | 348 | } |
323 | 349 | ||
350 | if (!list_empty(&obj->global_list)) | ||
351 | stats->unbound += obj->base.size; | ||
352 | |||
324 | return 0; | 353 | return 0; |
325 | } | 354 | } |
326 | 355 | ||
@@ -411,6 +440,7 @@ static int i915_gem_object_info(struct seq_file *m, void* data) | |||
411 | struct task_struct *task; | 440 | struct task_struct *task; |
412 | 441 | ||
413 | memset(&stats, 0, sizeof(stats)); | 442 | memset(&stats, 0, sizeof(stats)); |
443 | stats.file_priv = file->driver_priv; | ||
414 | idr_for_each(&file->object_idr, per_file_stats, &stats); | 444 | idr_for_each(&file->object_idr, per_file_stats, &stats); |
415 | /* | 445 | /* |
416 | * Although we have a valid reference on file->pid, that does | 446 | * Although we have a valid reference on file->pid, that does |
@@ -420,12 +450,13 @@ static int i915_gem_object_info(struct seq_file *m, void* data) | |||
420 | */ | 450 | */ |
421 | rcu_read_lock(); | 451 | rcu_read_lock(); |
422 | task = pid_task(file->pid, PIDTYPE_PID); | 452 | task = pid_task(file->pid, PIDTYPE_PID); |
423 | seq_printf(m, "%s: %u objects, %zu bytes (%zu active, %zu inactive, %zu unbound)\n", | 453 | seq_printf(m, "%s: %u objects, %zu bytes (%zu active, %zu inactive, %zu global, %zu unbound)\n", |
424 | task ? task->comm : "<unknown>", | 454 | task ? task->comm : "<unknown>", |
425 | stats.count, | 455 | stats.count, |
426 | stats.total, | 456 | stats.total, |
427 | stats.active, | 457 | stats.active, |
428 | stats.inactive, | 458 | stats.inactive, |
459 | stats.global, | ||
429 | stats.unbound); | 460 | stats.unbound); |
430 | rcu_read_unlock(); | 461 | rcu_read_unlock(); |
431 | } | 462 | } |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index c5c57608460c..9b8c1e06a787 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -725,6 +725,8 @@ struct i915_hw_ppgtt { | |||
725 | dma_addr_t *gen8_pt_dma_addr[4]; | 725 | dma_addr_t *gen8_pt_dma_addr[4]; |
726 | }; | 726 | }; |
727 | 727 | ||
728 | struct i915_hw_context *ctx; | ||
729 | |||
728 | int (*enable)(struct i915_hw_ppgtt *ppgtt); | 730 | int (*enable)(struct i915_hw_ppgtt *ppgtt); |
729 | int (*switch_mm)(struct i915_hw_ppgtt *ppgtt, | 731 | int (*switch_mm)(struct i915_hw_ppgtt *ppgtt, |
730 | struct intel_ring_buffer *ring, | 732 | struct intel_ring_buffer *ring, |
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c index b5a58372eb06..6043062ffce7 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.c +++ b/drivers/gpu/drm/i915/i915_gem_context.c | |||
@@ -215,6 +215,7 @@ create_vm_for_ctx(struct drm_device *dev, struct i915_hw_context *ctx) | |||
215 | return ERR_PTR(ret); | 215 | return ERR_PTR(ret); |
216 | } | 216 | } |
217 | 217 | ||
218 | ppgtt->ctx = ctx; | ||
218 | return ppgtt; | 219 | return ppgtt; |
219 | } | 220 | } |
220 | 221 | ||