From: "Volkin, Bradley D" Subject: Re: [PATCH 1/6] drm/i915: Reinitialize default context after reset Date: Fri, 19 Sep 2014 10:46:15 -0700 Message-ID: <20140919174615.GA2491@bdvolkin-ubuntu-desktop> References: <1411052315-22979-1-git-send-email-mika.kuoppala@intel.com> <1411052315-22979-2-git-send-email-mika.kuoppala@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTP id 84EB26E1A6 for ; Fri, 19 Sep 2014 10:47:23 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1411052315-22979-2-git-send-email-mika.kuoppala@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Mika Kuoppala Cc: "intel-gfx@lists.freedesktop.org" List-Id: intel-gfx@lists.freedesktop.org [snip] On Thu, Sep 18, 2014 at 07:58:30AM -0700, Mika Kuoppala wrote: > @@ -577,7 +596,7 @@ static int do_switch(struct intel_engine_cs *ring, > vma->bind_vma(vma, to->legacy_hw_ctx.rcs_state->cache_level, GLOBAL_BIND); > } > > - if (!to->legacy_hw_ctx.initialized || i915_gem_context_is_default(to)) > + if (!to->initialized || i915_gem_context_is_default(to)) > hw_flags |= MI_RESTORE_INHIBIT; > > ret = mi_set_context(ring, to, hw_flags); > @@ -618,26 +637,19 @@ static int do_switch(struct intel_engine_cs *ring, > /* obj is kept alive until the next request by its active ref */ > i915_gem_object_ggtt_unpin(from->legacy_hw_ctx.rcs_state); > i915_gem_context_unreference(from); > - } > > - uninitialized = !to->legacy_hw_ctx.initialized && from == NULL; > - to->legacy_hw_ctx.initialized = true; > + /* We inherit the state from the previous context */ > + to->initialized = true; > + } Regarding these two hunks, I may have asked this question before but if so I've forgotten the answer. Why do we want to set MI_RESTORE_INHIBIT when switching to the default context? Why do we want to inherit state from the previous context? I assumed that when switching to an initialized context we would always want to restore its last state. Thanks, Brad