From ded23af3cdf68ab94446b8774d6bc4d52b21907a Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 25 Nov 2013 16:49:58 +0000 Subject: [PATCH] sna: Include reflections when logging mode changes Signed-off-by: Chris Wilson --- src/sna/sna_display.c | 22 +++++++++++++++++----- src/sna/sna_display_fake.c | 22 +++++++++++++++++----- 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c index 3cf669d..165b9e9 100644 --- a/src/sna/sna_display.c +++ b/src/sna/sna_display.c @@ -1474,15 +1474,27 @@ static char *outputs_for_crtc(xf86CrtcPtr crtc, char *outputs, int max) static const char *rotation_to_str(Rotation rotation) { - switch (rotation) { + switch (rotation & RR_Rotate_All) { + case 0: case RR_Rotate_0: return "normal"; - case RR_Rotate_90: return "right"; + case RR_Rotate_90: return "left"; case RR_Rotate_180: return "inverted"; - case RR_Rotate_270: return "left"; + case RR_Rotate_270: return "right"; default: return "unknown"; } } +static const char *reflection_to_str(Rotation rotation) +{ + switch (rotation & RR_Reflect_All) { + case 0: return "none"; + case RR_Reflect_X: return "X axis"; + case RR_Reflect_Y: return "Y axis"; + case RR_Reflect_X | RR_Reflect_Y: return "X and Y axis"; + default: return "invalid"; + } +} + static Bool sna_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, int x, int y) @@ -1499,10 +1511,10 @@ sna_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, return FALSE; xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO, - "switch to mode %dx%d@%.1f on %s using pipe %d, position (%d, %d), rotation %s\n", + "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)); + x, y, rotation_to_str(rotation), reflection_to_str(rotation)); assert(mode->HDisplay <= sna->mode.kmode->max_width && mode->VDisplay <= sna->mode.kmode->max_height); diff --git a/src/sna/sna_display_fake.c b/src/sna/sna_display_fake.c index 8d24af0..cecedaa 100644 --- a/src/sna/sna_display_fake.c +++ b/src/sna/sna_display_fake.c @@ -59,15 +59,27 @@ static char *outputs_for_crtc(xf86CrtcPtr crtc, char *outputs, int max) static const char *rotation_to_str(Rotation rotation) { - switch (rotation) { + switch (rotation & RR_Rotate_All) { + case 0: case RR_Rotate_0: return "normal"; - case RR_Rotate_90: return "right"; + case RR_Rotate_90: return "left"; case RR_Rotate_180: return "inverted"; - case RR_Rotate_270: return "left"; + case RR_Rotate_270: return "right"; default: return "unknown"; } } +static const char *reflection_to_str(Rotation rotation) +{ + switch (rotation & RR_Reflect_All) { + case 0: return "none"; + case RR_Reflect_X: return "X axis"; + case RR_Reflect_Y: return "Y axis"; + case RR_Reflect_X | RR_Reflect_Y: return "X and Y axis"; + default: return "invalid"; + } +} + static Bool sna_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, int x, int y) @@ -75,10 +87,10 @@ sna_crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, char outputs[256]; xf86DrvMsg(crtc->scrn->scrnIndex, X_INFO, - "switch to mode %dx%d on %s, position (%d, %d), rotation %s\n", + "switch to mode %dx%d on %s, position (%d, %d), rotation %s, reflection %s\n", mode->HDisplay, mode->VDisplay, outputs_for_crtc(crtc, outputs, sizeof(outputs)), - x, y, rotation_to_str(rotation)); + x, y, rotation_to_str(rotation), reflection_to_str(rotation)); return TRUE; } -- 2.7.4