Signed-off-by: Rodrigo Vivi <[email protected]>
---
 src/sna/sna_accel.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 1663fe3..c1df7c9 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -14174,6 +14174,19 @@ static bool has_shadow(struct sna *sna)
             __FUNCTION__, sna->mode.shadow_flip));
        return !sna->mode.shadow_flip;
 }
+static bool psr_active(struct sna *sna)
+{
+       drm_i915_getparam_t gp;
+       int psr_active = 0;
+       int ret;
+
+       VG_CLEAR(gp);
+       gp.param = 27;
+       gp.value = &psr_active;
+
+       ret = drmIoctl(sna->kgem.fd, DRM_IOCTL_I915_GETPARAM, &gp);
+       return ret == 0 && psr_active;
+}
 
 static bool start_flush(struct sna *sna, struct sna_pixmap *scanout)
 {
@@ -14193,7 +14206,7 @@ static bool start_flush(struct sna *sna, struct 
sna_pixmap *scanout)
        if (!scanout)
                return false;
 
-       if (sna->flags & SNA_FLUSH_GTT && scanout->gpu_bo->gtt_dirty) {
+       if (psr_active(sna) && scanout->gpu_bo->gtt_dirty) {
                scanout->gpu_bo->needs_flush = true;
                return true;
        }
@@ -14219,7 +14232,7 @@ static bool stop_flush(struct sna *sna, struct 
sna_pixmap *scanout)
        if (!scanout)
                return false;
 
-       if (sna->flags & SNA_FLUSH_GTT && scanout->gpu_bo->gtt_dirty) {
+       if (psr_active(sna) && scanout->gpu_bo->gtt_dirty) {
                scanout->gpu_bo->needs_flush = true;
                return true;
        }
-- 
1.7.11.7

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to