0001
0002
0003
0004
0005
0006 #ifndef __I915_DRM_CLIENT_H__
0007 #define __I915_DRM_CLIENT_H__
0008
0009 #include <linux/kref.h>
0010 #include <linux/list.h>
0011 #include <linux/spinlock.h>
0012 #include <linux/xarray.h>
0013
0014 #include <uapi/drm/i915_drm.h>
0015
0016 #define I915_LAST_UABI_ENGINE_CLASS I915_ENGINE_CLASS_COMPUTE
0017
0018 struct drm_i915_private;
0019
0020 struct i915_drm_clients {
0021 struct drm_i915_private *i915;
0022
0023 struct xarray xarray;
0024 u32 next_id;
0025 };
0026
0027 struct i915_drm_client {
0028 struct kref kref;
0029
0030 unsigned int id;
0031
0032 spinlock_t ctx_lock;
0033 struct list_head ctx_list;
0034
0035 struct i915_drm_clients *clients;
0036
0037
0038
0039
0040 atomic64_t past_runtime[I915_LAST_UABI_ENGINE_CLASS + 1];
0041 };
0042
0043 void i915_drm_clients_init(struct i915_drm_clients *clients,
0044 struct drm_i915_private *i915);
0045
0046 static inline struct i915_drm_client *
0047 i915_drm_client_get(struct i915_drm_client *client)
0048 {
0049 kref_get(&client->kref);
0050 return client;
0051 }
0052
0053 void __i915_drm_client_free(struct kref *kref);
0054
0055 static inline void i915_drm_client_put(struct i915_drm_client *client)
0056 {
0057 kref_put(&client->kref, __i915_drm_client_free);
0058 }
0059
0060 struct i915_drm_client *i915_drm_client_add(struct i915_drm_clients *clients);
0061
0062 #ifdef CONFIG_PROC_FS
0063 void i915_drm_client_fdinfo(struct seq_file *m, struct file *f);
0064 #endif
0065
0066 void i915_drm_clients_fini(struct i915_drm_clients *clients);
0067
0068 #endif