e:/XFree86 for RH 8.0/XFree86-4.2.0/xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c File Reference

Go to the source code of this file.

Data Structures

struct  TRIDENTPortPrivRec
struct  OffscreenPrivRec

Typedefs

typedef * TRIDENTPortPrivPtr
typedef * OffscreenPrivPtr

Functions

XF86VideoAdaptorPtr TRIDENTSetupImageVideo (ScreenPtr)
void TRIDENTInitOffscreenImages (ScreenPtr)
void TRIDENTStopVideo (ScrnInfoPtr, pointer, Bool)
int TRIDENTSetPortAttribute (ScrnInfoPtr, Atom, INT32, pointer)
int TRIDENTGetPortAttribute (ScrnInfoPtr, Atom, INT32 *, pointer)
void TRIDENTQueryBestSize (ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer)
int TRIDENTPutImage (ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char *, short, short, Bool, RegionPtr, pointer)
int TRIDENTQueryImageAttributes (ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *)
void TRIDENTVideoTimerCallback (ScrnInfoPtr pScrn, Time time)
void tridentSetVideoGamma (TRIDENTPtr pTrident, int value, int brightness)
void tridentSetVideoContrast (TRIDENTPtr pTrident, int value)
void tridentSetVideoParameters (TRIDENTPtr pTrident, int brightness, int saturation, int hue)
void tridentFixFrame (ScrnInfoPtr pScrn, int *fixFrame)
void TRIDENTInitVideo (ScreenPtr pScreen)
void TRIDENTResetVideo (ScrnInfoPtr pScrn)
Bool RegionsEqual (RegionPtr A, RegionPtr B)
void TRIDENTCopyData (unsigned char *src, unsigned char *dst, int srcPitch, int dstPitch, int h, int w)
void TRIDENTCopyMungedData (unsigned char *src1, unsigned char *src2, unsigned char *src3, unsigned char *dst1, int srcPitch, int srcPitch2, int dstPitch, int h, int w)
FBLinearPtr TRIDENTAllocateMemory (ScrnInfoPtr pScrn, FBLinearPtr linear, int size)
void TRIDENTDisplayVideo (ScrnInfoPtr pScrn, int id, int offset, short width, short height, int pitch, int x1, int y1, int x2, int y2, BoxPtr dstBox, short src_w, short src_h, short drw_w, short drw_h)
int TRIDENTAllocateSurface (ScrnInfoPtr pScrn, int id, unsigned short w, unsigned short h, XF86SurfacePtr surface)
int TRIDENTStopSurface (XF86SurfacePtr surface)
int TRIDENTFreeSurface (XF86SurfacePtr surface)
int TRIDENTGetSurfaceAttribute (ScrnInfoPtr pScrn, Atom attribute, INT32 *value)
int TRIDENTSetSurfaceAttribute (ScrnInfoPtr pScrn, Atom attribute, INT32 value)
int TRIDENTDisplaySurface (XF86SurfacePtr surface, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, RegionPtr clipBoxes)

Variables

Atom xvColorKey
Atom xvSaturation
Atom xvBrightness
Atom xvHUE
Atom xvGamma
Atom xvContrast
XF86VideoEncodingRec DummyEncoding [1]
XF86VideoFormatRec Formats [NUM_FORMATS]
XF86AttributeRec Attributes [NUM_ATTRIBUTES]
XF86ImageRec Images [NUM_IMAGES]


Typedef Documentation

typedef * TRIDENTPortPrivPtr
 

Referenced by TRIDENTDisplaySurface(), TRIDENTGetPortAttribute(), TRIDENTPutImage(), TRIDENTResetVideo(), TRIDENTSetPortAttribute(), TRIDENTSetupImageVideo(), TRIDENTStopVideo(), and TRIDENTVideoTimerCallback().

typedef * OffscreenPrivPtr
 


Function Documentation

XF86VideoAdaptorPtr TRIDENTSetupImageVideo ScreenPtr   )  [static]
 

Definition at line 316 of file trident_video.c.

References Attributes, CYBER9397, DevUnion, DummyEncoding, Formats, Images, _Screen::myNum, pointer, pPriv, PROVIDIA9682, pScreen, pScrn, TRIDENTGetPortAttribute(), TRIDENTPortPrivPtr, TRIDENTPtr, TRIDENTPutImage(), TRIDENTQueryBestSize(), TRIDENTQueryImageAttributes(), TRIDENTResetVideo(), TRIDENTSetPortAttribute(), TRIDENTStopVideo(), xf86Screens, XF86VideoAdaptorPtr, xvBrightness, xvColorKey, xvContrast, xvGamma, xvHUE, and xvSaturation.

Referenced by TRIDENTInitVideo().

00317 { 00318 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 00319 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 00320 XF86VideoAdaptorPtr adapt; 00321 TRIDENTPortPrivPtr pPriv; 00322 00323 if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + 00324 sizeof(TRIDENTPortPrivRec) + 00325 sizeof(DevUnion)))) 00326 return NULL; 00327 00328 adapt->type = XvWindowMask | XvInputMask | XvImageMask; 00329 adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; 00330 adapt->name = "Trident Backend Scaler"; 00331 adapt->nEncodings = 1; 00332 adapt->pEncodings = DummyEncoding; 00333 adapt->nFormats = NUM_FORMATS; 00334 adapt->pFormats = Formats; 00335 adapt->nPorts = 1; 00336 adapt->pPortPrivates = (DevUnion*)(&adapt[1]); 00337 pPriv = (TRIDENTPortPrivPtr)(&adapt->pPortPrivates[1]); 00338 adapt->pPortPrivates[0].ptr = (pointer)(pPriv); 00339 adapt->pAttributes = Attributes; 00340 adapt->nImages = NUM_IMAGES; 00341 adapt->nAttributes = NUM_ATTRIBUTES; 00342 adapt->pImages = Images; 00343 adapt->PutVideo = NULL; 00344 adapt->PutStill = NULL; 00345 adapt->GetVideo = NULL; 00346 adapt->GetStill = NULL; 00347 adapt->StopVideo = TRIDENTStopVideo; 00348 adapt->SetPortAttribute = TRIDENTSetPortAttribute; 00349 adapt->GetPortAttribute = TRIDENTGetPortAttribute; 00350 adapt->QueryBestSize = TRIDENTQueryBestSize; 00351 adapt->PutImage = TRIDENTPutImage; 00352 adapt->QueryImageAttributes = TRIDENTQueryImageAttributes; 00353 00354 pPriv->colorKey = pTrident->videoKey & ((1 << pScrn->depth) - 1); 00355 pPriv->Brightness = 45; 00356 pPriv->Saturation = 80; 00357 pPriv->Contrast = 4; 00358 pPriv->Gamma = 0; 00359 pPriv->HUE = 0; 00360 pPriv->videoStatus = 0; 00361 pPriv->fixFrame = 100; 00362 00363 /* gotta uninit this someplace */ 00364 REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); 00365 00366 pTrident->adaptor = adapt; 00367 00368 xvColorKey = MAKE_ATOM("XV_COLORKEY"); 00369 00370 if (pTrident->Chipset >= CYBER9397) { 00371 xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); 00372 xvSaturation = MAKE_ATOM("XV_SATURATION"); 00373 xvHUE = MAKE_ATOM("XV_HUE"); 00374 xvGamma = MAKE_ATOM("XV_GAMMA"); 00375 xvContrast = MAKE_ATOM("XV_CONTRAST"); 00376 } 00377 00378 if (pTrident->Chipset >= PROVIDIA9682) 00379 pTrident->keyOffset = 0x50; 00380 else 00381 pTrident->keyOffset = 0x30; 00382 00383 TRIDENTResetVideo(pScrn); 00384 00385 return adapt; 00386 }

void TRIDENTInitOffscreenImages ScreenPtr   )  [static]
 

Definition at line 1244 of file trident_video.c.

References Attributes, Images, pScreen, TRIDENTAllocateSurface(), TRIDENTDisplaySurface(), TRIDENTFreeSurface(), TRIDENTGetSurfaceAttribute(), TRIDENTSetSurfaceAttribute(), TRIDENTStopSurface(), xalloc(), XF86OffscreenImagePtr, and xf86XVRegisterOffscreenImages().

Referenced by TRIDENTInitVideo().

01245 { 01246 XF86OffscreenImagePtr offscreenImages; 01247 01248 /* need to free this someplace */ 01249 if(!(offscreenImages = xalloc(sizeof(XF86OffscreenImageRec)))) 01250 return; 01251 01252 offscreenImages[0].image = &Images[0]; 01253 offscreenImages[0].flags = VIDEO_OVERLAID_IMAGES | 01254 VIDEO_CLIP_TO_VIEWPORT; 01255 offscreenImages[0].alloc_surface = TRIDENTAllocateSurface; 01256 offscreenImages[0].free_surface = TRIDENTFreeSurface; 01257 offscreenImages[0].display = TRIDENTDisplaySurface; 01258 offscreenImages[0].stop = TRIDENTStopSurface; 01259 offscreenImages[0].setAttribute = TRIDENTSetSurfaceAttribute; 01260 offscreenImages[0].getAttribute = TRIDENTGetSurfaceAttribute; 01261 offscreenImages[0].max_width = 1024; 01262 offscreenImages[0].max_height = 1024; 01263 offscreenImages[0].num_attributes = NUM_ATTRIBUTES; 01264 offscreenImages[0].attributes = Attributes; 01265 01266 xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); 01267 }

void TRIDENTStopVideo ScrnInfoPtr  ,
pointer  ,
Bool 
[static]
 

Definition at line 421 of file trident_video.c.

References currentTime, data, _TimeStamp::milliseconds, pPriv, pScrn, TRIDENTPortPrivPtr, TRIDENTPtr, TRIDENTVideoTimerCallback(), and xf86FreeOffscreenLinear().

Referenced by TRIDENTSetupImageVideo().

00422 { 00423 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 00424 TRIDENTPortPrivPtr pPriv = (TRIDENTPortPrivPtr)data; 00425 int vgaIOBase = VGAHWPTR(pScrn)->IOBase; 00426 00427 REGION_EMPTY(pScrn->pScreen, &pPriv->clip); 00428 00429 if(shutdown) { 00430 if(pPriv->videoStatus & CLIENT_VIDEO_ON) { 00431 OUTW(vgaIOBase + 4, 0x008E); 00432 OUTW(vgaIOBase + 4, 0x008F); 00433 } 00434 if(pPriv->linear) { 00435 xf86FreeOffscreenLinear(pPriv->linear); 00436 pPriv->linear = NULL; 00437 } 00438 pPriv->videoStatus = 0; 00439 } else { 00440 if(pPriv->videoStatus & CLIENT_VIDEO_ON) { 00441 pPriv->videoStatus |= OFF_TIMER; 00442 pPriv->offTime = currentTime.milliseconds + OFF_DELAY; 00443 pTrident->VideoTimerCallback = TRIDENTVideoTimerCallback; 00444 } 00445 } 00446 }

int TRIDENTSetPortAttribute ScrnInfoPtr  ,
Atom  ,
INT32  ,
pointer 
[static]
 

Definition at line 536 of file trident_video.c.

References data, pPriv, pScrn, TRIDENTPortPrivPtr, TRIDENTPtr, tridentSetVideoContrast(), tridentSetVideoGamma(), tridentSetVideoParameters(), value, xvBrightness, xvColorKey, xvContrast, xvGamma, xvHUE, and xvSaturation.

Referenced by TRIDENTSetSurfaceAttribute(), and TRIDENTSetupImageVideo().

00541 { 00542 TRIDENTPortPrivPtr pPriv = (TRIDENTPortPrivPtr)data; 00543 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 00544 00545 if(attribute == xvColorKey) { 00546 int red, green, blue; 00547 int tmp; 00548 pPriv->colorKey = value; 00549 switch (pScrn->depth) { 00550 case 8: 00551 VIDEOOUT(pPriv->colorKey, pTrident->keyOffset); 00552 VIDEOOUT(0x00, (pTrident->keyOffset + 1)); 00553 VIDEOOUT(0x00, (pTrident->keyOffset + 2)); 00554 break; 00555 default: 00556 red = (pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red; 00557 green = (pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green; 00558 blue = (pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue; 00559 switch (pScrn->depth) { 00560 case 15: 00561 tmp = (red << 10) | (green << 5) | (blue); 00562 VIDEOOUT((tmp&0xff), pTrident->keyOffset); 00563 VIDEOOUT((tmp&0xff00)>>8, (pTrident->keyOffset + 1)); 00564 VIDEOOUT(0x00, (pTrident->keyOffset + 2)); 00565 break; 00566 case 16: 00567 tmp = (red << 11) | (green << 5) | (blue); 00568 VIDEOOUT((tmp&0xff), pTrident->keyOffset); 00569 VIDEOOUT((tmp&0xff00)>>8, (pTrident->keyOffset + 1)); 00570 VIDEOOUT(0x00, (pTrident->keyOffset + 2)); 00571 break; 00572 case 24: 00573 VIDEOOUT(blue, pTrident->keyOffset); 00574 VIDEOOUT(green, (pTrident->keyOffset + 1)); 00575 VIDEOOUT(red, (pTrident->keyOffset + 2)); 00576 break; 00577 } 00578 } 00579 REGION_EMPTY(pScrn->pScreen, &pPriv->clip); 00580 } else if (attribute == xvBrightness) { 00581 if ((value < 0) || (value > 0x3f)) 00582 return BadValue; 00583 pPriv->Brightness = value; 00584 tridentSetVideoParameters(pTrident, pPriv->Brightness, pPriv->Saturation, 00585 pPriv->HUE); 00586 } else if (attribute == xvSaturation) { 00587 if ((value < 0) || (value > 187)) 00588 return BadValue; 00589 pPriv->Saturation = value; 00590 tridentSetVideoParameters(pTrident, pPriv->Brightness, pPriv->Saturation, 00591 pPriv->HUE); 00592 } else if (attribute == xvHUE) { 00593 if ((value < 0) || (value > 360)) 00594 return BadValue; 00595 pPriv->HUE = value; 00596 tridentSetVideoParameters(pTrident, pPriv->Brightness, pPriv->Saturation, 00597 pPriv->HUE); 00598 tridentSetVideoGamma(pTrident,pPriv->Gamma,pPriv->Brightness); 00599 } else if (attribute == xvGamma) { 00600 if ((value < -128) || (value > 127)) 00601 return BadValue; 00602 pPriv->Gamma = value; 00603 tridentSetVideoGamma(pTrident,value,pPriv->Brightness); 00604 } else if (attribute == xvContrast) { 00605 if ((value < 0) || (value > 127)) 00606 return BadValue; 00607 pPriv->Contrast = value; 00608 tridentSetVideoContrast(pTrident,value); 00609 } else 00610 return BadMatch; 00611 00612 return Success; 00613 }

int TRIDENTGetPortAttribute ScrnInfoPtr  ,
Atom  ,
INT32 ,
pointer 
[static]
 

Definition at line 616 of file trident_video.c.

References data, pPriv, TRIDENTPortPrivPtr, value, xvBrightness, xvColorKey, xvContrast, xvGamma, xvHUE, and xvSaturation.

Referenced by TRIDENTGetSurfaceAttribute(), and TRIDENTSetupImageVideo().

00621 { 00622 TRIDENTPortPrivPtr pPriv = (TRIDENTPortPrivPtr)data; 00623 00624 if(attribute == xvColorKey) { 00625 *value = pPriv->colorKey; 00626 } else if(attribute == xvBrightness) { 00627 *value = pPriv->Brightness; 00628 } else if(attribute == xvSaturation) { 00629 *value = pPriv->Saturation; 00630 } else if (attribute == xvHUE) { 00631 *value = pPriv->HUE; 00632 } else if (attribute == xvGamma) { 00633 *value = pPriv->Gamma; 00634 } else if (attribute == xvContrast) { 00635 *value = pPriv->Contrast; 00636 } else 00637 return BadMatch; 00638 00639 return Success; 00640 }

void TRIDENTQueryBestSize ScrnInfoPtr  ,
Bool  ,
short  ,
short  ,
short  ,
short  ,
unsigned int *  ,
unsigned int *  ,
pointer 
[static]
 

Definition at line 643 of file trident_video.c.

Referenced by TRIDENTSetupImageVideo().

00650 { 00651 *p_w = drw_w; 00652 *p_h = drw_h; 00653 00654 if(*p_w > 16384) *p_w = 16384; 00655 }

int TRIDENTPutImage ScrnInfoPtr  ,
short  ,
short  ,
short  ,
short  ,
short  ,
short  ,
short  ,
short  ,
int  ,
unsigned char *  ,
short  ,
short  ,
Bool  ,
RegionPtr  ,
pointer 
[static]
 

Definition at line 911 of file trident_video.c.

References buf, data, height, INT32, offset, pPriv, pScreen, pScrn, RegionsEqual(), TRIDENTAllocateMemory(), TRIDENTCopyData(), TRIDENTCopyMungedData(), TRIDENTDisplayVideo(), tridentFixFrame(), TRIDENTPortPrivPtr, TRIDENTPtr, width, _Box::x1, _Box::x2, xf86XVClipVideoHelper(), xf86XVFillKeyHelper(), _Box::y1, and _Box::y2.

Referenced by TRIDENTSetupImageVideo().

00921 { 00922 TRIDENTPortPrivPtr pPriv = (TRIDENTPortPrivPtr)data; 00923 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 00924 INT32 x1, x2, y1, y2; 00925 unsigned char *dst_start; 00926 int pitch, new_size, offset, offset2 = 0, offset3 = 0; 00927 int srcPitch, srcPitch2 = 0, dstPitch; 00928 int top, left, npixels, nlines, bpp; 00929 BoxRec dstBox; 00930 CARD32 tmp; 00931 00932 /* Clip */ 00933 x1 = src_x; 00934 x2 = src_x + src_w; 00935 y1 = src_y; 00936 y2 = src_y + src_h; 00937 00938 dstBox.x1 = drw_x; 00939 dstBox.x2 = drw_x + drw_w; 00940 dstBox.y1 = drw_y; 00941 dstBox.y2 = drw_y + drw_h; 00942 00943 if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, 00944 width, height)) 00945 return Success; 00946 00947 dstBox.x1 -= pScrn->frameX0; 00948 dstBox.x2 -= pScrn->frameX0; 00949 dstBox.y1 -= pScrn->frameY0; 00950 dstBox.y2 -= pScrn->frameY0; 00951 00952 bpp = pScrn->bitsPerPixel >> 3; 00953 pitch = bpp * pScrn->displayWidth; 00954 00955 dstPitch = ((width << 1) + 15) & ~15; 00956 new_size = ((dstPitch * height) + bpp - 1) / bpp; 00957 switch(id) { 00958 case FOURCC_YV12: 00959 case FOURCC_I420: 00960 srcPitch = (width + 3) & ~3; 00961 offset2 = srcPitch * height; 00962 srcPitch2 = ((width >> 1) + 3) & ~3; 00963 offset3 = (srcPitch2 * (height >> 1)) + offset2; 00964 break; 00965 case FOURCC_UYVY: 00966 case FOURCC_YUY2: 00967 default: 00968 srcPitch = (width << 1); 00969 break; 00970 } 00971 00972 if(!(pPriv->linear = TRIDENTAllocateMemory(pScrn, pPriv->linear, new_size))) 00973 return BadAlloc; 00974 00975 /* copy data */ 00976 top = y1 >> 16; 00977 left = (x1 >> 16) & ~1; 00978 npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; 00979 left <<= 1; 00980 00981 offset = pPriv->linear->offset * bpp; 00982 00983 dst_start = pTrident->FbBase + offset + left + (top * dstPitch); 00984 00985 switch(id) { 00986 case FOURCC_YV12: 00987 case FOURCC_I420: 00988 top &= ~1; 00989 tmp = ((top >> 1) * srcPitch2) + (left >> 2); 00990 offset2 += tmp; 00991 offset3 += tmp; 00992 if(id == FOURCC_I420) { 00993 tmp = offset2; 00994 offset2 = offset3; 00995 offset3 = tmp; 00996 } 00997 nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; 00998 TRIDENTCopyMungedData(buf + (top * srcPitch) + (left >> 1), 00999 buf + offset2, buf + offset3, dst_start, 01000 srcPitch, srcPitch2, dstPitch, nlines, npixels); 01001 break; 01002 case FOURCC_UYVY: 01003 case FOURCC_YUY2: 01004 default: 01005 buf += (top * srcPitch) + left; 01006 nlines = ((y2 + 0xffff) >> 16) - top; 01007 TRIDENTCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); 01008 break; 01009 } 01010 01011 /* update cliplist */ 01012 if(!RegionsEqual(&pPriv->clip, clipBoxes)) { 01013 /* update cliplist */ 01014 REGION_COPY(pScreen, &pPriv->clip, clipBoxes); 01015 xf86XVFillKeyHelper(pScrn->pScreen, pPriv->colorKey, clipBoxes); 01016 } 01017 01018 offset += top * dstPitch; 01019 01020 tridentFixFrame(pScrn,&pPriv->fixFrame); 01021 TRIDENTDisplayVideo(pScrn, id, offset, width, height, dstPitch, 01022 x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); 01023 01024 pPriv->videoStatus = CLIENT_VIDEO_ON; 01025 01026 return Success; 01027 }

int TRIDENTQueryImageAttributes ScrnInfoPtr  ,
int  ,
unsigned short *  ,
unsigned short *  ,
int *  ,
int * 
[static]
 

Definition at line 1030 of file trident_video.c.

References h, size, and w.

Referenced by TRIDENTSetupImageVideo().

01035 { 01036 int size, tmp; 01037 01038 if(*w > 1024) *w = 1024; 01039 if(*h > 1024) *h = 1024; 01040 01041 *w = (*w + 1) & ~1; 01042 if(offsets) offsets[0] = 0; 01043 01044 switch(id) { 01045 case FOURCC_YV12: /* YV12 */ 01046 *h = (*h + 1) & ~1; 01047 size = (*w + 3) & ~3; 01048 if(pitches) pitches[0] = size; 01049 size *= *h; 01050 if(offsets) offsets[1] = size; 01051 tmp = ((*w >> 1) + 3) & ~3; 01052 if(pitches) pitches[1] = pitches[2] = tmp; 01053 tmp *= (*h >> 1); 01054 size += tmp; 01055 if(offsets) offsets[2] = size; 01056 size += tmp; 01057 break; 01058 default: /* RGB15, RGB16, YUY2 */ 01059 size = *w << 1; 01060 if(pitches) pitches[0] = size; 01061 size *= *h; 01062 break; 01063 } 01064 01065 return size; 01066 }

void TRIDENTVideoTimerCallback ScrnInfoPtr  pScrn,
Time  time
[static]
 

Definition at line 1270 of file trident_video.c.

References pPriv, pScrn, time, TRIDENTPortPrivPtr, TRIDENTPtr, and xf86FreeOffscreenLinear().

Referenced by TRIDENTDisplaySurface(), and TRIDENTStopVideo().

01271 { 01272 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 01273 TRIDENTPortPrivPtr pPriv = pTrident->adaptor->pPortPrivates[0].ptr; 01274 int vgaIOBase = VGAHWPTR(pScrn)->IOBase; 01275 01276 if(pPriv->videoStatus & TIMER_MASK) { 01277 if(pPriv->videoStatus & OFF_TIMER) { 01278 if(pPriv->offTime < time) { 01279 OUTW(vgaIOBase + 4, 0x008E); 01280 OUTW(vgaIOBase + 4, 0x008F); 01281 pPriv->videoStatus = FREE_TIMER; 01282 pPriv->freeTime = time + FREE_DELAY; 01283 } 01284 } else { /* FREE_TIMER */ 01285 if(pPriv->freeTime < time) { 01286 if(pPriv->linear) { 01287 xf86FreeOffscreenLinear(pPriv->linear); 01288 pPriv->linear = NULL; 01289 } 01290 pPriv->videoStatus = 0; 01291 pTrident->VideoTimerCallback = NULL; 01292 } 01293 } 01294 } else /* shouldn't get here */ 01295 pTrident->VideoTimerCallback = NULL; 01296 }

void tridentSetVideoGamma TRIDENTPtr  pTrident,
int  value,
int  brightness
[static]
 

Definition at line 458 of file trident_video.c.

References i, pow(), val, value, x, and y.

Referenced by TRIDENTResetVideo(), and TRIDENTSetPortAttribute().

00459 { 00460 int pivots[] = {0,3,15,63,255}; 00461 00462 int slope; 00463 int y_0; 00464 float x, x_prev = 0, y, y_prev = 0; 00465 int i; 00466 int exp; 00467 CARD8 i_slopes[4]; 00468 CARD8 intercepts[4]; 00469 00470 brightness = (brightness - 0x20); 00471 if (value == 0) { 00472 OUTW(0x3C4, 0x80 << 8 | 0xB4); 00473 OUTW(0x3C4, (brightness) << 8 | 0xB8); 00474 OUTW(0x3C4, (brightness) << 8 | 0xB9); 00475 OUTW(0x3C4, (brightness) << 8 | 0xBA); 00476 OUTW(0x3C4, (brightness) << 8 | 0xBB); 00477 return; 00478 } 00479 exp = log(value); 00480 for (i = 0; i < 4; i++) { 00481 x = pivots[i-1] / 255.0; 00482 y = pow(x,exp); 00483 slope = (y - y_prev) / (x - x_prev); 00484 y_0 = y - x * slope; 00485 { 00486 int val = slope; 00487 if (val > 7) 00488 i_slopes[i] = (3 << 4) | (val & 0xf); 00489 else if (val > 3) 00490 i_slopes[i] = (2 << 4) | ((int)(slope / 2) & 0xf); 00491 else if (val > 2) 00492 i_slopes[i] = (1 << 4) | ((int)(slope / 4) & 0xf); 00493 else 00494 i_slopes[i] = ((int)(slope / 8) & 0xf); 00495 } 00496 intercepts[i] = y_0 * 256 / 4; 00497 x_prev = x; 00498 y_prev = y; 00499 } 00500 OUTW(0x3C4, i_slopes[0] << 8 | 0xB4); 00501 OUTW(0x3C4, i_slopes[1] << 8 | 0xB5); 00502 OUTW(0x3C4, i_slopes[2] << 8 | 0xB6); 00503 OUTW(0x3C4, i_slopes[3] << 8 | 0xB7); 00504 OUTW(0x3C4, (intercepts[0] + brightness) << 8 | 0xB8); 00505 OUTW(0x3C4, (intercepts[1] + brightness) << 8 | 0xB9); 00506 OUTW(0x3C4, (intercepts[2] + brightness) << 8 | 0xBA); 00507 OUTW(0x3C4, (intercepts[3] + brightness) << 8 | 0xBB); 00508 }

void tridentSetVideoContrast TRIDENTPtr  pTrident,
int  value
[static]
 

Definition at line 452 of file trident_video.c.

References value.

Referenced by TRIDENTResetVideo(), and TRIDENTSetPortAttribute().

00453 { 00454 OUTW(0x3C4, (((value & 0x7)|((value & 0x7) << 4)) << 8) | 0xBC); 00455 }

void tridentSetVideoParameters TRIDENTPtr  pTrident,
int  brightness,
int  saturation,
int  hue
[static]
 

Definition at line 511 of file trident_video.c.

Referenced by TRIDENTResetVideo(), and TRIDENTSetPortAttribute().

00513 { 00514 double dtmp; 00515 CARD8 sign, tmp, tmp1; 00516 00517 if (brightness >= 0x20) 00518 brightness -= 0x20; 00519 else 00520 brightness += 0x20; 00521 dtmp = sin((double)hue / 180.0 * PI) * saturation / 12.5; 00522 sign = (dtmp < 0) ? 1 << 1 : 0; 00523 tmp1 = ((int)fabs(dtmp) >> 4) & 0x1; 00524 tmp = brightness << 2 | sign | tmp1; 00525 OUTW(0x3C4, tmp << 8 | 0xB1); 00526 00527 tmp1 = ((int)fabs(dtmp) & 0x7 ) << 5; 00528 dtmp = cos((double)hue / 180.0 * PI) * saturation / 12.5; 00529 sign = (dtmp < 0) ? 1 << 4 : 0; 00530 tmp1 |= (int)fabs(dtmp) & 0xf; 00531 tmp = sign | tmp1; 00532 OUTW(0x3C4, tmp << 8 | 0xB0); 00533 }

void tridentFixFrame ScrnInfoPtr  pScrn,
int *  fixFrame
 

Definition at line 1302 of file trident_video.c.

References BLADE3D, Bool, CYBERBLADEAI1, CYBERBLADEAI1D, CYBERBLADEE4, CYBERBLADEI1, CYBERBLADEI1D, CYBERBLADEI7, CYBERBLADEI7D, CYBERBLADEXPAI1, CYBERBLADEXPm16, CYBERBLADEXPm8, tridentLCD::display_x, tridentLCD::display_y, LCD, mode, PROVIDIA9682, PROVIDIA9685, pScrn, TGUI9680, and TRIDENTPtr.

Referenced by TRIDENTDisplaySurface(), and TRIDENTPutImage().

01303 { 01304 01305 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 01306 int vgaIOBase = VGAHWPTR(pScrn)->IOBase; 01307 int HTotal, HSyncStart; 01308 int VTotal, VSyncStart; 01309 int h_off = 0; 01310 int v_off = 0; 01311 unsigned char CRTC[0x11]; 01312 Bool isShadow; 01313 unsigned char shadow = 0; 01314 01315 if ((*fixFrame)++ < 100) 01316 return; 01317 01318 *fixFrame = 0; 01319 isShadow = (pTrident->ModeReg.tridentRegs3CE[CyberControl] & 0x81) == 0x81; 01320 01321 if (isShadow) 01322 SHADOW_ENABLE(shadow); 01323 01324 OUTB(vgaIOBase + 4, 0x0); 01325 CRTC[0x0] = INB(vgaIOBase + 5); 01326 OUTB(vgaIOBase + 4, 0x4); 01327 CRTC[0x4] = INB(vgaIOBase + 5); 01328 OUTB(vgaIOBase + 4, 0x5); 01329 CRTC[0x5] = INB(vgaIOBase + 5); 01330 OUTB(vgaIOBase + 4, 0x6); 01331 CRTC[0x6] = INB(vgaIOBase + 5); 01332 OUTB(vgaIOBase + 4, 0x7); 01333 CRTC[0x7] = INB(vgaIOBase + 5); 01334 OUTB(vgaIOBase + 4, 0x10); 01335 CRTC[0x10] = INB(vgaIOBase + 5); 01336 01337 HTotal = CRTC[0] << 3; 01338 VTotal = CRTC[6] 01339 | ((CRTC[7] & (1<<0)) << 8) 01340 | ((CRTC[7] & (1<<5)) << 4); 01341 HSyncStart = (CRTC[4] 01342 + ((CRTC[5] >> 5) & 0x3)) << 3; 01343 VSyncStart = CRTC[0x10] 01344 | ((CRTC[7] & (1<<2)) << 6) 01345 | ((CRTC[7] & (1<<7)) << 2); 01346 01347 if (isShadow) { 01348 SHADOW_RESTORE(shadow); 01349 if (pTrident->lcdMode != 0xff) { 01350 h_off = (LCD[pTrident->lcdMode].display_x 01351 - pScrn->currentMode->HDisplay) >> 1; 01352 v_off = (LCD[pTrident->lcdMode].display_y 01353 - pScrn->currentMode->VDisplay) >> 1; 01354 } 01355 } 01356 01357 pTrident->hsync = (HTotal - HSyncStart) + 23 + h_off; 01358 pTrident->vsync = (VTotal - VSyncStart) - 2 + v_off; 01359 01360 /* 01361 * HACK !! As awful as this is, it appears to be the only way....Sigh! 01362 * We have XvHsync and XvVsync as options now, which adjust 01363 * at the very end of this function. It'll be helpful for now 01364 * and we can get more data on some of these skew values. 01365 */ 01366 switch (pTrident->Chipset) { 01367 case TGUI9680: 01368 /* Furthur tweaking needed */ 01369 #if 0 01370 pTrident->hsync -= (mode->CrtcHTotal / 16); 01371 #endif 01372 pTrident->vsync += 2; 01373 break; 01374 case PROVIDIA9682: 01375 /* Furthur tweaking needed */ 01376 pTrident->hsync += 7; 01377 break; 01378 case PROVIDIA9685: 01379 /* Spot on */ 01380 break; 01381 case CYBERBLADEXPm8: 01382 case CYBERBLADEXPm16: 01383 case CYBERBLADEXPAI1: 01384 pTrident->hsync -= 15; 01385 pTrident->hsync_rskew = 3; 01386 break; 01387 case BLADE3D: 01388 if (pScrn->depth == 24) 01389 pTrident->hsync -= 8; 01390 else 01391 pTrident->hsync -= 6; 01392 break; 01393 case CYBERBLADEI7: 01394 case CYBERBLADEI7D: 01395 case CYBERBLADEI1: 01396 case CYBERBLADEI1D: 01397 pTrident->hsync -= 8; 01398 break; 01399 case CYBERBLADEAI1: 01400 pTrident->hsync -= 7; 01401 break; 01402 case CYBERBLADEAI1D: 01403 pTrident->vsync += 2; 01404 pTrident->vsync_bskew = -4; 01405 pTrident->hsync -= 5; 01406 break; 01407 case CYBERBLADEE4: 01408 pTrident->hsync -= 8; 01409 break; 01410 } 01411 pTrident->hsync+=pTrident->OverrideHsync; 01412 pTrident->vsync+=pTrident->OverrideVsync; 01413 pTrident->hsync_rskew+=pTrident->OverrideRskew; 01414 pTrident->vsync_bskew+=pTrident->OverrideBskew; 01415 }

void TRIDENTInitVideo ScreenPtr  pScreen  ) 
 

Definition at line 77 of file trident_video.c.

References BLADE3D, CYBERBLADEAI1, CYBERBLADEAI1D, CYBERBLADEI1D, _Screen::myNum, pScreen, pScrn, TRIDENTInitOffscreenImages(), TRIDENTPtr, TRIDENTSetupImageVideo(), X_INFO, xalloc(), xf86DrvMsgVerb(), xf86Screens, XF86VideoAdaptorPtr, xf86XVListGenericAdaptors(), xf86XVScreenInit(), and xfree().

Referenced by TRIDENTScreenInit().

00078 { 00079 ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; 00080 XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; 00081 XF86VideoAdaptorPtr newAdaptor = NULL; 00082 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 00083 int num_adaptors; 00084 00085 /* 00086 * The following has been tested on: 00087 * 00088 * 9525 : flags: None 00089 * CyberBlade/i7: flags: VID_ZOOM_INV | VID_ZOOM_MINI 00090 * CyberBlade/i1: flags: VID_ZOOM_INV | VID_ZOOM_MINI 00091 * CyberBlade/Ai1: flags: VID_ZOOM_INV 00092 * Cyber 9540 : flags: VID_ZOOM_INV | VID_SHIFT_4 00093 * CyberXPm8 : flags: VID_ZOOM_INV | VID_SHIFT_4 00094 * 00095 * When you make changes make sure not to break these 00096 * Add new chipsets to this list. 00097 */ 00098 if (pTrident->Chipset >= BLADE3D) { 00099 pTrident->videoFlags = VID_ZOOM_INV ; 00100 if (pTrident->Chipset <= CYBERBLADEI1D) 00101 pTrident->videoFlags |= VID_ZOOM_MINI; 00102 else if (pTrident->Chipset < CYBERBLADEAI1 /* verified EE */ 00103 || pTrident->Chipset > CYBERBLADEAI1D) 00104 pTrident->videoFlags |= VID_OFF_SHIFT_4; 00105 } 00106 00107 newAdaptor = TRIDENTSetupImageVideo(pScreen); 00108 TRIDENTInitOffscreenImages(pScreen); 00109 00110 num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); 00111 00112 if(newAdaptor) { 00113 if(!num_adaptors) { 00114 num_adaptors = 1; 00115 adaptors = &newAdaptor; 00116 } else { 00117 newAdaptors = /* need to free this someplace */ 00118 xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); 00119 if(newAdaptors) { 00120 memcpy(newAdaptors, adaptors, num_adaptors * 00121 sizeof(XF86VideoAdaptorPtr)); 00122 newAdaptors[num_adaptors] = newAdaptor; 00123 adaptors = newAdaptors; 00124 num_adaptors++; 00125 } 00126 } 00127 } 00128 00129 if(num_adaptors) 00130 xf86XVScreenInit(pScreen, adaptors, num_adaptors); 00131 00132 if(newAdaptors) 00133 xfree(newAdaptors); 00134 00135 xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3,"XvFlags: %s %s %s\n", 00136 pTrident->videoFlags & VID_ZOOM_INV ? "VID_ZOOM_INV" : "", 00137 pTrident->videoFlags & VID_ZOOM_MINI ? "VID_ZOOM_MINI" : "", 00138 pTrident->videoFlags & VID_OFF_SHIFT_4 ? "VID_OFF_SHIFT_4" 00139 : ""); 00140 00141 }

void TRIDENTResetVideo ScrnInfoPtr  pScrn  ) 
 

Definition at line 234 of file trident_video.c.

References CYBER9397, CYBERBLADEXPm8, pPriv, PROVIDIA9682, pScrn, TRIDENTPortPrivPtr, TRIDENTPtr, tridentSetVideoContrast(), tridentSetVideoGamma(), and tridentSetVideoParameters().

Referenced by TRIDENTDisplaySurface(), and TRIDENTSetupImageVideo().

00235 { 00236 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 00237 TRIDENTPortPrivPtr pPriv = pTrident->adaptor->pPortPrivates[0].ptr; 00238 int vgaIOBase = VGAHWPTR(pScrn)->IOBase; 00239 int red, green, blue; 00240 int tmp; 00241 00242 OUTW(vgaIOBase + 4, 0x008E); 00243 OUTW(vgaIOBase + 4, 0x008F); 00244 00245 if (pTrident->Chipset >= CYBER9397) { 00246 OUTW(vgaIOBase + 4, 0x80B9); 00247 OUTW(0x3C4, 0xC057); 00248 OUTW(0x3C4, 0x3421); 00249 OUTW(0x3C4, 0x3037); 00250 } else { 00251 if (pTrident->Chipset >= PROVIDIA9682) { 00252 OUTB(0x83C8, 0x57); 00253 OUTB(0x83C6, 0xC0); 00254 OUTW(vgaIOBase + 4, 0x24BE); 00255 } else { 00256 OUTB(0x83C8, 0x37); 00257 OUTB(0x83C6, 0x01); 00258 } 00259 } 00260 00261 if (pTrident->Chipset >= CYBERBLADEXPm8) { 00262 OUTW(0x3C4, 0x007A); 00263 OUTW(0x3C4, 0x007D); 00264 } 00265 00266 switch (pScrn->depth) { 00267 case 8: 00268 VIDEOOUT(pPriv->colorKey, pTrident->keyOffset); 00269 VIDEOOUT(0x00, (pTrident->keyOffset + 1)); 00270 VIDEOOUT(0x00, (pTrident->keyOffset + 2)); 00271 VIDEOOUT(0xFF, (pTrident->keyOffset + 4)); 00272 VIDEOOUT(0x00, (pTrident->keyOffset + 5)); 00273 VIDEOOUT(0x00, (pTrident->keyOffset + 6)); 00274 break; 00275 default: 00276 red = (pPriv->colorKey & pScrn->mask.red) >> pScrn->offset.red; 00277 green = (pPriv->colorKey & pScrn->mask.green) >> pScrn->offset.green; 00278 blue = (pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue; 00279 switch (pScrn->depth) { 00280 case 15: 00281 tmp = (red << 10) | (green << 5) | (blue); 00282 VIDEOOUT((tmp & 0xff), pTrident->keyOffset); 00283 VIDEOOUT((tmp & 0xff00)>>8, (pTrident->keyOffset + 1)); 00284 VIDEOOUT(0x00, (pTrident->keyOffset + 2)); 00285 VIDEOOUT(0xFF, (pTrident->keyOffset + 4)); 00286 VIDEOOUT(0xFF, (pTrident->keyOffset + 5)); 00287 VIDEOOUT(0x00, (pTrident->keyOffset + 6)); 00288 break; 00289 case 16: 00290 tmp = (red << 11) | (green << 5) | (blue); 00291 VIDEOOUT((tmp & 0xff), pTrident->keyOffset); 00292 VIDEOOUT((tmp & 0xff00)>>8, (pTrident->keyOffset + 1)); 00293 VIDEOOUT(0x00, (pTrident->keyOffset + 2)); 00294 VIDEOOUT(0xFF, (pTrident->keyOffset + 4)); 00295 VIDEOOUT(0xFF, (pTrident->keyOffset + 5)); 00296 VIDEOOUT(0x00, (pTrident->keyOffset + 6)); 00297 break; 00298 case 24: 00299 VIDEOOUT(blue, pTrident->keyOffset); 00300 VIDEOOUT(green, (pTrident->keyOffset + 1)); 00301 VIDEOOUT(red, (pTrident->keyOffset + 2)); 00302 VIDEOOUT(0xFF, (pTrident->keyOffset + 4)); 00303 VIDEOOUT(0xFF, (pTrident->keyOffset + 5)); 00304 VIDEOOUT(0xFF, (pTrident->keyOffset + 6)); 00305 break; 00306 } 00307 } 00308 tridentSetVideoGamma(pTrident,pPriv->Gamma,pPriv->Brightness); 00309 tridentSetVideoContrast(pTrident,pPriv->Contrast); 00310 tridentSetVideoParameters(pTrident,pPriv->Brightness,pPriv->Saturation, 00311 pPriv->HUE); 00312 }

Bool RegionsEqual RegionPtr  A,
RegionPtr  B
[static]
 

Definition at line 390 of file trident_video.c.

References _Region::extents, num, _Box::x1, _Box::x2, _Box::y1, and _Box::y2.

00391 { 00392 int *dataA, *dataB; 00393 int num; 00394 00395 num = REGION_NUM_RECTS(A); 00396 if(num != REGION_NUM_RECTS(B)) 00397 return FALSE; 00398 00399 if((A->extents.x1 != B->extents.x1) || 00400 (A->extents.x2 != B->extents.x2) || 00401 (A->extents.y1 != B->extents.y1) || 00402 (A->extents.y2 != B->extents.y2)) 00403 return FALSE; 00404 00405 dataA = (int*)REGION_RECTS(A); 00406 dataB = (int*)REGION_RECTS(B); 00407 00408 while(num--) { 00409 if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) 00410 return FALSE; 00411 dataA += 2; 00412 dataB += 2; 00413 } 00414 00415 return TRUE; 00416 }

void TRIDENTCopyData unsigned char *  src,
unsigned char *  dst,
int  srcPitch,
int  dstPitch,
int  h,
int  w
[static]
 

Definition at line 659 of file trident_video.c.

References dst, h, src, and w.

Referenced by TRIDENTPutImage().

00666 { 00667 w <<= 1; 00668 while(h--) { 00669 memcpy(dst, src, w); 00670 src += srcPitch; 00671 dst += dstPitch; 00672 } 00673 }

void TRIDENTCopyMungedData unsigned char *  src1,
unsigned char *  src2,
unsigned char *  src3,
unsigned char *  dst1,
int  srcPitch,
int  srcPitch2,
int  dstPitch,
int  h,
int  w
[static]
 

Definition at line 676 of file trident_video.c.

References dst, h, i, and w.

Referenced by TRIDENTPutImage().

00686 { 00687 CARD32 *dst = (CARD32*)dst1; 00688 int i, j; 00689 00690 dstPitch >>= 2; 00691 w >>= 1; 00692 00693 for(j = 0; j < h; j++) { 00694 for(i = 0; i < w; i++) { 00695 dst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | 00696 (src3[i] << 8) | (src2[i] << 24); 00697 } 00698 dst += dstPitch; 00699 src1 += srcPitch; 00700 if(j & 1) { 00701 src2 += srcPitch2; 00702 src3 += srcPitch2; 00703 } 00704 } 00705 }

FBLinearPtr TRIDENTAllocateMemory ScrnInfoPtr  pScrn,
FBLinearPtr  linear,
int  size
[static]
 

Definition at line 708 of file trident_video.c.

References FBLinearPtr, pScreen, pScrn, screenInfo, _ScreenInfo::screens, size, xf86AllocateOffscreenLinear(), xf86FreeOffscreenLinear(), xf86PurgeUnlockedOffscreenAreas(), xf86QueryLargestOffscreenLinear(), and xf86ResizeOffscreenLinear().

Referenced by TRIDENTAllocateSurface(), and TRIDENTPutImage().

00712 { 00713 ScreenPtr pScreen; 00714 FBLinearPtr new_linear; 00715 00716 if(linear) { 00717 if(linear->size >= size) 00718 return linear; 00719 00720 if(xf86ResizeOffscreenLinear(linear, size)) 00721 return linear; 00722 00723 xf86FreeOffscreenLinear(linear); 00724 } 00725 00726 pScreen = screenInfo.screens[pScrn->scrnIndex]; 00727 00728 new_linear = xf86AllocateOffscreenLinear(pScreen, size, 16, 00729 NULL, NULL, NULL); 00730 00731 if(!new_linear) { 00732 int max_size; 00733 00734 xf86QueryLargestOffscreenLinear(pScreen, &max_size, 16, 00735 PRIORITY_EXTREME); 00736 00737 if(max_size < size) 00738 return NULL; 00739 00740 xf86PurgeUnlockedOffscreenAreas(pScreen); 00741 new_linear = xf86AllocateOffscreenLinear(pScreen, size, 16, 00742 NULL, NULL, NULL); 00743 } 00744 00745 return new_linear; 00746 }

void TRIDENTDisplayVideo ScrnInfoPtr  pScrn,
int  id,
int  offset,
short  width,
short  height,
int  pitch,
int  x1,
int  y1,
int  x2,
int  y2,
BoxPtr  dstBox,
short  src_w,
short  src_h,
short  drw_w,
short  drw_h
[static]
 

Definition at line 749 of file trident_video.c.

References CYBER9397, offset, pScrn, TRIDENTPtr, width, _Box::x1, _Box::x2, _Box::y1, and _Box::y2.

Referenced by TRIDENTDisplaySurface(), and TRIDENTPutImage().

00759 { 00760 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 00761 int vgaIOBase = VGAHWPTR(pScrn)->IOBase; 00762 int zoomx1, zoomx2, zoomy1, zoomy2; 00763 int tx1,tx2; 00764 int ty1,ty2; 00765 00766 switch(id) { 00767 case 0x35315652: /* RGB15 */ 00768 case 0x36315652: /* RGB16 */ 00769 if (pTrident->Chipset >= CYBER9397) { 00770 OUTW(vgaIOBase + 4, 0x22BF); 00771 } else { 00772 OUTW(vgaIOBase + 4, 0x118F); 00773 } 00774 break; 00775 case FOURCC_YV12: /* YV12 */ 00776 case FOURCC_YUY2: /* YUY2 */ 00777 default: 00778 if (pTrident->Chipset >= CYBER9397) { 00779 OUTW(vgaIOBase + 4, 0x00BF); 00780 } else { 00781 OUTW(vgaIOBase + 4, 0x108F); 00782 } 00783 break; 00784 } 00785 tx1 = dstBox->x1 + pTrident->hsync; 00786 tx2 = dstBox->x2 + pTrident->hsync + pTrident->hsync_rskew; 00787 ty1 = dstBox->y1 + pTrident->vsync - 2; 00788 ty2 = dstBox->y2 + pTrident->vsync + 2 + pTrident->vsync_bskew; 00789 00790 OUTW(vgaIOBase + 4, (tx1 & 0xff) <<8 | 0x86); 00791 OUTW(vgaIOBase + 4, (tx1 & 0xff00) | 0x87); 00792 OUTW(vgaIOBase + 4, (ty1 & 0xff) <<8 | 0x88); 00793 OUTW(vgaIOBase + 4, (ty1 & 0xff00) | 0x89); 00794 OUTW(vgaIOBase + 4, (tx2 & 0xff) <<8 | 0x8A); 00795 OUTW(vgaIOBase + 4, (tx2 & 0xff00) | 0x8B); 00796 OUTW(vgaIOBase + 4, (ty2 & 0xff) <<8 | 0x8C); 00797 OUTW(vgaIOBase + 4, (ty2 & 0xff00) | 0x8D); 00798 00799 offset += (x1 >> 15) & ~0x01; 00800 00801 if (pTrident->videoFlags & VID_OFF_SHIFT_4) 00802 offset = offset >> 4; 00803 else 00804 offset = offset >> 3; 00805 00806 OUTW(vgaIOBase + 4, (((width<<1) & 0xff)<<8) | 0x90); 00807 OUTW(vgaIOBase + 4, ((width<<1) & 0xff00) | 0x91); 00808 OUTW(vgaIOBase + 4, ((offset) & 0xff) << 8 | 0x92); 00809 OUTW(vgaIOBase + 4, ((offset) & 0xff00) | 0x93); 00810 OUTW(vgaIOBase + 4, ((offset) & 0xff0000) >> 8 | 0x94); 00811 00812 /* Horizontal Zoom */ 00813 if (pTrident->videoFlags & VID_ZOOM_INV) { 00814 if ((pTrident->videoFlags & VID_ZOOM_MINI) && src_w > drw_w) 00815 zoomx2 = (int)((float)drw_w/(float)src_w * 1024) 00816 | (((int)((float)src_w/(float)drw_w) - 1)&7)<<10 | 0x8000; 00817 else 00818 zoomx2 = (int)(float)src_w/(float)drw_w * 1024; 00819 00820 OUTW(vgaIOBase + 4, (zoomx2&0xff)<<8 | 0x80); 00821 OUTW(vgaIOBase + 4, (zoomx2&0x9f00) | 0x81); 00822 } else { 00823 if (drw_w == src_w) { 00824 OUTW(vgaIOBase + 4, 0x0080); 00825 OUTW(vgaIOBase + 4, 0x0081); 00826 } else 00827 if (drw_w > src_w) { 00828 float z; 00829 00830 z = (float)drw_w/(float)src_w - 1; 00831 zoomx1 = z; 00832 zoomx2 = (z - (int)zoomx1 ) * 1024; 00833 00834 OUTW(vgaIOBase + 4, (zoomx2&0xff)<<8 | 0x80); 00835 OUTW(vgaIOBase + 4, (zoomx1&0x0f)<<10 | (zoomx2&0x0300) |0x81); 00836 } else { 00837 zoomx1 = ((float)drw_w/(float)src_w); 00838 zoomx2 = ( ((float)drw_w/(float)src_w) - (int)zoomx1 ) * 1024; 00839 OUTW(vgaIOBase + 4, (zoomx2&0xff)<<8 | 0x80); 00840 OUTW(vgaIOBase + 4, (zoomx2&0x0300)| 00841 (((int)((float)src_w/(float)drw_w)-1)&7)<<10 | 0x8081); 00842 } 00843 } 00844 00845 /* Vertical Zoom */ 00846 if (pTrident->videoFlags & VID_ZOOM_INV) { 00847 if ((pTrident->videoFlags & VID_ZOOM_MINI) && src_h > drw_h) 00848 zoomy2 = (int)(( ((float)drw_h/(float)src_h)) * 1024) 00849 | (((int)((float)src_h/(float)drw_h)-1)&7)<<10 00850 | 0x8000; 00851 else 00852 zoomy2 = ( ((float)src_h/(float)drw_h)) * 1024; 00853 OUTW(vgaIOBase + 4, (zoomy2&0xff)<<8 | 0x82); 00854 OUTW(vgaIOBase + 4, (zoomy2&0x9f00) | 0x0083); 00855 } else { 00856 if (drw_h == src_h) { 00857 OUTW(vgaIOBase + 4, 0x0082); 00858 OUTW(vgaIOBase + 4, 0x0083); 00859 } else 00860 if (drw_h > src_h) { 00861 float z; 00862 00863 z = (float)drw_h/(float)src_h - 1; 00864 zoomy1 = z; 00865 zoomy2 = (z - (int)zoomy1 ) * 1024; 00866 00867 OUTW(vgaIOBase + 4, (zoomy2&0xff)<<8 | 0x82); 00868 OUTW(vgaIOBase + 4, (zoomy1&0x0f)<<10 | (zoomy2&0x0300) |0x83); 00869 } else { 00870 zoomy1 = ((float)drw_h/(float)src_h); 00871 zoomy2 = ( ((float)drw_h/(float)src_h) - (int)zoomy1 ) * 1024; 00872 OUTW(vgaIOBase + 4, (zoomy2&0xff)<<8 | 0x82); 00873 OUTW(vgaIOBase + 4, (zoomy2&0x0300)| 00874 (((int)((float)src_h/(float)drw_h)-1)&7)<<10 | 0x8083); 00875 } 00876 } 00877 00878 if (pTrident->Chipset >= CYBER9397) { 00879 int lb = (width+2) >> 2; 00880 00881 OUTW(vgaIOBase + 4, ((lb & 0x100)>>1) | 0x0895); 00882 OUTW(vgaIOBase + 4, (lb & 0xFF)<<8 | 0x0096); 00883 00884 if (src_w > 384) { 00885 OUTW(0x3C4, 0x0497); /* 2x line buffers */ 00886 } else { 00887 OUTW(0x3C4, 0x0097); /* 1x line buffers */ 00888 } 00889 OUTW(vgaIOBase + 4, 0x0097); 00890 OUTW(vgaIOBase + 4, 0x00BA); 00891 OUTW(vgaIOBase + 4, 0x00BB); 00892 OUTW(vgaIOBase + 4, 0xFFBC); 00893 OUTW(vgaIOBase + 4, 0xFFBD); 00894 OUTW(vgaIOBase + 4, 0x04BE); 00895 OUTW(vgaIOBase + 4, 0xD48E); 00896 OUTW(vgaIOBase + 4, 0x208F); 00897 } else { 00898 00899 OUTW(vgaIOBase + 4, ((((id == FOURCC_YV12) || (id == FOURCC_YUY2)) 00900 ? (width >> 2) : (width >> 6)) << 8) | 0x95); 00901 OUTW(vgaIOBase + 4, ((((id == FOURCC_YV12) || (id == FOURCC_YUY2)) 00902 ? ((width+2) >> 2) : ((width+2) >> 6)) << 8) |0x96); 00903 00904 OUTW(vgaIOBase + 4, 0x938E); 00905 OUTB(0x83C8, 0x00); 00906 OUTB(0x83C6, 0x95); 00907 } 00908 }

int TRIDENTAllocateSurface ScrnInfoPtr  pScrn,
int  id,
unsigned short  w,
unsigned short  h,
XF86SurfacePtr  surface
[static]
 

Definition at line 1076 of file trident_video.c.

References FBLinearPtr, h, _Screen::id, OffscreenPrivPtr, pointer, pPriv, pScrn, size, TRIDENTAllocateMemory(), w, xalloc(), xf86FreeOffscreenLinear(), and xfree().

Referenced by TRIDENTInitOffscreenImages().

01082 { 01083 FBLinearPtr linear; 01084 int pitch, fbpitch, size, bpp; 01085 OffscreenPrivPtr pPriv; 01086 01087 if((w > 1024) || (h > 1024)) 01088 return BadAlloc; 01089 01090 w = (w + 1) & ~1; 01091 pitch = ((w << 1) + 15) & ~15; 01092 bpp = pScrn->bitsPerPixel >> 3; 01093 fbpitch = bpp * pScrn->displayWidth; 01094 size = ((pitch * h) + bpp - 1) / bpp; 01095 01096 if(!(linear = TRIDENTAllocateMemory(pScrn, NULL, size))) 01097 return BadAlloc; 01098 01099 surface->width = w; 01100 surface->height = h; 01101 01102 if(!(surface->pitches = xalloc(sizeof(int)))) { 01103 xf86FreeOffscreenLinear(linear); 01104 return BadAlloc; 01105 } 01106 if(!(surface->offsets = xalloc(sizeof(int)))) { 01107 xfree(surface->pitches); 01108 xf86FreeOffscreenLinear(linear); 01109 return BadAlloc; 01110 } 01111 if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { 01112 xfree(surface->pitches); 01113 xfree(surface->offsets); 01114 xf86FreeOffscreenLinear(linear); 01115 return BadAlloc; 01116 } 01117 01118 pPriv->linear = linear; 01119 pPriv->isOn = FALSE; 01120 01121 surface->pScrn = pScrn; 01122 surface->id = id; 01123 surface->pitches[0] = pitch; 01124 surface->offsets[0] = linear->offset * bpp; 01125 surface->devPrivate.ptr = (pointer)pPriv; 01126 01127 return Success; 01128 }

int TRIDENTStopSurface XF86SurfacePtr  surface  )  [static]
 

Definition at line 1131 of file trident_video.c.

References OffscreenPrivPtr, pPriv, and TRIDENTPtr.

Referenced by TRIDENTFreeSurface(), and TRIDENTInitOffscreenImages().

01133 { 01134 OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; 01135 01136 if(pPriv->isOn) { 01137 TRIDENTPtr pTrident = TRIDENTPTR(surface->pScrn); 01138 int vgaIOBase = VGAHWPTR(surface->pScrn)->IOBase; 01139 OUTW(vgaIOBase + 4, 0x008E); 01140 OUTW(vgaIOBase + 4, 0x008F); 01141 pPriv->isOn = FALSE; 01142 } 01143 01144 return Success; 01145 }

int TRIDENTFreeSurface XF86SurfacePtr  surface  )  [static]
 

Definition at line 1149 of file trident_video.c.

References OffscreenPrivPtr, pPriv, TRIDENTStopSurface(), xf86FreeOffscreenLinear(), and xfree().

Referenced by TRIDENTInitOffscreenImages().

01151 { 01152 OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; 01153 01154 if(pPriv->isOn) 01155 TRIDENTStopSurface(surface); 01156 xf86FreeOffscreenLinear(pPriv->linear); 01157 xfree(surface->pitches); 01158 xfree(surface->offsets); 01159 xfree(surface->devPrivate.ptr); 01160 01161 return Success; 01162 }

int TRIDENTGetSurfaceAttribute ScrnInfoPtr  pScrn,
Atom  attribute,
INT32 value
[static]
 

Definition at line 1165 of file trident_video.c.

References pointer, pScrn, TRIDENTGetPortAttribute(), and value.

Referenced by TRIDENTInitOffscreenImages().

01169 { 01170 return TRIDENTGetPortAttribute(pScrn, attribute, value, 01171 (pointer)(GET_PORT_PRIVATE(pScrn))); 01172 }

int TRIDENTSetSurfaceAttribute ScrnInfoPtr  pScrn,
Atom  attribute,
INT32  value
[static]
 

Definition at line 1175 of file trident_video.c.

References pointer, pScrn, TRIDENTSetPortAttribute(), and value.

Referenced by TRIDENTInitOffscreenImages().

01179 { 01180 return TRIDENTSetPortAttribute(pScrn, attribute, value, 01181 (pointer)(GET_PORT_PRIVATE(pScrn))); 01182 }

int TRIDENTDisplaySurface XF86SurfacePtr  surface,
short  src_x,
short  src_y,
short  drw_x,
short  drw_y,
short  src_w,
short  src_h,
short  drw_w,
short  drw_h,
RegionPtr  clipBoxes
[static]
 

Definition at line 1185 of file trident_video.c.

References currentTime, _Screen::id, INT32, _TimeStamp::milliseconds, OffscreenPrivPtr, pPriv, pScrn, TRIDENTDisplayVideo(), tridentFixFrame(), TRIDENTPortPrivPtr, TRIDENTPtr, TRIDENTResetVideo(), TRIDENTVideoTimerCallback(), UpdateCurrentTime(), _Box::x1, _Box::x2, xf86XVClipVideoHelper(), xf86XVFillKeyHelper(), _Box::y1, and _Box::y2.

Referenced by TRIDENTInitOffscreenImages().

01192 { 01193 OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; 01194 ScrnInfoPtr pScrn = surface->pScrn; 01195 TRIDENTPtr pTrident = TRIDENTPTR(pScrn); 01196 TRIDENTPortPrivPtr portPriv = pTrident->adaptor->pPortPrivates[0].ptr; 01197 INT32 x1, y1, x2, y2; 01198 BoxRec dstBox; 01199 01200 x1 = src_x; 01201 x2 = src_x + src_w; 01202 y1 = src_y; 01203 y2 = src_y + src_h; 01204 01205 dstBox.x1 = drw_x; 01206 dstBox.x2 = drw_x + drw_w; 01207 dstBox.y1 = drw_y; 01208 dstBox.y2 = drw_y + drw_h; 01209 01210 if(!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, 01211 surface->width, surface->height)) 01212 { 01213 return Success; 01214 } 01215 01216 dstBox.x1 -= pScrn->frameX0; 01217 dstBox.x2 -= pScrn->frameX0; 01218 dstBox.y1 -= pScrn->frameY0; 01219 dstBox.y2 -= pScrn->frameY0; 01220 01221 TRIDENTResetVideo(pScrn); 01222 01223 tridentFixFrame(pScrn,&portPriv->fixFrame); 01224 TRIDENTDisplayVideo(pScrn, surface->id, surface->offsets[0], 01225 surface->width, surface->height, surface->pitches[0], 01226 x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); 01227 01228 xf86XVFillKeyHelper(pScrn->pScreen, portPriv->colorKey, clipBoxes); 01229 01230 pPriv->isOn = TRUE; 01231 /* we've prempted the XvImage stream so set its free timer */ 01232 if(portPriv->videoStatus & CLIENT_VIDEO_ON) { 01233 REGION_EMPTY(pScrn->pScreen, &portPriv->clip); 01234 UpdateCurrentTime(); 01235 portPriv->videoStatus = FREE_TIMER; 01236 portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; 01237 pTrident->VideoTimerCallback = TRIDENTVideoTimerCallback; 01238 } 01239 01240 return Success; 01241 }


Variable Documentation

Atom xvColorKey [static]
 

Definition at line 75 of file trident_video.c.

Referenced by TRIDENTGetPortAttribute(), TRIDENTSetPortAttribute(), and TRIDENTSetupImageVideo().

Atom xvSaturation [static]
 

Definition at line 75 of file trident_video.c.

Referenced by TRIDENTGetPortAttribute(), TRIDENTSetPortAttribute(), and TRIDENTSetupImageVideo().

Atom xvBrightness [static]
 

Definition at line 75 of file trident_video.c.

Referenced by TRIDENTGetPortAttribute(), TRIDENTSetPortAttribute(), and TRIDENTSetupImageVideo().

Atom xvHUE [static]
 

Definition at line 75 of file trident_video.c.

Referenced by TRIDENTGetPortAttribute(), TRIDENTSetPortAttribute(), and TRIDENTSetupImageVideo().

Atom xvGamma [static]
 

Definition at line 75 of file trident_video.c.

Referenced by TRIDENTGetPortAttribute(), TRIDENTSetPortAttribute(), and TRIDENTSetupImageVideo().

Atom xvContrast [static]
 

Definition at line 75 of file trident_video.c.

Referenced by TRIDENTGetPortAttribute(), TRIDENTSetPortAttribute(), and TRIDENTSetupImageVideo().

XF86VideoEncodingRec DummyEncoding[1] [static]
 

Initial value:

{ { 0, "XV_IMAGE", 1024, 1024, {1, 1} } }

Definition at line 144 of file trident_video.c.

Referenced by TRIDENTSetupImageVideo().

XF86VideoFormatRec Formats[NUM_FORMATS] [static]
 

Initial value:

{ {8, PseudoColor}, {15, TrueColor}, {16, TrueColor}, {24, TrueColor} }

Definition at line 156 of file trident_video.c.

Referenced by TRIDENTSetupImageVideo().

XF86AttributeRec Attributes[NUM_ATTRIBUTES] [static]
 

Initial value:

{ {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, {XvSettable | XvGettable, 0, 187, "XV_SATURATION"}, {XvSettable | XvGettable, 0, 0x3F, "XV_BRIGHTNESS"}, {XvSettable | XvGettable, 0, 360 , "XV_HUE"}, {XvSettable | XvGettable, -128, 127, "XV_GAMMA"}, {XvSettable | XvGettable, 0, 7, "XV_CONTRAST"} }

Definition at line 163 of file trident_video.c.

Referenced by TRIDENTInitOffscreenImages(), and TRIDENTSetupImageVideo().

XF86ImageRec Images[NUM_IMAGES] [static]
 

Definition at line 175 of file trident_video.c.

Referenced by TRIDENTInitOffscreenImages(), and TRIDENTSetupImageVideo().


Generated on Tue May 11 04:04:10 2004 for XFree86 by doxygen 1.3.7