1 /* SPDX-License-Identifier: MIT */
3 * Copyright © 2020 Intel Corporation
6 #ifndef __I915_DRM_CLIENT_H__
7 #define __I915_DRM_CLIENT_H__
9 #include <linux/kref.h>
10 #include <linux/list.h>
11 #include <linux/spinlock.h>
13 #include <uapi/drm/i915_drm.h>
15 #define I915_LAST_UABI_ENGINE_CLASS I915_ENGINE_CLASS_COMPUTE
20 struct i915_drm_client {
25 spinlock_t ctx_lock; /* For add/remove from ctx_list. */
26 struct list_head ctx_list; /* List of contexts belonging to client. */
29 * @past_runtime: Accumulation of pphwsp runtimes from closed contexts.
31 atomic64_t past_runtime[I915_LAST_UABI_ENGINE_CLASS + 1];
34 static inline struct i915_drm_client *
35 i915_drm_client_get(struct i915_drm_client *client)
37 kref_get(&client->kref);
41 void __i915_drm_client_free(struct kref *kref);
43 static inline void i915_drm_client_put(struct i915_drm_client *client)
45 kref_put(&client->kref, __i915_drm_client_free);
48 struct i915_drm_client *i915_drm_client_alloc(void);
50 void i915_drm_client_fdinfo(struct drm_printer *p, struct drm_file *file);
52 #endif /* !__I915_DRM_CLIENT_H__ */