summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2009-07-02 14:15:34 +0200
committerIan Romanick <ian.d.romanick@intel.com>2009-07-02 09:24:19 -0700
commit795c11c49cf10525f02127a3629d35378d802fa7 (patch)
treeeaa2dc7655daa4a2724846990764797d487f92ef
parent4100abdf5d208bbcbb4ceabad0572c04221443c9 (diff)
Xv i830_display_video splitup: extract i830_update_dst_box_to_crtc_coords
Just moved the code ouf of line. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--src/i830_video.c95
1 files changed, 53 insertions, 42 deletions
diff --git a/src/i830_video.c b/src/i830_video.c
index e142fb5b..e5be7e9c 100644
--- a/src/i830_video.c
+++ b/src/i830_video.c
@@ -1781,6 +1781,58 @@ i830_swidth (I830Ptr pI830, unsigned int offset,
}
static void
+i830_update_dst_box_to_crtc_coords(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
+ BoxPtr dstBox)
+{
+ int tmp;
+
+ /* for overlay, we should take it from crtc's screen
+ * coordinate to current crtc's display mode.
+ * yeah, a bit confusing.
+ */
+ switch (crtc->rotation & 0xf) {
+ case RR_Rotate_0:
+ dstBox->x1 -= crtc->x;
+ dstBox->x2 -= crtc->x;
+ dstBox->y1 -= crtc->y;
+ dstBox->y2 -= crtc->y;
+ break;
+ case RR_Rotate_90:
+ tmp = dstBox->x1;
+ dstBox->x1 = dstBox->y1 - crtc->x;
+ dstBox->y1 = pScrn->virtualX - tmp - crtc->y;
+ tmp = dstBox->x2;
+ dstBox->x2 = dstBox->y2 - crtc->x;
+ dstBox->y2 = pScrn->virtualX - tmp - crtc->y;
+ tmp = dstBox->y1;
+ dstBox->y1 = dstBox->y2;
+ dstBox->y2 = tmp;
+ break;
+ case RR_Rotate_180:
+ tmp = dstBox->x1;
+ dstBox->x1 = pScrn->virtualX - dstBox->x2 - crtc->x;
+ dstBox->x2 = pScrn->virtualX - tmp - crtc->x;
+ tmp = dstBox->y1;
+ dstBox->y1 = pScrn->virtualY - dstBox->y2 - crtc->y;
+ dstBox->y2 = pScrn->virtualY - tmp - crtc->y;
+ break;
+ case RR_Rotate_270:
+ tmp = dstBox->x1;
+ dstBox->x1 = pScrn->virtualY - dstBox->y1 - crtc->x;
+ dstBox->y1 = tmp - crtc->y;
+ tmp = dstBox->x2;
+ dstBox->x2 = pScrn->virtualY - dstBox->y2 - crtc->x;
+ dstBox->y2 = tmp - crtc->y;
+ tmp = dstBox->x1;
+ dstBox->x1 = dstBox->x2;
+ dstBox->x2 = tmp;
+ break;
+ }
+
+ return;
+}
+
+static void
i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
int id, short width, short height,
int dstPitch, int x1, int y1, int x2, int y2, BoxPtr dstBox,
@@ -1824,48 +1876,7 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc,
if (!pPriv->overlayOK)
return;
- switch (crtc->rotation & 0xf) {
- /* for overlay, we should take it from crtc's screen
- * coordinate to current crtc's display mode.
- * yeah, a bit confusing.
- */
- case RR_Rotate_0:
- dstBox->x1 -= crtc->x;
- dstBox->x2 -= crtc->x;
- dstBox->y1 -= crtc->y;
- dstBox->y2 -= crtc->y;
- break;
- case RR_Rotate_90:
- tmp = dstBox->x1;
- dstBox->x1 = dstBox->y1 - crtc->x;
- dstBox->y1 = pScrn->virtualX - tmp - crtc->y;
- tmp = dstBox->x2;
- dstBox->x2 = dstBox->y2 - crtc->x;
- dstBox->y2 = pScrn->virtualX - tmp - crtc->y;
- tmp = dstBox->y1;
- dstBox->y1 = dstBox->y2;
- dstBox->y2 = tmp;
- break;
- case RR_Rotate_180:
- tmp = dstBox->x1;
- dstBox->x1 = pScrn->virtualX - dstBox->x2 - crtc->x;
- dstBox->x2 = pScrn->virtualX - tmp - crtc->x;
- tmp = dstBox->y1;
- dstBox->y1 = pScrn->virtualY - dstBox->y2 - crtc->y;
- dstBox->y2 = pScrn->virtualY - tmp - crtc->y;
- break;
- case RR_Rotate_270:
- tmp = dstBox->x1;
- dstBox->x1 = pScrn->virtualY - dstBox->y1 - crtc->x;
- dstBox->y1 = tmp - crtc->y;
- tmp = dstBox->x2;
- dstBox->x2 = pScrn->virtualY - dstBox->y2 - crtc->x;
- dstBox->y2 = tmp - crtc->y;
- tmp = dstBox->x1;
- dstBox->x1 = dstBox->x2;
- dstBox->x2 = tmp;
- break;
- }
+ i830_update_dst_box_to_crtc_coords(pScrn, crtc, dstBox);
if (crtc->rotation & (RR_Rotate_90 | RR_Rotate_270)) {
tmp = width;