vbox的更動 7759 路徑 trunk/src/VBox/Devices/Graphics
- 時間撮記:
- 2008-4-5 上午11:36:02 (17 年 以前)
- 位置:
- trunk/src/VBox/Devices/Graphics
- 檔案:
-
- 修改 4 筆資料
- 移動 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Devices/Graphics/BIOS/Makefile.kmk
r5999 r7759 47 47 $(PATH_TARGET)/vgabios.bin \ 48 48 $(PATH_TARGET)/VgaBiosBin.c \ 49 $(PATH_TARGET)/VgaDefBiosLogo.c \ 49 50 \ 50 51 $(PATH_TARGET)/_vgabios-cirrus_.c \ … … 97 98 $(QUIET)$(TARGET_vgabiossums) $@ 98 99 100 # 101 # The VGA BIOS Logo. 102 # 103 LIBRARIES += VgaDefBiosLogo 104 VgaDefBiosLogo_TEMPLATE = VBOXR3 105 VgaDefBiosLogo_INCS = $(VBOX_PATH_DEVICES_SRC) 106 VgaDefBiosLogo_SOURCES = $(PATH_TARGET)/VgaDefBiosLogo.c 107 108 # 109 # Rule for making the bios logo. 110 # 111 $(PATH_TARGET)/VgaDefBiosLogo.c: $(PATH_SUB_CURRENT)/innotek_logo.bmp $(VBOX_BIN2C) 112 $(call MSG_TOOL,bin2c,VgaBiosBin,$<,$@) 113 $(QUIET)$(VBOX_BIN2C) -max 64 VgaDefBiosLogo $< $@ 114 99 115 100 116 include $(PATH_KBUILD)/subfooter.kmk -
trunk/src/VBox/Devices/Graphics/BIOS/vbe.h
r5450 r7759 312 312 /** 313 313 * VBE Bios Extra Data structure. 314 * @remark duplicated in vga_int.h.314 * @remark duplicated in DevVGA.h. 315 315 */ 316 316 typedef struct VBEHeader … … 323 323 324 324 /** The value of the VBEHEADER::u16Signature field. 325 * @remark duplicated in vga_int.h. */325 * @remark duplicated in DevVGA.h. */ 326 326 #define VBEHEADER_MAGIC 0x77CC 327 327 328 328 /** The extra port which is used to read the mode list. 329 * @remark duplicated in vga_int.h. */329 * @remark duplicated in DevVGA.h. */ 330 330 #define VBE_EXTRA_PORT 0x3b6 331 331 332 332 /** The extra port which is used for debug printf. 333 * @remark duplicated in vga_int.h. */333 * @remark duplicated in DevVGA.h. */ 334 334 #define VBE_PRINTF_PORT 0x3b7 335 335 336 337 336 #endif -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r7755 r7759 88 88 #include <iprt/assert.h> 89 89 #include <iprt/asm.h> 90 #include <iprt/file.h> 90 91 #include <iprt/string.h> 91 92 … … 103 104 #include "Builtins2.h" 104 105 106 /* "Press F12 to select boot device." bitmap. */ 107 uint8_t LogoF12BootText[] = { 108 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 109 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 110 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x0F, 0x7C, 111 0xF8, 0xF0, 0x01, 0xE0, 0x81, 0x9F, 0x3F, 0x00, 0x70, 0xF8, 0x00, 0xE0, 0xC3, 112 0x07, 0x0F, 0x1F, 0x3E, 0x70, 0x00, 0xF0, 0xE1, 0xC3, 0x07, 0x0E, 0x00, 0x6E, 113 0x7C, 0x60, 0xE0, 0xE1, 0xC3, 0x07, 0xC6, 0x80, 0x81, 0x31, 0x63, 0xC6, 0x00, 114 0x30, 0x80, 0x61, 0x0C, 0x00, 0x36, 0x63, 0x00, 0x8C, 0x19, 0x83, 0x61, 0xCC, 115 0x18, 0x36, 0x00, 0xCC, 0x8C, 0x19, 0xC3, 0x06, 0xC0, 0x8C, 0x31, 0x3C, 0x30, 116 0x8C, 0x19, 0x83, 0x31, 0x60, 0x60, 0x00, 0x0C, 0x18, 0x00, 0x0C, 0x60, 0x18, 117 0x00, 0x80, 0xC1, 0x18, 0x00, 0x30, 0x06, 0x60, 0x18, 0x30, 0x80, 0x01, 0x00, 118 0x33, 0x63, 0xC6, 0x30, 0x00, 0x30, 0x63, 0x80, 0x19, 0x0C, 0x03, 0x06, 0x00, 119 0x0C, 0x18, 0x18, 0xC0, 0x81, 0x03, 0x00, 0x03, 0x18, 0x0C, 0x00, 0x60, 0x30, 120 0x06, 0x00, 0x87, 0x01, 0x18, 0x06, 0x0C, 0x60, 0x00, 0xC0, 0xCC, 0x98, 0x31, 121 0x0C, 0x00, 0xCC, 0x18, 0x30, 0x0C, 0xC3, 0x80, 0x01, 0x00, 0x03, 0x66, 0xFE, 122 0x18, 0x30, 0x00, 0xC0, 0x02, 0x06, 0x06, 0x00, 0x18, 0x8C, 0x01, 0x60, 0xE0, 123 0x0F, 0x86, 0x3F, 0x03, 0x18, 0x00, 0x30, 0x33, 0x66, 0x0C, 0x03, 0x00, 0x33, 124 0xFE, 0x0C, 0xC3, 0x30, 0xE0, 0x0F, 0xC0, 0x87, 0x9B, 0x31, 0x63, 0xC6, 0x00, 125 0xF0, 0x80, 0x01, 0x03, 0x00, 0x06, 0x63, 0x00, 0x8C, 0x19, 0x83, 0x61, 0xCC, 126 0x18, 0x06, 0x00, 0x6C, 0x8C, 0x19, 0xC3, 0x00, 0x80, 0x8D, 0x31, 0xC3, 0x30, 127 0x8C, 0x19, 0x03, 0x30, 0xB3, 0xC3, 0x87, 0x0F, 0x1F, 0x00, 0x2C, 0x60, 0x80, 128 0x01, 0xE0, 0x87, 0x0F, 0x00, 0x3E, 0x7C, 0x60, 0xF0, 0xE1, 0xE3, 0x07, 0x00, 129 0x0F, 0x3E, 0x7C, 0xFC, 0x00, 0xC0, 0xC3, 0xC7, 0x30, 0x0E, 0x3E, 0x7C, 0x00, 130 0xCC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x1E, 0xC0, 0x00, 0x60, 0x00, 131 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, 0x00, 0xC0, 0x00, 0x00, 0x00, 132 0x0C, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 133 0x00, 0x00, 0x00, 0xC0, 0x0C, 0x87, 0x31, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 134 0x00, 0x06, 0x00, 0x00, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x03, 0x00, 0x30, 135 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0xE0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 136 0xF8, 0x83, 0xC1, 0x07, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x01, 0x00, 137 0x00, 0x04, 0x00, 0x0E, 0x00, 0x00, 0x80, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x30, 138 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 139 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 140 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 105 141 106 142 #ifndef VBOX_DEVICE_STRUCT_TESTCASE … … 130 166 PDMBOTHCBDECL(int) vbeIOPortWriteVBEExtra(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb); 131 167 # endif 168 PDMBOTHCBDECL(int) vbeIOPortReadCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb); 169 PDMBOTHCBDECL(int) vbeIOPortWriteCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb); 132 170 #endif /* IN_RING3 */ 133 171 … … 3509 3547 # endif /* VBE_NEW_DYN_LIST */ 3510 3548 3549 /** 3550 * Port I/O Handler for BIOS Logo OUT operations. 3551 * 3552 * @returns VBox status code. 3553 * 3554 * @param pDevIns The device instance. 3555 * @param pvUser User argument - ignored. 3556 * @param Port Port number used for the IN operation. 3557 * @param u32 The value to output. 3558 * @param cb The value size in bytes. 3559 */ 3560 PDMBOTHCBDECL(int) vbeIOPortWriteCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t u32, unsigned cb) 3561 { 3562 PVGASTATE pData = PDMINS2DATA(pDevIns, PVGASTATE); 3563 NOREF(pvUser); 3564 NOREF(Port); 3565 3566 Log(("vbeIOPortWriteCMDLogo: cb=%d u32=%#04x(%#04d) (byte)\n", cb, u32, u32)); 3567 3568 if (cb == 2) 3569 { 3570 /* Get the logo data */ 3571 if (pData->LogoCommand) 3572 { 3573 switch (pData->LogoCommand) 3574 { 3575 case LOGO_CMD_SET_OFFSET: 3576 pData->offLogoData = u32; 3577 break; 3578 case LOGO_CMD_SET_X: 3579 pData->LogoX = u32; 3580 break; 3581 case LOGO_CMD_SET_Y: 3582 pData->LogoY = u32; 3583 break; 3584 case LOGO_CMD_SET_WIDTH: 3585 pData->LogoWidth = u32; 3586 break; 3587 case LOGO_CMD_SET_HEIGHT: 3588 pData->LogoHeight = u32; 3589 break; 3590 case LOGO_CMD_SET_DEPTH: 3591 pData->LogoDepth = u32; 3592 break; 3593 case LOGO_CMD_SET_PALSIZE: 3594 pData->PalSize = u32; 3595 break; 3596 default: 3597 Log(("vbeIOPortWriteCMDLogo: invalid command %d\n", pData->LogoCommand)); 3598 break; 3599 } 3600 3601 pData->LogoCommand = LOGO_CMD_NOP; 3602 return VINF_SUCCESS; 3603 } 3604 3605 /* Get the logo command */ 3606 switch (u32 & 0xFF00) 3607 { 3608 int i, j; 3609 case LOGO_CMD_SET_OFFSET: 3610 case LOGO_CMD_SET_X: 3611 case LOGO_CMD_SET_Y: 3612 case LOGO_CMD_SET_WIDTH: 3613 case LOGO_CMD_SET_HEIGHT: 3614 case LOGO_CMD_SET_DEPTH: 3615 case LOGO_CMD_SET_PALSIZE: 3616 pData->LogoCommand = u32 & 0xFF00; 3617 break; 3618 case LOGO_CMD_SET_DEFAULT: 3619 pData->BmpImage = LOGO_IMAGE_DEFAULT; 3620 pData->offLogoData = 0; 3621 pData->LogoCommand = LOGO_CMD_NOP; 3622 break; 3623 case LOGO_CMD_SET_PAL: 3624 { 3625 uint8_t *pu8Pal; 3626 3627 if (pData->BmpImage == LOGO_IMAGE_EXTERNAL) 3628 pu8Pal = (uint8_t *)&pData->pu8Logo[pData->offLogoData]; 3629 else 3630 pu8Pal = (uint8_t *)&g_abVgaDefBiosLogo[pData->offLogoData]; 3631 3632 for (i = 0; i <= pData->PalSize; i++) 3633 { 3634 uint8_t b; 3635 uint32_t p = 0; 3636 3637 for (j = 0; j < 3; j++) 3638 { 3639 p <<= 8; 3640 b = (uint8_t)*pu8Pal++; 3641 p |= b; 3642 } 3643 *pu8Pal++; 3644 3645 pData->Palette[i] = p; 3646 } 3647 } 3648 break; 3649 case LOGO_CMD_CLS: 3650 { 3651 /* Clear vram */ 3652 uint32_t *pu32TmpPtr = (uint32_t *)pData->vram_ptrHC; 3653 for (i = 0; i < LOGO_MAX_WIDTH; i++) 3654 { 3655 for (j = 0; j < LOGO_MAX_HEIGHT; j++) 3656 *pu32TmpPtr++ = 0; 3657 } 3658 } 3659 break; 3660 case LOGO_CMD_SHOW_BMP: 3661 case LOGO_CMD_SHOW_TEXT: 3662 { 3663 uint8_t cbStep = u32 & 0xFF; 3664 3665 /* 3666 * Determin bytes per pixel in the destination buffer. 3667 */ 3668 size_t scr_cx = LOGO_MAX_WIDTH; 3669 size_t scr_cy = LOGO_MAX_HEIGHT; 3670 3671 if ((u32 & 0xFF00) == LOGO_CMD_SHOW_TEXT) 3672 { 3673 pData->LogoX = LOGO_F12TEXT_X; 3674 pData->LogoY = LOGO_F12TEXT_Y; 3675 3676 pData->LogoWidth = LOGO_F12TEXT_WIDTH; 3677 pData->LogoHeight = LOGO_F12TEXT_HEIGHT; 3678 pData->LogoDepth = 1; 3679 } 3680 3681 uint32_t cx = pData->LogoWidth; 3682 uint32_t cy = pData->LogoHeight; 3683 uint8_t *pu8Src; 3684 uint8_t *pu8TmpPtr; 3685 size_t cbPadBytes = 0; 3686 size_t cbLineDst = pData->pDrv->cbScanline; 3687 uint8_t *pu8Dst = pData->vram_ptrHC; 3688 uint32_t cyLeft = cy; 3689 uint16_t i; 3690 3691 pu8Dst += pData->LogoX * 4 + pData->LogoY * cbLineDst; 3692 3693 switch (pData->LogoDepth) 3694 { 3695 case 1: 3696 pu8Dst += pData->LogoHeight * cbLineDst; 3697 cbPadBytes = 0; 3698 break; 3699 case 4: 3700 if (((pData->LogoWidth % 8) == 0) || ((pData->LogoWidth % 8) > 6)) 3701 cbPadBytes = 0; 3702 else if ((pData->LogoWidth % 8) <= 2) 3703 cbPadBytes = 3; 3704 else if ((pData->LogoWidth % 8) <= 4) 3705 cbPadBytes = 2; 3706 else 3707 cbPadBytes = 1; 3708 break; 3709 case 8: 3710 cbPadBytes = ((pData->LogoWidth % 4) == 0) ? 0 : (4 - (pData->LogoWidth % 4)); 3711 break; 3712 case 24: 3713 cbPadBytes = cx % 4; 3714 break; 3715 } 3716 3717 if (pData->LogoDepth == 1) 3718 { 3719 pu8Src = (uint8_t *)&LogoF12BootText; 3720 } 3721 else 3722 { 3723 if (pData->BmpImage == LOGO_IMAGE_EXTERNAL) 3724 pu8Src = (uint8_t *)&pData->pu8Logo[pData->offLogoData]; 3725 else 3726 pu8Src = (uint8_t *)&g_abVgaDefBiosLogo[pData->offLogoData]; 3727 } 3728 3729 uint8_t j = 0, c = 0; 3730 3731 while (cyLeft-- > 0) 3732 { 3733 pu8TmpPtr = pu8Dst; 3734 3735 if (pData->LogoDepth != 1) 3736 j = 0; 3737 3738 for (i = 0; i < cx; i++) 3739 { 3740 uint8_t pix; 3741 3742 switch (pData->LogoDepth) 3743 { 3744 case 1: 3745 { 3746 if (!j) 3747 c = *pu8Src++; 3748 3749 pix = (c & 1) ? 0xFF : 0; 3750 c >>= 1; 3751 3752 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3753 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3754 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3755 *pu8TmpPtr++; 3756 3757 if (j++ >= 7) j = 0; 3758 } 3759 break; 3760 case 4: 3761 { 3762 uint32_t p; 3763 3764 if (!j) 3765 c = *pu8Src++; 3766 3767 pix = (c >> 4) & 0xF; 3768 c <<= 4; 3769 3770 p = pData->Palette[pix]; 3771 3772 pix = (p >> 16) & 0xFF; 3773 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3774 pix = (p >> 8) & 0xFF; 3775 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3776 pix = p & 0xFF; 3777 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3778 *pu8TmpPtr++; 3779 3780 if (j++ >= 1) j = 0; 3781 } 3782 break; 3783 case 8: 3784 { 3785 uint32_t p; 3786 3787 p = pData->Palette[*pu8Src++]; 3788 3789 pix = (p >> 16) & 0xFF; 3790 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3791 pix = (p >> 8) & 0xFF; 3792 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3793 pix = p & 0xFF; 3794 *pu8TmpPtr++ = pix * cbStep / LOGO_SHOW_STEPS; 3795 *pu8TmpPtr++; 3796 } 3797 break; 3798 case 24: 3799 *pu8TmpPtr++ = *pu8Src++ * cbStep / LOGO_SHOW_STEPS; 3800 *pu8TmpPtr++ = *pu8Src++ * cbStep / LOGO_SHOW_STEPS; 3801 *pu8TmpPtr++ = *pu8Src++ * cbStep / LOGO_SHOW_STEPS; 3802 *pu8TmpPtr++; 3803 break; 3804 } 3805 } 3806 3807 pu8Dst -= cbLineDst; 3808 pu8Src += cbPadBytes; 3809 } 3810 3811 /* 3812 * Invalidate the area. 3813 */ 3814 pData->pDrv->pfnUpdateRect(pData->pDrv, 0, 0, scr_cx, scr_cy); 3815 3816 pData->LogoCommand = LOGO_CMD_NOP; 3817 } 3818 break; 3819 default: 3820 Log(("vbeIOPortWriteCMDLogo: invalid command %d\n", u32)); 3821 pData->LogoCommand = LOGO_CMD_NOP; 3822 break; 3823 } 3824 3825 return VINF_SUCCESS; 3826 } 3827 3828 Log(("vbeIOPortWriteCMDLogo: Ignoring invalid cb=%d writes to the VBE Extra port!!!\n", cb)); 3829 return VINF_SUCCESS; 3830 } 3831 3832 3833 /** 3834 * Port I/O Handler for BIOS Logo IN operations. 3835 * 3836 * @returns VBox status code. 3837 * 3838 * @param pDevIns The device instance. 3839 * @param pvUser User argument - ignored. 3840 * @param Port Port number used for the IN operation. 3841 * @param pu32 Where to store the result. 3842 * @param cb Number of bytes read. 3843 */ 3844 PDMBOTHCBDECL(int) vbeIOPortReadCMDLogo(PPDMDEVINS pDevIns, void *pvUser, RTIOPORT Port, uint32_t *pu32, unsigned cb) 3845 { 3846 PVGASTATE pData = PDMINS2DATA(pDevIns, PVGASTATE); 3847 NOREF(pvUser); 3848 NOREF(Port); 3849 3850 PRTUINT64U p; 3851 3852 if (pData->BmpImage == LOGO_IMAGE_DEFAULT) 3853 { 3854 /* 3855 * Default bios logo. 3856 */ 3857 if (pData->offLogoData + cb > g_cbVgaDefBiosLogo) 3858 { 3859 Log(("vbeIOPortReadCMDLogo: Requested address is out of Logo data!!! offLogoData=%#x(%d) cbLogo=%#x(%d)\n", 3860 pData->offLogoData, pData->offLogoData, g_cbVgaDefBiosLogo, g_cbVgaDefBiosLogo)); 3861 return VINF_SUCCESS; 3862 } 3863 p = (PRTUINT64U)&g_abVgaDefBiosLogo[pData->offLogoData]; 3864 } 3865 else 3866 { 3867 /* 3868 * Custom logo. 3869 */ 3870 if (pData->offLogoData + cb > pData->cbLogo) 3871 { 3872 Log(("vbeIOPortReadCMDLogo: Requested address is out of Logo data!!! offLogoData=%#x(%d) cbLogo=%#x(%d)\n", 3873 pData->offLogoData, pData->offLogoData, pData->cbLogo, pData->cbLogo)); 3874 return VINF_SUCCESS; 3875 } 3876 p = (PRTUINT64U)&pData->pu8Logo[pData->offLogoData]; 3877 } 3878 3879 switch (cb) 3880 { 3881 case 1: *pu32 = p->au8[0]; break; 3882 case 2: *pu32 = p->au16[0]; break; 3883 case 4: *pu32 = p->au32[0]; break; 3884 //case 8: *pu32 = p->au64[0]; break; 3885 default: AssertFailed(); break; 3886 } 3887 Log(("vbeIOPortReadCMDLogo: LogoOffset=%#x(%d) cb=%#x %.*Vhxs\n", pData->offLogoData, pData->offLogoData, cb, cb, pu32)); 3888 3889 pData->LogoCommand = LOGO_CMD_NOP; 3890 pData->offLogoData += cb; 3891 3892 return VINF_SUCCESS; 3893 } 3894 3511 3895 3512 3896 … … 4332 4716 } 4333 4717 4718 /* 4719 * Reset the logo data. 4720 */ 4721 pData->LogoCommand = LOGO_CMD_NOP; 4722 pData->offLogoData = 0; 4723 4334 4724 /* notify port handler */ 4335 4725 if (pData->pDrv) … … 4504 4894 "GCEnabled\0" 4505 4895 "R0Enabled\0" 4896 "FadeIn\0" 4897 "FadeOut\0" 4898 "LogoTime\0" 4899 "LogoFile\0" 4900 "ShowBootMenu\0" 4506 4901 "CustomVideoModes\0" 4507 4902 "HeightReduction\0" … … 4981 5376 4982 5377 /* 5378 * Register I/O Port for the BIOS Logo. 5379 */ 5380 rc = PDMDevHlpIOPortRegister(pDevIns, VBE_LOGO_PORT, 1, NULL, vbeIOPortWriteCMDLogo, vbeIOPortReadCMDLogo, NULL, NULL, "BIOS Logo"); 5381 if (VBOX_FAILURE(rc)) 5382 return rc; 5383 5384 /* 5385 * Construct the logo header. 5386 */ 5387 LOGOHDR LogoHdr = { LOGO_HDR_MAGIC, 0, 0, 0, 0, 0 }; 5388 5389 rc = CFGMR3QueryU8(pCfgHandle, "FadeIn", &LogoHdr.u8FadeIn); 5390 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 5391 LogoHdr.u8FadeIn = 1; 5392 else if (VBOX_FAILURE(rc)) 5393 return PDMDEV_SET_ERROR(pDevIns, rc, 5394 N_("Configuration error: Querying \"FadeIn\" as integer failed")); 5395 5396 rc = CFGMR3QueryU8(pCfgHandle, "FadeOut", &LogoHdr.u8FadeOut); 5397 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 5398 LogoHdr.u8FadeOut = 1; 5399 else if (VBOX_FAILURE(rc)) 5400 return PDMDEV_SET_ERROR(pDevIns, rc, 5401 N_("Configuration error: Querying \"FadeOut\" as integer failed")); 5402 5403 rc = CFGMR3QueryU16(pCfgHandle, "LogoTime", &LogoHdr.u16LogoMillies); 5404 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 5405 LogoHdr.u16LogoMillies = 1; 5406 else if (VBOX_FAILURE(rc)) 5407 return PDMDEV_SET_ERROR(pDevIns, rc, 5408 N_("Configuration error: Querying \"LogoTime\" as integer failed")); 5409 5410 rc = CFGMR3QueryU8(pCfgHandle, "ShowBootMenu", &LogoHdr.u8ShowBootMenu); 5411 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 5412 LogoHdr.u8ShowBootMenu = 0; 5413 else if (VBOX_FAILURE(rc)) 5414 return PDMDEV_SET_ERROR(pDevIns, rc, 5415 N_("Configuration error: Querying \"ShowBootMenu\" as integer failed")); 5416 5417 /* 5418 * Get the Logo file name. 5419 */ 5420 rc = CFGMR3QueryStringAlloc(pCfgHandle, "LogoFile", &pData->pszLogoFile); 5421 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 5422 pData->pszLogoFile = NULL; 5423 else if (VBOX_FAILURE(rc)) 5424 return PDMDEV_SET_ERROR(pDevIns, rc, 5425 N_("Configuration error: Querying \"LogoFile\" as a string failed")); 5426 else if (!*pData->pszLogoFile) 5427 { 5428 MMR3HeapFree(pData->pszLogoFile); 5429 pData->pszLogoFile = NULL; 5430 } 5431 5432 /* 5433 * Determine the logo size, open any specified logo file in the process. 5434 */ 5435 LogoHdr.cbLogo = g_cbVgaDefBiosLogo; 5436 RTFILE FileLogo = NIL_RTFILE; 5437 if (pData->pszLogoFile) 5438 { 5439 rc = RTFileOpen(&FileLogo, pData->pszLogoFile, 5440 RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE); 5441 if (VBOX_SUCCESS(rc)) 5442 { 5443 uint64_t cbFile; 5444 rc = RTFileGetSize(FileLogo, &cbFile); 5445 if (VBOX_SUCCESS(rc)) 5446 { 5447 if (cbFile > 0) 5448 LogoHdr.cbLogo = (uint32_t)cbFile; 5449 else 5450 rc = VERR_TOO_MUCH_DATA; 5451 } 5452 } 5453 if (VBOX_FAILURE(rc)) 5454 { 5455 /* 5456 * Ignore failure and fall back to the default logo. 5457 */ 5458 LogRel(("vgaR3Construct: Failed to open logo file '%s', rc=%Vrc!\n", pData->pszLogoFile, rc)); 5459 RTFileClose(FileLogo); 5460 FileLogo = NIL_RTFILE; 5461 MMR3HeapFree(pData->pszLogoFile); 5462 pData->pszLogoFile = NULL; 5463 } 5464 } 5465 5466 /* 5467 * Allocate buffer for the logo data. 5468 * RT_MAX() is applied to let us fall back to default logo on read failure. 5469 */ 5470 pData->cbLogo = sizeof(LogoHdr) + LogoHdr.cbLogo; 5471 pData->pu8Logo = (uint8_t *)PDMDevHlpMMHeapAlloc(pDevIns, RT_MAX(pData->cbLogo, g_cbVgaDefBiosLogo + sizeof(LogoHdr))); 5472 if (pData->pu8Logo) 5473 { 5474 /* 5475 * Write the logo header. 5476 */ 5477 PLOGOHDR pLogoHdr = (PLOGOHDR)pData->pu8Logo; 5478 *pLogoHdr = LogoHdr; 5479 5480 /* 5481 * Write the logo bitmap. 5482 */ 5483 if (pData->pszLogoFile) 5484 { 5485 rc = RTFileRead(FileLogo, pLogoHdr + 1, LogoHdr.cbLogo, NULL); 5486 if (VBOX_FAILURE(rc)) 5487 { 5488 AssertMsgFailed(("RTFileRead(,,%d,NULL) -> %Vrc\n", LogoHdr.cbLogo, rc)); 5489 pLogoHdr->cbLogo = LogoHdr.cbLogo = g_cbVgaDefBiosLogo; 5490 memcpy(pLogoHdr + 1, g_abVgaDefBiosLogo, LogoHdr.cbLogo); 5491 } 5492 } 5493 else 5494 memcpy(pLogoHdr + 1, g_abVgaDefBiosLogo, LogoHdr.cbLogo); 5495 5496 pData->BmpImage = LOGO_IMAGE_EXTERNAL; 5497 5498 rc = VINF_SUCCESS; 5499 } 5500 else 5501 rc = VERR_NO_MEMORY; 5502 5503 /* cleanup */ 5504 if (FileLogo != NIL_RTFILE) 5505 RTFileClose(FileLogo); 5506 5507 /* 4983 5508 * Statistics. 4984 5509 */ … … 4988 5513 STAM_REG(pVM, &pData->StatGCIOPortWrite, STAMTYPE_PROFILE, "/Devices/VGA/GC/IOPort/Write", STAMUNIT_TICKS_PER_CALL, "Profiling of the VGAGCIOPortWrite() body."); 4989 5514 4990 return VINF_SUCCESS;5515 return rc; 4991 5516 } 4992 5517 -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r7074 r7759 317 317 uint16_t Padding7[2]; /**< Alignment padding. */ 318 318 #endif 319 /** Current logo command. */ 320 uint16_t LogoCommand; 321 /** Current logo data offset. */ 322 uint32_t offLogoData; 323 /** Bitmap image to use. */ 324 uint8_t BmpImage; 325 /** The size of the BIOS logo data. */ 326 uint32_t cbLogo; 327 /** The BIOS logo data. */ 328 uint8_t *pu8Logo; 329 /** The name of the logo file. */ 330 char *pszLogoFile; 331 /** Logo X. */ 332 uint16_t LogoX; 333 /** Logo Y. */ 334 uint16_t LogoY; 335 /** Logo width. */ 336 uint16_t LogoWidth; 337 /** Logo height. */ 338 uint16_t LogoHeight; 339 /** Logo depth. */ 340 uint16_t LogoDepth; 341 /** Palette data. */ 342 uint32_t Palette[256]; 343 /** Palette size. */ 344 uint16_t PalSize; 319 345 320 346 #endif /* VBOX */ … … 359 385 #endif /* VBE_NEW_DYN_LIST */ 360 386 387 /** The extra port which is used to show the BIOS logo. 388 * @remark duplicated in logo.c. */ 389 #define VBE_LOGO_PORT 0x3b8 390 391 /** The BIOS logo fade in/fade out steps. 392 * @remark duplicated in logo.c. */ 393 #define LOGO_SHOW_STEPS 64 394 395 /** The BIOS boot menu text position. */ 396 #define LOGO_F12TEXT_X 340 397 #define LOGO_F12TEXT_Y 455 398 399 /** Width and height of the "Press F12 to select boot device." bitmap. 400 Anything that exceeds the limit of F12BootText below is filled with 401 background. */ 402 #define LOGO_F12TEXT_WIDTH 286 403 #define LOGO_F12TEXT_HEIGHT 12 404 405 /** The BIOS logo commands. 406 * @remark duplicated in logo.c. */ 407 #define LOGO_IMAGE_DEFAULT 0 408 #define LOGO_IMAGE_EXTERNAL 1 409 410 #define LOGO_MAX_WIDTH 640 411 #define LOGO_MAX_HEIGHT 480 412 413 #define LOGO_CMD_NOP 0 414 #define LOGO_CMD_SET_OFFSET 0x100 415 #define LOGO_CMD_SET_X 0x200 416 #define LOGO_CMD_SET_Y 0x300 417 #define LOGO_CMD_SET_WIDTH 0x400 418 #define LOGO_CMD_SET_HEIGHT 0x500 419 #define LOGO_CMD_SET_DEPTH 0x600 420 #define LOGO_CMD_SET_PALSIZE 0x700 421 #define LOGO_CMD_SET_DEFAULT 0x800 422 #define LOGO_CMD_SET_PAL 0x900 423 #define LOGO_CMD_SHOW_BMP 0xA00 424 #define LOGO_CMD_SHOW_TEXT 0xB00 425 #define LOGO_CMD_CLS 0xC00 426 427 /** 428 * PC Bios logo data structure. 429 */ 430 #pragma pack(2) /* pack(2) is important! (seems that bios compiled with pack(2)...) */ 431 typedef struct LOGOHDR 432 { 433 /** Signature (LOGO_HDR_MAGIC/0x66BB). */ 434 uint16_t u16Signature; 435 /** Fade in - boolean. */ 436 uint8_t u8FadeIn; 437 /** Fade out - boolean. */ 438 uint8_t u8FadeOut; 439 /** Logo time (msec). */ 440 uint16_t u16LogoMillies; 441 /** Show setup - boolean. */ 442 uint8_t u8ShowBootMenu; 443 /** Logo file size. */ 444 uint32_t cbLogo; 445 } LOGOHDR, *PLOGOHDR; 446 #pragma pack() 447 448 /** The value of the LOGOHDR::u16Signature field. */ 449 #define LOGO_HDR_MAGIC 0x66BB 450 451 /** The value which will switch you the default logo. */ 452 #define LOGO_DEFAULT_LOGO 0xFFFF 453 361 454 #if !defined(VBOX) || defined(IN_RING3) 362 455 static inline int c6_to_8(int v)
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器