[PATCH 5/7] drm/cirrus: phase 3: use atomic .set_config helper

John Hunter zhjwpku at gmail.com
Thu Jul 30 03:08:56 PDT 2015


From: Zhao Junwang <zhjwpku at gmail.com>

Now that phase 1 and phase 2 are completed, switch .set_config
helper to use the atomic one.

-stop looking legacy crtc->primary->fb, instead we should use
crtc->primary->state->fb

.prepare() calls are no more needed, remove them
.mode_set() and .mode_set_base are no longer needed, remove

Signed-off-by: Zhao Junwang <zhjwpku at gmail.com>
---
 drivers/gpu/drm/cirrus/cirrus_mode.c |   28 ++++++----------------------
 1 file changed, 6 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c
index e8f038b..1775864 100644
--- a/drivers/gpu/drm/cirrus/cirrus_mode.c
+++ b/drivers/gpu/drm/cirrus/cirrus_mode.c
@@ -208,7 +208,8 @@ static void cirrus_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	sr07 = RREG8(SEQ_DATA);
 	sr07 &= 0xe0;
 	hdr = 0;
-	switch (crtc->primary->fb->bits_per_pixel) {
+
+	switch (crtc->primary->state->fb->bits_per_pixel) {
 	case 8:
 		sr07 |= 0x11;
 		break;
@@ -231,13 +232,13 @@ static void cirrus_crtc_mode_set_nofb(struct drm_crtc *crtc)
 	WREG_SEQ(0x7, sr07);
 
 	/* Program the pitch */
-	tmp = crtc->primary->fb->pitches[0] / 8;
+	tmp = crtc->primary->state->fb->pitches[0] / 8;
 	WREG_CRT(VGA_CRTC_OFFSET, tmp);
 
 	/* Enable extended blanking and pitch bits, and enable full memory */
 	tmp = 0x22;
-	tmp |= (crtc->primary->fb->pitches[0] >> 7) & 0x10;
-	tmp |= (crtc->primary->fb->pitches[0] >> 6) & 0x40;
+	tmp |= (crtc->primary->state->fb->pitches[0] >> 7) & 0x10;
+	tmp |= (crtc->primary->state->fb->pitches[0] >> 6) & 0x40;
 	WREG_CRT(0x1b, tmp);
 
 	/* Enable high-colour modes */
@@ -253,15 +254,6 @@ static void cirrus_crtc_mode_set_nofb(struct drm_crtc *crtc)
 }
 
 /*
- * This is called before a mode is programmed. A typical use might be to
- * enable DPMS during the programming to avoid seeing intermediate stages,
- * but that's not relevant to us
- */
-static void cirrus_crtc_prepare(struct drm_crtc *crtc)
-{
-}
-
-/*
  * This is called after a mode is programmed. It should reverse anything done
  * by the prepare function
  */
@@ -303,7 +295,7 @@ static void cirrus_crtc_destroy(struct drm_crtc *crtc)
 /* These provide the minimum set of functions required to handle a CRTC */
 static const struct drm_crtc_funcs cirrus_crtc_funcs = {
 	.gamma_set = cirrus_crtc_gamma_set,
-	.set_config = drm_crtc_helper_set_config,
+	.set_config = drm_atomic_helper_set_config,
 	.destroy = cirrus_crtc_destroy,
 	.reset = drm_atomic_helper_crtc_reset,
 	.atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state,
@@ -313,10 +305,7 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = {
 static const struct drm_crtc_helper_funcs cirrus_helper_funcs = {
 	.dpms = cirrus_crtc_dpms,
 	.mode_fixup = cirrus_crtc_mode_fixup,
-	.mode_set = drm_helper_crtc_mode_set,
-	.mode_set_base = drm_helper_crtc_mode_set_base,
 	.mode_set_nofb = cirrus_crtc_mode_set_nofb,
-	.prepare = cirrus_crtc_prepare,
 	.commit = cirrus_crtc_commit,
 	.load_lut = cirrus_crtc_load_lut,
 };
@@ -506,10 +495,6 @@ static void cirrus_encoder_dpms(struct drm_encoder *encoder, int state)
 	return;
 }
 
-static void cirrus_encoder_prepare(struct drm_encoder *encoder)
-{
-}
-
 static void cirrus_encoder_commit(struct drm_encoder *encoder)
 {
 }
@@ -525,7 +510,6 @@ static const struct drm_encoder_helper_funcs cirrus_encoder_helper_funcs = {
 	.dpms = cirrus_encoder_dpms,
 	.mode_fixup = cirrus_encoder_mode_fixup,
 	.mode_set = cirrus_encoder_mode_set,
-	.prepare = cirrus_encoder_prepare,
 	.commit = cirrus_encoder_commit,
 };
 
-- 
1.7.10.4




More information about the dri-devel mailing list