summaryrefslogtreecommitdiff
path: root/src/sna/sna_display.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-07-16 09:34:30 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-07-16 12:17:40 +0100
commitc564414157e27417f0de1c0542dafd9b47e01eda (patch)
treeb32e3fec5f0030c192c58a4e85c0a32b9bb21d3b /src/sna/sna_display.c
parent536e7ab756d6821db79e4cd79a250af1c0f7d5a3 (diff)
sna: Disable the scanout flush when switch off via DPMS
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/sna/sna_display.c')
-rw-r--r--src/sna/sna_display.c54
1 files changed, 30 insertions, 24 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 87a69ba9..b31f08d5 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -59,6 +59,7 @@
struct sna_crtc {
struct drm_mode_modeinfo kmode;
+ int dpms_mode;
struct kgem_bo *bo;
uint32_t cursor;
bool shadow;
@@ -655,11 +656,38 @@ sna_crtc_disable(xf86CrtcPtr crtc)
}
}
+static void update_flush_interval(struct sna *sna)
+{
+ xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(sna->scrn);
+ int i, max_vrefresh = 0;
+
+ for (i = 0; i < xf86_config->num_crtc; i++) {
+ if (!xf86_config->crtc[i]->enabled)
+ continue;
+
+ if (to_sna_crtc(xf86_config->crtc[i])->dpms_mode != DPMSModeOn)
+ continue;
+
+ max_vrefresh = max(max_vrefresh,
+ xf86ModeVRefresh(&xf86_config->crtc[i]->mode));
+ }
+
+ if (max_vrefresh == 0)
+ sna->vblank_interval = 0;
+ else
+ sna->vblank_interval = 1000 / max_vrefresh; /* Hz -> ms */
+
+ DBG(("max_vrefresh=%d, vblank_interval=%d ms\n",
+ max_vrefresh, sna->vblank_interval));
+}
+
static void
sna_crtc_dpms(xf86CrtcPtr crtc, int mode)
{
DBG(("%s(pipe %d, dpms mode -> %d):= active=%d\n",
__FUNCTION__, to_sna_crtc(crtc)->pipe, mode, mode == DPMSModeOn));
+ to_sna_crtc(crtc)->dpms_mode = mode;
+ update_flush_interval(to_sna(crtc->scrn));
}
void sna_mode_disable_unused(struct sna *sna)
@@ -799,28 +827,6 @@ cleanup_scratch:
FreeScratchPixmapHeader(scratch);
}
-static void update_flush_interval(struct sna *sna)
-{
- xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(sna->scrn);
- int i, max_vrefresh = 0;
-
- for (i = 0; i < xf86_config->num_crtc; i++) {
- if (!xf86_config->crtc[i]->enabled)
- continue;
-
- max_vrefresh = max(max_vrefresh,
- xf86ModeVRefresh(&xf86_config->crtc[i]->mode));
- }
-
- if (max_vrefresh == 0)
- sna->vblank_interval = 0;
- else
- sna->vblank_interval = 1000 / max_vrefresh; /* Hz -> ms */
-
- DBG(("max_vrefresh=%d, vblank_interval=%d ms\n",
- max_vrefresh, sna->vblank_interval));
-}
-
static bool use_shadow(struct sna *sna, xf86CrtcPtr crtc)
{
RRTransformPtr transform;
@@ -1107,8 +1113,6 @@ retry: /* Attach per-crtc pixmap or direct */
if (saved_bo)
kgem_bo_destroy(&sna->kgem, saved_bo);
- update_flush_interval(sna);
-
sna_crtc_randr(crtc);
if (sna_crtc->shadow)
sna_crtc_damage(crtc);
@@ -2619,6 +2623,8 @@ void sna_mode_update(struct sna *sna)
if (!crtc->active || !sna_crtc_is_bound(sna, crtc))
sna_crtc_disable(crtc);
}
+
+ update_flush_interval(sna);
}
static void