[PATCH xf86-video-amdgpu 06/13] DRI2: Move amdgpu_dri2_flip_event_handler

Michel Dänzer michel at daenzer.net
Tue Jun 2 02:21:24 PDT 2015


From: Michel Dänzer <michel.daenzer at amd.com>

In preparation for the next change, which will modify it to a static
function which needs to be in the new place. No functional change.

(Cherry picked from radeon commit c3fa22a479e61d1899fa9d327d9c4e2a7f64b0c1)

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/amdgpu_dri2.c | 120 +++++++++++++++++++++++++++---------------------------
 1 file changed, 60 insertions(+), 60 deletions(-)

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index fd98fa7..c139dec 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -497,6 +497,66 @@ xf86CrtcPtr amdgpu_dri2_drawable_crtc(DrawablePtr pDraw, Bool consider_disabled)
 		return NULL;
 }
 
+void amdgpu_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec,
+				    unsigned int tv_usec, void *event_data)
+{
+	DRI2FrameEventPtr flip = event_data;
+	DrawablePtr drawable;
+	ScreenPtr screen;
+	ScrnInfoPtr scrn;
+	int status;
+	PixmapPtr pixmap;
+
+	status = dixLookupDrawable(&drawable, flip->drawable_id, serverClient,
+				   M_ANY, DixWriteAccess);
+	if (status != Success) {
+		free(flip);
+		return;
+	}
+	if (!flip->crtc) {
+		free(flip);
+		return;
+	}
+	frame += amdgpu_get_interpolated_vblanks(flip->crtc);
+
+	screen = drawable->pScreen;
+	scrn = xf86ScreenToScrn(screen);
+
+	pixmap = screen->GetScreenPixmap(screen);
+	xf86DrvMsgVerb(scrn->scrnIndex, X_INFO, AMDGPU_LOGLEVEL_DEBUG,
+		       "%s:%d fevent[%p] width %d pitch %d (/4 %d)\n",
+		       __func__, __LINE__, flip, pixmap->drawable.width,
+		       pixmap->devKind, pixmap->devKind / 4);
+
+	/* We assume our flips arrive in order, so we don't check the frame */
+	switch (flip->type) {
+	case DRI2_SWAP:
+		/* Check for too small vblank count of pageflip completion, taking wraparound
+		 * into account. This usually means some defective kms pageflip completion,
+		 * causing wrong (msc, ust) return values and possible visual corruption.
+		 */
+		if ((frame < flip->frame) && (flip->frame - frame < 5)) {
+			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+				   "%s: Pageflip completion event has impossible msc %d < target_msc %d\n",
+				   __func__, frame, flip->frame);
+			/* All-Zero values signal failure of (msc, ust) timestamping to client. */
+			frame = tv_sec = tv_usec = 0;
+		}
+
+		DRI2SwapComplete(flip->client, drawable, frame, tv_sec, tv_usec,
+				 DRI2_FLIP_COMPLETE, flip->event_complete,
+				 flip->event_data);
+		break;
+	default:
+		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
+			   "%s: unknown vblank event received\n", __func__);
+		/* Unknown type */
+		break;
+	}
+
+	free(flip);
+}
+
 static Bool
 amdgpu_dri2_schedule_flip(ScrnInfoPtr scrn, ClientPtr client,
 			  DrawablePtr draw, DRI2BufferPtr front,
@@ -1130,66 +1190,6 @@ out_complete:
 	return TRUE;
 }
 
-void amdgpu_dri2_flip_event_handler(unsigned int frame, unsigned int tv_sec,
-				    unsigned int tv_usec, void *event_data)
-{
-	DRI2FrameEventPtr flip = event_data;
-	DrawablePtr drawable;
-	ScreenPtr screen;
-	ScrnInfoPtr scrn;
-	int status;
-	PixmapPtr pixmap;
-
-	status = dixLookupDrawable(&drawable, flip->drawable_id, serverClient,
-				   M_ANY, DixWriteAccess);
-	if (status != Success) {
-		free(flip);
-		return;
-	}
-	if (!flip->crtc) {
-		free(flip);
-		return;
-	}
-	frame += amdgpu_get_interpolated_vblanks(flip->crtc);
-
-	screen = drawable->pScreen;
-	scrn = xf86ScreenToScrn(screen);
-
-	pixmap = screen->GetScreenPixmap(screen);
-	xf86DrvMsgVerb(scrn->scrnIndex, X_INFO, AMDGPU_LOGLEVEL_DEBUG,
-		       "%s:%d fevent[%p] width %d pitch %d (/4 %d)\n",
-		       __func__, __LINE__, flip, pixmap->drawable.width,
-		       pixmap->devKind, pixmap->devKind / 4);
-
-	/* We assume our flips arrive in order, so we don't check the frame */
-	switch (flip->type) {
-	case DRI2_SWAP:
-		/* Check for too small vblank count of pageflip completion, taking wraparound
-		 * into account. This usually means some defective kms pageflip completion,
-		 * causing wrong (msc, ust) return values and possible visual corruption.
-		 */
-		if ((frame < flip->frame) && (flip->frame - frame < 5)) {
-			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-				   "%s: Pageflip completion event has impossible msc %d < target_msc %d\n",
-				   __func__, frame, flip->frame);
-			/* All-Zero values signal failure of (msc, ust) timestamping to client. */
-			frame = tv_sec = tv_usec = 0;
-		}
-
-		DRI2SwapComplete(flip->client, drawable, frame, tv_sec, tv_usec,
-				 DRI2_FLIP_COMPLETE, flip->event_complete,
-				 flip->event_data);
-		break;
-	default:
-		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
-			   "%s: unknown vblank event received\n", __func__);
-		/* Unknown type */
-		break;
-	}
-
-	free(flip);
-}
-
 /*
  * ScheduleSwap is responsible for requesting a DRM vblank event for the
  * appropriate frame.
-- 
2.1.4



More information about the xorg-driver-ati mailing list