1 --- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile Wed Jan 24 01:06:21 2001
2 +++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile Thu Apr 4 16:05:44 2002
8 SRCS = neo_driver.c neo_bank.c neo_cursor.c neo_2097.c neo_2070.c \
9 - neo_2090.c neo_2200.c neo_i2c.c neo_shadow.c neo_dga.c
10 + neo_2090.c neo_2200.c neo_i2c.c neo_shadow.c neo_dga.c neo_video.c
12 OBJS = neo_driver.o neo_bank.o neo_cursor.o neo_2097.o neo_2070.o \
13 - neo_2090.o neo_2200.o neo_i2c.o neo_shadow.o neo_dga.o
14 + neo_2090.o neo_2200.o neo_i2c.o neo_shadow.o neo_dga.o neo_video.o
18 --- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/NM-reg.txt Thu Jan 1 01:00:00 1970
19 +++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/neomagic/NM-reg.txt Thu Apr 4 16:05:44 2002
21 +NM2160 Register GUESS
22 + --- Overlay and ZV capture ---
27 + GRB0 bit5 Format; 0:YUY2/1:RGB
29 + bit0 Enable overlay ; 1:enable/0:disable
30 + GRB1 bit7:4 X2[11:8]
34 + GRB4 bit7:4 Y2[11:8]
38 + GRB7 VRAM offset[24:17]
39 + GRB8 VRAM offset[16:9]
40 + GRB9 VRAM offset[8:1]
41 + GRBA Width in byte[15:8]
42 + GRBB Width in byte[7:0]
46 + GRBF bit2 0:normal/1:mirror
48 + GRC0 X scale[15:8] ; x1.0 == 0x1000
50 + GRC2 Y scale[15:8] ; x1.0 == 0x1000
52 + GRC4 brightness ; -128 to +127
54 + GRC6 Color key(G) / Color key(8bpp)
58 + GR0A bit5 Enable extended SR reg. ; 1:enable/0:disable
61 + SR08 bit7:1 b'1010000'
62 + bit0 Enable capture ; 1:enable/0:disable
66 + SR0C VRAM offset[8:1]
67 + SR0D VRAM offset[16:9]
68 + SR0E VRAM offset[24:17]
76 + SR16 bit7:4 Y2[11:4]
80 + SR19 bit7:4 X2[11:8]
82 + SR1A Width in byte[7:0]
83 + SR1B Width in byte[15:8]
89 +s.nomura@mba.nifty.ne.jp
90 --- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h Mon Oct 1 15:44:07 2001
91 +++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo.h Thu Apr 4 16:05:44 2002
99 +#endif /* XvExtension */
102 * Driver data structures.
106 Bool NEODGAInit(ScreenPtr pScreen);
108 +/* in neo_video.c */
109 +extern void NEOInitVideo(ScreenPtr pScreen);
110 +extern void NEOResetVideo(ScrnInfoPtr pScrn);
114 #define NEO_EXT_CR_MAX 0x85
116 unsigned long NeoMMIOAddr;
117 unsigned long NeoLinearAddr;
118 unsigned char* NeoMMIOBase;
119 + unsigned long NeoMMIOAddr2;
120 + unsigned char* NeoMMIOBase2;
121 unsigned char* NeoFbBase;
123 unsigned long vgaIOBase;
125 RefreshAreaFuncPtr refreshArea;
126 void (*PointerMoved)(int index, int x, int y);
133 + XF86VideoAdaptorPtr overlayAdaptor;
135 + int overlay_offset;
138 +#endif /* XvExtension */
142 @@ -264,18 +286,20 @@
145 /* vga IO functions */
146 -#define VGArCR(index) hwp->readCrtc(hwp,index)
147 -#define VGAwCR(index,val) hwp->writeCrtc(hwp,index,val)
148 -#define VGArGR(index) hwp->readGr(hwp,index)
149 -#define VGAwGR(index,val) hwp->writeGr(hwp,index,val)
150 +#define VGArCR(index) (*hwp->readCrtc)(hwp, index)
151 +#define VGAwCR(index, val) (*hwp->writeCrtc)(hwp, index, val)
152 +#define VGArGR(index) (*hwp->readGr)(hwp, index)
153 +#define VGAwGR(index, val) (*hwp->writeGr)(hwp, index, val)
154 +#define VGArSR(index) (*hwp->readSeq)(hwp, index)
155 +#define VGAwSR(index, val) (*hwp->writeSeq)(hwp, index, val)
157 /* memory mapped register access macros */
158 -#define INREG8(addr) MMIO_IN8(nPtr->NeoMMIOBase, (addr))
159 -#define INREG16(addr) MMIO_IN16(nPtr->NeoMMIOBase, (addr))
160 -#define INREG(addr) MMIO_IN32(nPtr->NeoMMIOBase, (addr))
161 -#define OUTREG8(addr, val) MMIO_OUT8(nPtr->NeoMMIOBase, (addr), (val))
162 -#define OUTREG16(addr, val) MMIO_OUT16(nPtr->NeoMMIOBase, (addr), (val))
163 -#define OUTREG(addr, val) MMIO_OUT32(nPtr->NeoMMIOBase, (addr), (val))
164 +#define INREG8(addr) MMIO_IN8(nPtr->NeoMMIOBase, addr)
165 +#define INREG16(addr) MMIO_IN16(nPtr->NeoMMIOBase, addr)
166 +#define INREG(addr) MMIO_IN32(nPtr->NeoMMIOBase, addr)
167 +#define OUTREG8(addr, val) MMIO_OUT8(nPtr->NeoMMIOBase, addr, val)
168 +#define OUTREG16(addr, val) MMIO_OUT16(nPtr->NeoMMIOBase, addr, val)
169 +#define OUTREG(addr, val) MMIO_OUT32(nPtr->NeoMMIOBase, addr, val)
171 /* This swizzle macro is to support the manipulation of cursor masks when
172 * the sprite moves off the left edge of the display. This code is
173 --- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2070.c Tue Sep 26 01:57:08 2000
174 +++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2070.c Thu Apr 4 16:05:44 2002
176 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
177 NEOPtr nPtr = NEOPTR(pScrn);
178 NEOACLPtr nAcl = NEOACLPTR(pScrn);
179 - BoxRec AvailFBArea;
182 nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec();
183 if(!infoPtr) return FALSE;
189 - /* Initialize for widths */
190 - nAcl->Pitch = pScrn->displayWidth * nAcl->PixelWidth;
191 - lines = nAcl->cacheEnd /
192 - (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3));
193 - if(lines > 1024) lines = 1024;
195 - AvailFBArea.x1 = 0;
196 - AvailFBArea.y1 = 0;
197 - AvailFBArea.x2 = pScrn->displayWidth;
198 - AvailFBArea.y2 = lines;
199 - xf86InitFBManager(pScreen, &AvailFBArea);
201 - xf86DrvMsg(pScrn->scrnIndex, X_INFO,
202 - "Using %i scanlines of offscreen memory for pixmap caching\n",
203 - lines - pScrn->virtualY);
206 return(XAAInit(pScreen, infoPtr));
209 --- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c Mon Oct 1 15:44:07 2001
210 +++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2090.c Thu Apr 4 16:05:44 2002
212 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
213 NEOPtr nPtr = NEOPTR(pScrn);
214 NEOACLPtr nAcl = NEOACLPTR(pScrn);
215 - BoxRec AvailFBArea;
218 nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec();
219 if(!infoPtr) return FALSE;
222 nAcl->BltCntlFlags |= NEO_BC3_FIFO_EN;
224 - lines = nAcl->cacheEnd /
225 - (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3));
226 - if(lines > 1024) lines = 1024;
228 - AvailFBArea.x1 = 0;
229 - AvailFBArea.y1 = 0;
230 - AvailFBArea.x2 = pScrn->displayWidth;
231 - AvailFBArea.y2 = lines;
232 - xf86InitFBManager(pScreen, &AvailFBArea);
234 - xf86DrvMsg(pScrn->scrnIndex, X_INFO,
235 - "Using %i scanlines of offscreen memory for pixmap caching\n",
236 - lines - pScrn->virtualY);
238 return(XAAInit(pScreen, infoPtr));
241 --- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c Mon Oct 1 15:44:07 2001
242 +++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2097.c Thu Apr 4 16:05:44 2002
244 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
245 NEOPtr nPtr = NEOPTR(pScrn);
246 NEOACLPtr nAcl = NEOACLPTR(pScrn);
248 - BoxRec AvailFBArea;
250 nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec();
251 if(!infoPtr) return FALSE;
257 - lines = nAcl->cacheEnd /
258 - (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3));
259 - if(lines > 1024) lines = 1024;
261 - AvailFBArea.x1 = 0;
262 - AvailFBArea.y1 = 0;
263 - AvailFBArea.x2 = pScrn->displayWidth;
264 - AvailFBArea.y2 = lines;
265 - xf86InitFBManager(pScreen, &AvailFBArea);
267 - xf86DrvMsg(pScrn->scrnIndex, X_INFO,
268 - "Using %i scanlines of offscreen memory for pixmap caching\n",
269 - lines - pScrn->virtualY);
272 return(XAAInit(pScreen, infoPtr));
275 --- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c Sun Oct 28 04:33:42 2001
276 +++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c Thu Apr 4 16:05:44 2002
278 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
279 NEOPtr nPtr = NEOPTR(pScrn);
280 NEOACLPtr nAcl = NEOACLPTR(pScrn);
281 - BoxRec AvailFBArea;
284 nPtr->AccelInfoRec = infoPtr = XAACreateInfoRec();
285 if(!infoPtr) return FALSE;
290 - lines = nAcl->cacheEnd /
291 - (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3));
292 - if(lines > 1024) lines = 1024;
294 - AvailFBArea.x1 = 0;
295 - AvailFBArea.y1 = 0;
296 - AvailFBArea.x2 = pScrn->displayWidth;
297 - AvailFBArea.y2 = lines;
298 - xf86InitFBManager(pScreen, &AvailFBArea);
300 - xf86DrvMsg(pScrn->scrnIndex, X_INFO,
301 - "Using %i scanlines of offscreen memory for pixmap caching\n",
302 - lines - pScrn->virtualY);
304 return(XAAInit(pScreen, infoPtr));
307 NEOPtr nPtr = NEOPTR(pScrn);
310 - OUTREG(NEOREG_DSTSTARTOFF, (y<<16) | (x & 0xffff));
311 + OUTREG(NEOREG_DSTSTARTOFF, (y <<16) | (x & 0xffff));
312 OUTREG(NEOREG_XYEXT, (h<<16) | (w & 0xffff));
315 --- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c Mon Oct 1 15:44:07 2001
316 +++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_dga.c Thu Apr 4 16:05:44 2002
318 static void NEO_SetViewport(ScrnInfoPtr, int, int, int);
319 static void NEO_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long);
320 static void NEO_BlitRect(ScrnInfoPtr, int, int, int, int, int, int);
322 static void NEO_BlitTransRect(ScrnInfoPtr, int, int, int, int, int, int,
327 DGAFunctionRec NEODGAFuncs = {
329 imlines = (pScrn->videoRam * 1024) /
330 (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3));
332 - pixlines = (imlines > 1024 && !pNEO->noAccel) ? 1024 : imlines;
333 + pixlines = (imlines > 1024 && !pNEO->noAccel) ? 1024 : imlines;
335 pMode = firstMode = pScrn->modes;
339 NEOPtr pNEO = NEOPTR(pScrn);
340 vgaHWPtr hwp = VGAHWPTR(pScrn);
343 NEOAdjustFrame(pScrn->pScreen->myNum, x, y, flags);
344 /* wait for retrace */
345 while((hwp->readST01(hwp) & 0x08));
356 /* this one should be separate since the XAA function would
357 prohibit usage of ~0 as the key */
364 --- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c Fri Nov 30 13:11:57 2001
365 +++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c Sat Apr 6 19:49:40 2002
367 OPTION_PROG_LCD_MODE_REGS,
368 OPTION_PROG_LCD_MODE_STRETCH,
369 OPTION_OVERRIDE_VALIDATE_MODE,
374 + OPTION_VIDEO_INTERLACE,
375 OPTION_DISPLAY_HEIGHT_480,
376 OPTION_STRANGE_LOCKUPS
379 { OPTION_LCD_STRETCH, "NoStretch", OPTV_BOOLEAN, {0}, FALSE },
380 { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
381 { OPTION_PCI_BURST, "pciBurst", OPTV_BOOLEAN, {0}, FALSE },
382 + { OPTION_SHOWCACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE },
383 { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE },
384 { OPTION_PROG_LCD_MODE_REGS, "progLcdModeRegs",
385 OPTV_BOOLEAN, {0}, FALSE },
387 OPTV_BOOLEAN, {0}, FALSE },
388 { OPTION_OVERRIDE_VALIDATE_MODE, "overrideValidateMode",
389 OPTV_BOOLEAN, {0}, FALSE },
390 + { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE },
391 + { OPTION_OVERLAYMEM, "OverlayMem", OPTV_INTEGER, {0}, FALSE },
392 + { OPTION_VIDEO_INTERLACE, "Interlace",
393 + OPTV_INTEGER, {0}, FALSE },
394 { -1, NULL, OPTV_NONE, {0}, FALSE }
398 { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE },
399 { OPTION_LCD_STRETCH,"NoStretch", OPTV_BOOLEAN, {0}, FALSE },
400 { OPTION_PCI_BURST, "pciBurst", OPTV_BOOLEAN, {0}, FALSE },
401 + { OPTION_SHOWCACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE },
402 { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE },
403 { OPTION_STRANGE_LOCKUPS, "StrangeLockups", OPTV_BOOLEAN, {0}, FALSE },
404 { OPTION_DISPLAY_HEIGHT_480, "DisplayHeight480",
406 OPTV_BOOLEAN, {0}, FALSE },
407 { OPTION_OVERRIDE_VALIDATE_MODE, "overrideValidateMode",
408 OPTV_BOOLEAN, {0}, FALSE },
409 + { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE },
410 + { OPTION_OVERLAYMEM, "OverlayMem", OPTV_INTEGER, {0}, FALSE },
411 + { OPTION_VIDEO_INTERLACE, "Interlace",
412 + OPTV_INTEGER, {0}, FALSE },
413 { -1, NULL, OPTV_NONE, {0}, FALSE }
417 xf86GetOptValBool(nPtr->Options, OPTION_LCD_CENTER,&nPtr->lcdCenter);
418 xf86GetOptValBool(nPtr->Options, OPTION_LCD_STRETCH,&nPtr->noLcdStretch);
419 xf86GetOptValBool(nPtr->Options, OPTION_SHADOW_FB,&nPtr->shadowFB);
420 + xf86GetOptValBool(nPtr->Options, OPTION_SHOWCACHE,&nPtr->showcache);
421 nPtr->onPciBurst = TRUE;
422 xf86GetOptValBool(nPtr->Options, OPTION_PCI_BURST,&nPtr->onPciBurst);
423 xf86GetOptValBool(nPtr->Options,
424 @@ -1014,6 +1037,39 @@
425 "Valid options are \"CW\" or \"CCW\"\n");
429 + if(xf86GetOptValInteger(nPtr->Options,
430 + OPTION_VIDEO_KEY, &(nPtr->videoKey))) {
431 + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n",
434 + nPtr->videoKey = (1 << pScrn->offset.red) |
435 + (1 << pScrn->offset.green) |
436 + (((pScrn->mask.blue >> pScrn->offset.blue) - 1)
437 + << pScrn->offset.blue);
439 + if(xf86GetOptValInteger(nPtr->Options, OPTION_OVERLAYMEM,
440 + &(nPtr->overlay))) {
441 + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
442 + "reserve %d bytes for overlay.\n", nPtr->overlay);
446 + nPtr->interlace = 0;
447 + if(xf86GetOptValInteger(nPtr->Options, OPTION_VIDEO_INTERLACE,
448 + &(nPtr->interlace))) {
449 + if (nPtr->interlace >= 0 && nPtr->interlace <= 2){
450 + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "interlace flag = %d\n",
453 + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,
454 + "\"%s\" is not a valid value for "
455 + "Option \"Interlaced\"\n", s);
456 + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Valid options are 0..2\n");
459 +#endif /* XvExtension */
462 if (height_480 && nPtr->NeoPanelWidth == 800) {
463 xf86DrvMsg(pScrn->scrnIndex,X_CONFIG,
464 @@ -1069,6 +1125,9 @@
465 if (nPtr->strangeLockups)
466 xf86DrvMsg(pScrn->scrnIndex,X_CONFIG,
467 "Option StrangeLockups set: disabling some acceleration\n");
468 + if (nPtr->showcache)
469 + xf86DrvMsg(pScrn->scrnIndex,X_CONFIG,
470 + "Show chache for debugging\n");
471 if (nPtr->shadowFB) {
472 if (nPtr->noLinear) {
473 xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
474 @@ -1096,6 +1155,8 @@
475 nPtr->NeoLinearAddr = 0;
478 + nPtr->NeoMMIOAddr2 = 0;
479 + nPtr->NeoMMIOBase2 = NULL;
480 if (nPtr->pEnt->device->IOBase && !nPtr->noMMIO) {
481 /* XXX Check this matches a PCI base address */
482 nPtr->NeoMMIOAddr = nPtr->pEnt->device->IOBase;
483 @@ -1113,7 +1174,7 @@
484 "FB base address is set at 0x%X.\n",
485 nPtr->NeoLinearAddr);
487 - if (!nPtr->NeoMMIOAddr) {
488 + if (!nPtr->NeoMMIOAddr && !nPtr->noMMIO) {
489 switch (nPtr->NeoChipset) {
491 nPtr->NeoMMIOAddr = nPtr->NeoLinearAddr + 0x100000;
492 @@ -1129,11 +1190,17 @@
495 nPtr->NeoMMIOAddr = nPtr->PciInfo->memBase[1];
496 + nPtr->NeoMMIOAddr2 = nPtr->PciInfo->memBase[2];
499 xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
500 "MMIO base address is set at 0x%X.\n",
502 + if (nPtr->NeoMMIOAddr2 != 0){
503 + xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
504 + "MMIO base address2 is set at 0x%X.\n",
505 + nPtr->NeoMMIOAddr2);
508 /* XXX What about VGA resources in OPERATING mode? */
509 if (xf86RegisterResources(nPtr->pEnt->index, NULL, ResExclusive))
510 @@ -1152,7 +1219,7 @@
511 "FB base address is set at 0x%X.\n",
512 nPtr->NeoLinearAddr);
514 - if (!nPtr->NeoMMIOAddr) {
515 + if (!nPtr->NeoMMIOAddr && !nPtr->noMMIO) {
516 nPtr->NeoMMIOAddr = nPtr->NeoLinearAddr + 0x100000;
517 xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
518 "MMIO base address is set at 0x%X.\n",
519 @@ -1293,6 +1360,10 @@
520 /* Should we re-save the text mode on each VT enter? */
521 if(!neoModeInit(pScrn, pScrn->currentMode))
525 + NEOResetVideo(pScrn);
527 if (nPtr->NeoHWCursorShown)
528 NeoShowCursor(pScrn);
529 NEOAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0);
530 @@ -1384,12 +1455,12 @@
531 /* Map the Neo memory and possible MMIO areas */
532 if (!neoMapMem(pScrn))
537 * next we save the current state and setup the first mode
542 if (!neoModeInit(pScrn,pScrn->currentMode))
544 vgaHWSaveScreen(pScreen,SCREEN_SAVER_ON);
545 @@ -1431,7 +1502,7 @@
546 nPtr->ShadowPtr = NULL;
547 FBStart = nPtr->NeoFbBase;
551 ret = fbScreenInit(pScreen, FBStart,
553 pScrn->xDpi, pScrn->yDpi,
554 @@ -1509,13 +1580,13 @@
555 nPtr->NeoLinearAddr);
556 /* Setup pointers to free space in video ram */
557 allocatebase = (pScrn->videoRam << 10);
558 - freespace = allocatebase - pScrn->displayWidth *
559 + freespace = allocatebase - pScrn->displayWidth *
560 pScrn->virtualY * (pScrn->bitsPerPixel >> 3);
561 currentaddr = allocatebase;
562 xf86DrvMsg(scrnIndex, X_PROBED,
563 "%d bytes off-screen memory available\n", freespace);
565 - if (nPtr->swCursor || nPtr->noMMIO) {
566 + if (nPtr->swCursor || !nPtr->NeoMMIOBase) {
567 xf86DrvMsg(scrnIndex, X_CONFIG,
568 "Using Software Cursor.\n");
569 } else if (nPtr->NeoCursorMem <= freespace) {
570 @@ -1530,19 +1601,52 @@
571 } else xf86DrvMsg(scrnIndex, X_ERROR,
572 "Too little space for H/W cursor.\n");
574 - if (!nPtr->noAccel && nPtr->noMMIO)
575 + if (!nPtr->noAccel && !nPtr->NeoMMIOBase)
576 xf86DrvMsg(pScrn->scrnIndex,X_INFO,
577 "Acceleration disabled when not using MMIO\n");
579 - /* Setup the acceleration primitives */
580 - if (!nPtr->noAccel && !nPtr->noMMIO) {
583 + if (nPtr->overlay > 0){
584 + if (nPtr->overlay > freespace){
585 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,
586 + "Can not reserve %d bytes for overlay. "
587 + "Resize to %d bytes.\n",
588 + nPtr->overlay, freespace);
589 + nPtr->overlay = freespace;
591 + currentaddr -= nPtr->overlay;
592 + freespace -= nPtr->overlay;
593 + nPtr->overlay_offset = currentaddr;
594 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Overlay at 0x%x\n",
595 + nPtr->overlay_offset);
597 +#endif /* XvExtension */
598 nAcl->cacheStart = currentaddr - freespace;
599 nAcl->cacheEnd = currentaddr;
601 + if (nAcl->cacheStart < nAcl->cacheEnd) {
602 + BoxRec AvailFBArea;
603 + int lines = nAcl->cacheEnd /
604 + (pScrn->displayWidth * (pScrn->bitsPerPixel >> 3));
605 + if (!nPtr->noAccel && nPtr->NeoMMIOBase && lines > 1024)
607 + AvailFBArea.x1 = 0;
608 + AvailFBArea.y1 = 0;
609 + AvailFBArea.x2 = pScrn->displayWidth;
610 + AvailFBArea.y2 = lines;
611 + xf86InitFBManager(pScreen, &AvailFBArea);
613 + xf86DrvMsg(pScrn->scrnIndex, X_INFO,
614 + "Using %i scanlines of offscreen memory \n"
615 + , lines - pScrn->virtualY);
618 + /* Setup the acceleration primitives */
619 + if (!nPtr->noAccel && nPtr->NeoMMIOBase) {
620 if (nAcl->cacheStart >= nAcl->cacheEnd) {
621 xf86DrvMsg(scrnIndex, X_ERROR,
622 "Too little space for pixmap cache.\n");
625 switch(nPtr->NeoChipset) {
627 Neo2070AccelInit(pScreen);
628 @@ -1624,6 +1728,8 @@
630 pScrn->racIoFlags = pScrn->racMemFlags = racflag;
632 + NEOInitVideo(pScreen);
634 pScreen->SaveScreen = vgaHWSaveScreen;
636 /* Setup DPMS mode */
637 @@ -1635,18 +1741,7 @@
638 pScrn->memPhysBase = (unsigned long)nPtr->NeoFbBase;
644 - XF86VideoAdaptorPtr *ptr;
647 - n = xf86XVListGenericAdaptors(pScrn,&ptr);
649 - xf86XVScreenInit(pScreen, ptr, n);
654 /* Wrap the current CloseScreen function */
655 nPtr->CloseScreen = pScreen->CloseScreen;
656 pScreen->CloseScreen = NEOCloseScreen;
657 @@ -1677,11 +1772,21 @@
660 pScrn = xf86Screens[scrnIndex];
661 - Base = (y * pScrn->displayWidth + x) >> 2;
662 hwp = VGAHWPTR(pScrn);
663 nPtr = NEOPTR(pScrn);
664 - /* Scale Base by the number of bytes per pixel. */
666 + if (nPtr->showcache && y) {
667 + int lastline = nPtr->NeoFbMapSize /
668 + ((pScrn->displayWidth * pScrn->bitsPerPixel) / 8);
670 + lastline -= pScrn->currentMode->VDisplay;
671 + y += pScrn->virtualY - 1;
672 + if (y > lastline) y = lastline;
675 + Base = (y * pScrn->displayWidth + x) >> 2;
677 + /* Scale Base by the number of bytes per pixel. */
678 switch (pScrn->depth) {
681 @@ -1730,6 +1835,7 @@
682 if (nPtr->NeoHWCursorShown)
683 NeoHideCursor(pScrn);
684 neoRestore(pScrn, &(VGAHWPTR(pScrn))->SavedReg, &nPtr->NeoSavedReg, TRUE);
689 @@ -1845,12 +1951,18 @@
691 if (!nPtr->noLinear) {
693 - if (nPtr->pEnt->location.type == BUS_PCI)
694 + if (nPtr->pEnt->location.type == BUS_PCI){
696 xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
697 nPtr->PciTag, nPtr->NeoMMIOAddr,
700 + if (nPtr->NeoMMIOAddr2 != 0){
701 + nPtr->NeoMMIOBase2 =
702 + xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO,
703 + nPtr->PciTag, nPtr->NeoMMIOAddr2,
708 xf86MapVidMem(pScrn->scrnIndex,
709 VIDMEM_MMIO, nPtr->NeoMMIOAddr,
710 @@ -1889,8 +2001,14 @@
711 NEOPtr nPtr = NEOPTR(pScrn);
713 if (!nPtr->noLinear) {
714 - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)nPtr->NeoMMIOBase, 0x200000L);
715 + if (nPtr->NeoMMIOBase)
716 + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)nPtr->NeoMMIOBase,
718 nPtr->NeoMMIOBase = NULL;
719 + if (nPtr->NeoMMIOBase2)
720 + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)nPtr->NeoMMIOBase2,
722 + nPtr->NeoMMIOBase2 = NULL;
723 xf86UnMapVidMem(pScrn->scrnIndex, (pointer)nPtr->NeoFbBase,
726 @@ -2200,7 +2318,7 @@
729 Bool clock_hi = FALSE;
732 vgaHWProtect(pScrn,TRUE); /* Blank the screen */
735 @@ -2220,6 +2338,7 @@
740 switch (nPtr->NeoChipset) {
742 temp &= 0xF0; /* Save bits 7:4 */
743 @@ -2238,6 +2357,7 @@
749 * In some rare cases a lockup might occur if we don't delay
750 * here. (Reported by Miles Lane)
751 @@ -2256,7 +2376,6 @@
752 * had time to take effect.
757 * This function handles restoring the generic VGA registers. */
758 vgaHWRestore(pScrn, VgaReg,
759 @@ -2273,6 +2392,7 @@
760 VGAwGR(0x11, restore->SysIfaceCntl2);
761 VGAwGR(0x15, restore->SingleAddrPage);
762 VGAwGR(0x16, restore->DualAddrPage);
765 switch (nPtr->NeoChipset) {
767 @@ -2349,7 +2469,7 @@
769 if (restore->biosMode)
770 VGAwCR(0x23,restore->biosMode);
774 VGAwCR(0x23,restore->reg->CR[0x23]);
775 VGAwCR(0x25,restore->reg->CR[0x25]);
776 @@ -2371,13 +2491,13 @@
777 VGAwGR(i, restore->reg->GR[i]);
781 /* Program vertical extension register */
782 if (nPtr->NeoChipset == NM2200 || nPtr->NeoChipset == NM2230
783 || nPtr->NeoChipset == NM2360 || nPtr->NeoChipset == NM2380) {
784 VGAwCR(0x70, restore->VerticalExt);
789 vgaHWProtect(pScrn, FALSE); /* Turn on screen */
792 @@ -2574,7 +2694,7 @@
793 NeoNew->PanelHorizCenterReg3 = 0x00;
794 NeoNew->PanelHorizCenterReg4 = 0x00;
795 NeoNew->PanelHorizCenterReg5 = 0x00;
798 if (nPtr->lcdCenter &&
799 (NeoNew->PanelDispCntlReg1 & 0x02)) {
800 if (mode->HDisplay == nPtr->NeoPanelWidth) {
801 @@ -2632,6 +2752,18 @@
806 + if (!noLcdStretch) {
807 + if (mode->HDisplay != nPtr->NeoPanelWidth)
808 + nPtr->videoHZoom = (double)nPtr->NeoPanelWidth/mode->HDisplay;
809 + if (mode->VDisplay != nPtr->NeoPanelHeight)
810 + nPtr->videoVZoom = (double)nPtr->NeoPanelHeight/mode->VDisplay;
812 + nPtr->videoHZoom = 1.0;
813 + nPtr->videoVZoom = 1.0;
817 NeoNew->biosMode = neoFindMode(mode->HDisplay,mode->VDisplay,pScrn->depth);
820 @@ -2764,9 +2896,8 @@
823 /* Turn the screen on/off */
825 - SEQ01 |= inb(0x3C5) & ~0x20;
826 - outb(0x3C5, SEQ01);
827 + SEQ01 |= VGArSR(0x01) & ~0x20;
828 + VGAwSR(0x01, SEQ01);
830 /* Turn the LCD on/off */
831 LCD_on |= VGArGR(0x20) & ~0x02;
832 --- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.c Thu Jan 1 01:00:00 1970
833 +++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.c Thu Apr 4 16:05:44 2002
835 +/**********************************************************************
836 +Copyright 2002 by Shigehiro Nomura.
838 + All Rights Reserved
840 +Permission to use, copy, modify, distribute, and sell this software and
841 +its documentation for any purpose is hereby granted without fee,
842 +provided that the above copyright notice appear in all copies and that
843 +both that copyright notice and this permission notice appear in
844 +supporting documentation, and that the name of Shigehiro Nomura not be
845 +used in advertising or publicity pertaining to distribution of the
846 +software without specific, written prior permission. Shigehiro Nomura
847 +and its suppliers make no representations about the suitability of this
848 +software for any purpose. It is provided "as is" without express or
851 +SHIGEHIRO NOMURA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
852 +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
853 +EVENT SHALL SHIGEHIRO NOMURA AND/OR ITS SUPPLIERS BE LIABLE FOR ANY
854 +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
855 +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
856 +CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
857 +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
858 +**********************************************************************/
861 + * Copyright 2002 SuSE Linux AG, Author: Egbert Eich
865 +#include "neo_video.h"
867 +#define nElems(x) (sizeof(x) / sizeof(x[0]))
868 +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE)
870 +#if defined(XvExtension)
872 +#include "dixstruct.h"
874 +#include "xaalocal.h"
876 +static XF86VideoAdaptorPtr NEOSetupVideo(ScreenPtr);
878 +static int NEOPutVideo(ScrnInfoPtr, short, short, short, short,
879 + short, short, short, short, RegionPtr, pointer);
881 +static void NEOStopVideo(ScrnInfoPtr, pointer, Bool);
882 +static int NEOSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer);
883 +static int NEOGetPortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer);
884 +static void NEOQueryBestSize(ScrnInfoPtr, Bool, short, short, short,
885 + short, unsigned int *, unsigned int *, pointer);
886 +static int NEOPutImage(ScrnInfoPtr, short, short, short, short, short, short,
887 + short, short, int, unsigned char *, short, short, Bool,
888 + RegionPtr, pointer);
889 +static int NEOQueryImageAttributes(ScrnInfoPtr, int, unsigned short *,
890 + unsigned short *, int *, int *);
892 +static Bool RegionsEqual(RegionPtr, RegionPtr);
893 +static void NEODisplayVideo(ScrnInfoPtr, int, int, short, short, int, int,
894 + int, int, int, BoxPtr, short, short, short, short);
896 +static void NEOInitOffscreenImages(ScreenPtr);
897 +static FBLinearPtr NEOAllocateMemory(ScrnInfoPtr, FBLinearPtr, int);
898 +static void NEOCopyData(unsigned char *, unsigned char *, int, int, int, int);
899 +static void NEOCopyYV12Data(unsigned char *, unsigned char *, unsigned char *,
900 + unsigned char *, int, int, int, int, int);
902 +static int NEOAllocSurface(ScrnInfoPtr, int, unsigned short, unsigned short,
904 +static int NEOFreeSurface(XF86SurfacePtr);
905 +static int NEODisplaySurface(XF86SurfacePtr, short, short, short, short,
906 + short, short, short, short, RegionPtr clipBoxes);
907 +static int NEOStopSurface(XF86SurfacePtr);
908 +static int NEOGetSurfaceAttribute(ScrnInfoPtr, Atom, INT32 *);
909 +static int NEOSetSurfaceAttribute(ScrnInfoPtr, Atom, INT32);
911 +static Atom xvColorKey, xvBrightness, xvInterlace;
914 +NEOInitVideo(ScreenPtr pScreen)
916 + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
917 + NEOPtr nPtr = NEOPTR(pScrn);
918 + XF86VideoAdaptorPtr *overlayAdaptors, *newAdaptors = NULL;
919 + XF86VideoAdaptorPtr newAdaptor = NULL;
922 + numAdaptors = xf86XVListGenericAdaptors(pScrn, &overlayAdaptors);
924 + if (nPtr->NeoChipset >= NM2160
926 + && nPtr->NeoMMIOBase2 != NULL){
927 + nPtr->video = TRUE;
928 + newAdaptor = NEOSetupVideo(pScreen);
929 + NEOInitOffscreenImages(pScreen);
931 + nPtr->video = FALSE;
936 + overlayAdaptors = &newAdaptor;
938 + newAdaptors = xalloc((numAdaptors + 1)
939 + * sizeof(XF86VideoAdaptorPtr*));
941 + memcpy(newAdaptors, overlayAdaptors,
942 + numAdaptors * sizeof(XF86VideoAdaptorPtr));
943 + newAdaptors[numAdaptors++] = newAdaptor;
944 + overlayAdaptors = newAdaptors;
950 + xf86XVScreenInit(pScreen, overlayAdaptors, numAdaptors);
953 + xfree(newAdaptors);
956 +static XF86VideoEncodingRec NEOVideoEncodings[] =
972 +static XF86VideoFormatRec NEOVideoFormats[] =
974 + { 8, PseudoColor },
980 +static XF86AttributeRec NEOVideoAttributes[] =
983 + XvSettable | XvGettable,
984 + 0x000000, 0xFFFFFF,
988 + XvSettable | XvGettable,
993 + XvSettable | XvGettable,
999 +static XF86ImageRec NEOVideoImages[] =
1008 + { 'R', 'V' ,'1', '5',
1009 + 0x00,'5',0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
1013 + 15, 0x001F, 0x03E0, 0x7C00,
1017 + { 'R', 'V', 'B' },
1024 + { 'R', 'V' ,'1', '6',
1025 + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
1029 + 16, 0x001F, 0x07E0, 0xF800,
1033 + { 'R', 'V', 'B' },
1038 +static XF86VideoAdaptorPtr
1039 +NEOSetupVideo(ScreenPtr pScreen)
1041 + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
1042 + NEOPtr nPtr = NEOPTR(pScrn);
1044 + XF86VideoAdaptorPtr overlayAdaptor;
1048 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOSetupVideo\n");
1050 + if ((overlayAdaptor = xcalloc(1, sizeof(XF86VideoAdaptorRec) +
1051 + sizeof(DevUnion) +
1052 + sizeof(NEOPortRec))) == NULL){
1056 + overlayAdaptor->type = XvInputMask | XvImageMask | XvWindowMask
1057 + | XvOutputMask | XvVideoMask;
1058 + overlayAdaptor->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
1059 + overlayAdaptor->name = "NeoMagic Video Engine";
1060 + overlayAdaptor->nEncodings = nElems(NEOVideoEncodings);
1061 + overlayAdaptor->pEncodings = NEOVideoEncodings;
1062 + for (i = 0; i < nElems(NEOVideoEncodings); i++){
1063 + NEOVideoEncodings[i].width = 1024;
1064 + NEOVideoEncodings[i].height = 1024;
1066 + overlayAdaptor->nFormats = nElems(NEOVideoFormats);
1067 + overlayAdaptor->pFormats = NEOVideoFormats;
1068 + overlayAdaptor->nPorts = 1;
1069 + overlayAdaptor->pPortPrivates = (DevUnion*) &overlayAdaptor[1];
1070 + overlayAdaptor->pPortPrivates[0].ptr =
1071 + (pointer) &overlayAdaptor->pPortPrivates[1];
1072 + overlayAdaptor->nAttributes = nElems(NEOVideoAttributes);
1073 + overlayAdaptor->pAttributes = NEOVideoAttributes;
1074 + overlayAdaptor->nImages = nElems(NEOVideoImages);
1075 + overlayAdaptor->pImages = NEOVideoImages;
1077 + overlayAdaptor->PutVideo = NEOPutVideo;
1078 + overlayAdaptor->PutStill = NULL;
1079 + overlayAdaptor->GetVideo = NULL;
1080 + overlayAdaptor->GetStill = NULL;
1082 + overlayAdaptor->StopVideo = NEOStopVideo;
1083 + overlayAdaptor->SetPortAttribute = NEOSetPortAttribute;
1084 + overlayAdaptor->GetPortAttribute = NEOGetPortAttribute;
1085 + overlayAdaptor->QueryBestSize = NEOQueryBestSize;
1086 + overlayAdaptor->PutImage = NEOPutImage;
1087 + overlayAdaptor->QueryImageAttributes = NEOQueryImageAttributes;
1089 + pPriv = (NEOPortPtr)overlayAdaptor->pPortPrivates[0].ptr;
1090 + pPriv->colorKey = nPtr->videoKey;
1091 + pPriv->interlace = nPtr->interlace;
1092 + pPriv->videoStatus = 0;
1093 + pPriv->brightness = 0;
1094 + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0);
1095 + nPtr->overlayAdaptor = overlayAdaptor;
1097 + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS");
1098 + xvColorKey = MAKE_ATOM("XV_COLORKEY");
1099 + xvInterlace = MAKE_ATOM("XV_INTERLACE");
1101 + NEOResetVideo(pScrn);
1103 + return (overlayAdaptor);
1107 +NEOResetVideo(ScrnInfoPtr pScrn)
1109 + NEOPtr nPtr = NEOPTR(pScrn);
1110 + NEOPortPtr pPriv = (NEOPortPtr)nPtr->overlayAdaptor->pPortPrivates[0].ptr;
1115 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOResetVideo\n");
1117 + switch (pScrn->depth){
1119 + OUTGR(0xc6, pPriv->colorKey & 0);
1120 + OUTGR(0xc5, pPriv->colorKey & 0xff);
1121 + OUTGR(0xc7, pPriv->colorKey & 0);
1124 + r = (pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red;
1125 + g = (pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green;
1126 + b = (pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue;
1132 + OUTGR(0xc4, pPriv->brightness);
1136 +NEOPutVideo(ScrnInfoPtr pScrn,
1137 + short src_x, short src_y, short drw_x, short drw_y,
1138 + short src_w, short src_h, short drw_w, short drw_h,
1139 + RegionPtr clipBoxes, pointer data)
1141 + NEOPortPtr pPriv = (NEOPortPtr)data;
1142 + NEOPtr nPtr = NEOPTR(pScrn);
1143 + CARD32 src_pitch, offset;
1144 + int xscale, yscale;
1146 + INT32 x1, y1, x2, y2;
1148 + unsigned char capctrl;
1152 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutVideo: src: %d %d %d %d\n",
1153 + src_x, src_y, src_w, src_h);
1154 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutVideo: drw: %d %d %d %d\n",
1155 + drw_x, drw_y, drw_w, drw_h);
1161 + if (pPriv->interlace != 2)
1165 + x2 = src_x + src_w;
1166 + y2 = src_y + src_h;
1168 + dstBox.x1 = drw_x;
1169 + dstBox.y1 = drw_y;
1170 + dstBox.x2 = drw_x + drw_w;
1171 + dstBox.y2 = drw_y + drw_h;
1173 + if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2,
1174 + clipBoxes, src_w, src_h)){
1178 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutVideo: %d %d %d %d\n",
1182 + dstBox.x1 -= pScrn->frameX0;
1183 + dstBox.y1 -= pScrn->frameY0;
1184 + dstBox.x2 -= pScrn->frameX0;
1185 + dstBox.y2 -= pScrn->frameY0;
1187 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutVideo: dstBox %d %d %d %d\n",
1188 + dstBox.x1, dstBox.y1, dstBox.x2, dstBox.y2);
1191 + bpp = (pScrn->bitsPerPixel + 1) >> 3;
1192 + src_pitch = (src_w + 7) & ~7;
1195 + if (src_w <= drw_w){
1196 + xscale = (src_w * 0x1000 / drw_w) & 0xffff;
1200 + if (src_h <= drw_h){
1201 + yscale = (src_h * 0x1000 / drw_h) & 0xffff;
1204 + size = src_h * src_pitch * 2;
1206 + if (size > nPtr->overlay){
1207 + if ((pPriv->linear = NEOAllocateMemory(pScrn, pPriv->linear, size))
1209 + return (BadAlloc);
1212 + pPriv->linear = NULL;
1215 + if (pPriv->linear == NULL){
1216 + offset = nPtr->overlay_offset;
1218 + offset = pPriv->linear->offset * bpp;
1222 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutVideo: offset=0x%x\n", offset);
1224 + WAIT_ENGINE_IDLE();
1225 + memset(nPtr->NeoFbBase + offset, 0, size);
1227 + if (!RegionsEqual(&pPriv->clip, clipBoxes)){
1228 + REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
1229 + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey,
1238 + switch (nPtr->NeoChipset) {
1242 + OUTGR(0xbc, 0x4f);
1248 + OUTGR(0xbc, 0x2e);
1253 + OUTGR(0xb1, (((dstBox.x2-1) >> 4) & 0xf0) | ((dstBox.x1 >> 8) & 0x0f));
1254 + OUTGR(0xb2, dstBox.x1);
1255 + OUTGR(0xb3, dstBox.x2 - 1);
1256 + OUTGR(0xb4, (((dstBox.y2 - 1) >> 4) & 0xf0) | ((dstBox.y1 >> 8) & 0x0f));
1257 + OUTGR(0xb5, dstBox.y1);
1258 + OUTGR(0xb6, dstBox.y2 - 1);
1259 + OUTGR(0xb7, offset >> 16);
1260 + OUTGR(0xb8, offset >> 8);
1261 + OUTGR(0xb9, offset );
1262 + OUTGR(0xba, src_pitch >> 8);
1263 + OUTGR(0xbb, src_pitch);
1265 + OUTGR(0xc0, xscale >> 8);
1266 + OUTGR(0xc1, xscale);
1267 + OUTGR(0xc2, yscale >> 8);
1268 + OUTGR(0xc3, yscale);
1269 + OUTGR(0xbf, 0x02);
1271 + OUTGR(0x0a, 0x21);
1273 + OUTSR(0x0c, offset );
1274 + OUTSR(0x0d, offset >> 8);
1275 + OUTSR(0x0e, offset >> 16);
1276 + OUTSR(0x1a, src_pitch);
1277 + OUTSR(0x1b, src_pitch>>8);
1279 + OUTSR(0x17, 0 + x1);
1280 + OUTSR(0x18, 0 + x2 -1);
1281 + OUTSR(0x19, (((0 + x2 - 1) >> 4) & 0xf0) | (((0 + x1) >> 8) & 0x0f));
1283 + OUTSR(0x14, 14 + y1);
1284 + OUTSR(0x15, 14 + y2 - 2);
1285 + OUTSR(0x16, (((14 + y2 - 1) >> 4) & 0xf0) | (((14 + y1) >> 8) & 0x0f));
1287 + OUTSR(0x1c, 0xfb);
1288 + OUTSR(0x1d, 0x00);
1289 + OUTSR(0x1e, 0xe2);
1290 + OUTSR(0x1f, 0x02);
1292 + OUTSR(0x09, 0x11);
1293 + OUTSR(0x0a, 0x00);
1296 + switch (pPriv->interlace){
1297 + case 0: /* Combine 2 fields */
1299 + case 1: /* one field only */
1302 + case 2: /* Interlaced fields */
1306 + OUTSR(0x08, capctrl);
1309 + OUTGR(0x0a, 0x01);
1311 + OUTGR(0xb0, 0x03);
1313 + pPriv->videoStatus = CLIENT_VIDEO_ON;
1318 +NEOStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit)
1320 + NEOPortPtr pPriv = (NEOPortPtr)data;
1321 + NEOPtr nPtr = NEOPTR(pScrn);
1325 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOStopVideo\n");
1327 + REGION_EMPTY(pScrn->pScreen, &pPriv->clip);
1330 + if (pPriv->videoStatus & CLIENT_VIDEO_ON){
1332 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOStopVideo: stop capture\n");
1334 + OUTGR(0xb0, 0x02);
1335 + OUTGR(0x0a, 0x21);
1336 + OUTSR(0x08, 0xa0);
1338 + OUTGR(0x0a, 0x01);
1341 + if (pPriv->linear != NULL){
1342 + xf86FreeOffscreenLinear(pPriv->linear);
1343 + pPriv->linear = NULL;
1345 + pPriv->videoStatus = 0;
1347 + if (pPriv->videoStatus & CLIENT_VIDEO_ON){
1348 + OUTGR(0xb0, 0x02);
1349 + OUTGR(0x0a, 0x21);
1350 + OUTSR(0x08, 0xa0);
1352 + OUTGR(0x0a, 0x01);
1354 + pPriv->videoStatus |= OFF_TIMER;
1355 + pPriv->offTime = currentTime.milliseconds + OFF_DELAY;
1361 +NEOSetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value,
1364 + NEOPortPtr pPriv = (NEOPortPtr)data;
1365 + NEOPtr nPtr = NEOPTR(pScrn);
1369 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOSetPortAttribute\n");
1371 + if (attribute == xvColorKey){
1374 + pPriv->colorKey = value;
1375 + switch (pScrn->depth){
1377 + OUTGR(0xc6, pPriv->colorKey & 0xff);
1378 + OUTGR(0xc5, 0x00);
1379 + OUTGR(0xc7, 0x00);
1382 + r = (pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red;
1383 + g = (pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green;
1384 + b = (pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue;
1389 + } else if (attribute == xvBrightness){
1390 + if ((value < -128) || (value > 127)){
1391 + return (BadValue);
1393 + pPriv->brightness = value;
1394 + OUTGR(0xc4, value);
1395 + } else if (attribute == xvInterlace){
1396 + if (value < 0 || value > 2){
1397 + return (BadValue);
1399 + pPriv->interlace = value;
1401 + return (BadMatch);
1407 +NEOGetPortAttribute(ScrnInfoPtr pScrn, Atom attribute, INT32 *value,
1410 + NEOPortPtr pPriv = (NEOPortPtr)data;
1413 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOGetPortAttribute\n");
1415 + if (attribute == xvColorKey){
1416 + *value = pPriv->colorKey;
1417 + } else if (attribute == xvBrightness){
1418 + *value = pPriv->brightness;
1419 + } else if (attribute == xvInterlace){
1420 + *value = pPriv->interlace;
1422 + return (BadMatch);
1428 +NEOQueryBestSize(ScrnInfoPtr pScrn, Bool motion,
1429 + short vid_w, short vid_h, short drw_w, short drw_h,
1430 + unsigned int *p_w, unsigned int *p_h,
1434 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOQueryBestSize\n");
1436 + *p_w = min(drw_w, 1024);
1437 + *p_h = min(drw_h, 1024);
1441 +NEOPutImage(ScrnInfoPtr pScrn,
1442 + short src_x, short src_y, short drw_x, short drw_y,
1443 + short src_w, short src_h, short drw_w, short drw_h,
1444 + int id, unsigned char *buf, short width, short height,
1445 + Bool sync, RegionPtr clipBoxes, pointer data)
1447 + NEOPtr nPtr = NEOPTR(pScrn);
1448 + NEOPortPtr pPriv = (NEOPortPtr)nPtr->overlayAdaptor->pPortPrivates[0].ptr;
1449 + INT32 x1, y1, x2, y2;
1451 + int srcPitch, srcPitch2 = 0, dstPitch, size;
1453 + CARD32 offset, offset2 = 0, offset3 = 0, tmp;
1454 + int left, top, nPixels, nLines;
1455 + unsigned char *dstStart;
1458 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOPutImage\n");
1463 + x2 = src_x + src_w;
1464 + y2 = src_y + src_h;
1466 + dstBox.x1 = drw_x;
1467 + dstBox.y1 = drw_y;
1468 + dstBox.x2 = drw_x + drw_w;
1469 + dstBox.y2 = drw_y + drw_h;
1471 + if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2,
1472 + clipBoxes, width, height)){
1476 + dstBox.x1 -= pScrn->frameX0;
1477 + dstBox.y1 -= pScrn->frameY0;
1478 + dstBox.x2 -= pScrn->frameX0;
1479 + dstBox.y2 -= pScrn->frameY0;
1481 + bpp = ((pScrn->bitsPerPixel + 1) >> 3);
1485 + srcPitch = (width + 3) & ~3;
1486 + offset2 = srcPitch * height;
1487 + srcPitch2 = ((width >> 1) + 3) & ~3;
1488 + offset3 = offset2 + (srcPitch2 * (height >> 1));
1489 + dstPitch = ((width << 1) + 15) & ~15;
1492 + srcPitch = (width + 3) & ~3;
1493 + offset3 = srcPitch * height;
1494 + srcPitch2 = ((width >> 1) + 3) & ~3;
1495 + offset2 = offset3 + (srcPitch2 * (height >> 1));
1496 + dstPitch = ((width << 1) + 15) & ~15;
1502 + srcPitch = width << 1;
1503 + dstPitch = (srcPitch + 15) & ~15;
1507 + size = dstPitch * height;
1508 + if (size > nPtr->overlay){
1509 + if ((pPriv->linear = NEOAllocateMemory(pScrn, pPriv->linear, size))
1511 + return (BadAlloc);
1514 + pPriv->linear = NULL;
1518 + left = (x1 >> 16) & ~1;
1519 + nPixels = ((((x2 + 0xFFFF) >> 16) + 1) & ~1) - left;
1522 + if (pPriv->linear == NULL){
1523 + offset = nPtr->overlay_offset;
1525 + offset = pPriv->linear->offset * bpp;
1529 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"offset=%x\n", offset);
1532 + dstStart = (unsigned char *)(nPtr->NeoFbBase + offset + left);
1538 + tmp = ((top >> 1) * srcPitch2) + (left >> 2);
1541 + nLines = ((((y2 + 0xFFFF) >> 16) + 1) & ~1) - top;
1542 + NEOCopyYV12Data(buf + (top * srcPitch) + (left >> 1), buf + offset2,
1543 + buf + offset3, dstStart, srcPitch, srcPitch2,
1544 + dstPitch, nLines, nPixels);
1547 + buf += (top * srcPitch) + left;
1548 + nLines = ((y2 + 0xFFFF) >> 16) - top;
1549 + NEOCopyData(buf, dstStart, srcPitch, dstPitch, nLines, nPixels << 1);
1552 + if (!RegionsEqual(&pPriv->clip, clipBoxes)){
1553 + REGION_COPY(pScreen, &pPriv->clip, clipBoxes);
1554 + xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes);
1556 + NEODisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1,
1557 + x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
1559 + pPriv->videoStatus = CLIENT_VIDEO_ON;
1565 +NEOQueryImageAttributes(ScrnInfoPtr pScrn, int id,
1566 + unsigned short *width, unsigned short *height,
1567 + int *pitches, int *offsets)
1572 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOQueryImageAttributes\n");
1574 + if (*width > 1024){
1577 + if (*height > 1024){
1581 + *width = (*width + 1) & ~1;
1582 + if (offsets != NULL){
1589 + *height = (*height + 1) & ~1;
1590 + size = (*width + 3) & ~3;
1591 + if (pitches != NULL){
1592 + pitches[0] = size;
1595 + if (offsets != NULL){
1596 + offsets[1] = size;
1598 + tmp = ((*width >> 1) + 3) & ~3;
1599 + if (pitches != NULL){
1600 + pitches[1] = pitches[2] = tmp;
1602 + tmp *= (*height >> 1);
1604 + if (offsets != NULL){
1605 + offsets[2] = size;
1613 + size = *width * 2;
1614 + if (pitches != NULL){
1615 + pitches[0] = size;
1624 +RegionsEqual(RegionPtr A, RegionPtr B)
1626 + int *dataA, *dataB;
1629 + num = REGION_NUM_RECTS(A);
1630 + if (num != REGION_NUM_RECTS(B)){
1634 + if ((A->extents.x1 != B->extents.x1)
1635 + || (A->extents.y1 != B->extents.y1)
1636 + || (A->extents.x2 != B->extents.x2)
1637 + || (A->extents.y2 != B->extents.y2)){
1641 + dataA = (int*) REGION_RECTS(A);
1642 + dataB = (int*) REGION_RECTS(B);
1645 + if ((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])){
1655 +NEODisplayVideo(ScrnInfoPtr pScrn, int id, int offset,
1656 + short width, short height, int pitch,
1657 + int x1, int y1, int x2, int y2, BoxPtr dstBox,
1658 + short src_w, short src_h, short drw_w, short drw_h)
1660 + NEOPtr nPtr = NEOPTR(pScrn);
1661 + int hstretch, vstretch, fmt;
1664 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEODisplayVideo\n");
1665 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEODisplayVideo src_w=%d, src_h=%d, pitch=%d, drw_w=%d, drw_h=%d\n", src_w, src_h, pitch, drw_w, drw_h);
1667 +#define WIDTH_THRESHOLD 160
1668 + if (dstBox->x2 >= pScrn->virtualX) {
1670 + * This is a hack to work around a problem when video is moved
1671 + * accross the right border.
1673 + int diff_s = (width - ((x2 - x1) >> 16)) & ~1;
1674 + int diff_d = (drw_w - dstBox->x2 + dstBox->x1) & ~1;
1676 + offset -= 2 * ((diff_s > diff_d) ? diff_d : diff_s);
1677 + dstBox->x1 -= diff_d;
1678 + } else if (dstBox->x2 - dstBox->x1 < WIDTH_THRESHOLD) {
1680 + * When the video window is less than about 160 pixel wide
1681 + * it will be distoreted. We attempt to fix it by actually
1682 + * making it wider and relying on the color key to prevent
1683 + * it from appearanig outside of the video.
1688 + if (dstBox->x1 < WIDTH_THRESHOLD) {
1695 + offset -= 2 * scale * pre;
1696 + dstBox->x1 -= pre;
1697 + dstBox->x2 += post;
1699 + if (nPtr->videoHZoom != 1.0) {
1700 + if ((dstBox->x2 += 5) > pScrn->virtualX)
1701 + dstBox->x2 = pScrn->virtualX;
1702 + if (dstBox->x1 > 0) dstBox->x1 += 2;
1718 + offset += (x1 >> 15) & ~0x03;
1720 + switch (nPtr->NeoChipset) {
1725 + OUTGR(0xbc, 0x4f);
1731 + OUTGR(0xbc, 0x2e);
1735 + /* factor 4 for granularity */
1736 + hstretch = (double)0x1000 * 4 / (int)(nPtr->videoHZoom * 4);
1737 + if (drw_w > src_w)
1738 + hstretch = (((int)src_w) * hstretch) / (int) drw_w;
1740 + vstretch = (double)0x1000 / nPtr->videoVZoom;
1741 + if (drw_h > src_h)
1742 + vstretch = (((int)src_h) * vstretch )/ (int) drw_h;
1744 + OUTGR(0xb1, (((dstBox->x2 - 1) >> 4) & 0xf0) | ((dstBox->x1 >> 8) & 0x0f));
1745 + OUTGR(0xb2, dstBox->x1);
1746 + OUTGR(0xb3, dstBox->x2 - 1);
1747 + OUTGR(0xb4, (((dstBox->y2 - 1) >> 4) & 0xf0) | ((dstBox->y1 >> 8) & 0x0f));
1748 + OUTGR(0xb5, dstBox->y1);
1749 + OUTGR(0xb6, dstBox->y2 - 1);
1750 + OUTGR(0xb7, offset >> 16);
1751 + OUTGR(0xb8, offset >> 8);
1752 + OUTGR(0xb9, offset );
1753 + OUTGR(0xba, pitch >> 8);
1754 + OUTGR(0xbb, pitch);
1756 + OUTGR(0xbd, 0x02);
1757 + OUTGR(0xbe, 0x00);
1758 + OUTGR(0xbf, 0x02);
1760 + OUTGR(0xc0, hstretch >> 8);
1761 + OUTGR(0xc1, hstretch);
1762 + OUTGR(0xc2, vstretch >> 8);
1763 + OUTGR(0xc3, vstretch);
1765 + OUTGR(0xb0, fmt | 0x03);
1767 + OUTGR(0x0a, 0x21);
1768 + OUTSR(0x08, 0xa0);
1769 + OUTGR(0x0a, 0x01);
1773 +NEOInitOffscreenImages(ScreenPtr pScreen)
1775 + XF86OffscreenImagePtr offscreenImages;
1778 + xf86DrvMsg(xf86Screens[pScreen->myNum]->scrnIndex,X_INFO,"NEOInitOffscreenImages\n");
1780 + if ((offscreenImages = xalloc(sizeof(XF86OffscreenImageRec))) == NULL){
1784 + offscreenImages->image = NEOVideoImages;
1785 + offscreenImages->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT;
1786 + offscreenImages->alloc_surface = NEOAllocSurface;
1787 + offscreenImages->free_surface = NEOFreeSurface;
1788 + offscreenImages->display = NEODisplaySurface;
1789 + offscreenImages->stop = NEOStopSurface;
1790 + offscreenImages->getAttribute = NEOGetSurfaceAttribute;
1791 + offscreenImages->setAttribute = NEOSetSurfaceAttribute;
1792 + offscreenImages->max_width = 1024;
1793 + offscreenImages->max_height = 1024;
1794 + offscreenImages->num_attributes = nElems(NEOVideoAttributes);
1795 + offscreenImages->attributes = NEOVideoAttributes;
1797 + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1);
1801 +NEOAllocateMemory(ScrnInfoPtr pScrn, FBLinearPtr linear, int size)
1803 + ScreenPtr pScreen;
1804 + FBLinearPtr new_linear;
1805 + int bytespp = pScrn->bitsPerPixel >> 3;
1807 + /* convert size in bytes into number of pixels */
1808 + size = (size + bytespp - 1) / bytespp;
1810 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,
1811 + "NEOAllocateMemory: linear=%x, size=%d\n", linear, size);
1815 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,
1816 + "NEOAllocateMemory: linear->size=%d\n", linear->size);
1818 + if (linear->size >= size){
1822 + if (xf86ResizeOffscreenLinear(linear, size)){
1826 + xf86FreeOffscreenLinear(linear);
1830 + pScreen = screenInfo.screens[pScrn->scrnIndex];
1831 + if ((new_linear = xf86AllocateOffscreenLinear(pScreen, size, 16, NULL,
1832 + NULL, NULL)) == NULL){
1835 + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 16,
1836 + PRIORITY_EXTREME);
1838 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,
1839 + "NEOAllocateMemory: max_size=%d\n", max_size);
1841 + if (max_size < size){
1845 + xf86PurgeUnlockedOffscreenAreas(pScreen);
1846 + new_linear = xf86AllocateOffscreenLinear(pScreen,
1847 + size, 16, NULL, NULL, NULL);
1850 + return (new_linear);
1854 +NEOCopyData(unsigned char *src, unsigned char *dst,
1855 + int srcPitch, int dstPitch,
1856 + int height, int width)
1858 + while (height-- > 0){
1859 + memcpy(dst, src, width);
1866 +NEOCopyYV12Data(unsigned char *src1, unsigned char *src2,
1867 + unsigned char *src3, unsigned char *dst,
1868 + int srcPitch1, int srcPitch2, int dstPitch,
1869 + int height, int width)
1871 + CARD32 *pDst = (CARD32 *) dst;
1877 + while (--height >= 0){
1878 + for (i =0; i < width; i++){
1879 + pDst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) |
1880 + (src3[i] << 8) | (src2[i] << 24);
1883 + src1 += srcPitch1;
1885 + for (i =0; i < width; i++){
1886 + pDst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) |
1887 + (src3[i] << 8) | (src2[i] << 24);
1890 + src1 += srcPitch1;
1891 + src2 += srcPitch2;
1892 + src3 += srcPitch2;
1897 +NEOAllocSurface(ScrnInfoPtr pScrn, int id,
1898 + unsigned short width, unsigned short height,
1899 + XF86SurfacePtr surface)
1901 + int pitch, bpp, size;
1902 + NEOOffscreenPtr pPriv;
1903 + FBLinearPtr linear;
1906 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOAllocSurface\n");
1908 + if (width > 1024 || height > 1024){
1909 + return (BadAlloc);
1912 + width = (width + 1) & ~1;
1913 + bpp = ((pScrn->bitsPerPixel + 1) >> 3);
1914 + pitch = ((width << 1) + 15) & ~15;
1915 + size = pitch * height;
1917 + if ((linear = NEOAllocateMemory(pScrn, NULL, size)) == NULL){
1918 + return (BadAlloc);
1921 + surface->width = width;
1922 + surface->height = height;
1923 + if ((surface->pitches = xalloc(sizeof(int))) == NULL){
1924 + xf86FreeOffscreenLinear(linear);
1925 + return (BadAlloc);
1927 + if ((surface->offsets = xalloc(sizeof(int))) == NULL){
1928 + xfree(surface->pitches);
1929 + xf86FreeOffscreenLinear(linear);
1930 + return (BadAlloc);
1933 + if ((pPriv = xalloc(sizeof(NEOOffscreenRec))) == NULL){
1934 + xfree(surface->pitches);
1935 + xfree(surface->offsets);
1936 + xf86FreeOffscreenLinear(linear);
1937 + return (BadAlloc);
1940 + pPriv->linear = linear;
1941 + pPriv->isOn = FALSE;
1943 + surface->pScrn = pScrn;
1945 + surface->pitches[0] = pitch;
1946 + surface->offsets[0] = linear->offset << 1;
1947 + surface->devPrivate.ptr = (pointer)pPriv;
1952 +NEOFreeSurface(XF86SurfacePtr surface)
1954 + NEOOffscreenPtr pPriv = (NEOOffscreenPtr)surface->devPrivate.ptr;
1957 + xf86DrvMsg(0,X_INFO,"NEOFreeSurface\n");
1960 + NEOStopSurface(surface);
1962 + xf86FreeOffscreenLinear(pPriv->linear);
1963 + xfree(surface->pitches);
1964 + xfree(surface->offsets);
1965 + xfree(surface->devPrivate.ptr);
1970 +NEODisplaySurface(XF86SurfacePtr surface,
1971 + short src_x, short src_y, short drw_x, short drw_y,
1972 + short src_w, short src_h, short drw_w, short drw_h,
1973 + RegionPtr clipBoxes)
1975 + NEOOffscreenPtr pPriv = (NEOOffscreenPtr)surface->devPrivate.ptr;
1976 + NEOPtr nPtr = NEOPTR(surface->pScrn);
1977 + NEOPortPtr portPriv = nPtr->overlayAdaptor->pPortPrivates[0].ptr;
1978 + INT32 x1, y1, x2, y2;
1982 + xf86DrvMsg(surface->pScrn->scrnIndex,X_INFO,"NEODisplaySurface\n");
1985 + x2 = src_x + src_w;
1987 + y2 = src_y + src_h;
1989 + dstBox.x1 = drw_x;
1990 + dstBox.x2 = drw_x + drw_w;
1991 + dstBox.y1 = drw_y;
1992 + dstBox.y2 = drw_y + drw_h;
1993 + if (!xf86XVClipVideoHelper( &dstBox, &x1, &x2, &y1, &y2,
1994 + clipBoxes, surface->width, surface->height)){
1998 + dstBox.x1 -= surface->pScrn->frameX0;
1999 + dstBox.y1 -= surface->pScrn->frameY0;
2000 + dstBox.x2 -= surface->pScrn->frameX0;
2001 + dstBox.y2 -= surface->pScrn->frameY0;
2003 + xf86XVFillKeyHelper(surface->pScrn->pScreen, portPriv->colorKey,
2005 + NEOResetVideo(surface->pScrn);
2006 + NEODisplayVideo(surface->pScrn, surface->id, surface->offsets[0],
2007 + surface->width, surface->height, surface->pitches[0],
2008 + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h);
2010 + pPriv->isOn = TRUE;
2011 + if (portPriv->videoStatus & CLIENT_VIDEO_ON){
2012 + REGION_EMPTY(pScrn->pScreen, &portPriv->clip);
2013 + UpdateCurrentTime();
2014 + portPriv->videoStatus = FREE_TIMER;
2015 + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY;
2021 +NEOStopSurface(XF86SurfacePtr surface)
2023 + NEOOffscreenPtr pPriv = (NEOOffscreenPtr)surface->devPrivate.ptr;
2026 + xf86DrvMsg(surface->pScrn->scrnIndex,X_INFO,"NEOStopSurface\n");
2029 + NEOPtr nPtr = NEOPTR(surface->pScrn);
2030 + VGA_HWP(surface->pScrn);
2031 + OUTGR(0xb0, 0x02);
2032 + pPriv->isOn = FALSE;
2038 +NEOGetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attr, INT32 *value)
2040 + NEOPtr nPtr = NEOPTR(pScrn);
2043 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOGetSurfaceAttribute\n");
2045 + return (NEOGetPortAttribute(pScrn,
2046 + attr, value, (pointer)nPtr->overlayAdaptor->pPortPrivates[0].ptr));
2050 +NEOSetSurfaceAttribute(ScrnInfoPtr pScrn, Atom attr, INT32 value)
2052 + NEOPtr nPtr = NEOPTR(pScrn);
2055 + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"NEOSetSurfaceAttribute\n");
2057 + return (NEOSetPortAttribute(pScrn,
2058 + attr, value, (pointer)nPtr->overlayAdaptor->pPortPrivates[0].ptr));
2061 +#else /* XvExtension */
2063 +void NEOInitVideo(ScreenPtr pScreen) {}
2064 +void NEOResetVideo(ScreenPtr pScreen) {}
2067 --- XFree86-4.2.0/xc.orig/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.h Thu Jan 1 01:00:00 1970
2068 +++ XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_video.h Thu Apr 4 16:05:44 2002
2070 +/**********************************************************************
2071 +Copyright 2002 by Shigehiro Nomura.
2073 + All Rights Reserved
2075 +Permission to use, copy, modify, distribute, and sell this software and
2076 +its documentation for any purpose is hereby granted without fee,
2077 +provided that the above copyright notice appear in all copies and that
2078 +both that copyright notice and this permission notice appear in
2079 +supporting documentation, and that the name of Shigehiro Nomura not be
2080 +used in advertising or publicity pertaining to distribution of the
2081 +software without specific, written prior permission. Shigehiro Nomura
2082 +and its suppliers make no representations about the suitability of this
2083 +software for any purpose. It is provided "as is" without express or
2086 +SHIGEHIRO NOMURA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
2087 +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
2088 +EVENT SHALL SHIGEHIRO NOMURA AND/OR ITS SUPPLIERS BE LIABLE FOR ANY
2089 +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
2090 +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
2091 +CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
2092 +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2093 +**********************************************************************/
2095 +#ifndef _NEO_VIDEO_H
2096 +#define _NEO_VIDEO_H
2101 +#include "fourcc.h"
2104 +#define NEO_VIDEO_VIDEO 0
2105 +#define NEO_VIDEO_IMAGE 1
2107 +#define FOURCC_RV15 0x35315652
2108 +#define FOURCC_RV16 0x36315652
2110 +#define OFF_DELAY 200 /* milliseconds */
2111 +#define FREE_DELAY 60000 /* milliseconds */
2113 +#define OFF_TIMER 0x01
2114 +#define FREE_TIMER 0x02
2115 +#define CLIENT_VIDEO_ON 0x04
2116 +#define TIMER_MASK (OFF_TIMER | FREE_TIMER)
2120 + FBLinearPtr linear;
2124 + CARD32 brightness;
2125 + CARD32 videoStatus;
2128 +} NEOPortRec, *NEOPortPtr;
2132 + FBLinearPtr linear;
2134 +} NEOOffscreenRec, *NEOOffscreenPtr;
2136 +/* I/O Functions */
2137 +# define OUTGR(idx,dat) \
2138 + if (nPtr->NeoMMIOBase2) \
2139 + (*(unsigned short *)(nPtr->NeoMMIOBase2+VGA_GRAPH_INDEX)\
2140 + =(idx)|((dat)<<8));\
2142 + VGAwGR((idx),(dat));
2144 +# define OUTSR(idx,dat) \
2145 +if (nPtr->NeoMMIOBase2) \
2146 + (*(unsigned short *)(nPtr->NeoMMIOBase2+VGA_SEQ_INDEX)=(idx)|((dat)<<8));\
2148 + VGAwSR((idx),(dat));
2150 +# define VGA_HWP(x) vgaHWPtr hwp = VGAHWPTR(x)
2152 +#endif /* _NEO_VIDEO_H */