diff options
Diffstat (limited to 'src/i830_video.c')
-rw-r--r-- | src/i830_video.c | 72 |
1 files changed, 33 insertions, 39 deletions
diff --git a/src/i830_video.c b/src/i830_video.c index 25f9716b..f665d74e 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -1,6 +1,6 @@ #define VIDEO_DEBUG 0 /*************************************************************************** - + Copyright 2000 Intel Corporation. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a @@ -24,7 +24,7 @@ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_video.c,v 1.6 2003/02/06 04:18:05 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i830_video.c,v 1.12 2003/11/10 18:22:22 tsi Exp $ */ /* * Reformatted with GNU indent (2.2.8), using the following options: @@ -46,7 +46,7 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Alan Hourihane <alanh@tungstengraphics.com> - * David Dawes <dawes@tungstengraphics.com> + * David Dawes <dawes@xfree86.org> * * Derived from i810 Xv driver: * @@ -631,11 +631,15 @@ I830SetupImageVideo(ScreenPtr pScreen) } /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + REGION_NULL(pScreen, &pPriv->clip); pI830->adaptor = adapt; - /* Initialise pPriv->refreshOK */ + /* + * Initialise pPriv->refreshOK. Set it to TRUE here so that a warning will + * be generated if I830VideoSwitchModeAfter() sets it to FALSE. + */ + pPriv->refreshOK = TRUE; I830VideoSwitchModeAfter(pScrn, pScrn->currentMode); pI830->BlockHandler = pScreen->BlockHandler; @@ -650,34 +654,6 @@ I830SetupImageVideo(ScreenPtr pScreen) return adapt; } -static Bool -RegionsEqual(RegionPtr A, RegionPtr B) -{ - int *dataA, *dataB; - int num; - - num = REGION_NUM_RECTS(A); - if (num != REGION_NUM_RECTS(B)) - return FALSE; - - if ((A->extents.x1 != B->extents.x1) || - (A->extents.x2 != B->extents.x2) || - (A->extents.y1 != B->extents.y1) || (A->extents.y2 != B->extents.y2)) - return FALSE; - - dataA = (int *)REGION_RECTS(A); - dataB = (int *)REGION_RECTS(B); - - while (num--) { - if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) - return FALSE; - dataA += 2; - dataB += 2; - } - - return TRUE; -} - static void I830StopVideo(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { @@ -1013,7 +989,7 @@ UpdateCoeff(int taps, double fCutoff, Bool isHoriz, Bool isY, coeffPtr pCoeff) SetCoeffRegs(&coeffs[i][tap2Fix], mantSize + 2, pCoeff, pos); else SetCoeffRegs(&coeffs[i][tap2Fix], mantSize, pCoeff, pos); - + sum = 0.0; for (j = 0; j < taps; j++) sum += coeffs[i][j]; @@ -1175,7 +1151,7 @@ I830DisplayVideo(ScrnInfoPtr pScrn, int id, short width, short height, scaleChanged = TRUE; overlay->YRGBSCALE = newval; } - + newval = (xscaleIntUV << 16) | ((xscaleFractUV & 0xFFF) << 3) | ((yscaleFractUV & 0xFFF) << 20); if (newval != overlay->UVSCALE) { @@ -1190,14 +1166,14 @@ I830DisplayVideo(ScrnInfoPtr pScrn, int id, short width, short height, } /* Recalculate coefficients if the scaling changed. */ - + /* * Only Horizontal coefficients so far. */ if (scaleChanged) { double fCutoffY; double fCutoffUV; - + fCutoffY = xscaleFract / 4096.0; fCutoffUV = xscaleFractUV / 4096.0; @@ -1276,8 +1252,13 @@ I830AllocateMemory(ScrnInfoPtr pScrn, FBLinearPtr linear, int size) { ScreenPtr pScreen; FBLinearPtr new_linear; + int bytespp = pScrn->bitsPerPixel >> 3; DPRINTF(PFX, "I830AllocateMemory\n"); + + /* convert size in bytes into number of pixels */ + size = (size + bytespp - 1) / bytespp; + if (linear) { if (linear->size >= size) return linear; @@ -1436,7 +1417,7 @@ I830PutImage(ScrnInfoPtr pScrn, * XXX Always draw the key. LinDVD seems to fill the window background * with a colour different from the key. This works around that. */ - if (1 || !RegionsEqual(&pPriv->clip, clipBoxes)) { + if (1 || !REGION_EQUAL(pScreen, &pPriv->clip, clipBoxes)) { REGION_COPY(pScreen, &pPriv->clip, clipBoxes); xf86XVFillKeyHelper(pScreen, pPriv->colorKey, clipBoxes); } @@ -1814,6 +1795,9 @@ I830VideoSwitchModeBefore(ScrnInfoPtr pScrn, DisplayModePtr mode) if (pixrate > pPriv->maxRate && pPriv->refreshOK) { I830StopVideo(pScrn, pPriv, TRUE); pPriv->refreshOK = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling XVideo output because the mode pixel rate (%d MHz)\n" + "\texceeds the hardware limit (%d MHz).\n", pixrate, pPriv->maxRate); } } @@ -1835,6 +1819,16 @@ I830VideoSwitchModeAfter(ScrnInfoPtr pScrn, DisplayModePtr mode) mode->VRefresh = 60; pixrate = (mode->HDisplay * mode->VDisplay * mode->VRefresh) / 1000000; - pPriv->refreshOK = (pixrate <= pPriv->maxRate); + if (pPriv->refreshOK && pixrate > pPriv->maxRate) { + pPriv->refreshOK = FALSE; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling XVideo output because the mode pixel rate (%d MHz)\n" + "\texceeds the hardware limit (%d MHz)\n", pixrate, pPriv->maxRate); + } else if (!pPriv->refreshOK && pixrate <= pPriv->maxRate) { + pPriv->refreshOK = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Enabling XVideo output (mode pixel rate %d MHz is within limits).\n", + pixrate); + } } |