From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by gabe.freedesktop.org (Postfix) with ESMTPS id 036DC10EC6C for ; Fri, 28 Apr 2023 07:18:42 +0000 (UTC) From: Bhanuprakash Modem To: igt-dev@lists.freedesktop.org Date: Fri, 28 Apr 2023 12:43:11 +0530 Message-Id: <20230428071350.2561575-9-bhanuprakash.modem@intel.com> In-Reply-To: <20230428071350.2561575-1-bhanuprakash.modem@intel.com> References: <20230428071350.2561575-1-bhanuprakash.modem@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [igt-dev] [i-g-t V5 08/47] lib/intel_batchbuffer: Reacquire offset for reloc allocator in reset path List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: From: Zbigniew Kempczyński On reset path we recreate bo for batch (to avoid stalls) so we should reacquire the offset too. At the moment simple allocator will return same offset (so unfortunately we'll stall), but for reloc allocator we'll get new one (so we avoid stall). I've noticed this is missing during xe_intel_bb test, where on reloc I noticed unexpected result (direct consequence of using same offset which pointed to old batch, not new one). Signed-off-by: Zbigniew Kempczyński --- lib/intel_batchbuffer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c index 7dbd6dd58..99b0b6158 100644 --- a/lib/intel_batchbuffer.c +++ b/lib/intel_batchbuffer.c @@ -1280,8 +1280,9 @@ void intel_bb_reset(struct intel_bb *ibb, bool purge_objects_cache) gem_close(ibb->fd, ibb->handle); ibb->handle = gem_create(ibb->fd, ibb->size); - /* Keep address for bb in reloc mode and RANDOM allocator */ - if (ibb->allocator_type == INTEL_ALLOCATOR_SIMPLE) + /* Reacquire offset for RELOC and SIMPLE */ + if (ibb->allocator_type == INTEL_ALLOCATOR_SIMPLE || + ibb->allocator_type == INTEL_ALLOCATOR_RELOC) ibb->batch_offset = __intel_bb_get_offset(ibb, ibb->handle, ibb->size, -- 2.40.0