[Intel-gfx] [PATCH 09/13] drm/i915: add reset_state for hw_contexts
Mika Kuoppala
mika.kuoppala at linux.intel.com
Tue Feb 26 12:05:12 CET 2013
For arb-robustness, every context needs to have it's own
reset state tracking. Default context will be handled in a identical
way as the no-context case in further down in the patch set.
For no-context case, the reset state will be stored in
the file_priv part.
v2: handle default context inside get_reset_state
Signed-off-by: Mika Kuoppala <mika.kuoppala at intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 4 ++++
drivers/gpu/drm/i915/i915_gem_context.c | 34 +++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1c67fb2..2cc5817 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1684,6 +1684,10 @@ int i915_switch_context(struct intel_ring_buffer *ring,
struct drm_file *file, int to_id,
struct i915_hw_context **ctx);
void i915_gem_context_free(struct kref *ctx_ref);
+int i915_gem_context_get_reset_state(struct intel_ring_buffer *ring,
+ struct drm_file *file,
+ u32 id,
+ struct ctx_reset_state **rs);
int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
struct drm_file *file);
int i915_gem_context_destroy_ioctl(struct drm_device *dev, void *data,
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index cba54fb..1b14a06 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -304,6 +304,40 @@ static int context_idr_cleanup(int id, void *p, void *data)
return 0;
}
+int i915_gem_context_get_reset_state(struct intel_ring_buffer *ring,
+ struct drm_file *file,
+ u32 id,
+ struct ctx_reset_state **rs)
+{
+ struct drm_i915_private *dev_priv = ring->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 -ENOENT;
+
+ if (ring->id != RCS)
+ return -EINVAL;
+
+ if (rs == NULL)
+ return -EINVAL;
+
+ if (file == NULL)
+ return -EINVAL;
+
+ if (id == DEFAULT_CONTEXT_ID) {
+ *rs = &file_priv->reset_state;
+ } else {
+ to = i915_gem_context_get(file->driver_priv, id);
+ if (to == NULL)
+ return -ENOENT;
+
+ *rs = &to->reset_state;
+ }
+
+ return 0;
+}
+
void i915_gem_context_close(struct drm_device *dev, struct drm_file *file)
{
struct drm_i915_file_private *file_priv = file->driver_priv;
--
1.7.9.5
More information about the Intel-gfx
mailing list