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=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS 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 E10B4C43381 for ; Mon, 1 Apr 2019 18:22:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 AE9AD20883 for ; Mon, 1 Apr 2019 18:22:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SF55WxV8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AE9AD20883 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=anholt.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type:Cc: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:To:From:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mrASVXxKNa8n1Cv4bo/xT9v+a4yH7yI3Ufi424PvpKY=; b=SF55WxV8m4NCi/2TQA67ctBj4 v+EyyM73swpTmT62Tj0W81cNkI/twmoW5D47eseY65LsSIuRoEwVrtQxfTfY17iFBXQb1jQILZIRN yOlu7QMoIsyXCqEanttPJCtLHlKsOZWYs1s38UcXKAQzOQ1QqT4u+XVivnZARz+Q4XyXYD8RjG/1P msodrERAP/UZMBnAMS32GMpUXXD1L9I3fFfxgmoFxiNzkSlRkVSy99tJgK3o7tmyRzb0jCgSTqfXj sS2yPNyU63vbc7ho0V6vyzsxa5kZrIKcDv/FnuVgqZ69Jl9pigHaIOzRf9v2eMmvhom3gUcuiI7nq HXKTvRcvg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1Ze-0000sr-48; Mon, 01 Apr 2019 18:22:22 +0000 Received: from anholt.net ([50.246.234.109]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hB1Zb-0000s2-Cd for linux-arm-kernel@lists.infradead.org; Mon, 01 Apr 2019 18:22:21 +0000 Received: from localhost (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id E893610A0220; Mon, 1 Apr 2019 11:22:17 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at anholt.net Received: from anholt.net ([127.0.0.1]) by localhost (kingsolver.anholt.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id wRZ8IiiYAfYF; Mon, 1 Apr 2019 11:22:15 -0700 (PDT) Received: from eliezer.anholt.net (localhost [127.0.0.1]) by anholt.net (Postfix) with ESMTP id 90DCD10A278C; Mon, 1 Apr 2019 11:22:15 -0700 (PDT) Received: by eliezer.anholt.net (Postfix, from userid 1000) id 2DDF02FE33BA; Mon, 1 Apr 2019 11:22:15 -0700 (PDT) From: Eric Anholt To: Rob Herring , Daniel Vetter Subject: Re: [PATCH v2 2/3] drm: Add a drm_gem_objects_lookup helper In-Reply-To: References: <20190401074730.12241-1-robh@kernel.org> <20190401074730.12241-3-robh@kernel.org> User-Agent: Notmuch/0.22.2+1~gb0bcfaa (http://notmuchmail.org) Emacs/25.2.2 (x86_64-pc-linux-gnu) Date: Mon, 01 Apr 2019 11:22:14 -0700 Message-ID: <87sgv14mcp.fsf@anholt.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_112219_483865_5DC6C7FF X-CRM114-Status: GOOD ( 20.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sean Paul , Lyude Paul , Neil Armstrong , Maxime Ripard , Maarten Lankhorst , Joerg Roedel , Will Deacon , Linux Kernel Mailing List , dri-devel , David Airlie , "list@263.net:IOMMU DRIVERS , Joerg Roedel , " , Alyssa Rosenzweig , Robin Murphy , Linux ARM Content-Type: multipart/mixed; boundary="===============3620535060174784321==" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org --===============3620535060174784321== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Rob Herring writes: > On Mon, Apr 1, 2019 at 8:07 AM Daniel Vetter wrote: >> >> On Mon, Apr 1, 2019 at 9:47 AM Rob Herring wrote: >> > >> > Similar to the single handle drm_gem_object_lookup(), >> > drm_gem_objects_lookup() takes an array of handles and returns an array >> > of GEM objects. >> > >> > Cc: Maarten Lankhorst >> > Cc: Maxime Ripard >> > Cc: Sean Paul >> > Cc: David Airlie >> > Cc: Daniel Vetter >> > Signed-off-by: Rob Herring >> > --- >> > drivers/gpu/drm/drm_gem.c | 46 +++++++++++++++++++++++++++++++-------- >> > include/drm/drm_gem.h | 2 ++ >> > 2 files changed, 39 insertions(+), 9 deletions(-) >> > >> > diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c >> > index 388b3742e562..5c9bff45e5e1 100644 >> > --- a/drivers/gpu/drm/drm_gem.c >> > +++ b/drivers/gpu/drm/drm_gem.c >> > @@ -663,6 +663,42 @@ void drm_gem_put_pages(struct drm_gem_object *obj, struct page **pages, >> > } >> > EXPORT_SYMBOL(drm_gem_put_pages); >> > >> > +/** >> > + * drm_gem_objects_lookup - look up GEM objects from an array of handles >> > + * @filp: DRM file private date >> > + * @handle: pointer to array of userspace handle >> > + * @count: size of handle array >> > + * @objs: pointer to array of drm_gem_object pointers >> > + * >> > + * Returns: >> > + * >> > + * @objs filled in with GEM object pointers. -ENOENT is returned on a lookup >> > + * failure. 0 is returned on success. >> >> Bonus points for adding references between the array and normal lookup >> functions to guide people around. Also a comment that the buffers need >> to be released with drm_gem_object_put(). >> >> > + */ >> > +int drm_gem_objects_lookup(struct drm_file *filp, u32 *handle, int count, >> > + struct drm_gem_object **objs) >> >> With a pointer to a pointer I'd expect this function to do the >> allocation, but it doesn't. Normal pointer is enough to pass an array. >> Also maybe make the handle pointer >> const, so it's clear that it's an input parameter. > > I thought about doing the allocation here, but then I couldn't > implement the single drm_gem_object_lookup() using this function. > Maybe I can refactor in 3 functions making this one a static function. FWIW, I was thinking for v3d that I'd probably add a helper that took in the user's pointer to handles :) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAlyiVtYACgkQtdYpNtH8 nuiMBg//VvQsbg5XwF+KRXj9otwDpkUrrGoK72c+wmoCBIWMPgV9fHi17iVul/8Y uoIq7rGWoNnPjMMoj50AecbF/Z3848xgsXtwzCSiCSqyEzt9GWHZotNCjUKk+Usu fvSCW2kMlow9LPPG9XcVqxT7+79fWse7d5bL6nh44rkFYynMtbyV4zYFdPgh2UyP 8IXYtK8W265MCJiLWvMlTxzdoryX7xygVqDnbcqX/bS53zpAVseNar7cxV4I4CK8 xoOv09Np3SmAVN0OGcJe0JjHV4iRUHHldtHqvddYl1WMAGBPH21fir4Qfdid9DAb atb6QzY/OcS3AZ8hRYm4Lm//WPHfbza6AclnCK9QmsierhFxVRECZED5rUieK0kA KUYCfNhgB8dxks3lKuYpMOtRXGEbnpiKQsJE1WGiKkWhZvuilb1JCQISZXf7BV93 32zupQg60EXYs+qNFCa2m9w7tCTqia2F0A52/zDB2nXjDMV0umnMzsoPfaqYCywX nKjqknOC7apeMgEl/WvEXDulLTF8Uo2ZN5Nr6cjoZf3aR2YFsMlhDUJ/z/KYIYeK JpTowKxpwO3Je7WIQhhDuf7PyiIhUZEy3rxegXKaiDUySuE4mK2p7Nu3F3uAeu2K 8Ou5n5U5sv5PQMdzpVRE2KjxLdti7fd8osmkupb4J/1MYdsmyms= =q8QO -----END PGP SIGNATURE----- --=-=-=-- --===============3620535060174784321== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel --===============3620535060174784321==--