diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/amdgpu_drv.h | 3 | ||||
-rw-r--r-- | src/amdgpu_kms.c | 8 | ||||
-rw-r--r-- | src/amdgpu_present.c | 7 | ||||
-rw-r--r-- | src/drmmode_display.c | 12 |
4 files changed, 28 insertions, 2 deletions
diff --git a/src/amdgpu_drv.h b/src/amdgpu_drv.h index e2e162e..200f0ba 100644 --- a/src/amdgpu_drv.h +++ b/src/amdgpu_drv.h @@ -165,6 +165,7 @@ typedef enum { OPTION_TEAR_FREE, OPTION_DELETE_DP12, OPTION_VARIABLE_REFRESH, + OPTION_ASYNC_FLIP_SECONDARIES, } AMDGPUOpts; static inline ScreenPtr @@ -306,6 +307,8 @@ typedef struct { /* kms pageflipping */ WindowPtr flip_window; Bool allowPageFlip; + Bool can_async_flip; + Bool async_flip_secondaries; /* cursor size */ int cursor_w; diff --git a/src/amdgpu_kms.c b/src/amdgpu_kms.c index 8997759..6d65c81 100644 --- a/src/amdgpu_kms.c +++ b/src/amdgpu_kms.c @@ -87,6 +87,7 @@ const OptionInfoRec AMDGPUOptions_KMS[] = { {OPTION_TEAR_FREE, "TearFree", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_DELETE_DP12, "DeleteUnusedDP12Displays", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_VARIABLE_REFRESH, "VariableRefresh", OPTV_BOOLEAN, {0}, FALSE }, + {OPTION_ASYNC_FLIP_SECONDARIES, "AsyncFlipSecondaries", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; @@ -1637,6 +1638,13 @@ Bool AMDGPUPreInit_KMS(ScrnInfoPtr pScrn, int flags) xf86DrvMsg(pScrn->scrnIndex, from, "VariableRefresh: %sabled\n", info->vrr_support ? "en" : "dis"); + + info->async_flip_secondaries = FALSE; + from = xf86GetOptValBool(info->Options, OPTION_ASYNC_FLIP_SECONDARIES, + &info->async_flip_secondaries) ? X_CONFIG : X_DEFAULT; + + xf86DrvMsg(pScrn->scrnIndex, from, "AsyncFlipSecondaries: %sabled\n", + info->async_flip_secondaries ? "en" : "dis"); } } diff --git a/src/amdgpu_present.c b/src/amdgpu_present.c index cc3d113..f768dd2 100644 --- a/src/amdgpu_present.c +++ b/src/amdgpu_present.c @@ -496,8 +496,13 @@ amdgpu_present_has_async_flip(ScreenPtr screen) Bool amdgpu_present_screen_init(ScreenPtr screen) { - if (amdgpu_present_has_async_flip(screen)) + ScrnInfoPtr scrn = xf86ScreenToScrn(screen); + AMDGPUInfoPtr info = AMDGPUPTR(scrn); + + if (amdgpu_present_has_async_flip(screen)) { amdgpu_present_screen_info.capabilities |= PresentCapabilityAsync; + info->can_async_flip = TRUE; + } if (!present_screen_init(screen, &amdgpu_present_screen_info)) { xf86DrvMsg(xf86ScreenToScrn(screen)->scrnIndex, X_WARNING, diff --git a/src/drmmode_display.c b/src/drmmode_display.c index b6cdde7..5b73fce 100644 --- a/src/drmmode_display.c +++ b/src/drmmode_display.c @@ -3970,17 +3970,27 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, uint32_t target_msc) { AMDGPUEntPtr pAMDGPUEnt = AMDGPUEntPriv(scrn); + AMDGPUInfoPtr info = AMDGPUPTR(scrn); xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); xf86CrtcPtr crtc = NULL; drmmode_crtc_private_ptr drmmode_crtc = config->crtc[0]->driver_private; int crtc_id; uint32_t flip_flags = flip_sync == FLIP_ASYNC ? DRM_MODE_PAGE_FLIP_ASYNC : 0; + uint32_t sec_flip_flags = flip_flags; drmmode_flipdata_ptr flipdata; Bool handle_deferred = FALSE; uintptr_t drm_queue_seq = 0; struct drmmode_fb *fb; int i = 0; + /* + * Flip secondary non-ref_crtc crtc's async if possible and requested + * by xorg.conf option "AsyncFlipSecondaries". Otherwise follow the lead + * of flip_sync. + */ + if (info->can_async_flip && info->async_flip_secondaries) + sec_flip_flags |= DRM_MODE_PAGE_FLIP_ASYNC; + flipdata = calloc(1, sizeof(*flipdata) + drmmode_crtc->drmmode->count_crtcs * sizeof(flipdata->fb[0])); if (!flipdata) { @@ -4081,7 +4091,7 @@ Bool amdgpu_do_pageflip(ScrnInfoPtr scrn, ClientPtr client, if (drmmode_page_flip_target_relative(pAMDGPUEnt, drmmode_crtc, flipdata->fb[crtc_id]->handle, - flip_flags, + sec_flip_flags, drm_queue_seq, 0) != 0) goto flip_error; } |