2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-28 15:13:55 +08:00

drm/i915: Fix various tracepoints for gen2

Gen2 doesn't have a frame counter and apparently we no longer provide
a fake .get_vblank_counter() hook for it. That means all tracepoints
calling that hook will oops. Update the tracepoints to use
intel_crtc_get_vblank_counter() which will gracefully fall back to
using the software counter. This is actually a better approach since
we now get (hopefully accurate) frame numbers in the traces.

This also gets rid of the raw driver->get_vblank_counter() calls, which
we need to do in order to switch to the per-crtc vblank vfuncs.

v2: Deal with new tracepoints
v3: Use a distinct variable name for the internal crtc iterator (Chris)

Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Fixes: 967dd48417 ("drm: remove drm_vblank_no_hw_counter assignment from driver code")
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190619170842.20579-2-ville.syrjala@linux.intel.com
This commit is contained in:
Ville Syrjälä 2019-06-19 20:08:39 +03:00
parent faaa2902b5
commit 4c888e7bd2
2 changed files with 35 additions and 45 deletions

View File

@ -1839,7 +1839,7 @@ static void intel_enable_pipe(const struct intel_crtc_state *new_crtc_state)
/* FIXME: assert CPU port conditions for SNB+ */ /* FIXME: assert CPU port conditions for SNB+ */
} }
trace_intel_pipe_enable(dev_priv, pipe); trace_intel_pipe_enable(crtc);
reg = PIPECONF(cpu_transcoder); reg = PIPECONF(cpu_transcoder);
val = I915_READ(reg); val = I915_READ(reg);
@ -1880,7 +1880,7 @@ static void intel_disable_pipe(const struct intel_crtc_state *old_crtc_state)
*/ */
assert_planes_disabled(crtc); assert_planes_disabled(crtc);
trace_intel_pipe_disable(dev_priv, pipe); trace_intel_pipe_disable(crtc);
reg = PIPECONF(cpu_transcoder); reg = PIPECONF(cpu_transcoder);
val = I915_READ(reg); val = I915_READ(reg);

View File

@ -21,24 +21,22 @@
/* watermark/fifo updates */ /* watermark/fifo updates */
TRACE_EVENT(intel_pipe_enable, TRACE_EVENT(intel_pipe_enable,
TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe), TP_PROTO(struct intel_crtc *crtc),
TP_ARGS(dev_priv, pipe), TP_ARGS(crtc),
TP_STRUCT__entry( TP_STRUCT__entry(
__array(u32, frame, 3) __array(u32, frame, 3)
__array(u32, scanline, 3) __array(u32, scanline, 3)
__field(enum pipe, pipe) __field(enum pipe, pipe)
), ),
TP_fast_assign( TP_fast_assign(
enum pipe _pipe; struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
for_each_pipe(dev_priv, _pipe) { struct intel_crtc *it__;
__entry->frame[_pipe] = for_each_intel_crtc(&dev_priv->drm, it__) {
dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, _pipe); __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
__entry->scanline[_pipe] = __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, _pipe));
} }
__entry->pipe = pipe; __entry->pipe = crtc->pipe;
), ),
TP_printk("pipe %c enable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u", TP_printk("pipe %c enable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
@ -49,8 +47,8 @@ TRACE_EVENT(intel_pipe_enable,
); );
TRACE_EVENT(intel_pipe_disable, TRACE_EVENT(intel_pipe_disable,
TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe), TP_PROTO(struct intel_crtc *crtc),
TP_ARGS(dev_priv, pipe), TP_ARGS(crtc),
TP_STRUCT__entry( TP_STRUCT__entry(
__array(u32, frame, 3) __array(u32, frame, 3)
@ -59,14 +57,13 @@ TRACE_EVENT(intel_pipe_disable,
), ),
TP_fast_assign( TP_fast_assign(
enum pipe _pipe; struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
for_each_pipe(dev_priv, _pipe) { struct intel_crtc *it__;
__entry->frame[_pipe] = for_each_intel_crtc(&dev_priv->drm, it__) {
dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, _pipe); __entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
__entry->scanline[_pipe] = __entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, _pipe));
} }
__entry->pipe = pipe; __entry->pipe = crtc->pipe;
), ),
TP_printk("pipe %c disable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u", TP_printk("pipe %c disable, pipe A: frame=%u, scanline=%u, pipe B: frame=%u, scanline=%u, pipe C: frame=%u, scanline=%u",
@ -89,8 +86,7 @@ TRACE_EVENT(intel_pipe_crc,
TP_fast_assign( TP_fast_assign(
__entry->pipe = crtc->pipe; __entry->pipe = crtc->pipe;
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, __entry->frame = intel_crtc_get_vblank_counter(crtc);
crtc->pipe);
__entry->scanline = intel_get_crtc_scanline(crtc); __entry->scanline = intel_get_crtc_scanline(crtc);
memcpy(__entry->crcs, crcs, sizeof(__entry->crcs)); memcpy(__entry->crcs, crcs, sizeof(__entry->crcs));
), ),
@ -112,9 +108,10 @@ TRACE_EVENT(intel_cpu_fifo_underrun,
), ),
TP_fast_assign( TP_fast_assign(
struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
__entry->pipe = pipe; __entry->pipe = pipe;
__entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe); __entry->frame = intel_crtc_get_vblank_counter(crtc);
__entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe)); __entry->scanline = intel_get_crtc_scanline(crtc);
), ),
TP_printk("pipe %c, frame=%u, scanline=%u", TP_printk("pipe %c, frame=%u, scanline=%u",
@ -134,9 +131,10 @@ TRACE_EVENT(intel_pch_fifo_underrun,
TP_fast_assign( TP_fast_assign(
enum pipe pipe = pch_transcoder; enum pipe pipe = pch_transcoder;
struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
__entry->pipe = pipe; __entry->pipe = pipe;
__entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe); __entry->frame = intel_crtc_get_vblank_counter(crtc);
__entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe)); __entry->scanline = intel_get_crtc_scanline(crtc);
), ),
TP_printk("pch transcoder %c, frame=%u, scanline=%u", TP_printk("pch transcoder %c, frame=%u, scanline=%u",
@ -156,12 +154,10 @@ TRACE_EVENT(intel_memory_cxsr,
), ),
TP_fast_assign( TP_fast_assign(
enum pipe pipe; struct intel_crtc *crtc;
for_each_pipe(dev_priv, pipe) { for_each_intel_crtc(&dev_priv->drm, crtc) {
__entry->frame[pipe] = __entry->frame[crtc->pipe] = intel_crtc_get_vblank_counter(crtc);
dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe); __entry->scanline[crtc->pipe] = intel_get_crtc_scanline(crtc);
__entry->scanline[pipe] =
intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
} }
__entry->old = old; __entry->old = old;
__entry->new = new; __entry->new = new;
@ -198,8 +194,7 @@ TRACE_EVENT(g4x_wm,
TP_fast_assign( TP_fast_assign(
__entry->pipe = crtc->pipe; __entry->pipe = crtc->pipe;
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, __entry->frame = intel_crtc_get_vblank_counter(crtc);
crtc->pipe);
__entry->scanline = intel_get_crtc_scanline(crtc); __entry->scanline = intel_get_crtc_scanline(crtc);
__entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY]; __entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
__entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0]; __entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
@ -243,8 +238,7 @@ TRACE_EVENT(vlv_wm,
TP_fast_assign( TP_fast_assign(
__entry->pipe = crtc->pipe; __entry->pipe = crtc->pipe;
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, __entry->frame = intel_crtc_get_vblank_counter(crtc);
crtc->pipe);
__entry->scanline = intel_get_crtc_scanline(crtc); __entry->scanline = intel_get_crtc_scanline(crtc);
__entry->level = wm->level; __entry->level = wm->level;
__entry->cxsr = wm->cxsr; __entry->cxsr = wm->cxsr;
@ -278,8 +272,7 @@ TRACE_EVENT(vlv_fifo_size,
TP_fast_assign( TP_fast_assign(
__entry->pipe = crtc->pipe; __entry->pipe = crtc->pipe;
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, __entry->frame = intel_crtc_get_vblank_counter(crtc);
crtc->pipe);
__entry->scanline = intel_get_crtc_scanline(crtc); __entry->scanline = intel_get_crtc_scanline(crtc);
__entry->sprite0_start = sprite0_start; __entry->sprite0_start = sprite0_start;
__entry->sprite1_start = sprite1_start; __entry->sprite1_start = sprite1_start;
@ -310,8 +303,7 @@ TRACE_EVENT(intel_update_plane,
TP_fast_assign( TP_fast_assign(
__entry->pipe = crtc->pipe; __entry->pipe = crtc->pipe;
__entry->name = plane->name; __entry->name = plane->name;
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, __entry->frame = intel_crtc_get_vblank_counter(crtc);
crtc->pipe);
__entry->scanline = intel_get_crtc_scanline(crtc); __entry->scanline = intel_get_crtc_scanline(crtc);
memcpy(__entry->src, &plane->state->src, sizeof(__entry->src)); memcpy(__entry->src, &plane->state->src, sizeof(__entry->src));
memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst)); memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst));
@ -338,8 +330,7 @@ TRACE_EVENT(intel_disable_plane,
TP_fast_assign( TP_fast_assign(
__entry->pipe = crtc->pipe; __entry->pipe = crtc->pipe;
__entry->name = plane->name; __entry->name = plane->name;
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, __entry->frame = intel_crtc_get_vblank_counter(crtc);
crtc->pipe);
__entry->scanline = intel_get_crtc_scanline(crtc); __entry->scanline = intel_get_crtc_scanline(crtc);
), ),
@ -364,8 +355,7 @@ TRACE_EVENT(i915_pipe_update_start,
TP_fast_assign( TP_fast_assign(
__entry->pipe = crtc->pipe; __entry->pipe = crtc->pipe;
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev, __entry->frame = intel_crtc_get_vblank_counter(crtc);
crtc->pipe);
__entry->scanline = intel_get_crtc_scanline(crtc); __entry->scanline = intel_get_crtc_scanline(crtc);
__entry->min = crtc->debug.min_vbl; __entry->min = crtc->debug.min_vbl;
__entry->max = crtc->debug.max_vbl; __entry->max = crtc->debug.max_vbl;