xserver: Branch 'master' - 3 commits
Keith Packard
keithp at kemper.freedesktop.org
Tue Feb 3 22:03:41 PST 2009
hw/xfree86/modes/xf86Crtc.c | 36 ++++++++++--------------------------
hw/xfree86/modes/xf86Rotate.c | 6 +++++-
randr/rrtransform.c | 39 ++++++++++++++++++++++++++++++++-------
3 files changed, 47 insertions(+), 34 deletions(-)
New commits:
commit 7968823cbc02615e1080c0d3f34dcebe14ea1771
Author: Keith Packard <keithp at keithp.com>
Date: Tue Feb 3 20:18:37 2009 -0800
Handle the combination of panning and crtc transforms
This patch gets the shadow scanout buffer repainted on panning area changes.
It does not, however, track the mouse correctly.
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 40352b4..7dbabda 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -306,33 +306,14 @@ xf86CrtcSetModeTransform (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotati
} else
crtc->transformPresent = FALSE;
- /* Shift offsets that move us out of virtual size */
- if (x + mode->HDisplay > xf86_config->maxWidth ||
- y + mode->VDisplay > xf86_config->maxHeight)
- {
- if (x + mode->HDisplay > xf86_config->maxWidth)
- crtc->x = xf86_config->maxWidth - mode->HDisplay;
- if (y + mode->VDisplay > xf86_config->maxHeight)
- crtc->y = xf86_config->maxHeight - mode->VDisplay;
- if (crtc->x < 0 || crtc->y < 0)
- {
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Mode %dx%d does not fit virtual size %dx%d - "
- "internal error\n", mode->HDisplay, mode->VDisplay,
- xf86_config->maxWidth, xf86_config->maxHeight);
- goto done;
- }
- xf86DrvMsg (scrn->scrnIndex, X_ERROR,
- "Mode %dx%d+%d+%d does not fit virtual size %dx%d - "
- "offset updated to +%d+%d\n",
- mode->HDisplay, mode->VDisplay, x, y,
- xf86_config->maxWidth, xf86_config->maxHeight,
- crtc->x, crtc->y);
- }
-
if (crtc->funcs->set_origin &&
memcmp (mode, &saved_mode, sizeof(saved_mode)) == 0 &&
- saved_rotation == rotation) {
+ saved_rotation == rotation &&
+ saved_transform_present == crtc->transformPresent &&
+ (!crtc->transformPresent || RRTransformEqual(&saved_transform, &crtc->transform)))
+ {
+ if (!xf86CrtcRotate (crtc))
+ goto done;
crtc->funcs->set_origin (crtc, crtc->x, crtc->y);
ret = TRUE;
goto done;
@@ -441,8 +422,11 @@ xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y)
{
crtc->x = x;
crtc->y = y;
- if (crtc->funcs->set_origin)
+ if (crtc->funcs->set_origin) {
+ if (!xf86CrtcRotate (crtc))
+ return;
crtc->funcs->set_origin (crtc, x, y);
+ }
else
xf86CrtcSetMode (crtc, &crtc->mode, crtc->rotation, x, y);
}
commit 763df9eec79a867978efc5138d8635a46c1a0d17
Author: Keith Packard <keithp at keithp.com>
Date: Tue Feb 3 20:15:41 2009 -0800
Damage re-used shadow scanout buffer using new transforms.
When the shadow scanout buffer can be re-used, the underlying framebuffer
area must be damaged so that the scanout will be repainted. This patch
delays the addition of that damaged area until after the transform in the
crtc has been updated, otherwise the old transform would have been used and
the wrong area repainted.
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 21b7aff..dcc3ec0 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -406,6 +406,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
int new_width = 0;
int new_height = 0;
RRTransformPtr transform = NULL;
+ Bool damage = FALSE;
if (crtc->transformPresent)
transform = &crtc->transform;
@@ -466,7 +467,7 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
else
{
/* mark shadowed area as damaged so it will be repainted */
- xf86CrtcDamageShadow (crtc);
+ damage = TRUE;
}
if (!xf86_config->rotation_damage)
@@ -540,6 +541,9 @@ xf86CrtcRotate (xf86CrtcPtr crtc)
crtc->bounds.y2 = crtc->mode.VDisplay;
pixman_f_transform_bounds (&f_crtc_to_fb, &crtc->bounds);
+ if (damage)
+ xf86CrtcDamageShadow (crtc);
+
/* All done */
return TRUE;
}
commit 62fc98cb88e4e8b636f343453fc1168a87c58972
Author: Keith Packard <keithp at keithp.com>
Date: Tue Feb 3 20:12:42 2009 -0800
Handle matrix computation overflow in RRTransformCompute
If the computation of the composite fixed-point transform for RandR
overflows at any point, take the resulting floating point transform and
scale that back to fit in a fixed point matrix. This ensures that a matrix
will always be available, although perhaps at reduced precision. Someday we
should add floating point matrices to Render.
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/randr/rrtransform.c b/randr/rrtransform.c
index a901df4..cc18a06 100644
--- a/randr/rrtransform.c
+++ b/randr/rrtransform.c
@@ -120,6 +120,22 @@ RRTransformCopy (RRTransformPtr dst, RRTransformPtr src)
#define F(x) IntToxFixed(x)
+static void
+RRTransformRescale(struct pixman_f_transform *f_transform, double limit)
+{
+ double max = 0, v, scale;
+ int i, j;
+
+ for (j = 0; j < 3; j++)
+ for (i = 0; i < 3; i++)
+ if ((v = abs (f_transform->m[j][i])) > max)
+ max = v;
+ scale = limit / max;
+ for (j = 0; j < 3; j++)
+ for (i = 0; i < 3; i++)
+ f_transform->m[j][i] *= scale;
+}
+
/*
* Compute the complete transformation matrix including
* client-specified transform, rotation/reflection values and the crtc
@@ -141,6 +157,7 @@ RRTransformCompute (int x,
{
PictTransform t_transform, inverse;
struct pixman_f_transform tf_transform, tf_inverse;
+ Bool overflow = FALSE;
if (!transform) transform = &t_transform;
if (!f_transform) f_transform = &tf_transform;
@@ -234,7 +251,8 @@ RRTransformCompute (int x,
#ifdef RANDR_12_INTERFACE
if (rr_transform)
{
- pixman_transform_multiply (transform, transform, &rr_transform->transform);
+ if (!pixman_transform_multiply (transform, transform, &rr_transform->transform))
+ overflow = TRUE;
pixman_f_transform_multiply (f_transform, f_transform, &rr_transform->f_transform);
pixman_f_transform_multiply (f_inverse, &rr_transform->f_inverse, f_inverse);
}
@@ -242,19 +260,26 @@ RRTransformCompute (int x,
/*
* Compute the class of the resulting transform
*/
- if (pixman_transform_is_identity (transform))
+ if (!overflow && pixman_transform_is_identity (transform))
{
pixman_transform_init_translate (transform, F ( x), F ( y));
- pixman_f_transform_init_translate (f_transform, F( x), F( y));
- pixman_f_transform_init_translate (f_inverse, F(-x), F(-y));
+ pixman_f_transform_init_translate (f_transform, x, y);
+ pixman_f_transform_init_translate (f_inverse, -x, -y);
return FALSE;
}
else
{
- pixman_transform_translate (&inverse, transform, x, y);
- pixman_f_transform_translate (f_inverse, f_transform, x, y);
+ pixman_f_transform_translate (f_inverse, f_transform, -x, -y);
+ if (!pixman_transform_translate (&inverse, transform, F(-x), F(-y)))
+ overflow = TRUE;
+ if (overflow)
+ {
+ struct pixman_f_transform f_scaled;
+ f_scaled = *f_transform;
+ RRTransformRescale(&f_scaled, 16384.0);
+ pixman_transform_from_pixman_f_transform(transform, &f_scaled);
+ }
return TRUE;
}
}
-
More information about the xorg-commit
mailing list