[PATCH 1/2] exa: Add a check for screen extents.

Emmanuel Gil Peyrot emmanuel.peyrot at collabora.com
Mon Sep 11 18:07:28 UTC 2017


This prevents trying to get a screenshot when the user switched to
another VT, which was previously checked in fb.

Signed-off-by: Emmanuel Gil Peyrot <emmanuel.peyrot at collabora.com>
---
 exa/exa_unaccel.c | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c
index 73eada9c2..1dea9df56 100644
--- a/exa/exa_unaccel.c
+++ b/exa/exa_unaccel.c
@@ -403,11 +403,14 @@ ExaCheckGetImage(DrawablePtr pDrawable, int x, int y, int w, int h,
     EXA_PRE_FALLBACK(pScreen);
     EXA_FALLBACK(("from %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
 
-    ExaFallbackPrepareReg(pDrawable, NULL, x, y, w, h, EXA_PREPARE_SRC, FALSE);
-    swap(pExaScr, pScreen, GetImage);
-    pScreen->GetImage(pDrawable, x, y, w, h, format, planeMask, d);
-    swap(pExaScr, pScreen, GetImage);
-    exaFinishAccess(pDrawable, EXA_PREPARE_SRC);
+    if (RegionNotEmpty(pScreen->root->borderClip)) {
+        ExaFallbackPrepareReg(pDrawable, NULL, x, y, w, h, EXA_PREPARE_SRC, FALSE);
+        swap(pExaScr, pScreen, GetImage);
+        pScreen->GetImage(pDrawable, x, y, w, h, format, planeMask, d);
+        swap(pExaScr, pScreen, GetImage);
+        exaFinishAccess(pDrawable, EXA_PREPARE_SRC);
+    }
+
     EXA_POST_FALLBACK(pScreen);
 }
 
@@ -420,11 +423,15 @@ ExaCheckGetSpans(DrawablePtr pDrawable,
 
     EXA_PRE_FALLBACK(pScreen);
     EXA_FALLBACK(("from %p (%c)\n", pDrawable, exaDrawableLocation(pDrawable)));
-    exaPrepareAccess(pDrawable, EXA_PREPARE_SRC);
-    swap(pExaScr, pScreen, GetSpans);
-    pScreen->GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
-    swap(pExaScr, pScreen, GetSpans);
-    exaFinishAccess(pDrawable, EXA_PREPARE_SRC);
+
+    if (RegionNotEmpty(pScreen->root->borderClip)) {
+        exaPrepareAccess(pDrawable, EXA_PREPARE_SRC);
+        swap(pExaScr, pScreen, GetSpans);
+        pScreen->GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
+        swap(pExaScr, pScreen, GetSpans);
+        exaFinishAccess(pDrawable, EXA_PREPARE_SRC);
+    }
+
     EXA_POST_FALLBACK(pScreen);
 }
 
-- 
2.14.1



More information about the xorg-devel mailing list