From patchwork Tue Sep 3 20:25:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Adri=C3=A1n_Larumbe?= X-Patchwork-Id: 13789280 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 F3A241D58A4; Tue, 3 Sep 2024 20:26:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725395183; cv=pass; b=RKVtIg5xDVKAjhKVat/gUYXUHrAep8A9xP/u3UEDxflBeY8eKmyQbFRNexeA9lNaC9vlFEjmA3qwt5AbfiDEZAVfMXR6SWLZAmdNPOcoebAKH4uGhz/wY02r5mwmA5zzKS5vm8NuxP4+aQeol2CAJvpKScs99TfyAnem1CfwKCw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725395183; c=relaxed/simple; bh=XGPb9LbdVs7JugQ3H1n47tAaUHx6JRllnNEKY/oQUiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=cMtHuN7Nv3yXT5jjPmPFz/iXa20l1rZE8dCrhMlVrQKqsooTwnB04Gwi9o2/don0sfm8BwdHXBXPQQd/5s9kakd9zilpzenGAIieirOIzIvP+DBwyV8CyN2AZd7asXFhkWxHCv1P+Zxb4K5nxHZdchIUgZuc5xfRtAWh/A6DgHs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b=Zqr/jTHb; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=adrian.larumbe@collabora.com header.b="Zqr/jTHb" ARC-Seal: i=1; a=rsa-sha256; t=1725395164; cv=none; d=zohomail.com; s=zohoarc; b=PHJigLn3btVtrMZHHeuZViEjw7MJrDS5XPk1DQVzOVE/r99LpyTge5UIkVjAORfo9AhFKq7ElqyPmAB8P7NhYxtmSBDw05xNCY9e1tjdIoDY9B3F40G26rXGk2PFSycNgY3jS8IClRE4y2f2ThKobiDXr0YIpFoAvNieO0nNwKw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725395164; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=PrtZYtmwgxZHb8XgHEA0W+MTLGH+E4kIm30ubb9dtB4=; b=H9Ix7wUYZKgiQhxkB2nLq/Ljgr84mC100ku28HyJBtYBd6eBqIDxGptJTz2+JHrlgDNIOYHahcYO5v6D2w6IgK8ghOJjE2vVFZeKpWjr3upLnnZqEdsbC/EbCh9UT9y5F8wELGj0nP6f3GjO+n/lA7u/rUHSIs+6CnQtPTQ0mw4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.larumbe@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1725395164; s=zohomail; d=collabora.com; i=adrian.larumbe@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=PrtZYtmwgxZHb8XgHEA0W+MTLGH+E4kIm30ubb9dtB4=; b=Zqr/jTHbOzr2DkmD1SvqxnEvWJeLmfy5Jiju+NeBACjDUJ4jOJBzXDB+iC9a5JhW MupztvuOlbYB+ToE2k4kzyDOwMSSuYWelVHIIMKXe1DyOgNenlkG6ONeZvJ5RwRyVEd haXe8eGiFGI9i0okdDXwCOL73B070STyPu38Hfw8= Received: by mx.zohomail.com with SMTPS id 1725395162731400.01079093347084; Tue, 3 Sep 2024 13:26:02 -0700 (PDT) From: =?utf-8?q?Adri=C3=A1n_Larumbe?= To: Boris Brezillon , Steven Price , Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= Cc: kernel@collabora.com, =?utf-8?q?Adri=C3=A1n_Larumbe?= , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org Subject: [PATCH v5 3/4] drm/panthor: enable fdinfo for memory stats Date: Tue, 3 Sep 2024 21:25:37 +0100 Message-ID: <20240903202541.430225-4-adrian.larumbe@collabora.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240903202541.430225-1-adrian.larumbe@collabora.com> References: <20240903202541.430225-1-adrian.larumbe@collabora.com> Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Implement drm object's status callback. Also, we consider a PRIME imported BO to be resident if its matching dma_buf has an open attachment, which means its backing storage had already been allocated. Signed-off-by: Adrián Larumbe Reviewed-by: Liviu Dudau Reviewed-by: Boris Brezillon --- drivers/gpu/drm/panthor/panthor_gem.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c index 38f560864879..c60b599665d8 100644 --- a/drivers/gpu/drm/panthor/panthor_gem.c +++ b/drivers/gpu/drm/panthor/panthor_gem.c @@ -145,6 +145,17 @@ panthor_gem_prime_export(struct drm_gem_object *obj, int flags) return drm_gem_prime_export(obj, flags); } +static enum drm_gem_object_status panthor_gem_status(struct drm_gem_object *obj) +{ + struct panthor_gem_object *bo = to_panthor_bo(obj); + enum drm_gem_object_status res = 0; + + if (bo->base.base.import_attach || bo->base.pages) + res |= DRM_GEM_OBJECT_RESIDENT; + + return res; +} + static const struct drm_gem_object_funcs panthor_gem_funcs = { .free = panthor_gem_free_object, .print_info = drm_gem_shmem_object_print_info, @@ -154,6 +165,7 @@ static const struct drm_gem_object_funcs panthor_gem_funcs = { .vmap = drm_gem_shmem_object_vmap, .vunmap = drm_gem_shmem_object_vunmap, .mmap = panthor_gem_mmap, + .status = panthor_gem_status, .export = panthor_gem_prime_export, .vm_ops = &drm_gem_shmem_vm_ops, };