2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 06:34:11 +08:00

drm/i915: Pass dev_priv to intel_get_crtc_for_pipe()

Unify our approach to things by passing around dev_priv instead of dev.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1477946245-14134-11-git-send-email-ville.syrjala@linux.intel.com
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Ville Syrjälä 2016-10-31 22:37:09 +02:00
parent f0ce231040
commit b91eb5cce6
7 changed files with 17 additions and 20 deletions

View File

@ -4131,9 +4131,8 @@ static int pipe_crc_set_source(struct drm_i915_private *dev_priv,
enum pipe pipe, enum pipe pipe,
enum intel_pipe_crc_source source) enum intel_pipe_crc_source source)
{ {
struct drm_device *dev = &dev_priv->drm;
struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe]; struct intel_pipe_crc *pipe_crc = &dev_priv->pipe_crc[pipe];
struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev, pipe); struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
enum intel_display_power_domain power_domain; enum intel_display_power_domain power_domain;
u32 val = 0; /* shut up gcc */ u32 val = 0; /* shut up gcc */
int ret; int ret;

View File

@ -965,15 +965,16 @@ static int i915_get_vblank_timestamp(struct drm_device *dev, unsigned int pipe,
struct timeval *vblank_time, struct timeval *vblank_time,
unsigned flags) unsigned flags)
{ {
struct drm_i915_private *dev_priv = to_i915(dev);
struct intel_crtc *crtc; struct intel_crtc *crtc;
if (pipe >= INTEL_INFO(dev)->num_pipes) { if (pipe >= INTEL_INFO(dev_priv)->num_pipes) {
DRM_ERROR("Invalid crtc %u\n", pipe); DRM_ERROR("Invalid crtc %u\n", pipe);
return -EINVAL; return -EINVAL;
} }
/* Get drm_crtc to timestamp: */ /* Get drm_crtc to timestamp: */
crtc = intel_get_crtc_for_pipe(dev, pipe); crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
if (crtc == NULL) { if (crtc == NULL) {
DRM_ERROR("Invalid crtc %u\n", pipe); DRM_ERROR("Invalid crtc %u\n", pipe);
return -EINVAL; return -EINVAL;

View File

@ -7072,7 +7072,7 @@ static int ironlake_check_fdi_lanes(struct drm_device *dev, enum pipe pipe,
if (pipe_config->fdi_lanes <= 2) if (pipe_config->fdi_lanes <= 2)
return 0; return 0;
other_crtc = intel_get_crtc_for_pipe(dev, PIPE_C); other_crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_C);
other_crtc_state = other_crtc_state =
intel_atomic_get_crtc_state(state, other_crtc); intel_atomic_get_crtc_state(state, other_crtc);
if (IS_ERR(other_crtc_state)) if (IS_ERR(other_crtc_state))
@ -7091,7 +7091,7 @@ static int ironlake_check_fdi_lanes(struct drm_device *dev, enum pipe pipe,
return -EINVAL; return -EINVAL;
} }
other_crtc = intel_get_crtc_for_pipe(dev, PIPE_B); other_crtc = intel_get_crtc_for_pipe(dev_priv, PIPE_B);
other_crtc_state = other_crtc_state =
intel_atomic_get_crtc_state(state, other_crtc); intel_atomic_get_crtc_state(state, other_crtc);
if (IS_ERR(other_crtc_state)) if (IS_ERR(other_crtc_state))
@ -8106,7 +8106,7 @@ static void chv_prepare_pll(struct intel_crtc *crtc,
int vlv_force_pll_on(struct drm_i915_private *dev_priv, enum pipe pipe, int vlv_force_pll_on(struct drm_i915_private *dev_priv, enum pipe pipe,
const struct dpll *dpll) const struct dpll *dpll)
{ {
struct intel_crtc *crtc = intel_get_crtc_for_pipe(&dev_priv->drm, pipe); struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
struct intel_crtc_state *pipe_config; struct intel_crtc_state *pipe_config;
pipe_config = kzalloc(sizeof(*pipe_config), GFP_KERNEL); pipe_config = kzalloc(sizeof(*pipe_config), GFP_KERNEL);

View File

@ -1029,16 +1029,14 @@ vlv_pipe_to_channel(enum pipe pipe)
} }
static inline struct intel_crtc * static inline struct intel_crtc *
intel_get_crtc_for_pipe(struct drm_device *dev, int pipe) intel_get_crtc_for_pipe(struct drm_i915_private *dev_priv, enum pipe pipe)
{ {
struct drm_i915_private *dev_priv = to_i915(dev);
return dev_priv->pipe_to_crtc_mapping[pipe]; return dev_priv->pipe_to_crtc_mapping[pipe];
} }
static inline struct intel_crtc * static inline struct intel_crtc *
intel_get_crtc_for_plane(struct drm_device *dev, int plane) intel_get_crtc_for_plane(struct drm_i915_private *dev_priv, enum plane plane)
{ {
struct drm_i915_private *dev_priv = to_i915(dev);
return dev_priv->plane_to_crtc_mapping[plane]; return dev_priv->plane_to_crtc_mapping[plane];
} }
@ -1251,7 +1249,7 @@ intel_wait_for_vblank(struct drm_i915_private *dev_priv, enum pipe pipe)
static inline void static inline void
intel_wait_for_vblank_if_active(struct drm_i915_private *dev_priv, int pipe) intel_wait_for_vblank_if_active(struct drm_i915_private *dev_priv, int pipe)
{ {
const struct intel_crtc *crtc = intel_get_crtc_for_pipe(&dev_priv->drm, pipe); const struct intel_crtc *crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
if (crtc->active) if (crtc->active)
intel_wait_for_vblank(dev_priv, pipe); intel_wait_for_vblank(dev_priv, pipe);

View File

@ -396,7 +396,7 @@ intel_dvo_get_current_mode(struct drm_connector *connector)
struct intel_crtc *crtc; struct intel_crtc *crtc;
int pipe = (dvo_val & DVO_PIPE_B_SELECT) ? 1 : 0; int pipe = (dvo_val & DVO_PIPE_B_SELECT) ? 1 : 0;
crtc = intel_get_crtc_for_pipe(dev, pipe); crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
if (crtc) { if (crtc) {
mode = intel_crtc_mode_get(dev, &crtc->base); mode = intel_crtc_mode_get(dev, &crtc->base);
if (mode) { if (mode) {

View File

@ -1163,7 +1163,7 @@ void intel_lvds_init(struct drm_device *dev)
goto failed; goto failed;
pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0; pipe = (lvds & LVDS_PIPEB_SELECT) ? 1 : 0;
crtc = intel_get_crtc_for_pipe(dev, pipe); crtc = intel_get_crtc_for_pipe(dev_priv, pipe);
if (crtc && (lvds & LVDS_PORT_EN)) { if (crtc && (lvds & LVDS_PORT_EN)) {
fixed_mode = intel_crtc_mode_get(dev, &crtc->base); fixed_mode = intel_crtc_mode_get(dev, &crtc->base);

View File

@ -728,7 +728,7 @@ static bool g4x_compute_wm0(struct drm_i915_private *dev_priv,
int line_time_us, line_count; int line_time_us, line_count;
int entries, tlb_miss; int entries, tlb_miss;
crtc = intel_get_crtc_for_plane(&dev_priv->drm, plane); crtc = intel_get_crtc_for_plane(dev_priv, plane);
if (!intel_crtc_active(crtc)) { if (!intel_crtc_active(crtc)) {
*cursor_wm = cursor->guard_size; *cursor_wm = cursor->guard_size;
*plane_wm = display->guard_size; *plane_wm = display->guard_size;
@ -823,7 +823,7 @@ static bool g4x_compute_srwm(struct drm_i915_private *dev_priv,
return false; return false;
} }
crtc = intel_get_crtc_for_plane(&dev_priv->drm, plane); crtc = intel_get_crtc_for_plane(dev_priv, plane);
adjusted_mode = &crtc->config->base.adjusted_mode; adjusted_mode = &crtc->config->base.adjusted_mode;
fb = crtc->base.primary->state->fb; fb = crtc->base.primary->state->fb;
clock = adjusted_mode->crtc_clock; clock = adjusted_mode->crtc_clock;
@ -1393,9 +1393,8 @@ static void vlv_update_wm(struct intel_crtc *crtc)
static void g4x_update_wm(struct intel_crtc *crtc) static void g4x_update_wm(struct intel_crtc *crtc)
{ {
struct drm_device *dev = crtc->base.dev; struct drm_i915_private *dev_priv = to_i915(crtc->base.dev);
static const int sr_latency_ns = 12000; static const int sr_latency_ns = 12000;
struct drm_i915_private *dev_priv = to_i915(dev);
int planea_wm, planeb_wm, cursora_wm, cursorb_wm; int planea_wm, planeb_wm, cursora_wm, cursorb_wm;
int plane_sr, cursor_sr; int plane_sr, cursor_sr;
unsigned int enabled = 0; unsigned int enabled = 0;
@ -1546,7 +1545,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
wm_info = &i830_a_wm_info; wm_info = &i830_a_wm_info;
fifo_size = dev_priv->display.get_fifo_size(dev, 0); fifo_size = dev_priv->display.get_fifo_size(dev, 0);
crtc = intel_get_crtc_for_plane(dev, 0); crtc = intel_get_crtc_for_plane(dev_priv, 0);
if (intel_crtc_active(crtc)) { if (intel_crtc_active(crtc)) {
const struct drm_display_mode *adjusted_mode = const struct drm_display_mode *adjusted_mode =
&crtc->config->base.adjusted_mode; &crtc->config->base.adjusted_mode;
@ -1573,7 +1572,7 @@ static void i9xx_update_wm(struct intel_crtc *unused_crtc)
wm_info = &i830_bc_wm_info; wm_info = &i830_bc_wm_info;
fifo_size = dev_priv->display.get_fifo_size(dev, 1); fifo_size = dev_priv->display.get_fifo_size(dev, 1);
crtc = intel_get_crtc_for_plane(dev, 1); crtc = intel_get_crtc_for_plane(dev_priv, 1);
if (intel_crtc_active(crtc)) { if (intel_crtc_active(crtc)) {
const struct drm_display_mode *adjusted_mode = const struct drm_display_mode *adjusted_mode =
&crtc->config->base.adjusted_mode; &crtc->config->base.adjusted_mode;