diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-03-15 16:42:16 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2016-04-12 17:46:12 +0900 |
commit | 90a915c62d012e99193833aecc93974e68880c60 (patch) | |
tree | 0a62ede5f2d2c6ae4c5c7a4fe036e22c262d4e35 | |
parent | ba8b6288c8e6fc4be5d7144ecbe9a1f241881674 (diff) |
Add support for async flips to radeon_do_pageflip
Will be used by the next change. No functional change here.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | src/drmmode_display.c | 9 | ||||
-rw-r--r-- | src/drmmode_display.h | 9 | ||||
-rw-r--r-- | src/radeon_dri2.c | 2 | ||||
-rw-r--r-- | 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 a368a412..4c66ca70 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 c2957353..83c64820 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 84cd031f..62325bde 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 8988fc6c..c012fedd 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: |