From patchwork Fri Mar 5 11:12:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Roberts X-Patchwork-Id: 12118339 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 2B2D1C433DB for ; Fri, 5 Mar 2021 11:13:17 +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 BF56264FF0 for ; Fri, 5 Mar 2021 11:13:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF56264FF0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2305D6E1D6; Fri, 5 Mar 2021 11:13:16 +0000 (UTC) Received: from fanzine.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id 63A296E1CD; Fri, 5 Mar 2021 11:13:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=9IMtNTWCQ0cP72Gz+Jj7FrniCUzLw8jtsPxfq8pOVno=; b=RYvV9WjH3zRvC/dKbDBQUWJJx8TVrrcSw8BKvYDfXy3aUsEOCUUT0DuXITRnVQevNza28CWoTq2pEqoYoB10eZxi4A0wSE0LMyezTg6qCLJlRBC9Ptc4dSF0id6wHxUEreHwJN6KOQxxUlzPqwmpHA0BY/iRP6xrTzVknbdQ7WumsNT3cCDckSjoqSJfEEIrwLb933h7ZPHbG5Py4WFdRleIACEsE4l1MrGfsW81Z8Csvsl7ZH6h4qWhOAl/5fr98GXwNXLBEuOTTqPnHzIVEIyvYUKdJcTvTsh9HAdSm6wDPRJy9kd/cskTSpsLenUj+FJPdFHqUTrEpLbB7r4n3Q==; Received: from lneuilly-657-1-8-171.w81-250.abo.wanadoo.fr ([81.250.147.171] helo=masxo.routerf36dc8.com) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1lI8OO-0008UE-T9; Fri, 05 Mar 2021 12:13:13 +0100 From: Neil Roberts To: igt-dev@lists.freedesktop.org Subject: [PATCH i-g-t 1/2] lib/panfrost: Add a utility to madvise a buffer Date: Fri, 5 Mar 2021 12:12:45 +0100 Message-Id: <20210305111246.1381965-2-nroberts@igalia.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210305111246.1381965-1-nroberts@igalia.com> References: <20210305111246.1381965-1-nroberts@igalia.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: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Signed-off-by: Neil Roberts --- lib/igt_panfrost.c | 12 ++++++++++++ lib/igt_panfrost.h | 1 + 2 files changed, 13 insertions(+) diff --git a/lib/igt_panfrost.c b/lib/igt_panfrost.c index 8b0c2b77..ffce66a2 100644 --- a/lib/igt_panfrost.c +++ b/lib/igt_panfrost.c @@ -127,6 +127,18 @@ void igt_panfrost_bo_mmap(int fd, struct panfrost_bo *bo) igt_assert(bo->map); } +bool igt_panfrost_bo_madvise(int fd, struct panfrost_bo *bo, uint32_t madv) +{ + struct drm_panfrost_madvise madvise = { + .handle = bo->handle, + .madv = madv, + }; + + do_ioctl(fd, DRM_IOCTL_PANFROST_MADVISE, &madvise); + + return madvise.retained; +} + struct panfrost_submit *igt_panfrost_trivial_job(int fd, bool do_crash, int width, int height, uint32_t color) { struct panfrost_submit *submit; diff --git a/lib/igt_panfrost.h b/lib/igt_panfrost.h index cc7998dc..df326a6c 100644 --- a/lib/igt_panfrost.h +++ b/lib/igt_panfrost.h @@ -56,5 +56,6 @@ uint32_t igt_panfrost_get_param(int fd, int param); void *igt_panfrost_mmap_bo(int fd, uint32_t handle, uint32_t size, unsigned prot); void igt_panfrost_bo_mmap(int fd, struct panfrost_bo *bo); +bool igt_panfrost_bo_madvise(int fd, struct panfrost_bo *bo, uint32_t madv); #endif /* IGT_PANFROST_H */