diff options
author | tsi <tsi> | 2005-08-28 19:49:23 +0000 |
---|---|---|
committer | tsi <tsi> | 2005-08-28 19:49:23 +0000 |
commit | 91b27781dd2c38f5b93bed22e6bf136af0c0a09b (patch) | |
tree | cbcf548fa07cc0bc48029b7b56ced98c43c0a4d6 | |
parent | f1673905411b0b2b5af0993e3e8f110177c74e80 (diff) |
Cosmetic changes
-rw-r--r-- | programs/Xserver/hw/xfree86/vbe/vbe.c | 404 | ||||
-rw-r--r-- | programs/Xserver/hw/xfree86/vbe/vbe.h | 98 | ||||
-rw-r--r-- | programs/Xserver/hw/xfree86/vbe/vbe_module.c | 50 |
3 files changed, 280 insertions, 272 deletions
diff --git a/programs/Xserver/hw/xfree86/vbe/vbe.c b/programs/Xserver/hw/xfree86/vbe/vbe.c index d2657ab43..b6ebf5fc6 100644 --- a/programs/Xserver/hw/xfree86/vbe/vbe.c +++ b/programs/Xserver/hw/xfree86/vbe/vbe.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe.c,v 1.14 2005/08/19 00:36:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe.c,v 1.15 2005/08/20 15:31:02 tsi Exp $ */ /* * XFree86 vbe module @@ -114,7 +114,7 @@ VBEExtendedInit(xf86Int10InfoPtr pInt, int entityIndex, int Flags) page = xf86Int10AllocPages(pInt, 1, &RealOff); if (!page) goto error; vbe = (vbeControllerInfoPtr) page; - memcpy(vbe->VbeSignature, vbeVersionString, 4); + (void) memcpy(vbe->VbeSignature, vbeVersionString, 4); pInt->ax = 0x4F00; pInt->es = SEG_ADDR(RealOff); @@ -276,11 +276,12 @@ vbeProbeDDC(vbeInfoPtr pVbe) xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC Screen blanked" "for data transfer\n"); pVbe->ddc_blank = TRUE; - } else + } else { pVbe->ddc_blank = FALSE; + } xf86DrvMsgVerb(screen, X_INFO, 3, - "VESA VBE DDC transfer in appr. %x sec.\n", + "VESA VBE DDC transfer in approximately %x second(s)\n", (pVbe->pInt10->bx >> 8) & 0xff); } @@ -315,7 +316,7 @@ vbeReadEDID(vbeInfoPtr pVbe) if (!page) return NULL; options = xnfalloc(sizeof(VBEOptions)); - (void)memcpy(options, VBEOptions, sizeof(VBEOptions)); + (void) memcpy(options, VBEOptions, sizeof(VBEOptions)); xf86ProcessOptions(screen, xf86Screens[screen]->options, options); xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe); xf86GetOptValBool(options, VBEOPT_NODDC, &noddc); @@ -330,8 +331,8 @@ vbeReadEDID(vbeInfoPtr pVbe) if (!vbeProbeDDC(pVbe)) goto error; - memset(page, 0, sizeof(vbeInfoPtr)); - strcpy(page, vbeVersionString); + (void) memset(page, 0, sizeof(vbeInfoPtr)); + (void) memcpy(page, vbeVersionString, 4); pVbe->pInt10->ax = 0x4F15; pVbe->pInt10->bx = 0x01; @@ -351,13 +352,13 @@ vbeReadEDID(vbeInfoPtr pVbe) case 0x0: xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC read successfully\n"); tmp = (unsigned char *)xnfalloc(128); - memcpy(tmp, page, 128); + (void) memcpy(tmp, page, 128); break; case 0x100: xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC read failed\n"); break; default: - xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC unkown failure %i\n", + xf86DrvMsgVerb(screen, X_INFO, 3, "VESA VBE DDC unknown failure %i\n", pVbe->pInt10->ax & 0xff00); break; } @@ -398,17 +399,9 @@ vbeDoEDID(vbeInfoPtr pVbe, pointer pDDCModule) return pMonitor; } - VbeInfoBlock * VBEGetVBEInfo(vbeInfoPtr pVbe) { - VbeInfoBlock *block = NULL; - int i, pStr, pModes; - char *str; - CARD16 major, *modes; - - bzero(pVbe->memory, sizeof(VbeInfoBlock)); - /* Input: AH := 4Fh Super VGA support @@ -420,10 +413,13 @@ VBEGetVBEInfo(vbeInfoPtr pVbe) (All other registers are preserved) */ - ((char*)pVbe->memory)[0] = 'V'; - ((char*)pVbe->memory)[1] = 'B'; - ((char*)pVbe->memory)[2] = 'E'; - ((char*)pVbe->memory)[3] = '2'; + VbeInfoBlock *block = NULL; + int i, pStr, pModes; + char *str, *pBlock = pVbe->memory; + CARD16 *modes; + + (void) memset(pBlock, 0, sizeof(VbeInfoBlock)); + (void) memcpy(pBlock, vbeVersionString, 4); pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f00; @@ -432,27 +428,29 @@ VBEGetVBEInfo(vbeInfoPtr pVbe) xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) - return (NULL); + return NULL; block = xnfcalloc(sizeof(VbeInfoBlock), 1); - block->VESASignature[0] = ((char*)pVbe->memory)[0]; - block->VESASignature[1] = ((char*)pVbe->memory)[1]; - block->VESASignature[2] = ((char*)pVbe->memory)[2]; - block->VESASignature[3] = ((char*)pVbe->memory)[3]; + block->VESASignature[0] = pBlock[0]; + block->VESASignature[1] = pBlock[1]; + block->VESASignature[2] = pBlock[2]; + block->VESASignature[3] = pBlock[3]; - block->VESAVersion = B_O16(((char*)pVbe->memory)[4]); - major = (unsigned)block->VESAVersion >> 8; + block->VESAVersion = B_O16(pBlock[4]); - pStr = B_O32(((char*)pVbe->memory)[6]); + pStr = B_O32(pBlock[6]); str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); block->OEMStringPtr = strdup(str); - block->Capabilities[0] = ((char*)pVbe->memory)[10]; - block->Capabilities[1] = ((char*)pVbe->memory)[11]; - block->Capabilities[2] = ((char*)pVbe->memory)[12]; - block->Capabilities[3] = ((char*)pVbe->memory)[13]; + block->Capabilities[0] = pBlock[10]; + block->Capabilities[1] = pBlock[11]; + block->Capabilities[2] = pBlock[12]; + block->Capabilities[3] = pBlock[13]; - pModes = B_O32(((char*)pVbe->memory)[14]); + /* + * XXX This doesn't check if the mode list overflows. + */ + pModes = B_O32(pBlock[14]); modes = xf86int10Addr(pVbe->pInt10, FARP(pModes)); for (i = 0; modes[i] != 0xffff; i++); block->VideoModePtr = xnfalloc(sizeof(CARD16) * i + 1); @@ -460,31 +458,35 @@ VBEGetVBEInfo(vbeInfoPtr pVbe) block->VideoModePtr[i] = B_O16(modes[i]); block->VideoModePtr[i] = 0xffff; - block->TotalMemory = B_O16(((char*)pVbe->memory)[18]); + block->TotalMemory = B_O16(pBlock[18]); block->TotalMemory += block->TotalMemory & 1U; - if (major < 2) { - memcpy(&block->OemSoftwareRev, (char*)pVbe->memory + 20, 236); + if (block->VESAVersion < 0x0200) { + (void) memcpy(&block->OemSoftwareRev, pBlock + 20, 236); } else { - block->OemSoftwareRev = B_O16(((char*)pVbe->memory)[20]); + block->OemSoftwareRev = B_O16(pBlock[20]); - pStr = B_O32(((char*)pVbe->memory)[22]); + /* + * XXX Consider using strndup for these three. + */ + + pStr = B_O32(pBlock[22]); str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); block->OemVendorNamePtr = strdup(str); - pStr = B_O32(((char*)pVbe->memory)[26]); + pStr = B_O32(pBlock[26]); str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); block->OemProductNamePtr = strdup(str); - pStr = B_O32(((char*)pVbe->memory)[30]); + pStr = B_O32(pBlock[30]); str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); block->OemProductRevPtr = strdup(str); - memcpy(&block->Reserved, (char*)pVbe->memory + 34, 222); - memcpy(&block->OemData, (char*)pVbe->memory + 256, 256); + (void) memcpy(&block->Reserved, pBlock + 34, 222); + (void) memcpy(&block->OemData, pBlock + 256, 256); } - return (block); + return block; } void @@ -525,13 +527,15 @@ VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *block) Output: AX = Status (All other registers are preserved) */ + xf86Int10InfoPtr pInt10 = pVbe->pInt10; - CARD8 *pBlock = pVbe->memory; pInt10->num = 0x10; pInt10->ax = 0x4f02; pInt10->bx = mode & ~(1 << 11); if (block) { + CARD8 *pBlock = pVbe->memory; + pInt10->bx |= 1 << 11; pInt10->es = SEG_ADDR(pVbe->real_mode_base); pInt10->di = SEG_OFF(pVbe->real_mode_base); @@ -560,7 +564,7 @@ VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *block) pBlock[17] = block->RefreshRate; pBlock[18] = block->RefreshRate >> 8; - (void)memcpy(pBlock + 19, block->Reserved, 40); + (void) memcpy(pBlock + 19, block->Reserved, 40); } xf86ExecX86int10(pInt10); @@ -581,40 +585,39 @@ VBEGetVBEMode(vbeInfoPtr pVbe, int *mode) BX := Current video mode (All other registers are preserved) */ + pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f03; xf86ExecX86int10(pVbe->pInt10); - if (R16(pVbe->pInt10->ax) == 0x4f) { - *mode = R16(pVbe->pInt10->bx); - - return (TRUE); - } + if (R16(pVbe->pInt10->ax) != 0x4f) + return FALSE; - return (FALSE); + *mode = R16(pVbe->pInt10->bx); + return TRUE; } VbeModeInfoBlock * VBEGetModeInfo(vbeInfoPtr pVbe, int mode) { - VbeModeInfoBlock *block = NULL; - - bzero(pVbe->memory, sizeof(VbeModeInfoBlock)); - /* Input: AH := 4Fh Super VGA support AL := 01h Return Super VGA mode information CX := Super VGA video mode - (mode number must be one of those returned by Function 0) + (mode number must be one returned by Function 0) ES:DI := Pointer to buffer Output: AX := status (All other registers are preserved) */ - (void) memset(pVbe->memory, 0, 256); + + VbeModeInfoBlock *block; + char *pBlock = pVbe->memory; + + (void) memset(pBlock, 0, 256); pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f01; @@ -623,73 +626,75 @@ VBEGetModeInfo(vbeInfoPtr pVbe, int mode) pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) - return (NULL); + return NULL; block = xnfcalloc(sizeof(VbeModeInfoBlock), 1); - block->ModeAttributes = B_O16(((char*)pVbe->memory)[0]); - block->WinAAttributes = ((char*)pVbe->memory)[2]; - block->WinBAttributes = ((char*)pVbe->memory)[3]; - block->WinGranularity = B_O16(((char*)pVbe->memory)[4]); - block->WinSize = B_O16(((char*)pVbe->memory)[6]); - block->WinASegment = B_O16(((char*)pVbe->memory)[8]); - block->WinBSegment = B_O16(((char*)pVbe->memory)[10]); - block->WinFuncPtr = B_O32(((char*)pVbe->memory)[12]); - block->BytesPerScanline = B_O16(((char*)pVbe->memory)[16]); + block->ModeAttributes = B_O16(pBlock[0]); + block->WinAAttributes = pBlock[2]; + block->WinBAttributes = pBlock[3]; + block->WinGranularity = B_O16(pBlock[4]); + block->WinSize = B_O16(pBlock[6]); + block->WinASegment = B_O16(pBlock[8]); + block->WinBSegment = B_O16(pBlock[10]); + block->WinFuncPtr = B_O32(pBlock[12]); + block->BytesPerScanline = B_O16(pBlock[16]); /* mandatory information for VBE 1.2 and above */ - block->XResolution = B_O16(((char*)pVbe->memory)[18]); - block->YResolution = B_O16(((char*)pVbe->memory)[20]); - block->XCharSize = ((char*)pVbe->memory)[22]; - block->YCharSize = ((char*)pVbe->memory)[23]; - block->NumberOfPlanes = ((char*)pVbe->memory)[24]; - block->BitsPerPixel = ((char*)pVbe->memory)[25]; - block->NumberOfBanks = ((char*)pVbe->memory)[26]; - block->MemoryModel = ((char*)pVbe->memory)[27]; - block->BankSize = ((char*)pVbe->memory)[28]; - block->NumberOfImages = ((char*)pVbe->memory)[29]; - block->Reserved = ((char*)pVbe->memory)[30]; + block->XResolution = B_O16(pBlock[18]); + block->YResolution = B_O16(pBlock[20]); + block->XCharSize = pBlock[22]; + block->YCharSize = pBlock[23]; + block->NumberOfPlanes = pBlock[24]; + block->BitsPerPixel = pBlock[25]; + block->NumberOfBanks = pBlock[26]; + block->MemoryModel = pBlock[27]; + block->BankSize = pBlock[28]; + block->NumberOfImages = pBlock[29]; + block->Reserved = pBlock[30]; /* Direct color fields (required for direct/6 and YUV/7 memory models) */ - block->RedMaskSize = ((char*)pVbe->memory)[31]; - block->RedFieldPosition = ((char*)pVbe->memory)[32]; - block->GreenMaskSize = ((char*)pVbe->memory)[33]; - block->GreenFieldPosition = ((char*)pVbe->memory)[34]; - block->BlueMaskSize = ((char*)pVbe->memory)[35]; - block->BlueFieldPosition = ((char*)pVbe->memory)[36]; - block->RsvdMaskSize = ((char*)pVbe->memory)[37]; - block->RsvdFieldPosition = ((char*)pVbe->memory)[38]; - block->DirectColorModeInfo = ((char*)pVbe->memory)[39]; + block->RedMaskSize = pBlock[31]; + block->RedFieldPosition = pBlock[32]; + block->GreenMaskSize = pBlock[33]; + block->GreenFieldPosition = pBlock[34]; + block->BlueMaskSize = pBlock[35]; + block->BlueFieldPosition = pBlock[36]; + block->RsvdMaskSize = pBlock[37]; + block->RsvdFieldPosition = pBlock[38]; + block->DirectColorModeInfo = pBlock[39]; + + if (pVbe->version < 0x0200) { + (void) memcpy(&block->PhysBasePtr, pBlock + 40, 216); + return block; + } /* Mandatory information for VBE 2.0 and above */ - if (pVbe->version >= 0x200) { - block->PhysBasePtr = B_O32(((char*)pVbe->memory)[40]); - block->Reserved32 = B_O32(((char*)pVbe->memory)[44]); - block->Reserved16 = B_O16(((char*)pVbe->memory)[48]); - - /* Mandatory information for VBE 3.0 and above */ - if (pVbe->version >= 0x300) { - block->LinBytesPerScanLine = B_O16(((char*)pVbe->memory)[50]); - block->BnkNumberOfImagePages = ((char*)pVbe->memory)[52]; - block->LinNumberOfImagePages = ((char*)pVbe->memory)[53]; - block->LinRedMaskSize = ((char*)pVbe->memory)[54]; - block->LinRedFieldPosition = ((char*)pVbe->memory)[55]; - block->LinGreenMaskSize = ((char*)pVbe->memory)[56]; - block->LinGreenFieldPosition = ((char*)pVbe->memory)[57]; - block->LinBlueMaskSize = ((char*)pVbe->memory)[58]; - block->LinBlueFieldPosition = ((char*)pVbe->memory)[59]; - block->LinRsvdMaskSize = ((char*)pVbe->memory)[60]; - block->LinRsvdFieldPosition = ((char*)pVbe->memory)[61]; - block->MaxPixelClock = B_O32(((char*)pVbe->memory)[62]); - memcpy(&block->Reserved2, (char*)pVbe->memory + 66, 188); - } - else - memcpy(&block->LinBytesPerScanLine, (char*)pVbe->memory + 50, 206); + block->PhysBasePtr = B_O32(pBlock[40]); + block->Reserved32 = B_O32(pBlock[44]); + block->Reserved16 = B_O16(pBlock[48]); + + if (pVbe->version < 0x0300) { + (void) memcpy(&block->LinBytesPerScanLine, pBlock + 50, 206); + return block; } - else - memcpy(&block->PhysBasePtr, (char*)pVbe->memory + 40, 216); - return (block); + /* Mandatory information for VBE 3.0 and above */ + block->LinBytesPerScanLine = B_O16(pBlock[50]); + block->BnkNumberOfImagePages = pBlock[52]; + block->LinNumberOfImagePages = pBlock[53]; + block->LinRedMaskSize = pBlock[54]; + block->LinRedFieldPosition = pBlock[55]; + block->LinGreenMaskSize = pBlock[56]; + block->LinGreenFieldPosition = pBlock[57]; + block->LinBlueMaskSize = pBlock[58]; + block->LinBlueFieldPosition = pBlock[59]; + block->LinRsvdMaskSize = pBlock[60]; + block->LinRsvdFieldPosition = pBlock[61]; + block->MaxPixelClock = B_O32(pBlock[62]); + (void) memcpy(&block->Reserved2, pBlock + 66, 188); + + return block; } void @@ -718,7 +723,6 @@ VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, BX = Number of 64-byte blocks to hold the state buffer (All other registers are preserved) - Input: AH := 4Fh Super VGA support AL := 04h Save/restore Super VGA video state @@ -730,7 +734,6 @@ VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, AX := Status (All other registers are preserved) - Input: AH := 4Fh Super VGA support AL := 04h Save/restore Super VGA video state @@ -743,58 +746,65 @@ VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, (All other registers are preserved) */ - if ((pVbe->version & 0xff00) > 0x100) { - int screen = pVbe->pInt10->scrnIndex; - if (function == MODE_QUERY || - (function == MODE_SAVE && !*memory)) { - /* Query amount of memory to save state */ - - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f04; - pVbe->pInt10->dx = 0; - pVbe->pInt10->cx = 0x000f; - xf86ExecX86int10(pVbe->pInt10); - if (R16(pVbe->pInt10->ax) != 0x4f) - return (FALSE); - - if (function == MODE_SAVE) { - int npages = (R16(pVbe->pInt10->bx) * 64) / 4096 + 1; - if ((*memory = xf86Int10AllocPages(pVbe->pInt10, npages, - real_mode_pages)) == NULL) { - xf86DrvMsg(screen, X_ERROR, - "Cannot allocate memory to save SVGA state.\n"); - return (FALSE); - } + xf86Int10InfoPtr pInt10; + + /* Earlier VBE versions won't give us an error indication */ + if (pVbe->version < 0x0200) + return TRUE; + + pInt10 = pVbe->pInt10; + + if ((function == MODE_QUERY) || ((function == MODE_SAVE) && !*memory)) { + /* Query amount of memory to save state */ + + pInt10->num = 0x10; + pInt10->ax = 0x4f04; + pInt10->dx = 0; + pInt10->cx = 0x000f; + xf86ExecX86int10(pInt10); + if (R16(pInt10->ax) != 0x4f) + return FALSE; + + if (function == MODE_SAVE) { + int npages = (R16(pInt10->bx) * 64) / 4096 + 1; + + *memory = xf86Int10AllocPages(pInt10, npages, real_mode_pages); + if (!*memory) { + xf86DrvMsg(pInt10->scrnIndex, X_ERROR, + "Cannot allocate memory to save SVGA state.\n"); + return FALSE; } - *size = pVbe->pInt10->bx * 64; } - /* Save/Restore Super VGA state */ - if (function != MODE_QUERY) { - - if (!*memory) return FALSE; - pVbe->pInt10->num = 0x10; - pVbe->pInt10->ax = 0x4f04; - switch (function) { - case MODE_SAVE: - pVbe->pInt10->dx = 1; - break; - case MODE_RESTORE: - pVbe->pInt10->dx = 2; - break; - case MODE_QUERY: - return FALSE; - } - pVbe->pInt10->cx = 0x000f; + *size = pInt10->bx * 64; + + if (function == MODE_QUERY) + return TRUE; + } - pVbe->pInt10->es = SEG_ADDR(*real_mode_pages); - pVbe->pInt10->bx = SEG_OFF(*real_mode_pages); - xf86ExecX86int10(pVbe->pInt10); - return (R16(pVbe->pInt10->ax) == 0x4f); + /* Save/Restore Super VGA state */ + if (!*memory) + return FALSE; - } + pInt10->num = 0x10; + pInt10->ax = 0x4f04; + pInt10->cx = 0x000f; + pInt10->es = SEG_ADDR(*real_mode_pages); + pInt10->bx = SEG_OFF(*real_mode_pages); + + switch (function) { + case MODE_SAVE: + pInt10->dx = 1; + break; + case MODE_RESTORE: + pInt10->dx = 2; + break; + default: + return FALSE; } - return TRUE; + + xf86ExecX86int10(pInt10); + return (R16(pInt10->ax) == 0x4f); } Bool @@ -804,28 +814,30 @@ VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window) Input: AH := 4Fh Super VGA support AL := 05h + BH := 00h Set memory window + := 01h Get memory window + BL := 00h Window A + := 01h Window B + DX := Window number to set Output: + AX := Status + DX := Window number retrieved */ + pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f05; pVbe->pInt10->bx = window; pVbe->pInt10->dx = iBank; xf86ExecX86int10(pVbe->pInt10); - if (R16(pVbe->pInt10->ax) != 0x4f) - return (FALSE); - - return (TRUE); + return (R16(pVbe->pInt10->ax) == 0x4f); } Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command, int width, int *pixels, int *bytes, int *max) { - if (command < SCANWID_SET || command > SCANWID_GET_MAX) - return (FALSE); - /* Input: AX := 4F06h VBE Set/Get Logical Scan Line Length @@ -845,6 +857,9 @@ VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command, DX := Maximum Number of Scan Lines */ + if (command < SCANWID_SET || command > SCANWID_GET_MAX) + return FALSE; + pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f06; pVbe->pInt10->bx = command; @@ -853,7 +868,7 @@ VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command, xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) - return (FALSE); + return FALSE; if (command == SCANWID_GET || command == SCANWID_GET_MAX) { if (pixels) @@ -864,7 +879,7 @@ VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command, *max = R16(pVbe->pInt10->dx); } - return (TRUE); + return TRUE; } Bool @@ -877,10 +892,7 @@ VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace) pVbe->pInt10->dx = y; xf86ExecX86int10(pVbe->pInt10); - if (R16(pVbe->pInt10->ax) != 0x4f) - return (FALSE); - - return (TRUE); + return (R16(pVbe->pInt10->ax) == 0x4f); } Bool @@ -892,12 +904,12 @@ VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y) xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) - return (FALSE); + return FALSE; *x = pVbe->pInt10->cx; *y = pVbe->pInt10->dx; - return (TRUE); + return TRUE; } int @@ -925,7 +937,7 @@ VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits) xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) - return (0); + return 0; return (bits != 0 ? bits : (pVbe->pInt10->bx >> 8) & 0x00ff); } @@ -936,7 +948,6 @@ VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, { /* Input: - (16-bit) AX := 4F09h VBE Load/Unload Palette Data BL := 00h Set Palette Data := 01h Get Palette Data @@ -949,16 +960,6 @@ VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, Output: AX := VBE Return Status - - - Input: - (32-bit) - BL := 00h Set Palette Data - := 80h Set Palette Data during Vertical Retrace - CX := Number of palette registers to update (to a maximum of 256) - DX := First of the palette registers to update (start) - ES:EDI := Table of palette values (see below for format) - DS := Selector for memory mapped registers */ pVbe->pInt10->num = 0x10; @@ -972,26 +973,24 @@ VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); if (set) - memcpy(pVbe->memory, data, num * sizeof(CARD32)); + (void) memcpy(pVbe->memory, data, num * sizeof(CARD32)); xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) - return (NULL); + return NULL; if (set) - return (data); + return data; data = xnfalloc(num * sizeof(CARD32)); - memcpy(data, pVbe->memory, num * sizeof(CARD32)); + (void) memcpy(data, pVbe->memory, num * sizeof(CARD32)); - return (data); + return data; } VBEpmi * VBEGetVBEpmi(vbeInfoPtr pVbe) { - VBEpmi *pmi; - /* Input: AH := 4Fh Super VGA support @@ -1002,10 +1001,13 @@ VBEGetVBEpmi(vbeInfoPtr pVbe) AX := Status ES := Real Mode Segment of Table DI := Offset of Table - CX := Lenght of Table including protected mode code in bytes (for copying purposes) + CX := Length of Table including protected mode code in bytes + (for copying purposes) (All other registers are preserved) */ + VBEpmi *pmi; + pVbe->pInt10->num = 0x10; pVbe->pInt10->ax = 0x4f0a; pVbe->pInt10->bx = 0; @@ -1013,14 +1015,14 @@ VBEGetVBEpmi(vbeInfoPtr pVbe) xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) - return (NULL); + return NULL; pmi = xnfalloc(sizeof(VBEpmi)); pmi->seg_tbl = R16(pVbe->pInt10->es); pmi->tbl_off = R16(pVbe->pInt10->di); pmi->tbl_len = R16(pVbe->pInt10->cx); - return (pmi); + return pmi; } int @@ -1046,9 +1048,9 @@ VBEGetPixelClock(vbeInfoPtr pVbe, int mode, int clock) xf86ExecX86int10(pVbe->pInt10); if (R16(pVbe->pInt10->ax) != 0x4f) - return (0); + return 0; - return (pVbe->pInt10->cx); + return pVbe->pInt10->cx; } Bool diff --git a/programs/Xserver/hw/xfree86/vbe/vbe.h b/programs/Xserver/hw/xfree86/vbe/vbe.h index 4df02fbce..7e0cd0ea2 100644 --- a/programs/Xserver/hw/xfree86/vbe/vbe.h +++ b/programs/Xserver/hw/xfree86/vbe/vbe.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe.h,v 1.8 2005/08/08 20:15:29 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe.h,v 1.9 2005/08/20 15:31:02 tsi Exp $ */ /* * XFree86 vbe module @@ -69,8 +69,10 @@ typedef struct vbeControllerInfoBlock { CARD8 OemData[256]; } vbeControllerInfoRec, *vbeControllerInfoPtr; -#if defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) || \ - defined(__SUNPRO_C) +#if defined(__GNUC__) || \ + defined(__SCO__) || \ + defined(__USLC__) || \ + defined(__SUNPRO_C) #pragma pack() /* All GCC versions recognise this syntax */ #else #pragma pack(0) @@ -90,23 +92,23 @@ typedef struct _VbeCRTCInfoBlock VbeCRTCInfoBlock; struct _VbeInfoBlock { /* VESA 1.2 fields */ - CARD8 VESASignature[4]; /* VESA */ - CARD16 VESAVersion; /* Higher byte major, lower byte minor */ - /*CARD32*/char *OEMStringPtr; /* Pointer to OEM string */ - CARD8 Capabilities[4]; /* Capabilities of the video environment */ + CARD8 VESASignature[4]; /* VESA */ + CARD16 VESAVersion; /* Higher byte major, lower byte minor */ + char *OEMStringPtr; /* Pointer to OEM string */ + CARD8 Capabilities[4]; /* Capabilities of the video environment */ - /*CARD32*/CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */ + CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */ - CARD16 TotalMemory; /* Number of 64kb memory blocks on board */ + CARD16 TotalMemory; /* Number of 64kb memory blocks on board */ /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */ /* VESA 2 fields */ - CARD16 OemSoftwareRev; /* VBE implementation Software revision */ - /*CARD32*/char *OemVendorNamePtr; /* Pointer to Vendor Name String */ - /*CARD32*/char *OemProductNamePtr; /* Pointer to Product Name String */ - /*CARD32*/char *OemProductRevPtr; /* Pointer to Product Revision String */ - CARD8 Reserved[222]; /* Reserved for VBE implementation */ - CARD8 OemData[256]; /* Data Area for OEM Strings */ + CARD16 OemSoftwareRev; /* VBE implementation Software revision */ + char *OemVendorNamePtr; /* Pointer to Vendor Name String */ + char *OemProductNamePtr; /* Pointer to Product Name String */ + char *OemProductRevPtr; /* Pointer to Product Revision String */ + CARD8 Reserved[222]; /* Reserved for VBE implementation */ + CARD8 OemData[256]; /* Data Area for OEM Strings */ } __attribute__((packed)); /* Return Super VGA Information */ @@ -125,12 +127,12 @@ struct _VbeModeInfoBlock { CARD16 WinSize; /* window size */ CARD16 WinASegment; /* window A start segment */ CARD16 WinBSegment; /* window B start segment */ - CARD32 WinFuncPtr; /* real mode pointer to window function */ + CARD32 WinFuncPtr; /* far pointer to window function */ CARD16 BytesPerScanline; /* bytes per scanline */ /* Mandatory information for VBE 1.2 and above */ - CARD16 XResolution; /* horizontal resolution in pixels or characters */ - CARD16 YResolution; /* vertical resolution in pixels or characters */ + CARD16 XResolution; /* horizontal pixels or characters */ + CARD16 YResolution; /* vertical pixels or characters */ CARD8 XCharSize; /* character cell width in pixels */ CARD8 YCharSize; /* character cell height in pixels */ CARD8 NumberOfPlanes; /* number of memory planes */ @@ -142,34 +144,36 @@ struct _VbeModeInfoBlock { CARD8 Reserved; /* 1 */ /* reserved for page function */ /* Direct color fields (required for direct/6 and YUV/7 memory models) */ - CARD8 RedMaskSize; /* size of direct color red mask in bits */ - CARD8 RedFieldPosition; /* bit position of lsb of red mask */ - CARD8 GreenMaskSize; /* size of direct color green mask in bits */ - CARD8 GreenFieldPosition; /* bit position of lsb of green mask */ - CARD8 BlueMaskSize; /* size of direct color blue mask in bits */ - CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */ - CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */ - CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */ + CARD8 RedMaskSize; /* bit size of red mask */ + CARD8 RedFieldPosition; /* bit position of red mask lsb */ + CARD8 GreenMaskSize; /* bit size of green mask */ + CARD8 GreenFieldPosition; /* bit position of green mask lsb */ + CARD8 BlueMaskSize; /* bit size of blue mask */ + CARD8 BlueFieldPosition; /* bit position of blue mask lsb */ + CARD8 RsvdMaskSize; /* bit size of reserved mask */ + CARD8 RsvdFieldPosition; /* bit position of reserved mask lsb */ CARD8 DirectColorModeInfo; /* direct color mode attributes */ /* Mandatory information for VBE 2.0 and above */ - CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */ + CARD32 PhysBasePtr; /* physical address of linear + framebuffer */ CARD32 Reserved32; /* 0 */ /* Reserved - always set to 0 */ CARD16 Reserved16; /* 0 */ /* Reserved - always set to 0 */ /* Mandatory information for VBE 3.0 and above */ - CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */ + CARD16 LinBytesPerScanLine; /* bytes per scanline */ CARD8 BnkNumberOfImagePages; /* number of images for banked modes */ CARD8 LinNumberOfImagePages; /* number of images for linear modes */ - CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */ - CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */ - CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */ - CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */ - CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */ - CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */ - CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */ - CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */ - CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */ + CARD8 LinRedMaskSize; /* size of direct color red mask */ + CARD8 LinRedFieldPosition; /* bit position of red mask lsb */ + CARD8 LinGreenMaskSize; /* size of direct color green mask */ + CARD8 LinGreenFieldPosition; /* bit position of green mask lsb */ + CARD8 LinBlueMaskSize; /* size of direct color blue mask */ + CARD8 LinBlueFieldPosition; /* bit position of blue mask lsb */ + CARD8 LinRsvdMaskSize; /* size of direct color reserved mask */ + CARD8 LinRsvdFieldPosition; /* bit position of reserved mask lsb */ + CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for + graphics mode */ CARD8 Reserved2[189]; /* remainder of VbeModeInfoBlock */ } __attribute__((packed)); @@ -187,16 +191,16 @@ void VBEFreeModeInfo(VbeModeInfoBlock *block); #define CRTC_NVSYNC (1<<3) struct _VbeCRTCInfoBlock { - CARD16 HorizontalTotal; /* Horizontal total in pixels */ - CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */ - CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */ - CARD16 VerticalTotal; /* Vertical total in lines */ - CARD16 VerticalSyncStart; /* Vertical sync start in lines */ - CARD16 VerticalSyncEnd; /* Vertical sync end in lines */ - CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */ - CARD32 PixelClock; /* Pixel clock in units of Hz */ - CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */ - CARD8 Reserved[40]; /* remainder of ModeInfoBlock */ + CARD16 HorizontalTotal; /* Horizontal total in pixels */ + CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */ + CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */ + CARD16 VerticalTotal; /* Vertical total in lines */ + CARD16 VerticalSyncStart; /* Vertical sync start in lines */ + CARD16 VerticalSyncEnd; /* Vertical sync end in lines */ + CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */ + CARD32 PixelClock; /* Pixel clock in units of Hz */ + CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */ + CARD8 Reserved[40]; /* remainder of ModeInfoBlock */ } __attribute__((packed)); /* VbeCRTCInfoBlock is in the VESA 3.0 specs */ diff --git a/programs/Xserver/hw/xfree86/vbe/vbe_module.c b/programs/Xserver/hw/xfree86/vbe/vbe_module.c index 0347f7fb7..9b129f3c7 100644 --- a/programs/Xserver/hw/xfree86/vbe/vbe_module.c +++ b/programs/Xserver/hw/xfree86/vbe/vbe_module.c @@ -1,31 +1,12 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe_module.c,v 1.4 2002/09/16 18:06:15 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vbe/vbe_module.c,v 1.1 2003/02/17 17:06:46 dawes Exp $ */ + +#ifdef XFree86LOADER #include "xf86.h" -#include "xf86str.h" #include "vbe.h" extern const char *vbe_ddcSymbols[]; -#ifdef XFree86LOADER - -static MODULESETUPPROTO(vbeSetup); - -static XF86ModuleVersionInfo vbeVersRec = -{ - "vbe", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XF86_VERSION_CURRENT, - 1, 1, 0, - ABI_CLASS_VIDEODRV, /* needs the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - -XF86ModuleData vbeModuleData = { &vbeVersRec, vbeSetup, NULL }; - static pointer vbeSetup(pointer module, pointer opts, int *errmaj, int *errmin) { @@ -33,11 +14,12 @@ vbeSetup(pointer module, pointer opts, int *errmaj, int *errmin) if (!setupDone) { setupDone = TRUE; - LoaderRefSymLists(vbe_ddcSymbols,NULL); + /* * Tell the loader about symbols from other modules that this module * might refer to. */ + LoaderRefSymLists(vbe_ddcSymbols, NULL); } /* * The return value must be non-NULL on success even though there @@ -46,5 +28,25 @@ vbeSetup(pointer module, pointer opts, int *errmaj, int *errmin) return (pointer)1; } -#endif +static XF86ModuleVersionInfo vbeVersRec = +{ + "vbe", /* modname */ + MODULEVENDORSTRING, /* vendor */ + MODINFOSTRING1, /* _modinfo1_ */ + MODINFOSTRING2, /* _modinfo2_ */ + XF86_VERSION_CURRENT, /* xf86version */ + 1, 1, 0, /* majorversion, minorversion, patchlevel */ + ABI_CLASS_VIDEODRV, /* needs the video driver ABI */ + ABI_VIDEODRV_VERSION, /* abiversion */ + MOD_CLASS_NONE, /* moduleclass */ + {0,0,0,0} /* checksum */ +}; + +XF86ModuleData vbeModuleData = +{ + &vbeVersRec, /* vers */ + vbeSetup, /* setup */ + NULL /* teardown */ +}; +#endif /* XFree86LOADER */ |