summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:48:58 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:48:58 +0000
commitfee1f0faa587bfe8dc34970c66a3708ce189ba74 (patch)
tree47c01f0011bc1583926d8b294e68f3ffdd5356f5
parentdc8e1571ee80808baf376ac7f1f7d557309a487b (diff)
merge latest (4.3.99.16) from XFree86 (vendor) branch
-rw-r--r--README.sgml9
-rw-r--r--src/apm.h4
-rw-r--r--src/apm_cursor.c13
-rw-r--r--src/apm_driver.c72
-rw-r--r--src/apm_funcs.c7
-rw-r--r--src/apm_video.c68
6 files changed, 70 insertions, 103 deletions
diff --git a/README.sgml b/README.sgml
index 196c5b7..ba081fd 100644
--- a/README.sgml
+++ b/README.sgml
@@ -4,11 +4,11 @@
<article>
<title> Information for Alliance Promotion chipset users
-<author> Loïc Grenié (<email>grenie@math.jussieu.fr</email>),
+<author> Lo&iuml;c Greni&eacute; (<email>grenie@math.jussieu.fr</email>),
Henrik Harmsen (<email>Henrik.Harmsen@erv.ericsson.se</email>)
<date> 6 March 2000
<ident>
-$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/apm.sgml,v 1.3 2000/03/08 05:38:43 dawes Exp $
+$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/apm.sgml,v 1.4 2003/10/19 19:47:17 dawes Exp $
</ident>
<toc>
@@ -114,8 +114,9 @@ There is support for the XF86Rush extension for use with the glide2x library.
<sect> Questions
<p>
-Any questions regarding this driver should be sent to Loïc Grenié. It should
-be possible to add support for the 3210 chipset if someone needs it.
+Any questions regarding this driver should be sent to Lo&iuml;c
+Greni&eacute;. It should be possible to add support for the 3210 chipset
+if someone needs it.
</article>
diff --git a/src/apm.h b/src/apm.h
index 44e37eb..ddf9b06 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.19 2002/05/07 12:53:49 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h,v 1.20 2003/11/03 05:11:04 tsi Exp $ */
/* All drivers should typically include these */
@@ -146,7 +146,7 @@ typedef struct {
struct ApmStippleCacheRec {
XAACacheInfoRec apmStippleCache;
FBAreaPtr area;
- int apmStippleCached:1;
+ unsigned int apmStippleCached:1;
} apmCache[APM_CACHE_NUMBER];
int apmCachePtr;
unsigned char regcurr[0x54];
diff --git a/src/apm_cursor.c b/src/apm_cursor.c
index 4bf0f98..6a23341 100644
--- a/src/apm_cursor.c
+++ b/src/apm_cursor.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_cursor.c,v 1.14 2000/06/30 18:27:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_cursor.c,v 1.15 2003/10/30 18:37:20 tsi Exp $ */
#include "X.h"
@@ -84,17 +84,6 @@ 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_driver.c b/src/apm_driver.c
index dd877d3..43ee94e 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.61 2002/10/16 21:13:46 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.66 2003/10/30 18:37:20 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
};
@@ -177,12 +173,14 @@ static const char *ramdacSymbols[] = {
NULL
};
+#ifdef XFree86LOADER
static const char *vbeSymbols[] = {
"VBEInit",
"vbeDoEDID",
"vbeFree",
NULL
};
+#endif
static const char *ddcSymbols[] = {
"xf86DoEDID_DDC1",
@@ -202,11 +200,13 @@ static const char *shadowSymbols[] = {
NULL
};
+#ifdef XFree86LOADER
static const char *miscfbSymbols[] = {
"xf1bppScreenInit",
"xf4bppScreenInit",
NULL
};
+#endif
static const char *fbSymbols[] = {
"fbPictureInit",
@@ -471,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);
@@ -1076,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,
@@ -1093,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,
@@ -1431,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
@@ -1449,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;
@@ -1458,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.
@@ -1514,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",
@@ -1724,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. */
@@ -1983,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);
@@ -1997,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))
@@ -2233,9 +2252,6 @@ ApmCloseScreen(int scrnIndex, ScreenPtr pScreen)
pApm->CursorInfoRec = NULL;
if (pApm->DGAModes)
xfree(pApm->DGAModes);
- if (pApm->I2CPtr)
- xf86DestroyI2CBusRec(pApm->I2CPtr, TRUE, TRUE);
- pApm->I2CPtr = NULL;
if (pApm->adaptor)
xfree(pApm->adaptor);
@@ -2261,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_funcs.c b/src/apm_funcs.c
index 71f0fe8..2a0e6a6 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.17 2002/05/07 12:53:49 alanh Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_funcs.c,v 1.19 2003/11/03 05:11:04 tsi 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, 4, "Apm" #s APM_SUFF_24 APM_SUFF_IOP "\n"); } while (0)
+#define DPRINTNAME(s) do { xf86DrvMsgVerb(pScrn->pScreen->myNum, X_NOTICE, 6, "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, phaseXB, height, width, blit_w;
+ int x, y, phaseY, phaseX, height, width, blit_w;
int pHeight = pPix->drawable.height;
int pWidth = pPix->drawable.width;
int depth = pPix->drawable.depth;
@@ -1404,7 +1404,6 @@ 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_video.c b/src/apm_video.c
index 4f57808..5a75be0 100644
--- a/src/apm_video.c
+++ b/src/apm_video.c
@@ -1,17 +1,13 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c,v 1.9 2001/06/15 21:22:45 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c,v 1.12 2003/11/10 18:22:17 tsi Exp $ */
#if PSZ != 24
#include "dixstruct.h"
+#include "fourcc.h"
/*
* Ported from mga_video.c by Loïc Grenié
*/
-#ifndef XvExtension
-void A(InitVideo)(ScreenPtr pScreen) {}
-void A(ResetVideo)(ScrnInfoPtr pScrn) {}
-#else
-
#ifndef OFF_DELAY
#define OFF_DELAY 200
#endif
@@ -120,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] =
@@ -176,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,
@@ -343,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;
@@ -483,43 +480,6 @@ ApmQueryBestSize(ScrnInfoPtr pScrn, Bool motion, short vid_w, short vid_h,
*p_w = drw_w & round;
*p_h = drw_h & round;
}
-
-static void
-ApmCopyData(unsigned char *src, unsigned char *dst, int srcPitch, int dstPitch,
- int h, int w)
-{
- w <<= 1;
- while(h--) {
- memcpy(dst, src, w);
- src += srcPitch;
- dst += dstPitch;
- }
-}
-
-static void
-ApmCopyMungedData(unsigned char *src1, unsigned char *src2,
- unsigned char *src3, unsigned char *dst1,
- int srcPitch, int srcPitch2, int dstPitch, int h, int w)
-{
- CARD32 *dst = (CARD32*)dst1;
- int i, j;
-
- dstPitch >>= 2;
- w >>= 1;
-
- for(j = 0; j < h; j++) {
- for(i = 0; i < w; i++) {
- dst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) |
- (src2[i] << 8) | (src3[i] << 24);
- }
- dst += dstPitch;
- src1 += srcPitch;
- if(j & 1) {
- src2 += srcPitch2;
- src3 += srcPitch2;
- }
- }
-}
#endif
static void A(XvMoveCB)(FBAreaPtr area1, FBAreaPtr area2)
@@ -548,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;
@@ -576,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);
@@ -868,9 +829,10 @@ A(PutImage)(ScrnInfoPtr pScrn, short src_x, short src_y,
offset2 += tmp;
offset3 += tmp;
nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
- ApmCopyMungedData(buf + (top * srcPitch) + (left >> 1),
- buf + offset2, buf + offset3, dst_start,
- srcPitch, srcPitch2, dstPitch, nlines, npixels);
+ xf86XVCopyYUV12ToPacked(buf + (top * srcPitch) + (left >> 1),
+ buf + offset2, buf + offset3, dst_start,
+ srcPitch, srcPitch2, dstPitch,
+ nlines, npixels);
break;
default:
if (id == 0x32335652)
@@ -880,7 +842,8 @@ A(PutImage)(ScrnInfoPtr pScrn, short src_x, short src_y,
buf += (top * srcPitch) + left;
nlines = ((y2 + 0xffff) >> 16) - top;
if (offscreen)
- ApmCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels);
+ xf86XVCopyPacked(buf, dst_start, srcPitch, dstPitch,
+ nlines, npixels);
break;
}
}
@@ -966,6 +929,7 @@ ApmQueryImageAttributes(ScrnInfoPtr pScrn, int id,
case 0x59565955:
case 0x55595659:
case 0x59555956:
+ case 0x32595559:
size = *w << 1;
goto common;
case 0x59595959:
@@ -982,5 +946,3 @@ common:
}
#endif
#endif
-#endif
-