Commit 8cbda6b2 authored by Jani Nikula's avatar Jani Nikula

drm/i915/irq: use intel de functions for forcewake register access

Move away from I915_READ_FW() and I915_WRITE_FW() in display code, and
switch to using intel_de_read_fw() and intel_de_write_fw(),
respectively.

No functional changes.
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200123140004.14136-3-jani.nikula@intel.com
parent 2aa10054
...@@ -629,9 +629,9 @@ u32 i915_get_vblank_counter(struct drm_crtc *crtc) ...@@ -629,9 +629,9 @@ u32 i915_get_vblank_counter(struct drm_crtc *crtc)
* register. * register.
*/ */
do { do {
high1 = I915_READ_FW(high_frame) & PIPE_FRAME_HIGH_MASK; high1 = intel_de_read_fw(dev_priv, high_frame) & PIPE_FRAME_HIGH_MASK;
low = I915_READ_FW(low_frame); low = intel_de_read_fw(dev_priv, low_frame);
high2 = I915_READ_FW(high_frame) & PIPE_FRAME_HIGH_MASK; high2 = intel_de_read_fw(dev_priv, high_frame) & PIPE_FRAME_HIGH_MASK;
} while (high1 != high2); } while (high1 != high2);
spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags); spin_unlock_irqrestore(&dev_priv->uncore.lock, irqflags);
...@@ -688,15 +688,17 @@ static u32 __intel_get_crtc_scanline_from_timestamp(struct intel_crtc *crtc) ...@@ -688,15 +688,17 @@ static u32 __intel_get_crtc_scanline_from_timestamp(struct intel_crtc *crtc)
* pipe frame time stamp. The time stamp value * pipe frame time stamp. The time stamp value
* is sampled at every start of vertical blank. * is sampled at every start of vertical blank.
*/ */
scan_prev_time = I915_READ_FW(PIPE_FRMTMSTMP(crtc->pipe)); scan_prev_time = intel_de_read_fw(dev_priv,
PIPE_FRMTMSTMP(crtc->pipe));
/* /*
* The TIMESTAMP_CTR register has the current * The TIMESTAMP_CTR register has the current
* time stamp value. * time stamp value.
*/ */
scan_curr_time = I915_READ_FW(IVB_TIMESTAMP_CTR); scan_curr_time = intel_de_read_fw(dev_priv, IVB_TIMESTAMP_CTR);
scan_post_time = I915_READ_FW(PIPE_FRMTMSTMP(crtc->pipe)); scan_post_time = intel_de_read_fw(dev_priv,
PIPE_FRMTMSTMP(crtc->pipe));
} while (scan_post_time != scan_prev_time); } while (scan_post_time != scan_prev_time);
scanline = div_u64(mul_u32_u32(scan_curr_time - scan_prev_time, scanline = div_u64(mul_u32_u32(scan_curr_time - scan_prev_time,
...@@ -707,7 +709,10 @@ static u32 __intel_get_crtc_scanline_from_timestamp(struct intel_crtc *crtc) ...@@ -707,7 +709,10 @@ static u32 __intel_get_crtc_scanline_from_timestamp(struct intel_crtc *crtc)
return scanline; return scanline;
} }
/* I915_READ_FW, only for fast reads of display block, no need for forcewake etc. */ /*
* intel_de_read_fw(), only for fast reads of display block, no need for
* forcewake etc.
*/
static int __intel_get_crtc_scanline(struct intel_crtc *crtc) static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
{ {
struct drm_device *dev = crtc->base.dev; struct drm_device *dev = crtc->base.dev;
...@@ -731,9 +736,9 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc) ...@@ -731,9 +736,9 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
vtotal /= 2; vtotal /= 2;
if (IS_GEN(dev_priv, 2)) if (IS_GEN(dev_priv, 2))
position = I915_READ_FW(PIPEDSL(pipe)) & DSL_LINEMASK_GEN2; position = intel_de_read_fw(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN2;
else else
position = I915_READ_FW(PIPEDSL(pipe)) & DSL_LINEMASK_GEN3; position = intel_de_read_fw(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN3;
/* /*
* On HSW, the DSL reg (0x70000) appears to return 0 if we * On HSW, the DSL reg (0x70000) appears to return 0 if we
...@@ -752,7 +757,7 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc) ...@@ -752,7 +757,7 @@ static int __intel_get_crtc_scanline(struct intel_crtc *crtc)
for (i = 0; i < 100; i++) { for (i = 0; i < 100; i++) {
udelay(1); udelay(1);
temp = I915_READ_FW(PIPEDSL(pipe)) & DSL_LINEMASK_GEN3; temp = intel_de_read_fw(dev_priv, PIPEDSL(pipe)) & DSL_LINEMASK_GEN3;
if (temp != position) { if (temp != position) {
position = temp; position = temp;
break; break;
...@@ -823,7 +828,7 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index, ...@@ -823,7 +828,7 @@ bool i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int index,
* We can split this into vertical and horizontal * We can split this into vertical and horizontal
* scanout position. * scanout position.
*/ */
position = (I915_READ_FW(PIPEFRAMEPIXEL(pipe)) & PIPE_PIXEL_MASK) >> PIPE_PIXEL_SHIFT; position = (intel_de_read_fw(dev_priv, PIPEFRAMEPIXEL(pipe)) & PIPE_PIXEL_MASK) >> PIPE_PIXEL_SHIFT;
/* convert to pixel counts */ /* convert to pixel counts */
vbl_start *= htotal; vbl_start *= htotal;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment