From e063162e80e51ed4368874b3af7ba690ea280d9e Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Thu, 13 Mar 2008 14:26:01 -0700 Subject: [PATCH] Add projective transforms to RandR DIX/DDX API. 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 12bd75404..5ab2bf89a 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 bd7c7c59a..4692ddf91 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -586,6 +586,20 @@ RRCrtcGammaSetSize (RRCrtcPtr crtc, 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 */ diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index ec65a040e..38b34525c 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -358,6 +358,25 @@ RRCrtcSet (RRCrtcPtr crtc, return ret; } +/* + * 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 */