Пример #1
0
int vboxVhwaHlpPopulateSurInfo(VBOXVHWA_SURFACEDESC *pInfo, PVBOXWDDM_ALLOCATION pSurf,
                               uint32_t fFlags, uint32_t cBackBuffers, uint32_t fSCaps,
                               D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
{
    RT_NOREF(VidPnSourceId);
    memset(pInfo, 0, sizeof(VBOXVHWA_SURFACEDESC));

#if 0
    /**
     * The following breaks 2D accelerated video playback because this method is called just after the surface was created
     * and most its members are still 0.
     *
     * @todo: Not 100% sure this is the correct way. It looks like the SegmentId specifies where the  memory
     *        for the surface is stored (VRAM vs. system memory) but because this method is only used
     *        to query some parameters (using VBOXVHWACMD_SURF_GETINFO) and this command doesn't access any surface memory
     *        on the host it should be safe.
     */
    if (pSurf->AllocData.Addr.SegmentId != 1)
    {
        WARN(("invalid segment id!"));
        return VERR_INVALID_PARAMETER;
    }
#endif

    pInfo->height = pSurf->AllocData.SurfDesc.height;
    pInfo->width = pSurf->AllocData.SurfDesc.width;
    pInfo->flags |= VBOXVHWA_SD_HEIGHT | VBOXVHWA_SD_WIDTH;
    if (fFlags & VBOXVHWA_SD_PITCH)
    {
        pInfo->pitch = pSurf->AllocData.SurfDesc.pitch;
        pInfo->flags |= VBOXVHWA_SD_PITCH;
        pInfo->sizeX = pSurf->AllocData.SurfDesc.cbSize;
        pInfo->sizeY = 1;
    }

    if (cBackBuffers)
    {
        pInfo->cBackBuffers = cBackBuffers;
        pInfo->flags |= VBOXVHWA_SD_BACKBUFFERCOUNT;
    }
    else
        pInfo->cBackBuffers = 0;
    pInfo->Reserved = 0;
        /** @todo color keys */
//                        pInfo->DstOverlayCK;
//                        pInfo->DstBltCK;
//                        pInfo->SrcOverlayCK;
//                        pInfo->SrcBltCK;
    int rc = vboxVhwaHlpTranslateFormat(&pInfo->PixelFormat, pSurf->AllocData.SurfDesc.format);
    AssertRC(rc);
    if (RT_SUCCESS(rc))
    {
        pInfo->flags |= VBOXVHWA_SD_PIXELFORMAT;
        pInfo->surfCaps = fSCaps;
        pInfo->flags |= VBOXVHWA_SD_CAPS;
        pInfo->offSurface = pSurf->AllocData.Addr.offVram;
    }

    return rc;
}
Пример #2
0
int vboxVhwaHlpPopulateSurInfo(VBOXVHWA_SURFACEDESC *pInfo, PVBOXWDDM_ALLOCATION pSurf,
        uint32_t fFlags, uint32_t cBackBuffers, uint32_t fSCaps,
        D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId)
{
    memset(pInfo, 0, sizeof(VBOXVHWA_SURFACEDESC));

    if (pSurf->AllocData.Addr.SegmentId != 1)
    {
        WARN(("invalid segment id!"));
        return VERR_INVALID_PARAMETER;
    }

    pInfo->height = pSurf->AllocData.SurfDesc.height;
    pInfo->width = pSurf->AllocData.SurfDesc.width;
    pInfo->flags |= VBOXVHWA_SD_HEIGHT | VBOXVHWA_SD_WIDTH;
    if (fFlags & VBOXVHWA_SD_PITCH)
    {
        pInfo->pitch = pSurf->AllocData.SurfDesc.pitch;
        pInfo->flags |= VBOXVHWA_SD_PITCH;
        pInfo->sizeX = pSurf->AllocData.SurfDesc.cbSize;
        pInfo->sizeY = 1;
    }

    if (cBackBuffers)
    {
        pInfo->cBackBuffers = cBackBuffers;
        pInfo->flags |= VBOXVHWA_SD_BACKBUFFERCOUNT;
    }
    else
        pInfo->cBackBuffers = 0;
    pInfo->Reserved = 0;
        /* @todo: color keys */
//                        pInfo->DstOverlayCK;
//                        pInfo->DstBltCK;
//                        pInfo->SrcOverlayCK;
//                        pInfo->SrcBltCK;
    int rc = vboxVhwaHlpTranslateFormat(&pInfo->PixelFormat, pSurf->AllocData.SurfDesc.format);
    AssertRC(rc);
    if (RT_SUCCESS(rc))
    {
        pInfo->flags |= VBOXVHWA_SD_PIXELFORMAT;
        pInfo->surfCaps = fSCaps;
        pInfo->flags |= VBOXVHWA_SD_CAPS;
        pInfo->offSurface = pSurf->AllocData.Addr.offVram;
    }

    return rc;
}