Skip to content

Commit

Permalink
drm/i915: add struct i915_ctx_hang_stats
Browse files Browse the repository at this point in the history
To count context losses, add struct i915_ctx_hang_stats for
both i915_hw_context and drm_i915_file_private.
drm_i915_file_private is used when there is no context.

v2: renamed and cleaned up the struct (Chris Wilson, Ian Romanick)

Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Acked-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Mika Kuoppala authored and Daniel Vetter committed Jun 13, 2013
1 parent e0d8d59 commit e59ec13
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/i915_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1814,7 +1814,7 @@ int i915_driver_open(struct drm_device *dev, struct drm_file *file)
struct drm_i915_file_private *file_priv;

DRM_DEBUG_DRIVER("\n");
file_priv = kmalloc(sizeof(*file_priv), GFP_KERNEL);
file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL);
if (!file_priv)
return -ENOMEM;

Expand Down
10 changes: 10 additions & 0 deletions drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,13 @@ struct i915_hw_ppgtt {
void (*cleanup)(struct i915_hw_ppgtt *ppgtt);
};

struct i915_ctx_hang_stats {
/* This context had batch pending when hang was declared */
unsigned batch_pending;

/* This context had batch active when hang was declared */
unsigned batch_active;
};

/* This must match up with the value previously used for execbuf2.rsvd1. */
#define DEFAULT_CONTEXT_ID 0
Expand All @@ -518,6 +525,7 @@ struct i915_hw_context {
struct drm_i915_file_private *file_priv;
struct intel_ring_buffer *ring;
struct drm_i915_gem_object *obj;
struct i915_ctx_hang_stats hang_stats;
};

enum no_fbc_reason {
Expand Down Expand Up @@ -1377,6 +1385,8 @@ struct drm_i915_file_private {
struct list_head request_list;
} mm;
struct idr context_idr;

struct i915_ctx_hang_stats hang_stats;
};

#define INTEL_INFO(dev) (((struct drm_i915_private *) (dev)->dev_private)->info)
Expand Down

0 comments on commit e59ec13

Please sign in to comment.