From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1D8DC4338F for ; Wed, 28 Jul 2021 23:07:42 +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 9A29560524 for ; Wed, 28 Jul 2021 23:07:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9A29560524 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 453CA6EB86; Wed, 28 Jul 2021 23:07:42 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1FA2A6E8E9; Wed, 28 Jul 2021 23:07:41 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10059"; a="199983751" X-IronPort-AV: E=Sophos;i="5.84,276,1620716400"; d="scan'208";a="199983751" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2021 16:07:38 -0700 X-IronPort-AV: E=Sophos;i="5.84,276,1620716400"; d="scan'208";a="464843201" Received: from adixit-mobl1.amr.corp.intel.com (HELO adixit-arch.intel.com) ([10.209.99.34]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jul 2021 16:07:38 -0700 Date: Wed, 28 Jul 2021 16:07:37 -0700 Message-ID: <87eebi3ume.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Matthew Auld In-Reply-To: <20210728103041.1669985-4-matthew.auld@intel.com> References: <20210728103041.1669985-1-matthew.auld@intel.com> <20210728103041.1669985-4-matthew.auld@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Subject: Re: [Intel-gfx] [PATCH i-g-t v2 04/11] lib/i915/gem_mman: add fixed mode to gem_mmap__cpu 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: , Cc: igt-dev@lists.freedesktop.org, Daniel Vetter , intel-gfx@lists.freedesktop.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Wed, 28 Jul 2021 03:30:34 -0700, Matthew Auld wrote: > > diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c > index 337d28fb..6f5e6d72 100644 > --- a/lib/i915/gem_mman.c > +++ b/lib/i915/gem_mman.c > @@ -434,7 +434,13 @@ void *gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset, > */ > void *__gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot) > { > - return __gem_mmap(fd, handle, offset, size, prot, 0); > + void *ptr; > + > + ptr = __gem_mmap(fd, handle, offset, size, prot, 0); > + if (!ptr) > + ptr = __gem_mmap_offset__fixed(fd, handle, offset, size, prot); > + > + return ptr; What about __gem_mmap__wc? Also shouldn't we just fix the __gem_mmap_offset fallback in __gem_mmap and that will take care of both __gem_mmap__cpu and __gem_mmap__wc? (I think it will actually also fix __gem_mmap__device_coherent and __gem_mmap__cpu_coherent but maybe we can still have those patches in this series especially if they save a couple of system calls). _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Wed, 28 Jul 2021 16:07:37 -0700 Message-ID: <87eebi3ume.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" In-Reply-To: <20210728103041.1669985-4-matthew.auld@intel.com> References: <20210728103041.1669985-1-matthew.auld@intel.com> <20210728103041.1669985-4-matthew.auld@intel.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Subject: Re: [igt-dev] [PATCH i-g-t v2 04/11] lib/i915/gem_mman: add fixed mode to gem_mmap__cpu List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" To: Matthew Auld Cc: igt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org List-ID: On Wed, 28 Jul 2021 03:30:34 -0700, Matthew Auld wrote: > > diff --git a/lib/i915/gem_mman.c b/lib/i915/gem_mman.c > index 337d28fb..6f5e6d72 100644 > --- a/lib/i915/gem_mman.c > +++ b/lib/i915/gem_mman.c > @@ -434,7 +434,13 @@ void *gem_mmap__device_coherent(int fd, uint32_t handle, uint64_t offset, > */ > void *__gem_mmap__cpu(int fd, uint32_t handle, uint64_t offset, uint64_t size, unsigned prot) > { > - return __gem_mmap(fd, handle, offset, size, prot, 0); > + void *ptr; > + > + ptr = __gem_mmap(fd, handle, offset, size, prot, 0); > + if (!ptr) > + ptr = __gem_mmap_offset__fixed(fd, handle, offset, size, prot); > + > + return ptr; What about __gem_mmap__wc? Also shouldn't we just fix the __gem_mmap_offset fallback in __gem_mmap and that will take care of both __gem_mmap__cpu and __gem_mmap__wc? (I think it will actually also fix __gem_mmap__device_coherent and __gem_mmap__cpu_coherent but maybe we can still have those patches in this series especially if they save a couple of system calls). _______________________________________________ igt-dev mailing list igt-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/igt-dev