Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 11fa3384 authored by Chris Wilson's avatar Chris Wilson Committed by Daniel Vetter
Browse files

drm/i915: Fix retrieval of hangcheck stats

The default context is always supported (as it contains the global
hangcheck stats) and the contexts for hangcheck are not limited
to any ring.

References: https://bugs.freedesktop.org/show_bug.cgi?id=65845


Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent eb4926e4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1860,7 +1860,7 @@ static inline void i915_gem_context_unreference(struct i915_hw_context *ctx)
}

struct i915_ctx_hang_stats * __must_check
i915_gem_context_get_hang_stats(struct intel_ring_buffer *ring,
i915_gem_context_get_hang_stats(struct drm_device *dev,
				struct drm_file *file,
				u32 id);
int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
+8 −15
Original line number Diff line number Diff line
@@ -304,31 +304,24 @@ static int context_idr_cleanup(int id, void *p, void *data)
}

struct i915_ctx_hang_stats *
i915_gem_context_get_hang_stats(struct intel_ring_buffer *ring,
i915_gem_context_get_hang_stats(struct drm_device *dev,
				struct drm_file *file,
				u32 id)
{
	struct drm_i915_private *dev_priv = ring->dev->dev_private;
	struct drm_i915_private *dev_priv = dev->dev_private;
	struct drm_i915_file_private *file_priv = file->driver_priv;
	struct i915_hw_context *to;

	if (dev_priv->hw_contexts_disabled)
		return ERR_PTR(-ENOENT);

	if (ring->id != RCS)
		return ERR_PTR(-EINVAL);

	if (file == NULL)
		return ERR_PTR(-EINVAL);
	struct i915_hw_context *ctx;

	if (id == DEFAULT_CONTEXT_ID)
		return &file_priv->hang_stats;

	to = i915_gem_context_get(file->driver_priv, id);
	if (to == NULL)
	ctx = NULL;
	if (!dev_priv->hw_contexts_disabled)
		ctx = i915_gem_context_get(file->driver_priv, id);
	if (ctx == NULL)
		return ERR_PTR(-ENOENT);

	return &to->hang_stats;
	return &ctx->hang_stats;
}

void i915_gem_context_close(struct drm_device *dev, struct drm_file *file)