From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id B5DD510EAB7 for ; Thu, 27 Apr 2023 06:41:35 +0000 (UTC) Message-ID: <963562a5-2148-a674-788e-69f6b94c4628@intel.com> Date: Thu, 27 Apr 2023 12:11:16 +0530 Content-Language: en-US To: =?UTF-8?Q?Zbigniew_Kempczy=c5=84ski?= , References: <20230425154017.374465-1-zbigniew.kempczynski@intel.com> <20230425154017.374465-15-zbigniew.kempczynski@intel.com> From: "Modem, Bhanuprakash" In-Reply-To: <20230425154017.374465-15-zbigniew.kempczynski@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Subject: Re: [igt-dev] [PATCH i-g-t v6 14/15] lib/igt_draw: Pass region while building intel_buf from flink List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: On Tue-25-04-2023 09:10 pm, Zbigniew Kempczyński wrote: > For i915 region doesn't matter but for xe we need to be more strict and > region aware. This is related to size and alignment constraints. As we > don't have information about flink buffer origin let's assume region > is vram if possible, otherwise choose system region. > > Signed-off-by: Zbigniew Kempczyński LGTM Reviewed-by: Bhanuprakash Modem > --- > lib/igt_draw.c | 14 +++++++++++--- > 1 file changed, 11 insertions(+), 3 deletions(-) > > diff --git a/lib/igt_draw.c b/lib/igt_draw.c > index ac512fac5a..c5f2fdfe2b 100644 > --- a/lib/igt_draw.c > +++ b/lib/igt_draw.c > @@ -37,6 +37,7 @@ > #include "i915/gem_create.h" > #include "i915/gem_mman.h" > #include "i915/intel_mocs.h" > +#include "xe/xe_query.h" > > #ifndef PAGE_ALIGN > #ifndef PAGE_SIZE > @@ -634,17 +635,24 @@ static struct intel_buf *create_buf(int fd, struct buf_ops *bops, > struct buf_data *from, uint32_t tiling) > { > struct intel_buf *buf; > + enum intel_driver driver = buf_ops_get_driver(bops); > uint32_t handle, name, width, height; > + uint64_t region = driver == INTEL_DRIVER_XE ? vram_if_possible(fd, 0) : -1; > + uint64_t size = from->size; > > width = from->stride / (from->bpp / 8); > height = from->size / from->stride; > + if (driver == INTEL_DRIVER_XE) > + size = ALIGN(size, xe_get_default_alignment(fd)); > > name = gem_flink(fd, from->handle); > handle = gem_open(fd, name); > > - buf = intel_buf_create_using_handle(bops, handle, > - width, height, from->bpp, 0, > - tiling, 0); > + buf = intel_buf_create_full(bops, handle, > + width, height, from->bpp, 0, > + tiling, 0, > + size, 0, > + region); > > /* Make sure we close handle on destroy path */ > intel_buf_set_ownership(buf, true);