Skip to content

Commit 70a65a5

Browse files
committed
drm/i915/dsb: Shuffle code around
Relocate intel_dsb_dewake_scanline() and dsb_chicken() upwards in the file. I need to reuse these while emitting DSB commands, and I'd like to keep the DSB command emission stuff more or less grouped together in the file. Also drop the intel_ prefix from intel_dsb_dewake_scanline() since it's all internal stuff and thus doesn't need so much namespacing. Signed-off-by: Ville Syrjälä <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Animesh manna <[email protected]>
1 parent 21bb041 commit 70a65a5

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

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

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,33 @@ struct intel_dsb {
8383
#define DSB_OPCODE_POLL 0xA
8484
/* see DSB_REG_VALUE_MASK */
8585

86+
static int dsb_dewake_scanline(const struct intel_crtc_state *crtc_state)
87+
{
88+
struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
89+
const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
90+
unsigned int latency = skl_watermark_max_latency(i915, 0);
91+
int vblank_start;
92+
93+
if (crtc_state->vrr.enable)
94+
vblank_start = intel_vrr_vmin_vblank_start(crtc_state);
95+
else
96+
vblank_start = intel_mode_vblank_start(adjusted_mode);
97+
98+
return max(0, vblank_start - intel_usecs_to_scanlines(adjusted_mode, latency));
99+
}
100+
101+
static u32 dsb_chicken(struct intel_crtc *crtc)
102+
{
103+
if (crtc->mode_flags & I915_MODE_FLAG_VRR)
104+
return DSB_SKIP_WAITS_EN |
105+
DSB_CTRL_WAIT_SAFE_WINDOW |
106+
DSB_CTRL_NO_WAIT_VBLANK |
107+
DSB_INST_WAIT_SAFE_WINDOW |
108+
DSB_INST_NO_WAIT_VBLANK;
109+
else
110+
return DSB_SKIP_WAITS_EN;
111+
}
112+
86113
static bool assert_dsb_has_room(struct intel_dsb *dsb)
87114
{
88115
struct intel_crtc *crtc = dsb->crtc;
@@ -313,33 +340,6 @@ void intel_dsb_finish(struct intel_dsb *dsb)
313340
intel_dsb_buffer_flush_map(&dsb->dsb_buf);
314341
}
315342

316-
static int intel_dsb_dewake_scanline(const struct intel_crtc_state *crtc_state)
317-
{
318-
struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev);
319-
const struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode;
320-
unsigned int latency = skl_watermark_max_latency(i915, 0);
321-
int vblank_start;
322-
323-
if (crtc_state->vrr.enable)
324-
vblank_start = intel_vrr_vmin_vblank_start(crtc_state);
325-
else
326-
vblank_start = intel_mode_vblank_start(adjusted_mode);
327-
328-
return max(0, vblank_start - intel_usecs_to_scanlines(adjusted_mode, latency));
329-
}
330-
331-
static u32 dsb_chicken(struct intel_crtc *crtc)
332-
{
333-
if (crtc->mode_flags & I915_MODE_FLAG_VRR)
334-
return DSB_SKIP_WAITS_EN |
335-
DSB_CTRL_WAIT_SAFE_WINDOW |
336-
DSB_CTRL_NO_WAIT_VBLANK |
337-
DSB_INST_WAIT_SAFE_WINDOW |
338-
DSB_INST_NO_WAIT_VBLANK;
339-
else
340-
return DSB_SKIP_WAITS_EN;
341-
}
342-
343343
static u32 dsb_error_int_status(struct intel_display *display)
344344
{
345345
u32 errors;
@@ -530,7 +530,7 @@ struct intel_dsb *intel_dsb_prepare(struct intel_atomic_state *state,
530530
dsb->ins_start_offset = 0;
531531

532532
dsb->hw_dewake_scanline =
533-
intel_crtc_scanline_to_hw(crtc_state, intel_dsb_dewake_scanline(crtc_state));
533+
intel_crtc_scanline_to_hw(crtc_state, dsb_dewake_scanline(crtc_state));
534534

535535
return dsb;
536536

0 commit comments

Comments
 (0)