[PATCH xf86-video-amdgpu 09/13] Move drmmode_do_crtc_dpms

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: "Leo (Sunpeng) Li" <sunpeng.li@xxxxxxx>

To avoid forward declarations in upcomming changes

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li at amd.com>
---
 src/drmmode_display.c | 118 +++++++++++++++++++++++++-------------------------
 1 file changed, 59 insertions(+), 59 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index f86f99a..45c582c 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -276,65 +276,6 @@ int drmmode_crtc_get_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc)
 }
 
 static void
-drmmode_do_crtc_dpms(xf86CrtcPtr crtc, int mode)
-{
-	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
-	ScrnInfoPtr scrn = crtc->scrn;
-	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
-	CARD64 ust;
-	int ret;
-
-	if (drmmode_crtc->dpms_mode == DPMSModeOn && mode != DPMSModeOn) {
-		uint32_t seq;
-
-		drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
-						drmmode_crtc->flip_pending);
-
-		/*
-		 * On->Off transition: record the last vblank time,
-		 * sequence number and frame period.
-		 */
-		if (!drmmode_wait_vblank(crtc, DRM_VBLANK_RELATIVE, 0, 0, &ust,
-					 &seq))
-			xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-				   "%s cannot get last vblank counter\n",
-				   __func__);
-		else {
-			CARD64 nominal_frame_rate, pix_in_frame;
-
-			drmmode_crtc->dpms_last_ust = ust;
-			drmmode_crtc->dpms_last_seq = seq;
-			nominal_frame_rate = crtc->mode.Clock;
-			nominal_frame_rate *= 1000;
-			pix_in_frame = crtc->mode.HTotal * crtc->mode.VTotal;
-			if (nominal_frame_rate == 0 || pix_in_frame == 0)
-				nominal_frame_rate = DEFAULT_NOMINAL_FRAME_RATE;
-			else
-				nominal_frame_rate /= pix_in_frame;
-			drmmode_crtc->dpms_last_fps = nominal_frame_rate;
-		}
-	} else if (drmmode_crtc->dpms_mode != DPMSModeOn && mode == DPMSModeOn) {
-		/*
-		 * Off->On transition: calculate and accumulate the
-		 * number of interpolated vblanks while we were in Off state
-		 */
-		ret = drmmode_get_current_ust(pAMDGPUEnt->fd, &ust);
-		if (ret)
-			xf86DrvMsg(scrn->scrnIndex, X_ERROR,
-				   "%s cannot get current time\n", __func__);
-		else if (drmmode_crtc->dpms_last_ust) {
-			CARD64 time_elapsed, delta_seq;
-			time_elapsed = ust - drmmode_crtc->dpms_last_ust;
-			delta_seq = time_elapsed * drmmode_crtc->dpms_last_fps;
-			delta_seq /= 1000000;
-			drmmode_crtc->interpolated_vblanks += delta_seq;
-
-		}
-	}
-	drmmode_crtc->dpms_mode = mode;
-}
-
-static void
 drmmode_crtc_dpms(xf86CrtcPtr crtc, int mode)
 {
 	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
@@ -1346,6 +1287,65 @@ static int drmmode_crtc_push_cm_prop(xf86CrtcPtr crtc,
 }
 
 static void
+drmmode_do_crtc_dpms(xf86CrtcPtr crtc, int mode)
+{
+	drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private;
+	ScrnInfoPtr scrn = crtc->scrn;
+	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
+	CARD64 ust;
+	int ret;
+
+	if (drmmode_crtc->dpms_mode == DPMSModeOn && mode != DPMSModeOn) {
+		uint32_t seq;
+
+		drmmode_crtc_wait_pending_event(drmmode_crtc, pAMDGPUEnt->fd,
+						drmmode_crtc->flip_pending);
+
+		/*
+		 * On->Off transition: record the last vblank time,
+		 * sequence number and frame period.
+		 */
+		if (!drmmode_wait_vblank(crtc, DRM_VBLANK_RELATIVE, 0, 0, &ust,
+					 &seq))
+			xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+				   "%s cannot get last vblank counter\n",
+				   __func__);
+		else {
+			CARD64 nominal_frame_rate, pix_in_frame;
+
+			drmmode_crtc->dpms_last_ust = ust;
+			drmmode_crtc->dpms_last_seq = seq;
+			nominal_frame_rate = crtc->mode.Clock;
+			nominal_frame_rate *= 1000;
+			pix_in_frame = crtc->mode.HTotal * crtc->mode.VTotal;
+			if (nominal_frame_rate == 0 || pix_in_frame == 0)
+				nominal_frame_rate = DEFAULT_NOMINAL_FRAME_RATE;
+			else
+				nominal_frame_rate /= pix_in_frame;
+			drmmode_crtc->dpms_last_fps = nominal_frame_rate;
+		}
+	} else if (drmmode_crtc->dpms_mode != DPMSModeOn && mode == DPMSModeOn) {
+		/*
+		 * Off->On transition: calculate and accumulate the
+		 * number of interpolated vblanks while we were in Off state
+		 */
+		ret = drmmode_get_current_ust(pAMDGPUEnt->fd, &ust);
+		if (ret)
+			xf86DrvMsg(scrn->scrnIndex, X_ERROR,
+				   "%s cannot get current time\n", __func__);
+		else if (drmmode_crtc->dpms_last_ust) {
+			CARD64 time_elapsed, delta_seq;
+			time_elapsed = ust - drmmode_crtc->dpms_last_ust;
+			delta_seq = time_elapsed * drmmode_crtc->dpms_last_fps;
+			delta_seq /= 1000000;
+			drmmode_crtc->interpolated_vblanks += delta_seq;
+		}
+
+	}
+	drmmode_crtc->dpms_mode = mode;
+}
+
+static void
 drmmode_crtc_gamma_do_set(xf86CrtcPtr crtc, uint16_t *red, uint16_t *green,
 			  uint16_t *blue, int size)
 {
-- 
2.7.4



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux