sna: Log mode switches on virtual outputs
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 25 Nov 2013 15:33:13 +0000 (15:33 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 25 Nov 2013 15:33:13 +0000 (15:33 +0000)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/sna/sna_display.c
src/sna/sna_display_fake.c

index 8982d6a..3cf669d 100644 (file)
@@ -1499,10 +1499,9 @@ sna_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
                return FALSE;
 
        xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO,
-                  "switch to mode %dx%d@%.1f on pipe %d using %s, position (%d, %d), rotation %s\n",
+                  "switch to mode %dx%d@%.1f on %s using pipe %d, position (%d, %d), rotation %s\n",
                   mode->HDisplay, mode->VDisplay, xf86ModeVRefresh(mode),
-                  sna_crtc->pipe,
-                  outputs_for_crtc(crtc, outputs, sizeof(outputs)),
+                  outputs_for_crtc(crtc, outputs, sizeof(outputs)), sna_crtc->pipe,
                   x, y, rotation_to_str(rotation));
 
        assert(mode->HDisplay <= sna->mode.kmode->max_width &&
index 29426b7..8d24af0 100644 (file)
@@ -38,10 +38,48 @@ sna_crtc_dpms(xf86CrtcPtr crtc, int mode)
 {
 }
 
+static char *outputs_for_crtc(xf86CrtcPtr crtc, char *outputs, int max)
+{
+       xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+       int len, i;
+
+       for (i = len = 0; i < config->num_output; i++) {
+               xf86OutputPtr output = config->output[i];
+
+               if (output->crtc != crtc)
+                       continue;
+
+               len += snprintf(outputs+len, max-len, "%s, ", output->name);
+       }
+       assert(len >= 2);
+       outputs[len-2] = '\0';
+
+       return outputs;
+}
+
+static const char *rotation_to_str(Rotation rotation)
+{
+       switch (rotation) {
+       case RR_Rotate_0: return "normal";
+       case RR_Rotate_90: return "right";
+       case RR_Rotate_180: return "inverted";
+       case RR_Rotate_270: return "left";
+       default: return "unknown";
+       }
+}
+
 static Bool
 sna_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode,
                        Rotation rotation, int x, int y)
 {
+       char outputs[256];
+
+       xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO,
+                  "switch to mode %dx%d on %s, position (%d, %d), rotation %s\n",
+                  mode->HDisplay, mode->VDisplay,
+                  outputs_for_crtc(crtc, outputs, sizeof(outputs)),
+                  x, y, rotation_to_str(rotation));
+
        return TRUE;
 }