* [PATCH 1/3] drm/i915: Fix retrieval of hangcheck stats
@ 2013-06-17 11:25 Chris Wilson
2013-06-17 11:25 ` [PATCH 2/3] drm/i915: Replace open-coding of DEFAULT_CONTEXT_ID Chris Wilson
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Chris Wilson @ 2013-06-17 11:25 UTC (permalink / raw)
To: intel-gfx
The default context is always supported (as it contains the global
hangcheck stats) and the contexts for hangcheck are not limited
to any ring.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65845
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_drv.h | 2 +-
drivers/gpu/drm/i915/i915_gem_context.c | 23 ++++++++---------------
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 3 +--
3 files changed, 10 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 5be8856..c0d1af2 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1864,7 +1864,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,
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index b46f850..8cd675f 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -305,31 +305,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)
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index a465a3b..da3dfd7 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -1040,8 +1040,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
if (ret)
goto err;
- hs = i915_gem_context_get_hang_stats(&dev_priv->ring[RCS],
- file, ctx_id);
+ hs = i915_gem_context_get_hang_stats(dev, file, ctx_id);
if (IS_ERR(hs)) {
ret = PTR_ERR(hs);
goto err;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/3] drm/i915: Replace open-coding of DEFAULT_CONTEXT_ID
2013-06-17 11:25 [PATCH 1/3] drm/i915: Fix retrieval of hangcheck stats Chris Wilson
@ 2013-06-17 11:25 ` Chris Wilson
2013-06-17 11:25 ` [PATCH 3/3] drm/i915: Allow contexts to be specified for unsupported rings Chris Wilson
2013-06-18 12:02 ` [PATCH 1/3] drm/i915: Fix retrieval of hangcheck stats Mika Kuoppala
2 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2013-06-17 11:25 UTC (permalink / raw)
To: intel-gfx
The intent of the check is made more clear if we use the proper name for
0 here.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index da3dfd7..173fe8f 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -879,7 +879,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
break;
case I915_EXEC_BSD:
ring = &dev_priv->ring[VCS];
- if (ctx_id != 0) {
+ if (ctx_id != DEFAULT_CONTEXT_ID) {
DRM_DEBUG("Ring %s doesn't support contexts\n",
ring->name);
return -EPERM;
@@ -887,7 +887,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
break;
case I915_EXEC_BLT:
ring = &dev_priv->ring[BCS];
- if (ctx_id != 0) {
+ if (ctx_id != DEFAULT_CONTEXT_ID) {
DRM_DEBUG("Ring %s doesn't support contexts\n",
ring->name);
return -EPERM;
@@ -895,7 +895,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
break;
case I915_EXEC_VEBOX:
ring = &dev_priv->ring[VECS];
- if (ctx_id != 0) {
+ if (ctx_id != DEFAULT_CONTEXT_ID) {
DRM_DEBUG("Ring %s doesn't support contexts\n",
ring->name);
return -EPERM;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 3/3] drm/i915: Allow contexts to be specified for unsupported rings
2013-06-17 11:25 [PATCH 1/3] drm/i915: Fix retrieval of hangcheck stats Chris Wilson
2013-06-17 11:25 ` [PATCH 2/3] drm/i915: Replace open-coding of DEFAULT_CONTEXT_ID Chris Wilson
@ 2013-06-17 11:25 ` Chris Wilson
2013-06-18 12:02 ` [PATCH 1/3] drm/i915: Fix retrieval of hangcheck stats Mika Kuoppala
2 siblings, 0 replies; 6+ messages in thread
From: Chris Wilson @ 2013-06-17 11:25 UTC (permalink / raw)
To: intel-gfx
As our contexts are more general than the logical contexts supported by
the hardware, for instance they allow per context hangcheck tracking, it
is beneficial to group tasks across rings belonging to the same context.
Context switching is already a no-op for unsupported rings, we just
suffered from a little too overzealous parameter checking on entry - now
we just check that the context is valid.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
drivers/gpu/drm/i915/i915_gem_execbuffer.c | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 173fe8f..8557da3 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -879,27 +879,12 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
break;
case I915_EXEC_BSD:
ring = &dev_priv->ring[VCS];
- if (ctx_id != DEFAULT_CONTEXT_ID) {
- DRM_DEBUG("Ring %s doesn't support contexts\n",
- ring->name);
- return -EPERM;
- }
break;
case I915_EXEC_BLT:
ring = &dev_priv->ring[BCS];
- if (ctx_id != DEFAULT_CONTEXT_ID) {
- DRM_DEBUG("Ring %s doesn't support contexts\n",
- ring->name);
- return -EPERM;
- }
break;
case I915_EXEC_VEBOX:
ring = &dev_priv->ring[VECS];
- if (ctx_id != DEFAULT_CONTEXT_ID) {
- DRM_DEBUG("Ring %s doesn't support contexts\n",
- ring->name);
- return -EPERM;
- }
break;
default:
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/3] drm/i915: Fix retrieval of hangcheck stats
2013-06-17 11:25 [PATCH 1/3] drm/i915: Fix retrieval of hangcheck stats Chris Wilson
2013-06-17 11:25 ` [PATCH 2/3] drm/i915: Replace open-coding of DEFAULT_CONTEXT_ID Chris Wilson
2013-06-17 11:25 ` [PATCH 3/3] drm/i915: Allow contexts to be specified for unsupported rings Chris Wilson
@ 2013-06-18 12:02 ` Mika Kuoppala
2 siblings, 0 replies; 6+ messages in thread
From: Mika Kuoppala @ 2013-06-18 12:02 UTC (permalink / raw)
To: Chris Wilson, intel-gfx
Chris Wilson <chris@chris-wilson.co.uk> writes:
> The default context is always supported (as it contains the global
> hangcheck stats) and the contexts for hangcheck are not limited
> to any ring.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65845
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Patches 1-3:
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/3] drm/i915: Fix retrieval of hangcheck stats
@ 2013-06-25 15:47 Mika Kuoppala
2013-07-01 5:04 ` Ben Widawsky
0 siblings, 1 reply; 6+ messages in thread
From: Mika Kuoppala @ 2013-06-25 15:47 UTC (permalink / raw)
To: intel-gfx; +Cc: miku
From: Chris Wilson <chris@chris-wilson.co.uk>
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: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
---
drivers/gpu/drm/i915/i915_drv.h | 2 +-
drivers/gpu/drm/i915/i915_gem_context.c | 23 ++++++++---------------
2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 491958e..dd55bc0 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1825,7 +1825,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,
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index ff47145..ec4cf02 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -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)
--
1.7.9.5
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/3] drm/i915: Fix retrieval of hangcheck stats
2013-06-25 15:47 Mika Kuoppala
@ 2013-07-01 5:04 ` Ben Widawsky
0 siblings, 0 replies; 6+ messages in thread
From: Ben Widawsky @ 2013-07-01 5:04 UTC (permalink / raw)
To: Mika Kuoppala; +Cc: intel-gfx, miku
On Tue, Jun 25, 2013 at 06:47:00PM +0300, Mika Kuoppala wrote:
> From: Chris Wilson <chris@chris-wilson.co.uk>
>
> 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: Chris Wilson <chris@chris-wilson.co.uk>
> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
This patch is also duplicated in my PPGTT series. If you want to drop it
here, I'll ameks ure it gets moved forward.
[snip]
--
Ben Widawsky, Intel Open Source Technology Center
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-07-01 5:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-17 11:25 [PATCH 1/3] drm/i915: Fix retrieval of hangcheck stats Chris Wilson
2013-06-17 11:25 ` [PATCH 2/3] drm/i915: Replace open-coding of DEFAULT_CONTEXT_ID Chris Wilson
2013-06-17 11:25 ` [PATCH 3/3] drm/i915: Allow contexts to be specified for unsupported rings Chris Wilson
2013-06-18 12:02 ` [PATCH 1/3] drm/i915: Fix retrieval of hangcheck stats Mika Kuoppala
-- strict thread matches above, loose matches on Subject: below --
2013-06-25 15:47 Mika Kuoppala
2013-07-01 5:04 ` Ben Widawsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).