[PATCH xf86-video-ati 1/2] Add support for async flips to radeon_do_pageflip

Michel Dänzer michel at daenzer.net
Fri Apr 1 09:52:23 UTC 2016


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

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

Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/drmmode_display.c | 9 +++++++--
 src/drmmode_display.h | 9 ++++++++-
 src/radeon_dri2.c     | 2 +-
 src/radeon_present.c  | 5 +++--
 4 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index a368a41..4c66ca7 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -2649,7 +2649,8 @@ void drmmode_uevent_fini(ScrnInfoPtr scrn, drmmode_ptr drmmode)
 Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 			uint32_t new_front_handle, uint64_t id, void *data,
 			int ref_crtc_hw_id, radeon_drm_handler_proc handler,
-			radeon_drm_abort_proc abort)
+			radeon_drm_abort_proc abort,
+			enum drmmode_flip_sync flip_sync)
 {
 	RADEONInfoPtr info = RADEONPTR(scrn);
 	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
@@ -2659,6 +2660,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 	unsigned int pitch;
 	int i;
 	uint32_t tiling_flags = 0;
+	uint32_t flip_flags = DRM_MODE_PAGE_FLIP_EVENT;
 	drmmode_flipdata_ptr flipdata;
 	uintptr_t drm_queue_seq = 0;
 
@@ -2705,6 +2707,9 @@ Bool radeon_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];
 
@@ -2731,7 +2736,7 @@ Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 		}
 
 		if (drmModePageFlip(drmmode->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 c295735..83c6482 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -125,6 +125,12 @@ typedef struct {
 } 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);
@@ -151,7 +157,8 @@ extern int drmmode_get_base_align(ScrnInfoPtr scrn, int bpe, uint32_t tiling);
 Bool radeon_do_pageflip(ScrnInfoPtr scrn, ClientPtr client,
 			uint32_t new_front_handle, uint64_t id, void *data,
 			int ref_crtc_hw_id, radeon_drm_handler_proc handler,
-			radeon_drm_abort_proc abort);
+			radeon_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);
 
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 84cd031..62325bd 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -737,7 +737,7 @@ radeon_dri2_schedule_flip(xf86CrtcPtr crtc, ClientPtr client,
 			   RADEON_DRM_QUEUE_ID_DEFAULT, flip_info,
 			   ref_crtc_hw_id,
 			   radeon_dri2_flip_event_handler,
-			   radeon_dri2_flip_event_abort)) {
+			   radeon_dri2_flip_event_abort, FLIP_VSYNC)) {
 	info->drmmode.dri2_flipping = TRUE;
 	return TRUE;
     }
diff --git a/src/radeon_present.c b/src/radeon_present.c
index 8988fc6..c012fed 100644
--- a/src/radeon_present.c
+++ b/src/radeon_present.c
@@ -338,7 +338,8 @@ radeon_present_flip(RRCrtcPtr crtc, uint64_t event_id, uint64_t target_msc,
     ret = radeon_do_pageflip(scrn, RADEON_DRM_QUEUE_CLIENT_DEFAULT, handle,
 			     event_id, event, crtc_id,
 			     radeon_present_flip_event,
-			     radeon_present_flip_abort);
+			     radeon_present_flip_abort,
+			     FLIP_VSYNC);
     if (!ret)
 	xf86DrvMsg(scrn->scrnIndex, X_ERROR, "present flip failed\n");
     else
@@ -381,7 +382,7 @@ radeon_present_unflip(ScreenPtr screen, uint64_t event_id)
 
     if (radeon_do_pageflip(scrn, RADEON_DRM_QUEUE_CLIENT_DEFAULT, handle,
 			   event_id, event, -1, radeon_present_flip_event,
-			   radeon_present_flip_abort))
+			   radeon_present_flip_abort, FLIP_VSYNC))
 	return;
 
 modeset:
-- 
2.8.0.rc3



More information about the xorg-driver-ati mailing list