diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2014-12-22 16:30:13 +1000 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-01-22 12:14:57 +1000 |
commit | a91d322120a65ec5ada5518d948fda84aa87796f (patch) | |
tree | 421cbf7b775f1f32f51bcf1ddbaa6d77af7647a6 /drivers | |
parent | 495b21761a4bf50c0453766ed8fdcfed075d43ff (diff) | |
download | op-kernel-dev-a91d322120a65ec5ada5518d948fda84aa87796f.zip op-kernel-dev-a91d322120a65ec5ada5518d948fda84aa87796f.tar.gz |
drm/nv50-/kms: move identical scaler mode fixup code into a function
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/nouveau/nv50_display.c | 78 |
1 files changed, 24 insertions, 54 deletions
diff --git a/drivers/gpu/drm/nouveau/nv50_display.c b/drivers/gpu/drm/nouveau/nv50_display.c index 490b908..4f544f3 100644 --- a/drivers/gpu/drm/nouveau/nv50_display.c +++ b/drivers/gpu/drm/nouveau/nv50_display.c @@ -1466,6 +1466,26 @@ out: } /****************************************************************************** + * Encoder helpers + *****************************************************************************/ +static bool +nv50_encoder_mode_fixup(struct drm_encoder *encoder, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); + struct nouveau_connector *nv_connector; + + nv_connector = nouveau_encoder_connector_get(nv_encoder); + if (nv_connector && nv_connector->native_mode) { + if (nv_connector->scaling_mode != DRM_MODE_SCALE_NONE) + drm_mode_copy(adjusted_mode, nv_connector->native_mode); + } + + return true; +} + +/****************************************************************************** * DAC *****************************************************************************/ static void @@ -1492,26 +1512,6 @@ nv50_dac_dpms(struct drm_encoder *encoder, int mode) nvif_mthd(disp->disp, 0, &args, sizeof(args)); } -static bool -nv50_dac_mode_fixup(struct drm_encoder *encoder, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); - struct nouveau_connector *nv_connector; - - nv_connector = nouveau_encoder_connector_get(nv_encoder); - if (nv_connector && nv_connector->native_mode) { - if (nv_connector->scaling_mode != DRM_MODE_SCALE_NONE) { - int id = adjusted_mode->base.id; - *adjusted_mode = *nv_connector->native_mode; - adjusted_mode->base.id = id; - } - } - - return true; -} - static void nv50_dac_commit(struct drm_encoder *encoder) { @@ -1629,7 +1629,7 @@ nv50_dac_destroy(struct drm_encoder *encoder) static const struct drm_encoder_helper_funcs nv50_dac_hfunc = { .dpms = nv50_dac_dpms, - .mode_fixup = nv50_dac_mode_fixup, + .mode_fixup = nv50_encoder_mode_fixup, .prepare = nv50_dac_disconnect, .commit = nv50_dac_commit, .mode_set = nv50_dac_mode_set, @@ -1834,26 +1834,6 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode) } } -static bool -nv50_sor_mode_fixup(struct drm_encoder *encoder, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); - struct nouveau_connector *nv_connector; - - nv_connector = nouveau_encoder_connector_get(nv_encoder); - if (nv_connector && nv_connector->native_mode) { - if (nv_connector->scaling_mode != DRM_MODE_SCALE_NONE) { - int id = adjusted_mode->base.id; - *adjusted_mode = *nv_connector->native_mode; - adjusted_mode->base.id = id; - } - } - - return true; -} - static void nv50_sor_ctrl(struct nouveau_encoder *nv_encoder, u32 mask, u32 data) { @@ -2035,7 +2015,7 @@ nv50_sor_destroy(struct drm_encoder *encoder) static const struct drm_encoder_helper_funcs nv50_sor_hfunc = { .dpms = nv50_sor_dpms, - .mode_fixup = nv50_sor_mode_fixup, + .mode_fixup = nv50_encoder_mode_fixup, .prepare = nv50_sor_disconnect, .commit = nv50_sor_commit, .mode_set = nv50_sor_mode_set, @@ -2112,18 +2092,8 @@ nv50_pior_mode_fixup(struct drm_encoder *encoder, const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { - struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); - struct nouveau_connector *nv_connector; - - nv_connector = nouveau_encoder_connector_get(nv_encoder); - if (nv_connector && nv_connector->native_mode) { - if (nv_connector->scaling_mode != DRM_MODE_SCALE_NONE) { - int id = adjusted_mode->base.id; - *adjusted_mode = *nv_connector->native_mode; - adjusted_mode->base.id = id; - } - } - + if (!nv50_encoder_mode_fixup(encoder, mode, adjusted_mode)) + return false; adjusted_mode->clock *= 2; return true; } |