From patchwork Tue May 29 19:16:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lionel Landwerlin X-Patchwork-Id: 10436809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D351E601E9 for ; Tue, 29 May 2018 19:16:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C47042890F for ; Tue, 29 May 2018 19:16:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B937428944; Tue, 29 May 2018 19:16:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6EE622890F for ; Tue, 29 May 2018 19:16:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E3C416E56C; Tue, 29 May 2018 19:16:49 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F41889CD3 for ; Tue, 29 May 2018 19:16:28 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2018 12:16:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,457,1520924400"; d="scan'208";a="53215033" Received: from delly.ld.intel.com ([10.103.238.201]) by FMSMGA003.fm.intel.com with ESMTP; 29 May 2018 12:16:27 -0700 From: Lionel Landwerlin To: intel-gfx@lists.freedesktop.org Date: Tue, 29 May 2018 20:16:16 +0100 Message-Id: <20180529191618.19050-7-lionel.g.landwerlin@intel.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529191618.19050-1-lionel.g.landwerlin@intel.com> References: <20180529191618.19050-1-lionel.g.landwerlin@intel.com> Subject: [Intel-gfx] [PATCH v8 6/8] drm/i915: create context image vma in kernel context X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP We want to be able to modify other context images from the kernel context in a following commit. To be able to do this we need to map the context image into the kernel context's ppgtt. Signed-off-by: Lionel Landwerlin --- drivers/gpu/drm/i915/i915_gem_context.h | 1 + drivers/gpu/drm/i915/intel_lrc.c | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem_context.h b/drivers/gpu/drm/i915/i915_gem_context.h index f40d85448a28..9c313c2edb09 100644 --- a/drivers/gpu/drm/i915/i915_gem_context.h +++ b/drivers/gpu/drm/i915/i915_gem_context.h @@ -155,6 +155,7 @@ struct i915_gem_context { struct intel_context { struct i915_gem_context *gem_context; struct i915_vma *state; + struct i915_vma *kernel_state; /**/ struct intel_ring *ring; u32 *lrc_reg_state; u64 lrc_desc; diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c index 7314e548fb4e..8a49323f6672 100644 --- a/drivers/gpu/drm/i915/intel_lrc.c +++ b/drivers/gpu/drm/i915/intel_lrc.c @@ -2739,7 +2739,7 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, struct intel_context *ce) { struct drm_i915_gem_object *ctx_obj; - struct i915_vma *vma; + struct i915_vma *ggtt_vma, *ppgtt_vma; uint32_t context_size; struct intel_ring *ring; struct i915_timeline *timeline; @@ -2762,9 +2762,17 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, goto error_deref_obj; } - vma = i915_vma_instance(ctx_obj, &ctx->i915->ggtt.base, NULL); - if (IS_ERR(vma)) { - ret = PTR_ERR(vma); + ggtt_vma = i915_vma_instance(ctx_obj, &ctx->i915->ggtt.base, NULL); + if (IS_ERR(ggtt_vma)) { + ret = PTR_ERR(ggtt_vma); + goto error_deref_obj; + } + + ppgtt_vma = i915_vma_instance(ctx_obj, + &ctx->i915->kernel_context->ppgtt->base, + NULL); + if (IS_ERR(ppgtt_vma)) { + ret = PTR_ERR(ppgtt_vma); goto error_deref_obj; } @@ -2788,7 +2796,8 @@ static int execlists_context_deferred_alloc(struct i915_gem_context *ctx, } ce->ring = ring; - ce->state = vma; + ce->state = ggtt_vma; + ce->kernel_state = ppgtt_vma; return 0;