[RFC PATCH v2 6/6] drm/panfrost/panthor: Take sparse objects into account for fdinfo

From: Adrián Larumbe
Date: Tue Mar 25 2025 - 22:17:03 EST


Make use of the new shmem helper for deciding whether a GEM object has
backing pages.

Signed-off-by: Adrián Larumbe <adrian.larumbe@xxxxxxxxxxxxx>
---
drivers/gpu/drm/panfrost/panfrost_gem.c | 2 +-
drivers/gpu/drm/panthor/panthor_gem.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c
index 0cda2c4e524f..2c6d73a7b5e5 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gem.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gem.c
@@ -200,7 +200,7 @@ static enum drm_gem_object_status panfrost_gem_status(struct drm_gem_object *obj
struct panfrost_gem_object *bo = to_panfrost_bo(obj);
enum drm_gem_object_status res = 0;

- if (bo->base.base.import_attach || bo->base.pages)
+ if (drm_gem_shmem_is_populated(&bo->base))
res |= DRM_GEM_OBJECT_RESIDENT;

if (bo->base.madv == PANFROST_MADV_DONTNEED)
diff --git a/drivers/gpu/drm/panthor/panthor_gem.c b/drivers/gpu/drm/panthor/panthor_gem.c
index 8244a4e6c2a2..48930fe7b398 100644
--- a/drivers/gpu/drm/panthor/panthor_gem.c
+++ b/drivers/gpu/drm/panthor/panthor_gem.c
@@ -155,7 +155,7 @@ 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)
+ if (drm_gem_shmem_is_populated(&bo->base))
res |= DRM_GEM_OBJECT_RESIDENT;

return res;
--
2.48.1