[PATCH] Report whether transforms are support from driver through extension to client

Keith Packard keithp at keithp.com
Fri Nov 14 14:12:46 PST 2008


Add APIs to xf86RandR12 support and randr extension to record whether the
driver supports transforms, report that value in the RRGetCrtcTransform
reply.
---
 hw/xfree86/modes/xf86Crtc.c    |    6 ++++++
 hw/xfree86/modes/xf86RandR12.c |   25 +++++++++++++++++++++++++
 hw/xfree86/modes/xf86RandR12.h |    1 +
 randr/randrstr.h               |    7 +++++++
 randr/rrcrtc.c                 |   15 +++++++++++++--
 5 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 35c1190..f977152 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -735,11 +735,17 @@ xf86CrtcScreenInit (ScreenPtr screen)
 	    break;
     }
     if (c == config->num_crtc)
+    {
 	xf86RandR12SetRotations (screen, RR_Rotate_0 | RR_Rotate_90 |
 				 RR_Rotate_180 | RR_Rotate_270 |
 				 RR_Reflect_X | RR_Reflect_Y);
+	xf86RandR12SetTransform (screen, TRUE);
+    }
     else
+    {
 	xf86RandR12SetRotations (screen, RR_Rotate_0);
+	xf86RandR12SetTransform (screen, FALSE);
+    }
     
     /* Wrap CreateScreenResources so we can initialize the RandR code */
     config->CreateScreenResources = screen->CreateScreenResources;
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 6e14bd7..f247a88 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -569,6 +569,31 @@ xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations)
 }
 
 _X_EXPORT void
+xf86RandR12SetTransform (ScreenPtr pScreen, Bool transforms)
+{
+    XF86RandRInfoPtr	randrp;
+#if RANDR_13_INTERFACE
+    ScrnInfoPtr		pScrn = xf86Screens[pScreen->myNum];
+    int			c;
+    xf86CrtcConfigPtr   config = XF86_CRTC_CONFIG_PTR(pScrn);
+#endif
+
+#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
+    if (xf86RandR12Key == NULL)
+	return;
+#endif
+
+    randrp = XF86RANDRINFO(pScreen);
+#if RANDR_13_INTERFACE
+    for (c = 0; c < config->num_crtc; c++) {
+	xf86CrtcPtr    crtc = config->crtc[c];
+
+	RRCrtcSetTransform (crtc->randr_crtc, transforms);
+    }
+#endif
+}
+
+_X_EXPORT void
 xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y)
 {
     ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex];
diff --git a/hw/xfree86/modes/xf86RandR12.h b/hw/xfree86/modes/xf86RandR12.h
index 4fd855c..c361b47 100644
--- a/hw/xfree86/modes/xf86RandR12.h
+++ b/hw/xfree86/modes/xf86RandR12.h
@@ -31,6 +31,7 @@
 Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen);
 Bool xf86RandR12Init(ScreenPtr pScreen);
 void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotation);
+void xf86RandR12SetTransform (ScreenPtr pScreen, Bool transforms);
 Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate,
 			RRScreenSizePtr pSize);
 Rotation xf86RandR12GetRotation(ScreenPtr pScreen);
diff --git a/randr/randrstr.h b/randr/randrstr.h
index 17d0a8b..792c3d6 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -130,6 +130,7 @@ struct _rrCrtc {
     CARD16	    *gammaBlue;
     CARD16	    *gammaGreen;
     void	    *devPrivate;
+    Bool	    transforms;
     RRTransformRec  client_pending_transform;
     RRTransformRec  client_current_transform;
     PictTransform   transform;
@@ -539,6 +540,12 @@ void
 RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations);
 
 /*
+ * Set whether transforms are allowed on a CRTC
+ */
+void
+RRCrtcSetTransform (RRCrtcPtr crtc, Bool transforms);
+
+/*
  * Notify the extension that the Crtc has been reconfigured,
  * the driver calls this whenever it has updated the mode
  */
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index b8b9ec0..6559d51 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -164,6 +164,15 @@ RRCrtcSetRotations (RRCrtcPtr crtc, Rotation rotations)
 }
 
 /*
+ * Set whether transforms are allowed on a CRTC
+ */
+void
+RRCrtcSetTransform (RRCrtcPtr crtc, Bool transforms)
+{
+    crtc->transforms = transforms;
+}
+
+/*
  * Notify the extension that the Crtc has been reconfigured,
  * the driver calls this whenever it has updated the mode
  */
@@ -608,6 +617,9 @@ RRCrtcTransformSet (RRCrtcPtr		crtc,
     PictFilterPtr   filter = NULL;
     int		    width = 0, height = 0;
 
+    if (!crtc->transforms)
+	return BadValue;
+
     if (filter_len)
     {
 	filter = PictureFindFilter (crtc->pScreen,
@@ -1326,8 +1338,7 @@ ProcRRGetCrtcTransform (ClientPtr client)
     reply->sequenceNumber = client->sequence;
     reply->length = (CrtcTransformExtra + nextra) >> 2;
 
-    /* XXX deal with DDXen that can't do transforms */
-    reply->hasTransforms = xTrue;
+    reply->hasTransforms = crtc->transforms;
 
     transform_encode (client, &reply->pendingTransform, &pending->transform);
     transform_encode (client, &reply->pendingInverse, &pending->inverse);
-- 
1.5.6.5




More information about the xorg mailing list