summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-11-25 16:55:47 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2013-11-25 16:56:06 +0000
commit5580df729f4d3b2498a6dae19dac938f06bf602d (patch)
tree3cf78e8771416bf07193f2b7a9499de5edf10317 /tools
parentded23af3cdf68ab94446b8774d6bc4d52b21907a (diff)
intel-virtual-output: Include transforms when computing required fb size
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71846 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/virtual.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/tools/virtual.c b/tools/virtual.c
index 54550f90..4e1eca4b 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -861,6 +861,34 @@ static void clone_update(struct clone *clone)
clone->rr_update = 0;
}
+static int mode_height(const XRRModeInfo *mode, Rotation rotation)
+{
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ case RR_Rotate_180:
+ return mode->height;
+ case RR_Rotate_90:
+ case RR_Rotate_270:
+ return mode->width;
+ default:
+ return 0;
+ }
+}
+
+static int mode_width(const XRRModeInfo *mode, Rotation rotation)
+{
+ switch (rotation & 0xf) {
+ case RR_Rotate_0:
+ case RR_Rotate_180:
+ return mode->width;
+ case RR_Rotate_90:
+ case RR_Rotate_270:
+ return mode->height;
+ default:
+ return 0;
+ }
+}
+
static int context_update(struct context *ctx)
{
Display *dpy = ctx->display->dpy;
@@ -971,17 +999,18 @@ static int context_update(struct context *ctx)
DBG(("%s: source %s enabled (%d, %d)x(%d, %d)\n",
DisplayString(clone->dst.dpy), output->name,
output->x, output->y,
- output->mode.width, output->mode.height));
+ mode_width(&output->mode, output->rotation),
+ mode_height(&output->mode, output->rotation)));
if (output->x < x1)
x1 = output->x;
if (output->y < y1)
y1 = output->y;
- v = (int)output->x + output->mode.width;
+ v = (int)output->x + mode_width(&output->mode, output->rotation);
if (v > x2)
x2 = v;
- v = (int)output->y + output->mode.height;
+ v = (int)output->y + mode_height(&output->mode, output->rotation);
if (v > y2)
y2 = v;
}