summaryrefslogtreecommitdiff
path: root/randr
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2008-03-19 12:15:39 -0700
committerKeith Packard <keithp@keithp.com>2008-11-24 13:24:40 -0800
commit6fe9c15731be5f5afabacb3aa3ed71b840f4238b (patch)
tree234c3584789da29033ba209ab101d86be8491d2f /randr
parent49db14e4ac26070ed86088419483888dda18b603 (diff)
Allow drivers to set crtc transforms.
Track curent transform down in the mode setting code so that it may be set separately from RandR.
Diffstat (limited to 'randr')
-rw-r--r--randr/randrstr.h4
-rw-r--r--randr/rrcrtc.c56
2 files changed, 36 insertions, 24 deletions
diff --git a/randr/randrstr.h b/randr/randrstr.h
index 5ac983d90..d4cfa67e6 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -545,7 +545,7 @@ RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations);
* Set whether transforms are allowed on a CRTC
*/
void
-RRCrtcSetTransform (RRCrtcPtr crtc, Bool transforms);
+RRCrtcSetTransformSupport (RRCrtcPtr crtc, Bool transforms);
/*
* Notify the extension that the Crtc has been reconfigured,
@@ -639,7 +639,7 @@ RRCrtcGetTransform (RRCrtcPtr crtc);
* Mark the pending transform as current
*/
void
-RRCrtcPostPendingTransform (RRCrtcPtr crtc);
+RRCrtcSetTransform (RRCrtcPtr crtc, RRTransformPtr transform);
/*
* Check whether the pending and current transforms are the same
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index d7ea6f22b..091517a05 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -91,12 +91,23 @@ RRTransformSetFilter (RRTransformPtr dst,
static Bool
RRTransformCopy (RRTransformPtr dst, RRTransformPtr src)
{
- if (!RRTransformSetFilter (dst, src->filter,
- src->params, src->nparams, src->width, src->height))
- return FALSE;
- dst->transform = src->transform;
- dst->f_transform = src->f_transform;
- dst->f_inverse = src->f_inverse;
+ if (src)
+ {
+ if (!RRTransformSetFilter (dst, src->filter,
+ src->params, src->nparams, src->width, src->height))
+ return FALSE;
+ dst->transform = src->transform;
+ dst->f_transform = src->f_transform;
+ dst->f_inverse = src->f_inverse;
+ }
+ else
+ {
+ if (!RRTransformSetFilter (dst, NULL, NULL, 0, 0, 0))
+ return FALSE;
+ PictureTransformInitIdentity (&dst->transform);
+ pict_f_transform_init_identity (&dst->f_transform);
+ pict_f_transform_init_identity (&dst->f_inverse);
+ }
return TRUE;
}
@@ -170,7 +181,7 @@ RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations)
* Set whether transforms are allowed on a CRTC
*/
void
-RRCrtcSetTransform (RRCrtcPtr crtc, Bool transforms)
+RRCrtcSetTransformSupport (RRCrtcPtr crtc, Bool transforms)
{
crtc->transforms = transforms;
}
@@ -439,21 +450,21 @@ RRCrtcGetTransform (RRCrtcPtr crtc)
}
/*
- * Mark the pending transform as current
+ * Called when driver applies a transform to a crtc
*/
void
-RRCrtcPostPendingTransform (RRCrtcPtr crtc)
+RRCrtcSetTransform (RRCrtcPtr crtc, RRTransformPtr transform)
{
if (!crtc->mode)
return;
- RRTransformCopy (&crtc->client_current_transform,
- &crtc->client_pending_transform);
+ RRTransformCopy (&crtc->client_current_transform, transform);
+
RRComputeTransform (crtc->x, crtc->y,
crtc->mode->mode.width,
crtc->mode->mode.height,
crtc->rotation,
- &crtc->client_current_transform,
+ transform,
&crtc->transform,
&crtc->f_transform,
&crtc->f_inverse);
@@ -1091,23 +1102,25 @@ ProcRRSetCrtcConfig (ClientPtr client)
}
#ifdef RANDR_12_INTERFACE
-#if 0
/*
* Check screen size bounds if the DDX provides a 1.2 interface
* for setting screen size. Else, assume the CrtcSet sets
- * the size along with the mode
+ * the size along with the mode. If the driver supports transforms,
+ * then it must allow crtcs to display a subset of the screen, so
+ * only do this check for drivers without transform support.
*/
- if (pScrPriv->rrScreenSetSize)
+ if (pScrPriv->rrScreenSetSize && !crtc->transforms)
{
int source_width;
int source_height;
- PictTransform transform, inverse;
+ PictTransform transform;
+ struct pict_f_transform f_transform, f_inverse;
- RRComputeTransform (mode, stuff->rotation,
- stuff->x, stuff->y,
- &crtc->client_pending_transform.transform,
- &crtc->client_pending_transform.inverse,
- &transform, &inverse);
+ RRComputeTransform (stuff->x, stuff->y,
+ mode->mode.width, mode->mode.height,
+ rotation,
+ &crtc->client_pending_transform,
+ &transform, &f_transform, &f_inverse);
RRModeGetScanoutSize (mode, &transform, &source_width, &source_height);
if (stuff->x + source_width > pScreen->width)
@@ -1127,7 +1140,6 @@ ProcRRSetCrtcConfig (ClientPtr client)
}
}
#endif
-#endif
}
/*