Changeset 2106 in vbox for trunk/src/VBox/Devices/Graphics
- Timestamp:
- Apr 16, 2007 3:25:48 PM (18 years ago)
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r2079 r2106 1406 1406 * - flashing 1407 1407 */ 1408 #ifndef VBOX 1408 1409 static void vga_draw_text(VGAState *s, int full_update) 1410 #else 1411 static int vga_draw_text(VGAState *s, int full_update) 1412 #endif /* !VBOX */ 1409 1413 { 1410 1414 int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr; … … 1484 1488 if ((height * width) > CH_ATTR_SIZE) { 1485 1489 /* better than nothing: exit if transient size is too big */ 1490 #ifndef VBOX 1486 1491 return; 1492 #else 1493 return VINF_SUCCESS; 1494 #endif /* VBOX */ 1487 1495 } 1488 1496 … … 1493 1501 #ifndef VBOX 1494 1502 dpy_resize(s->ds, s->last_scr_width, s->last_scr_height); 1495 #else /* VBOX */1496 /* For text modes the external memory buffer can not be used, so bpp and cbLine are 0 here. */1497 s->pDrv->pfnResize(s->pDrv, 0, NULL, 0, s->last_scr_width, s->last_scr_height);1498 #endif /* VBOX */1499 1503 s->last_width = width; 1500 1504 s->last_height = height; … … 1502 1506 s->last_cw = cw; 1503 1507 full_update = 1; 1508 #else /* VBOX */ 1509 /* For text modes the direct use of guest VRAM is not implemented, so bpp and cbLine are 0 here. */ 1510 int rc = s->pDrv->pfnResize(s->pDrv, 0, NULL, 0, s->last_scr_width, s->last_scr_height); 1511 s->last_width = width; 1512 s->last_height = height; 1513 s->last_ch = cheight; 1514 s->last_cw = cw; 1515 full_update = 1; 1516 if (rc == VINF_VGA_RESIZE_IN_PROGRESS) 1517 return rc; 1518 AssertRC(rc); 1519 #endif /* VBOX */ 1504 1520 } 1505 1521 cursor_offset = ((s->cr[0x0e] << 8) | s->cr[0x0f]) - s->start_addr; … … 1612 1628 s1 += line_offset; 1613 1629 } 1630 #ifdef VBOX 1631 return VINF_SUCCESS; 1632 #endif /* VBOX */ 1614 1633 } 1615 1634 … … 1744 1763 { 1745 1764 const unsigned cBits = s->get_bpp(s); 1746 #if 0 /** @todo kill the nasty resize deadlocks! */1747 int rc = s->pDrv->pfnResize(s->pDrv, cBits, s->CTXSUFF(vram_ptr), s->line_offset, cx, cy);1748 if (rc == VINF_VGA_RESIZE_IN_PROGRESS)1749 return rc;1750 AssertRC(rc);1751 #else1752 1765 /** @todo r=sunlover: If the guest changes VBE_DISPI_INDEX_X_OFFSET, VBE_DISPI_INDEX_Y_OFFSET 1753 1766 * registers, then the third parameter of the following call should be 1754 1767 * probably 's->CTXSUFF(vram_ptr) + s->vbe_start_addr'. 1755 1768 */ 1756 s->pDrv->pfnResize(s->pDrv, cBits, s->CTXSUFF(vram_ptr), s->line_offset, cx, cy); 1757 #endif 1769 int rc = s->pDrv->pfnResize(s->pDrv, cBits, s->CTXSUFF(vram_ptr), s->line_offset, cx, cy); 1758 1770 1759 1771 /* last stuff */ … … 1764 1776 s->last_height = cy; 1765 1777 1778 if (rc == VINF_VGA_RESIZE_IN_PROGRESS) 1779 return rc; 1780 AssertRC(rc); 1781 1766 1782 /* update palette */ 1767 1783 switch (s->pDrv->cBits) … … 1784 1800 * graphic modes 1785 1801 */ 1802 #ifndef VBOX 1786 1803 static void vga_draw_graphic(VGAState *s, int full_update) 1804 #else 1805 static int vga_draw_graphic(VGAState *s, int full_update) 1806 #endif /* !VBOX */ 1787 1807 { 1788 1808 int y1, y, update, page_min, page_max, linesize, y_start, double_scan, mask; … … 1875 1895 || height != (int)s->last_height 1876 1896 || s->get_bpp(s) != (int)s->last_bpp 1877 || offsets_changed) { 1878 if (vga_resize_graphic(s, disp_width, height, v) != VINF_SUCCESS) 1879 return; 1897 || offsets_changed) 1898 { 1899 int rc = vga_resize_graphic(s, disp_width, height, v); 1900 if (rc != VINF_SUCCESS) /* Return any rc, particularly VINF_VGA_RESIZE_IN_PROGRESS, to the caller. */ 1901 return rc; 1880 1902 full_update = 1; 1881 1903 } … … 1900 1922 * programming of the virtual hardware ports. Just return. 1901 1923 */ 1902 if (bwidth == 0) return ;1924 if (bwidth == 0) return VINF_SUCCESS; 1903 1925 #endif /* VBOX */ 1904 1926 y_start = -1; … … 1957 1979 vga_draw_line(s, d, s->vram_ptr + addr, width); 1958 1980 #else /* VBOX */ 1959 if (s-> pvExtVRAMHC != s->pDrv->pu8Data) /* Only if external VRAM was not setup. */1981 if (s->fRenderVRAM) 1960 1982 vga_draw_line(s, d, s->CTXSUFF(vram_ptr) + addr, width); 1961 1983 #endif /* VBOX */ … … 2007 2029 } 2008 2030 memset(s->invalidated_y_table, 0, ((height + 31) >> 5) * 4); 2031 #ifdef VBOX 2032 return VINF_SUCCESS; 2033 #endif /* VBOX */ 2009 2034 } 2010 2035 … … 2062 2087 void vga_update_display(void) 2063 2088 { 2064 #ifdef DEBUG_sunlover2065 LogFlow(("vga_update_display"));2066 #endif /* DEBUG_sunlover */2067 2068 2089 VGAState *s = vga_state; 2069 2090 #else /* VBOX */ 2070 static void vga_update_display(PVGASTATE s) 2071 { 2091 static int vga_update_display(PVGASTATE s) 2092 { 2093 int rc = VINF_SUCCESS; 2072 2094 #endif /* VBOX */ 2073 2095 int full_update, graphic_mode; … … 2112 2134 switch(graphic_mode) { 2113 2135 case GMODE_TEXT: 2136 #ifdef VBOX 2137 rc = 2138 #endif /* VBOX */ 2114 2139 vga_draw_text(s, full_update); 2115 2140 break; 2116 2141 case GMODE_GRAPH: 2142 #ifdef VBOX 2143 rc = 2144 #endif /* VBOX */ 2117 2145 vga_draw_graphic(s, full_update); 2118 2146 break; … … 2123 2151 } 2124 2152 } 2153 #ifdef VBOX 2154 return rc; 2155 #endif /* VBOX */ 2125 2156 } 2126 2157 … … 3522 3553 * @thread The emulation thread. 3523 3554 */ 3524 static DECLCALLBACK(void) vgaDummyResize(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy) 3525 { 3555 static DECLCALLBACK(int) vgaDummyResize(PPDMIDISPLAYCONNECTOR pInterface, uint32_t bpp, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy) 3556 { 3557 return VINF_SUCCESS; 3526 3558 } 3527 3559 … … 3572 3604 * @see PDMIKEYBOARDPORT::pfnUpdateDisplay() for details. 3573 3605 */ 3574 static DECLCALLBACK( void) vgaPortUpdateDisplay(PPDMIDISPLAYPORT pInterface)3606 static DECLCALLBACK(int) vgaPortUpdateDisplay(PPDMIDISPLAYPORT pInterface) 3575 3607 { 3576 3608 PVGASTATE pData = IDISPLAYPORT_2_VGASTATE(pInterface); … … 3583 3615 /* This should be called only in non VBVA mode. */ 3584 3616 3585 vga_update_display(pData); 3617 int rc = vga_update_display(pData); 3618 if (rc != VINF_SUCCESS) 3619 return rc; 3586 3620 3587 3621 if (pData->fHaveDirtyBits) … … 3591 3625 pData->fHaveDirtyBits = false; 3592 3626 } 3627 3628 return VINF_SUCCESS; 3593 3629 } 3594 3630 … … 3600 3636 * @see PDMIKEYBOARDPORT::pfnUpdateDisplayAll() for details. 3601 3637 */ 3602 static DECLCALLBACK( void) vgaPortUpdateDisplayAll(PPDMIDISPLAYPORT pInterface)3638 static DECLCALLBACK(int) vgaPortUpdateDisplayAll(PPDMIDISPLAYPORT pInterface) 3603 3639 { 3604 3640 PVGASTATE pData = IDISPLAYPORT_2_VGASTATE(pInterface); … … 3612 3648 3613 3649 pData->graphic_mode = -1; /* force full update */ 3614 vga_update_display(pData);3650 return vga_update_display(pData); 3615 3651 } 3616 3652 … … 3660 3696 static DECLCALLBACK(int) vgaPortSnapshot(PPDMIDISPLAYPORT pInterface, void *pvData, size_t cbData, uint32_t *pcx, uint32_t *pcy, size_t *pcbData) 3661 3697 { 3698 /* @todo r=sunlover: replace the method with a direct VRAM rendering like in vgaPortUpdateDisplayRect. */ 3662 3699 PPDMIDISPLAYCONNECTOR pConnector; 3663 3700 PDMIDISPLAYCONNECTOR Connector; … … 3713 3750 3714 3751 /* make the snapshot. */ 3715 vga_update_display(pData); 3752 int rc = vga_update_display(pData); 3753 if (rc != VINF_SUCCESS) 3754 return rc; 3716 3755 3717 3756 /* restore */ … … 3843 3882 3844 3883 /* Check if there is something to do at all. */ 3845 if ( s->pvExtVRAMHC == s->pDrv->pu8Data)3884 if (!s->fRenderVRAM) 3846 3885 { 3847 3886 /* The framebuffer uses the guest VRAM directly. */ 3848 3887 #ifdef DEBUG_sunlover 3849 LogFlow(("vgaPortUpdateDisplayRect: nothing to do : s->pvExtVRAMHC %p, s->pDrv->pu8Data %p\n", s->pvExtVRAMHC, s->pDrv->pu8Data));3888 LogFlow(("vgaPortUpdateDisplayRect: nothing to do fRender is false.\n")); 3850 3889 #endif /* DEBUG_sunlover */ 3851 3890 return; … … 3944 3983 * This is true because coordinates were verified. 3945 3984 */ 3946 pu8Src = s-> pvExtVRAMHC? (uint8_t *)s->pvExtVRAMHC: s->vram_ptrHC;3985 pu8Src = s->vram_ptrHC; 3947 3986 pu8Src += u32OffsetSrc + y * cbLineSrc + x * cbPixelSrc; 3948 3987 … … 3965 4004 } 3966 4005 3967 static DECLCALLBACK(int) vgaPortSetupVRAM (PPDMIDISPLAYPORT pInterface, void *pvBuffer, uint32_t cbBuffer) 3968 { 3969 int rc = VINF_SUCCESS; 4006 static DECLCALLBACK(void) vgaPortSetRenderVRAM(PPDMIDISPLAYPORT pInterface, bool fRender) 4007 { 3970 4008 PVGASTATE s = IDISPLAYPORT_2_VGASTATE(pInterface); 3971 PPDMDEVINS pDevIns; 3972 PVM pVM; 3973 3974 uint32_t u32OverlayOffset = 0; 3975 3976 LogFlow(("vgaPortSetupVRAM: pvBuffer = %p, cbBuffer = 0x%08X, s->vram_ptrHC = %p\n", pvBuffer, cbBuffer, s->vram_ptrHC)); 3977 3978 /* Check input values, Main::Display rely on that. */ 3979 if (ALIGNP(pvBuffer, PAGE_SIZE) != pvBuffer) 3980 { 3981 LogFlow(("vgaPortSetupVRAM: Not aligned address.\n")); 3982 return VERR_INVALID_PARAMETER; 3983 } 3984 3985 pDevIns = s->pDevInsHC; 3986 Assert(pDevIns); 3987 3988 pVM = PDMDevHlpGetVM(pDevIns); 3989 Assert(pVM); 3990 3991 if (s->pvExtVRAMHC != NULL) 3992 { 3993 if (s->pvExtVRAMHC != s->vram_ptrHC) 3994 { 3995 /* @todo */ 3996 AssertMsgFailed(("Too early to call SetupVRAM with external VRAM\n")); 3997 3998 /* Remove existing overlay mapping. */ 3999 // MMR3PPhysUnregisterOverlay (pVM, s->GCPhysVRAM, u32OverlayOffset, s->pvExtVRAMHC, s->cbExtVRAM); 4000 4001 /* Copy the content of the external VRAM to the device VRAM. */ 4002 memcpy (s->vram_ptrHC + u32OverlayOffset, s->pvExtVRAMHC, s->cbExtVRAM); 4003 } 4004 4005 s->pvExtVRAMHC = NULL; 4006 s->cbExtVRAM = 0; 4007 } 4008 4009 if (pvBuffer == NULL) 4010 { 4011 /* Resetting VRAM to use only vga device allocated memory. */ 4012 Assert (cbBuffer == 0); 4013 return VINF_SUCCESS; 4014 } 4015 4016 if (pvBuffer == s->vram_ptrHC) 4017 { 4018 /* Caller will use the guest VRAM directly. Do nothing. Ignore cbBuffer. */ 4019 cbBuffer = 0; 4020 rc = VINF_SUCCESS; 4021 } 4022 else 4023 { 4024 /* Register new overlay. */ 4025 4026 /* @todo */ 4027 AssertMsgFailed(("Too early to call SetupVRAM with external VRAM\n")); 4028 4029 cbBuffer = RT_ALIGN_32(cbBuffer, PAGE_SIZE); 4030 4031 // rc = MMR3PhysRegisterOverlay(pVM, s->GCPhysVRAM, u32OverlayOffset, pvBuffer, cbBuffer, "FBVRam"); 4032 } 4033 4034 if (VBOX_SUCCESS (rc)) 4035 { 4036 s->pvExtVRAMHC = pvBuffer; 4037 s->cbExtVRAM = cbBuffer; 4038 } 4039 4040 return rc; 4009 4010 LogFlow(("vgaPortSetRenderVRAM: fRender = %d\n", fRender)); 4011 4012 s->fRenderVRAM = fRender; 4041 4013 } 4042 4014 … … 4575 4547 pData->Port.pfnDisplayBlt = vgaPortDisplayBlt; 4576 4548 pData->Port.pfnUpdateDisplayRect= vgaPortUpdateDisplayRect; 4577 pData->Port.pfnSet upVRAM = vgaPortSetupVRAM;4549 pData->Port.pfnSetRenderVRAM = vgaPortSetRenderVRAM; 4578 4550 4579 4551 -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r2079 r2106 281 281 uint32_t Padding0; /* May be removed if more data is added */ 282 282 283 /** Size of the buffer*/ 284 uint32_t cbExtVRAM; 285 /** Address of external video memory buffer overlaying VRAM. */ 286 R3PTRTYPE(void *) pvExtVRAMHC; 287 #if HC_ARCH_BITS ==32 288 uint32_t Alignment0; 289 #endif 283 /** Whether to render the guest VRAM to the framebuffer memory. False only for some LFB modes. */ 284 uint32_t fRenderVRAM; 290 285 291 286 /** The PCI device. */
Note:
See TracChangeset
for help on using the changeset viewer.