]> Git Repo - J-linux.git/blob - drivers/gpu/drm/xe/xe_drm_client.h
Merge tag 'vfs-6.13-rc7.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
[J-linux.git] / drivers / gpu / drm / xe / xe_drm_client.h
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2023 Intel Corporation
4  */
5
6 #ifndef _XE_DRM_CLIENT_H_
7 #define _XE_DRM_CLIENT_H_
8
9 #include <linux/kref.h>
10 #include <linux/list.h>
11 #include <linux/pid.h>
12 #include <linux/rcupdate.h>
13 #include <linux/sched.h>
14 #include <linux/spinlock.h>
15
16 struct drm_file;
17 struct drm_printer;
18 struct xe_bo;
19
20 struct xe_drm_client {
21         struct kref kref;
22         unsigned int id;
23 #ifdef CONFIG_PROC_FS
24         /**
25          * @bos_lock: lock protecting @bos_list
26          */
27         spinlock_t bos_lock;
28         /**
29          * @bos_list: list of bos created by this client
30          *
31          * Protected by @bos_lock.
32          */
33         struct list_head bos_list;
34 #endif
35 };
36
37         static inline struct xe_drm_client *
38 xe_drm_client_get(struct xe_drm_client *client)
39 {
40         kref_get(&client->kref);
41         return client;
42 }
43
44 void __xe_drm_client_free(struct kref *kref);
45
46 static inline void xe_drm_client_put(struct xe_drm_client *client)
47 {
48         kref_put(&client->kref, __xe_drm_client_free);
49 }
50
51 struct xe_drm_client *xe_drm_client_alloc(void);
52 static inline struct xe_drm_client *
53 xe_drm_client_get(struct xe_drm_client *client);
54 static inline void xe_drm_client_put(struct xe_drm_client *client);
55 #ifdef CONFIG_PROC_FS
56 void xe_drm_client_fdinfo(struct drm_printer *p, struct drm_file *file);
57 void xe_drm_client_add_bo(struct xe_drm_client *client,
58                           struct xe_bo *bo);
59 void xe_drm_client_remove_bo(struct xe_bo *bo);
60 #else
61 static inline void xe_drm_client_add_bo(struct xe_drm_client *client,
62                                         struct xe_bo *bo)
63 {
64 }
65
66 static inline void xe_drm_client_remove_bo(struct xe_bo *bo)
67 {
68 }
69 #endif
70 #endif
This page took 0.030425 seconds and 4 git commands to generate.