summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xe/xe_device.c
diff options
context:
space:
mode:
authorTejas Upadhyay <tejas.upadhyay@intel.com>2023-09-14 14:55:14 +0300
committerRodrigo Vivi <rodrigo.vivi@intel.com>2023-12-21 19:41:14 +0300
commit8f965392c4d915195307979640295189eec94df4 (patch)
treea0ac3d18ee4a1a64878079e00536a0371ccf5d79 /drivers/gpu/drm/xe/xe_device.c
parentcb90d469183cc8335d646484d66bd3c3643683cc (diff)
downloadlinux-8f965392c4d915195307979640295189eec94df4.tar.xz
drm/xe: Add drm-client infrastructure
Add drm-client infrastructure to record stats of consumption done by individual drm client. V2: - Typo - CI Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Signed-off-by: Tejas Upadhyay <tejas.upadhyay@intel.com> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Diffstat (limited to 'drivers/gpu/drm/xe/xe_device.c')
-rw-r--r--drivers/gpu/drm/xe/xe_device.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 89bf926bc0f3..612dfc92e948 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -17,6 +17,7 @@
#include "xe_bo.h"
#include "xe_debugfs.h"
#include "xe_dma_buf.h"
+#include "xe_drm_client.h"
#include "xe_drv.h"
#include "xe_exec_queue.h"
#include "xe_exec.h"
@@ -42,13 +43,24 @@ struct lockdep_map xe_device_mem_access_lockdep_map = {
static int xe_file_open(struct drm_device *dev, struct drm_file *file)
{
+ struct xe_device *xe = to_xe_device(dev);
+ struct xe_drm_client *client;
struct xe_file *xef;
+ int ret = -ENOMEM;
xef = kzalloc(sizeof(*xef), GFP_KERNEL);
if (!xef)
- return -ENOMEM;
+ return ret;
+
+ client = xe_drm_client_alloc();
+ if (!client) {
+ kfree(xef);
+ return ret;
+ }
xef->drm = file;
+ xef->client = client;
+ xef->xe = xe;
mutex_init(&xef->vm.lock);
xa_init_flags(&xef->vm.xa, XA_FLAGS_ALLOC1);
@@ -88,6 +100,7 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file)
xa_destroy(&xef->vm.xa);
mutex_destroy(&xef->vm.lock);
+ xe_drm_client_put(xef->client);
kfree(xef);
}