[PATCH] Add projective transforms to RandR DIX/DDX API.

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


New RRCrtcGetTransform function in DIX that DDX can use to get the pending
transform. The DDX code should be complete; the DIX code is just a stub at
this point.
---
 hw/xfree86/modes/xf86Rotate.c |   24 ++++++++++++++++++------
 randr/randrstr.h              |   14 ++++++++++++++
 randr/rrcrtc.c                |   19 +++++++++++++++++++
 3 files changed, 51 insertions(+), 6 deletions(-)

diff --git a/hw/xfree86/modes/xf86Rotate.c b/hw/xfree86/modes/xf86Rotate.c
index 12bd754..5ab2bf8 100644
--- a/hw/xfree86/modes/xf86Rotate.c
+++ b/hw/xfree86/modes/xf86Rotate.c
@@ -261,7 +261,7 @@ PictureTransformIsInverse (char *where, PictTransform *a, PictTransform *b)
 	ErrorF (" * ");
 	PictureTransformErrorF (b);
 	ErrorF (" = ");
-	PictureTransformErrorF (a);
+	PictureTransformErrorF (&t);
 	ErrorF ("\n");
 	return FALSE;
     }
@@ -331,10 +331,11 @@ xf86CrtcDamageShadow (xf86CrtcPtr crtc)
     RegionRec   damage_region;
     ScreenPtr	pScreen = pScrn->pScreen;
 
-    damage_box.x1 = crtc->x;
-    damage_box.x2 = crtc->x + xf86ModeWidth (&crtc->mode, crtc->rotation);
-    damage_box.y1 = crtc->y;
-    damage_box.y2 = crtc->y + xf86ModeHeight (&crtc->mode, crtc->rotation);
+    damage_box.x1 = 0;
+    damage_box.x2 = crtc->mode.HDisplay;
+    damage_box.y1 = 0;
+    damage_box.y2 = crtc->mode.VDisplay;
+    PictureTransformBounds (&damage_box, &crtc->crtc_to_framebuffer);
     REGION_INIT (pScreen, &damage_region, &damage_box, 1);
     DamageRegionAppend(&(*pScreen->GetScreenPixmap)(pScreen)->drawable,
 			&damage_region);
@@ -401,7 +402,7 @@ xf86RotateRedisplay(ScreenPtr pScreen)
 	{
 	    xf86CrtcPtr	    crtc = xf86_config->crtc[c];
 
-	    if (crtc->rotation != RR_Rotate_0 && crtc->enabled)
+	    if (crtc->transform_in_use && crtc->enabled)
 	    {
 		RegionRec   crtc_damage;
 
@@ -582,6 +583,17 @@ xf86CrtcRotate (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation)
 
     }
     
+#ifdef RANDR_12_INTERFACE
+    {
+	PictTransform	user_forward, user_reverse;
+	if (RRCrtcGetTransform (crtc->randr_crtc, &user_forward, &user_reverse))
+	{
+	    PictureTransformIsInverse ("user", &user_forward, &user_reverse);
+	    PictureTransformMultiply (&crtc_to_fb, &user_forward, &crtc_to_fb);
+	    PictureTransformMultiply (&fb_to_crtc, &fb_to_crtc, &user_reverse);
+	}
+    }
+#endif
     /*
      * If the untranslated transformation is the identity,
      * disable the shadow buffer
diff --git a/randr/randrstr.h b/randr/randrstr.h
index bd7c7c5..4692ddf 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -587,6 +587,20 @@ void
 RRCrtcGetScanoutSize(RRCrtcPtr crtc, int *width, int *height);
 
 /*
+ * Return crtc transform
+ */
+Bool
+RRCrtcGetTransform (RRCrtcPtr crtc,
+		    PictTransformPtr crtc_to_fb,
+		    PictTransformPtr fb_to_crtc);
+
+/*
+ * Mark the pending transform as current
+ */
+void
+RRCrtcPostPendingTransform (RRCrtcPtr crtc);
+
+/*
  * Destroy a Crtc at shutdown
  */
 void
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c
index ec65a04..38b3452 100644
--- a/randr/rrcrtc.c
+++ b/randr/rrcrtc.c
@@ -359,6 +359,25 @@ RRCrtcSet (RRCrtcPtr    crtc,
 }
 
 /*
+ * Return crtc transform
+ */
+Bool
+RRCrtcGetTransform (RRCrtcPtr crtc,
+		    PictTransformPtr crtc_to_fb,
+		    PictTransformPtr fb_to_crtc)
+{
+    return FALSE;
+}
+
+/*
+ * Mark the pending transform as current
+ */
+void
+RRCrtcPostPendingTransform (RRCrtcPtr crtc)
+{
+}
+
+/*
  * Destroy a Crtc at shutdown
  */
 void
-- 
1.5.6.5




More information about the xorg mailing list