Attached to mirror radeon commit messages.

Cheers,

Tom
From 99d53a54ec9369949f15d95765d0b4239b5c3bed Mon Sep 17 00:00:00 2001
From: Tom St Denis <[email protected]>
Date: Wed, 13 Apr 2016 11:55:57 -0400
Subject: [PATCH 1/2] Add support for async flips to radeon_do_pageflip

Will be used by the next change. No functional change here.

Based on radeon commit 90a915c62d012e99193833aecc93974e68880c60

Signed-off-by: Tom St Denis <[email protected]>
---
 src/amdgpu_dri2.c     | 2 +-
 src/amdgpu_present.c  | 5 +++--
 src/drmmode_display.c | 9 +++++++--
 src/drmmode_display.h | 8 +++++++-
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 29f60ba11929..27a0c1a4042f 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -615,7 +615,7 @@ amdgpu_dri2_schedule_flip(xf86CrtcPtr crtc, ClientPtr client,
 			       AMDGPU_DRM_QUEUE_ID_DEFAULT, flip_info,
 			       ref_crtc_hw_id,
 			       amdgpu_dri2_flip_event_handler,
-			       amdgpu_dri2_flip_event_abort)) {
+			       amdgpu_dri2_flip_event_abort, FLIP_VSYNC)) {
 		info->drmmode.dri2_flipping = TRUE;
 		return TRUE;
 	}
diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index 4aa070823903..e39b2d28c897 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -311,7 +311,8 @@ amdgpu_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
 	ret = amdgpu_do_pageflip(scrn, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT,
 				 pixmap, event_id, event, crtc_id,
 				 amdgpu_present_flip_event,
-				 amdgpu_present_flip_abort);
+				 amdgpu_present_flip_abort,
+				 FLIP_VSYNC);
 	if (!ret)
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR, "present flip failed\n");
 	else
@@ -348,7 +349,7 @@ amdgpu_present_unflip(ScreenPtr screen, uint64_t event_id)
 
 	if (amdgpu_do_pageflip(scrn, AMDGPU_DRM_QUEUE_CLIENT_DEFAULT, pixmap,
 			       event_id, event, -1, amdgpu_present_flip_event,
-			       amdgpu_present_flip_abort))
+			       amdgpu_present_flip_abort, FLIP_VSYNC))
 		return;
 
 modeset:
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 07ae9b2c411f..d043ebdce6b2 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2495,7 +2495,8 @@ void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode)
 Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 			PixmapPtr new_front, uint64_t id, void *data,
 			int ref_crtc_hw_id, amdgpu_drm_handler_proc handler,
-			amdgpu_drm_abort_proc abort)
+			amdgpu_drm_abort_proc abort,
+			enum drmmode_flip_sync flip_sync)
 {
 	AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn);
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -2506,6 +2507,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 	drmmode_flipdata_ptr flipdata;
 	uintptr_t drm_queue_seq = 0;
 	uint32_t new_front_handle;
+	uint32_t flip_flags = DRM_MODE_PAGE_FLIP_EVENT;
 
 	if (!amdgpu_pixmap_get_handle(new_front, &new_front_handle)) {
 		xf86DrvMsg(scrn->scrnIndex, X_WARNING,
@@ -2544,6 +2546,9 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 	flipdata->handler = handler;
 	flipdata->abort = abort;
 
+	if (flip_sync == FLIP_ASYNC)
+		flip_flags |= DRM_MODE_PAGE_FLIP_ASYNC;
+
 	for (i = 0; i < config->num_crtc; i++) {
 		crtc = config->crtc[i];
 
@@ -2570,7 +2575,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 		}
 
 		if (drmModePageFlip(pAMDGPUEnt->fd, drmmode_crtc->mode_crtc->crtc_id,
-				    drmmode->fb_id, DRM_MODE_PAGE_FLIP_EVENT,
+				    drmmode->fb_id, flip_flags,
 				    (void*)drm_queue_seq)) {
 			xf86DrvMsg(scrn->scrnIndex, X_WARNING,
 				   "flip queue failed: %s\n", strerror(errno));
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 24d517d89859..1f730136f428 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -121,6 +121,11 @@ typedef struct {
 	int enc_clone_mask;
 } drmmode_output_private_rec, *drmmode_output_private_ptr;
 
+enum drmmode_flip_sync {
+	FLIP_VSYNC,
+	FLIP_ASYNC,
+};
+
 extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
 extern void drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
 extern void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
@@ -144,7 +149,8 @@ extern int drmmode_get_pitch_align(ScrnInfoPtr scrn, int bpe);
 Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 			PixmapPtr new_front, uint64_t id, void *data,
 			int ref_crtc_hw_id, amdgpu_drm_handler_proc handler,
-			amdgpu_drm_abort_proc abort);
+			amdgpu_drm_abort_proc abort,
+			enum drmmode_flip_sync flip_sync);
 int drmmode_crtc_get_ust_msc(xf86CrtcPtr crtc, CARD64 *ust, CARD64 *msc);
 int drmmode_get_current_ust(int drm_fd, CARD64 * ust);
 
-- 
2.8.1

From 028820fcfb38d724e7bc4506d103496214243fc3 Mon Sep 17 00:00:00 2001
From: Tom St Denis <[email protected]>
Date: Wed, 13 Apr 2016 11:58:33 -0400
Subject: [PATCH 2/2] present: Support async flips

The xserver Present code only calls radeon_present_flip with
sync_flip=FALSE if radeon_present_screen_init sets
PresentCapabilityAsync, and the latter only sets it if the kernel drive
advertises support for async flips.

Based on radeon commit 1ca677309720e2f6c953c9e76f5b34c22a4416c6

Signed-off-by: Tom St Denis <[email protected]>
---
 src/amdgpu_present.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index e39b2d28c897..63ba81281899 100644
--- a/src/amdgpu_present.c
+++ b/src/amdgpu_present.c
@@ -233,9 +233,6 @@ amdgpu_present_check_flip(RRCrtcPtr crtc, WindowPtr window, PixmapPtr pixmap,
 	if (info->hwcursor_disabled)
 		return FALSE;
 
-	if (!sync_flip)
-		return FALSE;
-
 	if (info->drmmode.dri2_flipping)
 		return FALSE;
 
@@ -312,7 +309,7 @@ amdgpu_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
 				 pixmap, event_id, event, crtc_id,
 				 amdgpu_present_flip_event,
 				 amdgpu_present_flip_abort,
-				 FLIP_VSYNC);
+				 sync_flip ? FLIP_VSYNC : FLIP_ASYNC);
 	if (!ret)
 		xf86DrvMsg(scrn->scrnIndex, X_ERROR, "present flip failed\n");
 	else
-- 
2.8.1

_______________________________________________
xorg-driver-ati mailing list
[email protected]
https://lists.x.org/mailman/listinfo/xorg-driver-ati

Reply via email to