Home | History | Annotate | Line # | Download | only in i915
      1  1.1  riastrad /*	$NetBSD: i915_perf.h,v 1.2 2021/12/18 23:45:28 riastradh Exp $	*/
      2  1.1  riastrad 
      3  1.1  riastrad /* SPDX-License-Identifier: MIT */
      4  1.1  riastrad /*
      5  1.1  riastrad  * Copyright  2019 Intel Corporation
      6  1.1  riastrad  */
      7  1.1  riastrad 
      8  1.1  riastrad #ifndef __I915_PERF_H__
      9  1.1  riastrad #define __I915_PERF_H__
     10  1.1  riastrad 
     11  1.1  riastrad #include <linux/kref.h>
     12  1.1  riastrad #include <linux/types.h>
     13  1.1  riastrad 
     14  1.1  riastrad #include "i915_perf_types.h"
     15  1.1  riastrad 
     16  1.1  riastrad struct drm_device;
     17  1.1  riastrad struct drm_file;
     18  1.1  riastrad struct drm_i915_private;
     19  1.1  riastrad struct i915_oa_config;
     20  1.1  riastrad struct intel_context;
     21  1.1  riastrad struct intel_engine_cs;
     22  1.1  riastrad 
     23  1.1  riastrad void i915_perf_init(struct drm_i915_private *i915);
     24  1.1  riastrad void i915_perf_fini(struct drm_i915_private *i915);
     25  1.1  riastrad void i915_perf_register(struct drm_i915_private *i915);
     26  1.1  riastrad void i915_perf_unregister(struct drm_i915_private *i915);
     27  1.1  riastrad int i915_perf_ioctl_version(void);
     28  1.1  riastrad void i915_perf_sysctl_register(void);
     29  1.1  riastrad void i915_perf_sysctl_unregister(void);
     30  1.1  riastrad 
     31  1.1  riastrad int i915_perf_open_ioctl(struct drm_device *dev, void *data,
     32  1.1  riastrad 			 struct drm_file *file);
     33  1.1  riastrad int i915_perf_add_config_ioctl(struct drm_device *dev, void *data,
     34  1.1  riastrad 			       struct drm_file *file);
     35  1.1  riastrad int i915_perf_remove_config_ioctl(struct drm_device *dev, void *data,
     36  1.1  riastrad 				  struct drm_file *file);
     37  1.1  riastrad 
     38  1.1  riastrad void i915_oa_init_reg_state(const struct intel_context *ce,
     39  1.1  riastrad 			    const struct intel_engine_cs *engine);
     40  1.1  riastrad 
     41  1.1  riastrad struct i915_oa_config *
     42  1.1  riastrad i915_perf_get_oa_config(struct i915_perf *perf, int metrics_set);
     43  1.1  riastrad 
     44  1.1  riastrad static inline struct i915_oa_config *
     45  1.1  riastrad i915_oa_config_get(struct i915_oa_config *oa_config)
     46  1.1  riastrad {
     47  1.1  riastrad 	if (kref_get_unless_zero(&oa_config->ref))
     48  1.1  riastrad 		return oa_config;
     49  1.1  riastrad 	else
     50  1.1  riastrad 		return NULL;
     51  1.1  riastrad }
     52  1.1  riastrad 
     53  1.1  riastrad void i915_oa_config_release(struct kref *ref);
     54  1.1  riastrad static inline void i915_oa_config_put(struct i915_oa_config *oa_config)
     55  1.1  riastrad {
     56  1.1  riastrad 	if (!oa_config)
     57  1.1  riastrad 		return;
     58  1.1  riastrad 
     59  1.1  riastrad 	kref_put(&oa_config->ref, i915_oa_config_release);
     60  1.1  riastrad }
     61  1.1  riastrad 
     62  1.1  riastrad #endif /* __I915_PERF_H__ */
     63