summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-08-12 10:49:20 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-08-12 10:49:20 +0100
commit9cc72c2dc7130d3d5731f7e75f35f10302389f08 (patch)
tree23f48731f0bcbf9a1f13a15a2e2681563c71734a
parentb3138bee8db7db6ebaa10ecdd09c47f899d24c8c (diff)
sna: Suppress "switch to mode" messages for internal CRTC applies
We only want to log a mode change when it is initiated by the user. For internal updates, such as changing the frame or restoring a mode from DPMS, we want to silently apply the current mode. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_display.c86
1 files changed, 46 insertions, 40 deletions
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 4f69dacd..f723481e 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -2046,41 +2046,14 @@ static const char *reflection_to_str(Rotation rotation)
}
static Bool
-sna_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
- Rotation rotation, int x, int y)
+__sna_crtc_set_mode(xf86CrtcPtr crtc)
{
- ScrnInfoPtr scrn = crtc->scrn;
- struct sna *sna = to_sna(scrn);
+ struct sna *sna = to_sna(crtc->scrn);
struct sna_crtc *sna_crtc = to_sna_crtc(crtc);
struct kgem_bo *saved_bo, *bo;
- struct drm_mode_modeinfo saved_kmode;
uint32_t saved_offset;
bool saved_transform;
- char outputs[256];
-
- if (mode->HDisplay == 0 || mode->VDisplay == 0)
- return FALSE;
-
- assert(sna_crtc);
-
- xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO,
- "switch to mode %dx%d@%.1f on %s using pipe %d, position (%d, %d), rotation %s, reflection %s\n",
- mode->HDisplay, mode->VDisplay, xf86ModeVRefresh(mode),
- outputs_for_crtc(crtc, outputs, sizeof(outputs)), sna_crtc->pipe,
- x, y, rotation_to_str(rotation), reflection_to_str(rotation));
- assert(mode->HDisplay <= sna->mode.max_crtc_width &&
- mode->VDisplay <= sna->mode.max_crtc_height);
-
-#if HAS_GAMMA
- drmModeCrtcSetGamma(sna->kgem.fd, sna_crtc->id,
- crtc->gamma_size,
- crtc->gamma_red,
- crtc->gamma_green,
- crtc->gamma_blue);
-#endif
-
- saved_kmode = sna_crtc->kmode;
saved_bo = sna_crtc->bo;
saved_transform = sna_crtc->transform;
saved_offset = sna_crtc->offset;
@@ -2094,7 +2067,6 @@ retry: /* Attach per-crtc pixmap or direct */
kgem_bo_submit(&sna->kgem, bo);
sna_crtc->bo = bo;
- mode_to_kmode(&sna_crtc->kmode, mode);
if (!sna_crtc_apply(crtc)) {
int err = errno;
@@ -2111,9 +2083,9 @@ retry: /* Attach per-crtc pixmap or direct */
sna_crtc->offset = saved_offset;
sna_crtc->transform = saved_transform;
sna_crtc->bo = saved_bo;
- sna_crtc->kmode = saved_kmode;
return FALSE;
}
+
bo->active_scanout++;
if (saved_bo) {
assert(saved_bo->active_scanout);
@@ -2131,6 +2103,46 @@ retry: /* Attach per-crtc pixmap or direct */
return TRUE;
}
+static Bool
+sna_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
+ Rotation rotation, int x, int y)
+{
+ struct sna *sna = to_sna(crtc->scrn);
+ struct sna_crtc *sna_crtc = to_sna_crtc(crtc);
+ struct drm_mode_modeinfo saved_kmode;
+ char outputs[256];
+
+ if (mode->HDisplay == 0 || mode->VDisplay == 0)
+ return FALSE;
+
+ assert(sna_crtc);
+
+ xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO,
+ "switch to mode %dx%d@%.1f on %s using pipe %d, position (%d, %d), rotation %s, reflection %s\n",
+ mode->HDisplay, mode->VDisplay, xf86ModeVRefresh(mode),
+ outputs_for_crtc(crtc, outputs, sizeof(outputs)), sna_crtc->pipe,
+ x, y, rotation_to_str(rotation), reflection_to_str(rotation));
+
+ assert(mode->HDisplay <= sna->mode.max_crtc_width &&
+ mode->VDisplay <= sna->mode.max_crtc_height);
+
+#if HAS_GAMMA
+ drmModeCrtcSetGamma(sna->kgem.fd, sna_crtc->id,
+ crtc->gamma_size,
+ crtc->gamma_red,
+ crtc->gamma_green,
+ crtc->gamma_blue);
+#endif
+
+ saved_kmode = sna_crtc->kmode;
+ mode_to_kmode(&sna_crtc->kmode, mode);
+ if (__sna_crtc_set_mode(crtc))
+ return TRUE;
+
+ sna_crtc->kmode = saved_kmode;
+ return FALSE;
+}
+
static void
sna_crtc_dpms(xf86CrtcPtr crtc, int mode)
{
@@ -2146,9 +2158,7 @@ sna_crtc_dpms(xf86CrtcPtr crtc, int mode)
if (mode == DPMSModeOn &&
priv->bo == NULL &&
- !sna_crtc_set_mode_major(crtc,
- &crtc->mode, crtc->rotation,
- crtc->x, crtc->y))
+ !__sna_crtc_set_mode(crtc))
mode = DPMSModeOff;
if (mode != DPMSModeOn)
@@ -2176,9 +2186,7 @@ void sna_mode_adjust_frame(struct sna *sna, int x, int y)
crtc->x = x;
crtc->y = y;
- if (to_sna_crtc(crtc) &&
- !sna_crtc_set_mode_major(crtc, &crtc->mode,
- crtc->rotation, x, y)) {
+ if (to_sna_crtc(crtc) && !__sna_crtc_set_mode(crtc)) {
crtc->x = saved_x;
crtc->y = saved_y;
}
@@ -4129,9 +4137,7 @@ sna_mode_resize(ScrnInfoPtr scrn, int width, int height)
if (!crtc->enabled)
continue;
- if (!sna_crtc_set_mode_major(crtc,
- &crtc->mode, crtc->rotation,
- crtc->x, crtc->y))
+ if (!__sna_crtc_set_mode(crtc))
sna_crtc_disable(crtc);
}