Commit 000644c8 authored by Kaleb Keithley Keithley's avatar Kaleb Keithley Keithley
Browse files

merge latest (4.3.99.16) from XFree86 (vendor) branch

parent 3685e43c
.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man,v 1.4 2003/02/20 03:22:52 dawes Exp $
.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man,v 1.5 2003/05/29 21:48:09 herrb Exp $
.\" shorthand for double quote that works everywhere.
.ds q \N'34'
.TH NEOMAGIC __drivermansuffix__ __vendorversion__
......@@ -77,7 +77,7 @@ Enable or disable use of the shadow framebuffer layer. Default: off.
Reserve the given amount of memory (in bytes) for the XVideo overlay. On
boards with limited memory, display of large XVideo buffers might fail due
to insufficient available memory. Using this option solves the problem at
the expense of reducing the memory avilable for other operations. For
the expense of reducing the memory available for other operations. For
full\-resolution DVDs, 829440 bytes (720x576x2) are necessary.
.PP
.B Note
......
......@@ -22,7 +22,7 @@ RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**********************************************************************/
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h,v 1.23 2002/10/30 12:52:21 alanh Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h,v 1.24 2003/04/23 21:51:40 tsi Exp $ */
/*
* The original Precision Insight driver for
......@@ -60,10 +60,8 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "xf86i2c.h"
#ifdef XvExtension
# include "xf86xv.h"
# include "Xv.h"
#endif /* XvExtension */
#include "xf86xv.h"
#include "Xv.h"
/*
* Driver data structures.
......@@ -263,7 +261,6 @@ typedef struct neoRec
void (*PointerMoved)(int index, int x, int y);
int rotate;
Bool showcache;
#ifdef XvExtension
Bool video;
double videoHZoom;
double videoVZoom;
......@@ -272,7 +269,6 @@ typedef struct neoRec
int overlay_offset;
int videoKey;
int interlace;
#endif /* XvExtension */
} NEORec, *NEOPtr;
typedef struct {
......
......@@ -30,7 +30,7 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
* Copyright 2002 Shigehiro Nomura
*/
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.66 2002/12/09 11:32:48 eich Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.73 2003/10/31 15:46:34 tsi Exp $ */
/*
* The original Precision Insight driver for
......@@ -94,10 +94,8 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include "picturestr.h"
#ifdef XvExtension
#include "xf86xv.h"
#include "Xv.h"
#endif
/*
* Driver data structures.
......@@ -125,8 +123,8 @@ static Bool NEOEnterVT(int scrnIndex, int flags);
static void NEOLeaveVT(int scrnIndex, int flags);
static Bool NEOCloseScreen(int scrnIndex, ScreenPtr pScreen);
static void NEOFreeScreen(int scrnIndex, int flags);
static int NEOValidMode(int scrnIndex, DisplayModePtr mode,
Bool verbose, int flags);
static ModeStatus NEOValidMode(int scrnIndex, DisplayModePtr mode,
Bool verbose, int flags);
/* Internally used functions */
static int neoFindIsaDevice(GDevPtr dev);
......@@ -964,7 +962,7 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
neoDoDDC1(pScrn);
}
if (!xf86SetDepthBpp(pScrn, 8, 8, 8, bppSupport ))
if (!xf86SetDepthBpp(pScrn, 16, 0, 0, bppSupport ))
return FALSE;
else {
/* Check that the returned depth is one we support */
......@@ -1081,7 +1079,7 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
"Valid options are \"CW\" or \"CCW\"\n");
}
}
#ifdef XvExtension
if(xf86GetOptValInteger(nPtr->Options,
OPTION_VIDEO_KEY, &(nPtr->videoKey))) {
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
......@@ -1112,8 +1110,6 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Valid options are 0..2\n");
}
}
#endif /* XvExtension */
if (height_480
&& (nPtr->NeoPanelWidth == 800 || nPtr->NeoPanelWidth == 1024)) {
......@@ -1199,7 +1195,7 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
/* XXX Check this matches a PCI base address */
nPtr->NeoLinearAddr = nPtr->pEnt->device->MemBase;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"FB base address is set at 0x%X.\n",
"FB base address is set at 0x%lX.\n",
nPtr->NeoLinearAddr);
} else {
nPtr->NeoLinearAddr = 0;
......@@ -1211,7 +1207,7 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
/* XXX Check this matches a PCI base address */
nPtr->NeoMMIOAddr = nPtr->pEnt->device->IOBase;
xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
"MMIO base address is set at 0x%X.\n",
"MMIO base address is set at 0x%lX.\n",
nPtr->NeoMMIOAddr);
} else {
nPtr->NeoMMIOAddr = 0;
......@@ -1221,7 +1217,7 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
if (!nPtr->NeoLinearAddr) {
nPtr->NeoLinearAddr = nPtr->PciInfo->memBase[0];
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"FB base address is set at 0x%X.\n",
"FB base address is set at 0x%lX.\n",
nPtr->NeoLinearAddr);
}
if (!nPtr->NeoMMIOAddr && !nPtr->noMMIO) {
......@@ -1244,11 +1240,11 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
break;
}
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"MMIO base address is set at 0x%X.\n",
"MMIO base address is set at 0x%lX.\n",
nPtr->NeoMMIOAddr);
if (nPtr->NeoMMIOAddr2 != 0){
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"MMIO base address2 is set at 0x%X.\n",
"MMIO base address2 is set at 0x%lX.\n",
nPtr->NeoMMIOAddr2);
}
}
......@@ -1266,13 +1262,13 @@ NEOPreInit(ScrnInfoPtr pScrn, int flags)
VGAwGR(0x09,0x00);
nPtr->NeoLinearAddr = addr << 20;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"FB base address is set at 0x%X.\n",
"FB base address is set at 0x%lX.\n",
nPtr->NeoLinearAddr);
}
if (!nPtr->NeoMMIOAddr && !nPtr->noMMIO) {
nPtr->NeoMMIOAddr = nPtr->NeoLinearAddr + 0x100000;
xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
"MMIO base address is set at 0x%X.\n",
"MMIO base address is set at 0x%lX.\n",
nPtr->NeoMMIOAddr);
}
linearRes[0].rBegin = nPtr->NeoLinearAddr;
......@@ -1414,10 +1410,10 @@ NEOEnterVT(int scrnIndex, int flags)
/* Should we re-save the text mode on each VT enter? */
if(!neoModeInit(pScrn, pScrn->currentMode))
return FALSE;
#ifdef XvExtension
if (nPtr->video)
NEOResetVideo(pScrn);
#endif
if (nPtr->NeoHWCursorShown)
NeoShowCursor(pScrn);
NEOAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
......@@ -1661,7 +1657,6 @@ NEOScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86DrvMsg(pScrn->scrnIndex,X_INFO,
"Acceleration disabled when not using MMIO\n");
#ifdef XvExtension
if (nPtr->overlay > 0){
if (nPtr->overlay > freespace){
xf86DrvMsg(pScrn->scrnIndex,X_INFO,
......@@ -1676,7 +1671,7 @@ NEOScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv)
xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Overlay at 0x%x\n",
nPtr->overlay_offset);
}
#endif /* XvExtension */
nAcl->cacheStart = currentaddr - freespace;
nAcl->cacheEnd = currentaddr;
freespace = 0;
......@@ -1919,7 +1914,7 @@ NEOFreeScreen(int scrnIndex, int flags)
}
/* Optional */
static int
static ModeStatus
NEOValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags)
{
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
......@@ -2153,7 +2148,7 @@ neoSave(ScrnInfoPtr pScrn)
save->reg = (regSavePtr)xnfcalloc(sizeof(regSaveRec), 1);
else
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Non-NULL reg in NeoSave: reg=0x%08X\n", save->reg);
"Non-NULL reg in NeoSave: reg=%p\n", (void *)save->reg);
save->reg->CR[0x23] = VGArCR(0x23);
save->reg->CR[0x25] = VGArCR(0x25);
......@@ -2605,7 +2600,9 @@ neoRestore(ScrnInfoPtr pScrn, vgaRegPtr VgaReg, NeoRegPtr restore,
VGAwGR(i, restore->reg->GR[i]);
}
}
VGAwGR (0x93, 0xc0); /* Gives faster framebuffer writes */
/* Program vertical extension register */
if (nPtr->NeoChipset == NM2200 || nPtr->NeoChipset == NM2230
|| nPtr->NeoChipset == NM2360 || nPtr->NeoChipset == NM2380) {
......@@ -2893,7 +2890,6 @@ neoModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
}
}
#ifdef XvExtension
if (!noLcdStretch &&
(NeoNew->PanelDispCntlReg1 & 0x02)) {
if (mode->HDisplay != nPtr->NeoPanelWidth)
......@@ -2904,7 +2900,6 @@ neoModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
nPtr->videoHZoom = 1.0;
nPtr->videoVZoom = 1.0;
}
#endif
if (mode->VDisplay < 480) {
NeoStd->Sequencer[1] |= 0x8;
......@@ -2919,7 +2914,7 @@ neoModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode)
*/
if (NeoNew->reg) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"Non-NULL reg in NeoInit: reg=0x%08X\n", NeoNew->reg);
"Non-NULL reg in NeoInit: reg=%p\n", (void *)NeoNew->reg);
xfree(NeoNew->reg);
NeoNew->reg = NULL;
}
......@@ -3084,11 +3079,12 @@ neo_ddc1(int scrnIndex)
reg3 = VGArCR(0x1A);
VGAwCR(0x21,0x00);
VGAwCR(0x1D,0x01); /* some Voodoo */
VGAwGR(0xA1,0x2F);
VGAwGR(0x1A,0x2F);
ret = xf86DoEDID_DDC1(scrnIndex,vgaHWddc1SetSpeed,neo_ddc1Read);
/* undo initialization */
VGAwCR(0x21,reg1);
VGAwCR(0x1D,reg2);
VGAwGR(0x1A,reg3);
return ret;
}
......
......@@ -26,7 +26,7 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/*
* Copyright 2002 SuSE Linux AG, Author: Egbert Eich
*/
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.c,v 1.4 2002/11/25 14:05:00 eich Exp $ */
/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.c,v 1.7 2003/11/10 18:22:23 tsi Exp $ */
#include "neo.h"
#include "neo_video.h"
......@@ -34,8 +34,6 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define nElems(x) (sizeof(x) / sizeof(x[0]))
#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
#if defined(XvExtension)
#include "dixstruct.h"
#include "xaa.h"
#include "xaalocal.h"
......@@ -56,15 +54,11 @@ static int NEOPutImage(ScrnInfoPtr, short, short, short, short, short, short,
static int NEOQueryImageAttributes(ScrnInfoPtr, int, unsigned short *,
unsigned short *, int *, int *);
static Bool RegionsEqual(RegionPtr, RegionPtr);
static void NEODisplayVideo(ScrnInfoPtr, int, int, short, short, int, int,
int, int, int, BoxPtr, short, short, short, short);
static void NEOInitOffscreenImages(ScreenPtr);
static FBLinearPtr NEOAllocateMemory(ScrnInfoPtr, FBLinearPtr, int);
static void NEOCopyData(unsigned char *, unsigned char *, int, int, int, int);
static void NEOCopyYV12Data(unsigned char *, unsigned char *, unsigned char *,
unsigned char *, int, int, int, int, int);
static int NEOAllocSurface(ScrnInfoPtr, int, unsigned short, unsigned short,
XF86SurfacePtr);
......@@ -258,7 +252,7 @@ NEOSetupVideo(ScreenPtr pScreen)
pPriv->interlace = nPtr->interlace;
pPriv->videoStatus = 0;
pPriv->brightness = 0;
REGION_INIT(pScreen, &pPriv->clip, NullBox, 0);
REGION_NULL(pScreen, &pPriv->clip);
nPtr->overlayAdaptor = overlayAdaptor;
xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
......@@ -391,10 +385,9 @@ NEOPutVideo(ScrnInfoPtr pScrn,
WAIT_ENGINE_IDLE();
memset(nPtr->NeoFbBase + offset, 0, size);
if (!RegionsEqual(&pPriv->clip, clipBoxes)){
REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey,
clipBoxes);
if (!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)){
REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes);
xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes);
}
x1 >>= 16;
......@@ -706,18 +699,20 @@ NEOPutImage(ScrnInfoPtr pScrn,
offset2 += tmp;
offset3 += tmp;
nLines = ((((y2 + 0xFFFF) >> 16) + 1) & ~1) - top;
NEOCopyYV12Data(buf + (top * srcPitch) + (left >> 1), buf + offset2,
buf + offset3, dstStart, srcPitch, srcPitch2,
dstPitch, nLines, nPixels);
xf86XVCopyYUV12ToPacked(buf + (top * srcPitch) + (left >> 1),
buf + offset2, buf + offset3,
dstStart, srcPitch, srcPitch2,
dstPitch, nLines, nPixels);
break;
default:
buf += (top * srcPitch) + left;
nLines = ((y2 + 0xFFFF) >> 16) - top;
NEOCopyData(buf, dstStart, srcPitch, dstPitch, nLines, nPixels << 1);
xf86XVCopyPacked(buf, dstStart, srcPitch, dstPitch,
nLines, nPixels << 1);
}
if (!RegionsEqual(&pPriv->clip, clipBoxes)){
REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
if (!REGION_EQUAL(pScrn->pScreen, &pPriv->clip, clipBoxes)){
REGION_COPY(pScrn->pScreen, &pPriv->clip, clipBoxes);
xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes);
}
NEODisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1,
......@@ -787,37 +782,6 @@ NEOQueryImageAttributes(ScrnInfoPtr pScrn, int id,
return (size);
}
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.y1 != B->extents.y1)
|| (A->extents.x2 != B->extents.x2)
|| (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
NEODisplayVideo(ScrnInfoPtr pScrn, int id, int offset,
short width, short height, int pitch,
......@@ -1017,55 +981,12 @@ NEOAllocateMemory(ScrnInfoPtr pScrn, FBLinearPtr linear, int size)
return (new_linear);
}
static void
NEOCopyData(unsigned char *src, unsigned char *dst,
int srcPitch, int dstPitch,
int height, int width)
{
while (height-- > 0){
memcpy(dst, src, width);
src += srcPitch;
dst += dstPitch;
}
}
static void
NEOCopyYV12Data(unsigned char *src1, unsigned char *src2,
unsigned char *src3, unsigned char *dst,
int srcPitch1, int srcPitch2, int dstPitch,
int height, int width)
{
CARD32 *pDst = (CARD32 *) dst;
int i;
width >>= 1;
height >>= 1;
dstPitch >>= 2;
while (--height >= 0){
for (i =0; i < width; i++){
pDst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) |
(src3[i] << 8) | (src2[i] << 24);
}
pDst += dstPitch;
src1 += srcPitch1;
for (i =0; i < width; i++){
pDst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) |
(src3[i] << 8) | (src2[i] << 24);
}
pDst += dstPitch;
src1 += srcPitch1;
src2 += srcPitch2;
src3 += srcPitch2;
}
}
static int
NEOAllocSurface(ScrnInfoPtr pScrn, int id,
unsigned short width, unsigned short height,
XF86SurfacePtr surface)
{
int pitch, bpp, size;
int pitch, size;
NEOOffscreenPtr pPriv;
FBLinearPtr linear;
......@@ -1077,7 +998,6 @@ NEOAllocSurface(ScrnInfoPtr pScrn, int id,
}
width = (width + 1) & ~1;
bpp = ((pScrn->bitsPerPixel + 1) >> 3);
pitch = ((width << 1) + 15) & ~15;
size = pitch * height;
......@@ -1176,7 +1096,7 @@ NEODisplaySurface(XF86SurfacePtr surface,
pPriv->isOn = TRUE;
if (portPriv->videoStatus & CLIENT_VIDEO_ON){
REGION_EMPTY(pScrn->pScreen, &portPriv->clip);
REGION_EMPTY(surface->pScrn->pScreen, &portPriv->clip);
UpdateCurrentTime();
portPriv->videoStatus = FREE_TIMER;
portPriv->freeTime = currentTime.milliseconds + FREE_DELAY;
......@@ -1224,10 +1144,3 @@ NEOSetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attr, INT32 value)
return (NEOSetPortAttribute(pScrn,
attr, value, (pointer)nPtr->overlayAdaptor->pPortPrivates[0].ptr));
}
#else /* XvExtension */
void NEOInitVideo(ScreenPtr pScreen) {}
void NEOResetVideo(ScreenPtr pScreen) {}
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment