Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1608104rdb; Thu, 25 Jan 2024 00:08:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IGo5HvqgwRDxoHkGHD4Hy6ojjp6HCCBBWHJTaBSjh0MKzKNEXZmiW/buLbMKg1mTHmXsqvy X-Received: by 2002:a05:6358:d59f:b0:176:7d60:8426 with SMTP id ms31-20020a056358d59f00b001767d608426mr600344rwb.44.1706170127093; Thu, 25 Jan 2024 00:08:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706170127; cv=pass; d=google.com; s=arc-20160816; b=hNdd6LS49iN9IAv6szcYeyNbjPjy1uzxGJKfnGsWENgQMNo+g2/S4Y+g2lk8aIOCUj 3QVqgoC7yy+W3vGeIJSP8ZGypOetZK0jbweFZpIAu3P8454fVz05V6kJjqFuKBi9eMc0 iuQ5gPxqzmSHmgOSP/C8UR4h5RBhARzZ20PzkR5J0OIRmQZ72Z8t0YeeYLue0b5605U6 O96QiIGDO3jSM/l9uwFz/cuhbFaG6WGFcEJNCnb6tMkqJg2Jfok5zPA9OHddxoKJ5RHF PX9NowcnGW9EqN3uhLff8yRLkxvlhqm43IZuHiy5pH/NSH0n42FDGxgqWxutzGvX3ggA f27g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:organization:references :in-reply-to:message-id:subject:cc:to:from:date:dkim-signature; bh=r/H6Hj9rx8ZlLB8dBHp26oL92XwSD1KQlqGSfONMeZw=; fh=uxLNaPoPRUzmkUc1KOgGwCEU/bTSjK8Yed2Up6ovXLY=; b=iy8Dzz9gfRF/+AakmVO4KDJs4BLUkGbmGbN26W6qfqQL+Kz1eJt+I5yti9BpoFepuc oQUvHUjZ4T4VoFCMuRZbzg24flu5yT4RfVxqV6ScJtRnf/eExzqdP8v56L56o6Z2mLqp h2gjyuuHMQHW4Q+vY5nvqIq+0uDcFR3nCJ2hwlcdtuSSjZXO7FwGknuawDUrietjHwtH krVo12tRanChacSUfKXKrPiAqNU+icndn0e8iyoN8bvgnwj5l8+NuXgPzDqAO2bZzItn NCkiR+EH50neMFWJGUqFQyD2/O2DIRiAHloAL1Sq0QvG8hittXt8lkaI1eUt5h6B8ovZ fHbg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=nVwhPSFR; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-38128-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38128-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id fc34-20020a056a002e2200b006dba0e78b30si14809293pfb.259.2024.01.25.00.08.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 00:08:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-38128-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=nVwhPSFR; arc=pass (i=1 spf=pass spfdomain=collabora.com dkim=pass dkdomain=collabora.com dmarc=pass fromdomain=collabora.com); spf=pass (google.com: domain of linux-kernel+bounces-38128-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-38128-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 715C5B25E68 for ; Thu, 25 Jan 2024 08:03:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51E55199A0; Thu, 25 Jan 2024 08:02:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="nVwhPSFR" Received: from madrid.collaboradmins.com (madrid.collaboradmins.com [46.235.227.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7236A18B04 for ; Thu, 25 Jan 2024 08:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.235.227.194 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706169739; cv=none; b=LQ0Bk3CiXiVOQIYsqtTOF00UhY9G4Y0sIk9TFVpIGnZHA2iYxyHB6fL3rH5VciiL0p66Efh+Eo3nv1OReorlkJgoG83Ls3iXo/KndGuxCIw+veoyZyC7MFBjHRaZsCrG97grBcB9MCYcWmum1M6jkjw9PMm2Fyqrgv/GwSBl3X4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706169739; c=relaxed/simple; bh=O3U1kGKwJmoScP/bAbGpguM1vg+2nAo9bdmHRguFPsw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aKiVw9VNJXfF/C2dBysxLVeqhUuXEqooO7xPTFgkFFrUn4oLm0L+mwGerARZzrxbkv0UqFtWFLFrwxuucATl/PrmqXCLRpEcSXNq5wdHJFfeWJHfRTsmFiJPol3AJ/zkkNpGWAAMQ8hzVA3TM1BRwr3wUfPe5OXzwqCN5B4f7VA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=nVwhPSFR; arc=none smtp.client-ip=46.235.227.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1706169736; bh=O3U1kGKwJmoScP/bAbGpguM1vg+2nAo9bdmHRguFPsw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nVwhPSFRWtGZjapYQM3fa933PxX0Nh0QxWXeltwxS8c+/8z5uGYPmNTOJrlHh/vue L2tiVMr00xXFG2yH59O5ArcHn4Tttz+hFCYQlJsuD6keT91/R19HjV/ECBQUSrfu3s +oo5oHD5l/yAGF9Ob1TTsuTdvlBUdIaPYex1g+9j6BwkzJLTFMy3ZOZn7Q9TQ6V8rw 5BB/nehoXJA57E/6DHY5FXVIaO3XvoQwTLqK82IDp8dFca/aZJ/VXP1U3Wgu8/Lkvd yiDZzjdlso93bKSRFyEbrT2m6tCU3FlJqF6qzsMVFzxugknNcMswFKvUWleBqJAQgJ 4j+3sQy9vPQow== Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by madrid.collaboradmins.com (Postfix) with ESMTPSA id EDF4237820BD; Thu, 25 Jan 2024 08:02:14 +0000 (UTC) Date: Thu, 25 Jan 2024 09:02:13 +0100 From: Boris Brezillon To: Dmitry Osipenko Cc: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Christian =?UTF-8?B?S8O2bmln?= , Qiang Yu , Steven Price , Emma Anholt , Melissa Wen , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v19 13/30] drm/shmem-helper: Make drm_gem_shmem_get_pages() public Message-ID: <20240125090213.5a9e0853@collabora.com> In-Reply-To: <20240105184624.508603-14-dmitry.osipenko@collabora.com> References: <20240105184624.508603-1-dmitry.osipenko@collabora.com> <20240105184624.508603-14-dmitry.osipenko@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.2.0 (GTK 3.24.38; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 5 Jan 2024 21:46:07 +0300 Dmitry Osipenko wrote: > We're going to move away from having implicit get_pages() done by > get_pages_sgt() to simplify refcnt handling. Drivers will manage > get/put_pages() by themselves. Expose the drm_gem_shmem_get_pages() > in a public drm-shmem API. > > Signed-off-by: Dmitry Osipenko Reviewed-by: Boris Brezillon > --- > drivers/gpu/drm/drm_gem_shmem_helper.c | 10 +++++++++- > include/drm/drm_gem_shmem_helper.h | 1 + > 2 files changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c > index 799a3c5015ad..dc416a4bce1b 100644 > --- a/drivers/gpu/drm/drm_gem_shmem_helper.c > +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c > @@ -228,7 +228,14 @@ void drm_gem_shmem_put_pages_locked(struct drm_gem_shmem_object *shmem) > } > EXPORT_SYMBOL_GPL(drm_gem_shmem_put_pages_locked); > > -static int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem) > +/* > + * drm_gem_shmem_get_pages - Increase use count on the backing pages for a shmem GEM object > + * @shmem: shmem GEM object > + * > + * This function Increases the use count and allocates the backing pages if > + * use-count equals to zero. > + */ > +int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem) > { > int ret; > > @@ -241,6 +248,7 @@ static int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem) > > return ret; > } > +EXPORT_SYMBOL_GPL(drm_gem_shmem_get_pages); > > static int drm_gem_shmem_pin_locked(struct drm_gem_shmem_object *shmem) > { > diff --git a/include/drm/drm_gem_shmem_helper.h b/include/drm/drm_gem_shmem_helper.h > index 18020f653d7e..6dedc0739fbc 100644 > --- a/include/drm/drm_gem_shmem_helper.h > +++ b/include/drm/drm_gem_shmem_helper.h > @@ -110,6 +110,7 @@ struct drm_gem_shmem_object { > struct drm_gem_shmem_object *drm_gem_shmem_create(struct drm_device *dev, size_t size); > void drm_gem_shmem_free(struct drm_gem_shmem_object *shmem); > > +int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem); > void drm_gem_shmem_put_pages_locked(struct drm_gem_shmem_object *shmem); > int drm_gem_shmem_pin(struct drm_gem_shmem_object *shmem); > void drm_gem_shmem_unpin(struct drm_gem_shmem_object *shmem);