Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915: Move intel_crtc_scanline_offset()

I want to use intel_crtc_scanline_offset() in
intel_crtc_scanline_to_hw(). Relocate intel_crtc_scanline_offset()
a bit to avoid a forward declaration.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240528185647.7765-6-ville.syrjala@linux.intel.com
Reviewed-by: Jani Nikula <jani.nikula@intel.com>

+38 -38
+38 -38
drivers/gpu/drm/i915/display/intel_vblank.c
··· 188 188 return scanline; 189 189 } 190 190 191 + static int intel_crtc_scanline_offset(const struct intel_crtc_state *crtc_state) 192 + { 193 + struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); 194 + 195 + /* 196 + * The scanline counter increments at the leading edge of hsync. 197 + * 198 + * On most platforms it starts counting from vtotal-1 on the 199 + * first active line. That means the scanline counter value is 200 + * always one less than what we would expect. Ie. just after 201 + * start of vblank, which also occurs at start of hsync (on the 202 + * last active line), the scanline counter will read vblank_start-1. 203 + * 204 + * On gen2 the scanline counter starts counting from 1 instead 205 + * of vtotal-1, so we have to subtract one. 206 + * 207 + * On HSW+ the behaviour of the scanline counter depends on the output 208 + * type. For DP ports it behaves like most other platforms, but on HDMI 209 + * there's an extra 1 line difference. So we need to add two instead of 210 + * one to the value. 211 + * 212 + * On VLV/CHV DSI the scanline counter would appear to increment 213 + * approx. 1/3 of a scanline before start of vblank. Unfortunately 214 + * that means we can't tell whether we're in vblank or not while 215 + * we're on that particular line. We must still set scanline_offset 216 + * to 1 so that the vblank timestamps come out correct when we query 217 + * the scanline counter from within the vblank interrupt handler. 218 + * However if queried just before the start of vblank we'll get an 219 + * answer that's slightly in the future. 220 + */ 221 + if (DISPLAY_VER(i915) == 2) 222 + return -1; 223 + else if (HAS_DDI(i915) && intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) 224 + return 2; 225 + else 226 + return 1; 227 + } 228 + 191 229 /* 192 230 * intel_de_read_fw(), only for fast reads of display block, no need for 193 231 * forcewake etc. ··· 503 465 void intel_wait_for_pipe_scanline_moving(struct intel_crtc *crtc) 504 466 { 505 467 wait_for_pipe_scanline_moving(crtc, true); 506 - } 507 - 508 - static int intel_crtc_scanline_offset(const struct intel_crtc_state *crtc_state) 509 - { 510 - struct drm_i915_private *i915 = to_i915(crtc_state->uapi.crtc->dev); 511 - 512 - /* 513 - * The scanline counter increments at the leading edge of hsync. 514 - * 515 - * On most platforms it starts counting from vtotal-1 on the 516 - * first active line. That means the scanline counter value is 517 - * always one less than what we would expect. Ie. just after 518 - * start of vblank, which also occurs at start of hsync (on the 519 - * last active line), the scanline counter will read vblank_start-1. 520 - * 521 - * On gen2 the scanline counter starts counting from 1 instead 522 - * of vtotal-1, so we have to subtract one. 523 - * 524 - * On HSW+ the behaviour of the scanline counter depends on the output 525 - * type. For DP ports it behaves like most other platforms, but on HDMI 526 - * there's an extra 1 line difference. So we need to add two instead of 527 - * one to the value. 528 - * 529 - * On VLV/CHV DSI the scanline counter would appear to increment 530 - * approx. 1/3 of a scanline before start of vblank. Unfortunately 531 - * that means we can't tell whether we're in vblank or not while 532 - * we're on that particular line. We must still set scanline_offset 533 - * to 1 so that the vblank timestamps come out correct when we query 534 - * the scanline counter from within the vblank interrupt handler. 535 - * However if queried just before the start of vblank we'll get an 536 - * answer that's slightly in the future. 537 - */ 538 - if (DISPLAY_VER(i915) == 2) 539 - return -1; 540 - else if (HAS_DDI(i915) && intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) 541 - return 2; 542 - else 543 - return 1; 544 468 } 545 469 546 470 void intel_crtc_update_active_timings(const struct intel_crtc_state *crtc_state,