diff options
author | Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk> | 2004-12-04 00:42:59 +0000 |
---|---|---|
committer | Markus Kuhn <Markus.Kuhn@cl.cam.ac.uk> | 2004-12-04 00:42:59 +0000 |
commit | 40912339a041c7193f1134befc94d62c5c3bd75b (patch) | |
tree | c27b41f42d6e99eff5595713988bf6a524f83d35 | |
parent | 3032cb6cda0e6527cf40fba692e2e5782858445a (diff) |
Encoding of numerous files changed to UTF-8xprint_packagertest_20041217_baseXORG-6_8_99_3XORG-6_8_99_2XORG-6_8_99_1xprint_packagertest_20041217
-rw-r--r-- | src/apm_driver.c | 69 | ||||
-rw-r--r-- | src/apm_rush.c | 5 | ||||
-rw-r--r-- | src/apm_video.c | 16 |
3 files changed, 55 insertions, 35 deletions
diff --git a/src/apm_driver.c b/src/apm_driver.c index fa1d4f7..b13f184 100644 --- a/src/apm_driver.c +++ b/src/apm_driver.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.63 2003/08/23 16:09:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.65 2003/10/30 17:36:57 tsi Exp $ */ #include "apm.h" #include "xf86cmap.h" @@ -36,8 +36,8 @@ static Bool ApmEnterVT(int scrnIndex, int flags); static void ApmLeaveVT(int scrnIndex, int flags); static Bool ApmCloseScreen(int scrnIndex, ScreenPtr pScreen); static void ApmFreeScreen(int scrnIndex, int flags); -static int ApmValidMode(int scrnIndex, DisplayModePtr mode, - Bool verbose, int flags); +static ModeStatus ApmValidMode(int scrnIndex, DisplayModePtr mode, + Bool verbose, int flags); static Bool ApmSaveScreen(ScreenPtr pScreen, int mode); static void ApmUnlock(ApmPtr pApm); static void ApmLock(ApmPtr pApm); @@ -161,12 +161,8 @@ static const char *xaaSymbols[] = { "XAADestroyInfoRec", "XAAGlyphScanlineFuncLSBFirst", "XAAInit", - "XAAQueryBestSize", "XAAReverseBitOrder", - "XAARestoreCursor", - "XAAScreenIndex", "XAAStippleScanlineFuncMSBFirst", - "XAAWarpCursor", NULL }; @@ -231,7 +227,7 @@ static XF86ModuleVersionInfo apmVersRec = { MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, - XF86_VERSION_CURRENT, + XORG_VERSION_CURRENT, APM_MAJOR_VERSION, APM_MINOR_VERSION, APM_PATCHLEVEL, ABI_CLASS_VIDEODRV, /* This is a video driver */ ABI_VIDEODRV_VERSION, @@ -475,7 +471,7 @@ static int * GetAccelPitchValues(ScrnInfoPtr pScrn) { int *linePitches = NULL; - int linep[] = {640, 800, 1024, 1152, 1280, 1600, 0}; + int linep[] = {640, 800, 1024, 1152, 1280, 0}; if (sizeof linep > 0) { linePitches = (int *)xnfalloc(sizeof linep); @@ -1030,7 +1026,7 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags) pApm->MaxClock = 144000; break; case 24: - pApm->MaxClock = 94000; /* Changed from 75000 by Grenié */ + pApm->MaxClock = 94000; /* Changed from 75000 by Grenié */ break; case 32: pApm->MaxClock = 94500; @@ -1080,12 +1076,12 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags) if (pApm->NoAccel) { /* * XXX Assuming min pitch 256, max 2048 - * XXX Assuming min height 128, max 2048 + * XXX Assuming min height 128, max 1024 (changed EE) */ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, 256, 2048, - pScrn->bitsPerPixel, 128, 2048, + pScrn->bitsPerPixel, 128, 1024, pScrn->display->virtualX, pScrn->display->virtualY, pApm->FbMapSize, @@ -1097,7 +1093,7 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags) i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, GetAccelPitchValues(pScrn), 0, 0, - pScrn->bitsPerPixel, 128, 2048, + pScrn->bitsPerPixel, 128, 1024, pScrn->display->virtualX, pScrn->display->virtualY, pApm->FbMapSize, @@ -1435,7 +1431,9 @@ comp_lmn(ApmPtr pApm, long clock) double fref; double fvco_goal; double k, c; - + double fout_best = 0; + unsigned int best = 0; + if (pApm->Chipset >= AT3D) fmax = 370000.0; else @@ -1453,7 +1451,7 @@ comp_lmn(ApmPtr pApm, long clock) fout = ((double)(n + 1) * fref)/((double)(m + 1) * (1 << l)); fvco_goal = (double)clock * (double)(1 << l); fvco = fout * (double)(1 << l); - if (!WITHIN(fvco, 0.995*fvco_goal, 1.005*fvco_goal)) + if (!WITHIN(fvco, 0.99*fvco_goal, 1.01*fvco_goal)) continue; if (!WITHIN(fvco, fmin, fmax)) continue; @@ -1462,6 +1460,16 @@ comp_lmn(ApmPtr pApm, long clock) if (!WITHIN(fref / (double)(m+1), 300.0, 300000.0)) continue; + if (fout_best != 0) { + double diff_new = clock - fout; + double diff_old = clock - best; + diff_new = diff_new < 0 ? -diff_new : diff_new; + diff_old = diff_old < 0 ? -diff_old : diff_old; + if (diff_new > diff_old) + continue; + } + fout_best = fout; + /* The following formula was empirically derived by matching a number of fvco values with acceptable values of f. @@ -1518,11 +1526,15 @@ comp_lmn(ApmPtr pApm, long clock) if (f > 7) f = 7; if (f < 0) f = 0; } - - return (n << 16) | (m << 8) | (l << 2) | (f << 4); + + best = (n << 16) | (m << 8) | (l << 2) | (f << 4); } } } + + if (fout_best != 0) + return best; + xf86DrvMsg(pApm->scrnIndex, X_PROBED, "Cannot find register values for clock %6.2f MHz. " "Please use a (slightly) different clock.\n", @@ -1728,24 +1740,26 @@ ApmRestore(ScrnInfoPtr pScrn, vgaRegPtr vgaReg, ApmRegPtr ApmReg) ApmWriteCrtc(0x19, ApmReg->CRT[0x19]); ApmWriteCrtc(0x1A, ApmReg->CRT[0x1A]); ApmWriteCrtc(0x1B, ApmReg->CRT[0x1B]); - ApmWriteCrtc(0x1C, ApmReg->CRT[0x1C]); ApmWriteCrtc(0x1D, ApmReg->CRT[0x1D]); ApmWriteCrtc(0x1E, ApmReg->CRT[0x1E]); /* RAMDAC registers. */ WRXL(0xE8, ApmReg->EX[XRE8]); + WRXL(0xEC, ApmReg->EX[XREC] & ~(1 << 7)); WRXL(0xEC, ApmReg->EX[XREC] | (1 << 7)); /* Do a PLL resync */ /* Color correction */ WRXL(0xE0, ApmReg->EX[XRE0]); - WRXB(0x80, ApmReg->EX[XR80]); - /* * This function handles restoring the generic VGA registers. */ vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_CMAP); + + /* set these after setting the default VGA registers */ + ApmWriteCrtc(0x1C, ApmReg->CRT[0x1C]); + WRXB(0x80, ApmReg->EX[XR80]); } else { /* Set aperture index to 0. */ @@ -1987,6 +2001,13 @@ ApmScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) } } + /* + * Initialize the acceleration interface. + */ + if (!pApm->NoAccel) { + ApmAccelInit(pScreen); /* set up XAA interface */ + } + miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); @@ -2001,12 +2022,6 @@ ApmScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) "Hardware cursor initialization failed\n"); } - /* - * Initialize the acceleration interface. - */ - if (!pApm->NoAccel) { - ApmAccelInit(pScreen); /* set up XAA interface */ - } /* Initialise default colourmap */ if (!miCreateDefColormap(pScreen)) @@ -2262,7 +2277,7 @@ ApmFreeScreen(int scrnIndex, int flags) /* Checks if a mode is suitable for the selected chipset. */ /* Optional */ -static int +static ModeStatus ApmValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { if (mode->Flags & V_INTERLACE) diff --git a/src/apm_rush.c b/src/apm_rush.c index 9b4da96..28cfe50 100644 --- a/src/apm_rush.c +++ b/src/apm_rush.c @@ -1,6 +1,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c,v 1.12 2003/02/12 21:46:42 tsi Exp $ */ +/* $XdotOrg: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c,v 1.2 2004/04/23 19:25:03 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c,v 1.11tsi Exp $ */ /* - * Copyright Loïc Grenié 1999 + * Copyright Loïc Grenié 1999 */ #include "apm.h" diff --git a/src/apm_video.c b/src/apm_video.c index 7107b13..f3e5db6 100644 --- a/src/apm_video.c +++ b/src/apm_video.c @@ -1,10 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c,v 1.10 2003/04/23 21:51:26 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c,v 1.11tsi Exp $ */ #if PSZ != 24 #include "dixstruct.h" +#include "fourcc.h" /* - * Ported from mga_video.c by Loïc Grenié + * Ported from mga_video.c by Loïc Grenié */ #ifndef OFF_DELAY @@ -115,7 +116,7 @@ static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"} }; -#define NUM_IMAGES 8 +#define NUM_IMAGES 9 typedef char c8; static XF86ImageRec Images[NUM_IMAGES] = @@ -171,6 +172,7 @@ static XF86ImageRec Images[NUM_IMAGES] = 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, XvTopToBottom }, + XVIMAGE_YUY2, { 0x59595959, XvYUV, @@ -338,8 +340,8 @@ A(SetupImageVideo)(ScreenPtr pScreen) pPriv[1].contrast = 128; /* gotta uninit this someplace */ - REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); - REGION_INIT(pScreen, &(pPriv + 1)->clip, NullBox, 0); + REGION_NULL(pScreen, &pPriv->clip); + REGION_NULL(pScreen, &(pPriv + 1)->clip); pApm->adaptor = adapt; @@ -506,6 +508,7 @@ static int A(ReputImage)(ScrnInfoPtr pScrn, short drw_x, short drw_y, RegionPtr clipBoxes, pointer pdata) { + ScreenPtr pScreen = pScrn->pScreen; APMDECL(pScrn); ApmPortPrivPtr pPriv = pdata, pPriv0, pPriv1; register int fx, fy; @@ -534,7 +537,7 @@ A(ReputImage)(ScrnInfoPtr pScrn, short drw_x, short drw_y, reg0 = &pPriv0->clip; bzero(&Union, sizeof Union); REGION_EMPTY(pScreen, &Union); - REGION_INIT(pScreen, &Union, NullBox, 0); + REGION_NULL(pScreen, &Union); REGION_UNION(pScreen, &Union, reg0, &pPriv1->clip); nrects = REGION_NUM_RECTS(&Union); rects = REGION_RECTS(&Union); @@ -926,6 +929,7 @@ ApmQueryImageAttributes(ScrnInfoPtr pScrn, int id, case 0x59565955: case 0x55595659: case 0x59555956: + case 0x32595559: size = *w << 1; goto common; case 0x59595959: |