From patchwork Tue Oct 1 05:53:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 11167945 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1E48C13BD for ; Tue, 1 Oct 2019 05:53:20 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C91DB2133F for ; Tue, 1 Oct 2019 05:53:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C91DB2133F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 85F5D6E072; Tue, 1 Oct 2019 05:53:18 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3EFC6E072 for ; Tue, 1 Oct 2019 05:53:17 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2019 22:53:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,570,1559545200"; d="scan'208";a="215954045" Received: from ramaling-i9x.iind.intel.com ([10.99.66.154]) by fmsmga004.fm.intel.com with ESMTP; 30 Sep 2019 22:53:15 -0700 From: Ramalingam C To: intel-gfx , Matthew Auld Date: Tue, 1 Oct 2019 11:23:07 +0530 Message-Id: <20191001055308.21643-1-ramalingam.c@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 1/2] drm/i915: Create dumb buffer from LMEM 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" When LMEM is supported, dumb buffer preferred to be created from LMEM. This is developed on top of LMEM Basics https://patchwork.freedesktop.org/series/67350/ v2: Parameters are reshuffled. [Chris] Signed-off-by: Ramalingam C cc: Matthew Auld --- drivers/gpu/drm/i915/i915_gem.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 82daaab022d8..48afc676fa8c 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -44,6 +44,7 @@ #include "gem/i915_gem_clflush.h" #include "gem/i915_gem_context.h" #include "gem/i915_gem_ioctls.h" +#include "gem/i915_gem_lmem.h" #include "gem/i915_gem_pm.h" #include "gt/intel_engine_user.h" #include "gt/intel_gt.h" @@ -157,6 +158,7 @@ i915_gem_phys_pwrite(struct drm_i915_gem_object *obj, static int i915_gem_create(struct drm_file *file, struct drm_i915_private *dev_priv, + enum intel_region_id mem_region, u64 *size_p, u32 *handle_p) { @@ -170,7 +172,12 @@ i915_gem_create(struct drm_file *file, return -EINVAL; /* Allocate the new object */ - obj = i915_gem_object_create_shmem(dev_priv, size); + if (mem_region == INTEL_MEMORY_LMEM) + obj = i915_gem_object_create_lmem(dev_priv, size, 0); + else if (mem_region == INTEL_MEMORY_STOLEN) + obj = i915_gem_object_create_stolen(dev_priv, size); + else + obj = i915_gem_object_create_shmem(dev_priv, size); if (IS_ERR(obj)) return PTR_ERR(obj); @@ -190,6 +197,7 @@ i915_gem_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args) { + enum intel_region_id mem_region = INTEL_MEMORY_UKNOWN; int cpp = DIV_ROUND_UP(args->bpp, 8); u32 format; @@ -216,7 +224,11 @@ i915_gem_dumb_create(struct drm_file *file, args->pitch = ALIGN(args->pitch, 4096); args->size = args->pitch * args->height; - return i915_gem_create(file, to_i915(dev), + + if (HAS_LMEM(to_i915(dev))) + mem_region = INTEL_MEMORY_LMEM; + + return i915_gem_create(file, to_i915(dev), mem_region, &args->size, &args->handle); } @@ -235,7 +247,7 @@ i915_gem_create_ioctl(struct drm_device *dev, void *data, i915_gem_flush_free_objects(dev_priv); - return i915_gem_create(file, dev_priv, + return i915_gem_create(file, dev_priv, INTEL_MEMORY_UKNOWN, &args->size, &args->handle); } From patchwork Tue Oct 1 05:53:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 11167947 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BAA0E15AB for ; Tue, 1 Oct 2019 05:53:21 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A2F222133F for ; Tue, 1 Oct 2019 05:53:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A2F222133F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AFA956E082; Tue, 1 Oct 2019 05:53:20 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 72BD86E082 for ; Tue, 1 Oct 2019 05:53:19 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Sep 2019 22:53:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,570,1559545200"; d="scan'208";a="215954051" Received: from ramaling-i9x.iind.intel.com ([10.99.66.154]) by fmsmga004.fm.intel.com with ESMTP; 30 Sep 2019 22:53:17 -0700 From: Ramalingam C To: intel-gfx , Matthew Auld Date: Tue, 1 Oct 2019 11:23:08 +0530 Message-Id: <20191001055308.21643-2-ramalingam.c@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191001055308.21643-1-ramalingam.c@intel.com> References: <20191001055308.21643-1-ramalingam.c@intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/2] drm/i915: FB backing gem obj should reside in LMEM 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" If Local memory is supported by hardware, we want framebuffer backing gem objects from local memory. pin_to_display is failed, if the backing obj is not from LMEM. This is developed on top of LMEM Basics https://patchwork.freedesktop.org/series/67350/ v2: memory regions are correctly assigned to obj->memory_regions [tvrtko] migration failure is reported as debug log [Tvrtko] v3: Migration is dropped. only error is reported [Daniel] mem region check is move to pin_to_display [Chris] cc: Matthew Auld Signed-off-by: Ramalingam C --- drivers/gpu/drm/i915/gem/i915_gem_domain.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_domain.c b/drivers/gpu/drm/i915/gem/i915_gem_domain.c index 55c3ab59e3aa..c74d0796b142 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_domain.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_domain.c @@ -419,11 +419,19 @@ i915_gem_object_pin_to_display_plane(struct drm_i915_gem_object *obj, const struct i915_ggtt_view *view, unsigned int flags) { + struct drm_i915_private *dev_priv = to_i915(obj->base.dev); struct i915_vma *vma; int ret; assert_object_held(obj); + /* GEM Obj for frame buffer is expected to be in LMEM. */ + if (HAS_LMEM(dev_priv)) + if (obj->mm.region->type != INTEL_LMEM) { + DRM_DEBUG_KMS("OBJ is not from LMEM\n"); + return ERR_PTR(-EINVAL); + } + /* * The display engine is not coherent with the LLC cache on gen6. As * a result, we make sure that the pinning that is about to occur is