Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp319557rdb; Fri, 5 Jan 2024 10:50:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFn36njEotdWCbcKzVpyhopiDFQWxaW/SqnQPgC5pkxHAxVucGIvvYPouHxb/CDUaSY3Dim X-Received: by 2002:ac8:4f48:0:b0:429:7636:240f with SMTP id i8-20020ac84f48000000b004297636240fmr1978563qtw.51.1704480621349; Fri, 05 Jan 2024 10:50:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704480621; cv=none; d=google.com; s=arc-20160816; b=x8657CKE9DqQDJXwH1ez6I3MrtIyhIpI/DE6y7B5fCO7ZduUo3APAzbynqJNjuYVIq ZA85Ki61W+FHQJWGPm0DQMjz8m+4THwkX0K3oSp7GECrMEWit0EB+H0brqjgmo8kAbPi VyCQGECU+yfgcJj2vQodPXhvGPw2LFISWsaB+majInf14U8lJNS9Vdpv+dPBJtEjQ5yx q9bqYoYHv/XKzpsZBaeyH3Y17ZbVL/pmBwNIFcykWHFkvfKrNIayqvLst8fRjLOoXf8k tcpZ4J+05vZOkAPLiGa+I47ZTo/aB6JPT2VnEgkNH8JF4mO2znMGt700OxUGaJnN3SbG dyAA== ARC-Message-Signature: i=1; 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=L3/d1THGEL44Ziw2nkhvhXG7wbk+5hEUSLEiMzWWVUA=; fh=5cel2jD5h+yPMXVwxbomyVhwojHUqATy6nFjd4aOh4o=; b=Iu5aS+ajO24D3tuRU53HTu8f2gJwVZmQwcDsr5pNHMr22B6V6ZY5NGNsYVtM2t0rTh iLuPiVoUabAZTUfLqoSRih5EYe7IJzGQHod4Y/k2VN21c4q4aK+pfr67t1XgtO9CjefM zxLRwqn0x66XVb8sghxWOSPJ0kWm/cvDfVDsM/zC+Qkb1ahQVBGVHWiowOoEjwridTwB xeF8BZ8v5svca7vdG15pqSof1ZYahi1aoyx27ZvsUztaVhiiPTP7mjEmyeWtnWKYq51k 2Kp5fYVVeXvtkmaC015L/25GE+5769HdAL8YiAL504aikKzJAqV2VlkBKWQrKxZvd/k7 H58g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=PLJ35Kr9; spf=pass (google.com: domain of linux-kernel+bounces-18251-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18251-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o14-20020a05622a138e00b0042780bde4b2si2333380qtk.666.2024.01.05.10.50.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Jan 2024 10:50:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-18251-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=PLJ35Kr9; spf=pass (google.com: domain of linux-kernel+bounces-18251-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-18251-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 17A0A1C21310 for ; Fri, 5 Jan 2024 18:50:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DC2E838F94; Fri, 5 Jan 2024 18:47:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="PLJ35Kr9" X-Original-To: linux-kernel@vger.kernel.org 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 C7E0838DD8 for ; Fri, 5 Jan 2024 18:47:06 +0000 (UTC) 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=1704480425; bh=n3hnUXa5rluasw0Ba4uFJ6xIbIY38qEptryUL9/Mlug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PLJ35Kr9M6RCca7l9xI++W2rK719IWUm+1nZ4aTWDZJEj67CVmMfoN6D6U6Gzq5Ld jL40ZlU06lMn4SdhmaKxSz2EaQ0jcvzq4zKKUTzi2kzu7jJQ8WP7Z5ZGmontcK+OLJ h/gzZRlOmajo6zE50Yrs9l3t+I3i1CVk/onosyKEv8UYcyxyvZYmC61QExPsK7HhXi opsaVm1g1AzUU4OQV/hlz3H+2XcjdB5WfU0iubq7Xz7hXNmgW48AQileJT5n+NXAyg qEPvVibHijLxHJwWa+IJlwdJtwGaull+JMULndzEE5HUQ2ZZOo4iYsEb7I84cnQIfh lrg1NFN8azc3g== Received: from workpc.. (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: dmitry.osipenko) by madrid.collaboradmins.com (Postfix) with ESMTPSA id 0A6B73782056; Fri, 5 Jan 2024 18:47:03 +0000 (UTC) From: Dmitry Osipenko To: David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , =?UTF-8?q?Christian=20K=C3=B6nig?= , Qiang Yu , Steven Price , Boris Brezillon , Emma Anholt , Melissa Wen Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel@collabora.com, virtualization@lists.linux-foundation.org Subject: [PATCH v19 13/30] drm/shmem-helper: Make drm_gem_shmem_get_pages() public Date: Fri, 5 Jan 2024 21:46:07 +0300 Message-ID: <20240105184624.508603-14-dmitry.osipenko@collabora.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240105184624.508603-1-dmitry.osipenko@collabora.com> References: <20240105184624.508603-1-dmitry.osipenko@collabora.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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); -- 2.43.0