summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:48:59 +0000
committerKaleb Keithley <kaleb@freedesktop.org>2003-11-26 22:48:59 +0000
commitaaf74493bbda0f57dd77ec51502b3b0a7264b823 (patch)
treeaf470bc13f33a8ca3900ff05fc04ef3181783400
parent3b2090ec858107463451f90a4889f2c4cfc21254 (diff)
merge latest (4.3.99.16) from XFree86 (vendor) branchXORG-RELEASE-1-BASEXEVIE-MERGEXEVIE-BASEXINERAMA_2XEVIE
-rw-r--r--src/i740.h3
-rw-r--r--src/i740_driver.c126
-rw-r--r--src/i740_video.c90
3 files changed, 84 insertions, 135 deletions
diff --git a/src/i740.h b/src/i740.h
index 63f78f2..267c13c 100644
--- a/src/i740.h
+++ b/src/i740.h
@@ -25,7 +25,7 @@ TORT OR 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/i740/i740.h,v 1.7 2002/10/23 16:08:36 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h,v 1.8 2003/08/23 16:09:17 dawes Exp $ */
/*
* Authors:
@@ -150,6 +150,7 @@ void I740InitVideo(ScreenPtr pScreen);
Bool I740SwitchMode(int scrnIndex, DisplayModePtr mode, int flags);
void I740AdjustFrame(int scrnIndex, int x, int y, int flags);
+Bool I740_I2CInit(ScrnInfoPtr pScrn);
#define minb(p) MMIO_IN8(pI740->MMIOBase, (p))
#define moutb(p,v) MMIO_OUT8(pI740->MMIOBase, (p),(v))
diff --git a/src/i740_driver.c b/src/i740_driver.c
index 51e8b61..53240c1 100644
--- a/src/i740_driver.c
+++ b/src/i740_driver.c
@@ -25,7 +25,7 @@ TORT OR 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/i740/i740_driver.c,v 1.41 2003/02/17 16:59:02 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c,v 1.50 2003/11/03 05:11:16 tsi Exp $ */
/*
* Authors:
@@ -41,6 +41,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* DGA
*/
+#ifndef USE_DDC2
+#define USE_DDC2 0
+#endif
+
/*
* These are X and server generic header files.
*/
@@ -92,7 +96,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/* The driver's own header file: */
-#include "miscstruct.h"
+#include "regionstr.h"
#include "xf86xv.h"
#include "Xv.h"
@@ -133,8 +137,8 @@ static Bool I740SaveScreen(ScreenPtr pScreen, int mode);
static void I740FreeScreen(int scrnIndex, int flags);
/* Check if a mode is valid on the hardware */
-static int I740ValidMode(int scrnIndex, DisplayModePtr mode, Bool
- verbose, int flags);
+static ModeStatus I740ValidMode(int scrnIndex, DisplayModePtr mode,
+ Bool verbose, int flags);
/* Switch to various Display Power Management System levels */
static void I740DisplayPowerManagementSet(ScrnInfoPtr pScrn,
@@ -216,6 +220,7 @@ static const char *vgahwSymbols[] = {
0
};
+#ifdef XFree86LOADER
static const char *fbSymbols[] = {
#ifdef USE_FB
"fbScreenInit",
@@ -230,20 +235,12 @@ static const char *fbSymbols[] = {
"cfb24_32ScreenInit",
NULL
};
-
-static const char *xf8_32bppSymbols[] = {
- "xf86Overlay8Plus32Init",
- NULL
-};
+#endif
static const char *xaaSymbols[] = {
"XAADestroyInfoRec",
"XAACreateInfoRec",
"XAAInit",
- "XAAStippleScanlineFuncLSBFirst",
- "XAAOverlayFBfuncs",
- "XAACachePlanarMonoStipple",
- "XAAScreenIndex",
NULL
};
@@ -254,12 +251,16 @@ static const char *ramdacSymbols[] = {
NULL
};
+#ifdef XFree86LOADER
static const char *vbeSymbols[] = {
"VBEInit",
"vbeDoEDID",
+ "vbeFree",
NULL
};
+#endif
+#if USE_DDC2
static const char *ddcSymbols[] = {
"xf86PrintEDID",
"xf86DoEDID_DDC1",
@@ -272,6 +273,7 @@ static const char *i2cSymbols[] = {
"xf86I2CBusInit",
NULL
};
+#endif
#ifdef XFree86LOADER
@@ -315,9 +317,11 @@ i740Setup(pointer module, pointer opts, int *errmaj, int *errmin)
* might refer to.
*/
LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols,
- xf8_32bppSymbols, ramdacSymbols, vbeSymbols,
- ddcSymbols, i2cSymbols, NULL /* shadowSymbols */,
- NULL /* fbdevsymbols */, NULL);
+ ramdacSymbols, vbeSymbols,
+#if USE_DDC2
+ ddcSymbols, i2cSymbols,
+#endif
+ NULL);
/*
* The return value must be non-NULL on success even though there
@@ -489,7 +493,6 @@ I740ProbeDDC(ScrnInfoPtr pScrn, int index)
*/
static Bool
I740PreInit(ScrnInfoPtr pScrn, int flags) {
- vgaHWPtr hwp;
I740Ptr pI740;
ClockRangePtr clockRanges;
int i;
@@ -543,7 +546,7 @@ I740PreInit(ScrnInfoPtr pScrn, int flags) {
flags24=Support24bppFb | Support32bppFb | SupportConvert32to24;
- if (!xf86SetDepthBpp(pScrn, 8, 8, 8, flags24)) {
+ if (!xf86SetDepthBpp(pScrn, 0, 0, 0, flags24)) {
return FALSE;
} else {
switch (pScrn->depth) {
@@ -579,7 +582,6 @@ I740PreInit(ScrnInfoPtr pScrn, int flags) {
/* We use a programamble clock */
pScrn->progClock = TRUE;
- hwp = VGAHWPTR(pScrn);
pI740->cpp = pScrn->bitsPerPixel/8;
/* Process the options */
@@ -828,6 +830,7 @@ I740PreInit(ScrnInfoPtr pScrn, int flags) {
I740FreeRec(pScrn);
return FALSE;
}
+ xf86LoaderReqSymLists(xaaSymbols, NULL);
}
if (!xf86ReturnOptValBool(pI740->Options, OPTION_SW_CURSOR, FALSE)) {
@@ -862,7 +865,7 @@ I740PreInit(ScrnInfoPtr pScrn, int flags) {
pI740->usevgacompat=FALSE;
-#if 0 /*DDC2*/
+#if USE_DDC2 /*DDC2*/
{ /*PL*/
if (xf86LoadSubModule(pScrn, "ddc")) {
@@ -1486,12 +1489,10 @@ I740ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode_src)
static void I740LoadPalette15(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual)
{
- I740Ptr pI740;
vgaHWPtr hwp;
int i, index;
unsigned char r, g, b;
- pI740 = I740PTR(pScrn);
hwp = VGAHWPTR(pScrn);
for (i=0; i<numColors; i++)
@@ -1516,12 +1517,10 @@ static void I740LoadPalette15(ScrnInfoPtr pScrn, int numColors, int *indices, LO
static void I740LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual)
{
- I740Ptr pI740;
vgaHWPtr hwp;
int i, index;
unsigned char r, g, b;
- pI740 = I740PTR(pScrn);
hwp = VGAHWPTR(pScrn);
for (i=0; i<numColors; i++) {
index=indices[i/2];
@@ -1546,12 +1545,10 @@ static void I740LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LO
static void
I740LoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors,
VisualPtr pVisual) {
- I740Ptr pI740;
vgaHWPtr hwp;
int i, index;
unsigned char r, g, b;
- pI740 = I740PTR(pScrn);
hwp = VGAHWPTR(pScrn);
for (i=0; i<numColors; i++) {
index=indices[i];
@@ -1655,6 +1652,26 @@ I740ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
xf86SetBlackWhitePixels(pScreen);
+ memset(&(pI740->FbMemBox), 0, sizeof(BoxRec));
+ pI740->FbMemBox.x1=0;
+ pI740->FbMemBox.x2=pScrn->displayWidth;
+ pI740->FbMemBox.y1=0;
+ pI740->FbMemBox.y2=pI740->FbMapSize/(pScrn->displayWidth*pI740->cpp);
+
+ I740DGAInit(pScreen);
+
+ if (!xf86InitFBManager(pScreen, &pI740->FbMemBox)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to init memory manager\n");
+ return FALSE;
+ }
+
+ if (!xf86ReturnOptValBool(pI740->Options, OPTION_NOACCEL, FALSE)) {
+ if (!I740AccelInit(pScreen)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Hardware acceleration initialization failed\n");
+ }
+ }
+
if (pScrn->bitsPerPixel>8) {
visual = pScreen->visuals + pScreen->numVisuals;
while (--visual >= pScreen->visuals) {
@@ -1675,6 +1692,13 @@ I740ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
miDCInitialize(pScreen, xf86GetPointerScreenFuncs());
+ if (!xf86ReturnOptValBool(pI740->Options, OPTION_SW_CURSOR, FALSE)) {
+ if (!I740CursorInit(pScreen)) {
+ xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
+ "Hardware cursor initialization failed\n");
+ }
+ }
+
if (!miCreateDefColormap(pScreen)) return FALSE;
if (pScrn->bitsPerPixel==16)
@@ -1698,45 +1722,6 @@ I740ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
xf86DPMSInit(pScreen, I740DisplayPowerManagementSet, 0);
-#if 0 /*def XvExtension*/
- {
- XF86VideoAdaptorPtr *ptr;
- int n;
-
- n = xf86XVListGenericAdaptors(pScrn,&ptr);
- if (n) {
- xf86XVScreenInit(pScreen, ptr, n);
- }
- }
-#endif
-
- memset(&(pI740->FbMemBox), 0, sizeof(BoxRec));
- pI740->FbMemBox.x1=0;
- pI740->FbMemBox.x2=pScrn->displayWidth;
- pI740->FbMemBox.y1=0;
- pI740->FbMemBox.y2=pI740->FbMapSize/(pScrn->displayWidth*pI740->cpp);
-
- I740DGAInit(pScreen);
-
- if (!xf86InitFBManager(pScreen, &pI740->FbMemBox)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to init memory manager\n");
- return FALSE;
- }
-
- if (!xf86ReturnOptValBool(pI740->Options, OPTION_NOACCEL, FALSE)) {
- if (!I740AccelInit(pScreen)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Hardware acceleration initialization failed\n");
- }
- }
-
- if (!xf86ReturnOptValBool(pI740->Options, OPTION_SW_CURSOR, FALSE)) {
- if (!I740CursorInit(pScreen)) {
- xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
- "Hardware cursor initialization failed\n");
- }
- }
-
pScreen->SaveScreen = I740SaveScreen;
pI740->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = I740CloseScreen;
@@ -1744,11 +1729,8 @@ I740ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) {
if (serverGeneration == 1)
xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options);
-#ifdef XvExtension
- { /* Overlay */
- I740InitVideo(pScreen); pI740->OverlayStart = pI740->CursorStart + 1024;
- }
-#endif /*XvExtension*/
+ /* Overlay */
+ I740InitVideo(pScreen); pI740->OverlayStart = pI740->CursorStart + 1024;
return TRUE;
}
@@ -1764,12 +1746,10 @@ I740SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) {
void
I740AdjustFrame(int scrnIndex, int x, int y, int flags) {
ScrnInfoPtr pScrn;
- I740Ptr pI740;
int Base;
vgaHWPtr hwp;
pScrn = xf86Screens[scrnIndex];
- pI740 = I740PTR(pScrn);
hwp = VGAHWPTR(pScrn);
Base = (y * pScrn->displayWidth + x) >> 2;
@@ -1857,7 +1837,7 @@ I740FreeScreen(int scrnIndex, int flags) {
vgaHWFreeHWRec(xf86Screens[scrnIndex]);
}
-static int
+static ModeStatus
I740ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) {
if (mode->Flags & V_INTERLACE) {
if (verbose) {
diff --git a/src/i740_video.c b/src/i740_video.c
index 7ce7dfb..1ea5370 100644
--- a/src/i740_video.c
+++ b/src/i740_video.c
@@ -24,33 +24,33 @@
* with modifications by Stephen Blackheath (Aug 2002)
*
* REVISION HISTORY:
- * December 2001 - Patrick LERDA's original (http://sourceforge.net/projects/i740fb).
- * 27 August 2002 - Patrick's version would run for an hour or two on my machine,
- * then the screen would go blank (no signal to monitor) and for some reason I
- * sometimes couldn't even log in through the network. I had to re-boot my machine.
- * This version fixes that and makes a few other unnecessary tweaks. I am not
- * certain, but I think the problem is that Patrick's code was reading a value from
- * XRX register 0xD0, and or'ing with 0x10. When I removed this from the main
- * loop, it became reliable. I suspect the hardware (whether just my cheap
- * clone board only I'm not sure) was sometimes returning bogus values, which were
- * then programmed back in - but I never checked this. This register is related to
- * powering on or off certain subsystems of the i740 chip, so that might explain
- * the blank screen. - Stephen Blackheath
- * 3 September 2002 - Added software scaling in the situation where the screen size is
- * smaller than the original video size, since scaling down is not supported by
- * the hardware. The implementation of this is not quite complete.
- * 12 September 2002 - Better software scaling with some averaging, giving a nicer
- * picture.
- * 13 January 2003 - Fixed a minor bug where the video would occasionally stop updating,
- * which was worked around just by re-sizing the window.
+ * December 2001 - Patrick LERDA's original i740fb project on SourceForge.
+ * 27 August 2002 - Patrick's version would run for an hour or two on my
+ * machine, then the screen would go blank (no signal to monitor) and for
+ * some reason I sometimes couldn't even log in through the network. I had
+ * to re-boot my machine. This version fixes that and makes a few other
+ * unnecessary tweaks. I am not certain, but I think the problem is that
+ * Patrick's code was reading a value from XRX register 0xD0, and or'ing
+ * with 0x10. When I removed this from the main loop, it became reliable.
+ * I suspect the hardware (whether just my cheap clone board only I'm not
+ * sure) was sometimes returning bogus values, which were then programmed
+ * back in - but I never checked this. This register is related to
+ * powering on or off certain subsystems of the i740 chip, so that might
+ * explain the blank screen. - Stephen Blackheath
+ * 3 September 2002 - Added software scaling in the situation where the
+ * screen size is smaller than the original video size, since scaling down
+ * is not supported by the hardware. The implementation of this is not
+ * quite complete.
+ * 12 September 2002 - Better software scaling with some averaging, giving a
+ * nicer picture.
*/
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_video.c,v 1.3 2003/01/17 22:22:52 tsi Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_video.c,v 1.6 2003/11/10 18:22:21 tsi Exp $ */
+
/*
* i740_video.c: i740 Xv driver. Based on the mga Xv driver by Mark Vojkovich.
*/
-#ifdef XvExtension
#include "xf86.h"
#include "xf86_OSproc.h"
#include "xf86Resources.h"
@@ -275,36 +275,6 @@ static void I740ResetVideo(ScrnInfoPtr pScrn)
-
-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;
-}
-
-
/* I740ClipVideo -
Takes the dst box in standard X BoxRec form (top and left
@@ -618,11 +588,11 @@ static FBLinearPtr I740AllocateMemory(ScrnInfoPtr pScrn, FBLinearPtr linear, int
return linear;
if(xf86ResizeOffscreenLinear(linear, size)) {
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateMemory resized to %d - %p\n", (int) size, linear); /* ### */
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateMemory resized to %d - %p\n", (int) size, (void *)linear); /* ### */
return linear;
}
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateMemory free %p - %d < %d\n", linear, (int) linear->size, (int) size); /* ### */
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateMemory free %p - %d < %d\n", (void *)linear, (int) linear->size, (int) size); /* ### */
xf86FreeOffscreenLinear(linear);
}
@@ -646,7 +616,7 @@ static FBLinearPtr I740AllocateMemory(ScrnInfoPtr pScrn, FBLinearPtr linear, int
new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4,
NULL, NULL, NULL);
}
- xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateMemory allocated %d - %p\n", (int) size, new_linear); /* ### */
+ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "I740AllocateMemory allocated %d - %p\n", (int) size, (void *)new_linear); /* ### */
return new_linear;
}
@@ -659,6 +629,7 @@ static int I740PutImage(ScrnInfoPtr pScrn,
Bool sync, RegionPtr clipBoxes, pointer data
)
{
+ ScreenPtr pScreen = pScrn->pScreen;
I740Ptr pI740 = I740PTR(pScrn);
I740PortPrivPtr pPriv = (I740PortPrivPtr)data;
INT32 x1, x2, y1, y2;
@@ -788,11 +759,11 @@ static int I740PutImage(ScrnInfoPtr pScrn,
}
/* update cliplist */
- if(!RegionsEqual(&pPriv->clip, clipBoxes))
+ if(!REGION_EQUAL(pScreen, &pPriv->clip, clipBoxes))
{
REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
/* draw these */
- XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes));
+ xf86XVFillKeyHelper(pScreen, pPriv->colorKey, clipBoxes);
}
{
@@ -1075,9 +1046,7 @@ static int I740DisplaySurface(XF86SurfacePtr surface, short src_x, short src_y,
src_w, src_h, drw_w, drw_h,
0x00);
- XAAFillSolidRects(pScrn, pI740Priv->colorKey, GXcopy, ~0,
- REGION_NUM_RECTS(clipBoxes),
- REGION_RECTS(clipBoxes));
+ xf86XVFillKeyHelper(pScrn->pScreen, pI740Priv->colorKey, clipBoxes);
pPriv->isOn = TRUE;
/* we've prempted the XvImage stream so set its free timer */
@@ -1248,7 +1217,7 @@ static XF86VideoAdaptorPtr I740SetupImageVideo(ScreenPtr pScreen)
pPriv->currentBuf = 0;
/* gotta uninit this someplace */
- REGION_INIT(pScreen, &pPriv->clip, NullBox, 0);
+ REGION_NULL(pScreen, &pPriv->clip);
pI740->adaptor = adapt;
@@ -1320,4 +1289,3 @@ void I740InitVideo(ScreenPtr pScreen)
}
}
-#endif /*XvExtension*/