VirtualBox

Ignore:
Timestamp:
Sep 24, 2024 10:05:58 AM (5 months ago)
Author:
vboxsync
Message:

3D: A sysmem->sysmem transfers in vmsvga3dBackSurfaceCopy implemented using memcpy (no 3D backend involved). bugref:10580

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp

    r106120 r106137  
    46034603    AssertRCReturn(rc, rc);
    46044604
    4605 /** @todo Implement a separate code paths for memory->texture, texture->memory and memory->memory transfers */
     4605/** @todo Implement a separate code paths for memory->texture, texture->memory */
    46064606    LogFunc(("src%s sid = %u -> dst%s sid = %u\n",
    46074607             pSrcSurface->pBackendSurface ? "" : " sysmem", pSrcSurface->id,
    46084608             pDstSurface->pBackendSurface ? "" : " sysmem", pDstSurface->id));
    4609 
    4610     //DXDEVICE *pDevice = dxDeviceGet(pThisCC->svga.p3dState);
    4611     //AssertReturn(pDevice->pDevice, VERR_INVALID_STATE);
    4612 
    4613     if (pSrcSurface->pBackendSurface == NULL)
    4614     {
    4615         rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, pSrcSurface);
    4616         AssertRCReturn(rc, rc);
    4617     }
    4618 
    4619     if (pDstSurface->pBackendSurface == NULL)
    4620     {
    4621         rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, pDstSurface);
    4622         AssertRCReturn(rc, rc);
    4623     }
    4624 
    4625     DXDEVICE *pDXDevice = &pBackend->dxDevice;
    46264609
    46274610    /* Clip the box. */
     
    46364619    SVGA3dCopyBox clipBox = *pBox;
    46374620    vmsvgaR3ClipCopyBox(&pSrcMipLevel->mipmapSize, &pDstMipLevel->mipmapSize, &clipBox);
     4621
     4622    if (pSrcSurface->pBackendSurface == NULL && pDstSurface->pBackendSurface == NULL)
     4623    {
     4624        AssertReturn(pSrcSurface->format == pDstSurface->format, VERR_INVALID_PARAMETER);
     4625        AssertReturn(pSrcSurface->cbBlock == pDstSurface->cbBlock, VERR_INVALID_PARAMETER);
     4626        AssertReturn(pSrcMipLevel->pSurfaceData && pDstMipLevel->pSurfaceData, VERR_INVALID_STATE);
     4627
     4628        uint32_t const cxBlocks = (clipBox.w + pSrcSurface->cxBlock - 1) / pSrcSurface->cxBlock;
     4629        uint32_t const cyBlocks = (clipBox.h + pSrcSurface->cyBlock - 1) / pSrcSurface->cyBlock;
     4630        uint32_t const cbRow = cxBlocks * pSrcSurface->cbBlock;
     4631
     4632        uint8_t const *pu8Src = (uint8_t *)pSrcMipLevel->pSurfaceData
     4633                + (clipBox.srcx / pSrcSurface->cxBlock) * pSrcSurface->cbBlock
     4634                + (clipBox.srcy / pSrcSurface->cyBlock) * pSrcMipLevel->cbSurfacePitch
     4635                + clipBox.srcz * pSrcMipLevel->cbSurfacePlane;
     4636
     4637        uint8_t *pu8Dst = (uint8_t *)pDstMipLevel->pSurfaceData
     4638                + (clipBox.x / pDstSurface->cxBlock) * pDstSurface->cbBlock
     4639                + (clipBox.y / pDstSurface->cyBlock) * pDstMipLevel->cbSurfacePitch
     4640                + clipBox.z * pDstMipLevel->cbSurfacePlane;
     4641
     4642        for (uint32_t z = 0; z < clipBox.d; ++z)
     4643        {
     4644            uint8_t const *pu8PlaneSrc = pu8Src;
     4645            uint8_t *pu8PlaneDst = pu8Dst;
     4646
     4647            for (uint32_t y = 0; y < cyBlocks; ++y)
     4648            {
     4649                memcpy(pu8PlaneDst, pu8PlaneSrc, cbRow);
     4650                pu8PlaneDst += pDstMipLevel->cbSurfacePitch;
     4651                pu8PlaneSrc += pSrcMipLevel->cbSurfacePitch;
     4652            }
     4653
     4654            pu8Src += pSrcMipLevel->cbSurfacePlane;
     4655            pu8Dst += pDstMipLevel->cbSurfacePlane;
     4656        }
     4657
     4658        return VINF_SUCCESS;
     4659    }
     4660
     4661    //DXDEVICE *pDevice = dxDeviceGet(pThisCC->svga.p3dState);
     4662    //AssertReturn(pDevice->pDevice, VERR_INVALID_STATE);
     4663    DXDEVICE *pDXDevice = &pBackend->dxDevice;
     4664
     4665    if (pSrcSurface->pBackendSurface == NULL)
     4666    {
     4667        rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, pSrcSurface);
     4668        AssertRCReturn(rc, rc);
     4669    }
     4670
     4671    if (pDstSurface->pBackendSurface == NULL)
     4672    {
     4673        rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, pDstSurface);
     4674        AssertRCReturn(rc, rc);
     4675    }
    46384676
    46394677    UINT DstSubresource = vmsvga3dCalcSubresource(dest.mipmap, dest.face, pDstSurface->cLevels);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette