summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/v3d/v3d_drv.c
diff options
context:
space:
mode:
authorMaíra Canal <mcanal@igalia.com>2023-09-06 00:06:35 +0300
committerMaíra Canal <mcanal@igalia.com>2023-11-06 16:09:29 +0300
commit509433d8146c64ca9e0bcc370ec910821fffe80c (patch)
tree9a3e6880c111b48d78a87255198a1ff68e6700fc /drivers/gpu/drm/v3d/v3d_drv.c
parent09a93cc4f7d1893777f6b788bffe60d64e4d5df7 (diff)
downloadlinux-509433d8146c64ca9e0bcc370ec910821fffe80c.tar.xz
drm/v3d: Expose the total GPU usage stats on sysfs
The previous patch exposed the accumulated amount of active time per client for each V3D queue. But this doesn't provide a global notion of the GPU usage. Therefore, provide the accumulated amount of active time for each V3D queue (BIN, RENDER, CSD, TFU and CACHE_CLEAN), considering all the jobs submitted to the queue, independent of the client. This data is exposed through the sysfs interface, so that if the interface is queried at two different points of time the usage percentage of each of the queues can be calculated. Co-developed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Signed-off-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Signed-off-by: Maíra Canal <mcanal@igalia.com> Acked-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com> Reviewed-by: Melissa Wen <mwen@igalia.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230905213416.1290219-3-mcanal@igalia.com
Diffstat (limited to 'drivers/gpu/drm/v3d/v3d_drv.c')
-rw-r--r--drivers/gpu/drm/v3d/v3d_drv.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index 82984b4df2a2..44a1ca57d6a4 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -316,8 +316,14 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
if (ret)
goto irq_disable;
+ ret = v3d_sysfs_init(dev);
+ if (ret)
+ goto drm_unregister;
+
return 0;
+drm_unregister:
+ drm_dev_unregister(drm);
irq_disable:
v3d_irq_disable(v3d);
gem_destroy:
@@ -331,6 +337,9 @@ static void v3d_platform_drm_remove(struct platform_device *pdev)
{
struct drm_device *drm = platform_get_drvdata(pdev);
struct v3d_dev *v3d = to_v3d_dev(drm);
+ struct device *dev = &pdev->dev;
+
+ v3d_sysfs_destroy(dev);
drm_dev_unregister(drm);