- Timestamp:
- Oct 26, 2010 11:39:37 AM (14 years ago)
- Location:
- trunk/src/VBox/Additions/x11/vboxvideo
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/vboxvideo/vboxutils.c
r32831 r33460 1034 1034 * cx and cy. 1035 1035 */ 1036 static void vboxFillDisplayMode(DisplayModePtr m, const char *pszName, 1037 unsigned cx, unsigned cy) 1038 { 1036 static void vboxFillDisplayMode(ScrnInfoPtr pScrn, DisplayModePtr m, 1037 const char *pszName, unsigned cx, unsigned cy) 1038 { 1039 VBOXPtr pVBox = pScrn->driverPrivate; 1039 1040 TRACE_LOG("pszName=%s, cx=%u, cy=%u\n", pszName, cx, cy); 1040 1041 m->status = MODE_OK; 1041 1042 m->type = M_T_BUILTIN; 1042 /* VBox only supports screen widths which are a multiple of 8 */ 1043 m->HDisplay = cx & ~7; 1043 /* Older versions of VBox only support screen widths which are a multiple 1044 * of 8 */ 1045 if (pVBox->fAnyX) 1046 m->HDisplay = cx; 1047 else 1048 m->HDisplay = cx & ~7; 1044 1049 m->HSyncStart = m->HDisplay + 2; 1045 1050 m->HSyncEnd = m->HDisplay + 4; … … 1155 1160 if ((cx == 0) || (cy == 0)) 1156 1161 found = false; 1157 if (found)1158 /* Adjust to a multiple of eight */1159 cx &= ~7;1160 1162 if (!found) 1161 1163 found = (vboxNextStandardMode(pScrn, 0, &cx, &cy, &cBits) != 0); … … 1236 1238 { 1237 1239 if (!found) 1238 vboxFillDisplayMode(p Mode, NULL, cx, cy);1240 vboxFillDisplayMode(pScrn, pMode, NULL, cx, cy); 1239 1241 else if (pCurrent) 1240 vboxFillDisplayMode(p Mode, NULL, pCurrent->HDisplay,1242 vboxFillDisplayMode(pScrn, pMode, NULL, pCurrent->HDisplay, 1241 1243 pCurrent->VDisplay); 1242 1244 found = true; … … 1308 1310 * be, and breaks the second assumption, we guarantee the first. */ 1309 1311 DisplayModePtr pMode = vboxAddEmptyScreenMode(pScrn); 1310 vboxFillDisplayMode(p Mode, "VBoxInitialMode", cxInit, cyInit);1312 vboxFillDisplayMode(pScrn, pMode, "VBoxInitialMode", cxInit, cyInit); 1311 1313 /* Create our two dynamic modes. */ 1312 1314 pMode = vboxAddEmptyScreenMode(pScrn); 1313 vboxFillDisplayMode(p Mode, "VBoxDynamicMode", cxInit, cyInit);1315 vboxFillDisplayMode(pScrn, pMode, "VBoxDynamicMode", cxInit, cyInit); 1314 1316 pMode = vboxAddEmptyScreenMode(pScrn); 1315 vboxFillDisplayMode(p Mode, "VBoxDynamicMode", cxInit, cyInit);1317 vboxFillDisplayMode(pScrn, pMode, "VBoxDynamicMode", cxInit, cyInit); 1316 1318 /* Add standard modes supported by the host */ 1317 1319 for ( ; ; ) … … 1323 1325 sprintf(szName, "VBox-%ux%u", cx, cy); 1324 1326 pMode = vboxAddEmptyScreenMode(pScrn); 1325 vboxFillDisplayMode(p Mode, szName, cx, cy);1327 vboxFillDisplayMode(pScrn, pMode, szName, cx, cy); 1326 1328 } 1327 1329 /* And finally any modes specified by the user. We assume here that … … 1333 1335 { 1334 1336 pMode = vboxAddEmptyScreenMode(pScrn); 1335 vboxFillDisplayMode(p Mode, pScrn->display->modes[i], cx, cy);1337 vboxFillDisplayMode(pScrn, pMode, pScrn->display->modes[i], cx, cy); 1336 1338 } 1337 1339 } -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo.h
r32692 r33460 137 137 #define VBE_DISPI_INDEX_VIRT_HEIGHT 0x7 138 138 #define VBE_DISPI_ID2 0xB0C2 139 #define VBE_DISPI_ID_ANYX 0xBE02 139 140 #define VBE_DISPI_DISABLED 0x00 140 141 #define VBE_DISPI_ENABLED 0x01 … … 220 221 VMMDevMemory *pVMMDevMemory; 221 222 VBVAMEMORY *pVbvaMemory; 223 Bool fAnyX; /* Unrestricted horizontal resolution flag. */ 222 224 #ifdef VBOX_DRI 223 225 Bool useDRI; -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_13.c
r32692 r33460 202 202 203 203 TRACE_LOG("width=%d, height=%d\n", width, height); 204 /* We only support horizontal resolutions which are a multiple of 8.205 * Round up if necessary. */206 width = (width + 7) & ~7;207 204 if (width * height * bpp / 8 >= scrn->videoRam * 1024) 208 205 { … … 261 258 vbox_crtc_mode_fixup (xf86CrtcPtr crtc, DisplayModePtr mode, 262 259 DisplayModePtr adjusted_mode) 263 { 264 ScrnInfoPtr pScrn = crtc->scrn; 265 int xRes = adjusted_mode->HDisplay; 266 267 (void) mode; 268 TRACE_LOG("name=%s, HDisplay=%d, VDisplay=%d\n", adjusted_mode->name, 269 adjusted_mode->HDisplay, adjusted_mode->VDisplay); 270 /* We only support horizontal resolutions which are a multiple of 8. Round down if 271 necessary. */ 272 if (xRes % 8 != 0) 273 { 274 xf86DrvMsg(pScrn->scrnIndex, X_WARNING, 275 "VirtualBox only supports screen widths which are a multiple of 8. Rounding down from %d to %d\n", 276 xRes, xRes - (xRes % 8)); 277 adjusted_mode->HDisplay = xRes - (xRes % 8); 278 } 279 return TRUE; 280 } 260 { (void) crtc; (void) mode; (void) adjusted_mode; return TRUE; } 281 261 282 262 static void … … 379 359 380 360 static void 381 vbox_output_add_mode (DisplayModePtr *pModes, const char *pszName, int x, int y, 361 vbox_output_add_mode (VBOXPtr pVBox, DisplayModePtr *pModes, 362 const char *pszName, int x, int y, 382 363 Bool isPreferred, Bool isUserDef) 383 364 { … … 391 372 if (isPreferred) 392 373 pMode->type |= M_T_PREFERRED; 393 /* VBox only supports screen widths which are a multiple of 8 */ 394 pMode->HDisplay = (x + 7) & ~7; 374 /* Older versions of VBox only support screen widths which are a multiple 375 * of 8 */ 376 if (pVBox->fAnyX) 377 pMode->HDisplay = x; 378 else 379 pMode->HDisplay = x & ~7; 395 380 pMode->HSyncStart = pMode->HDisplay + 2; 396 381 pMode->HSyncEnd = pMode->HDisplay + 4; … … 428 413 if (!rc || (0 == x) || (0 == y)) 429 414 rc = vboxRetrieveVideoMode(pScrn, &x, &y, &bpp); 430 if (rc && (0 != x) && (0 != y)) { 431 /* We prefer a slightly smaller size to a slightly larger one */ 432 x -= (x % 8); 433 vbox_output_add_mode(&pModes, NULL, x, y, TRUE, FALSE); 434 } 415 if (rc && (0 != x) && (0 != y)) 416 vbox_output_add_mode(pVBox, &pModes, NULL, x, y, TRUE, FALSE); 435 417 } 436 418 /* Also report any modes the user may have requested in the xorg.conf … … 440 422 int x, y; 441 423 if (2 == sscanf(pScrn->display->modes[i], "%dx%d", &x, &y)) 442 vbox_output_add_mode( &pModes, pScrn->display->modes[i], x, y,424 vbox_output_add_mode(pVBox, &pModes, pScrn->display->modes[i], x, y, 443 425 FALSE, TRUE); 444 426 } … … 667 649 rgb rzeros = {0, 0, 0}; 668 650 xf86OutputPtr output; 651 unsigned DispiId; 669 652 670 653 /* Are we really starting the server, or is this just a dummy run? */ … … 733 716 sized video RAM configurations */ 734 717 pScrn->videoRam = inl(VBE_DISPI_IOPORT_DATA) / 1024; 718 719 /* Check if the chip restricts horizontal resolution or not. */ 720 outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID); 721 outw(VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID_ANYX); 722 DispiId = inw(VBE_DISPI_IOPORT_DATA); 723 if (DispiId == VBE_DISPI_ID_ANYX) 724 pVBox->fAnyX = TRUE; 725 else 726 pVBox->fAnyX = FALSE; 735 727 736 728 /* Query the host for the preferred colour depth */ … … 898 890 899 891 /* Needed before we initialise DRI. */ 900 pScrn->virtualX = (pScrn->virtualX + 7) & ~7;901 892 pScrn->displayWidth = pScrn->virtualX; 902 893 -
trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_70.c
r32692 r33460 484 484 rgb rzeros = {0, 0, 0}; 485 485 int i; 486 unsigned DispiId; 486 487 DisplayModePtr pMode; 487 488 enum { MODE_MIN_SIZE = 64 }; … … 565 566 sized video RAM configurations */ 566 567 pScrn->videoRam = inl(VBE_DISPI_IOPORT_DATA) / 1024; 568 569 /* Check if the chip restricts horizontal resolution or not. */ 570 outw(VBE_DISPI_IOPORT_INDEX, VBE_DISPI_INDEX_ID); 571 outw(VBE_DISPI_IOPORT_DATA, VBE_DISPI_ID_ANYX); 572 DispiId = inw(VBE_DISPI_IOPORT_DATA); 573 if (DispiId == VBE_DISPI_ID_ANYX) 574 pVBox->fAnyX = TRUE; 575 else 576 pVBox->fAnyX = FALSE; 567 577 568 578 /* Set up clock information that will support all modes we need. */
Note:
See TracChangeset
for help on using the changeset viewer.