aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-11-12 14:55:14 -0500
committerDave Airlie <airlied@redhat.com>2009-12-01 20:36:43 -0500
commit80297e87bc9728a6ce559063fc4c117eba1f955a (patch)
treef68e1cf3628cf547cf58808c7506824e0000596a /drivers/gpu
parentfe6890c3e8019cf1cebce60a86c19180359d3292 (diff)
drm/radeon/kms: rework scaler handling
Keep requested scaler type in radeon_encoder and the actual scaler type used in radeon_crtc. This prevents us from enabling the scaler when it's not required (i.e., the requested mode is the native mode). Also, always set the adjusted mode equal to the native mode for lvds. Should fix: https://bugzilla.redhat.com/show_bug.cgi?id=522271 Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Acked-by: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c12
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c39
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_encoders.c71
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h3
4 files changed, 40 insertions, 85 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 8b117e82e5e9..5859109f924d 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -750,9 +750,17 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
750 if (encoder->crtc != crtc) 750 if (encoder->crtc != crtc)
751 continue; 751 continue;
752 if (first) { 752 if (first) {
753 radeon_crtc->rmx_type = radeon_encoder->rmx_type; 753 /* set scaling */
754 if (radeon_encoder->rmx_type == RMX_OFF)
755 radeon_crtc->rmx_type = RMX_OFF;
756 else if (mode->hdisplay < radeon_encoder->native_mode.hdisplay ||
757 mode->vdisplay < radeon_encoder->native_mode.vdisplay)
758 radeon_crtc->rmx_type = radeon_encoder->rmx_type;
759 else
760 radeon_crtc->rmx_type = RMX_OFF;
761 /* copy native mode */
754 memcpy(&radeon_crtc->native_mode, 762 memcpy(&radeon_crtc->native_mode,
755 &radeon_encoder->native_mode, 763 &radeon_encoder->native_mode,
756 sizeof(struct drm_display_mode)); 764 sizeof(struct drm_display_mode));
757 first = false; 765 first = false;
758 } else { 766 } else {
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index d42bc512d75a..57a29f36115e 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -163,29 +163,6 @@ radeon_get_connector_for_encoder(struct drm_encoder *encoder)
163 return NULL; 163 return NULL;
164} 164}
165 165
166/* used for both atom and legacy */
167void radeon_rmx_mode_fixup(struct drm_encoder *encoder,
168 struct drm_display_mode *mode,
169 struct drm_display_mode *adjusted_mode)
170{
171 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
172 struct drm_device *dev = encoder->dev;
173 struct radeon_device *rdev = dev->dev_private;
174 struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
175
176 if (mode->hdisplay < native_mode->hdisplay ||
177 mode->vdisplay < native_mode->vdisplay) {
178 int mode_id = adjusted_mode->base.id;
179 *adjusted_mode = *native_mode;
180 if (!ASIC_IS_AVIVO(rdev)) {
181 adjusted_mode->hdisplay = mode->hdisplay;
182 adjusted_mode->vdisplay = mode->vdisplay;
183 }
184 adjusted_mode->base.id = mode_id;
185 }
186}
187
188
189static bool radeon_atom_mode_fixup(struct drm_encoder *encoder, 166static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
190 struct drm_display_mode *mode, 167 struct drm_display_mode *mode,
191 struct drm_display_mode *adjusted_mode) 168 struct drm_display_mode *adjusted_mode)
@@ -198,14 +175,24 @@ static bool radeon_atom_mode_fixup(struct drm_encoder *encoder,
198 radeon_encoder_set_active_device(encoder); 175 radeon_encoder_set_active_device(encoder);
199 drm_mode_set_crtcinfo(adjusted_mode, 0); 176 drm_mode_set_crtcinfo(adjusted_mode, 0);
200 177
201 if (radeon_encoder->rmx_type != RMX_OFF)
202 radeon_rmx_mode_fixup(encoder, mode, adjusted_mode);
203
204 /* hw bug */ 178 /* hw bug */
205 if ((mode->flags & DRM_MODE_FLAG_INTERLACE) 179 if ((mode->flags & DRM_MODE_FLAG_INTERLACE)
206 && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2))) 180 && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2)))
207 adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2; 181 adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2;
208 182
183 /* get the native mode for LVDS */
184 if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) {
185 struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
186 int mode_id = adjusted_mode->base.id;
187 *adjusted_mode = *native_mode;
188 if (!ASIC_IS_AVIVO(rdev)) {
189 adjusted_mode->hdisplay = mode->hdisplay;
190 adjusted_mode->vdisplay = mode->vdisplay;
191 }
192 adjusted_mode->base.id = mode_id;
193 }
194
195 /* get the native mode for TV */
209 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) { 196 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) {
210 struct radeon_encoder_atom_dac *tv_dac = radeon_encoder->enc_priv; 197 struct radeon_encoder_atom_dac *tv_dac = radeon_encoder->enc_priv;
211 if (tv_dac) { 198 if (tv_dac) {
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index a1d9d29319b2..ae554bfa0548 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -184,9 +184,9 @@ static void radeon_legacy_lvds_mode_set(struct drm_encoder *encoder,
184 radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); 184 radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
185} 185}
186 186
187static bool radeon_legacy_lvds_mode_fixup(struct drm_encoder *encoder, 187static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder,
188 struct drm_display_mode *mode, 188 struct drm_display_mode *mode,
189 struct drm_display_mode *adjusted_mode) 189 struct drm_display_mode *adjusted_mode)
190{ 190{
191 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 191 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
192 192
@@ -194,15 +194,22 @@ static bool radeon_legacy_lvds_mode_fixup(struct drm_encoder *encoder,
194 radeon_encoder_set_active_device(encoder); 194 radeon_encoder_set_active_device(encoder);
195 drm_mode_set_crtcinfo(adjusted_mode, 0); 195 drm_mode_set_crtcinfo(adjusted_mode, 0);
196 196
197 if (radeon_encoder->rmx_type != RMX_OFF) 197 /* get the native mode for LVDS */
198 radeon_rmx_mode_fixup(encoder, mode, adjusted_mode); 198 if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) {
199 struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
200 int mode_id = adjusted_mode->base.id;
201 *adjusted_mode = *native_mode;
202 adjusted_mode->hdisplay = mode->hdisplay;
203 adjusted_mode->vdisplay = mode->vdisplay;
204 adjusted_mode->base.id = mode_id;
205 }
199 206
200 return true; 207 return true;
201} 208}
202 209
203static const struct drm_encoder_helper_funcs radeon_legacy_lvds_helper_funcs = { 210static const struct drm_encoder_helper_funcs radeon_legacy_lvds_helper_funcs = {
204 .dpms = radeon_legacy_lvds_dpms, 211 .dpms = radeon_legacy_lvds_dpms,
205 .mode_fixup = radeon_legacy_lvds_mode_fixup, 212 .mode_fixup = radeon_legacy_mode_fixup,
206 .prepare = radeon_legacy_lvds_prepare, 213 .prepare = radeon_legacy_lvds_prepare,
207 .mode_set = radeon_legacy_lvds_mode_set, 214 .mode_set = radeon_legacy_lvds_mode_set,
208 .commit = radeon_legacy_lvds_commit, 215 .commit = radeon_legacy_lvds_commit,
@@ -214,17 +221,6 @@ static const struct drm_encoder_funcs radeon_legacy_lvds_enc_funcs = {
214 .destroy = radeon_enc_destroy, 221 .destroy = radeon_enc_destroy,
215}; 222};
216 223
217static bool radeon_legacy_primary_dac_mode_fixup(struct drm_encoder *encoder,
218 struct drm_display_mode *mode,
219 struct drm_display_mode *adjusted_mode)
220{
221 /* set the active encoder to connector routing */
222 radeon_encoder_set_active_device(encoder);
223 drm_mode_set_crtcinfo(adjusted_mode, 0);
224
225 return true;
226}
227
228static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode) 224static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode)
229{ 225{
230 struct drm_device *dev = encoder->dev; 226 struct drm_device *dev = encoder->dev;
@@ -410,7 +406,7 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc
410 406
411static const struct drm_encoder_helper_funcs radeon_legacy_primary_dac_helper_funcs = { 407static const struct drm_encoder_helper_funcs radeon_legacy_primary_dac_helper_funcs = {
412 .dpms = radeon_legacy_primary_dac_dpms, 408 .dpms = radeon_legacy_primary_dac_dpms,
413 .mode_fixup = radeon_legacy_primary_dac_mode_fixup, 409 .mode_fixup = radeon_legacy_mode_fixup,
414 .prepare = radeon_legacy_primary_dac_prepare, 410 .prepare = radeon_legacy_primary_dac_prepare,
415 .mode_set = radeon_legacy_primary_dac_mode_set, 411 .mode_set = radeon_legacy_primary_dac_mode_set,
416 .commit = radeon_legacy_primary_dac_commit, 412 .commit = radeon_legacy_primary_dac_commit,
@@ -423,17 +419,6 @@ static const struct drm_encoder_funcs radeon_legacy_primary_dac_enc_funcs = {
423 .destroy = radeon_enc_destroy, 419 .destroy = radeon_enc_destroy,
424}; 420};
425 421
426static bool radeon_legacy_tmds_int_mode_fixup(struct drm_encoder *encoder,
427 struct drm_display_mode *mode,
428 struct drm_display_mode *adjusted_mode)
429{
430 /* set the active encoder to connector routing */
431 radeon_encoder_set_active_device(encoder);
432 drm_mode_set_crtcinfo(adjusted_mode, 0);
433
434 return true;
435}
436
437static void radeon_legacy_tmds_int_dpms(struct drm_encoder *encoder, int mode) 422static void radeon_legacy_tmds_int_dpms(struct drm_encoder *encoder, int mode)
438{ 423{
439 struct drm_device *dev = encoder->dev; 424 struct drm_device *dev = encoder->dev;
@@ -585,7 +570,7 @@ static void radeon_legacy_tmds_int_mode_set(struct drm_encoder *encoder,
585 570
586static const struct drm_encoder_helper_funcs radeon_legacy_tmds_int_helper_funcs = { 571static const struct drm_encoder_helper_funcs radeon_legacy_tmds_int_helper_funcs = {
587 .dpms = radeon_legacy_tmds_int_dpms, 572 .dpms = radeon_legacy_tmds_int_dpms,
588 .mode_fixup = radeon_legacy_tmds_int_mode_fixup, 573 .mode_fixup = radeon_legacy_mode_fixup,
589 .prepare = radeon_legacy_tmds_int_prepare, 574 .prepare = radeon_legacy_tmds_int_prepare,
590 .mode_set = radeon_legacy_tmds_int_mode_set, 575 .mode_set = radeon_legacy_tmds_int_mode_set,
591 .commit = radeon_legacy_tmds_int_commit, 576 .commit = radeon_legacy_tmds_int_commit,
@@ -597,17 +582,6 @@ static const struct drm_encoder_funcs radeon_legacy_tmds_int_enc_funcs = {
597 .destroy = radeon_enc_destroy, 582 .destroy = radeon_enc_destroy,
598}; 583};
599 584
600static bool radeon_legacy_tmds_ext_mode_fixup(struct drm_encoder *encoder,
601 struct drm_display_mode *mode,
602 struct drm_display_mode *adjusted_mode)
603{
604 /* set the active encoder to connector routing */
605 radeon_encoder_set_active_device(encoder);
606 drm_mode_set_crtcinfo(adjusted_mode, 0);
607
608 return true;
609}
610
611static void radeon_legacy_tmds_ext_dpms(struct drm_encoder *encoder, int mode) 585static void radeon_legacy_tmds_ext_dpms(struct drm_encoder *encoder, int mode)
612{ 586{
613 struct drm_device *dev = encoder->dev; 587 struct drm_device *dev = encoder->dev;
@@ -742,7 +716,7 @@ static void radeon_ext_tmds_enc_destroy(struct drm_encoder *encoder)
742 716
743static const struct drm_encoder_helper_funcs radeon_legacy_tmds_ext_helper_funcs = { 717static const struct drm_encoder_helper_funcs radeon_legacy_tmds_ext_helper_funcs = {
744 .dpms = radeon_legacy_tmds_ext_dpms, 718 .dpms = radeon_legacy_tmds_ext_dpms,
745 .mode_fixup = radeon_legacy_tmds_ext_mode_fixup, 719 .mode_fixup = radeon_legacy_mode_fixup,
746 .prepare = radeon_legacy_tmds_ext_prepare, 720 .prepare = radeon_legacy_tmds_ext_prepare,
747 .mode_set = radeon_legacy_tmds_ext_mode_set, 721 .mode_set = radeon_legacy_tmds_ext_mode_set,
748 .commit = radeon_legacy_tmds_ext_commit, 722 .commit = radeon_legacy_tmds_ext_commit,
@@ -754,17 +728,6 @@ static const struct drm_encoder_funcs radeon_legacy_tmds_ext_enc_funcs = {
754 .destroy = radeon_ext_tmds_enc_destroy, 728 .destroy = radeon_ext_tmds_enc_destroy,
755}; 729};
756 730
757static bool radeon_legacy_tv_dac_mode_fixup(struct drm_encoder *encoder,
758 struct drm_display_mode *mode,
759 struct drm_display_mode *adjusted_mode)
760{
761 /* set the active encoder to connector routing */
762 radeon_encoder_set_active_device(encoder);
763 drm_mode_set_crtcinfo(adjusted_mode, 0);
764
765 return true;
766}
767
768static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode) 731static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode)
769{ 732{
770 struct drm_device *dev = encoder->dev; 733 struct drm_device *dev = encoder->dev;
@@ -1281,7 +1244,7 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder
1281 1244
1282static const struct drm_encoder_helper_funcs radeon_legacy_tv_dac_helper_funcs = { 1245static const struct drm_encoder_helper_funcs radeon_legacy_tv_dac_helper_funcs = {
1283 .dpms = radeon_legacy_tv_dac_dpms, 1246 .dpms = radeon_legacy_tv_dac_dpms,
1284 .mode_fixup = radeon_legacy_tv_dac_mode_fixup, 1247 .mode_fixup = radeon_legacy_mode_fixup,
1285 .prepare = radeon_legacy_tv_dac_prepare, 1248 .prepare = radeon_legacy_tv_dac_prepare,
1286 .mode_set = radeon_legacy_tv_dac_mode_set, 1249 .mode_set = radeon_legacy_tv_dac_mode_set,
1287 .commit = radeon_legacy_tv_dac_commit, 1250 .commit = radeon_legacy_tv_dac_commit,
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 27ddc9b9a9ed..d7a29ce19df8 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -473,9 +473,6 @@ void radeon_get_clock_info(struct drm_device *dev);
473extern bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev); 473extern bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev);
474extern bool radeon_get_atom_connector_info_from_supported_devices_table(struct drm_device *dev); 474extern bool radeon_get_atom_connector_info_from_supported_devices_table(struct drm_device *dev);
475 475
476void radeon_rmx_mode_fixup(struct drm_encoder *encoder,
477 struct drm_display_mode *mode,
478 struct drm_display_mode *adjusted_mode);
479void radeon_enc_destroy(struct drm_encoder *encoder); 476void radeon_enc_destroy(struct drm_encoder *encoder);
480void radeon_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj); 477void radeon_copy_fb(struct drm_device *dev, struct drm_gem_object *dst_obj);
481void radeon_combios_asic_init(struct drm_device *dev); 478void radeon_combios_asic_init(struct drm_device *dev);