Changeset 33460 in vbox for trunk/src/VBox/Additions/x11/vboxvideo/vboxvideo_13.c
- Timestamp:
- Oct 26, 2010 11:39:37 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.