diff options
author | Francisco Jerez <currojerez@gmail.com> | 2008-10-27 23:37:30 +0100 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-10-28 15:09:39 -0200 |
commit | 5d151781515cf2e3af1322ce6ed5f8d871c05791 (patch) | |
tree | 51bab035b3521073dfedf01d681ace08900cac22 /src | |
parent | 486e92399f09b9d765d03184fe29a32b3bc4ecc5 (diff) |
Changes in the video overlay clipping code.
Clip the video to the CRTC viewport by using
xf86_crtc_clip_video_helper, and allow XV in
dual head mode.
Diffstat (limited to 'src')
-rw-r--r-- | src/smi_driver.c | 5 | ||||
-rw-r--r-- | src/smi_video.c | 92 |
2 files changed, 43 insertions, 54 deletions
diff --git a/src/smi_driver.c b/src/smi_driver.c index 3906555..4c0bad9 100644 --- a/src/smi_driver.c +++ b/src/smi_driver.c @@ -1799,10 +1799,7 @@ SMI_ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) !xf86DPMSInit(pScreen, SMILynx_DisplayPowerManagementSet, 0))) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed!\n"); - if (!pSmi->Dualhead) - SMI_InitVideo(pScreen); - else - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No overlay in dualhead mode\n"); + SMI_InitVideo(pScreen); if(!xf86CrtcScreenInit(pScreen)) RETURN(FALSE); diff --git a/src/smi_video.c b/src/smi_video.c index a2ce2bc..4df0d74 100644 --- a/src/smi_video.c +++ b/src/smi_video.c @@ -49,6 +49,7 @@ Date: 2.11.2001 #include "smi.h" #include "smi_video.h" +#include "xf86Crtc.h" /* @@ -888,7 +889,6 @@ SMI_SetupVideo(ScreenPtr pScreen) ptrAdaptor->flags = VIDEO_OVERLAID_IMAGES; if (IS_MSOC(pSmi)) { - ptrAdaptor->flags |= VIDEO_CLIP_TO_VIEWPORT; ptrAdaptor->name = "Silicon Motion MSOC Series Video Engine"; } else @@ -1070,6 +1070,8 @@ SMI_PutVideo( int norm; int size, width, height, fbPitch; int top, left; + xf86CrtcConfigPtr crtcConf = XF86_CRTC_CONFIG_PTR(pScrn); + xf86CrtcPtr crtc; ENTER(); @@ -1104,19 +1106,19 @@ SMI_PutVideo( dstBox.x2 = drw_x + drw_w; dstBox.y2 = drw_y + drw_h; -#if 1 - if (!SMI_ClipVideo(pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes, width, height)) -#else - if (!xf86XVClipVideoHelper(&dstBox, &x1, &y1, &x2, &y2, clipBoxes, width, height)) -#endif + if(!xf86_crtc_clip_video_helper(pScrn, &crtc, NULL, &dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height)) RETURN(Success); - DEBUG("Clip: x1=%d y1=%d x2=%d y2=%d\n", x1 >> 16, y1 >> 16, x2 >> 16, y2 >> 16); + if(pSmi->Dualhead && crtc == crtcConf->crtc[0]) + RETURN(Success); - dstBox.x1 -= pScrn->frameX0; - dstBox.y1 -= pScrn->frameY0; - dstBox.x2 -= pScrn->frameX0; - dstBox.y2 -= pScrn->frameY0; + /* Transform dstBox to the CRTC coordinates */ + dstBox.x1 -= crtc->x; + dstBox.y1 -= crtc->y; + dstBox.x2 -= crtc->x; + dstBox.y2 -= crtc->y; + + DEBUG("Clip: x1=%d y1=%d x2=%d y2=%d\n", x1 >> 16, y1 >> 16, x2 >> 16, y2 >> 16); vid_pitch = (vid_w * 2 + 7) & ~7; @@ -1548,17 +1550,11 @@ SMI_PutImage( CARD32 offset, offset2 = 0, offset3 = 0, tmp; int left, top, nPixels, nLines; unsigned char *dstStart; + xf86CrtcConfigPtr crtcConf = XF86_CRTC_CONFIG_PTR(pScrn); + xf86CrtcPtr crtc; ENTER(); - if(pSmi->rotate){ - /* As we cannot display it rotated, we pretend it has */ - /* the rotated dimensions to do the clipping... */ - ROTATE_DIMS(src_x,src_y); - ROTATE_DIMS(src_w,src_h); - ROTATE_DIMS(width,height); - } - x1 = src_x; y1 = src_y; x2 = src_x + src_w; @@ -1569,24 +1565,14 @@ SMI_PutImage( dstBox.x2 = drw_x + drw_w; dstBox.y2 = drw_y + drw_h; - if (!SMI_ClipVideo(pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes, width, height)) + if(!xf86_crtc_clip_video_helper(pScrn, &crtc, NULL, &dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height)) RETURN(Success); - if(pSmi->rotate){ - /* Now, transform the coordinates back */ - /* to the physical (unrotated) frame */ - UNROTATE_DIMS(x1,y1); - UNROTATE_DIMS(x2,y2); - UNROTATE_BOX(dstBox); - UNROTATE_DIMS(src_w,src_h); - UNROTATE_DIMS(drw_w,drw_h); - UNROTATE_DIMS(width,height); - } - - dstBox.x1 -= pScrn->frameX0; - dstBox.y1 -= pScrn->frameY0; - dstBox.x2 -= pScrn->frameX0; - dstBox.y2 -= pScrn->frameY0; + /* Transform dstBox to the CRTC coordinates */ + dstBox.x1 -= crtc->x; + dstBox.y1 -= crtc->y; + dstBox.x2 -= crtc->x; + dstBox.y2 -= crtc->y; switch (id) { @@ -1626,7 +1612,7 @@ SMI_PutImage( size = dstPitch * height; pPort->video_offset = SMI_AllocateMemory(pScrn, &pPort->video_memory, size); - if (pPort->video_offset == 0) + if (pPort->video_memory == NULL) RETURN(BadAlloc); top = y1 >> 16; @@ -1672,10 +1658,11 @@ SMI_PutImage( SMI_DisplayVideo0501(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); - else - SMI_DisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2, - &dstBox, src_w, src_h, drw_w, drw_h); - + else{ + if(!pSmi->Dualhead || crtc == crtcConf->crtc[1]) + SMI_DisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2, + &dstBox, src_w, src_h, drw_w, drw_h); + } pPort->videoStatus = CLIENT_VIDEO_ON; RETURN(Success); @@ -2485,6 +2472,8 @@ SMI_DisplaySurface( SMI_PortPtr pPort = pSmi->ptrAdaptor->pPortPrivates[0].ptr; INT32 x1, y1, x2, y2; BoxRec dstBox; + xf86CrtcConfigPtr crtcConf = XF86_CRTC_CONFIG_PTR(surface->pScrn); + xf86CrtcPtr crtc; ENTER(); @@ -2498,14 +2487,15 @@ SMI_DisplaySurface( dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - if (!SMI_ClipVideo(surface->pScrn, &dstBox, &x1, &y1, &x2, &y2, clipBoxes, - surface->width, surface->height)) + if(!xf86_crtc_clip_video_helper(surface->pScrn, &crtc, NULL, &dstBox, + &x1, &x2, &y1, &y2, clipBoxes, surface->width, surface->height)) RETURN(Success); - dstBox.x1 -= surface->pScrn->frameX0; - dstBox.y1 -= surface->pScrn->frameY0; - dstBox.x2 -= surface->pScrn->frameX0; - dstBox.y2 -= surface->pScrn->frameY0; + /* Transform dstBox to the CRTC coordinates */ + dstBox.x1 -= crtc->x; + dstBox.y1 -= crtc->y; + dstBox.x2 -= crtc->x; + dstBox.y2 -= crtc->y; xf86XVFillKeyHelper(surface->pScrn->pScreen, pPort->Attribute[XV_COLORKEY], clipBoxes); @@ -2520,10 +2510,12 @@ SMI_DisplaySurface( surface->offsets[0], surface->width, surface->height, surface->pitches[0], x1, y1, x2, y2, &dstBox, vid_w, vid_h, drw_w, drw_h); - else - SMI_DisplayVideo(surface->pScrn, surface->id, surface->offsets[0], - surface->width, surface->height, surface->pitches[0], x1, y1, x2, - y2, &dstBox, vid_w, vid_h, drw_w, drw_h); + else{ + if(!pSmi->Dualhead || crtc == crtcConf->crtc[1]) + SMI_DisplayVideo(surface->pScrn, surface->id, surface->offsets[0], + surface->width, surface->height, surface->pitches[0], x1, y1, x2, + y2, &dstBox, vid_w, vid_h, drw_w, drw_h); + } ptrOffscreen->isOn = TRUE; if (pPort->videoStatus & CLIENT_VIDEO_ON) { |