From patchwork Wed Feb 5 11:40:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ramalingam C X-Patchwork-Id: 11366159 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 9D6D592A for ; Wed, 5 Feb 2020 11:40:16 +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 84FCF21741 for ; Wed, 5 Feb 2020 11:40:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84FCF21741 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 C15E089A59; Wed, 5 Feb 2020 11:40:14 +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 4EA0789A59 for ; Wed, 5 Feb 2020 11:40:13 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Feb 2020 03:40:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,405,1574150400"; d="scan'208";a="235556919" Received: from ramaling-i9x.iind.intel.com ([10.99.66.154]) by orsmga006.jf.intel.com with ESMTP; 05 Feb 2020 03:40:10 -0800 From: Ramalingam C To: intel-gfx Date: Wed, 5 Feb 2020 17:10:19 +0530 Message-Id: <20200205114019.10900-1-ramalingam.c@intel.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/i915: align dumb buffer stride to page_sz of the region X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 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 stride of the dumb buffer requested is greater than the primary plane's max stride, then we align the stride to the page size. But the page size was hard coded for 4096. With the lmem addition, lets align the stride to the page size of the memory region that will be used for dumb buffer. Signed-off-by: Ramalingam C cc: Chris Wilson --- drivers/gpu/drm/i915/i915_gem.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index a712e60b016a..0f01396ca24e 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -239,8 +239,9 @@ i915_gem_dumb_create(struct drm_file *file, struct drm_device *dev, struct drm_mode_create_dumb *args) { - enum intel_memory_type mem_type; int cpp = DIV_ROUND_UP(args->bpp, 8); + enum intel_memory_type mem_type; + struct intel_memory_region *mr; u32 format; switch (cpp) { @@ -260,24 +261,21 @@ i915_gem_dumb_create(struct drm_file *file, /* have to work out size/pitch and return them */ args->pitch = ALIGN(args->width * cpp, 64); + mem_type = INTEL_MEMORY_SYSTEM; + if (HAS_LMEM(to_i915(dev))) + mem_type = INTEL_MEMORY_LOCAL; + mr = intel_memory_region_by_type(to_i915(dev), mem_type); + /* align stride to page size so that we can remap */ if (args->pitch > intel_plane_fb_max_stride(to_i915(dev), format, DRM_FORMAT_MOD_LINEAR)) - args->pitch = ALIGN(args->pitch, 4096); + args->pitch = ALIGN(args->pitch, mr->min_page_size); if (args->pitch < args->width) return -EINVAL; args->size = mul_u32_u32(args->pitch, args->height); - - mem_type = INTEL_MEMORY_SYSTEM; - if (HAS_LMEM(to_i915(dev))) - mem_type = INTEL_MEMORY_LOCAL; - - return i915_gem_create(file, - intel_memory_region_by_type(to_i915(dev), - mem_type), - &args->size, &args->handle); + return i915_gem_create(file, mr, &args->size, &args->handle); } /**