Changeset 51461 in vbox for trunk/src/VBox/Devices/Graphics
- Timestamp:
- May 29, 2014 1:20:06 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 94031
- Location:
- trunk/src/VBox/Devices/Graphics
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r51365 r51461 1699 1699 * - flashing 1700 1700 */ 1701 static int vga_draw_text(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty) 1701 static int vga_draw_text(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty, 1702 PDMIDISPLAYCONNECTOR *pDrv, bool fRenderVRAM) 1702 1703 { 1703 1704 int cx, cy, cheight, cw, ch, cattr, height, width, ch_attr; … … 1752 1753 if (pThis->sr[1] & 0x08) 1753 1754 cw = 16; /* NOTE: no 18 pixel wide */ 1754 x_incr = cw * ((p This->pDrv->cBits + 7) >> 3);1755 x_incr = cw * ((pDrv->cBits + 7) >> 3); 1755 1756 width = (pThis->cr[0x01] + 1); 1756 1757 if (pThis->cr[0x06] == 100) { … … 1778 1779 pThis->last_scr_height = height * cheight; 1779 1780 /* For text modes the direct use of guest VRAM is not implemented, so bpp and cbLine are 0 here. */ 1780 int rc = p This->pDrv->pfnResize(pThis->pDrv, 0, NULL, 0, pThis->last_scr_width, pThis->last_scr_height);1781 int rc = pDrv->pfnResize(pDrv, 0, NULL, 0, pThis->last_scr_width, pThis->last_scr_height); 1781 1782 pThis->last_width = width; 1782 1783 pThis->last_height = height; … … 1803 1804 } 1804 1805 cursor_ptr = pThis->CTX_SUFF(vram_ptr) + (pThis->start_addr + cursor_offset) * 8; 1805 depth_index = get_depth_index(p This->pDrv->cBits);1806 depth_index = get_depth_index(pDrv->cBits); 1806 1807 if (cw == 16) 1807 1808 vga_draw_glyph8 = vga_draw_glyph16_table[depth_index]; … … 1810 1811 vga_draw_glyph9 = vga_draw_glyph9_table[depth_index]; 1811 1812 1812 dest = p This->pDrv->pu8Data;1813 linesize = p This->pDrv->cbScanline;1813 dest = pDrv->pu8Data; 1814 linesize = pDrv->cbScanline; 1814 1815 ch_attr_ptr = pThis->last_ch_attr; 1815 1816 cy_start = -1; … … 1843 1844 fgcol = palette[cattr & 0x0f]; 1844 1845 if (cw != 9) { 1845 if ( pThis->fRenderVRAM)1846 if (fRenderVRAM) 1846 1847 vga_draw_glyph8(d1, linesize, 1847 1848 font_ptr, cheight, fgcol, bgcol, dscan); … … 1850 1851 if (ch >= 0xb0 && ch <= 0xdf && (pThis->ar[0x10] & 0x04)) 1851 1852 dup9 = 1; 1852 if ( pThis->fRenderVRAM)1853 if (fRenderVRAM) 1853 1854 vga_draw_glyph9(d1, linesize, 1854 1855 font_ptr, cheight, fgcol, bgcol, dup9); … … 1867 1868 d = d1 + (linesize * line_start << dscan); 1868 1869 if (cw != 9) { 1869 if ( pThis->fRenderVRAM)1870 if (fRenderVRAM) 1870 1871 vga_draw_glyph8(d, linesize, 1871 1872 cursor_glyph, h, fgcol, bgcol, dscan); 1872 1873 } else { 1873 if ( pThis->fRenderVRAM)1874 if (fRenderVRAM) 1874 1875 vga_draw_glyph9(d, linesize, 1875 1876 cursor_glyph, h, fgcol, bgcol, 1); … … 1892 1893 } else if (cy_start >= 0) { 1893 1894 /* Flush updates to display. */ 1894 p This->pDrv->pfnUpdateRect(pThis->pDrv, cx_min_upd * cw, cy_start * cheight,1895 pDrv->pfnUpdateRect(pDrv, cx_min_upd * cw, cy_start * cheight, 1895 1896 (cx_max_upd - cx_min_upd + 1) * cw, (cy - cy_start) * cheight); 1896 1897 cy_start = -1; … … 1903 1904 if (cy_start >= 0) 1904 1905 /* Flush any remaining changes to display. */ 1905 p This->pDrv->pfnUpdateRect(pThis->pDrv, cx_min_upd * cw, cy_start * cheight,1906 pDrv->pfnUpdateRect(pDrv, cx_min_upd * cw, cy_start * cheight, 1906 1907 (cx_max_upd - cx_min_upd + 1) * cw, (cy - cy_start) * cheight); 1907 1908 return VINF_SUCCESS; … … 2021 2022 * @param cy The height. 2022 2023 */ 2023 static int vga_resize_graphic(PVGASTATE pThis, int cx, int cy) 2024 static int vga_resize_graphic(PVGASTATE pThis, int cx, int cy, 2025 PDMIDISPLAYCONNECTOR *pDrv) 2024 2026 { 2025 2027 const unsigned cBits = pThis->get_bpp(pThis); … … 2048 2050 if (pThis->start_addr * 4 + pThis->line_offset * cy < pThis->vram_size) 2049 2051 /* Take into account the programmed start address (in DWORDs) of the visible screen. */ 2050 rc = p This->pDrv->pfnResize(pThis->pDrv, cBits, pThis->CTX_SUFF(vram_ptr) + pThis->start_addr * 4, pThis->line_offset, cx, cy);2052 rc = pDrv->pfnResize(pDrv, cBits, pThis->CTX_SUFF(vram_ptr) + pThis->start_addr * 4, pThis->line_offset, cx, cy); 2051 2053 else 2052 2054 { … … 2068 2070 2069 2071 /* update palette */ 2070 switch (p This->pDrv->cBits)2072 switch (pDrv->cBits) 2071 2073 { 2072 2074 case 32: pThis->rgb_to_pixel = rgb_to_pixel32_dup; break; … … 2152 2154 * graphic modes 2153 2155 */ 2154 static int vmsvga_draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty) 2156 static int vmsvga_draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty, 2157 PDMIDISPLAYCONNECTOR *pDrv, bool fRenderVRAM) 2155 2158 { 2156 2159 int y, page_min, page_max, linesize, y_start; … … 2197 2200 break; 2198 2201 } 2199 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(p This->pDrv->cBits)];2202 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(pDrv->cBits)]; 2200 2203 2201 2204 if (pThis->cursor_invalidate) … … 2207 2210 page_min = 0x7fffffff; 2208 2211 page_max = -1; 2209 d = p This->pDrv->pu8Data;2210 linesize = p This->pDrv->cbScanline;2212 d = pDrv->pu8Data; 2213 linesize = pDrv->cbScanline; 2211 2214 2212 2215 for(y = 0; y < height; y++) … … 2230 2233 if (page1 > page_max) 2231 2234 page_max = page1; 2232 if ( pThis->fRenderVRAM)2235 if (fRenderVRAM) 2233 2236 vga_draw_line(pThis, d, pThis->CTX_SUFF(vram_ptr) + addr, width); 2234 2237 if (pThis->cursor_draw_line) … … 2240 2243 /* flush to display */ 2241 2244 Log(("Flush to display (%d,%d)(%d,%d)\n", 0, y_start, disp_width, y - y_start)); 2242 p This->pDrv->pfnUpdateRect(pThis->pDrv, 0, y_start, disp_width, y - y_start);2245 pDrv->pfnUpdateRect(pDrv, 0, y_start, disp_width, y - y_start); 2243 2246 y_start = -1; 2244 2247 } … … 2250 2253 /* flush to display */ 2251 2254 Log(("Flush to display (%d,%d)(%d,%d)\n", 0, y_start, disp_width, y - y_start)); 2252 p This->pDrv->pfnUpdateRect(pThis->pDrv, 0, y_start, disp_width, y - y_start);2255 pDrv->pfnUpdateRect(pDrv, 0, y_start, disp_width, y - y_start); 2253 2256 } 2254 2257 /* reset modified pages */ … … 2263 2266 * graphic modes 2264 2267 */ 2265 static int vga_draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty) 2268 static int vga_draw_graphic(PVGASTATE pThis, bool full_update, bool fFailOnResize, bool reset_dirty, 2269 PDMIDISPLAYCONNECTOR *pDrv, bool fRenderVRAM) 2266 2270 { 2267 2271 int y1, y2, y, page_min, page_max, linesize, y_start, double_scan; … … 2341 2345 || height != (int)pThis->last_height 2342 2346 || pThis->get_bpp(pThis) != (int)pThis->last_bpp 2343 || (offsets_changed && ! pThis->fRenderVRAM))2347 || (offsets_changed && !fRenderVRAM)) 2344 2348 { 2345 2349 if (fFailOnResize) … … 2348 2352 return VERR_TRY_AGAIN; 2349 2353 } 2350 int rc = vga_resize_graphic(pThis, disp_width, height );2354 int rc = vga_resize_graphic(pThis, disp_width, height, pDrv); 2351 2355 if (rc != VINF_SUCCESS) /* Return any rc, particularly VINF_VGA_RESIZE_IN_PROGRESS, to the caller. */ 2352 2356 return rc; … … 2354 2358 } 2355 2359 2356 if ( pThis->fRenderVRAM)2360 if (fRenderVRAM) 2357 2361 { 2358 2362 /* Do not update the destination buffer if it is not big enough. 2359 2363 * Can happen if the resize request was ignored by the driver. 2360 2364 */ 2361 if ( p This->pDrv->cx != (uint32_t)width2362 || p This->pDrv->cy != (uint32_t)height)2365 if ( pDrv->cx != (uint32_t)width 2366 || pDrv->cy != (uint32_t)height) 2363 2367 { 2364 2368 LogRel(("Framebuffer mismatch: vga %dx%d, drv %dx%d!!!\n", 2365 2369 width, height, 2366 p This->pDrv->cx, pThis->pDrv->cy));2370 pDrv->cx, pDrv->cy)); 2367 2371 return VINF_SUCCESS; 2368 2372 } 2369 2373 } 2370 2374 2371 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(p This->pDrv->cBits)];2375 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(pDrv->cBits)]; 2372 2376 2373 2377 if (pThis->cursor_invalidate) … … 2384 2388 page_min = 0x7fffffff; 2385 2389 page_max = -1; 2386 d = p This->pDrv->pu8Data;2387 linesize = p This->pDrv->cbScanline;2390 d = pDrv->pu8Data; 2391 linesize = pDrv->cbScanline; 2388 2392 2389 2393 y1 = 0; … … 2416 2420 if (page1 > page_max) 2417 2421 page_max = page1; 2418 if ( pThis->fRenderVRAM)2422 if (fRenderVRAM) 2419 2423 vga_draw_line(pThis, d, pThis->CTX_SUFF(vram_ptr) + addr, width); 2420 2424 if (pThis->cursor_draw_line) … … 2423 2427 if (y_start >= 0) { 2424 2428 /* flush to display */ 2425 p This->pDrv->pfnUpdateRect(pThis->pDrv, 0, y_start, disp_width, y - y_start);2429 pDrv->pfnUpdateRect(pDrv, 0, y_start, disp_width, y - y_start); 2426 2430 y_start = -1; 2427 2431 } … … 2447 2451 if (y_start >= 0) { 2448 2452 /* flush to display */ 2449 p This->pDrv->pfnUpdateRect(pThis->pDrv, 0, y_start, disp_width, y - y_start);2453 pDrv->pfnUpdateRect(pDrv, 0, y_start, disp_width, y - y_start); 2450 2454 } 2451 2455 /* reset modified pages */ … … 2457 2461 } 2458 2462 2459 static void vga_draw_blank(PVGASTATE pThis, int full_update )2463 static void vga_draw_blank(PVGASTATE pThis, int full_update, PDMIDISPLAYCONNECTOR *pDrv, bool fRenderVRAM) 2460 2464 { 2461 2465 int i, w, val; 2462 2466 uint8_t *d; 2463 uint32_t cbScanline = p This->pDrv->cbScanline;2464 2465 if (p This->pDrv->pu8Data == pThis->vram_ptrR3) /* Do not clear the VRAM itself. */2467 uint32_t cbScanline = pDrv->cbScanline; 2468 2469 if (pDrv->pu8Data == pThis->vram_ptrR3) /* Do not clear the VRAM itself. */ 2466 2470 return; 2467 2471 if (!full_update) … … 2469 2473 if (pThis->last_scr_width <= 0 || pThis->last_scr_height <= 0) 2470 2474 return; 2471 if (p This->pDrv->cBits == 8)2475 if (pDrv->cBits == 8) 2472 2476 val = pThis->rgb_to_pixel(0, 0, 0); 2473 2477 else 2474 2478 val = 0; 2475 w = pThis->last_scr_width * ((p This->pDrv->cBits + 7) >> 3);2476 d = p This->pDrv->pu8Data;2477 if ( pThis->fRenderVRAM)2479 w = pThis->last_scr_width * ((pDrv->cBits + 7) >> 3); 2480 d = pDrv->pu8Data; 2481 if (fRenderVRAM) 2478 2482 { 2479 2483 for(i = 0; i < (int)pThis->last_scr_height; i++) { … … 2482 2486 } 2483 2487 } 2484 p This->pDrv->pfnUpdateRect(pThis->pDrv, 0, 0, pThis->last_scr_width, pThis->last_scr_height);2488 pDrv->pfnUpdateRect(pDrv, 0, 0, pThis->last_scr_width, pThis->last_scr_height); 2485 2489 } 2486 2490 … … 2498 2502 #endif 2499 2503 2500 static int vga_update_display(PVGASTATE pThis, bool fUpdateAll, bool fFailOnResize, bool reset_dirty) 2504 static int vga_update_display(PVGASTATE pThis, bool fUpdateAll, bool fFailOnResize, bool reset_dirty, 2505 PDMIDISPLAYCONNECTOR *pDrv, int32_t *pcur_graphic_mode, bool fRenderVRAM) 2501 2506 { 2502 2507 int rc = VINF_SUCCESS; 2503 2508 int graphic_mode; 2504 2509 2505 if (p This->pDrv->cBits == 0) {2510 if (pDrv->cBits == 0) { 2506 2511 /* nothing to do */ 2507 2512 } else { 2508 switch(p This->pDrv->cBits) {2513 switch(pDrv->cBits) { 2509 2514 case 8: 2510 2515 pThis->rgb_to_pixel = rgb_to_pixel8_dup; … … 2543 2548 if (fBlank) { 2544 2549 /* Provide a void pfnUpdateRect callback. */ 2545 if (p This->pDrv) {2546 pfnUpdateRect = p This->pDrv->pfnUpdateRect;2547 p This->pDrv->pfnUpdateRect = voidUpdateRect;2550 if (pDrv) { 2551 pfnUpdateRect = pDrv->pfnUpdateRect; 2552 pDrv->pfnUpdateRect = voidUpdateRect; 2548 2553 } 2549 2554 } … … 2552 2557 #ifdef VBOX_WITH_VMSVGA 2553 2558 if (pThis->svga.fEnabled) { 2554 pThis->graphic_mode = GMODE_SVGA;2555 rc = vmsvga_draw_graphic(pThis, 1, false, reset_dirty );2559 *pcur_graphic_mode = GMODE_SVGA; 2560 rc = vmsvga_draw_graphic(pThis, 1, false, reset_dirty, pDrv, fRenderVRAM); 2556 2561 } 2557 2562 else 2558 2563 #endif 2559 2564 if (pThis->gr[6] & 1) { 2560 pThis->graphic_mode = GMODE_GRAPH;2561 rc = vga_draw_graphic(pThis, 1, false, reset_dirty );2565 *pcur_graphic_mode = GMODE_GRAPH; 2566 rc = vga_draw_graphic(pThis, 1, false, reset_dirty, pDrv, fRenderVRAM); 2562 2567 } else { 2563 pThis->graphic_mode = GMODE_TEXT;2564 rc = vga_draw_text(pThis, 1, false, reset_dirty );2568 *pcur_graphic_mode = GMODE_TEXT; 2569 rc = vga_draw_text(pThis, 1, false, reset_dirty, pDrv, fRenderVRAM); 2565 2570 } 2566 2571 2567 2572 if (fBlank) { 2568 2573 /* Set the current mode and restore the callback. */ 2569 pThis->graphic_mode = GMODE_BLANK;2570 if (p This->pDrv) {2571 p This->pDrv->pfnUpdateRect = pfnUpdateRect;2574 *pcur_graphic_mode = GMODE_BLANK; 2575 if (pDrv) { 2576 pDrv->pfnUpdateRect = pfnUpdateRect; 2572 2577 } 2573 2578 } … … 2586 2591 graphic_mode = pThis->gr[6] & 1; 2587 2592 } 2588 bool full_update = graphic_mode != pThis->graphic_mode;2593 bool full_update = graphic_mode != *pcur_graphic_mode; 2589 2594 if (full_update) { 2590 pThis->graphic_mode = graphic_mode;2595 *pcur_graphic_mode = graphic_mode; 2591 2596 } 2592 2597 switch(graphic_mode) { 2593 2598 case GMODE_TEXT: 2594 rc = vga_draw_text(pThis, full_update, fFailOnResize, reset_dirty );2599 rc = vga_draw_text(pThis, full_update, fFailOnResize, reset_dirty, pDrv, fRenderVRAM); 2595 2600 break; 2596 2601 case GMODE_GRAPH: 2597 rc = vga_draw_graphic(pThis, full_update, fFailOnResize, reset_dirty );2602 rc = vga_draw_graphic(pThis, full_update, fFailOnResize, reset_dirty, pDrv, fRenderVRAM); 2598 2603 break; 2599 2604 #ifdef VBOX_WITH_VMSVGA 2600 2605 case GMODE_SVGA: 2601 rc = vmsvga_draw_graphic(pThis, full_update, fFailOnResize, reset_dirty );2606 rc = vmsvga_draw_graphic(pThis, full_update, fFailOnResize, reset_dirty, pDrv, fRenderVRAM); 2602 2607 break; 2603 2608 #endif 2604 2609 case GMODE_BLANK: 2605 2610 default: 2606 vga_draw_blank(pThis, full_update );2611 vga_draw_blank(pThis, full_update, pDrv, fRenderVRAM); 2607 2612 break; 2608 2613 } … … 4605 4610 } 4606 4611 4607 rc = vga_update_display(pThis, false, false, true); 4612 rc = vga_update_display(pThis, false, false, true, 4613 pThis->pDrv, &pThis->graphic_mode, pThis->fRenderVRAM); 4608 4614 PDMCritSectLeave(&pThis->CritSect); 4609 4615 return rc; … … 4637 4643 pThis->graphic_mode = -1; /* force full update */ 4638 4644 4639 return vga_update_display(pThis, true, false, true); 4640 } 4641 4645 return vga_update_display(pThis, true, false, true, 4646 pThis->pDrv, &pThis->graphic_mode, pThis->fRenderVRAM); 4647 } 4648 4649 4650 int vgaUpdateDisplayAll(PVGASTATE pThis) 4651 { 4652 #ifdef DEBUG_sunlover 4653 LogFlow(("vgaPortUpdateDisplayAll\n")); 4654 #endif /* DEBUG_sunlover */ 4655 4656 int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY); 4657 AssertRC(rc); 4658 4659 rc = updateDisplayAll(pThis); 4660 4661 PDMCritSectLeave(&pThis->CritSect); 4662 return rc; 4663 } 4642 4664 4643 4665 /** … … 4650 4672 { 4651 4673 PVGASTATE pThis = IDISPLAYPORT_2_VGASTATE(pInterface); 4652 /* this can be called from CmdVbva thread as a result of VBVA disable, 4653 * there should be no problem with calling it from there afaics */ 4654 // PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis)); 4674 PDMDEV_ASSERT_EMT(VGASTATE2DEVINS(pThis)); 4655 4675 4656 4676 /* This is called both in VBVA mode and normal modes. */ 4657 4677 4658 #ifdef DEBUG_sunlover 4659 LogFlow(("vgaPortUpdateDisplayAll\n")); 4660 #endif /* DEBUG_sunlover */ 4661 4662 int rc = PDMCritSectEnter(&pThis->CritSect, VERR_SEM_BUSY); 4663 AssertRC(rc); 4664 4665 rc = updateDisplayAll(pThis); 4666 4667 PDMCritSectLeave(&pThis->CritSect); 4668 return rc; 4678 return vgaUpdateDisplayAll(pThis); 4669 4679 } 4670 4680 … … 4759 4769 Connector.pfnResize = vgaDummyResize; 4760 4770 Connector.pfnUpdateRect = vgaDummyUpdateRect; 4761 /* keep the CtlSubmit unchanged */ 4762 Connector.pfnCrHgcmCtlSubmit = pThis->pDrv ? pThis->pDrv->pfnCrHgcmCtlSubmit : NULL; 4763 4764 /* Save & replace state data. */ 4765 PPDMIDISPLAYCONNECTOR pConnectorSaved = pThis->pDrv; 4766 int32_t graphic_mode_saved = pThis->graphic_mode; 4767 bool fRenderVRAMSaved = pThis->fRenderVRAM; 4768 4769 pThis->pDrv = &Connector; 4770 pThis->graphic_mode = -1; /* force a full refresh. */ 4771 pThis->fRenderVRAM = 1; /* force the guest VRAM rendering to the given buffer. */ 4771 4772 int32_t cur_graphic_mode = -1; 4772 4773 4773 4774 /* … … 4779 4780 * If there is a pending resize, the function will fail. 4780 4781 */ 4781 rc = vga_update_display(pThis, false, true, false); 4782 4783 /* Restore. */ 4784 pThis->pDrv = pConnectorSaved; 4785 pThis->graphic_mode = graphic_mode_saved; 4786 pThis->fRenderVRAM = fRenderVRAMSaved; 4782 rc = vga_update_display(pThis, false, true, false, 4783 &Connector, &cur_graphic_mode, 1); 4787 4784 4788 4785 if (rc == VINF_SUCCESS) -
trunk/src/VBox/Devices/Graphics/DevVGA.h
r51349 r51461 651 651 int vboxVBVALoadStateDone (PPDMDEVINS pDevIns, PSSMHANDLE pSSM); 652 652 653 int vgaUpdateDisplayAll(PVGASTATE pThis); 654 653 655 # ifdef VBOX_WITH_VDMA 654 656 typedef struct VBOXVDMAHOST *PVBOXVDMAHOST; -
trunk/src/VBox/Devices/Graphics/DevVGA_VDMA.cpp
r51364 r51461 1136 1136 VBVAEXHOSTCTL HCtl; 1137 1137 HCtl.enmType = VBVAEXHOSTCTL_TYPE_GHH_DISABLE; 1138 return vdmaVBVACtlSubmitSync(pVdma, &HCtl, VBVAEXHOSTCTL_SOURCE_HOST); 1138 int rc = vdmaVBVACtlSubmitSync(pVdma, &HCtl, VBVAEXHOSTCTL_SOURCE_HOST); 1139 if (RT_FAILURE(rc)) 1140 { 1141 WARN(("vdmaVBVACtlSubmitSync failed %d\n", rc)); 1142 return rc; 1143 } 1144 1145 vgaUpdateDisplayAll(pVdma->pVGAState); 1146 1147 return VINF_SUCCESS; 1139 1148 } 1140 1149 … … 1595 1604 return rc; 1596 1605 } 1606 1607 /* do vgaUpdateDisplayAll right away */ 1608 vgaUpdateDisplayAll(pVdma->pVGAState); 1597 1609 1598 1610 return VBoxVDMAThreadTerm(&pVdma->Thread, NULL, NULL, false);
Note:
See TracChangeset
for help on using the changeset viewer.