diff mbox

[3/4] drm/i915/contexts: Serialize default context init

Message ID 1344922871-2248-3-git-send-email-ben@bwidawsk.net (mailing list archive)
State Superseded
Headers show

Commit Message

Ben Widawsky Aug. 14, 2012, 5:41 a.m. UTC
This is possible with the new force paramter in do_switch. As stated in
that patch, the goal is to get a real context stored at the time of
initialization.

References: https://bugs.freedesktop.org/show_bug.cgi?id=52429
Tested-by: Guang A Yang <guang.a.yang@intel.com>
Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
---
 drivers/gpu/drm/i915/i915_gem_context.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Chris Wilson Aug. 14, 2012, 7:41 a.m. UTC | #1
On Mon, 13 Aug 2012 22:41:10 -0700, Ben Widawsky <ben@bwidawsk.net> wrote:
> This is possible with the new force paramter in do_switch. As stated in
> that patch, the goal is to get a real context stored at the time of
> initialization.
> 
> References: https://bugs.freedesktop.org/show_bug.cgi?id=52429
> Tested-by: Guang A Yang <guang.a.yang@intel.com>
> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>

I'm missing the rationalisation for this pair of patches... For
instance, I can't see how this closes the hole we have upon resume where
ring->context_obj == DEFAULT_CONTEXT but CCID is 0.
-Chris
Ben Widawsky Aug. 14, 2012, 4:41 p.m. UTC | #2
On 2012-08-14 00:41, Chris Wilson wrote:
> On Mon, 13 Aug 2012 22:41:10 -0700, Ben Widawsky <ben@bwidawsk.net> 
> wrote:
>> This is possible with the new force paramter in do_switch. As stated 
>> in
>> that patch, the goal is to get a real context stored at the time of
>> initialization.
>>
>> References: https://bugs.freedesktop.org/show_bug.cgi?id=52429
>> Tested-by: Guang A Yang <guang.a.yang@intel.com>
>> Signed-off-by: Ben Widawsky <ben@bwidawsk.net>
>
> I'm missing the rationalisation for this pair of patches... For
> instance, I can't see how this closes the hole we have upon resume 
> where
> ring->context_obj == DEFAULT_CONTEXT but CCID is 0.
> -Chris

Yeah this doesn't fix that problem. The problem this is trying to solve 
is suspend/resume before any context switch actually occurs. Basically 
jam the default context obj in, and this allows us to force restore it 
on resume. However, as you point out, I guess that force restore is 
missing. Let me think a bit more/chat on IRC.
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 3945e79..c96d6f2 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -229,6 +229,10 @@  static int create_default_context(struct drm_i915_private *dev_priv)
 	if (ret)
 		goto err_unpin;
 
+	ret = do_switch(ctx, true);
+	if (ret)
+		goto err_unpin;
+
 	DRM_DEBUG_DRIVER("Default HW context loaded\n");
 	return 0;