From 5f64cbc462a1a841bebe1fa5bae57560a8def42f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 16 Jun 2004 09:22:41 +0000 Subject: DRI XFree86-4_3_99_12-merge import --- man/apm.man | 8 +++---- src/apm.h | 4 ++-- src/apm_accel.c | 2 +- src/apm_cursor.c | 11 ++++++++++ src/apm_dga.c | 2 +- src/apm_driver.c | 67 ++++++++++++++++++++++---------------------------------- src/apm_funcs.c | 7 +++--- src/apm_i2c.c | 2 +- src/apm_regs.h | 2 +- src/apm_rush.c | 3 +-- src/apm_video.c | 14 +++++------- 11 files changed, 57 insertions(+), 65 deletions(-) diff --git a/man/apm.man b/man/apm.man index d3ff413..cb206c1 100644 --- a/man/apm.man +++ b/man/apm.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man,v 1.2 2001/01/27 18:20:46 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man,v 1.3 2002/05/07 12:53:49 alanh Exp $ .\" shorthand for double quote that works everywhere. .ds q \N'34' .TH APM __drivermansuffix__ __vendorversion__ @@ -14,7 +14,7 @@ apm \- Alliance ProMotion video driver .fi .SH DESCRIPTION .B apm -is an __xservername__ driver for Alliance ProMotion video cards. The driver +is an XFree86 driver for Alliance ProMotion video cards. The driver is accelerated for supported hardware/depth combination. It supports framebuffer depths of 8, 15, 16, 24 and 32 bits. For 6420, 6422, AT24, AT3D and AT25, all depths are fully accelerated except 24 bpp for which @@ -35,7 +35,7 @@ ProMotion chipsets .TP 12 .B AT25 .SH CONFIGURATION DETAILS -Please refer to __xconfigfile__(__filemansuffix__) for general configuration +Please refer to XF86Config(__filemansuffix__) for general configuration details. This section only covers configuration details specific to this driver. .PP @@ -101,6 +101,6 @@ Force the software cursor. Default: off. .BI "Option \*qShadowFB\*q \*q" boolean \*q Enable or disable use of the shadow framebuffer layer. Default: off. .SH "SEE ALSO" -__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__) +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) .SH AUTHORS Authors include: ... diff --git a/src/apm.h b/src/apm.h index ceeffff..44e37eb 100644 --- a/src/apm.h +++ b/src/apm.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h,v 1.19tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h,v 1.19 2002/05/07 12:53:49 alanh Exp $ */ /* All drivers should typically include these */ @@ -146,7 +146,7 @@ typedef struct { struct ApmStippleCacheRec { XAACacheInfoRec apmStippleCache; FBAreaPtr area; - unsigned int apmStippleCached:1; + int apmStippleCached:1; } apmCache[APM_CACHE_NUMBER]; int apmCachePtr; unsigned char regcurr[0x54]; diff --git a/src/apm_accel.c b/src/apm_accel.c index b59e2a7..72b0cee 100644 --- a/src/apm_accel.c +++ b/src/apm_accel.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c,v 1.20tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c,v 1.21 2002/10/08 22:14:03 tsi Exp $ */ #include "apm.h" #include "miline.h" diff --git a/src/apm_cursor.c b/src/apm_cursor.c index 3f26f0d..4bf0f98 100644 --- a/src/apm_cursor.c +++ b/src/apm_cursor.c @@ -84,6 +84,17 @@ int ApmHWCursorInit(ScreenPtr pScreen) infoPtr->ShowCursor = ApmShowCursor; infoPtr->UseHWCursor = ApmUseHWCursor; + /*ErrorF("%s %s: %s: Using hardware cursor (XAA).\n", + XCONFIG_PROBED, vga256InfoRec.name, vga256InfoRec.chipset); + + if(XAACursorInfoRec.Flags & USE_HARDWARE_CURSOR) { + vgaHWCursor.Init = XAACursorInit; + vgaHWCursor.Initialized = TRUE; + vgaHWCursor.Restore = XAARestoreCursor; + vgaHWCursor.Warp = XAAWarpCursor; + vgaHWCursor.QueryBestSize = XAAQueryBestSize; + }*/ + /* Set up the convert table for the input cursor data */ for (i = 0; i < 256; i++) ConvertTable[i] = ((~i) & 0xAA) | (i & (i >> 1) & 0x55); diff --git a/src/apm_dga.c b/src/apm_dga.c index 88867a9..3a5f362 100644 --- a/src/apm_dga.c +++ b/src/apm_dga.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c,v 1.9 2001/01/06 21:29:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c,v 1.10 2002/01/25 21:55:54 tsi Exp $ */ /* * file: apm_dga.c * ported from s3virge, ported from mga diff --git a/src/apm_driver.c b/src/apm_driver.c index 00dfcc5..fa1d4f7 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.65 2003/10/30 17:36:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.63 2003/08/23 16:09:14 dawes 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 ModeStatus ApmValidMode(int scrnIndex, DisplayModePtr mode, - Bool verbose, int flags); +static int 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,8 +161,12 @@ static const char *xaaSymbols[] = { "XAADestroyInfoRec", "XAAGlyphScanlineFuncLSBFirst", "XAAInit", + "XAAQueryBestSize", "XAAReverseBitOrder", + "XAARestoreCursor", + "XAAScreenIndex", "XAAStippleScanlineFuncMSBFirst", + "XAAWarpCursor", NULL }; @@ -227,7 +231,7 @@ static XF86ModuleVersionInfo apmVersRec = { MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, - XORG_VERSION_CURRENT, + XF86_VERSION_CURRENT, APM_MAJOR_VERSION, APM_MINOR_VERSION, APM_PATCHLEVEL, ABI_CLASS_VIDEODRV, /* This is a video driver */ ABI_VIDEODRV_VERSION, @@ -471,7 +475,7 @@ static int * GetAccelPitchValues(ScrnInfoPtr pScrn) { int *linePitches = NULL; - int linep[] = {640, 800, 1024, 1152, 1280, 0}; + int linep[] = {640, 800, 1024, 1152, 1280, 1600, 0}; if (sizeof linep > 0) { linePitches = (int *)xnfalloc(sizeof linep); @@ -1076,12 +1080,12 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags) if (pApm->NoAccel) { /* * XXX Assuming min pitch 256, max 2048 - * XXX Assuming min height 128, max 1024 (changed EE) + * XXX Assuming min height 128, max 2048 */ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, 256, 2048, - pScrn->bitsPerPixel, 128, 1024, + pScrn->bitsPerPixel, 128, 2048, pScrn->display->virtualX, pScrn->display->virtualY, pApm->FbMapSize, @@ -1093,7 +1097,7 @@ ApmPreInit(ScrnInfoPtr pScrn, int flags) i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, GetAccelPitchValues(pScrn), 0, 0, - pScrn->bitsPerPixel, 128, 1024, + pScrn->bitsPerPixel, 128, 2048, pScrn->display->virtualX, pScrn->display->virtualY, pApm->FbMapSize, @@ -1431,9 +1435,7 @@ 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 @@ -1451,7 +1453,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.99*fvco_goal, 1.01*fvco_goal)) + if (!WITHIN(fvco, 0.995*fvco_goal, 1.005*fvco_goal)) continue; if (!WITHIN(fvco, fmin, fmax)) continue; @@ -1460,16 +1462,6 @@ 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. @@ -1526,15 +1518,11 @@ comp_lmn(ApmPtr pApm, long clock) if (f > 7) f = 7; if (f < 0) f = 0; } - - best = (n << 16) | (m << 8) | (l << 2) | (f << 4); + + return (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", @@ -1740,26 +1728,24 @@ 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. */ @@ -2001,13 +1987,6 @@ 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); @@ -2022,6 +2001,12 @@ 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)) @@ -2277,7 +2262,7 @@ ApmFreeScreen(int scrnIndex, int flags) /* Checks if a mode is suitable for the selected chipset. */ /* Optional */ -static ModeStatus +static int ApmValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { if (mode->Flags & V_INTERLACE) diff --git a/src/apm_funcs.c b/src/apm_funcs.c index 7bfb5a2..71f0fe8 100644 --- a/src/apm_funcs.c +++ b/src/apm_funcs.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c,v 1.18tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c,v 1.17 2002/05/07 12:53:49 alanh Exp $ */ #define FASTER #ifndef PSZ @@ -38,7 +38,7 @@ # define A(s) Apm##s # endif #endif -#define DPRINTNAME(s) do { xf86DrvMsgVerb(pScrn->pScreen->myNum, X_NOTICE, 6, "Apm" #s APM_SUFF_24 APM_SUFF_IOP "\n"); } while (0) +#define DPRINTNAME(s) do { xf86DrvMsgVerb(pScrn->pScreen->myNum, X_NOTICE, 4, "Apm" #s APM_SUFF_24 APM_SUFF_IOP "\n"); } while (0) #if PSZ == 24 #undef SETSOURCEXY @@ -1364,7 +1364,7 @@ A(FillImageWriteRects)(ScrnInfoPtr pScrn, int rop, unsigned int planemask, PixmapPtr pPix) { XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - int x, y, phaseY, phaseX, height, width, blit_w; + int x, y, phaseY, phaseX, phaseXB, height, width, blit_w; int pHeight = pPix->drawable.height; int pWidth = pPix->drawable.width; int depth = pPix->drawable.depth; @@ -1404,6 +1404,7 @@ A(FillImageWriteRects)(ScrnInfoPtr pScrn, int rop, unsigned int planemask, if(!width) break; x += blit_w; phaseX = (phaseX + blit_w) % pWidth; + phaseXB = phaseX * pPix->drawable.bitsPerPixel / 8; } pBox++; } diff --git a/src/apm_i2c.c b/src/apm_i2c.c index aa45bc7..dc250b1 100644 --- a/src/apm_i2c.c +++ b/src/apm_i2c.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c,v 1.6.4.1 2001/11/28 22:35:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c,v 1.7 2002/01/25 21:55:55 tsi Exp $ */ #include "apm.h" #include "apm_regs.h" diff --git a/src/apm_regs.h b/src/apm_regs.h index bd4d015..633a1eb 100644 --- a/src/apm_regs.h +++ b/src/apm_regs.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_regs.h,v 1.7 2000/02/29 03:09:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_regs.h,v 1.8 2002/01/25 21:55:55 tsi Exp $ */ diff --git a/src/apm_rush.c b/src/apm_rush.c index 4e0b745..9b4da96 100644 --- a/src/apm_rush.c +++ b/src/apm_rush.c @@ -1,5 +1,4 @@ -/* $XdotOrg$ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c,v 1.11tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c,v 1.12 2003/02/12 21:46:42 tsi Exp $ */ /* * Copyright Loïc Grenié 1999 */ diff --git a/src/apm_video.c b/src/apm_video.c index dcaa00b..7107b13 100644 --- a/src/apm_video.c +++ b/src/apm_video.c @@ -1,8 +1,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c,v 1.11tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c,v 1.10 2003/04/23 21:51:26 tsi Exp $ */ #if PSZ != 24 #include "dixstruct.h" -#include "fourcc.h" /* * Ported from mga_video.c by Loïc Grenié @@ -116,7 +115,7 @@ static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"} }; -#define NUM_IMAGES 9 +#define NUM_IMAGES 8 typedef char c8; static XF86ImageRec Images[NUM_IMAGES] = @@ -172,7 +171,6 @@ 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, @@ -340,8 +338,8 @@ A(SetupImageVideo)(ScreenPtr pScreen) pPriv[1].contrast = 128; /* gotta uninit this someplace */ - REGION_NULL(pScreen, &pPriv->clip); - REGION_NULL(pScreen, &(pPriv + 1)->clip); + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + REGION_INIT(pScreen, &(pPriv + 1)->clip, NullBox, 0); pApm->adaptor = adapt; @@ -508,7 +506,6 @@ 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; @@ -537,7 +534,7 @@ A(ReputImage)(ScrnInfoPtr pScrn, short drw_x, short drw_y, reg0 = &pPriv0->clip; bzero(&Union, sizeof Union); REGION_EMPTY(pScreen, &Union); - REGION_NULL(pScreen, &Union); + REGION_INIT(pScreen, &Union, NullBox, 0); REGION_UNION(pScreen, &Union, reg0, &pPriv1->clip); nrects = REGION_NUM_RECTS(&Union); rects = REGION_RECTS(&Union); @@ -929,7 +926,6 @@ ApmQueryImageAttributes(ScrnInfoPtr pScrn, int id, case 0x59565955: case 0x55595659: case 0x59555956: - case 0x32595559: size = *w << 1; goto common; case 0x59595959: -- cgit v1.2.3