From patchwork Fri Aug 2 08:38:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Shyti X-Patchwork-Id: 13751253 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 14577C3DA4A for ; Fri, 2 Aug 2024 08:39:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 968AB10E9B9; Fri, 2 Aug 2024 08:39:24 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="kH6MU9IM"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id B9C7910E9B8; Fri, 2 Aug 2024 08:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1722587963; x=1754123963; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z5OFWfv2GShnV6R7ss7YMCEmoj481tWWJZcJ7gkJC+g=; b=kH6MU9IMhwoxibROvy0DxjzmncVWvpkEJ+7OqO4vNB1nCFu62qCozTQx Hy0BD6zYeoFEHVuA6E7ma9yujldKbPKeBZnAIz5QuRuBd9oNUpw/VeNgc rgGecaABpWTuuSCWik/Gv93GOt4qmv6M/xY9bwUr6vRAaLw1LT0/dCv+t zsX4vv3w3sY/sW+8V5Pr37IaYfcYxJkIEInfkczV/eSEqS/UMzEYGRuMO /c797VGe9RyAwcZQWV3p0JtKbvcq9unyBVLkdM1+aZXlc6SICywj6Bv6+ A3YmakO4Y1L9NaFJCoAEYKDQXQJ6uD77QIKdGwdLaiuXtZtqnUtTW1MXw Q==; X-CSE-ConnectionGUID: lxismfhrSueLLtqq2scdhA== X-CSE-MsgGUID: fFIP1fCTSGa9QUSUcZn7Pw== X-IronPort-AV: E=McAfee;i="6700,10204,11151"; a="23513519" X-IronPort-AV: E=Sophos;i="6.09,257,1716274800"; d="scan'208";a="23513519" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2024 01:39:22 -0700 X-CSE-ConnectionGUID: rCIQy/y+TqygnXE7yhO33g== X-CSE-MsgGUID: i42fV2HpTRK5kv1VLDDGlA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,257,1716274800"; d="scan'208";a="59443698" Received: from pgcooper-mobl3.ger.corp.intel.com (HELO intel.com) ([10.245.245.86]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2024 01:39:19 -0700 From: Andi Shyti To: intel-gfx , dri-devel Cc: Jann Horn , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Jann Horn , Chris Wilson , Krzysztof Niemiec , Andi Shyti , Matthew Auld , Andi Shyti Subject: [PATCH 1/2] drm/i915/gem: Adjust vma offset for framebuffer mmap offset Date: Fri, 2 Aug 2024 10:38:49 +0200 Message-ID: <20240802083850.103694-2-andi.shyti@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240802083850.103694-1-andi.shyti@linux.intel.com> References: <20240802083850.103694-1-andi.shyti@linux.intel.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" When mapping a framebuffer object, the virtual memory area (VMA) offset ('vm_pgoff') should be adjusted by the start of the 'vma_node' associated with the object. This ensures that the VMA offset is correctly aligned with the corresponding offset within the GGTT aperture. Increment vm_pgoff by the start of the vma_node with the offset= provided by the user. Suggested-by: Chris Wilson Signed-off-by: Andi Shyti Reviewed-by: Jonathan Cavitt Reviewed-by: Rodrigo Vivi --- drivers/gpu/drm/i915/gem/i915_gem_mman.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c index a2195e28b625..ce10dd259812 100644 --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c @@ -1084,6 +1084,8 @@ int i915_gem_fb_mmap(struct drm_i915_gem_object *obj, struct vm_area_struct *vma mmo = mmap_offset_attach(obj, mmap_type, NULL); if (IS_ERR(mmo)) return PTR_ERR(mmo); + + vma->vm_pgoff += drm_vma_node_start(&mmo->vma_node); } /*