Commit 98187836 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Always use intel_get_crtc_for_pipe()

Replace the open coded dev_priv->pipe_to_crtc_mapping[] usage with
intel_get_crtc_for_pipe().

Mostly done with coccinelle, with a few manual tweaks

@@
expression E1, E2;
@@
(
- E1->pipe_to_crtc_mapping[E2]
+ intel_get_crtc_for_pipe(E1, E2)
|
- E1->plane_to_crtc_mapping[E2]
+ intel_get_crtc_for_plane(E1, E2)
)
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1477946245-14134-12-git-send-email-ville.syrjala@linux.intel.comReviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
parent b91eb5cc
...@@ -4065,7 +4065,7 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_i915_private *dev_priv, ...@@ -4065,7 +4065,7 @@ static void hsw_trans_edp_pipe_A_crc_wa(struct drm_i915_private *dev_priv,
bool enable) bool enable)
{ {
struct drm_device *dev = &dev_priv->drm; struct drm_device *dev = &dev_priv->drm;
struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[PIPE_A]; struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_A);
struct intel_crtc_state *pipe_config; struct intel_crtc_state *pipe_config;
struct drm_atomic_state *state; struct drm_atomic_state *state;
int ret = 0; int ret = 0;
...@@ -4203,7 +4203,8 @@ static int pipe_crc_set_source(struct drm_i915_private *dev_priv, ...@@ -4203,7 +4203,8 @@ static int pipe_crc_set_source(struct drm_i915_private *dev_priv,
/* real source -> none transition */ /* real source -> none transition */
if (source == INTEL_PIPE_CRC_SOURCE_NONE) { if (source == INTEL_PIPE_CRC_SOURCE_NONE) {
struct intel_pipe_crc_entry *entries; struct intel_pipe_crc_entry *entries;
struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
pipe);
DRM_DEBUG_DRIVER("stopping CRCs for pipe %c\n", DRM_DEBUG_DRIVER("stopping CRCs for pipe %c\n",
pipe_name(pipe)); pipe_name(pipe));
......
...@@ -725,7 +725,8 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe) ...@@ -725,7 +725,8 @@ static u32 i915_get_vblank_counter(struct drm_device *dev, unsigned int pipe)
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
i915_reg_t high_frame, low_frame; i915_reg_t high_frame, low_frame;
u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal; u32 high1, high2, low, pixel, vbl_start, hsync_start, htotal;
struct intel_crtc *intel_crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *intel_crtc = intel_get_crtc_for_pipe(dev_priv,
pipe);
const struct drm_display_mode *mode = &intel_crtc->base.hwmode; const struct drm_display_mode *mode = &intel_crtc->base.hwmode;
htotal = mode->crtc_htotal; htotal = mode->crtc_htotal;
...@@ -830,7 +831,8 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe, ...@@ -830,7 +831,8 @@ static int i915_get_crtc_scanoutpos(struct drm_device *dev, unsigned int pipe,
const struct drm_display_mode *mode) const struct drm_display_mode *mode)
{ {
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_crtc *intel_crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *intel_crtc = intel_get_crtc_for_pipe(dev_priv,
pipe);
int position; int position;
int vbl_start, vbl_end, hsync_start, htotal, vtotal; int vbl_start, vbl_end, hsync_start, htotal, vtotal;
bool in_vbl = true; bool in_vbl = true;
......
...@@ -1030,7 +1030,7 @@ bool intel_crtc_active(struct intel_crtc *crtc) ...@@ -1030,7 +1030,7 @@ bool intel_crtc_active(struct intel_crtc *crtc)
enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv, enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
enum pipe pipe) enum pipe pipe)
{ {
struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
return crtc->config->cpu_transcoder; return crtc->config->cpu_transcoder;
} }
...@@ -1785,7 +1785,8 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv, ...@@ -1785,7 +1785,8 @@ void vlv_wait_port_ready(struct drm_i915_private *dev_priv,
static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv, static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv,
enum pipe pipe) enum pipe pipe)
{ {
struct intel_crtc *intel_crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *intel_crtc = intel_get_crtc_for_pipe(dev_priv,
pipe);
i915_reg_t reg; i915_reg_t reg;
uint32_t val, pipeconf_val; uint32_t val, pipeconf_val;
...@@ -11662,7 +11663,7 @@ static bool pageflip_finished(struct intel_crtc *crtc, ...@@ -11662,7 +11663,7 @@ static bool pageflip_finished(struct intel_crtc *crtc,
void intel_finish_page_flip_cs(struct drm_i915_private *dev_priv, int pipe) void intel_finish_page_flip_cs(struct drm_i915_private *dev_priv, int pipe)
{ {
struct drm_device *dev = &dev_priv->drm; struct drm_device *dev = &dev_priv->drm;
struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
struct intel_flip_work *work; struct intel_flip_work *work;
unsigned long flags; unsigned long flags;
...@@ -11688,7 +11689,7 @@ void intel_finish_page_flip_cs(struct drm_i915_private *dev_priv, int pipe) ...@@ -11688,7 +11689,7 @@ void intel_finish_page_flip_cs(struct drm_i915_private *dev_priv, int pipe)
void intel_finish_page_flip_mmio(struct drm_i915_private *dev_priv, int pipe) void intel_finish_page_flip_mmio(struct drm_i915_private *dev_priv, int pipe)
{ {
struct drm_device *dev = &dev_priv->drm; struct drm_device *dev = &dev_priv->drm;
struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
struct intel_flip_work *work; struct intel_flip_work *work;
unsigned long flags; unsigned long flags;
...@@ -12118,7 +12119,7 @@ static bool __pageflip_stall_check_cs(struct drm_i915_private *dev_priv, ...@@ -12118,7 +12119,7 @@ static bool __pageflip_stall_check_cs(struct drm_i915_private *dev_priv,
void intel_check_page_flip(struct drm_i915_private *dev_priv, int pipe) void intel_check_page_flip(struct drm_i915_private *dev_priv, int pipe)
{ {
struct drm_device *dev = &dev_priv->drm; struct drm_device *dev = &dev_priv->drm;
struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
struct intel_flip_work *work; struct intel_flip_work *work;
WARN_ON(!in_interrupt()); WARN_ON(!in_interrupt());
...@@ -14177,7 +14178,8 @@ static void intel_atomic_wait_for_vblanks(struct drm_device *dev, ...@@ -14177,7 +14178,8 @@ static void intel_atomic_wait_for_vblanks(struct drm_device *dev,
return; return;
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
pipe);
if (!((1 << pipe) & crtc_mask)) if (!((1 << pipe) & crtc_mask))
continue; continue;
...@@ -14192,7 +14194,8 @@ static void intel_atomic_wait_for_vblanks(struct drm_device *dev, ...@@ -14192,7 +14194,8 @@ static void intel_atomic_wait_for_vblanks(struct drm_device *dev,
} }
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv,
pipe);
long lret; long lret;
if (!((1 << pipe) & crtc_mask)) if (!((1 << pipe) & crtc_mask))
...@@ -16867,7 +16870,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) ...@@ -16867,7 +16870,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)
pipe = 0; pipe = 0;
if (encoder->get_hw_state(encoder, &pipe)) { if (encoder->get_hw_state(encoder, &pipe)) {
crtc = dev_priv->pipe_to_crtc_mapping[pipe]; crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
encoder->base.crtc = &crtc->base; encoder->base.crtc = &crtc->base;
crtc->config->output_types |= 1 << encoder->type; crtc->config->output_types |= 1 << encoder->type;
...@@ -16969,7 +16972,7 @@ intel_modeset_setup_hw_state(struct drm_device *dev) ...@@ -16969,7 +16972,7 @@ intel_modeset_setup_hw_state(struct drm_device *dev)
} }
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
crtc = dev_priv->pipe_to_crtc_mapping[pipe]; crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
intel_sanitize_crtc(crtc); intel_sanitize_crtc(crtc);
intel_dump_pipe_config(crtc, crtc->config, intel_dump_pipe_config(crtc, crtc->config,
......
...@@ -57,7 +57,7 @@ static bool ivb_can_enable_err_int(struct drm_device *dev) ...@@ -57,7 +57,7 @@ static bool ivb_can_enable_err_int(struct drm_device *dev)
assert_spin_locked(&dev_priv->irq_lock); assert_spin_locked(&dev_priv->irq_lock);
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
crtc = dev_priv->pipe_to_crtc_mapping[pipe]; crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
if (crtc->cpu_fifo_underrun_disabled) if (crtc->cpu_fifo_underrun_disabled)
return false; return false;
...@@ -75,7 +75,7 @@ static bool cpt_can_enable_serr_int(struct drm_device *dev) ...@@ -75,7 +75,7 @@ static bool cpt_can_enable_serr_int(struct drm_device *dev)
assert_spin_locked(&dev_priv->irq_lock); assert_spin_locked(&dev_priv->irq_lock);
for_each_pipe(dev_priv, pipe) { for_each_pipe(dev_priv, pipe) {
crtc = dev_priv->pipe_to_crtc_mapping[pipe]; crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
if (crtc->pch_fifo_underrun_disabled) if (crtc->pch_fifo_underrun_disabled)
return false; return false;
...@@ -245,7 +245,7 @@ static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev, ...@@ -245,7 +245,7 @@ static bool __intel_set_cpu_fifo_underrun_reporting(struct drm_device *dev,
enum pipe pipe, bool enable) enum pipe pipe, bool enable)
{ {
struct drm_i915_private *dev_priv = to_i915(dev); struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
bool old; bool old;
assert_spin_locked(&dev_priv->irq_lock); assert_spin_locked(&dev_priv->irq_lock);
...@@ -313,7 +313,8 @@ bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv, ...@@ -313,7 +313,8 @@ bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
enum transcoder pch_transcoder, enum transcoder pch_transcoder,
bool enable) bool enable)
{ {
struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pch_transcoder]; struct intel_crtc *crtc =
intel_get_crtc_for_pipe(dev_priv, (enum pipe) pch_transcoder);
unsigned long flags; unsigned long flags;
bool old; bool old;
...@@ -356,7 +357,7 @@ bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv, ...@@ -356,7 +357,7 @@ bool intel_set_pch_fifo_underrun_reporting(struct drm_i915_private *dev_priv,
void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv, void intel_cpu_fifo_underrun_irq_handler(struct drm_i915_private *dev_priv,
enum pipe pipe) enum pipe pipe)
{ {
struct intel_crtc *crtc = dev_priv->pipe_to_crtc_mapping[pipe]; struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
/* We may be called too early in init, thanks BIOS! */ /* We may be called too early in init, thanks BIOS! */
if (crtc == NULL) if (crtc == NULL)
......
...@@ -3065,7 +3065,7 @@ bool intel_can_enable_sagv(struct drm_atomic_state *state) ...@@ -3065,7 +3065,7 @@ bool intel_can_enable_sagv(struct drm_atomic_state *state)
/* Since we're now guaranteed to only have one active CRTC... */ /* Since we're now guaranteed to only have one active CRTC... */
pipe = ffs(intel_state->active_crtcs) - 1; pipe = ffs(intel_state->active_crtcs) - 1;
crtc = dev_priv->pipe_to_crtc_mapping[pipe]; crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
cstate = to_intel_crtc_state(crtc->base.state); cstate = to_intel_crtc_state(crtc->base.state);
if (crtc->base.state->adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) if (crtc->base.state->adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE)
......
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