summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2019-06-06 11:22:09 +0200
committerMichel Dänzer <michel@daenzer.net>2019-06-14 11:07:32 +0200
commit3109f088fdbd89c2ee8078625d4f073852492656 (patch)
tree92b617e8db2e38c0b618cb17f383de558cc440b4
parentfb06fb814700a47464abd756e1111dcc76d0d776 (diff)
dri2: Re-use previous CRTC when possible if pick_best_crtc returns NULL
This way, the MSC will continue ticking at the rate of (the last mode which was enabled for) that CRTC, instead of the client running unthrottled. Reviewed-and-tested-by: Flora Cui <flora.cui@amd.com>
-rw-r--r--src/amdgpu_dri2.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/amdgpu_dri2.c b/src/amdgpu_dri2.c
index d205428..824b1f6 100644
--- a/src/amdgpu_dri2.c
+++ b/src/amdgpu_dri2.c
@@ -422,10 +422,12 @@ xf86CrtcPtr amdgpu_dri2_drawable_crtc(DrawablePtr pDraw, Bool consider_disabled)
pDraw->x, pDraw->x + pDraw->width,
pDraw->y, pDraw->y + pDraw->height);
- if (crtc && pDraw->type == DRAWABLE_WINDOW) {
+ if (pDraw->type == DRAWABLE_WINDOW) {
struct dri2_window_priv *priv = get_dri2_window_priv((WindowPtr)pDraw);
- if (priv->crtc && priv->crtc != crtc) {
+ if (!crtc) {
+ crtc = priv->crtc;
+ } else if (priv->crtc && priv->crtc != crtc) {
CARD64 ust, mscold, mscnew;
if (amdgpu_dri2_get_crtc_msc(priv->crtc, &ust, &mscold) &&