mirror of
https://github.com/torvalds/linux.git
synced 2026-05-03 22:12:32 -04:00
Similar to AMD commit
8744425411 ("drm/amdgpu: Add show_fdinfo() interface"), using the
infrastructure added in previous patches, we add basic client info
and GPU engine utilisation for i915.
Example of the output:
pos: 0
flags: 0100002
mnt_id: 21
drm-driver: i915
drm-pdev: 0000:00:02.0
drm-client-id: 7
drm-engine-render: 9288864723 ns
drm-engine-copy: 2035071108 ns
drm-engine-video: 0 ns
drm-engine-video-enhance: 0 ns
v2:
* Update for removal of name and pid.
v3:
* Use drm_driver.name.
v4:
* Added drm-engine-capacity- tag.
* Fix typo. (Umesh)
v5:
* Don't output engine data before Gen8.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: David M Nieto <David.Nieto@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Chris Healy <cphealy@gmail.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Acked-by: Rob Clark <robdclark@gmail.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20220401142205.3123159-9-tvrtko.ursulin@linux.intel.com
69 lines
1.5 KiB
C
69 lines
1.5 KiB
C
/* SPDX-License-Identifier: MIT */
|
|
/*
|
|
* Copyright © 2020 Intel Corporation
|
|
*/
|
|
|
|
#ifndef __I915_DRM_CLIENT_H__
|
|
#define __I915_DRM_CLIENT_H__
|
|
|
|
#include <linux/kref.h>
|
|
#include <linux/list.h>
|
|
#include <linux/spinlock.h>
|
|
#include <linux/xarray.h>
|
|
|
|
#include "gt/intel_engine_types.h"
|
|
|
|
#define I915_LAST_UABI_ENGINE_CLASS I915_ENGINE_CLASS_VIDEO_ENHANCE
|
|
|
|
struct drm_i915_private;
|
|
|
|
struct i915_drm_clients {
|
|
struct drm_i915_private *i915;
|
|
|
|
struct xarray xarray;
|
|
u32 next_id;
|
|
};
|
|
|
|
struct i915_drm_client {
|
|
struct kref kref;
|
|
|
|
unsigned int id;
|
|
|
|
spinlock_t ctx_lock; /* For add/remove from ctx_list. */
|
|
struct list_head ctx_list; /* List of contexts belonging to client. */
|
|
|
|
struct i915_drm_clients *clients;
|
|
|
|
/**
|
|
* @past_runtime: Accumulation of pphwsp runtimes from closed contexts.
|
|
*/
|
|
atomic64_t past_runtime[I915_LAST_UABI_ENGINE_CLASS + 1];
|
|
};
|
|
|
|
void i915_drm_clients_init(struct i915_drm_clients *clients,
|
|
struct drm_i915_private *i915);
|
|
|
|
static inline struct i915_drm_client *
|
|
i915_drm_client_get(struct i915_drm_client *client)
|
|
{
|
|
kref_get(&client->kref);
|
|
return client;
|
|
}
|
|
|
|
void __i915_drm_client_free(struct kref *kref);
|
|
|
|
static inline void i915_drm_client_put(struct i915_drm_client *client)
|
|
{
|
|
kref_put(&client->kref, __i915_drm_client_free);
|
|
}
|
|
|
|
struct i915_drm_client *i915_drm_client_add(struct i915_drm_clients *clients);
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
void i915_drm_client_fdinfo(struct seq_file *m, struct file *f);
|
|
#endif
|
|
|
|
void i915_drm_clients_fini(struct i915_drm_clients *clients);
|
|
|
|
#endif /* !__I915_DRM_CLIENT_H__ */
|