diff options
author | Michel Dänzer <michel.daenzer@amd.com> | 2016-12-01 18:37:57 +0900 |
---|---|---|
committer | Michel Dänzer <michel@daenzer.net> | 2017-02-22 18:27:37 +0900 |
commit | 58cd1600057e41aade0106d4acf78e23eac6e44f (patch) | |
tree | 54c662551421d8eae7db1b1702b1ad258a238a6b /src/radeon_dri2.c | |
parent | 305e2cbf335837a2ab6a24e9ff65815afe038296 (diff) |
Allow toggling TearFree at runtime via output property
Option "TearFree" now sets the default value of the output property.
See the manpage update for details.
TearFree is now enabled by default for outputs using rotation or other
RandR transforms, and for RandR 1.4 slave outputs.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/radeon_dri2.c')
-rw-r--r-- | src/radeon_dri2.c | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c index d0dcf890..c108ceab 100644 --- a/src/radeon_dri2.c +++ b/src/radeon_dri2.c @@ -47,6 +47,7 @@ #include "radeon_bo_gem.h" #include <xf86Priv.h> +#include <X11/extensions/dpmsconst.h> #if DRI2INFOREC_VERSION >= 9 #define USE_DRI2_PRIME @@ -756,14 +757,34 @@ can_flip(ScrnInfoPtr pScrn, DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPtr back) { RADEONInfoPtr info = RADEONPTR(pScrn); + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + int num_crtcs_on; + int i; + + if (draw->type != DRAWABLE_WINDOW || + !info->allowPageFlip || + info->hwcursor_disabled || + info->drmmode.present_flipping || + !pScrn->vtSema || + !DRI2CanFlip(draw)) + return FALSE; + + for (i = 0, num_crtcs_on = 0; i < config->num_crtc; i++) { + xf86CrtcPtr crtc = config->crtc[i]; + drmmode_crtc_private_ptr drmmode_crtc = crtc->driver_private; + + if (!crtc->enabled) + continue; + + if (!drmmode_crtc || drmmode_crtc->rotate.bo || + drmmode_crtc->scanout[0].bo) + return FALSE; + + if (drmmode_crtc->pending_dpms_mode == DPMSModeOn) + num_crtcs_on++; + } - return draw->type == DRAWABLE_WINDOW && - info->allowPageFlip && - !info->hwcursor_disabled && - !info->drmmode.present_flipping && - pScrn->vtSema && - DRI2CanFlip(draw) && - can_exchange(pScrn, draw, front, back); + return num_crtcs_on > 0 && can_exchange(pScrn, draw, front, back); } static void |