diff options
author | Mika Kuoppala <mika.kuoppala@linux.intel.com> | 2014-01-30 09:01:15 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2014-01-30 11:24:36 -0500 |
commit | 44e2c0705a19e09d7b0f30a591f92e473e5ef89e (patch) | |
tree | 1a16f579170009cd0bad8aaf421d74c5f9279b9f | |
parent | 116f2b6da868dec7539103574d0421cd6221e931 (diff) |
drm/i915: Use i915_hw_context to set reset stats
With full ppgtt support drm_i915_file_private gained knowledge
about the default context. Also reset stats are now inside
i915_hw_context so we can use proper abstraction.
v2: Move BUG_ON and WARN_ON to more proper locations (Ben)
v3: Pass dev directly to i915_context_is_banned to avoid the need to
dereference ctx->last_ring. Spotted by Mika when checking my
s/BUG/WARN/ change, I've missed this ->last_ring dereference.
Suggested-by: Ben Widawsky <ben@bwidawsk.net>
Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com> (v2)
Reviewed-by: Ben Widawsky <ben@bwidawsk.net> (v2)
[danvet: s/BUG/WARN/]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r-- | drivers/gpu/drm/i915/i915_gem.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 39770f7b333f..873b6fb34917 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2305,11 +2305,15 @@ static bool i915_request_guilty(struct drm_i915_gem_request *request, | |||
2305 | return false; | 2305 | return false; |
2306 | } | 2306 | } |
2307 | 2307 | ||
2308 | static bool i915_context_is_banned(const struct i915_ctx_hang_stats *hs) | 2308 | static bool i915_context_is_banned(struct drm_device *dev, |
2309 | const struct i915_hw_context *ctx) | ||
2309 | { | 2310 | { |
2310 | const unsigned long elapsed = get_seconds() - hs->guilty_ts; | 2311 | struct drm_i915_private *dev_priv = to_i915(dev); |
2312 | unsigned long elapsed; | ||
2311 | 2313 | ||
2312 | if (hs->banned) | 2314 | elapsed = get_seconds() - ctx->hang_stats.guilty_ts; |
2315 | |||
2316 | if (ctx->hang_stats.banned) | ||
2313 | return true; | 2317 | return true; |
2314 | 2318 | ||
2315 | if (elapsed <= DRM_I915_CTX_BAN_PERIOD) { | 2319 | if (elapsed <= DRM_I915_CTX_BAN_PERIOD) { |
@@ -2324,9 +2328,13 @@ static void i915_set_reset_status(struct intel_ring_buffer *ring, | |||
2324 | struct drm_i915_gem_request *request, | 2328 | struct drm_i915_gem_request *request, |
2325 | u32 acthd) | 2329 | u32 acthd) |
2326 | { | 2330 | { |
2327 | struct i915_ctx_hang_stats *hs = NULL; | ||
2328 | bool inside, guilty; | 2331 | bool inside, guilty; |
2329 | unsigned long offset = 0; | 2332 | unsigned long offset = 0; |
2333 | struct i915_hw_context *ctx = request->ctx; | ||
2334 | struct i915_ctx_hang_stats *hs; | ||
2335 | |||
2336 | if (WARN_ON(!ctx)) | ||
2337 | return; | ||
2330 | 2338 | ||
2331 | /* Innocent until proven guilty */ | 2339 | /* Innocent until proven guilty */ |
2332 | guilty = false; | 2340 | guilty = false; |
@@ -2341,28 +2349,22 @@ static void i915_set_reset_status(struct intel_ring_buffer *ring, | |||
2341 | ring->name, | 2349 | ring->name, |
2342 | inside ? "inside" : "flushing", | 2350 | inside ? "inside" : "flushing", |
2343 | offset, | 2351 | offset, |
2344 | request->ctx ? request->ctx->id : 0, | 2352 | ctx->id, |
2345 | acthd); | 2353 | acthd); |
2346 | 2354 | ||
2347 | guilty = true; | 2355 | guilty = true; |
2348 | } | 2356 | } |
2349 | 2357 | ||
2350 | /* If contexts are disabled or this is the default context, use | 2358 | WARN_ON(!ctx->last_ring); |
2351 | * file_priv->reset_state | 2359 | |
2352 | */ | 2360 | hs = &ctx->hang_stats; |
2353 | if (request->ctx && request->ctx->id != DEFAULT_CONTEXT_ID) | 2361 | |
2354 | hs = &request->ctx->hang_stats; | 2362 | if (guilty) { |
2355 | else if (request->file_priv) | 2363 | hs->banned = i915_context_is_banned(ring->dev, ctx); |
2356 | hs = &request->file_priv->private_default_ctx->hang_stats; | 2364 | hs->batch_active++; |
2357 | 2365 | hs->guilty_ts = get_seconds(); | |
2358 | if (hs) { | 2366 | } else { |
2359 | if (guilty) { | 2367 | hs->batch_pending++; |
2360 | hs->banned = i915_context_is_banned(hs); | ||
2361 | hs->batch_active++; | ||
2362 | hs->guilty_ts = get_seconds(); | ||
2363 | } else { | ||
2364 | hs->batch_pending++; | ||
2365 | } | ||
2366 | } | 2368 | } |
2367 | } | 2369 | } |
2368 | 2370 | ||