diff mbox

[07/11] drm/i915/perf: pass stream as argument to oa enable vfunc

Message ID 20180326090831.22686-8-lionel.g.landwerlin@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Lionel Landwerlin March 26, 2018, 9:08 a.m. UTC
This will allow use to program the hardware based on the stream's
properties in a later commit.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h  |  3 ++-
 drivers/gpu/drm/i915/i915_perf.c | 12 +++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

Comments

Matthew Auld March 26, 2018, 7:41 p.m. UTC | #1
On 26 March 2018 at 10:08, Lionel Landwerlin
<lionel.g.landwerlin@intel.com> wrote:
> This will allow use to program the hardware based on the stream's
> properties in a later commit.

I couldn't see where we need this? Regardless, operating on the stream
itself makes more sense to me.

>
> Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
> ---
>  drivers/gpu/drm/i915/i915_drv.h  |  3 ++-
>  drivers/gpu/drm/i915/i915_perf.c | 12 +++++++-----
>  2 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index f1a38c92bb1f..1169f0a5261f 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1515,7 +1515,8 @@ struct i915_oa_ops {
>         /**
>          * @oa_enable: Enable periodic sampling
>          */
> -       void (*oa_enable)(struct drm_i915_private *dev_priv);
> +       void (*oa_enable)(struct drm_i915_private *dev_priv,
> +                         const struct i915_perf_stream *stream);

Ditto. We can drop the dev_priv, and can we maybe also do the same for
oa_disable?

Reviewed-by: Matthew Auld <matthew.auld@intel.com>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index f1a38c92bb1f..1169f0a5261f 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1515,7 +1515,8 @@  struct i915_oa_ops {
 	/**
 	 * @oa_enable: Enable periodic sampling
 	 */
-	void (*oa_enable)(struct drm_i915_private *dev_priv);
+	void (*oa_enable)(struct drm_i915_private *dev_priv,
+			  const struct i915_perf_stream *stream);
 
 	/**
 	 * @oa_disable: Disable periodic sampling
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 9758f4be5653..2bad0bf66d89 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -894,7 +894,7 @@  static int gen8_oa_read(struct i915_perf_stream *stream,
 			  dev_priv->perf.oa.period_exponent);
 
 		dev_priv->perf.oa.ops.oa_disable(dev_priv);
-		dev_priv->perf.oa.ops.oa_enable(dev_priv);
+		dev_priv->perf.oa.ops.oa_enable(dev_priv, stream);
 
 		/*
 		 * Note: .oa_enable() is expected to re-init the oabuffer and
@@ -1118,7 +1118,7 @@  static int gen7_oa_read(struct i915_perf_stream *stream,
 			  dev_priv->perf.oa.period_exponent);
 
 		dev_priv->perf.oa.ops.oa_disable(dev_priv);
-		dev_priv->perf.oa.ops.oa_enable(dev_priv);
+		dev_priv->perf.oa.ops.oa_enable(dev_priv, stream);
 
 		oastatus1 = I915_READ(GEN7_OASTATUS1);
 	}
@@ -1888,7 +1888,8 @@  static void gen10_disable_metric_set(struct drm_i915_private *dev_priv)
 		   I915_READ(RPM_CONFIG1) & ~GEN10_GT_NOA_ENABLE);
 }
 
-static void gen7_oa_enable(struct drm_i915_private *dev_priv)
+static void gen7_oa_enable(struct drm_i915_private *dev_priv,
+			   const struct i915_perf_stream *stream)
 {
 	struct i915_gem_context *ctx =
 			dev_priv->perf.oa.exclusive_stream->ctx;
@@ -1918,7 +1919,8 @@  static void gen7_oa_enable(struct drm_i915_private *dev_priv)
 		   GEN7_OACONTROL_ENABLE);
 }
 
-static void gen8_oa_enable(struct drm_i915_private *dev_priv)
+static void gen8_oa_enable(struct drm_i915_private *dev_priv,
+			   const struct i915_perf_stream *stream)
 {
 	u32 report_format = dev_priv->perf.oa.oa_buffer.format;
 
@@ -1956,7 +1958,7 @@  static void i915_oa_stream_enable(struct i915_perf_stream *stream)
 {
 	struct drm_i915_private *dev_priv = stream->dev_priv;
 
-	dev_priv->perf.oa.ops.oa_enable(dev_priv);
+	dev_priv->perf.oa.ops.oa_enable(dev_priv, stream);
 
 	if (dev_priv->perf.oa.periodic)
 		hrtimer_start(&dev_priv->perf.oa.poll_check_timer,