diff mbox series

[5/6] drm/i915: Update shared stats to use the new gem helper

Message ID 20240130161235.3237122-6-alexander.deucher@amd.com (mailing list archive)
State New, archived
Headers show
Series fdinfo shared stats | expand

Commit Message

Alex Deucher Jan. 30, 2024, 4:12 p.m. UTC
Switch to using the new gem shared memory stats helper
rather than hand rolling it.

Link: https://lore.kernel.org/all/20231207180225.439482-1-alexander.deucher@amd.com/
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---
 drivers/gpu/drm/i915/i915_drm_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Tvrtko Ursulin Jan. 30, 2024, 4:26 p.m. UTC | #1
On 30/01/2024 16:12, Alex Deucher wrote:
> Switch to using the new gem shared memory stats helper
> rather than hand rolling it.
> 
> Link: https://lore.kernel.org/all/20231207180225.439482-1-alexander.deucher@amd.com/
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>   drivers/gpu/drm/i915/i915_drm_client.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drm_client.c b/drivers/gpu/drm/i915/i915_drm_client.c
> index fa6852713bee..f58682505491 100644
> --- a/drivers/gpu/drm/i915/i915_drm_client.c
> +++ b/drivers/gpu/drm/i915/i915_drm_client.c
> @@ -53,7 +53,7 @@ obj_meminfo(struct drm_i915_gem_object *obj,
>   					obj->mm.region->id : INTEL_REGION_SMEM;
>   	const u64 sz = obj->base.size;
>   
> -	if (obj->base.handle_count > 1)
> +	if (drm_gem_object_is_shared_for_memory_stats(&obj->base))
>   		stats[id].shared += sz;
>   	else
>   		stats[id].private += sz;

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Good that you remembered this story, I completely forgot!

Regards,

Tvrtko
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_drm_client.c b/drivers/gpu/drm/i915/i915_drm_client.c
index fa6852713bee..f58682505491 100644
--- a/drivers/gpu/drm/i915/i915_drm_client.c
+++ b/drivers/gpu/drm/i915/i915_drm_client.c
@@ -53,7 +53,7 @@  obj_meminfo(struct drm_i915_gem_object *obj,
 					obj->mm.region->id : INTEL_REGION_SMEM;
 	const u64 sz = obj->base.size;
 
-	if (obj->base.handle_count > 1)
+	if (drm_gem_object_is_shared_for_memory_stats(&obj->base))
 		stats[id].shared += sz;
 	else
 		stats[id].private += sz;