Skip to content

Commit 7d3cd66

Browse files
vsyrjalajnikula
authored andcommitted
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: 967dd48 ("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 (cherry picked from commit 4c888e7) Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent 95eef14 commit 7d3cd66

File tree

2 files changed

+35
-45
lines changed

2 files changed

+35
-45
lines changed

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,7 +1839,7 @@ static void intel_enable_pipe(const struct intel_crtc_state *new_crtc_state)
18391839
/* FIXME: assert CPU port conditions for SNB+ */
18401840
}
18411841

1842-
trace_intel_pipe_enable(dev_priv, pipe);
1842+
trace_intel_pipe_enable(crtc);
18431843

18441844
reg = PIPECONF(cpu_transcoder);
18451845
val = I915_READ(reg);
@@ -1880,7 +1880,7 @@ static void intel_disable_pipe(const struct intel_crtc_state *old_crtc_state)
18801880
*/
18811881
assert_planes_disabled(crtc);
18821882

1883-
trace_intel_pipe_disable(dev_priv, pipe);
1883+
trace_intel_pipe_disable(crtc);
18841884

18851885
reg = PIPECONF(cpu_transcoder);
18861886
val = I915_READ(reg);

drivers/gpu/drm/i915/i915_trace.h

Lines changed: 33 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,22 @@
2121
/* watermark/fifo updates */
2222

2323
TRACE_EVENT(intel_pipe_enable,
24-
TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe),
25-
TP_ARGS(dev_priv, pipe),
24+
TP_PROTO(struct intel_crtc *crtc),
25+
TP_ARGS(crtc),
2626

2727
TP_STRUCT__entry(
2828
__array(u32, frame, 3)
2929
__array(u32, scanline, 3)
3030
__field(enum pipe, pipe)
3131
),
32-
3332
TP_fast_assign(
34-
enum pipe _pipe;
35-
for_each_pipe(dev_priv, _pipe) {
36-
__entry->frame[_pipe] =
37-
dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, _pipe);
38-
__entry->scanline[_pipe] =
39-
intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, _pipe));
33+
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
34+
struct intel_crtc *it__;
35+
for_each_intel_crtc(&dev_priv->drm, it__) {
36+
__entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
37+
__entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
4038
}
41-
__entry->pipe = pipe;
39+
__entry->pipe = crtc->pipe;
4240
),
4341

4442
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,
4947
);
5048

5149
TRACE_EVENT(intel_pipe_disable,
52-
TP_PROTO(struct drm_i915_private *dev_priv, enum pipe pipe),
53-
TP_ARGS(dev_priv, pipe),
50+
TP_PROTO(struct intel_crtc *crtc),
51+
TP_ARGS(crtc),
5452

5553
TP_STRUCT__entry(
5654
__array(u32, frame, 3)
@@ -59,14 +57,13 @@ TRACE_EVENT(intel_pipe_disable,
5957
),
6058

6159
TP_fast_assign(
62-
enum pipe _pipe;
63-
for_each_pipe(dev_priv, _pipe) {
64-
__entry->frame[_pipe] =
65-
dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, _pipe);
66-
__entry->scanline[_pipe] =
67-
intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, _pipe));
60+
struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
61+
struct intel_crtc *it__;
62+
for_each_intel_crtc(&dev_priv->drm, it__) {
63+
__entry->frame[it__->pipe] = intel_crtc_get_vblank_counter(it__);
64+
__entry->scanline[it__->pipe] = intel_get_crtc_scanline(it__);
6865
}
69-
__entry->pipe = pipe;
66+
__entry->pipe = crtc->pipe;
7067
),
7168

7269
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,
8986

9087
TP_fast_assign(
9188
__entry->pipe = crtc->pipe;
92-
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
93-
crtc->pipe);
89+
__entry->frame = intel_crtc_get_vblank_counter(crtc);
9490
__entry->scanline = intel_get_crtc_scanline(crtc);
9591
memcpy(__entry->crcs, crcs, sizeof(__entry->crcs));
9692
),
@@ -112,9 +108,10 @@ TRACE_EVENT(intel_cpu_fifo_underrun,
112108
),
113109

114110
TP_fast_assign(
111+
struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
115112
__entry->pipe = pipe;
116-
__entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
117-
__entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
113+
__entry->frame = intel_crtc_get_vblank_counter(crtc);
114+
__entry->scanline = intel_get_crtc_scanline(crtc);
118115
),
119116

120117
TP_printk("pipe %c, frame=%u, scanline=%u",
@@ -134,9 +131,10 @@ TRACE_EVENT(intel_pch_fifo_underrun,
134131

135132
TP_fast_assign(
136133
enum pipe pipe = pch_transcoder;
134+
struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
137135
__entry->pipe = pipe;
138-
__entry->frame = dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
139-
__entry->scanline = intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
136+
__entry->frame = intel_crtc_get_vblank_counter(crtc);
137+
__entry->scanline = intel_get_crtc_scanline(crtc);
140138
),
141139

142140
TP_printk("pch transcoder %c, frame=%u, scanline=%u",
@@ -156,12 +154,10 @@ TRACE_EVENT(intel_memory_cxsr,
156154
),
157155

158156
TP_fast_assign(
159-
enum pipe pipe;
160-
for_each_pipe(dev_priv, pipe) {
161-
__entry->frame[pipe] =
162-
dev_priv->drm.driver->get_vblank_counter(&dev_priv->drm, pipe);
163-
__entry->scanline[pipe] =
164-
intel_get_crtc_scanline(intel_get_crtc_for_pipe(dev_priv, pipe));
157+
struct intel_crtc *crtc;
158+
for_each_intel_crtc(&dev_priv->drm, crtc) {
159+
__entry->frame[crtc->pipe] = intel_crtc_get_vblank_counter(crtc);
160+
__entry->scanline[crtc->pipe] = intel_get_crtc_scanline(crtc);
165161
}
166162
__entry->old = old;
167163
__entry->new = new;
@@ -198,8 +194,7 @@ TRACE_EVENT(g4x_wm,
198194

199195
TP_fast_assign(
200196
__entry->pipe = crtc->pipe;
201-
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
202-
crtc->pipe);
197+
__entry->frame = intel_crtc_get_vblank_counter(crtc);
203198
__entry->scanline = intel_get_crtc_scanline(crtc);
204199
__entry->primary = wm->pipe[crtc->pipe].plane[PLANE_PRIMARY];
205200
__entry->sprite = wm->pipe[crtc->pipe].plane[PLANE_SPRITE0];
@@ -243,8 +238,7 @@ TRACE_EVENT(vlv_wm,
243238

244239
TP_fast_assign(
245240
__entry->pipe = crtc->pipe;
246-
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
247-
crtc->pipe);
241+
__entry->frame = intel_crtc_get_vblank_counter(crtc);
248242
__entry->scanline = intel_get_crtc_scanline(crtc);
249243
__entry->level = wm->level;
250244
__entry->cxsr = wm->cxsr;
@@ -278,8 +272,7 @@ TRACE_EVENT(vlv_fifo_size,
278272

279273
TP_fast_assign(
280274
__entry->pipe = crtc->pipe;
281-
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
282-
crtc->pipe);
275+
__entry->frame = intel_crtc_get_vblank_counter(crtc);
283276
__entry->scanline = intel_get_crtc_scanline(crtc);
284277
__entry->sprite0_start = sprite0_start;
285278
__entry->sprite1_start = sprite1_start;
@@ -310,8 +303,7 @@ TRACE_EVENT(intel_update_plane,
310303
TP_fast_assign(
311304
__entry->pipe = crtc->pipe;
312305
__entry->name = plane->name;
313-
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
314-
crtc->pipe);
306+
__entry->frame = intel_crtc_get_vblank_counter(crtc);
315307
__entry->scanline = intel_get_crtc_scanline(crtc);
316308
memcpy(__entry->src, &plane->state->src, sizeof(__entry->src));
317309
memcpy(__entry->dst, &plane->state->dst, sizeof(__entry->dst));
@@ -338,8 +330,7 @@ TRACE_EVENT(intel_disable_plane,
338330
TP_fast_assign(
339331
__entry->pipe = crtc->pipe;
340332
__entry->name = plane->name;
341-
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
342-
crtc->pipe);
333+
__entry->frame = intel_crtc_get_vblank_counter(crtc);
343334
__entry->scanline = intel_get_crtc_scanline(crtc);
344335
),
345336

@@ -364,8 +355,7 @@ TRACE_EVENT(i915_pipe_update_start,
364355

365356
TP_fast_assign(
366357
__entry->pipe = crtc->pipe;
367-
__entry->frame = crtc->base.dev->driver->get_vblank_counter(crtc->base.dev,
368-
crtc->pipe);
358+
__entry->frame = intel_crtc_get_vblank_counter(crtc);
369359
__entry->scanline = intel_get_crtc_scanline(crtc);
370360
__entry->min = crtc->debug.min_vbl;
371361
__entry->max = crtc->debug.max_vbl;

0 commit comments

Comments
 (0)