From: Rodrigo Vivi Subject: [PATCH DDX] sna: flush gtt when psr_active Date: Wed, 12 Jun 2013 17:57:24 -0300 Message-ID: <1371070644-1886-1-git-send-email-rodrigo.vivi@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-pd0-f176.google.com (mail-pd0-f176.google.com [209.85.192.176]) by gabe.freedesktop.org (Postfix) with ESMTP id 265A8E64AD for ; Wed, 12 Jun 2013 13:57:30 -0700 (PDT) Received: by mail-pd0-f176.google.com with SMTP id t12so5712640pdi.7 for ; Wed, 12 Jun 2013 13:57:29 -0700 (PDT) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org Signed-off-by: Rodrigo Vivi --- 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