Changeset 57088 in vbox
- Timestamp:
- Jul 26, 2015 11:36:29 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 101810
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/vmm/pdmifs.h
r56439 r57088 563 563 * 564 564 * @param pInterface Pointer to this interface. 565 * @param ppu8Data Where to store the pointer to the allocated buffer. 565 * @param ppbData Where to store the pointer to the allocated 566 * buffer. 566 567 * @param pcbData Where to store the actual size of the bitmap. 567 568 * @param pcx Where to store the width of the bitmap. … … 569 570 * @thread The emulation thread. 570 571 */ 571 DECLR3CALLBACKMEMBER(int, pfnTakeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t **pp u8Data, size_t *pcbData, uint32_t *pcx, uint32_t *pcy));572 DECLR3CALLBACKMEMBER(int, pfnTakeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t **ppbData, size_t *pcbData, uint32_t *pcx, uint32_t *pcy)); 572 573 573 574 /** … … 577 578 * 578 579 * @param pInterface Pointer to this interface. 579 * @param ppu8Data Pointer to the buffer returned by pfnTakeScreenshot. 580 * @param pbData Pointer to the buffer returned by 581 * pfnTakeScreenshot. 580 582 * @thread Any. 581 583 */ 582 DECLR3CALLBACKMEMBER(void, pfnFreeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t *p u8Data));584 DECLR3CALLBACKMEMBER(void, pfnFreeScreenshot,(PPDMIDISPLAYPORT pInterface, uint8_t *pbData)); 583 585 584 586 /** … … 678 680 * @thread Schedules on the emulation thread. 679 681 */ 680 DECLR3CALLBACKMEMBER(int, pfnSendModeHint, 681 (PPDMIDISPLAYPORT pInterface, uint32_t cx, uint32_t cy, 682 uint32_t cBPP, uint32_t iDisplay, uint32_t dx, 683 uint32_t dy, uint32_t fEnabled, uint32_t fNotifyGuest)); 682 DECLR3CALLBACKMEMBER(int, pfnSendModeHint, (PPDMIDISPLAYPORT pInterface, uint32_t cx, uint32_t cy, 683 uint32_t cBPP, uint32_t iDisplay, uint32_t dx, 684 uint32_t dy, uint32_t fEnabled, uint32_t fNotifyGuest)); 684 685 685 686 /** … … 748 749 * @thread The emulation thread. 749 750 */ 750 DECLR3CALLBACKMEMBER(int, pfnResize,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t cBits, void *pvVRAM, uint32_t cbLine, uint32_t cx, uint32_t cy)); 751 DECLR3CALLBACKMEMBER(int, pfnResize,(PPDMIDISPLAYCONNECTOR pInterface, uint32_t cBits, void *pvVRAM, uint32_t cbLine, 752 uint32_t cx, uint32_t cy)); 751 753 752 754 /** … … 797 799 * @thread The emulation thread. 798 800 */ 799 DECLR3CALLBACKMEMBER(void, pfnLFBModeChange, 801 DECLR3CALLBACKMEMBER(void, pfnLFBModeChange,(PPDMIDISPLAYCONNECTOR pInterface, bool fEnabled)); 800 802 801 803 /** … … 809 811 * @thread The emulation thread. 810 812 */ 811 DECLR3CALLBACKMEMBER(void, pfnProcessAdapterData, 813 DECLR3CALLBACKMEMBER(void, pfnProcessAdapterData,(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, uint32_t u32VRAMSize)); 812 814 813 815 /** … … 821 823 * @thread The emulation thread. 822 824 */ 823 DECLR3CALLBACKMEMBER(void, pfnProcessDisplayData, 825 DECLR3CALLBACKMEMBER(void, pfnProcessDisplayData,(PPDMIDISPLAYCONNECTOR pInterface, void *pvVRAM, unsigned uScreenId)); 824 826 825 827 /** … … 833 835 * @thread The emulation thread. 834 836 */ 835 DECLR3CALLBACKMEMBER(int, pfnVHWACommandProcess, 837 DECLR3CALLBACKMEMBER(int, pfnVHWACommandProcess,(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVHWACMD pCmd)); 836 838 837 839 /** … … 842 844 * @thread The emulation thread. 843 845 */ 844 DECLR3CALLBACKMEMBER(void, pfnCrHgsmiCommandProcess, 846 DECLR3CALLBACKMEMBER(void, pfnCrHgsmiCommandProcess,(PPDMIDISPLAYCONNECTOR pInterface, struct VBOXVDMACMD_CHROMIUM_CMD* pCmd, uint32_t cbCmd)); 845 847 846 848 /** … … 851 853 * @thread The emulation thread. 852 854 */ 853 DECLR3CALLBACKMEMBER(void, pfnCrHgsmiControlProcess, 855 DECLR3CALLBACKMEMBER(void, pfnCrHgsmiControlProcess,(PPDMIDISPLAYCONNECTOR pInterface, struct VBOXVDMACMD_CHROMIUM_CTL* pCtl, uint32_t cbCtl)); 854 856 855 857 /** … … 858 860 * @param pInterface Pointer to this interface. 859 861 * @param pCmd Video HW Acceleration Command to be processed. 860 * @thread The emulation thread. 861 */ 862 DECLR3CALLBACKMEMBER(int, pfnCrHgcmCtlSubmit, (PPDMIDISPLAYCONNECTOR pInterface, 863 struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, 864 PFNCRCTLCOMPLETION pfnCompletion, 865 void *pvCompletion)); 862 * @param cbCmd Undocumented! 863 * @param pfnCompletion Undocumented! 864 * @param pvCompletion Undocumented! 865 * @thread The emulation thread. 866 */ 867 DECLR3CALLBACKMEMBER(int, pfnCrHgcmCtlSubmit,(PPDMIDISPLAYCONNECTOR pInterface, struct VBOXCRCMDCTL *pCmd, uint32_t cbCmd, 868 PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion)); 866 869 867 870 /** … … 870 873 * @param pInterface Pointer to this interface. 871 874 * @param uScreenId The screen updates are for. 875 * @param pHostFlags Undocumented! 872 876 * @param fRenderThreadMode if true - the graphics device has a separate thread that does all rendering. 873 877 * This means that: … … 879 883 * @thread if fRenderThreadMode is TRUE - the render thread, otherwise - the emulation thread. 880 884 */ 881 DECLR3CALLBACKMEMBER(int, pfnVBVAEnable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode)); 885 DECLR3CALLBACKMEMBER(int, pfnVBVAEnable,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, 886 PVBVAHOSTFLAGS pHostFlags, bool fRenderThreadMode)); 882 887 883 888 /** … … 905 910 * 906 911 * @param pInterface Pointer to this interface. 912 * @param uScreenId The screen updates are for. 907 913 * @param pCmd Video HW Acceleration Command to be processed. 914 * @param cbCmd Undocumented! 908 915 * @thread if render thread mode is on (fRenderThreadMode that was passed to pfnVBVAEnable is TRUE) - the render thread pfnVBVAEnable was called in, 909 916 * otherwise - the emulation thread. 910 917 */ 911 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateProcess,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, const PVBVACMDHDR pCmd, size_t cbCmd)); 918 DECLR3CALLBACKMEMBER(void, pfnVBVAUpdateProcess,(PPDMIDISPLAYCONNECTOR pInterface, unsigned uScreenId, 919 const PVBVACMDHDR pCmd, size_t cbCmd)); 912 920 913 921 /** … … 964 972 */ 965 973 DECLR3CALLBACKMEMBER(int, pfnVBVAMousePointerShape,(PPDMIDISPLAYCONNECTOR pInterface, bool fVisible, bool fAlpha, 966 uint32_t xHot, uint32_t yHot, 967 uint32_t cx, uint32_t cy, 974 uint32_t xHot, uint32_t yHot, uint32_t cx, uint32_t cy, 968 975 const void *pvShape)); 969 976 … … 983 990 */ 984 991 /** Pointer to the display data buffer. */ 985 uint8_t *p u8Data;992 uint8_t *pbData; 986 993 /** Size of a scanline in the data buffer. */ 987 994 uint32_t cbScanline; -
trunk/src/VBox/Devices/Graphics/DevVGA.cpp
r57085 r57088 1870 1870 vga_draw_glyph9 = vga_draw_glyph9_table[depth_index]; 1871 1871 1872 dest = pDrv->p u8Data;1872 dest = pDrv->pbData; 1873 1873 linesize = pDrv->cbScanline; 1874 1874 ch_attr_ptr = pThis->last_ch_attr; … … 2197 2197 uint32_t offDst = (xStart * RT_ALIGN(s->pDrv->cBits, 8)) / 8 + s->pDrv->cbScanline * yStart; 2198 2198 2199 uint8_t *pbDst = s->pDrv->p u8Data+ offDst;2199 uint8_t *pbDst = s->pDrv->pbData + offDst; 2200 2200 uint8_t const *pbSrc = s->CTX_SUFF(vram_ptr) + offSrc; 2201 2201 … … 2274 2274 page_min = 0x7fffffff; 2275 2275 page_max = -1; 2276 d = pDrv->p u8Data;2276 d = pDrv->pbData; 2277 2277 linesize = pDrv->cbScanline; 2278 2278 … … 2452 2452 page_min = 0x7fffffff; 2453 2453 page_max = -1; 2454 d = pDrv->p u8Data;2454 d = pDrv->pbData; 2455 2455 linesize = pDrv->cbScanline; 2456 2456 … … 2531 2531 uint32_t cbScanline = pDrv->cbScanline; 2532 2532 2533 if (pDrv->p u8Data == pThis->vram_ptrR3) /* Do not clear the VRAM itself. */2533 if (pDrv->pbData == pThis->vram_ptrR3) /* Do not clear the VRAM itself. */ 2534 2534 return; 2535 2535 if (!full_update) … … 2542 2542 val = 0; 2543 2543 w = pThis->last_scr_width * ((pDrv->cBits + 7) >> 3); 2544 d = pDrv->p u8Data;2544 d = pDrv->pbData; 2545 2545 if (pThis->fRenderVRAM) 2546 2546 { … … 4831 4831 PDMIDISPLAYCONNECTOR Connector; 4832 4832 RT_ZERO(Connector); 4833 Connector.p u8Data= pbData;4833 Connector.pbData = pbData; 4834 4834 Connector.cBits = 32; 4835 4835 Connector.cx = pThis->last_scr_width; … … 4969 4969 uint8_t *pbSrc = (uint8_t *)pvData; 4970 4970 size_t cbLineDst = pThis->pDrv->cbScanline; 4971 uint8_t *pbDst = pThis->pDrv->p u8Data + y * cbLineDst + x * cbPixelDst;4971 uint8_t *pbDst = pThis->pDrv->pbData + y * cbLineDst + x * cbPixelDst; 4972 4972 uint32_t cyLeft = cy; 4973 4973 vga_draw_line_func *pfnVgaDrawLine = vga_draw_line_table[VGA_DRAW_LINE32 * 4 + get_depth_index(pThis->pDrv->cBits)]; … … 5031 5031 5032 5032 Assert(pThis->pDrv); 5033 Assert(pThis->pDrv->p u8Data);5033 Assert(pThis->pDrv->pbData); 5034 5034 5035 5035 /* Correct negative x and y coordinates. */ … … 5114 5114 cbPixelDst = (pThis->pDrv->cBits + 7) / 8; 5115 5115 cbLineDst = pThis->pDrv->cbScanline; 5116 pbDst = pThis->pDrv->p u8Data + y * cbLineDst + x * cbPixelDst;5116 pbDst = pThis->pDrv->pbData + y * cbLineDst + x * cbPixelDst; 5117 5117 5118 5118 cbPixelSrc = (pThis->get_bpp(pThis) + 7) / 8; … … 5145 5145 } 5146 5146 5147 static DECLCALLBACK(int) vgaPortCopyRect (PPDMIDISPLAYPORT pInterface, 5148 uint32_t w, 5149 uint32_t h, 5150 const uint8_t *pbSrc, 5151 int32_t xSrc, 5152 int32_t ySrc, 5153 uint32_t u32SrcWidth, 5154 uint32_t u32SrcHeight, 5155 uint32_t u32SrcLineSize, 5156 uint32_t u32SrcBitsPerPixel, 5157 uint8_t *pbDst, 5158 int32_t xDst, 5159 int32_t yDst, 5160 uint32_t u32DstWidth, 5161 uint32_t u32DstHeight, 5162 uint32_t u32DstLineSize, 5163 uint32_t u32DstBitsPerPixel) 5147 5148 static DECLCALLBACK(int) 5149 vgaPortCopyRect(PPDMIDISPLAYPORT pInterface, 5150 uint32_t cx, 5151 uint32_t cy, 5152 const uint8_t *pbSrc, int32_t xSrc, int32_t ySrc, uint32_t cxSrc, uint32_t cySrc, 5153 uint32_t cbSrcLine, uint32_t cSrcBitsPerPixel, 5154 uint8_t *pbDst, int32_t xDst, int32_t yDst, uint32_t cxDst, uint32_t cyDst, 5155 uint32_t cbDstLine, uint32_t cDstBitsPerPixel) 5164 5156 { 5165 5157 uint32_t v; … … 5167 5159 5168 5160 #ifdef DEBUG_sunlover 5169 LogFlow(("vgaPortCopyRect: %d,%d %dx%d -> %d,%d\n", xSrc, ySrc, w, h, xDst, yDst));5161 LogFlow(("vgaPortCopyRect: %d,%d %dx%d -> %d,%d\n", xSrc, ySrc, cx, cy, xDst, yDst)); 5170 5162 #endif /* DEBUG_sunlover */ 5171 5163 … … 5175 5167 Assert(pThis->pDrv); 5176 5168 5177 int32_t xSrcCorrected = xSrc;5178 int32_t ySrcCorrected = ySrc;5179 uint32_t wCorrected = w;5180 uint32_t hCorrected = h;5169 int32_t xSrcCorrected = xSrc; 5170 int32_t ySrcCorrected = ySrc; 5171 uint32_t cxCorrected = cx; 5172 uint32_t cyCorrected = cy; 5181 5173 5182 5174 /* Correct source coordinates to be within the source bitmap. */ 5183 5175 if (xSrcCorrected < 0) 5184 5176 { 5185 xSrcCorrected += wCorrected; /* Compute xRight which is also the new width. */5186 wCorrected = (xSrcCorrected < 0) ? 0 : xSrcCorrected;5177 xSrcCorrected += cxCorrected; /* Compute xRight which is also the new width. */ 5178 cxCorrected = (xSrcCorrected < 0) ? 0 : xSrcCorrected; 5187 5179 xSrcCorrected = 0; 5188 5180 } … … 5190 5182 if (ySrcCorrected < 0) 5191 5183 { 5192 ySrcCorrected += hCorrected; /* Compute yBottom, which is also the new height. */5193 hCorrected = (ySrcCorrected < 0) ? 0 : ySrcCorrected;5184 ySrcCorrected += cyCorrected; /* Compute yBottom, which is also the new height. */ 5185 cyCorrected = (ySrcCorrected < 0) ? 0 : ySrcCorrected; 5194 5186 ySrcCorrected = 0; 5195 5187 } 5196 5188 5197 5189 /* Also check if coords are greater than the display resolution. */ 5198 if (xSrcCorrected + wCorrected > u32SrcWidth)5190 if (xSrcCorrected + cxCorrected > cxSrc) 5199 5191 { 5200 5192 /* xSrcCorrected < 0 is not possible here */ 5201 wCorrected = u32SrcWidth > (uint32_t)xSrcCorrected? u32SrcWidth - xSrcCorrected: 0;5202 } 5203 5204 if (ySrcCorrected + hCorrected > u32SrcHeight)5193 cxCorrected = cxSrc > (uint32_t)xSrcCorrected ? cxSrc - xSrcCorrected : 0; 5194 } 5195 5196 if (ySrcCorrected + cyCorrected > cySrc) 5205 5197 { 5206 5198 /* y < 0 is not possible here */ 5207 hCorrected = u32SrcHeight > (uint32_t)ySrcCorrected? u32SrcHeight - ySrcCorrected: 0;5199 cyCorrected = cySrc > (uint32_t)ySrcCorrected ? cySrc - ySrcCorrected : 0; 5208 5200 } 5209 5201 5210 5202 #ifdef DEBUG_sunlover 5211 LogFlow(("vgaPortCopyRect: %d,%d %dx%d (corrected coords)\n", xSrcCorrected, ySrcCorrected, wCorrected, hCorrected));5203 LogFlow(("vgaPortCopyRect: %d,%d %dx%d (corrected coords)\n", xSrcCorrected, ySrcCorrected, cxCorrected, cyCorrected)); 5212 5204 #endif /* DEBUG_sunlover */ 5213 5205 5214 5206 /* Check if there is something to do at all. */ 5215 if ( wCorrected == 0 || hCorrected == 0)5207 if (cxCorrected == 0 || cyCorrected == 0) 5216 5208 { 5217 5209 /* Empty rectangle. */ 5218 5210 #ifdef DEBUG_sunlover 5219 LogFlow(("vgaPortUpdateDisplayRectEx: nothing to do: %dx%d\n", wCorrected, hCorrected));5211 LogFlow(("vgaPortUpdateDisplayRectEx: nothing to do: %dx%d\n", cxCorrected, cyCorrected)); 5220 5212 #endif /* DEBUG_sunlover */ 5221 5213 return VINF_SUCCESS; … … 5227 5219 if ( xDst < 0 5228 5220 || yDst < 0 5229 || xDst + wCorrected > u32DstWidth5230 || yDst + hCorrected > u32DstHeight)5221 || xDst + cxCorrected > cxDst 5222 || yDst + cyCorrected > cyDst) 5231 5223 { 5232 5224 return VERR_INVALID_PARAMETER; … … 5234 5226 5235 5227 /* Choose the rendering function. */ 5236 switch (u32SrcBitsPerPixel)5228 switch (cSrcBitsPerPixel) 5237 5229 { 5238 5230 default: … … 5267 5259 } 5268 5260 5269 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index( u32DstBitsPerPixel)];5261 vga_draw_line = vga_draw_line_table[v * 4 + get_depth_index(cDstBitsPerPixel)]; 5270 5262 5271 5263 /* Compute source and destination addresses and pitches. */ 5272 uint32_t cbPixelDst = ( u32DstBitsPerPixel + 7) / 8;5273 uint32_t cbLineDst = u32DstLineSize;5264 uint32_t cbPixelDst = (cDstBitsPerPixel + 7) / 8; 5265 uint32_t cbLineDst = cbDstLine; 5274 5266 uint8_t *pbDstCur = pbDst + yDst * cbLineDst + xDst * cbPixelDst; 5275 5267 5276 uint32_t cbPixelSrc = ( u32SrcBitsPerPixel + 7) / 8;5277 uint32_t cbLineSrc = u32SrcLineSize;5268 uint32_t cbPixelSrc = (cSrcBitsPerPixel + 7) / 8; 5269 uint32_t cbLineSrc = cbSrcLine; 5278 5270 const uint8_t *pbSrcCur = pbSrc + ySrcCorrected * cbLineSrc + xSrcCorrected * cbPixelSrc; 5279 5271 … … 5282 5274 #endif /* DEBUG_sunlover */ 5283 5275 5284 while ( hCorrected-- > 0)5285 { 5286 vga_draw_line (pThis, pbDstCur, pbSrcCur, wCorrected);5276 while (cyCorrected-- > 0) 5277 { 5278 vga_draw_line(pThis, pbDstCur, pbSrcCur, cxCorrected); 5287 5279 pbDstCur += cbLineDst; 5288 5280 pbSrcCur += cbLineSrc; … … 5802 5794 if (pThis->pDrv) 5803 5795 { 5804 /* pThis->pDrv->p u8Data can be NULL when there is no framebuffer. */5796 /* pThis->pDrv->pbData can be NULL when there is no framebuffer. */ 5805 5797 if ( pThis->pDrv->pfnRefresh 5806 5798 && pThis->pDrv->pfnResize -
trunk/src/VBox/Main/include/DisplayImpl.h
r56468 r57088 448 448 public: 449 449 450 static int i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, 451 uint32_t *pu32Width, uint32_t *pu32Height); 452 450 static int i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppbData, size_t *pcbData, 451 uint32_t *pcx, uint32_t *pcy, bool *pfMemFree); 453 452 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) 454 static BOOL i_displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *p u8Data,453 static BOOL i_displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pbData, 455 454 uint32_t u32Width, uint32_t u32Height); 456 455 int i_crCtlSubmit(struct VBOXCRCMDCTL* pCmd, uint32_t cbCmd, PFNCRCTLCOMPLETION pfnCompletion, void *pvCompletion); … … 513 512 514 513 /* helper function, code in DisplayPNGUtul.cpp */ 515 int DisplayMakePNG(uint8_t *p u8Data, uint32_t cx, uint32_t cy,514 int DisplayMakePNG(uint8_t *pbData, uint32_t cx, uint32_t cy, 516 515 uint8_t **ppu8PNG, uint32_t *pcbPNG, uint32_t *pcxPNG, uint32_t *pcyPNG, 517 516 uint8_t fLimitSize); -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r56853 r57088 186 186 * Save thumbnail and screenshot of the guest screen. 187 187 */ 188 static int displayMakeThumbnail(uint8_t *p u8Data, uint32_t cx, uint32_t cy,188 static int displayMakeThumbnail(uint8_t *pbData, uint32_t cx, uint32_t cy, 189 189 uint8_t **ppu8Thumbnail, uint32_t *pcbThumbnail, uint32_t *pcxThumbnail, uint32_t *pcyThumbnail) 190 190 { … … 215 215 { 216 216 uint8_t *dst = pu8Thumbnail; 217 uint8_t *src = p u8Data;217 uint8_t *src = pbData; 218 218 int dstW = cxThumbnail; 219 219 int dstH = cyThumbnail; … … 303 303 if (ptrVM.isOk()) 304 304 { 305 /* Query RGB bitmap. */306 uint8_t *pu8Data = NULL;307 size_t cbData = 0;308 uint32_t cx = 0;309 uint32_t cy = 0;310 311 305 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) 312 306 BOOL f3DSnapshot = FALSE; … … 318 312 if (pVMMDev) 319 313 { 320 VBOX_DISPLAY_SAVESCREENSHOT_DATA *pScreenshot =321 314 VBOX_DISPLAY_SAVESCREENSHOT_DATA *pScreenshot; 315 pScreenshot = (VBOX_DISPLAY_SAVESCREENSHOT_DATA*)RTMemAllocZ(sizeof(*pScreenshot)); 322 316 if (pScreenshot) 323 317 { … … 373 367 #endif 374 368 { 369 /* Query RGB bitmap. */ 375 370 /* SSM code is executed on EMT(0), therefore no need to use VMR3ReqCallWait. */ 376 int rc = Display::i_displayTakeScreenshotEMT(that, VBOX_VIDEO_PRIMARY_SCREEN, &pu8Data, &cbData, &cx, &cy); 371 uint8_t *pbData = NULL; 372 size_t cbData = 0; 373 uint32_t cx = 0; 374 uint32_t cy = 0; 375 bool fFreeMem = false; 376 int rc = Display::i_displayTakeScreenshotEMT(that, VBOX_VIDEO_PRIMARY_SCREEN, &pbData, &cbData, &cx, &cy, &fFreeMem); 377 377 378 378 /* … … 380 380 * (no display attached if a VM is running with VBoxHeadless on OSE for example) 381 381 */ 382 if (RT_SUCCESS(rc) && p u8Data)382 if (RT_SUCCESS(rc) && pbData) 383 383 { 384 384 Assert(cx && cy); 385 385 386 386 /* Prepare a small thumbnail and a PNG screenshot. */ 387 displayMakeThumbnail(p u8Data, cx, cy, &pu8Thumbnail, &cbThumbnail, &cxThumbnail, &cyThumbnail);388 rc = DisplayMakePNG(p u8Data, cx, cy, &pu8PNG, &cbPNG, &cxPNG, &cyPNG, 1);387 displayMakeThumbnail(pbData, cx, cy, &pu8Thumbnail, &cbThumbnail, &cxThumbnail, &cyThumbnail); 388 rc = DisplayMakePNG(pbData, cx, cy, &pu8PNG, &cbPNG, &cxPNG, &cyPNG, 1); 389 389 if (RT_FAILURE(rc)) 390 390 { … … 399 399 } 400 400 401 /* This can be called from any thread. */ 402 that->mpDrv->pUpPort->pfnFreeScreenshot(that->mpDrv->pUpPort, pu8Data); 401 if (fFreeMem) 402 RTMemFree(pbData); 403 else 404 that->mpDrv->pUpPort->pfnFreeScreenshot(that->mpDrv->pUpPort, pbData); 403 405 } 404 406 } … … 908 910 mpDrv->pUpPort->pfnSetRenderVRAM(mpDrv->pUpPort, false); 909 911 910 mpDrv->IConnector.p u8Data= NULL;912 mpDrv->IConnector.pbData = NULL; 911 913 mpDrv->IConnector.cbScanline = 0; 912 914 mpDrv->IConnector.cBits = 32; /* DevVGA does not work with cBits == 0. */ … … 1840 1842 1841 1843 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) 1842 BOOL Display::i_displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *p u8Data,1844 BOOL Display::i_displayCheckTakeScreenshotCrOgl(Display *pDisplay, ULONG aScreenId, uint8_t *pbData, 1843 1845 uint32_t u32Width, uint32_t u32Height) 1844 1846 { … … 1850 1852 if (pVMMDev) 1851 1853 { 1852 CRVBOXHGCMTAKESCREENSHOT *pScreenshot = (CRVBOXHGCMTAKESCREENSHOT *)RTMemAlloc(sizeof(*pScreenshot));1854 CRVBOXHGCMTAKESCREENSHOT *pScreenshot = (CRVBOXHGCMTAKESCREENSHOT *)RTMemAlloc(sizeof(*pScreenshot)); 1853 1855 if (pScreenshot) 1854 1856 { … … 1858 1860 pScreenshot->u32Height = u32Height; 1859 1861 pScreenshot->u32Pitch = u32Width * 4; 1860 pScreenshot->pvBuffer = p u8Data;1862 pScreenshot->pvBuffer = pbData; 1861 1863 pScreenshot->pvContext = NULL; 1862 1864 pScreenshot->pfnScreenshotBegin = NULL; … … 1887 1889 #endif 1888 1890 1889 int Display::i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, 1890 uint32_t *pu32Width, uint32_t *pu32Height) 1891 /* static */ 1892 int Display::i_displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppbData, size_t *pcbData, 1893 uint32_t *pcx, uint32_t *pcy, bool *pfMemFree) 1891 1894 { 1892 1895 int rc; 1893 1894 1896 if ( aScreenId == VBOX_VIDEO_PRIMARY_SCREEN 1895 1897 && pDisplay->maFramebuffers[aScreenId].fVBVAEnabled == false) /* A non-VBVA mode. */ 1896 1898 { 1897 rc = pDisplay->mpDrv->pUpPort->pfnTakeScreenshot(pDisplay->mpDrv->pUpPort, ppu8Data, pcbData, pu32Width, pu32Height); 1899 rc = pDisplay->mpDrv->pUpPort->pfnTakeScreenshot(pDisplay->mpDrv->pUpPort, ppbData, pcbData, pcx, pcy); 1900 *pfMemFree = false; 1898 1901 } 1899 1902 else if (aScreenId < pDisplay->mcMonitors) … … 1909 1912 if (cbRequired) 1910 1913 { 1911 uint8_t *pu8Data = (uint8_t *)RTMemAlloc(cbRequired); 1912 1913 if (pu8Data == NULL) 1914 { 1915 rc = VERR_NO_MEMORY; 1916 } 1917 else 1914 uint8_t *pbDst = (uint8_t *)RTMemAlloc(cbRequired); 1915 if (pbDst != NULL) 1918 1916 { 1919 1917 /* Copy guest VRAM to the allocated 32bpp buffer. */ … … 1926 1924 uint32_t u32SrcBitsPerPixel = pFBInfo->u16BitsPerPixel; 1927 1925 1928 uint8_t *pu8Dst = pu8Data;1929 1926 int32_t xDst = 0; 1930 1927 int32_t yDst = 0; … … 1940 1937 u32SrcWidth, u32SrcHeight, 1941 1938 u32SrcLineSize, u32SrcBitsPerPixel, 1942 p u8Dst,1939 pbDst, 1943 1940 xDst, yDst, 1944 1941 u32DstWidth, u32DstHeight, … … 1946 1943 if (RT_SUCCESS(rc)) 1947 1944 { 1948 *pp u8Data = pu8Data;1945 *ppbData = pbDst; 1949 1946 *pcbData = cbRequired; 1950 *pu32Width = width; 1951 *pu32Height = height; 1947 *pcx = width; 1948 *pcy = height; 1949 *pfMemFree = true; 1952 1950 } 1953 1951 else 1954 1952 { 1955 RTMemFree(p u8Data);1953 RTMemFree(pbDst); 1956 1954 1957 1955 /* CopyRect can fail if VBVA was paused in VGA device, retry using the generic method. */ … … 1959 1957 && aScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 1960 1958 { 1961 rc = pDisplay->mpDrv->pUpPort->pfnTakeScreenshot(pDisplay->mpDrv->pUpPort, 1962 ppu8Data, pcbData, pu32Width, pu32Height);1959 rc = pDisplay->mpDrv->pUpPort->pfnTakeScreenshot(pDisplay->mpDrv->pUpPort, ppbData, pcbData, pcx, pcy); 1960 *pfMemFree = false; 1963 1961 } 1964 1962 } 1965 1963 } 1964 else 1965 rc = VERR_NO_MEMORY; 1966 1966 } 1967 1967 else 1968 1968 { 1969 1969 /* No image. */ 1970 *pp u8Data = NULL;1970 *ppbData = NULL; 1971 1971 *pcbData = 0; 1972 *pu32Width = 0; 1973 *pu32Height = 0; 1972 *pcx = 0; 1973 *pcy = 0; 1974 *pfMemFree = true; 1974 1975 rc = VINF_SUCCESS; 1975 1976 } 1976 1977 } 1977 1978 else 1978 {1979 1979 rc = VERR_INVALID_PARAMETER; 1980 }1981 1982 1980 return rc; 1983 1981 } … … 1986 1984 BYTE *address, ULONG width, ULONG height) 1987 1985 { 1988 uint8_t *pu8Data = NULL; 1986 #if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL) 1987 /* 1988 * CrOgl screenshot hook/hack. 1989 */ 1990 if (Display::i_displayCheckTakeScreenshotCrOgl(pDisplay, aScreenId, (uint8_t *)address, width, height)) 1991 return VINF_SUCCESS; 1992 #endif 1993 1994 uint8_t *pbData = NULL; 1989 1995 size_t cbData = 0; 1990 1996 uint32_t cx = 0; 1991 1997 uint32_t cy = 0; 1998 bool fFreeMem = false; 1992 1999 int vrc = VINF_SUCCESS; 1993 2000 1994 # if defined(VBOX_WITH_HGCM) && defined(VBOX_WITH_CROGL)1995 if (Display::i_displayCheckTakeScreenshotCrOgl(pDisplay, aScreenId, (uint8_t*)address, width, height))1996 return VINF_SUCCESS;1997 #endif1998 1999 2001 int cRetries = 5; 2000 2001 2002 while (cRetries-- > 0) 2002 2003 { … … 2004 2005 it would be nice to have an accurate screenshot for the bug 2005 2006 report if the VM deadlocks. */ 2006 vrc = VMR3ReqPriorityCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)Display::i_displayTakeScreenshotEMT, 6,2007 pDisplay, aScreenId, &p u8Data, &cbData, &cx, &cy);2007 vrc = VMR3ReqPriorityCallWaitU(pUVM, VMCPUID_ANY, (PFNRT)Display::i_displayTakeScreenshotEMT, 7, 2008 pDisplay, aScreenId, &pbData, &cbData, &cx, &cy, &fFreeMem); 2008 2009 if (vrc != VERR_TRY_AGAIN) 2009 2010 { … … 2014 2015 } 2015 2016 2016 if (RT_SUCCESS(vrc) && p u8Data)2017 if (RT_SUCCESS(vrc) && pbData) 2017 2018 { 2018 2019 if (cx == width && cy == height) 2019 2020 { 2020 2021 /* No scaling required. */ 2021 memcpy(address, p u8Data, cbData);2022 memcpy(address, pbData, cbData); 2022 2023 } 2023 2024 else … … 2027 2028 2028 2029 uint8_t *dst = address; 2029 uint8_t *src = p u8Data;2030 uint8_t *src = pbData; 2030 2031 int dstW = width; 2031 2032 int dstH = height; … … 2041 2042 } 2042 2043 2043 if (aScreenId == VBOX_VIDEO_PRIMARY_SCREEN) 2044 if (fFreeMem) 2045 RTMemFree(pbData); 2046 else 2044 2047 { 2045 2048 /* This can be called from any thread. */ 2046 pDrv->pUpPort->pfnFreeScreenshot(pDrv->pUpPort, pu8Data); 2047 } 2048 else 2049 { 2050 RTMemFree(pu8Data); 2049 pDrv->pUpPort->pfnFreeScreenshot(pDrv->pUpPort, pbData); 2051 2050 } 2052 2051 } … … 2764 2763 &bitmapFormat); 2765 2764 2766 mpDrv->IConnector.p u8Data= pAddress;2765 mpDrv->IConnector.pbData = pAddress; 2767 2766 mpDrv->IConnector.cbScanline = ulBytesPerLine; 2768 2767 mpDrv->IConnector.cBits = ulBitsPerPixel; … … 2859 2858 2860 2859 size_t cbData = RT_UOFFSETOF(VBOXCRCMDCTL_HGCM, aParms[5]); 2861 VBOXCRCMDCTL_HGCM *pData = (VBOXCRCMDCTL_HGCM *)alloca(cbData);2860 VBOXCRCMDCTL_HGCM *pData = (VBOXCRCMDCTL_HGCM *)alloca(cbData); 2862 2861 2863 2862 pData->Hdr.enmType = VBOXCRCMDCTL_TYPE_HGCM; … … 3102 3101 pFBInfo->pu8FramebufferVRAM, u64Now); 3103 3102 } 3104 else if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN && pDrv->IConnector.p u8Data)3103 else if (uScreenId == VBOX_VIDEO_PRIMARY_SCREEN && pDrv->IConnector.pbData) 3105 3104 { 3106 3105 rc = VideoRecCopyToIntBuf(pDisplay->mpVideoRecCtx, uScreenId, 0, 0, … … 3108 3107 pDrv->IConnector.cBits, 3109 3108 pDrv->IConnector.cbScanline, pDrv->IConnector.cx, 3110 pDrv->IConnector.cy, pDrv->IConnector.p u8Data, u64Now);3109 pDrv->IConnector.cy, pDrv->IConnector.pbData, u64Now); 3111 3110 } 3112 3111 if (rc == VINF_TRY_AGAIN) … … 4119 4118 pThis->pUpPort->pfnSetRenderVRAM(pThis->pUpPort, false); 4120 4119 4121 pThis->IConnector.p u8Data= NULL;4120 pThis->IConnector.pbData = NULL; 4122 4121 pThis->IConnector.cbScanline = 0; 4123 4122 pThis->IConnector.cBits = 32;
Note:
See TracChangeset
for help on using the changeset viewer.