Changeset 35949 in vbox for trunk/src/VBox
- Timestamp:
- Feb 11, 2011 11:27:06 PM (14 years ago)
- Location:
- trunk/src/VBox/Additions/x11/vboxvideo
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/vboxvideo/undefined
r35883 r35949 16 16 RRChangeOutputProperty 17 17 ShadowFBInit2 18 VBEExtendedInit19 VBEGetVBEMode20 VBESaveRestore21 VBESetVBEMode22 18 XNFcalloc 23 19 XNFstrdup … … 127 123 vgaHWFreeHWRec 128 124 vgaHWGetHWRec 129 vgaHWRestoreFonts 130 vgaHWSaveFonts 125 vgaHWGetIndex 126 vgaHWGetIOBase 127 vgaHWRestore 128 vgaHWSave 131 129 write 132 130 xf86AddDriver -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.c
r35948 r35949 104 104 static void VBOXAdjustFrame(int scrnIndex, int x, int y, int flags); 105 105 static void VBOXFreeScreen(int scrnIndex, int flags); 106 static void VBOXFreeRec(ScrnInfoPtr pScrn);107 106 static void VBOXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int mode, 108 107 int flags); … … 111 110 static Bool VBOXMapVidMem(ScrnInfoPtr pScrn); 112 111 static void VBOXUnmapVidMem(ScrnInfoPtr pScrn); 113 static Bool VBOXSaveRestore(ScrnInfoPtr pScrn,114 vbeSaveRestoreFunction function);112 static void VBOXSaveMode(ScrnInfoPtr pScrn); 113 static void VBOXRestoreMode(ScrnInfoPtr pScrn); 115 114 static Bool VBOXAdjustScreenPixmap(ScrnInfoPtr pScrn, int width, int height); 116 115 … … 200 199 }; 201 200 202 static const char *vbeSymbols[] = {203 "VBEExtendedInit",204 "VBEGetVBEMode",205 "VBESaveRestore",206 "VBESetVBEMode",207 NULL208 };209 210 201 static const char *ramdacSymbols[] = { 211 202 "xf86InitCursor", … … 215 206 216 207 static const char *vgahwSymbols[] = { 208 "vgaHWFreeHWRec", 217 209 "vgaHWGetHWRec", 218 "vgaHWFreeHWRec", 219 "vgaHWSaveFonts", 220 "vgaHWRestoreFonts", 210 "vgaHWGetIOBase", 211 "vgaHWGetIndex", 212 "vgaHWRestore", 213 "vgaHWSave", 221 214 NULL 222 215 }; … … 232 225 233 226 return ((VBOXPtr)pScrn->driverPrivate); 234 }235 236 static void237 VBOXFreeRec(ScrnInfoPtr pScrn)238 {239 VBOXPtr pVBox = VBOXGetRec(pScrn);240 free(pVBox->savedPal);241 free(pVBox->fonts);242 free(pScrn->driverPrivate);243 pScrn->driverPrivate = NULL;244 227 } 245 228 … … 569 552 LoaderRefSymLists(fbSymbols, 570 553 shadowfbSymbols, 571 vbeSymbols,572 554 ramdacSymbols, 573 555 vgahwSymbols, … … 795 777 return FALSE; 796 778 797 /* We need the vbe module because we use VBE code to save and restore798 text mode, in order to keep our code simple. */799 if (!xf86LoadSubModule(pScrn, "vbe"))800 return (FALSE);801 802 779 /* The framebuffer module. */ 803 780 if (!xf86LoadSubModule(pScrn, "fb")) … … 911 888 xf86PrintModes(pScrn); 912 889 890 /* VGA hardware initialisation */ 891 if (!vgaHWGetHWRec(pScrn)) 892 return FALSE; 893 /* Must be called before any VGA registers are saved or restored */ 894 vgaHWGetIOBase(VGAHWPTR(pScrn)); 895 913 896 /* Colour weight - we always call this, since we are always in 914 897 truecolour. */ … … 974 957 TRACE_ENTRY(); 975 958 976 /* VGA hardware initialisation */977 if (!vgaHWGetHWRec(pScrn))978 return FALSE;979 980 /* We make use of the X11 VBE code to save and restore text mode, in981 order to keep our code simple. */982 if ((pVBox->pVbe = VBEExtendedInit(NULL, pVBox->pEnt->index,983 SET_BIOS_SCRATCH984 | RESTORE_BIOS_SCRATCH)) == NULL)985 return (FALSE);986 987 959 if (!VBOXMapVidMem(pScrn)) 988 960 return (FALSE); 989 961 990 962 /* save current video state */ 991 VBOXSave Restore(pScrn, MODE_SAVE);963 VBOXSaveMode(pScrn); 992 964 993 965 /* mi layer - reset the visual list (?)*/ … … 1219 1191 vboxDisableVbva(pScrn); 1220 1192 vboxClearVRAM(pScrn, 0, 0); 1221 VBOX SaveRestore(pScrn, MODE_RESTORE);1193 VBOXRestoreMode(pScrn); 1222 1194 vboxDisableGraphicsCap(pVBox); 1223 1195 #ifdef VBOX_DRI … … 1245 1217 1246 1218 if (pScrn->vtSema) { 1247 VBOX SaveRestore(xf86Screens[scrnIndex], MODE_RESTORE);1219 VBOXRestoreMode(xf86Screens[scrnIndex]); 1248 1220 VBOXUnmapVidMem(pScrn); 1249 1221 } 1250 1222 pScrn->vtSema = FALSE; 1251 1223 1252 /* Destroy the VGA hardware record */ 1253 vgaHWFreeHWRec(pScrn); 1254 1255 /* And do additional bits which are separate for historical reasons */ 1224 /* Do additional bits which are separate for historical reasons */ 1256 1225 vbox_close(pScrn, pVBox); 1257 1226 … … 1420 1389 VBOXFreeScreen(int scrnIndex, int flags) 1421 1390 { 1422 VBOXFreeRec(xf86Screens[scrnIndex]); 1391 ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; 1392 1393 /* Destroy the VGA hardware record */ 1394 vgaHWFreeHWRec(pScrn); 1395 /* And our private record */ 1396 free(pScrn->driverPrivate); 1397 pScrn->driverPrivate = NULL; 1423 1398 } 1424 1399 … … 1479 1454 } 1480 1455 1481 Bool 1482 VBOXSave Restore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function)1483 { 1484 VBOXPtr pVBox ;1485 Bool rc = TRUE;1456 void 1457 VBOXSaveMode(ScrnInfoPtr pScrn) 1458 { 1459 VBOXPtr pVBox = VBOXGetRec(pScrn); 1460 vgaRegPtr vgaReg; 1486 1461 1487 1462 TRACE_ENTRY(); 1488 if (MODE_QUERY < 0 || function > MODE_RESTORE) 1489 rc = FALSE; 1490 1491 if (rc) 1492 { 1493 pVBox = VBOXGetRec(pScrn); 1494 1495 /* Query amount of memory to save state */ 1496 if (function == MODE_QUERY || 1497 (function == MODE_SAVE && pVBox->state == NULL)) 1498 { 1499 1500 /* Make sure we save at least this information in case of failure */ 1501 (void)VBEGetVBEMode(pVBox->pVbe, &pVBox->stateMode); 1502 vgaHWSaveFonts(pScrn, &pVBox->vgaRegs); 1503 1504 if (!VBESaveRestore(pVBox->pVbe,function,(pointer)&pVBox->state, 1505 &pVBox->stateSize,&pVBox->statePage) 1506 ) 1507 rc = FALSE; 1508 } 1509 } 1510 if (rc) 1511 { 1512 /* Save/Restore Super VGA state */ 1513 if (function != MODE_QUERY) { 1514 1515 if (function == MODE_RESTORE) 1516 memcpy(pVBox->state, pVBox->pstate, 1517 (unsigned) pVBox->stateSize); 1518 1519 if ( (rc = VBESaveRestore(pVBox->pVbe,function, 1520 (pointer)&pVBox->state, 1521 &pVBox->stateSize,&pVBox->statePage) 1522 ) 1523 && (function == MODE_SAVE) 1524 ) 1525 { 1526 /* don't rely on the memory not being touched */ 1527 if (pVBox->pstate == NULL) 1528 pVBox->pstate = malloc(pVBox->stateSize); 1529 memcpy(pVBox->pstate, pVBox->state, 1530 (unsigned) pVBox->stateSize); 1531 } 1532 1533 if (function == MODE_RESTORE) 1534 { 1535 VBESetVBEMode(pVBox->pVbe, pVBox->stateMode, NULL); 1536 vgaHWRestoreFonts(pScrn, &pVBox->vgaRegs); 1537 } 1538 } 1539 } 1540 TRACE_LOG("returning %s\n", rc ? "TRUE" : "FALSE"); 1541 return rc; 1463 vgaReg = &VGAHWPTR(pScrn)->SavedReg; 1464 vgaHWSave(pScrn, vgaReg, VGA_SR_ALL); 1465 pVBox->fSavedVBEMode = VBoxVideoGetModeRegisters(&pVBox->cSavedWidth, 1466 &pVBox->cSavedHeight, 1467 &pVBox->cSavedPitch, 1468 &pVBox->cSavedBPP, 1469 &pVBox->fSavedFlags); 1470 } 1471 1472 void 1473 VBOXRestoreMode(ScrnInfoPtr pScrn) 1474 { 1475 VBOXPtr pVBox = VBOXGetRec(pScrn); 1476 vgaRegPtr vgaReg; 1477 1478 TRACE_ENTRY(); 1479 vgaReg = &VGAHWPTR(pScrn)->SavedReg; 1480 vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); 1481 if (pVBox->fSavedVBEMode) 1482 VBoxVideoSetModeRegisters(pVBox->cSavedWidth, pVBox->cSavedHeight, 1483 pVBox->cSavedPitch, pVBox->cSavedBPP, 1484 pVBox->fSavedFlags, 0, 0); 1485 else 1486 VBoxVideoDisableVBE(); 1542 1487 } 1543 1488 -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h
r35777 r35949 117 117 #endif 118 118 119 #include "vgaHW.h"120 121 /* VBE/DDC support */122 #include "vbe.h"123 124 119 /* ShadowFB support */ 125 120 #include "shadowfb.h" … … 169 164 typedef struct VBOXRec 170 165 { 171 vbeInfoPtr pVbe; /** @todo do the VBE bits ourselves? */172 166 EntityInfoPtr pEnt; 173 167 #ifdef PCIACCESS … … 185 179 /** The current line size in bytes */ 186 180 uint32_t cbLine; 187 CARD8 *state, *pstate; /* SVGA state */188 int statePage, stateSize, stateMode;189 CARD32 *savedPal;190 CARD8 *fonts;191 vgaRegRec vgaRegs; /* Space for saving VGA information */181 /** Whether the pre-X-server mode was a VBE mode */ 182 bool fSavedVBEMode; 183 /** Paramters of the saved pre-X-server VBE mode, invalid if there is none 184 */ 185 uint16_t cSavedWidth, cSavedHeight, cSavedPitch, cSavedBPP, fSavedFlags; 192 186 CloseScreenProcPtr CloseScreen; 193 187 /** Default X server procedure for enabling and disabling framebuffer access */
Note:
See TracChangeset
for help on using the changeset viewer.