xf86-video-amdgpu: Branch 'master' - 2 commits

Michel Dänzer daenzer at kemper.freedesktop.org
Thu May 12 07:34:12 UTC 2016


 src/amdgpu_dri2.c     |    2 +-
 src/amdgpu_present.c  |    8 +++-----
 src/drmmode_display.c |    9 +++++++--
 src/drmmode_display.h |   10 +++++++++-
 4 files changed, 20 insertions(+), 9 deletions(-)

New commits:
commit 86f991838824494e68ac277fa27cbd88c23a5ee8
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue May 10 15:57:04 2016 +0900

    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 driver
    advertises support for async flips.
    
    (Ported from radeon commit 1ca677309720e2f6c953c9e76f5b34c22a4416c6)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c
index e39b2d2..63ba812 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
commit 744ac5faff7f58e26fa76974b6bdc345ea4c7c79
Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue May 10 15:47:55 2016 +0900

    Add support for async flips to radeon_do_pageflip
    
    Will be used by the next change. No functional change here.
    
    (Ported from radeon commit 90a915c62d012e99193833aecc93974e68880c60)
    
    Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index 29f60ba..27a0c1a 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 4aa0708..e39b2d2 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 07ae9b2..64ee489 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);
@@ -2503,6 +2504,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 	drmmode_crtc_private_ptr drmmode_crtc = config->crtc[0]->driver_private;
 	drmmode_ptr drmmode = drmmode_crtc->drmmode;
 	int i;
+	uint32_t flip_flags = DRM_MODE_PAGE_FLIP_EVENT;
 	drmmode_flipdata_ptr flipdata;
 	uintptr_t drm_queue_seq = 0;
 	uint32_t new_front_handle;
@@ -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 24d517d..617f2bc 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -121,6 +121,13 @@ 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 +151,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);
 


More information about the xorg-commit mailing list