drm/i915: set initialised only when init_context callback is NULL
authorChuanxiao Dong <chuanxiao.dong@intel.com>
Thu, 11 May 2017 10:07:42 +0000 (18:07 +0800)
committerJani Nikula <jani.nikula@intel.com>
Fri, 19 May 2017 08:45:10 +0000 (11:45 +0300)
During execlist_context_deferred_alloc() we presumed that the context is
uninitialised (we only just allocated the state object for it!) and
chose to optimise away the later call to engine->init_context() if
engine->init_context were NULL. This breaks with GVT's contexts that are
marked as pre-initialised to avoid us annoyingly calling
engine->init_context(). The fix is to not override ce->initialised if it
is already true.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1494497262-24855-1-git-send-email-chuanxiao.dong@intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
(cherry picked from commit 0d402a24df8c8160727af934d83293f3d44d31a3)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
drivers/gpu/drm/i915/intel_lrc.c

index c8f7c631fc1f8e354cac0038c80aa35d0a1dd0d2..dac4e003c1f317ec402110132bad0c3a734bf52a 100644 (file)
@@ -1989,7 +1989,7 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx,
 
        ce->ring = ring;
        ce->state = vma;
-       ce->initialised = engine->init_context == NULL;
+       ce->initialised |= engine->init_context == NULL;
 
        return 0;