VirtualBox

Changeset 102520 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Dec 7, 2023 12:06:26 PM (16 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
160664
Message:

Devices/Graphics: planar textures; video commands. bugref:10529

Location:
trunk/src/VBox/Devices/Graphics
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-cmd.cpp

    r102142 r102520  
    298298        SVGA_CASE_ID2STR(SVGA_3D_CMD_MAX);
    299299        SVGA_CASE_ID2STR(SVGA_3D_CMD_FUTURE_MAX);
     300
     301        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR);
     302        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER_OUTPUT_VIEW);
     303        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER);
     304        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_DECODER_BEGIN_FRAME);
     305        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_DECODER_SUBMIT_BUFFERS);
     306        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_DECODER_END_FRAME);
     307        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_INPUT_VIEW);
     308        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_OUTPUT_VIEW);
     309        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_BLT);
     310        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER);
     311        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER_OUTPUT_VIEW);
     312        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR);
     313        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_INPUT_VIEW);
     314        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_OUTPUT_VIEW);
     315        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_TARGET_RECT);
     316        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_BACKGROUND_COLOR);
     317        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_COLOR_SPACE);
     318        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_ALPHA_FILL_MODE);
     319        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_CONSTRICTION);
     320        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_STEREO_MODE);
     321        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FRAME_FORMAT);
     322        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_COLOR_SPACE);
     323        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_OUTPUT_RATE);
     324        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_SOURCE_RECT);
     325        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_DEST_RECT);
     326        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ALPHA);
     327        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PALETTE);
     328        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PIXEL_ASPECT_RATIO);
     329        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_LUMA_KEY);
     330        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_STEREO_FORMAT);
     331        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_AUTO_PROCESSING_MODE);
     332        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FILTER);
     333        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ROTATION);
     334        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_GET_VIDEO_CAPABILITY);
     335        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_CLEAR_RTV);
     336        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_CLEAR_UAV);
     337        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_CLEAR_VDOV);
     338        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_CLEAR_VPIV);
     339        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_DX_CLEAR_VPOV);
     340        SVGA_CASE_ID2STR(VBSVGA_3D_CMD_MAX);
    300341#ifndef DEBUG_sunlover
    301342        default: break; /* Compiler warning. */
     
    343384        SVGA_CASE_ID2STR(SVGA_CMD_MAX);
    344385        default:
    345             if (   u32Cmd >= SVGA_3D_CMD_BASE
    346                 && u32Cmd <  SVGA_3D_CMD_MAX)
     386            if (   (u32Cmd >= SVGA_3D_CMD_BASE && u32Cmd < SVGA_3D_CMD_MAX)
     387                || (u32Cmd >= VBSVGA_3D_CMD_BASE && u32Cmd < VBSVGA_3D_CMD_MAX))
    347388                return vmsvgaFifo3dCmdToString((SVGAFifo3dCmdId)u32Cmd);
    348389    }
     
    42644305
    42654306
     4307/* VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR  VBSVGA_3D_CMD_BASE + 0 */
     4308static int vmsvga3dVBCmdDXDefineVideoProcessor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessor *pCmd, uint32_t cbCmd)
     4309{
     4310#ifdef VMSVGA3D_DX
     4311    //DEBUG_BREAKPOINT_TEST();
     4312    RT_NOREF(cbCmd);
     4313    return vmsvga3dVBDXDefineVideoProcessor(pThisCC, idDXContext, pCmd);
     4314#else
     4315    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4316    return VERR_NOT_SUPPORTED;
     4317#endif
     4318}
     4319
     4320
     4321/* VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER_OUTPUT_VIEW  VBSVGA_3D_CMD_BASE + 1 */
     4322static int vmsvga3dVBCmdDXDefineVideoDecoderOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoDecoderOutputView *pCmd, uint32_t cbCmd)
     4323{
     4324#ifdef VMSVGA3D_DX
     4325    //DEBUG_BREAKPOINT_TEST();
     4326    RT_NOREF(cbCmd);
     4327    return vmsvga3dVBDXDefineVideoDecoderOutputView(pThisCC, idDXContext, pCmd);
     4328#else
     4329    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4330    return VERR_NOT_SUPPORTED;
     4331#endif
     4332}
     4333
     4334
     4335/* VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER  VBSVGA_3D_CMD_BASE + 2 */
     4336static int vmsvga3dVBCmdDXDefineVideoDecoder(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoDecoder *pCmd, uint32_t cbCmd)
     4337{
     4338#ifdef VMSVGA3D_DX
     4339    //DEBUG_BREAKPOINT_TEST();
     4340    RT_NOREF(cbCmd);
     4341    return vmsvga3dVBDXDefineVideoDecoder(pThisCC, idDXContext, pCmd);
     4342#else
     4343    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4344    return VERR_NOT_SUPPORTED;
     4345#endif
     4346}
     4347
     4348
     4349/* VBSVGA_3D_CMD_DX_VIDEO_DECODER_BEGIN_FRAME  VBSVGA_3D_CMD_BASE + 3 */
     4350static int vmsvga3dVBCmdDXVideoDecoderBeginFrame(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderBeginFrame *pCmd, uint32_t cbCmd)
     4351{
     4352#ifdef VMSVGA3D_DX
     4353    //DEBUG_BREAKPOINT_TEST();
     4354    RT_NOREF(cbCmd);
     4355    return vmsvga3dVBDXVideoDecoderBeginFrame(pThisCC, idDXContext, pCmd);
     4356#else
     4357    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4358    return VERR_NOT_SUPPORTED;
     4359#endif
     4360}
     4361
     4362
     4363/* VBSVGA_3D_CMD_DX_VIDEO_DECODER_SUBMIT_BUFFERS  VBSVGA_3D_CMD_BASE + 4 */
     4364static int vmsvga3dVBCmdDXVideoDecoderSubmitBuffers(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderSubmitBuffers *pCmd, uint32_t cbCmd)
     4365{
     4366#ifdef VMSVGA3D_DX
     4367    //DEBUG_BREAKPOINT_TEST();
     4368    VBSVGA3dVideoDecoderBufferDesc const *paBufferDesc = (VBSVGA3dVideoDecoderBufferDesc *)&pCmd[1];
     4369    uint32_t const cBuffer = (cbCmd - sizeof(*pCmd)) / sizeof(VBSVGA3dVideoDecoderBufferDesc);
     4370    return vmsvga3dVBDXVideoDecoderSubmitBuffers(pThisCC, idDXContext, pCmd, cBuffer, paBufferDesc);
     4371#else
     4372    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4373    return VERR_NOT_SUPPORTED;
     4374#endif
     4375}
     4376
     4377
     4378/* VBSVGA_3D_CMD_DX_VIDEO_DECODER_END_FRAME  VBSVGA_3D_CMD_BASE + 5 */
     4379static int vmsvga3dVBCmdDXVideoDecoderEndFrame(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderEndFrame *pCmd, uint32_t cbCmd)
     4380{
     4381#ifdef VMSVGA3D_DX
     4382    //DEBUG_BREAKPOINT_TEST();
     4383    RT_NOREF(cbCmd);
     4384    return vmsvga3dVBDXVideoDecoderEndFrame(pThisCC, idDXContext, pCmd);
     4385#else
     4386    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4387    return VERR_NOT_SUPPORTED;
     4388#endif
     4389}
     4390
     4391
     4392/* VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_INPUT_VIEW  VBSVGA_3D_CMD_BASE + 6 */
     4393static int vmsvga3dVBCmdDXDefineVideoProcessorInputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessorInputView *pCmd, uint32_t cbCmd)
     4394{
     4395#ifdef VMSVGA3D_DX
     4396    //DEBUG_BREAKPOINT_TEST();
     4397    RT_NOREF(cbCmd);
     4398    return vmsvga3dVBDXDefineVideoProcessorInputView(pThisCC, idDXContext, pCmd);
     4399#else
     4400    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4401    return VERR_NOT_SUPPORTED;
     4402#endif
     4403}
     4404
     4405
     4406/* VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_OUTPUT_VIEW  VBSVGA_3D_CMD_BASE + 7 */
     4407static int vmsvga3dVBCmdDXDefineVideoProcessorOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessorOutputView *pCmd, uint32_t cbCmd)
     4408{
     4409#ifdef VMSVGA3D_DX
     4410    //DEBUG_BREAKPOINT_TEST();
     4411    RT_NOREF(cbCmd);
     4412    return vmsvga3dVBDXDefineVideoProcessorOutputView(pThisCC, idDXContext, pCmd);
     4413#else
     4414    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4415    return VERR_NOT_SUPPORTED;
     4416#endif
     4417}
     4418
     4419
     4420/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_BLT  VBSVGA_3D_CMD_BASE + 8 */
     4421static int vmsvga3dVBCmdDXVideoProcessorBlt(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorBlt *pCmd, uint32_t cbCmd)
     4422{
     4423#ifdef VMSVGA3D_DX
     4424    //DEBUG_BREAKPOINT_TEST();
     4425    return vmsvga3dVBDXVideoProcessorBlt(pThisCC, idDXContext, pCmd, cbCmd);
     4426#else
     4427    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4428    return VERR_NOT_SUPPORTED;
     4429#endif
     4430}
     4431
     4432
     4433/* VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER  VBSVGA_3D_CMD_BASE + 9 */
     4434static int vmsvga3dVBCmdDXDestroyVideoDecoder(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoDecoder *pCmd, uint32_t cbCmd)
     4435{
     4436#ifdef VMSVGA3D_DX
     4437    //DEBUG_BREAKPOINT_TEST();
     4438    RT_NOREF(cbCmd);
     4439    return vmsvga3dVBDXDestroyVideoDecoder(pThisCC, idDXContext, pCmd);
     4440#else
     4441    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4442    return VERR_NOT_SUPPORTED;
     4443#endif
     4444}
     4445
     4446
     4447/* VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER_OUTPUT_VIEW  VBSVGA_3D_CMD_BASE + 10 */
     4448static int vmsvga3dVBCmdDXDestroyVideoDecoderOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoDecoderOutputView *pCmd, uint32_t cbCmd)
     4449{
     4450#ifdef VMSVGA3D_DX
     4451    //DEBUG_BREAKPOINT_TEST();
     4452    RT_NOREF(cbCmd);
     4453    return vmsvga3dVBDXDestroyVideoDecoderOutputView(pThisCC, idDXContext, pCmd);
     4454#else
     4455    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4456    return VERR_NOT_SUPPORTED;
     4457#endif
     4458}
     4459
     4460
     4461/* VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR  VBSVGA_3D_CMD_BASE + 11 */
     4462static int vmsvga3dVBCmdDXDestroyVideoProcessor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessor *pCmd, uint32_t cbCmd)
     4463{
     4464#ifdef VMSVGA3D_DX
     4465    //DEBUG_BREAKPOINT_TEST();
     4466    RT_NOREF(cbCmd);
     4467    return vmsvga3dVBDXDestroyVideoProcessor(pThisCC, idDXContext, pCmd);
     4468#else
     4469    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4470    return VERR_NOT_SUPPORTED;
     4471#endif
     4472}
     4473
     4474
     4475/* VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_INPUT_VIEW  VBSVGA_3D_CMD_BASE + 12 */
     4476static int vmsvga3dVBCmdDXDestroyVideoProcessorInputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessorInputView *pCmd, uint32_t cbCmd)
     4477{
     4478#ifdef VMSVGA3D_DX
     4479    //DEBUG_BREAKPOINT_TEST();
     4480    RT_NOREF(cbCmd);
     4481    return vmsvga3dVBDXDestroyVideoProcessorInputView(pThisCC, idDXContext, pCmd);
     4482#else
     4483    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4484    return VERR_NOT_SUPPORTED;
     4485#endif
     4486}
     4487
     4488
     4489/* VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_OUTPUT_VIEW  VBSVGA_3D_CMD_BASE + 13 */
     4490static int vmsvga3dVBCmdDXDestroyVideoProcessorOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessorOutputView *pCmd, uint32_t cbCmd)
     4491{
     4492#ifdef VMSVGA3D_DX
     4493    //DEBUG_BREAKPOINT_TEST();
     4494    RT_NOREF(cbCmd);
     4495    return vmsvga3dVBDXDestroyVideoProcessorOutputView(pThisCC, idDXContext, pCmd);
     4496#else
     4497    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4498    return VERR_NOT_SUPPORTED;
     4499#endif
     4500}
     4501
     4502
     4503/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_TARGET_RECT  VBSVGA_3D_CMD_BASE + 14 */
     4504static int vmsvga3dVBCmdDXVideoProcessorSetOutputTargetRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputTargetRect const *pCmd, uint32_t cbCmd)
     4505{
     4506#ifdef VMSVGA3D_DX
     4507    //DEBUG_BREAKPOINT_TEST();
     4508    RT_NOREF(cbCmd);
     4509    return vmsvga3dVBDXVideoProcessorSetOutputTargetRect(pThisCC, idDXContext, pCmd);
     4510#else
     4511    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4512    return VERR_NOT_SUPPORTED;
     4513#endif
     4514}
     4515
     4516
     4517/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_BACKGROUND_COLOR  VBSVGA_3D_CMD_BASE + 15 */
     4518static int vmsvga3dVBCmdDXVideoProcessorSetOutputBackgroundColor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputBackgroundColor const *pCmd, uint32_t cbCmd)
     4519{
     4520#ifdef VMSVGA3D_DX
     4521    //DEBUG_BREAKPOINT_TEST();
     4522    RT_NOREF(cbCmd);
     4523    return vmsvga3dVBDXVideoProcessorSetOutputBackgroundColor(pThisCC, idDXContext, pCmd);
     4524#else
     4525    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4526    return VERR_NOT_SUPPORTED;
     4527#endif
     4528}
     4529
     4530
     4531/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_COLOR_SPACE  VBSVGA_3D_CMD_BASE + 16 */
     4532static int vmsvga3dVBCmdDXVideoProcessorSetOutputColorSpace(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputColorSpace const *pCmd, uint32_t cbCmd)
     4533{
     4534#ifdef VMSVGA3D_DX
     4535    //DEBUG_BREAKPOINT_TEST();
     4536    RT_NOREF(cbCmd);
     4537    return vmsvga3dVBDXVideoProcessorSetOutputColorSpace(pThisCC, idDXContext, pCmd);
     4538#else
     4539    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4540    return VERR_NOT_SUPPORTED;
     4541#endif
     4542}
     4543
     4544
     4545/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_ALPHA_FILL_MODE  VBSVGA_3D_CMD_BASE + 17 */
     4546static int vmsvga3dVBCmdDXVideoProcessorSetOutputAlphaFillMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputAlphaFillMode const *pCmd, uint32_t cbCmd)
     4547{
     4548#ifdef VMSVGA3D_DX
     4549    //DEBUG_BREAKPOINT_TEST();
     4550    RT_NOREF(cbCmd);
     4551    return vmsvga3dVBDXVideoProcessorSetOutputAlphaFillMode(pThisCC, idDXContext, pCmd);
     4552#else
     4553    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4554    return VERR_NOT_SUPPORTED;
     4555#endif
     4556}
     4557
     4558
     4559/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_CONSTRICTION  VBSVGA_3D_CMD_BASE + 18 */
     4560static int vmsvga3dVBCmdDXVideoProcessorSetOutputConstriction(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputConstriction const *pCmd, uint32_t cbCmd)
     4561{
     4562#ifdef VMSVGA3D_DX
     4563    //DEBUG_BREAKPOINT_TEST();
     4564    RT_NOREF(cbCmd);
     4565    return vmsvga3dVBDXVideoProcessorSetOutputConstriction(pThisCC, idDXContext, pCmd);
     4566#else
     4567    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4568    return VERR_NOT_SUPPORTED;
     4569#endif
     4570}
     4571
     4572
     4573/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_STEREO_MODE  VBSVGA_3D_CMD_BASE + 19 */
     4574static int vmsvga3dVBCmdDXVideoProcessorSetOutputStereoMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputStereoMode const *pCmd, uint32_t cbCmd)
     4575{
     4576#ifdef VMSVGA3D_DX
     4577    //DEBUG_BREAKPOINT_TEST();
     4578    RT_NOREF(cbCmd);
     4579    return vmsvga3dVBDXVideoProcessorSetOutputStereoMode(pThisCC, idDXContext, pCmd);
     4580#else
     4581    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4582    return VERR_NOT_SUPPORTED;
     4583#endif
     4584}
     4585
     4586
     4587/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FRAME_FORMAT  VBSVGA_3D_CMD_BASE + 20 */
     4588static int vmsvga3dVBCmdDXVideoProcessorSetStreamFrameFormat(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamFrameFormat const *pCmd, uint32_t cbCmd)
     4589{
     4590#ifdef VMSVGA3D_DX
     4591    //DEBUG_BREAKPOINT_TEST();
     4592    RT_NOREF(cbCmd);
     4593    return vmsvga3dVBDXVideoProcessorSetStreamFrameFormat(pThisCC, idDXContext, pCmd);
     4594#else
     4595    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4596    return VERR_NOT_SUPPORTED;
     4597#endif
     4598}
     4599
     4600
     4601/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_COLOR_SPACE  VBSVGA_3D_CMD_BASE + 21 */
     4602static int vmsvga3dVBCmdDXVideoProcessorSetStreamColorSpace(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamColorSpace const *pCmd, uint32_t cbCmd)
     4603{
     4604#ifdef VMSVGA3D_DX
     4605    //DEBUG_BREAKPOINT_TEST();
     4606    RT_NOREF(cbCmd);
     4607    return vmsvga3dVBDXVideoProcessorSetStreamColorSpace(pThisCC, idDXContext, pCmd);
     4608#else
     4609    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4610    return VERR_NOT_SUPPORTED;
     4611#endif
     4612}
     4613
     4614
     4615/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_OUTPUT_RATE  VBSVGA_3D_CMD_BASE + 22 */
     4616static int vmsvga3dVBCmdDXVideoProcessorSetStreamOutputRate(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamOutputRate const *pCmd, uint32_t cbCmd)
     4617{
     4618#ifdef VMSVGA3D_DX
     4619    //DEBUG_BREAKPOINT_TEST();
     4620    RT_NOREF(cbCmd);
     4621    return vmsvga3dVBDXVideoProcessorSetStreamOutputRate(pThisCC, idDXContext, pCmd);
     4622#else
     4623    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4624    return VERR_NOT_SUPPORTED;
     4625#endif
     4626}
     4627
     4628
     4629/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_SOURCE_RECT  VBSVGA_3D_CMD_BASE + 23 */
     4630static int vmsvga3dVBCmdDXVideoProcessorSetStreamSourceRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamSourceRect const *pCmd, uint32_t cbCmd)
     4631{
     4632#ifdef VMSVGA3D_DX
     4633    //DEBUG_BREAKPOINT_TEST();
     4634    RT_NOREF(cbCmd);
     4635    return vmsvga3dVBDXVideoProcessorSetStreamSourceRect(pThisCC, idDXContext, pCmd);
     4636#else
     4637    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4638    return VERR_NOT_SUPPORTED;
     4639#endif
     4640}
     4641
     4642
     4643/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_DEST_RECT  VBSVGA_3D_CMD_BASE + 24 */
     4644static int vmsvga3dVBCmdDXVideoProcessorSetStreamDestRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamDestRect const *pCmd, uint32_t cbCmd)
     4645{
     4646#ifdef VMSVGA3D_DX
     4647    //DEBUG_BREAKPOINT_TEST();
     4648    RT_NOREF(cbCmd);
     4649    return vmsvga3dVBDXVideoProcessorSetStreamDestRect(pThisCC, idDXContext, pCmd);
     4650#else
     4651    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4652    return VERR_NOT_SUPPORTED;
     4653#endif
     4654}
     4655
     4656
     4657/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ALPHA  VBSVGA_3D_CMD_BASE + 25 */
     4658static int vmsvga3dVBCmdDXVideoProcessorSetStreamAlpha(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamAlpha const *pCmd, uint32_t cbCmd)
     4659{
     4660#ifdef VMSVGA3D_DX
     4661    //DEBUG_BREAKPOINT_TEST();
     4662    RT_NOREF(cbCmd);
     4663    return vmsvga3dVBDXVideoProcessorSetStreamAlpha(pThisCC, idDXContext, pCmd);
     4664#else
     4665    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4666    return VERR_NOT_SUPPORTED;
     4667#endif
     4668}
     4669
     4670
     4671/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PALETTE  VBSVGA_3D_CMD_BASE + 26, */
     4672static int vmsvga3dVBCmdDXVideoProcessorSetStreamPalette(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamPalette const *pCmd, uint32_t cbCmd)
     4673{
     4674#ifdef VMSVGA3D_DX
     4675    //DEBUG_BREAKPOINT_TEST();
     4676    uint32_t const *paEntries = (uint32_t *)&pCmd[1];
     4677    uint32_t const cEntries = (cbCmd - sizeof(*pCmd)) / sizeof(uint32_t);
     4678    return vmsvga3dVBDXVideoProcessorSetStreamPalette(pThisCC, idDXContext, pCmd, cEntries, paEntries);
     4679#else
     4680    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4681    return VERR_NOT_SUPPORTED;
     4682#endif
     4683}
     4684
     4685
     4686/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PIXEL_ASPECT_RATIO  VBSVGA_3D_CMD_BASE + 27 */
     4687static int vmsvga3dVBCmdDXVideoProcessorSetStreamPixelAspectRatio(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamPixelAspectRatio const *pCmd, uint32_t cbCmd)
     4688{
     4689#ifdef VMSVGA3D_DX
     4690    //DEBUG_BREAKPOINT_TEST();
     4691    RT_NOREF(cbCmd);
     4692    return vmsvga3dVBDXVideoProcessorSetStreamPixelAspectRatio(pThisCC, idDXContext, pCmd);
     4693#else
     4694    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4695    return VERR_NOT_SUPPORTED;
     4696#endif
     4697}
     4698
     4699
     4700/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_LUMA_KEY  VBSVGA_3D_CMD_BASE + 28 */
     4701static int vmsvga3dVBCmdDXVideoProcessorSetStreamLumaKey(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamLumaKey const *pCmd, uint32_t cbCmd)
     4702{
     4703#ifdef VMSVGA3D_DX
     4704    //DEBUG_BREAKPOINT_TEST();
     4705    RT_NOREF(cbCmd);
     4706    return vmsvga3dVBDXVideoProcessorSetStreamLumaKey(pThisCC, idDXContext, pCmd);
     4707#else
     4708    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4709    return VERR_NOT_SUPPORTED;
     4710#endif
     4711}
     4712
     4713
     4714/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_STEREO_FORMAT  VBSVGA_3D_CMD_BASE + 29 */
     4715static int vmsvga3dVBCmdDXVideoProcessorSetStreamStereoFormat(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamStereoFormat const *pCmd, uint32_t cbCmd)
     4716{
     4717#ifdef VMSVGA3D_DX
     4718    //DEBUG_BREAKPOINT_TEST();
     4719    RT_NOREF(cbCmd);
     4720    return vmsvga3dVBDXVideoProcessorSetStreamStereoFormat(pThisCC, idDXContext, pCmd);
     4721#else
     4722    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4723    return VERR_NOT_SUPPORTED;
     4724#endif
     4725}
     4726
     4727
     4728/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_AUTO_PROCESSING_MODE  VBSVGA_3D_CMD_BASE + 30 */
     4729static int vmsvga3dVBCmdDXVideoProcessorSetStreamAutoProcessingMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamAutoProcessingMode const *pCmd, uint32_t cbCmd)
     4730{
     4731#ifdef VMSVGA3D_DX
     4732    //DEBUG_BREAKPOINT_TEST();
     4733    RT_NOREF(cbCmd);
     4734    return vmsvga3dVBDXVideoProcessorSetStreamAutoProcessingMode(pThisCC, idDXContext, pCmd);
     4735#else
     4736    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4737    return VERR_NOT_SUPPORTED;
     4738#endif
     4739}
     4740
     4741
     4742/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FILTER  VBSVGA_3D_CMD_BASE + 31 */
     4743static int vmsvga3dVBCmdDXVideoProcessorSetStreamFilter(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamFilter const *pCmd, uint32_t cbCmd)
     4744{
     4745#ifdef VMSVGA3D_DX
     4746    //DEBUG_BREAKPOINT_TEST();
     4747    RT_NOREF(cbCmd);
     4748    return vmsvga3dVBDXVideoProcessorSetStreamFilter(pThisCC, idDXContext, pCmd);
     4749#else
     4750    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4751    return VERR_NOT_SUPPORTED;
     4752#endif
     4753}
     4754
     4755
     4756/* VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ROTATION  VBSVGA_3D_CMD_BASE + 32 */
     4757static int vmsvga3dVBCmdDXVideoProcessorSetStreamRotation(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamRotation const *pCmd, uint32_t cbCmd)
     4758{
     4759#ifdef VMSVGA3D_DX
     4760    //DEBUG_BREAKPOINT_TEST();
     4761    RT_NOREF(cbCmd);
     4762    return vmsvga3dVBDXVideoProcessorSetStreamRotation(pThisCC, idDXContext, pCmd);
     4763#else
     4764    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4765    return VERR_NOT_SUPPORTED;
     4766#endif
     4767}
     4768
     4769
     4770/* VBSVGA_3D_CMD_DX_GET_VIDEO_CAPABILITY  VBSVGA_3D_CMD_BASE + 33 */
     4771static int vmsvga3dVBCmdDXGetVideoCapability(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXGetVideoCapability const *pCmd, uint32_t cbCmd)
     4772{
     4773#ifdef VMSVGA3D_DX
     4774    //DEBUG_BREAKPOINT_TEST();
     4775    RT_NOREF(cbCmd);
     4776    return vmsvga3dVBDXGetVideoCapability(pThisCC, idDXContext, pCmd);
     4777#else
     4778    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4779    return VERR_NOT_SUPPORTED;
     4780#endif
     4781}
     4782
     4783
     4784/* VBSVGA_3D_CMD_DX_CLEAR_RTV  VBSVGA_3D_CMD_BASE + 34 */
     4785static int vmsvga3dVBCmdDXClearRTV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView *pCmd, uint32_t cbCmd)
     4786{
     4787#ifdef VMSVGA3D_DX
     4788    //DEBUG_BREAKPOINT_TEST();
     4789    SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
     4790    uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
     4791    return vmsvga3dVBDXClearRTV(pThisCC, idDXContext, pCmd, cRect, cRect ? paRect : NULL);
     4792#else
     4793    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4794    return VERR_NOT_SUPPORTED;
     4795#endif
     4796}
     4797
     4798
     4799/* VBSVGA_3D_CMD_DX_CLEAR_UAV  VBSVGA_3D_CMD_BASE + 35 */
     4800static int vmsvga3dVBCmdDXClearUAV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView *pCmd, uint32_t cbCmd)
     4801{
     4802#ifdef VMSVGA3D_DX
     4803    //DEBUG_BREAKPOINT_TEST();
     4804    SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
     4805    uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
     4806    return vmsvga3dVBDXClearUAV(pThisCC, idDXContext, pCmd, cRect, cRect ? paRect : NULL);
     4807#else
     4808    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4809    return VERR_NOT_SUPPORTED;
     4810#endif
     4811}
     4812
     4813
     4814/* VBSVGA_3D_CMD_DX_CLEAR_VDOV  VBSVGA_3D_CMD_BASE + 36 */
     4815static int vmsvga3dVBCmdDXClearVDOV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView *pCmd, uint32_t cbCmd)
     4816{
     4817#ifdef VMSVGA3D_DX
     4818    //DEBUG_BREAKPOINT_TEST();
     4819    SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
     4820    uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
     4821    return vmsvga3dVBDXClearVDOV(pThisCC, idDXContext, pCmd, cRect, cRect ? paRect : NULL);
     4822#else
     4823    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4824    return VERR_NOT_SUPPORTED;
     4825#endif
     4826}
     4827
     4828
     4829/* VBSVGA_3D_CMD_DX_CLEAR_VPIV  VBSVGA_3D_CMD_BASE + 37 */
     4830static int vmsvga3dVBCmdDXClearVPIV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView *pCmd, uint32_t cbCmd)
     4831{
     4832#ifdef VMSVGA3D_DX
     4833    //DEBUG_BREAKPOINT_TEST();
     4834    SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
     4835    uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
     4836    return vmsvga3dVBDXClearVPIV(pThisCC, idDXContext, pCmd, cRect, cRect ? paRect : NULL);
     4837#else
     4838    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4839    return VERR_NOT_SUPPORTED;
     4840#endif
     4841}
     4842
     4843
     4844/* VBSVGA_3D_CMD_DX_CLEAR_VPOV  VBSVGA_3D_CMD_BASE + 38 */
     4845static int vmsvga3dVBCmdDXClearVPOV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView *pCmd, uint32_t cbCmd)
     4846{
     4847#ifdef VMSVGA3D_DX
     4848    //DEBUG_BREAKPOINT_TEST();
     4849    SVGASignedRect const *paRect = (SVGASignedRect *)&pCmd[1];
     4850    uint32_t const cRect = (cbCmd - sizeof(*pCmd)) / sizeof(SVGASignedRect);
     4851    return vmsvga3dVBDXClearVPOV(pThisCC, idDXContext, pCmd, cRect, cRect ? paRect : NULL);
     4852#else
     4853    RT_NOREF(pThisCC, idDXContext, pCmd, cbCmd);
     4854    return VERR_NOT_SUPPORTED;
     4855#endif
     4856}
     4857
     4858
    42664859/** @def VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK
    42674860 * Check that the 3D command has at least a_cbMin of payload bytes after the
     
    42924885int vmsvgaR3Process3dCmd(PVGASTATE pThis, PVGASTATECC pThisCC, uint32_t idDXContext, SVGAFifo3dCmdId enmCmdId, uint32_t cbCmd, void const *pvCmd)
    42934886{
    4294     if (enmCmdId > SVGA_3D_CMD_MAX)
    4295     {
    4296         LogRelMax(16, ("VMSVGA: unsupported 3D command %d\n", enmCmdId));
    4297         ASSERT_GUEST_FAILED_RETURN(VERR_NOT_IMPLEMENTED);
    4298     }
    4299 
    43004887    int rcParse = VINF_SUCCESS;
    43014888    PVMSVGAR3STATE pSvgaR3State = pThisCC->svga.pSvgaR3State;
     
    62166803    }
    62176804
     6805    case VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR:
     6806    {
     6807        VBSVGA3dCmdDXDefineVideoProcessor *pCmd = (VBSVGA3dCmdDXDefineVideoProcessor *)pvCmd;
     6808        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6809        rcParse = vmsvga3dVBCmdDXDefineVideoProcessor(pThisCC, idDXContext, pCmd, cbCmd);
     6810        break;
     6811    }
     6812
     6813    case VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER_OUTPUT_VIEW:
     6814    {
     6815        VBSVGA3dCmdDXDefineVideoDecoderOutputView *pCmd = (VBSVGA3dCmdDXDefineVideoDecoderOutputView *)pvCmd;
     6816        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6817        rcParse = vmsvga3dVBCmdDXDefineVideoDecoderOutputView(pThisCC, idDXContext, pCmd, cbCmd);
     6818        break;
     6819    }
     6820
     6821    case VBSVGA_3D_CMD_DX_DEFINE_VIDEO_DECODER:
     6822    {
     6823        VBSVGA3dCmdDXDefineVideoDecoder *pCmd = (VBSVGA3dCmdDXDefineVideoDecoder *)pvCmd;
     6824        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6825        rcParse = vmsvga3dVBCmdDXDefineVideoDecoder(pThisCC, idDXContext, pCmd, cbCmd);
     6826        break;
     6827    }
     6828
     6829    case VBSVGA_3D_CMD_DX_VIDEO_DECODER_BEGIN_FRAME:
     6830    {
     6831        VBSVGA3dCmdDXVideoDecoderBeginFrame *pCmd = (VBSVGA3dCmdDXVideoDecoderBeginFrame *)pvCmd;
     6832        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6833        rcParse = vmsvga3dVBCmdDXVideoDecoderBeginFrame(pThisCC, idDXContext, pCmd, cbCmd);
     6834        break;
     6835    }
     6836
     6837    case VBSVGA_3D_CMD_DX_VIDEO_DECODER_SUBMIT_BUFFERS:
     6838    {
     6839        VBSVGA3dCmdDXVideoDecoderSubmitBuffers *pCmd = (VBSVGA3dCmdDXVideoDecoderSubmitBuffers *)pvCmd;
     6840        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6841        rcParse = vmsvga3dVBCmdDXVideoDecoderSubmitBuffers(pThisCC, idDXContext, pCmd, cbCmd);
     6842        break;
     6843    }
     6844
     6845    case VBSVGA_3D_CMD_DX_VIDEO_DECODER_END_FRAME:
     6846    {
     6847        VBSVGA3dCmdDXVideoDecoderEndFrame *pCmd = (VBSVGA3dCmdDXVideoDecoderEndFrame *)pvCmd;
     6848        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6849        rcParse = vmsvga3dVBCmdDXVideoDecoderEndFrame(pThisCC, idDXContext, pCmd, cbCmd);
     6850        break;
     6851    }
     6852
     6853    case VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_INPUT_VIEW:
     6854    {
     6855        VBSVGA3dCmdDXDefineVideoProcessorInputView *pCmd = (VBSVGA3dCmdDXDefineVideoProcessorInputView *)pvCmd;
     6856        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6857        rcParse = vmsvga3dVBCmdDXDefineVideoProcessorInputView(pThisCC, idDXContext, pCmd, cbCmd);
     6858        break;
     6859    }
     6860
     6861    case VBSVGA_3D_CMD_DX_DEFINE_VIDEO_PROCESSOR_OUTPUT_VIEW:
     6862    {
     6863        VBSVGA3dCmdDXDefineVideoProcessorOutputView *pCmd = (VBSVGA3dCmdDXDefineVideoProcessorOutputView *)pvCmd;
     6864        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6865        rcParse = vmsvga3dVBCmdDXDefineVideoProcessorOutputView(pThisCC, idDXContext, pCmd, cbCmd);
     6866        break;
     6867    }
     6868
     6869    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_BLT:
     6870    {
     6871        VBSVGA3dCmdDXVideoProcessorBlt *pCmd = (VBSVGA3dCmdDXVideoProcessorBlt *)pvCmd;
     6872        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6873        rcParse = vmsvga3dVBCmdDXVideoProcessorBlt(pThisCC, idDXContext, pCmd, cbCmd);
     6874        break;
     6875    }
     6876
     6877    case VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER:
     6878    {
     6879        VBSVGA3dCmdDXDestroyVideoDecoder *pCmd = (VBSVGA3dCmdDXDestroyVideoDecoder *)pvCmd;
     6880        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6881        rcParse = vmsvga3dVBCmdDXDestroyVideoDecoder(pThisCC, idDXContext, pCmd, cbCmd);
     6882        break;
     6883    }
     6884
     6885    case VBSVGA_3D_CMD_DX_DESTROY_VIDEO_DECODER_OUTPUT_VIEW:
     6886    {
     6887        VBSVGA3dCmdDXDestroyVideoDecoderOutputView *pCmd = (VBSVGA3dCmdDXDestroyVideoDecoderOutputView *)pvCmd;
     6888        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6889        rcParse = vmsvga3dVBCmdDXDestroyVideoDecoderOutputView(pThisCC, idDXContext, pCmd, cbCmd);
     6890        break;
     6891    }
     6892
     6893    case VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR:
     6894    {
     6895        VBSVGA3dCmdDXDestroyVideoProcessor *pCmd = (VBSVGA3dCmdDXDestroyVideoProcessor *)pvCmd;
     6896        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6897        rcParse = vmsvga3dVBCmdDXDestroyVideoProcessor(pThisCC, idDXContext, pCmd, cbCmd);
     6898        break;
     6899    }
     6900
     6901    case VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_INPUT_VIEW:
     6902    {
     6903        VBSVGA3dCmdDXDestroyVideoProcessorInputView *pCmd = (VBSVGA3dCmdDXDestroyVideoProcessorInputView *)pvCmd;
     6904        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6905        rcParse = vmsvga3dVBCmdDXDestroyVideoProcessorInputView(pThisCC, idDXContext, pCmd, cbCmd);
     6906        break;
     6907    }
     6908
     6909    case VBSVGA_3D_CMD_DX_DESTROY_VIDEO_PROCESSOR_OUTPUT_VIEW:
     6910    {
     6911        VBSVGA3dCmdDXDestroyVideoProcessorOutputView *pCmd = (VBSVGA3dCmdDXDestroyVideoProcessorOutputView *)pvCmd;
     6912        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6913        rcParse = vmsvga3dVBCmdDXDestroyVideoProcessorOutputView(pThisCC, idDXContext, pCmd, cbCmd);
     6914        break;
     6915    }
     6916
     6917    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_TARGET_RECT:
     6918    {
     6919        VBSVGA3dCmdDXVideoProcessorSetOutputTargetRect *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputTargetRect *)pvCmd;
     6920        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6921        rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputTargetRect(pThisCC, idDXContext, pCmd, cbCmd);
     6922        break;
     6923    }
     6924
     6925    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_BACKGROUND_COLOR:
     6926    {
     6927        VBSVGA3dCmdDXVideoProcessorSetOutputBackgroundColor *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputBackgroundColor *)pvCmd;
     6928        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6929        rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputBackgroundColor(pThisCC, idDXContext, pCmd, cbCmd);
     6930        break;
     6931    }
     6932
     6933    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_COLOR_SPACE:
     6934    {
     6935        VBSVGA3dCmdDXVideoProcessorSetOutputColorSpace *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputColorSpace *)pvCmd;
     6936        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6937        rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputColorSpace(pThisCC, idDXContext, pCmd, cbCmd);
     6938        break;
     6939    }
     6940
     6941    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_ALPHA_FILL_MODE:
     6942    {
     6943        VBSVGA3dCmdDXVideoProcessorSetOutputAlphaFillMode *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputAlphaFillMode *)pvCmd;
     6944        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6945        rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputAlphaFillMode(pThisCC, idDXContext, pCmd, cbCmd);
     6946        break;
     6947    }
     6948
     6949    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_CONSTRICTION:
     6950    {
     6951        VBSVGA3dCmdDXVideoProcessorSetOutputConstriction *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputConstriction *)pvCmd;
     6952        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6953        rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputConstriction(pThisCC, idDXContext, pCmd, cbCmd);
     6954        break;
     6955    }
     6956
     6957    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_OUTPUT_STEREO_MODE:
     6958    {
     6959        VBSVGA3dCmdDXVideoProcessorSetOutputStereoMode *pCmd = (VBSVGA3dCmdDXVideoProcessorSetOutputStereoMode *)pvCmd;
     6960        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6961        rcParse = vmsvga3dVBCmdDXVideoProcessorSetOutputStereoMode(pThisCC, idDXContext, pCmd, cbCmd);
     6962        break;
     6963    }
     6964
     6965    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FRAME_FORMAT:
     6966    {
     6967        VBSVGA3dCmdDXVideoProcessorSetStreamFrameFormat *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamFrameFormat *)pvCmd;
     6968        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6969        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamFrameFormat(pThisCC, idDXContext, pCmd, cbCmd);
     6970        break;
     6971    }
     6972
     6973    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_COLOR_SPACE:
     6974    {
     6975        VBSVGA3dCmdDXVideoProcessorSetStreamColorSpace *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamColorSpace *)pvCmd;
     6976        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6977        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamColorSpace(pThisCC, idDXContext, pCmd, cbCmd);
     6978        break;
     6979    }
     6980
     6981    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_OUTPUT_RATE:
     6982    {
     6983        VBSVGA3dCmdDXVideoProcessorSetStreamOutputRate *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamOutputRate *)pvCmd;
     6984        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6985        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamOutputRate(pThisCC, idDXContext, pCmd, cbCmd);
     6986        break;
     6987    }
     6988
     6989    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_SOURCE_RECT:
     6990    {
     6991        VBSVGA3dCmdDXVideoProcessorSetStreamSourceRect *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamSourceRect *)pvCmd;
     6992        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     6993        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamSourceRect(pThisCC, idDXContext, pCmd, cbCmd);
     6994        break;
     6995    }
     6996
     6997    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_DEST_RECT:
     6998    {
     6999        VBSVGA3dCmdDXVideoProcessorSetStreamDestRect *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamDestRect *)pvCmd;
     7000        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7001        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamDestRect(pThisCC, idDXContext, pCmd, cbCmd);
     7002        break;
     7003    }
     7004
     7005    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ALPHA:
     7006    {
     7007        VBSVGA3dCmdDXVideoProcessorSetStreamAlpha *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamAlpha *)pvCmd;
     7008        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7009        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamAlpha(pThisCC, idDXContext, pCmd, cbCmd);
     7010        break;
     7011    }
     7012
     7013    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PALETTE:
     7014    {
     7015        VBSVGA3dCmdDXVideoProcessorSetStreamPalette *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamPalette *)pvCmd;
     7016        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7017        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamPalette(pThisCC, idDXContext, pCmd, cbCmd);
     7018        break;
     7019    }
     7020
     7021    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_PIXEL_ASPECT_RATIO:
     7022    {
     7023        VBSVGA3dCmdDXVideoProcessorSetStreamPixelAspectRatio *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamPixelAspectRatio *)pvCmd;
     7024        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7025        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamPixelAspectRatio(pThisCC, idDXContext, pCmd, cbCmd);
     7026        break;
     7027    }
     7028
     7029    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_LUMA_KEY:
     7030    {
     7031        VBSVGA3dCmdDXVideoProcessorSetStreamLumaKey *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamLumaKey *)pvCmd;
     7032        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7033        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamLumaKey(pThisCC, idDXContext, pCmd, cbCmd);
     7034        break;
     7035    }
     7036
     7037    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_STEREO_FORMAT:
     7038    {
     7039        VBSVGA3dCmdDXVideoProcessorSetStreamStereoFormat *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamStereoFormat *)pvCmd;
     7040        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7041        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamStereoFormat(pThisCC, idDXContext, pCmd, cbCmd);
     7042        break;
     7043    }
     7044
     7045    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_AUTO_PROCESSING_MODE:
     7046    {
     7047        VBSVGA3dCmdDXVideoProcessorSetStreamAutoProcessingMode *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamAutoProcessingMode *)pvCmd;
     7048        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7049        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamAutoProcessingMode(pThisCC, idDXContext, pCmd, cbCmd);
     7050        break;
     7051    }
     7052
     7053    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_FILTER:
     7054    {
     7055        VBSVGA3dCmdDXVideoProcessorSetStreamFilter *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamFilter *)pvCmd;
     7056        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7057        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamFilter(pThisCC, idDXContext, pCmd, cbCmd);
     7058        break;
     7059    }
     7060
     7061    case VBSVGA_3D_CMD_DX_VIDEO_PROCESSOR_SET_STREAM_ROTATION:
     7062    {
     7063        VBSVGA3dCmdDXVideoProcessorSetStreamRotation *pCmd = (VBSVGA3dCmdDXVideoProcessorSetStreamRotation *)pvCmd;
     7064        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7065        rcParse = vmsvga3dVBCmdDXVideoProcessorSetStreamRotation(pThisCC, idDXContext, pCmd, cbCmd);
     7066        break;
     7067    }
     7068
     7069    case VBSVGA_3D_CMD_DX_GET_VIDEO_CAPABILITY:
     7070    {
     7071        VBSVGA3dCmdDXGetVideoCapability *pCmd = (VBSVGA3dCmdDXGetVideoCapability *)pvCmd;
     7072        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7073        rcParse = vmsvga3dVBCmdDXGetVideoCapability(pThisCC, idDXContext, pCmd, cbCmd);
     7074        break;
     7075    }
     7076
     7077    case VBSVGA_3D_CMD_DX_CLEAR_RTV:
     7078    {
     7079        VBSVGA3dCmdDXClearView *pCmd = (VBSVGA3dCmdDXClearView *)pvCmd;
     7080        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7081        rcParse = vmsvga3dVBCmdDXClearRTV(pThisCC, idDXContext, pCmd, cbCmd);
     7082        break;
     7083    }
     7084
     7085    case VBSVGA_3D_CMD_DX_CLEAR_UAV:
     7086    {
     7087        VBSVGA3dCmdDXClearView *pCmd = (VBSVGA3dCmdDXClearView *)pvCmd;
     7088        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7089        rcParse = vmsvga3dVBCmdDXClearUAV(pThisCC, idDXContext, pCmd, cbCmd);
     7090        break;
     7091    }
     7092
     7093    case VBSVGA_3D_CMD_DX_CLEAR_VDOV:
     7094    {
     7095        VBSVGA3dCmdDXClearView *pCmd = (VBSVGA3dCmdDXClearView *)pvCmd;
     7096        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7097        rcParse = vmsvga3dVBCmdDXClearVDOV(pThisCC, idDXContext, pCmd, cbCmd);
     7098        break;
     7099    }
     7100
     7101    case VBSVGA_3D_CMD_DX_CLEAR_VPIV:
     7102    {
     7103        VBSVGA3dCmdDXClearView *pCmd = (VBSVGA3dCmdDXClearView *)pvCmd;
     7104        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7105        rcParse = vmsvga3dVBCmdDXClearVPIV(pThisCC, idDXContext, pCmd, cbCmd);
     7106        break;
     7107    }
     7108
     7109    case VBSVGA_3D_CMD_DX_CLEAR_VPOV:
     7110    {
     7111        VBSVGA3dCmdDXClearView *pCmd = (VBSVGA3dCmdDXClearView *)pvCmd;
     7112        VMSVGAFIFO_CHECK_3D_CMD_MIN_SIZE_BREAK(sizeof(*pCmd));
     7113        rcParse = vmsvga3dVBCmdDXClearVPOV(pThisCC, idDXContext, pCmd, cbCmd);
     7114        break;
     7115    }
     7116
    62187117    /* Unsupported commands. */
    62197118    case SVGA_3D_CMD_DEAD4: /* SVGA_3D_CMD_VIDEO_CREATE_DECODER */
     
    62297128    case SVGA_3D_CMD_MAX:
    62307129    case SVGA_3D_CMD_FUTURE_MAX:
     7130    case VBSVGA_3D_CMD_MAX:
    62317131#ifndef DEBUG_sunlover
    62327132    default: /* Compiler warning. */
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA-internal.h

    r99688 r102520  
    160160    VMSVGA3DBACKENDFUNCSGBO *pFuncsGBO;
    161161    VMSVGA3DBACKENDFUNCSDX  *pFuncsDX;
     162    VMSVGA3DBACKENDFUNCSDXVIDEO *pFuncsDXVideo;
    162163# endif
    163164
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.cpp

    r100757 r102520  
    37233723# ifdef LOG_ENABLED
    37243724#  ifdef VBOX_WITH_VMSVGA3D
    3725         if (SVGA_3D_CMD_BASE <= cmdId && cmdId < SVGA_3D_CMD_MAX)
     3725        if (   (cmdId >= SVGA_3D_CMD_BASE && cmdId < SVGA_3D_CMD_MAX)
     3726            || (cmdId >= VBSVGA_3D_CMD_BASE && cmdId < VBSVGA_3D_CMD_MAX))
    37263727        {
    37273728            SVGA3dCmdHeader const *header = (SVGA3dCmdHeader *)pu8Cmd;
     
    40204021            {
    40214022# ifdef VBOX_WITH_VMSVGA3D
    4022                 if (   cmdId >= SVGA_3D_CMD_BASE
    4023                     && cmdId <  SVGA_3D_CMD_MAX)
     4023                if (   (cmdId >= SVGA_3D_CMD_BASE && cmdId < SVGA_3D_CMD_MAX)
     4024                    || (   pThis->svga.fVBoxExtensions
     4025                        && (cmdId >= VBSVGA_3D_CMD_BASE && cmdId < VBSVGA_3D_CMD_MAX)))
    40244026                {
    40254027                    RT_UNTRUSTED_VALIDATED_FENCE();
     
    52845286            default:
    52855287# ifdef VBOX_WITH_VMSVGA3D
    5286                 if (    (int)enmCmdId >= SVGA_3D_CMD_BASE
    5287                     &&  (int)enmCmdId <  SVGA_3D_CMD_MAX)
     5288                if (   ((int)enmCmdId >= SVGA_3D_CMD_BASE && (int)enmCmdId <  SVGA_3D_CMD_MAX)
     5289                    || (   pThis->svga.fVBoxExtensions
     5290                        && ((int)enmCmdId >= VBSVGA_3D_CMD_BASE && (int)enmCmdId < VBSVGA_3D_CMD_MAX)))
    52885291                {
    52895292                    RT_UNTRUSTED_VALIDATED_FENCE();
     
    65876590    RTMemFree(pSVGAState->pFuncsDX);
    65886591    pSVGAState->pFuncsDX = NULL;
     6592    RTMemFree(pSVGAState->pFuncsDXVideo);
     6593    pSVGAState->pFuncsDXVideo = NULL;
    65896594    RTMemFree(pSVGAState->pFuncsVGPU9);
    65906595    pSVGAState->pFuncsVGPU9 = NULL;
     
    66266631        ENTRY_3D_INTERFACE(VGPU9, pFuncsVGPU9),
    66276632        ENTRY_3D_INTERFACE(DX,    pFuncsDX),
     6633        ENTRY_3D_INTERFACE(DXVIDEO, pFuncsDXVideo),
    66286634        ENTRY_3D_INTERFACE(MAP,   pFuncsMap),
    66296635        ENTRY_3D_INTERFACE(GBO,   pFuncsGBO),
     
    67786784        int rc = vmsvga3dQueryCaps(pThisCC, (SVGA3dDevCapIndex)i, &val);
    67796785        if (RT_SUCCESS(rc))
     6786        {
     6787            if (!pThis->svga.fVBoxExtensions)
     6788            {
     6789                /* Hide extended VBoxSVGA capabilities. */
     6790                if (i == SVGA3D_DEVCAP_3D)
     6791                    val &= VBSVGA3D_CAP_3D;
     6792            }
    67806793            pThis->svga.au32DevCaps[i] = val;
     6794        }
    67816795        else
    67826796            pThis->svga.au32DevCaps[i] = 0;
     
    70467060    }
    70477061    Log(("VMSVGA: Maximum size (%d,%d)\n", pThis->svga.u32MaxWidth, pThis->svga.u32MaxHeight));
     7062
     7063    /* VBox commands and capabilities are always enabled for VirtualBox PCI device. */
     7064    pThis->svga.fVBoxExtensions = !pThis->fVMSVGAPciId;
    70487065
    70497066# ifdef DEBUG_GMR_ACCESS
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA.h

    r100690 r102520  
    7979#include <svga_escape.h>
    8080#include <svga_overlay.h>
     81#include <vbsvga3d_dx.h>
    8182#pragma pack()
    8283#include "vmsvga_headers_end.h"
     
    358359    /** Indicates that the guest behaves incorrectly. */
    359360    bool volatile               fBadGuest;
    360     bool                        afPadding[4];
     361    /** Whether the VirtualBox extensions for VMSVGA device (new commands and caps) are enabled. */
     362    bool                        fVBoxExtensions;
     363    bool                        afPadding[3];
    361364    uint32_t                    uWidth;
    362365    uint32_t                    uHeight;
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-dx11.cpp

    r102142 r102520  
    107107    D3D_FEATURE_LEVEL           FeatureLevel;
    108108
     109    ID3D11VideoDevice          *pVideoDevice;
     110    ID3D11VideoContext         *pVideoContext;
    109111#ifdef DX_COMMON_STAGING_BUFFER
    110112    /* Staging buffer for transfer to surface buffers. */
     
    123125    VMSVGA3D_VIEWTYPE_DEPTHSTENCIL   = 2,
    124126    VMSVGA3D_VIEWTYPE_SHADERRESOURCE = 3,
    125     VMSVGA3D_VIEWTYPE_UNORDEREDACCESS = 4
     127    VMSVGA3D_VIEWTYPE_UNORDEREDACCESS = 4,
     128    VMSVGA3D_VIEWTYPE_VIDEODECODEROUTPUT = 5,
     129    VMSVGA3D_VIEWTYPE_VIDEOPROCESSORINPUT = 6,
     130    VMSVGA3D_VIEWTYPE_VIDEOPROCESSOROUTPUT = 7
    126131} VMSVGA3DBACKVIEWTYPE;
    127132
     
    153158        ID3D11ShaderResourceView *pShaderResourceView;
    154159        ID3D11UnorderedAccessView *pUnorderedAccessView;
     160        ID3D11VideoDecoderOutputView *pVideoDecoderOutputView;
     161        ID3D11VideoProcessorInputView *pVideoProcessorInputView;
     162        ID3D11VideoProcessorOutputView *pVideoProcessorOutputView;
    155163    } u;
    156164
     
    278286    };
    279287} DXQUERY;
     288
     289typedef struct DXVIDEOPROCESSOR
     290{
     291    ID3D11VideoProcessorEnumerator *pEnum;
     292    ID3D11VideoProcessor       *pVideoProcessor;
     293} DXVIDEOPROCESSOR;
     294
     295typedef struct DXVIDEODECODER
     296{
     297    ID3D11VideoDecoder         *pVideoDecoder;
     298} DXVIDEODECODER;
    280299
    281300typedef struct DXSTREAMOUTPUT
     
    343362    DXVIEW                    *paUnorderedAccessView;
    344363
     364    uint32_t                   cVideoProcessor;        /* paVideoProcessor */
     365    uint32_t                   cVideoDecoderOutputView; /* paVideoDecoderOutputView */
     366    uint32_t                   cVideoDecoder;          /* paVideoDecoder */
     367    uint32_t                   cVideoProcessorInputView; /* paVideoProcessorInputView */
     368    uint32_t                   cVideoProcessorOutputView; /* paVideoProcessorOutputView */
     369    DXVIDEOPROCESSOR          *paVideoProcessor;
     370    DXVIEW                    *paVideoDecoderOutputView;
     371    DXVIDEODECODER            *paVideoDecoder;
     372    DXVIEW                    *paVideoProcessorInputView;
     373    DXVIEW                    *paVideoProcessorOutputView;
     374
    345375    uint32_t                   cSOTarget;              /* How many SO targets are currently set (SetSOTargets) */
    346376
     
    361391
    362392    DXDEVICE                   dxDevice;               /* Device for the VMSVGA3D context independent operation. */
     393    UINT                       VendorId;
     394    UINT                       DeviceId;
    363395
    364396    DXBOUNDRESOURCES           resources;              /* What is currently applied to the pipeline. */
     
    382414static int dxDestroyQuery(DXQUERY *pDXQuery);
    383415static int dxReadBuffer(DXDEVICE *pDevice, ID3D11Buffer *pBuffer, UINT Offset, UINT Bytes, void **ppvData, uint32_t *pcbData);
     416
     417static int dxCreateVideoProcessor(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, VBSVGACOTableDXVideoProcessorEntry const *pEntry);
     418static void dxDestroyVideoProcessor(DXVIDEOPROCESSOR *pDXVideoProcessor);
     419static int dxCreateVideoDecoder(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId, VBSVGACOTableDXVideoDecoderEntry const *pEntry);
     420static void dxDestroyVideoDecoder(DXVIDEODECODER *pDXVideoDecoder);
    384421
    385422static HRESULT BlitInit(D3D11BLITTER *pBlitter, ID3D11Device *pDevice, ID3D11DeviceContext *pImmediateContext);
     
    475512        case SVGA3D_A16B16G16R16:               return DXGI_FORMAT_;
    476513        case SVGA3D_UYVY:                       return DXGI_FORMAT_;
    477         case SVGA3D_YUY2:                       return DXGI_FORMAT_;
    478         case SVGA3D_NV12:                       return DXGI_FORMAT_;
     514        case SVGA3D_YUY2:                       return DXGI_FORMAT_YUY2;
     515        case SVGA3D_NV12:                       return DXGI_FORMAT_NV12;
    479516        case SVGA3D_FORMAT_DEAD2:               break; /* Old SVGA3D_AYUV */
    480517        case SVGA3D_R32G32B32A32_TYPELESS:      return DXGI_FORMAT_R32G32B32A32_TYPELESS;
     
    594631        case SVGA3D_BC7_UNORM:                  return DXGI_FORMAT_BC7_UNORM;
    595632        case SVGA3D_BC7_UNORM_SRGB:             return DXGI_FORMAT_BC7_UNORM_SRGB;
    596         case SVGA3D_AYUV:                       return DXGI_FORMAT_;
     633        case SVGA3D_AYUV:                       return DXGI_FORMAT_AYUV;
    597634
    598635        case SVGA3D_FORMAT_INVALID:
     
    896933
    897934
     935static void dxLogRelVideoCaps(ID3D11VideoDevice *pVideoDevice)
     936{
     937#define FORMAT_ELEMENT(aFormat) { aFormat, #aFormat }
     938    static const struct {
     939        DXGI_FORMAT format;
     940        char const *pszFormat;
     941    } aVDFormats[] =
     942    {
     943        FORMAT_ELEMENT(DXGI_FORMAT_NV12),
     944        FORMAT_ELEMENT(DXGI_FORMAT_YUY2),
     945        FORMAT_ELEMENT(DXGI_FORMAT_AYUV),
     946    };
     947
     948    static const struct {
     949        DXGI_FORMAT format;
     950        char const *pszFormat;
     951    } aVPFormats[] =
     952    {
     953        // Queried from driver
     954        FORMAT_ELEMENT(DXGI_FORMAT_R8_UNORM),
     955        FORMAT_ELEMENT(DXGI_FORMAT_R16_UNORM),
     956        FORMAT_ELEMENT(DXGI_FORMAT_NV12),
     957        FORMAT_ELEMENT(DXGI_FORMAT_420_OPAQUE),
     958        FORMAT_ELEMENT(DXGI_FORMAT_P010),
     959        FORMAT_ELEMENT(DXGI_FORMAT_P016),
     960        FORMAT_ELEMENT(DXGI_FORMAT_YUY2),
     961        FORMAT_ELEMENT(DXGI_FORMAT_NV11),
     962        FORMAT_ELEMENT(DXGI_FORMAT_AYUV),
     963        FORMAT_ELEMENT(DXGI_FORMAT_R16G16B16A16_FLOAT),
     964        FORMAT_ELEMENT(DXGI_FORMAT_Y216),
     965        FORMAT_ELEMENT(DXGI_FORMAT_B8G8R8X8_UNORM),
     966        FORMAT_ELEMENT(DXGI_FORMAT_B8G8R8A8_UNORM),
     967        FORMAT_ELEMENT(DXGI_FORMAT_R8G8B8A8_UNORM),
     968        FORMAT_ELEMENT(DXGI_FORMAT_R10G10B10A2_UNORM),
     969
     970        // From format table
     971        FORMAT_ELEMENT(DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM),
     972        FORMAT_ELEMENT(DXGI_FORMAT_R8G8B8A8_UNORM_SRGB),
     973        FORMAT_ELEMENT(DXGI_FORMAT_B8G8R8A8_UNORM_SRGB),
     974        FORMAT_ELEMENT(DXGI_FORMAT_Y410),
     975        FORMAT_ELEMENT(DXGI_FORMAT_Y416),
     976        FORMAT_ELEMENT(DXGI_FORMAT_Y210),
     977        FORMAT_ELEMENT(DXGI_FORMAT_AI44),
     978        FORMAT_ELEMENT(DXGI_FORMAT_IA44),
     979        FORMAT_ELEMENT(DXGI_FORMAT_P8),
     980        FORMAT_ELEMENT(DXGI_FORMAT_A8P8),
     981    };
     982#undef FORMAT_ELEMENT
     983
     984    static char const *apszFilterName[] =
     985    {
     986        "BRIGHTNESS",
     987        "CONTRAST",
     988        "HUE",
     989        "SATURATION",
     990        "NOISE_REDUCTION",
     991        "EDGE_ENHANCEMENT",
     992        "ANAMORPHIC_SCALING",
     993        "STEREO_ADJUSTMENT",
     994    };
     995
     996    HRESULT hr;
     997
     998    UINT cProfiles = pVideoDevice->GetVideoDecoderProfileCount();
     999    for (UINT i = 0; i < cProfiles; ++i)
     1000    {
     1001        GUID DecodeProfile;
     1002        hr = pVideoDevice->GetVideoDecoderProfile(i, &DecodeProfile);
     1003        if (SUCCEEDED(hr))
     1004            LogRel(("VMSVGA: DecodeProfile[%d]: %RTuuid\n", i, &DecodeProfile));
     1005    }
     1006
     1007    D3D11_VIDEO_DECODER_DESC DecoderDesc;
     1008    // Commonly used D3D11_DECODER_PROFILE_H264_VLD_NOFGT
     1009    DecoderDesc.Guid         = { 0x1b81be68, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5 };
     1010    DecoderDesc.SampleWidth  = 1920;
     1011    DecoderDesc.SampleHeight = 1080;
     1012    DecoderDesc.OutputFormat = DXGI_FORMAT_NV12;
     1013
     1014    UINT cConfigs = 0;
     1015    hr = pVideoDevice->GetVideoDecoderConfigCount(&DecoderDesc, &cConfigs);
     1016    for (UINT i = 0; i < cConfigs; ++i)
     1017    {
     1018        D3D11_VIDEO_DECODER_CONFIG DecoderConfig;
     1019        hr = pVideoDevice->GetVideoDecoderConfig(&DecoderDesc, i, &DecoderConfig);
     1020        if (SUCCEEDED(hr))
     1021        {
     1022            LogRel2(("VMSVGA: Config[%d]:\n"
     1023                     "VMSVGA:   %RTuuid\n"
     1024                     "VMSVGA:   %RTuuid\n"
     1025                     "VMSVGA:   %RTuuid\n"
     1026                     "VMSVGA:   BitstreamRaw 0x%x\n"
     1027                     "VMSVGA:   MBCRO        0x%x\n"
     1028                     "VMSVGA:   RDH          0x%x\n"
     1029                     "VMSVGA:   SR8          0x%x\n"
     1030                     "VMSVGA:   R8Sub        0x%x\n"
     1031                     "VMSVGA:   SH8or9C      0x%x\n"
     1032                     "VMSVGA:   SRInterlea   0x%x\n"
     1033                     "VMSVGA:   IRUnsigned   0x%x\n"
     1034                     "VMSVGA:   RDAccel      0x%x\n"
     1035                     "VMSVGA:   HInvScan     0x%x\n"
     1036                     "VMSVGA:   SpecIDCT     0x%x\n"
     1037                     "VMSVGA:   4GCoefs      0x%x\n"
     1038                     "VMSVGA:   MinRTBC      0x%x\n"
     1039                     "VMSVGA:   DecSpec      0x%x\n"
     1040                     ,
     1041                     i, &DecoderConfig.guidConfigBitstreamEncryption,
     1042                     &DecoderConfig.guidConfigMBcontrolEncryption,
     1043                     &DecoderConfig.guidConfigResidDiffEncryption,
     1044                     DecoderConfig.ConfigBitstreamRaw,
     1045                     DecoderConfig.ConfigMBcontrolRasterOrder,
     1046                     DecoderConfig.ConfigResidDiffHost,
     1047                     DecoderConfig.ConfigSpatialResid8,
     1048                     DecoderConfig.ConfigResid8Subtraction,
     1049                     DecoderConfig.ConfigSpatialHost8or9Clipping,
     1050                     DecoderConfig.ConfigSpatialResidInterleaved,
     1051                     DecoderConfig.ConfigIntraResidUnsigned,
     1052                     DecoderConfig.ConfigResidDiffAccelerator,
     1053                     DecoderConfig.ConfigHostInverseScan,
     1054                     DecoderConfig.ConfigSpecificIDCT,
     1055                     DecoderConfig.Config4GroupedCoefs,
     1056                     DecoderConfig.ConfigMinRenderTargetBuffCount,
     1057                     DecoderConfig.ConfigDecoderSpecific
     1058                   ));
     1059        }
     1060    }
     1061
     1062    for (UINT idxFormat = 0; idxFormat < RT_ELEMENTS(aVDFormats); ++idxFormat)
     1063    {
     1064        BOOL Supported;
     1065        hr = pVideoDevice->CheckVideoDecoderFormat(&DecoderDesc.Guid, aVDFormats[idxFormat].format, &Supported);
     1066        if (FAILED(hr))
     1067            Supported = FALSE;
     1068        LogRel(("VMSVGA: %s: %s\n", aVDFormats[idxFormat].pszFormat, Supported ? "supported" : "-"));
     1069    }
     1070
     1071    /* An arbitrary common video content. */
     1072    D3D11_VIDEO_PROCESSOR_CONTENT_DESC Desc;
     1073    Desc.InputFrameFormat            = D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE;
     1074    Desc.InputFrameRate.Numerator    = 25;
     1075    Desc.InputFrameRate.Denominator  = 1;
     1076    Desc.InputWidth                  = 1920;
     1077    Desc.InputHeight                 = 1080;
     1078    Desc.OutputFrameRate.Numerator   = 30;
     1079    Desc.OutputFrameRate.Denominator = 1;
     1080    Desc.OutputWidth                 = 864;
     1081    Desc.OutputHeight                = 486;
     1082    Desc.Usage                       = D3D11_VIDEO_USAGE_OPTIMAL_QUALITY;
     1083
     1084    ID3D11VideoProcessorEnumerator *pEnum = 0;
     1085    hr = pVideoDevice->CreateVideoProcessorEnumerator(&Desc, &pEnum);
     1086    if (SUCCEEDED(hr))
     1087    {
     1088        for (unsigned i = 0; i < RT_ELEMENTS(aVPFormats); ++i)
     1089        {
     1090            UINT Flags;
     1091            hr = pEnum->CheckVideoProcessorFormat(aVPFormats[i].format, &Flags);
     1092            if (FAILED(hr))
     1093                Flags = 0;
     1094            LogRel(("VMSVGA: %s: flags %x\n", aVPFormats[i].pszFormat, Flags));
     1095        }
     1096
     1097        D3D11_VIDEO_PROCESSOR_CAPS Caps;
     1098        hr = pEnum->GetVideoProcessorCaps(&Caps);
     1099        if (SUCCEEDED(hr))
     1100        {
     1101            LogRel(("VMSVGA: VideoProcessorCaps:\n"
     1102                    "VMSVGA:   DeviceCaps %x\n"
     1103                    "VMSVGA:   FeatureCaps %x\n"
     1104                    "VMSVGA:   FilterCaps %x\n"
     1105                    "VMSVGA:   InputFormatCaps %x\n"
     1106                    "VMSVGA:   AutoStreamCaps %x\n"
     1107                    "VMSVGA:   StereoCaps %x\n"
     1108                    "VMSVGA:   RateConversionCapsCount %d\n"
     1109                    "VMSVGA:   MaxInputStreams %d\n"
     1110                    "VMSVGA:   MaxStreamStates %d\n"
     1111                    "",
     1112                    Caps.DeviceCaps,
     1113                    Caps.FeatureCaps,
     1114                    Caps.FilterCaps,
     1115                    Caps.InputFormatCaps,
     1116                    Caps.AutoStreamCaps,
     1117                    Caps.StereoCaps,
     1118                    Caps.RateConversionCapsCount,
     1119                    Caps.MaxInputStreams,
     1120                    Caps.MaxStreamStates
     1121                  ));
     1122
     1123            for (unsigned i = 0; i < RT_ELEMENTS(apszFilterName); ++i)
     1124            {
     1125                if (Caps.FilterCaps & (1 << i))
     1126                {
     1127                    D3D11_VIDEO_PROCESSOR_FILTER_RANGE Range;
     1128                    hr = pEnum->GetVideoProcessorFilterRange((D3D11_VIDEO_PROCESSOR_FILTER)i, &Range);
     1129                    if (SUCCEEDED(hr))
     1130                    {
     1131                        LogRel(("VMSVGA: Filter[%s]: Min %d, Max %d, Default %d, Multiplier " FLOAT_FMT_STR "\n",
     1132                                 apszFilterName[i],
     1133                                 Range.Minimum,
     1134                                 Range.Maximum,
     1135                                 Range.Default,
     1136                                 FLOAT_FMT_ARGS(Range.Multiplier)
     1137                                ));
     1138                    }
     1139                }
     1140            }
     1141
     1142            for (unsigned idxRateCaps = 0; idxRateCaps < Caps.RateConversionCapsCount; ++idxRateCaps)
     1143            {
     1144                D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS RateCaps;
     1145                hr = pEnum->GetVideoProcessorRateConversionCaps(idxRateCaps, &RateCaps);
     1146                if (SUCCEEDED(hr))
     1147                {
     1148                    LogRel(("VMSVGA: RateConversionCaps[%u]:\n"
     1149                            "VMSVGA:   PastFrames %d\n"
     1150                            "VMSVGA:   FutureFrames %d\n"
     1151                            "VMSVGA:   ProcessorCaps %x\n"
     1152                            "VMSVGA:   ITelecineCaps %x\n"
     1153                            "VMSVGA:   CustomRateCount %d\n"
     1154                            "",
     1155                            idxRateCaps,
     1156                            RateCaps.PastFrames,
     1157                            RateCaps.FutureFrames,
     1158                            RateCaps.ProcessorCaps,
     1159                            RateCaps.ITelecineCaps,
     1160                            RateCaps.CustomRateCount
     1161                          ));
     1162
     1163                    for (unsigned idxCustomRateCap = 0; idxCustomRateCap < RateCaps.CustomRateCount; ++idxCustomRateCap)
     1164                    {
     1165                        D3D11_VIDEO_PROCESSOR_CUSTOM_RATE Rate;
     1166                        hr = pEnum->GetVideoProcessorCustomRate(idxRateCaps, idxCustomRateCap, &Rate);
     1167                        if (SUCCEEDED(hr))
     1168                        {
     1169                            LogRel(("VMSVGA:   CustomRate[%u][%u]:\n"
     1170                                    "VMSVGA:     CustomRate %d/%d\n"
     1171                                    "VMSVGA:     OutputFrames %d\n"
     1172                                    "VMSVGA:     InputInterlaced %d\n"
     1173                                    "VMSVGA:     InputFramesOrFields %d\n"
     1174                                    "",
     1175                                    idxRateCaps, idxCustomRateCap,
     1176                                    Rate.CustomRate.Numerator,
     1177                                    Rate.CustomRate.Denominator,
     1178                                    Rate.OutputFrames,
     1179                                    Rate.InputInterlaced,
     1180                                    Rate.InputFramesOrFields
     1181                                  ));
     1182                        }
     1183                    }
     1184                }
     1185            }
     1186        }
     1187
     1188        D3D_RELEASE(pEnum);
     1189    }
     1190}
     1191
     1192
    8981193static int dxDeviceCreate(PVMSVGA3DBACKEND pBackend, DXDEVICE *pDXDevice)
    8991194{
     
    9121207
    9131208        pDXDevice->FeatureLevel = pBackend->dxDevice.FeatureLevel;
     1209
     1210        pDXDevice->pVideoDevice = pBackend->dxDevice.pVideoDevice;
     1211        if (pDXDevice->pVideoDevice)
     1212            pDXDevice->pVideoDevice->AddRef();
     1213
     1214        pDXDevice->pVideoContext = pBackend->dxDevice.pVideoContext;
     1215        if (pDXDevice->pVideoContext)
     1216            pDXDevice->pVideoContext->AddRef();
    9141217
    9151218#ifdef DX_COMMON_STAGING_BUFFER
     
    9801283                         VERR_NOT_SUPPORTED);
    9811284
     1285        HRESULT hr2;
    9821286#ifdef DEBUG
    9831287        /* Break into debugger when DX runtime detects anything unusual. */
    984         HRESULT hr2;
    9851288        ID3D11Debug *pDebug = 0;
    9861289        hr2 = pDXDevice->pDevice->QueryInterface(__uuidof(ID3D11Debug), (void**)&pDebug);
     
    10341337            D3D_RELEASE(pDxgiDevice);
    10351338        }
     1339
     1340        /* Failure to query VideoDevice should be ignored. */
     1341        hr2 = pDXDevice->pDevice->QueryInterface(__uuidof(ID3D11VideoDevice), (void**)&pDXDevice->pVideoDevice);
     1342        Assert(SUCCEEDED(hr2));
     1343        if (SUCCEEDED(hr2))
     1344        {
     1345            hr2 = pDXDevice->pImmediateContext->QueryInterface(__uuidof(ID3D11VideoContext), (void**)&pDXDevice->pVideoContext);
     1346            Assert(SUCCEEDED(hr2));
     1347            if (SUCCEEDED(hr2))
     1348            {
     1349                LogRel(("VMSVGA: VideoDevice available\n"));
     1350            }
     1351            else
     1352            {
     1353                D3D_RELEASE(pDXDevice->pVideoDevice);
     1354                pDXDevice->pVideoContext = NULL;
     1355            }
     1356        }
     1357        else
     1358            pDXDevice->pVideoDevice = NULL;
    10361359    }
    10371360
     
    10541377    D3D_RELEASE(pDevice->pStagingBuffer);
    10551378#endif
     1379
     1380    D3D_RELEASE(pDevice->pVideoDevice);
     1381    D3D_RELEASE(pDevice->pVideoContext);
    10561382
    10571383    D3D_RELEASE(pDevice->pDxgiFactory);
     
    11751501static DXDEVICE *dxDeviceFromContext(PVMSVGA3DSTATE p3dState, VMSVGA3DDXCONTEXT *pDXContext)
    11761502{
     1503    DXDEVICE *pDXDevice;
    11771504    if (pDXContext && !p3dState->pBackend->fSingleDevice)
    1178         return &pDXContext->pBackendDXContext->dxDevice;
    1179 
    1180     return &p3dState->pBackend->dxDevice;
     1505        pDXDevice = &pDXContext->pBackendDXContext->dxDevice;
     1506    else
     1507        pDXDevice = &p3dState->pBackend->dxDevice;
     1508
     1509#ifdef DEBUG
     1510    HRESULT hr = pDXDevice->pDevice->GetDeviceRemovedReason();
     1511    Assert(SUCCEEDED(hr));
     1512#endif
     1513    return pDXDevice;
    11811514}
    11821515
     
    21942527    if (surfaceFlags & SVGA3D_SURFACE_BIND_STREAM_OUTPUT)   BindFlags |= D3D11_BIND_STREAM_OUTPUT;
    21952528    if (surfaceFlags & SVGA3D_SURFACE_BIND_UAVIEW)          BindFlags |= D3D11_BIND_UNORDERED_ACCESS;
     2529    if (surfaceFlags & SVGA3D_SURFACE_RESERVED1)            BindFlags |= D3D11_BIND_DECODER;
    21962530
    21972531    return BindFlags;
     
    23702704     * because D3D11_BIND_DEPTH_STENCIL requires a depth/stencil format.
    23712705     * Always use typeless format for staging/dynamic resources.
     2706     * Use explicit format for screen targets. For example they can be used
     2707     * for video processor output view, which does not allow a typeless format.
    23722708     */
    23732709    DXGI_FORMAT const dxgiFormatTypeless = dxGetDxgiTypelessFormat(dxgiFormat);
    2374     if (!dxIsDepthStencilFormat(dxgiFormat))
     2710    if (   !dxIsDepthStencilFormat(dxgiFormat)
     2711        && !RT_BOOL(pSurface->f.surfaceFlags & SVGA3D_SURFACE_SCREENTARGET))
    23752712        dxgiFormat = dxgiFormatTypeless;
    23762713
     
    30543391
    30553392
     3393static int dxEnsureResource(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, uint32_t sid,
     3394                            PVMSVGA3DSURFACE *ppSurface, ID3D11Resource **ppResource)
     3395{
     3396    /* Get corresponding resource for sid. Create the surface if does not yet exist. */
     3397    PVMSVGA3DSURFACE pSurface;
     3398    int rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, sid, &pSurface);
     3399    AssertRCReturn(rc, rc);
     3400
     3401    if (pSurface->pBackendSurface == NULL)
     3402    {
     3403        /* Create the actual texture or buffer. */
     3404        /** @todo One function to create all resources from surfaces. */
     3405        if (pSurface->format != SVGA3D_BUFFER)
     3406            rc = vmsvga3dBackSurfaceCreateTexture(pThisCC, pDXContext, pSurface);
     3407        else
     3408            rc = vmsvga3dBackSurfaceCreateResource(pThisCC, pDXContext, pSurface);
     3409
     3410        AssertRCReturn(rc, rc);
     3411    }
     3412
     3413    ID3D11Resource *pResource = dxResource(pThisCC->svga.p3dState, pSurface, pDXContext);
     3414    AssertReturn(pResource, VERR_INVALID_STATE);
     3415
     3416    *ppSurface = pSurface;
     3417    *ppResource  = pResource;
     3418    return VINF_SUCCESS;
     3419}
     3420
     3421
    30563422#ifdef DX_COMMON_STAGING_BUFFER
    30573423static int dxStagingBufferRealloc(DXDEVICE *pDXDevice, uint32_t cbRequiredSize)
     
    31603526            if (SUCCEEDED(hr))
    31613527            {
     3528                pBackend->VendorId = desc.VendorId;
     3529                pBackend->DeviceId = desc.DeviceId;
     3530
    31623531                char sz[RT_ELEMENTS(desc.Description)];
    31633532                for (unsigned i = 0; i < RT_ELEMENTS(desc.Description); ++i)
    31643533                    sz[i] = (char)desc.Description[i];
    3165                 LogRelMax(1, ("VMSVGA: Adapter [%s]\n", sz));
     3534                LogRelMax(1, ("VMSVGA: Adapter %04x:%04x [%s]\n", pBackend->VendorId, pBackend->DeviceId, sz));
    31663535            }
    31673536
    31683537            pAdapter->Release();
    31693538        }
     3539
     3540        if (pBackend->dxDevice.pVideoDevice)
     3541            dxLogRelVideoCaps(pBackend->dxDevice.pVideoDevice);
    31703542    }
    31713543    return rc;
     
    39244296    {
    39254297    case SVGA3D_DEVCAP_3D:
    3926         *pu32Val = 1;
     4298        *pu32Val = VBSVGA3D_CAP_3D;
     4299        if (pState->pBackend->dxDevice.pVideoDevice)
     4300            *pu32Val |= VBSVGA3D_CAP_VIDEO;
    39274301        break;
    39284302
     
    49535327                        break;
    49545328                    }
    4955                     default:
     5329                    case VMSVGA3D_VIEWTYPE_VIDEODECODEROUTPUT:
     5330                    {
     5331                        VBSVGACOTableDXVideoDecoderOutputViewEntry *pEntry = &pDXContext->cot.paVideoDecoderOutputView[pIter->viewId];
     5332                        RT_ZERO(*pEntry);
     5333                        break;
     5334                    }
     5335                    case VMSVGA3D_VIEWTYPE_VIDEOPROCESSORINPUT:
     5336                    {
     5337                        VBSVGACOTableDXVideoProcessorInputViewEntry *pEntry = &pDXContext->cot.paVideoProcessorInputView[pIter->viewId];
     5338                        RT_ZERO(*pEntry);
     5339                        break;
     5340                    }
     5341                    case VMSVGA3D_VIEWTYPE_VIDEOPROCESSOROUTPUT:
     5342                    {
     5343                        VBSVGACOTableDXVideoProcessorOutputViewEntry *pEntry = &pDXContext->cot.paVideoProcessorOutputView[pIter->viewId];
     5344                        RT_ZERO(*pEntry);
     5345                        break;
     5346                    }
     5347                    case VMSVGA3D_VIEWTYPE_NONE:
    49565348                        AssertFailed();
     5349                        break;
    49575350                }
    49585351            }
     
    50905483    {
    50915484        /** @todo This is generic code and should be in DevVGA-SVGA3d.cpp for backends which support Map/Unmap. */
     5485        /** @todo Use vmsvga3dGetBoxDimensions because it does clipping and calculations. */
    50925486        uint32_t const u32GuestBlockX = pBox->srcx / pSurface->cxBlock;
    50935487        uint32_t const u32GuestBlockY = pBox->srcy / pSurface->cyBlock;
     
    53065700                D3D_RELEASE(pBackendDXContext->paUnorderedAccessView[i].u.pUnorderedAccessView);
    53075701        }
     5702        if (pBackendDXContext->paVideoProcessor)
     5703        {
     5704            for (uint32_t i = 0; i < pBackendDXContext->cVideoProcessor; ++i)
     5705                dxDestroyVideoProcessor(&pBackendDXContext->paVideoProcessor[i]);
     5706        }
     5707        if (pBackendDXContext->paVideoDecoderOutputView)
     5708        {
     5709            /** @todo dxViewDestroy? */
     5710            for (uint32_t i = 0; i < pBackendDXContext->cVideoDecoderOutputView; ++i)
     5711                D3D_RELEASE(pBackendDXContext->paVideoDecoderOutputView[i].u.pVideoDecoderOutputView);
     5712        }
     5713        if (pBackendDXContext->paVideoDecoder)
     5714        {
     5715            for (uint32_t i = 0; i < pBackendDXContext->cVideoDecoder; ++i)
     5716                dxDestroyVideoDecoder(&pBackendDXContext->paVideoDecoder[i]);
     5717        }
     5718        if (pBackendDXContext->paVideoProcessorInputView)
     5719        {
     5720            for (uint32_t i = 0; i < pBackendDXContext->cVideoProcessorInputView; ++i)
     5721                D3D_RELEASE(pBackendDXContext->paVideoProcessorInputView[i].u.pVideoProcessorInputView);
     5722        }
     5723        if (pBackendDXContext->paVideoProcessorOutputView)
     5724        {
     5725            for (uint32_t i = 0; i < pBackendDXContext->cVideoProcessorOutputView; ++i)
     5726                D3D_RELEASE(pBackendDXContext->paVideoProcessorOutputView[i].u.pVideoProcessorOutputView);
     5727        }
    53085728
    53095729        RTMemFreeZ(pBackendDXContext->papBlendState, sizeof(pBackendDXContext->papBlendState[0]) * pBackendDXContext->cBlendState);
     
    53195739        RTMemFreeZ(pBackendDXContext->paStreamOutput, sizeof(pBackendDXContext->paStreamOutput[0]) * pBackendDXContext->cStreamOutput);
    53205740        RTMemFreeZ(pBackendDXContext->paUnorderedAccessView, sizeof(pBackendDXContext->paUnorderedAccessView[0]) * pBackendDXContext->cUnorderedAccessView);
     5741        RTMemFreeZ(pBackendDXContext->paVideoProcessor, sizeof(pBackendDXContext->paVideoProcessor[0]) * pBackendDXContext->cVideoProcessor);
     5742        RTMemFreeZ(pBackendDXContext->paVideoDecoderOutputView, sizeof(pBackendDXContext->paVideoDecoderOutputView[0]) * pBackendDXContext->cVideoDecoderOutputView);
     5743        RTMemFreeZ(pBackendDXContext->paVideoDecoder, sizeof(pBackendDXContext->paVideoDecoder[0]) * pBackendDXContext->cVideoDecoder);
     5744        RTMemFreeZ(pBackendDXContext->paVideoProcessorInputView, sizeof(pBackendDXContext->paVideoProcessorInputView[0]) * pBackendDXContext->cVideoProcessorInputView);
     5745        RTMemFreeZ(pBackendDXContext->paVideoProcessorOutputView, sizeof(pBackendDXContext->paVideoProcessorOutputView[0]) * pBackendDXContext->cVideoProcessorOutputView);
    53215746
    53225747        /* Destroy backend surfaces which belong to this context. */
     
    54465871            for (unsigned i = 0; i < sizeInBytes / sizeof(float) / 4; ++i)
    54475872            {
    5448                 Log(("ConstantF[%d]: " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR "\n",
     5873                Log(("ConstantF[%d]: " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ", " FLOAT_FMT_STR ",\n",
    54495874                     i, FLOAT_FMT_ARGS(pValuesF[i*4 + 0]), FLOAT_FMT_ARGS(pValuesF[i*4 + 1]), FLOAT_FMT_ARGS(pValuesF[i*4 + 2]), FLOAT_FMT_ARGS(pValuesF[i*4 + 3])));
    54505875            }
     
    60966521                }
    60976522
    6098                 Log8((" }\n"));
     6523                Log8((" },\n"));
    60996524
    61006525                if (pBufferPipeline->stride == 0)
     
    61906615                    }
    61916616
    6192                     Log8((" }\n"));
     6617                    Log8((" },\n"));
    61936618
    61946619                    if (pVB->stride == 0)
     
    62606685                    }
    62616686                }
    6262                 Log8((" }\n"));
     6687                Log8((" },\n"));
    62636688
    62646689                vmsvga3dBackSurfaceUnmap(pThisCC, &image, &mapVB, /* fWritten =  */ false);
     
    92279652            break;
    92289653        case SVGA_COTABLE_MAX: break; /* Compiler warning */
     9654        case VBSVGA_COTABLE_VIDEOPROCESSOR:
     9655            if (pBackendDXContext->paVideoProcessor)
     9656            {
     9657                /* Destroy the no longer used entries. */
     9658                for (uint32_t i = cValidEntries; i < pBackendDXContext->cVideoProcessor; ++i)
     9659                    dxDestroyVideoProcessor(&pBackendDXContext->paVideoProcessor[i]);
     9660            }
     9661
     9662            rc = dxCOTableRealloc((void **)&pBackendDXContext->paVideoProcessor, &pBackendDXContext->cVideoProcessor,
     9663                                  sizeof(pBackendDXContext->paVideoProcessor[0]), pDXContext->cot.cVideoProcessor, cValidEntries);
     9664            AssertRCBreak(rc);
     9665
     9666            for (uint32_t i = 0; i < cValidEntries; ++i)
     9667            {
     9668                VBSVGACOTableDXVideoProcessorEntry const *pEntry = &pDXContext->cot.paVideoProcessor[i];
     9669                if (ASMMemFirstNonZero(pEntry, sizeof(*pEntry)) == NULL)
     9670                    continue; /* Skip uninitialized entry. */
     9671
     9672                DXVIDEOPROCESSOR *pDXVideoProcessor = &pBackendDXContext->paVideoProcessor[i];
     9673                if (pDXVideoProcessor->pVideoProcessor == NULL)
     9674                    dxCreateVideoProcessor(pThisCC, pDXContext, i, pEntry);
     9675            }
     9676            break;
     9677        case VBSVGA_COTABLE_VDOV:
     9678            if (pBackendDXContext->paVideoDecoderOutputView)
     9679            {
     9680                /* Destroy the no longer used entries. */
     9681                for (uint32_t i = 0; i < pBackendDXContext->cVideoDecoderOutputView; ++i)
     9682                {
     9683                    DXVIEW *pDXView = &pBackendDXContext->paVideoDecoderOutputView[i];
     9684                    if (i < cValidEntries)
     9685                        dxViewRemoveFromList(pDXView); /* Remove from list because DXVIEW array will be reallocated. */
     9686                    else
     9687                        dxViewDestroy(pDXView);
     9688                }
     9689            }
     9690
     9691            rc = dxCOTableRealloc((void **)&pBackendDXContext->paVideoDecoderOutputView, &pBackendDXContext->cVideoDecoderOutputView,
     9692                                  sizeof(pBackendDXContext->paVideoDecoderOutputView[0]), pDXContext->cot.cVideoDecoderOutputView, cValidEntries);
     9693            AssertRCBreak(rc);
     9694
     9695            for (uint32_t i = 0; i < cValidEntries; ++i)
     9696            {
     9697                VBSVGACOTableDXVideoDecoderOutputViewEntry const *pEntry = &pDXContext->cot.paVideoDecoderOutputView[i];
     9698                if (ASMMemFirstNonZero(pEntry, sizeof(*pEntry)) == NULL)
     9699                    continue; /* Skip uninitialized entry. */
     9700
     9701                DXVIEW *pDXView = &pBackendDXContext->paVideoDecoderOutputView[i];
     9702                if (pDXView->u.pView)
     9703                    dxViewAddToList(pThisCC, pDXView);
     9704            }
     9705            break;
     9706        case VBSVGA_COTABLE_VIDEODECODER:
     9707            if (pBackendDXContext->paVideoDecoder)
     9708            {
     9709                /* Destroy the no longer used entries. */
     9710                for (uint32_t i = cValidEntries; i < pBackendDXContext->cVideoDecoder; ++i)
     9711                    dxDestroyVideoDecoder(&pBackendDXContext->paVideoDecoder[i]);
     9712            }
     9713
     9714            rc = dxCOTableRealloc((void **)&pBackendDXContext->paVideoDecoder, &pBackendDXContext->cVideoDecoder,
     9715                                  sizeof(pBackendDXContext->paVideoDecoder[0]), pDXContext->cot.cVideoDecoder, cValidEntries);
     9716            AssertRCBreak(rc);
     9717
     9718            for (uint32_t i = 0; i < cValidEntries; ++i)
     9719            {
     9720                VBSVGACOTableDXVideoDecoderEntry const *pEntry = &pDXContext->cot.paVideoDecoder[i];
     9721                if (ASMMemFirstNonZero(pEntry, sizeof(*pEntry)) == NULL)
     9722                    continue; /* Skip uninitialized entry. */
     9723
     9724                DXVIDEODECODER *pDXVideoDecoder = &pBackendDXContext->paVideoDecoder[i];
     9725                if (pDXVideoDecoder->pVideoDecoder == NULL)
     9726                    dxCreateVideoDecoder(pThisCC, pDXContext, i, pEntry);
     9727            }
     9728            break;
     9729        case VBSVGA_COTABLE_VPIV:
     9730            if (pBackendDXContext->paVideoProcessorInputView)
     9731            {
     9732                /* Destroy the no longer used entries. */
     9733                for (uint32_t i = 0; i < pBackendDXContext->cVideoProcessorInputView; ++i)
     9734                {
     9735                    DXVIEW *pDXView = &pBackendDXContext->paVideoProcessorInputView[i];
     9736                    if (i < cValidEntries)
     9737                        dxViewRemoveFromList(pDXView); /* Remove from list because DXVIEW array will be reallocated. */
     9738                    else
     9739                        dxViewDestroy(pDXView);
     9740                }
     9741            }
     9742
     9743            rc = dxCOTableRealloc((void **)&pBackendDXContext->paVideoProcessorInputView, &pBackendDXContext->cVideoProcessorInputView,
     9744                                  sizeof(pBackendDXContext->paVideoProcessorInputView[0]), pDXContext->cot.cVideoProcessorInputView, cValidEntries);
     9745            AssertRCBreak(rc);
     9746
     9747            for (uint32_t i = 0; i < cValidEntries; ++i)
     9748            {
     9749                VBSVGACOTableDXVideoProcessorInputViewEntry const *pEntry = &pDXContext->cot.paVideoProcessorInputView[i];
     9750                if (ASMMemFirstNonZero(pEntry, sizeof(*pEntry)) == NULL)
     9751                    continue; /* Skip uninitialized entry. */
     9752
     9753                DXVIEW *pDXView = &pBackendDXContext->paVideoProcessorInputView[i];
     9754                if (pDXView->u.pView)
     9755                    dxViewAddToList(pThisCC, pDXView);
     9756            }
     9757            break;
     9758        case VBSVGA_COTABLE_VPOV:
     9759            if (pBackendDXContext->paVideoProcessorOutputView)
     9760            {
     9761                /* Destroy the no longer used entries. */
     9762                for (uint32_t i = 0; i < pBackendDXContext->cVideoProcessorOutputView; ++i)
     9763                {
     9764                    DXVIEW *pDXView = &pBackendDXContext->paVideoProcessorOutputView[i];
     9765                    if (i < cValidEntries)
     9766                        dxViewRemoveFromList(pDXView); /* Remove from list because DXVIEW array will be reallocated. */
     9767                    else
     9768                        dxViewDestroy(pDXView);
     9769                }
     9770            }
     9771
     9772            rc = dxCOTableRealloc((void **)&pBackendDXContext->paVideoProcessorOutputView, &pBackendDXContext->cVideoProcessorOutputView,
     9773                                  sizeof(pBackendDXContext->paVideoProcessorOutputView[0]), pDXContext->cot.cVideoProcessorOutputView, cValidEntries);
     9774            AssertRCBreak(rc);
     9775
     9776            for (uint32_t i = 0; i < cValidEntries; ++i)
     9777            {
     9778                VBSVGACOTableDXVideoProcessorOutputViewEntry const *pEntry = &pDXContext->cot.paVideoProcessorOutputView[i];
     9779                if (ASMMemFirstNonZero(pEntry, sizeof(*pEntry)) == NULL)
     9780                    continue; /* Skip uninitialized entry. */
     9781
     9782                DXVIEW *pDXView = &pBackendDXContext->paVideoProcessorOutputView[i];
     9783                if (pDXView->u.pView)
     9784                    dxViewAddToList(pThisCC, pDXView);
     9785            }
     9786            break;
     9787        case VBSVGA_COTABLE_MAX: break; /* Compiler warning */
    92299788#ifndef DEBUG_sunlover
    92309789        default: break; /* Compiler warning. */
     
    990510464    AssertFailed(); /** @todo Implement */
    990610465    return VERR_NOT_IMPLEMENTED;
     10466}
     10467
     10468
     10469/*
     10470 *
     10471 * Video decoding and processing callbacks.
     10472 *
     10473 */
     10474
     10475/*
     10476 * Conversion between the device and D3D11 constants.
     10477 */
     10478
     10479static D3D11_VIDEO_FRAME_FORMAT dxVideoFrameFormat(VBSVGA3dVideoFrameFormat FrameFormat)
     10480{
     10481    switch (FrameFormat)
     10482    {
     10483        case VBSVGA3D_VIDEO_FRAME_FORMAT_PROGRESSIVE:                   return D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE;
     10484        case VBSVGA3D_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST:    return D3D11_VIDEO_FRAME_FORMAT_INTERLACED_TOP_FIELD_FIRST;
     10485        case VBSVGA3D_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST: return D3D11_VIDEO_FRAME_FORMAT_INTERLACED_BOTTOM_FIELD_FIRST;
     10486        default:
     10487            ASSERT_GUEST_FAILED();
     10488            break;
     10489    }
     10490    return D3D11_VIDEO_FRAME_FORMAT_PROGRESSIVE;
     10491}
     10492
     10493
     10494static D3D11_VIDEO_USAGE dxVideoUsage(VBSVGA3dVideoUsage Usage)
     10495{
     10496    switch (Usage)
     10497    {
     10498        case VBSVGA3D_VIDEO_USAGE_PLAYBACK_NORMAL: return D3D11_VIDEO_USAGE_PLAYBACK_NORMAL;
     10499        case VBSVGA3D_VIDEO_USAGE_OPTIMAL_SPEED:   return D3D11_VIDEO_USAGE_OPTIMAL_SPEED;
     10500        case VBSVGA3D_VIDEO_USAGE_OPTIMAL_QUALITY: return D3D11_VIDEO_USAGE_OPTIMAL_QUALITY;
     10501        default:
     10502            ASSERT_GUEST_FAILED();
     10503            break;
     10504    }
     10505    return D3D11_VIDEO_USAGE_PLAYBACK_NORMAL;
     10506}
     10507
     10508
     10509static D3D11_VDOV_DIMENSION dxVDOVDimension(VBSVGA3dVDOVDimension ViewDimension)
     10510{
     10511    switch (ViewDimension)
     10512    {
     10513        case VBSVGA3D_VDOV_DIMENSION_UNKNOWN:   return D3D11_VDOV_DIMENSION_UNKNOWN;
     10514        case VBSVGA3D_VDOV_DIMENSION_TEXTURE2D: return D3D11_VDOV_DIMENSION_TEXTURE2D;
     10515        default:
     10516            ASSERT_GUEST_FAILED();
     10517            break;
     10518    }
     10519    return D3D11_VDOV_DIMENSION_UNKNOWN;
     10520}
     10521
     10522
     10523static D3D11_VPIV_DIMENSION dxVPIVDimension(VBSVGA3dVPIVDimension ViewDimension)
     10524{
     10525    switch (ViewDimension)
     10526    {
     10527        case VBSVGA3D_VPIV_DIMENSION_UNKNOWN:   return D3D11_VPIV_DIMENSION_UNKNOWN;
     10528        case VBSVGA3D_VPIV_DIMENSION_TEXTURE2D: return D3D11_VPIV_DIMENSION_TEXTURE2D;
     10529        default:
     10530            ASSERT_GUEST_FAILED();
     10531            break;
     10532    }
     10533    return D3D11_VPIV_DIMENSION_UNKNOWN;
     10534}
     10535
     10536
     10537static D3D11_VPOV_DIMENSION dxVPOVDimension(VBSVGA3dVPOVDimension ViewDimension)
     10538{
     10539    switch (ViewDimension)
     10540    {
     10541        case VBSVGA3D_VPOV_DIMENSION_UNKNOWN:        return D3D11_VPOV_DIMENSION_UNKNOWN;
     10542        case VBSVGA3D_VPOV_DIMENSION_TEXTURE2D:      return D3D11_VPOV_DIMENSION_TEXTURE2D;
     10543        case VBSVGA3D_VPOV_DIMENSION_TEXTURE2DARRAY: return D3D11_VPOV_DIMENSION_TEXTURE2DARRAY;
     10544        default:
     10545            ASSERT_GUEST_FAILED();
     10546            break;
     10547    }
     10548    return D3D11_VPOV_DIMENSION_UNKNOWN;
     10549}
     10550
     10551
     10552static D3D11_VIDEO_DECODER_BUFFER_TYPE dxVideoDecoderBufferType(VBSVGA3dVideoDecoderBufferType BufferType)
     10553{
     10554    switch (BufferType)
     10555    {
     10556        case VBSVGA3D_VD_BUFFER_PICTURE_PARAMETERS:          return D3D11_VIDEO_DECODER_BUFFER_PICTURE_PARAMETERS;
     10557        case VBSVGA3D_VD_BUFFER_MACROBLOCK_CONTROL:          return D3D11_VIDEO_DECODER_BUFFER_MACROBLOCK_CONTROL;
     10558        case VBSVGA3D_VD_BUFFER_RESIDUAL_DIFFERENCE:         return D3D11_VIDEO_DECODER_BUFFER_RESIDUAL_DIFFERENCE;
     10559        case VBSVGA3D_VD_BUFFER_DEBLOCKING_CONTROL:          return D3D11_VIDEO_DECODER_BUFFER_DEBLOCKING_CONTROL;
     10560        case VBSVGA3D_VD_BUFFER_INVERSE_QUANTIZATION_MATRIX: return D3D11_VIDEO_DECODER_BUFFER_INVERSE_QUANTIZATION_MATRIX;
     10561        case VBSVGA3D_VD_BUFFER_SLICE_CONTROL:               return D3D11_VIDEO_DECODER_BUFFER_SLICE_CONTROL;
     10562        case VBSVGA3D_VD_BUFFER_BITSTREAM:                   return D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
     10563        case VBSVGA3D_VD_BUFFER_MOTION_VECTOR:               return D3D11_VIDEO_DECODER_BUFFER_MOTION_VECTOR;
     10564        case VBSVGA3D_VD_BUFFER_FILM_GRAIN:                  return D3D11_VIDEO_DECODER_BUFFER_FILM_GRAIN;
     10565        default:
     10566            ASSERT_GUEST_FAILED();
     10567            break;
     10568    }
     10569    return D3D11_VIDEO_DECODER_BUFFER_BITSTREAM;
     10570}
     10571
     10572
     10573/*
     10574 * D3D11 wrappers.
     10575 */
     10576
     10577static void dxVideoProcessorSetOutputTargetRect(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor, uint8 enable, SVGASignedRect const &outputRect)
     10578{
     10579    RECT OutputRect;
     10580    OutputRect.left   = outputRect.left;
     10581    OutputRect.top    = outputRect.top;
     10582    OutputRect.right  = outputRect.right;
     10583    OutputRect.bottom = outputRect.bottom;
     10584
     10585    pDXDevice->pVideoContext->VideoProcessorSetOutputTargetRect(pDXVideoProcessor->pVideoProcessor, RT_BOOL(enable), &OutputRect);
     10586}
     10587
     10588
     10589static void dxVideoProcessorSetOutputBackgroundColor(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor, uint32 YCbCr, VBSVGA3dVideoColor const &color)
     10590{
     10591    D3D11_VIDEO_COLOR Color;
     10592    Color.RGBA.R = color.r;
     10593    Color.RGBA.G = color.g;
     10594    Color.RGBA.B = color.b;
     10595    Color.RGBA.A = color.a;
     10596
     10597    pDXDevice->pVideoContext->VideoProcessorSetOutputBackgroundColor(pDXVideoProcessor->pVideoProcessor, RT_BOOL(YCbCr), &Color);
     10598}
     10599
     10600
     10601static void dxVideoProcessorSetOutputColorSpace(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor, VBSVGA3dVideoProcessorColorSpace const &colorSpace)
     10602{
     10603    D3D11_VIDEO_PROCESSOR_COLOR_SPACE ColorSpace;
     10604    ColorSpace.Usage         = colorSpace.Usage;
     10605    ColorSpace.RGB_Range     = colorSpace.RGB_Range;
     10606    ColorSpace.YCbCr_Matrix  = colorSpace.YCbCr_Matrix;
     10607    ColorSpace.YCbCr_xvYCC   = colorSpace.YCbCr_xvYCC;
     10608    ColorSpace.Nominal_Range = colorSpace.Nominal_Range;
     10609    ColorSpace.Reserved      = colorSpace.Reserved;
     10610
     10611    pDXDevice->pVideoContext->VideoProcessorSetOutputColorSpace(pDXVideoProcessor->pVideoProcessor, &ColorSpace);
     10612}
     10613
     10614
     10615static void dxVideoProcessorSetOutputAlphaFillMode(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor, VBSVGA3dVideoProcessorAlphaFillMode fillMode, uint32 streamIndex)
     10616{
     10617    D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE AlphaFillMode = (D3D11_VIDEO_PROCESSOR_ALPHA_FILL_MODE)fillMode;
     10618
     10619    pDXDevice->pVideoContext->VideoProcessorSetOutputAlphaFillMode(pDXVideoProcessor->pVideoProcessor, AlphaFillMode, streamIndex);
     10620}
     10621
     10622
     10623static void dxVideoProcessorSetOutputConstriction(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor, uint32 enable, uint32 width, uint32 height)
     10624{
     10625    SIZE Size;
     10626    Size.cx = width;
     10627    Size.cy = height;
     10628
     10629    pDXDevice->pVideoContext->VideoProcessorSetOutputConstriction(pDXVideoProcessor->pVideoProcessor, RT_BOOL(enable), Size);
     10630}
     10631
     10632
     10633static void dxVideoProcessorSetOutputStereoMode(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor, uint32 enable)
     10634{
     10635    pDXDevice->pVideoContext->VideoProcessorSetOutputStereoMode(pDXVideoProcessor->pVideoProcessor, RT_BOOL(enable));
     10636}
     10637
     10638
     10639static void dxVideoProcessorSetStreamFrameFormat(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor, uint32 streamIndex, VBSVGA3dVideoFrameFormat format)
     10640{
     10641    D3D11_VIDEO_FRAME_FORMAT FrameFormat = (D3D11_VIDEO_FRAME_FORMAT)format;
     10642
     10643    pDXDevice->pVideoContext->VideoProcessorSetStreamFrameFormat(pDXVideoProcessor->pVideoProcessor, streamIndex, FrameFormat);
     10644}
     10645
     10646
     10647static void dxVideoProcessorSetStreamColorSpace(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor, uint32 streamIndex, VBSVGA3dVideoProcessorColorSpace colorSpace)
     10648{
     10649    D3D11_VIDEO_PROCESSOR_COLOR_SPACE ColorSpace;
     10650    ColorSpace.Usage         = colorSpace.Usage;
     10651    ColorSpace.RGB_Range     = colorSpace.RGB_Range;
     10652    ColorSpace.YCbCr_Matrix  = colorSpace.YCbCr_Matrix;
     10653    ColorSpace.YCbCr_xvYCC   = colorSpace.YCbCr_xvYCC;
     10654    ColorSpace.Nominal_Range = colorSpace.Nominal_Range;
     10655    ColorSpace.Reserved      = colorSpace.Reserved;
     10656
     10657    pDXDevice->pVideoContext->VideoProcessorSetStreamColorSpace(pDXVideoProcessor->pVideoProcessor, streamIndex, &ColorSpace);
     10658}
     10659
     10660
     10661static void dxVideoProcessorSetStreamOutputRate(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor,
     10662                                                uint32 streamIndex, VBSVGA3dVideoProcessorOutputRate outputRate, uint32 repeatFrame, SVGA3dFraction64 const &customRate)
     10663{
     10664    D3D11_VIDEO_PROCESSOR_OUTPUT_RATE OutputRate = (D3D11_VIDEO_PROCESSOR_OUTPUT_RATE)outputRate;
     10665    DXGI_RATIONAL CustomRate;
     10666    CustomRate.Numerator   = customRate.numerator;
     10667    CustomRate.Denominator = customRate.denominator;
     10668
     10669    pDXDevice->pVideoContext->VideoProcessorSetStreamOutputRate(pDXVideoProcessor->pVideoProcessor, streamIndex, OutputRate, RT_BOOL(repeatFrame), &CustomRate);
     10670}
     10671
     10672
     10673static void dxVideoProcessorSetStreamSourceRect(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor,
     10674                                                uint32 streamIndex, uint32 enable, SVGASignedRect const &sourceRect)
     10675{
     10676    RECT Rect;
     10677    Rect.left   = sourceRect.left;
     10678    Rect.top    = sourceRect.top;
     10679    Rect.right  = sourceRect.right;
     10680    Rect.bottom = sourceRect.bottom;
     10681
     10682    pDXDevice->pVideoContext->VideoProcessorSetStreamSourceRect(pDXVideoProcessor->pVideoProcessor, streamIndex, RT_BOOL(enable), &Rect);
     10683}
     10684
     10685
     10686static void dxVideoProcessorSetStreamDestRect(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor,
     10687                                              uint32 streamIndex, uint32 enable, SVGASignedRect const &destRect)
     10688{
     10689    RECT Rect;
     10690    Rect.left   = destRect.left;
     10691    Rect.top    = destRect.top;
     10692    Rect.right  = destRect.right;
     10693    Rect.bottom = destRect.bottom;
     10694
     10695    pDXDevice->pVideoContext->VideoProcessorSetStreamDestRect(pDXVideoProcessor->pVideoProcessor, streamIndex, RT_BOOL(enable), &Rect);
     10696}
     10697
     10698
     10699static void dxVideoProcessorSetStreamAlpha(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor,
     10700                                           uint32 streamIndex, uint32 enable, float alpha)
     10701{
     10702    pDXDevice->pVideoContext->VideoProcessorSetStreamAlpha(pDXVideoProcessor->pVideoProcessor, streamIndex, RT_BOOL(enable), alpha);
     10703}
     10704
     10705
     10706static void dxVideoProcessorSetStreamPalette(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor,
     10707                                             uint32 streamIndex, uint32_t cEntries, uint32_t const *paEntries)
     10708{
     10709    pDXDevice->pVideoContext->VideoProcessorSetStreamPalette(pDXVideoProcessor->pVideoProcessor, streamIndex, cEntries, paEntries);
     10710}
     10711
     10712
     10713static void dxVideoProcessorSetStreamPixelAspectRatio(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor,
     10714                                                      uint32 streamIndex, uint32 enable, SVGA3dFraction64 const &sourceRatio, SVGA3dFraction64 const &destRatio)
     10715{
     10716    DXGI_RATIONAL SourceAspectRatio;
     10717    SourceAspectRatio.Numerator   = sourceRatio.numerator;
     10718    SourceAspectRatio.Denominator = sourceRatio.denominator;
     10719
     10720    DXGI_RATIONAL DestinationAspectRatio;
     10721    DestinationAspectRatio.Numerator   = destRatio.numerator;
     10722    DestinationAspectRatio.Denominator = destRatio.denominator;
     10723
     10724    pDXDevice->pVideoContext->VideoProcessorSetStreamPixelAspectRatio(pDXVideoProcessor->pVideoProcessor, streamIndex, RT_BOOL(enable), &SourceAspectRatio, &DestinationAspectRatio);
     10725}
     10726
     10727
     10728static void dxVideoProcessorSetStreamLumaKey(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor,
     10729                                             uint32 streamIndex, uint32 enable, float lower, float upper)
     10730{
     10731    pDXDevice->pVideoContext->VideoProcessorSetStreamLumaKey(pDXVideoProcessor->pVideoProcessor, streamIndex, RT_BOOL(enable), lower, upper);
     10732}
     10733
     10734
     10735static void dxVideoProcessorSetStreamStereoFormat(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor,
     10736                                                  uint32 streamIndex, uint32 enable, VBSVGA3dVideoProcessorStereoFormat stereoFormat,
     10737                                                  uint8 leftViewFrame0, uint8 baseViewFrame0, VBSVGA3dVideoProcessorStereoFlipMode flipMode, int32 monoOffset)
     10738{
     10739    D3D11_VIDEO_PROCESSOR_STEREO_FORMAT Format = (D3D11_VIDEO_PROCESSOR_STEREO_FORMAT)stereoFormat;
     10740    D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE FlipMode = (D3D11_VIDEO_PROCESSOR_STEREO_FLIP_MODE)flipMode;
     10741
     10742    pDXDevice->pVideoContext->VideoProcessorSetStreamStereoFormat(pDXVideoProcessor->pVideoProcessor, streamIndex, RT_BOOL(enable), Format, RT_BOOL(leftViewFrame0), RT_BOOL(baseViewFrame0), FlipMode, monoOffset);
     10743}
     10744
     10745
     10746static void dxVideoProcessorSetStreamAutoProcessingMode(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor,
     10747                                                        uint32 streamIndex, uint32 enable)
     10748{
     10749    pDXDevice->pVideoContext->VideoProcessorSetStreamAutoProcessingMode(pDXVideoProcessor->pVideoProcessor, streamIndex, RT_BOOL(enable));
     10750}
     10751
     10752
     10753static void dxVideoProcessorSetStreamFilter(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor,
     10754                                            uint32 streamIndex, uint32 enable, VBSVGA3dVideoProcessorFilter filter, int32 level)
     10755{
     10756    D3D11_VIDEO_PROCESSOR_FILTER Filter = (D3D11_VIDEO_PROCESSOR_FILTER)filter;
     10757
     10758    pDXDevice->pVideoContext->VideoProcessorSetStreamFilter(pDXVideoProcessor->pVideoProcessor, streamIndex, Filter, RT_BOOL(enable), level);
     10759}
     10760
     10761
     10762static void dxVideoProcessorSetStreamRotation(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor,
     10763                                              uint32 streamIndex, uint32 enable, VBSVGA3dVideoProcessorRotation rotation)
     10764{
     10765    D3D11_VIDEO_PROCESSOR_ROTATION Rotation = (D3D11_VIDEO_PROCESSOR_ROTATION)rotation;
     10766
     10767    pDXDevice->pVideoContext->VideoProcessorSetStreamRotation(pDXVideoProcessor->pVideoProcessor, streamIndex, RT_BOOL(enable), Rotation);
     10768}
     10769
     10770
     10771static int dxCreateVideoDecoderOutputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderOutputViewId videoDecoderOutputViewId, VBSVGACOTableDXVideoDecoderOutputViewEntry const *pEntry)
     10772{
     10773    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     10774    AssertReturn(pDXDevice->pVideoDevice, VERR_INVALID_STATE);
     10775
     10776    PVMSVGA3DSURFACE pSurface;
     10777    ID3D11Resource *pResource;
     10778    int rc = dxEnsureResource(pThisCC, pDXContext, pEntry->sid, &pSurface, &pResource);
     10779    AssertRCReturn(rc, rc);
     10780
     10781    DXVIEW *pView = &pDXContext->pBackendDXContext->paVideoDecoderOutputView[videoDecoderOutputViewId];
     10782    Assert(pView->u.pView == NULL);
     10783
     10784    D3D11_VIDEO_DECODER_OUTPUT_VIEW_DESC Desc;
     10785    RT_ZERO(Desc);
     10786    memcpy(&Desc.DecodeProfile, &pEntry->desc.DecodeProfile, sizeof(GUID));
     10787    Desc.ViewDimension        = dxVDOVDimension(pEntry->desc.ViewDimension);
     10788    Desc.Texture2D.ArraySlice = pEntry->desc.Texture2D.ArraySlice;
     10789
     10790    ID3D11VideoDecoderOutputView *pVDOView;
     10791    HRESULT hr = pDXDevice->pVideoDevice->CreateVideoDecoderOutputView(pResource, &Desc, &pVDOView);
     10792    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     10793
     10794    return dxViewInit(pView, pSurface, pDXContext, videoDecoderOutputViewId, VMSVGA3D_VIEWTYPE_VIDEODECODEROUTPUT, pVDOView);
     10795}
     10796
     10797
     10798static int dxCreateVideoProcessorInputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorInputViewId videoProcessorInputViewId, VBSVGACOTableDXVideoProcessorInputViewEntry const *pEntry)
     10799{
     10800    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     10801    AssertReturn(pDXDevice->pVideoDevice, VERR_INVALID_STATE);
     10802
     10803    PVMSVGA3DSURFACE pSurface;
     10804    ID3D11Resource *pResource;
     10805    int rc = dxEnsureResource(pThisCC, pDXContext, pEntry->sid, &pSurface, &pResource);
     10806    AssertRCReturn(rc, rc);
     10807
     10808    DXVIEW *pView = &pDXContext->pBackendDXContext->paVideoProcessorInputView[videoProcessorInputViewId];
     10809    Assert(pView->u.pView == NULL);
     10810
     10811    D3D11_VIDEO_PROCESSOR_CONTENT_DESC ContentDesc;
     10812    RT_ZERO(ContentDesc);
     10813    ContentDesc.InputFrameFormat            = dxVideoFrameFormat(pEntry->contentDesc.InputFrameFormat);
     10814    ContentDesc.InputFrameRate.Numerator    = pEntry->contentDesc.InputFrameRate.numerator;
     10815    ContentDesc.InputFrameRate.Denominator  = pEntry->contentDesc.InputFrameRate.denominator;
     10816    ContentDesc.InputWidth                  = pEntry->contentDesc.InputWidth;
     10817    ContentDesc.InputHeight                 = pEntry->contentDesc.InputHeight;
     10818    ContentDesc.OutputFrameRate.Numerator   = pEntry->contentDesc.OutputFrameRate.numerator;
     10819    ContentDesc.OutputFrameRate.Denominator = pEntry->contentDesc.OutputFrameRate.denominator;
     10820    ContentDesc.OutputWidth                 = pEntry->contentDesc.OutputWidth;
     10821    ContentDesc.OutputHeight                = pEntry->contentDesc.OutputHeight;
     10822    ContentDesc.Usage                       = dxVideoUsage(pEntry->contentDesc.Usage);
     10823
     10824    ID3D11VideoProcessorEnumerator *pEnum;
     10825    HRESULT hr = pDXDevice->pVideoDevice->CreateVideoProcessorEnumerator(&ContentDesc, &pEnum);
     10826    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     10827
     10828    D3D11_VIDEO_PROCESSOR_INPUT_VIEW_DESC Desc;
     10829    RT_ZERO(Desc);
     10830    Desc.FourCC               = pEntry->desc.FourCC;
     10831    Desc.ViewDimension        = dxVPIVDimension(pEntry->desc.ViewDimension);
     10832    Desc.Texture2D.MipSlice   = pEntry->desc.Texture2D.MipSlice;
     10833    Desc.Texture2D.ArraySlice = pEntry->desc.Texture2D.ArraySlice;
     10834
     10835    ID3D11VideoProcessorInputView *pVPIView;
     10836    hr = pDXDevice->pVideoDevice->CreateVideoProcessorInputView(pResource, pEnum, &Desc, &pVPIView);
     10837    D3D_RELEASE(pEnum);
     10838    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     10839
     10840    return dxViewInit(pView, pSurface, pDXContext, videoProcessorInputViewId, VMSVGA3D_VIEWTYPE_VIDEOPROCESSORINPUT, pVPIView);
     10841}
     10842
     10843
     10844static int dxCreateVideoProcessorOutputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorOutputViewId videoProcessorOutputViewId, VBSVGACOTableDXVideoProcessorOutputViewEntry const *pEntry)
     10845{
     10846    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     10847    AssertReturn(pDXDevice->pVideoDevice, VERR_INVALID_STATE);
     10848
     10849    PVMSVGA3DSURFACE pSurface;
     10850    ID3D11Resource *pResource;
     10851    int rc = dxEnsureResource(pThisCC, pDXContext, pEntry->sid, &pSurface, &pResource);
     10852    AssertRCReturn(rc, rc);
     10853
     10854    DXVIEW *pView = &pDXContext->pBackendDXContext->paVideoProcessorOutputView[videoProcessorOutputViewId];
     10855    Assert(pView->u.pView == NULL);
     10856
     10857    D3D11_VIDEO_PROCESSOR_CONTENT_DESC ContentDesc;
     10858    RT_ZERO(ContentDesc);
     10859    ContentDesc.InputFrameFormat            = dxVideoFrameFormat(pEntry->contentDesc.InputFrameFormat);
     10860    ContentDesc.InputFrameRate.Numerator    = pEntry->contentDesc.InputFrameRate.numerator;
     10861    ContentDesc.InputFrameRate.Denominator  = pEntry->contentDesc.InputFrameRate.denominator;
     10862    ContentDesc.InputWidth                  = pEntry->contentDesc.InputWidth;
     10863    ContentDesc.InputHeight                 = pEntry->contentDesc.InputHeight;
     10864    ContentDesc.OutputFrameRate.Numerator   = pEntry->contentDesc.OutputFrameRate.numerator;
     10865    ContentDesc.OutputFrameRate.Denominator = pEntry->contentDesc.OutputFrameRate.denominator;
     10866    ContentDesc.OutputWidth                 = pEntry->contentDesc.OutputWidth;
     10867    ContentDesc.OutputHeight                = pEntry->contentDesc.OutputHeight;
     10868    ContentDesc.Usage                       = dxVideoUsage(pEntry->contentDesc.Usage);
     10869
     10870    ID3D11VideoProcessorEnumerator *pEnum;
     10871    HRESULT hr = pDXDevice->pVideoDevice->CreateVideoProcessorEnumerator(&ContentDesc, &pEnum);
     10872    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     10873
     10874    D3D11_VIDEO_PROCESSOR_OUTPUT_VIEW_DESC Desc;
     10875    RT_ZERO(Desc);
     10876    Desc.ViewDimension                      = dxVPOVDimension(pEntry->desc.ViewDimension);
     10877    if (Desc.ViewDimension == D3D11_VPOV_DIMENSION_TEXTURE2D)
     10878    {
     10879        Desc.Texture2D.MipSlice             = pEntry->desc.Texture2D.MipSlice;
     10880    }
     10881    else if (Desc.ViewDimension == D3D11_VPOV_DIMENSION_TEXTURE2DARRAY)
     10882    {
     10883        Desc.Texture2DArray.MipSlice        = pEntry->desc.Texture2DArray.MipSlice;
     10884        Desc.Texture2DArray.FirstArraySlice = pEntry->desc.Texture2DArray.FirstArraySlice;
     10885        Desc.Texture2DArray.ArraySize       = pEntry->desc.Texture2DArray.ArraySize;
     10886    }
     10887
     10888    ID3D11VideoProcessorOutputView *pVPOView;
     10889    hr = pDXDevice->pVideoDevice->CreateVideoProcessorOutputView(pResource, pEnum, &Desc, &pVPOView);
     10890    D3D_RELEASE(pEnum);
     10891    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     10892
     10893    return dxViewInit(pView, pSurface, pDXContext, videoProcessorOutputViewId, VMSVGA3D_VIEWTYPE_VIDEOPROCESSOROUTPUT, pVPOView);
     10894}
     10895
     10896
     10897static int dxEnsureVideoDecoderOutputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderOutputViewId viewId, DXVIEW **ppResult)
     10898{
     10899    ASSERT_GUEST_RETURN(viewId < pDXContext->cot.cVideoDecoderOutputView, VERR_INVALID_PARAMETER);
     10900
     10901    DXVIEW *pDXView = &pDXContext->pBackendDXContext->paVideoDecoderOutputView[viewId];
     10902    if (!pDXView->u.pView)
     10903    {
     10904        VBSVGACOTableDXVideoDecoderOutputViewEntry const *pEntry = &pDXContext->cot.paVideoDecoderOutputView[viewId];
     10905        int rc = dxCreateVideoDecoderOutputView(pThisCC, pDXContext, viewId, pEntry);
     10906        AssertRCReturn(rc, rc);
     10907    }
     10908    *ppResult = pDXView;
     10909    return VINF_SUCCESS;
     10910}
     10911
     10912
     10913static int dxEnsureVideoProcessorInputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorInputViewId viewId, DXVIEW **ppResult)
     10914{
     10915    ASSERT_GUEST_RETURN(viewId < pDXContext->cot.cVideoProcessorInputView, VERR_INVALID_PARAMETER);
     10916
     10917    DXVIEW *pDXView = &pDXContext->pBackendDXContext->paVideoProcessorInputView[viewId];
     10918    if (!pDXView->u.pView)
     10919    {
     10920        VBSVGACOTableDXVideoProcessorInputViewEntry const *pEntry = &pDXContext->cot.paVideoProcessorInputView[viewId];
     10921        int rc = dxCreateVideoProcessorInputView(pThisCC, pDXContext, viewId, pEntry);
     10922        AssertRCReturn(rc, rc);
     10923    }
     10924    *ppResult = pDXView;
     10925    return VINF_SUCCESS;
     10926}
     10927
     10928
     10929static int dxEnsureVideoProcessorOutputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorOutputViewId viewId, DXVIEW **ppResult)
     10930{
     10931    ASSERT_GUEST_RETURN(viewId < pDXContext->cot.cVideoProcessorOutputView, VERR_INVALID_PARAMETER);
     10932
     10933    DXVIEW *pDXView = &pDXContext->pBackendDXContext->paVideoProcessorOutputView[viewId];
     10934    if (!pDXView->u.pView)
     10935    {
     10936        VBSVGACOTableDXVideoProcessorOutputViewEntry const *pEntry = &pDXContext->cot.paVideoProcessorOutputView[viewId];
     10937        int rc = dxCreateVideoProcessorOutputView(pThisCC, pDXContext, viewId, pEntry);
     10938        AssertRCReturn(rc, rc);
     10939    }
     10940    *ppResult = pDXView;
     10941    return VINF_SUCCESS;
     10942}
     10943
     10944
     10945static int dxVideoDecoderBeginFrame(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext,
     10946                                    VBSVGA3dVideoDecoderId videoDecoderId,
     10947                                    VBSVGA3dVideoDecoderOutputViewId videoDecoderOutputViewId)
     10948{
     10949    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     10950    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     10951
     10952    DXVIDEODECODER *pDXVideoDecoder = &pDXContext->pBackendDXContext->paVideoDecoder[videoDecoderId];
     10953
     10954    DXVIEW *pDXView;
     10955    int rc = dxEnsureVideoDecoderOutputView(pThisCC, pDXContext, videoDecoderOutputViewId, &pDXView);
     10956    AssertRCReturn(rc, rc);
     10957
     10958    HRESULT hr = pDXDevice->pVideoContext->DecoderBeginFrame(pDXVideoDecoder->pVideoDecoder,
     10959                                                             pDXView->u.pVideoDecoderOutputView,
     10960                                                             0, NULL);
     10961    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     10962
     10963    return VINF_SUCCESS;
     10964}
     10965
     10966
     10967static void dxSetupVideoProcessor(DXDEVICE *pDXDevice, DXVIDEOPROCESSOR *pDXVideoProcessor, VBSVGACOTableDXVideoProcessorEntry const *pEntry)
     10968{
     10969    if (pEntry->output.SetMask & VBSVGA3D_VP_SET_OUTPUT_TARGET_RECT)
     10970        dxVideoProcessorSetOutputTargetRect(pDXDevice, pDXVideoProcessor, pEntry->output.TargetRectEnable, pEntry->output.TargetRect);
     10971
     10972    if (pEntry->output.SetMask & VBSVGA3D_VP_SET_OUTPUT_BACKGROUND_COLOR)
     10973        dxVideoProcessorSetOutputBackgroundColor(pDXDevice, pDXVideoProcessor, pEntry->output.BackgroundColorYCbCr, pEntry->output.BackgroundColor);
     10974
     10975    if (pEntry->output.SetMask & VBSVGA3D_VP_SET_OUTPUT_COLOR_SPACE)
     10976        dxVideoProcessorSetOutputColorSpace(pDXDevice, pDXVideoProcessor, pEntry->output.ColorSpace);
     10977
     10978    if (pEntry->output.SetMask & VBSVGA3D_VP_SET_OUTPUT_ALPHA_FILL_MODE)
     10979        dxVideoProcessorSetOutputAlphaFillMode(pDXDevice, pDXVideoProcessor, pEntry->output.AlphaFillMode, pEntry->output.AlphaFillStreamIndex);
     10980
     10981    if (pEntry->output.SetMask & VBSVGA3D_VP_SET_OUTPUT_CONSTRICTION)
     10982        dxVideoProcessorSetOutputConstriction(pDXDevice, pDXVideoProcessor, pEntry->output.ConstrictionEnable, pEntry->output.ConstrictionWidth, pEntry->output.ConstrictionHeight);
     10983
     10984    if (pEntry->output.SetMask & VBSVGA3D_VP_SET_OUTPUT_STEREO_MODE)
     10985        dxVideoProcessorSetOutputStereoMode(pDXDevice, pDXVideoProcessor, pEntry->output.StereoModeEnable);
     10986
     10987    for (uint32_t i = 0; i < RT_ELEMENTS(pEntry->aStreamState); ++i)
     10988    {
     10989        VBSVGA3dVideoProcessorStreamState const *pStreamState = &pEntry->aStreamState[i];
     10990        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_FRAME_FORMAT)
     10991            dxVideoProcessorSetStreamFrameFormat(pDXDevice, pDXVideoProcessor, i, pStreamState->FrameFormat);
     10992
     10993        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_COLOR_SPACE)
     10994            dxVideoProcessorSetStreamColorSpace(pDXDevice, pDXVideoProcessor, i, pStreamState->ColorSpace);
     10995
     10996        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_OUTPUT_RATE)
     10997            dxVideoProcessorSetStreamOutputRate(pDXDevice, pDXVideoProcessor, i, pStreamState->OutputRate, pStreamState->RepeatFrame, pStreamState->CustomRate);
     10998
     10999        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_SOURCE_RECT)
     11000            dxVideoProcessorSetStreamSourceRect(pDXDevice, pDXVideoProcessor, i, pStreamState->SourceRectEnable, pStreamState->SourceRect);
     11001
     11002        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_DEST_RECT)
     11003            dxVideoProcessorSetStreamDestRect(pDXDevice, pDXVideoProcessor, i, pStreamState->DestRectEnable, pStreamState->DestRect);
     11004
     11005        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_ALPHA)
     11006            dxVideoProcessorSetStreamAlpha(pDXDevice, pDXVideoProcessor, i, pStreamState->AlphaEnable, pStreamState->Alpha);
     11007
     11008        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_PALETTE)
     11009            dxVideoProcessorSetStreamPalette(pDXDevice, pDXVideoProcessor, i, pStreamState->PaletteCount, &pStreamState->aPalette[0]);\
     11010
     11011        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_ASPECT_RATIO)
     11012            dxVideoProcessorSetStreamPixelAspectRatio(pDXDevice, pDXVideoProcessor, i, pStreamState->AspectRatioEnable, pStreamState->AspectSourceRatio, pStreamState->AspectDestRatio);
     11013
     11014        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_LUMA_KEY)
     11015            dxVideoProcessorSetStreamLumaKey(pDXDevice, pDXVideoProcessor, i, pStreamState->LumaKeyEnable, pStreamState->LumaKeyLower, pStreamState->LumaKeyUpper);
     11016
     11017        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_STEREO_FORMAT)
     11018            dxVideoProcessorSetStreamStereoFormat(pDXDevice, pDXVideoProcessor, i, pStreamState->StereoFormatEnable, pStreamState->StereoFormat,
     11019                                                  pStreamState->LeftViewFrame0, pStreamState->BaseViewFrame0, pStreamState->FlipMode, pStreamState->MonoOffset);
     11020
     11021        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_AUTO_PROCESSING_MODE)
     11022            dxVideoProcessorSetStreamAutoProcessingMode(pDXDevice, pDXVideoProcessor, i, pStreamState->AutoProcessingModeEnable);
     11023
     11024        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_FILTER)
     11025        {
     11026            for (uint32_t idxFilter = 0; idxFilter < VBSVGA3D_VP_MAX_FILTER_COUNT; ++idxFilter)
     11027            {
     11028                uint32_t const enable = pStreamState->FilterEnableMask & ~(1 << idxFilter);
     11029                int32 const level = pStreamState->aFilter[idxFilter].Level;
     11030                dxVideoProcessorSetStreamFilter(pDXDevice, pDXVideoProcessor, i, enable, (VBSVGA3dVideoProcessorFilter)idxFilter, level);
     11031            }
     11032        }
     11033
     11034        if (pStreamState->SetMask & VBSVGA3D_VP_SET_STREAM_ROTATION)
     11035            dxVideoProcessorSetStreamRotation(pDXDevice, pDXVideoProcessor, i, pStreamState->RotationEnable, pStreamState->Rotation);
     11036    }
     11037}
     11038
     11039
     11040static int dxCreateVideoProcessor(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, VBSVGACOTableDXVideoProcessorEntry const *pEntry)
     11041{
     11042    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11043    AssertReturn(pDXDevice->pVideoDevice, VERR_INVALID_STATE);
     11044
     11045    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11046
     11047    D3D11_VIDEO_PROCESSOR_CONTENT_DESC Desc;
     11048    RT_ZERO(Desc);
     11049    Desc.InputFrameFormat            = dxVideoFrameFormat(pEntry->desc.InputFrameFormat);
     11050    Desc.InputFrameRate.Numerator    = pEntry->desc.InputFrameRate.numerator;
     11051    Desc.InputFrameRate.Denominator  = pEntry->desc.InputFrameRate.denominator;
     11052    Desc.InputWidth                  = pEntry->desc.InputWidth;
     11053    Desc.InputHeight                 = pEntry->desc.InputHeight;
     11054    Desc.OutputFrameRate.Numerator   = pEntry->desc.OutputFrameRate.numerator;
     11055    Desc.OutputFrameRate.Denominator = pEntry->desc.OutputFrameRate.denominator;
     11056    Desc.OutputWidth                 = pEntry->desc.OutputWidth;
     11057    Desc.OutputHeight                = pEntry->desc.OutputHeight;
     11058    Desc.Usage                       = dxVideoUsage(pEntry->desc.Usage);
     11059
     11060    HRESULT hr = pDXDevice->pVideoDevice->CreateVideoProcessorEnumerator(&Desc, &pDXVideoProcessor->pEnum);
     11061    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     11062
     11063    hr = pDXDevice->pVideoDevice->CreateVideoProcessor(pDXVideoProcessor->pEnum, 0, &pDXVideoProcessor->pVideoProcessor);
     11064    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     11065
     11066    dxSetupVideoProcessor(pDXDevice, pDXVideoProcessor, pEntry);
     11067    return VINF_SUCCESS;
     11068}
     11069
     11070
     11071static void dxDestroyVideoProcessor(DXVIDEOPROCESSOR *pDXVideoProcessor)
     11072{
     11073    D3D_RELEASE(pDXVideoProcessor->pEnum);
     11074    D3D_RELEASE(pDXVideoProcessor->pVideoProcessor);
     11075}
     11076
     11077
     11078static int dxCreateVideoDecoder(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId, VBSVGACOTableDXVideoDecoderEntry const *pEntry)
     11079{
     11080    HRESULT hr;
     11081
     11082    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11083    AssertReturn(pDXDevice->pVideoDevice, VERR_INVALID_STATE);
     11084
     11085    DXVIDEODECODER *pDXVideoDecoder = &pDXContext->pBackendDXContext->paVideoDecoder[videoDecoderId];
     11086
     11087    D3D11_VIDEO_DECODER_DESC VideoDesc;
     11088    RT_ZERO(VideoDesc);
     11089    memcpy(&VideoDesc.Guid, &pEntry->desc.DecodeProfile, sizeof(GUID));
     11090    VideoDesc.SampleWidth  = pEntry->desc.SampleWidth;
     11091    VideoDesc.SampleHeight = pEntry->desc.SampleHeight;
     11092    VideoDesc.OutputFormat = vmsvgaDXSurfaceFormat2Dxgi(pEntry->desc.OutputFormat);
     11093
     11094    D3D11_VIDEO_DECODER_CONFIG Config;
     11095    RT_ZERO(Config);
     11096    memcpy(&Config.guidConfigBitstreamEncryption, &pEntry->config.guidConfigBitstreamEncryption, sizeof(GUID));
     11097    memcpy(&Config.guidConfigMBcontrolEncryption, &pEntry->config.guidConfigMBcontrolEncryption, sizeof(GUID));
     11098    memcpy(&Config.guidConfigResidDiffEncryption, &pEntry->config.guidConfigResidDiffEncryption, sizeof(GUID));
     11099    Config.ConfigBitstreamRaw             = pEntry->config.ConfigBitstreamRaw;
     11100    Config.ConfigMBcontrolRasterOrder     = pEntry->config.ConfigMBcontrolRasterOrder;
     11101    Config.ConfigResidDiffHost            = pEntry->config.ConfigResidDiffHost;
     11102    Config.ConfigSpatialResid8            = pEntry->config.ConfigSpatialResid8;
     11103    Config.ConfigResid8Subtraction        = pEntry->config.ConfigResid8Subtraction;
     11104    Config.ConfigSpatialHost8or9Clipping  = pEntry->config.ConfigSpatialHost8or9Clipping;
     11105    Config.ConfigSpatialResidInterleaved  = pEntry->config.ConfigSpatialResidInterleaved;
     11106    Config.ConfigIntraResidUnsigned       = pEntry->config.ConfigIntraResidUnsigned;
     11107    Config.ConfigResidDiffAccelerator     = pEntry->config.ConfigResidDiffAccelerator;
     11108    Config.ConfigHostInverseScan          = pEntry->config.ConfigHostInverseScan;
     11109    Config.ConfigSpecificIDCT             = pEntry->config.ConfigSpecificIDCT;
     11110    Config.Config4GroupedCoefs            = pEntry->config.Config4GroupedCoefs;
     11111    Config.ConfigMinRenderTargetBuffCount = pEntry->config.ConfigMinRenderTargetBuffCount;
     11112    Config.ConfigDecoderSpecific          = pEntry->config.ConfigDecoderSpecific;
     11113
     11114    hr = pDXDevice->pVideoDevice->CreateVideoDecoder(&VideoDesc, &Config, &pDXVideoDecoder->pVideoDecoder);
     11115    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     11116    LogFlowFunc(("Using DecodeProfile %RTuuid\n", &VideoDesc.Guid));
     11117
     11118    /* COTables are restored from saved state in ascending order. Output View must be created before Decoder. */
     11119    AssertCompile(VBSVGA_COTABLE_VDOV < VBSVGA_COTABLE_VIDEODECODER);
     11120    if (pEntry->vdovId != SVGA3D_INVALID_ID)
     11121    {
     11122        int rc = dxVideoDecoderBeginFrame(pThisCC, pDXContext, videoDecoderId, pEntry->vdovId);
     11123        AssertRC(rc); RT_NOREF(rc);
     11124    }
     11125
     11126    return VINF_SUCCESS;
     11127}
     11128
     11129
     11130static void dxDestroyVideoDecoder(DXVIDEODECODER *pDXVideoDecoder)
     11131{
     11132    D3D_RELEASE(pDXVideoDecoder->pVideoDecoder);
     11133}
     11134
     11135
     11136/*
     11137 * Backend callbacks.
     11138 */
     11139
     11140static DECLCALLBACK(int) vmsvga3dBackVBDXDefineVideoProcessor(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, VBSVGACOTableDXVideoProcessorEntry const *pEntry)
     11141{
     11142    return dxCreateVideoProcessor(pThisCC, pDXContext, videoProcessorId, pEntry);
     11143}
     11144
     11145
     11146static DECLCALLBACK(int) vmsvga3dBackVBDXDefineVideoDecoderOutputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderOutputViewId videoDecoderOutputViewId, VBSVGACOTableDXVideoDecoderOutputViewEntry const *pEntry)
     11147{
     11148    /* The view is created when it is used: either in BeginFrame or ClearView. */
     11149    RT_NOREF(pThisCC, pDXContext, videoDecoderOutputViewId, pEntry);
     11150    return VINF_SUCCESS;
     11151}
     11152
     11153
     11154static DECLCALLBACK(int) vmsvga3dBackVBDXDefineVideoDecoder(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId, VBSVGACOTableDXVideoDecoderEntry const *pEntry)
     11155{
     11156    return dxCreateVideoDecoder(pThisCC, pDXContext, videoDecoderId, pEntry);
     11157}
     11158
     11159
     11160static DECLCALLBACK(int) vmsvga3dBackVBDXVideoDecoderBeginFrame(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId, VBSVGA3dVideoDecoderOutputViewId videoDecoderOutputViewId)
     11161{
     11162    return dxVideoDecoderBeginFrame(pThisCC, pDXContext, videoDecoderId, videoDecoderOutputViewId);
     11163}
     11164
     11165
     11166static DECLCALLBACK(int) vmsvga3dBackVBDXVideoDecoderSubmitBuffers(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId, uint32_t cBuffer, VBSVGA3dVideoDecoderBufferDesc const *paBufferDesc)
     11167{
     11168    HRESULT hr;
     11169
     11170    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11171    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11172
     11173    DXVIDEODECODER *pDXVideoDecoder = &pDXContext->pBackendDXContext->paVideoDecoder[videoDecoderId];
     11174
     11175    D3D11_VIDEO_DECODER_BUFFER_DESC *paDesc = (D3D11_VIDEO_DECODER_BUFFER_DESC *)RTMemTmpAllocZ(cBuffer * sizeof(D3D11_VIDEO_DECODER_BUFFER_DESC));
     11176    AssertReturn(paDesc, VERR_NO_MEMORY);
     11177
     11178    for (uint32_t i = 0; i < cBuffer; ++i)
     11179    {
     11180        VBSVGA3dVideoDecoderBufferDesc const *s = &paBufferDesc[i];
     11181
     11182        PVMSVGA3DSURFACE pSurface;
     11183        int rc = vmsvga3dSurfaceFromSid(pThisCC->svga.p3dState, s->sidBuffer, &pSurface);
     11184        ASSERT_GUEST_CONTINUE(RT_SUCCESS(rc));
     11185
     11186        uint32_t const cbSurface = pSurface->paMipmapLevels[0].cbSurface;
     11187        ASSERT_GUEST_CONTINUE(   s->dataSize <= cbSurface
     11188                              && s->dataOffset <= cbSurface - s->dataSize);
     11189
     11190        D3D11_VIDEO_DECODER_BUFFER_DESC *d = &paDesc[i];
     11191        d->BufferType     = dxVideoDecoderBufferType(s->bufferType);
     11192        d->DataOffset     = 0;
     11193        d->DataSize       = s->dataSize;
     11194        d->FirstMBaddress = s->firstMBaddress;
     11195        d->NumMBsInBuffer = s->numMBsInBuffer;
     11196
     11197        UINT DecoderBufferSize;
     11198        void *pDecoderBuffer;
     11199        hr = pDXDevice->pVideoContext->GetDecoderBuffer(pDXVideoDecoder->pVideoDecoder, d->BufferType,
     11200                                                        &DecoderBufferSize, &pDecoderBuffer);
     11201        AssertReturnStmt(SUCCEEDED(hr), RTMemTmpFree(paDesc), VERR_NOT_SUPPORTED);
     11202
     11203        ASSERT_GUEST_CONTINUE(DecoderBufferSize >= s->dataSize);
     11204
     11205        if (pSurface->pBackendSurface)
     11206        {
     11207            void *pvGuestBuffer;
     11208            uint32_t cbGuestBuffer;
     11209            rc = dxReadBuffer(pDXDevice, pSurface->pBackendSurface->u.pBuffer, s->dataOffset, s->dataSize,
     11210                              &pvGuestBuffer, &cbGuestBuffer);
     11211            AssertRC(rc);
     11212            if (RT_SUCCESS(rc))
     11213            {
     11214                memcpy(pDecoderBuffer, pvGuestBuffer, cbGuestBuffer);
     11215                RTMemFree(pvGuestBuffer);
     11216            }
     11217        }
     11218        else
     11219            memcpy(pDecoderBuffer, (uint8_t *)pSurface->paMipmapLevels[0].pSurfaceData + s->dataOffset, s->dataSize);
     11220
     11221        hr = pDXDevice->pVideoContext->ReleaseDecoderBuffer(pDXVideoDecoder->pVideoDecoder, d->BufferType);
     11222        AssertReturnStmt(SUCCEEDED(hr), RTMemTmpFree(paDesc), VERR_NOT_SUPPORTED);
     11223    }
     11224
     11225    hr = pDXDevice->pVideoContext->SubmitDecoderBuffers(pDXVideoDecoder->pVideoDecoder, cBuffer, paDesc);
     11226    AssertReturnStmt(SUCCEEDED(hr), RTMemTmpFree(paDesc), VERR_NOT_SUPPORTED);
     11227
     11228    RTMemTmpFree(paDesc);
     11229    return VINF_SUCCESS;
     11230}
     11231
     11232
     11233static DECLCALLBACK(int) vmsvga3dBackVBDXVideoDecoderEndFrame(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId)
     11234{
     11235    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11236    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11237
     11238    DXVIDEODECODER *pDXVideoDecoder = &pDXContext->pBackendDXContext->paVideoDecoder[videoDecoderId];
     11239
     11240    HRESULT hr = pDXDevice->pVideoContext->DecoderEndFrame(pDXVideoDecoder->pVideoDecoder);
     11241    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     11242
     11243    return VINF_SUCCESS;
     11244}
     11245
     11246
     11247static DECLCALLBACK(int) vmsvga3dBackVBDXDefineVideoProcessorInputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorInputViewId videoProcessorInputViewId, VBSVGACOTableDXVideoProcessorInputViewEntry const *pEntry)
     11248{
     11249    /* The view is created when it is used: either in VideoProcessorBlt or ClearView. */
     11250    RT_NOREF(pThisCC, pDXContext, videoProcessorInputViewId, pEntry);
     11251    return VINF_SUCCESS;
     11252}
     11253
     11254
     11255static DECLCALLBACK(int) vmsvga3dBackVBDXDefineVideoProcessorOutputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorOutputViewId videoProcessorOutputViewId, VBSVGACOTableDXVideoProcessorOutputViewEntry const *pEntry)
     11256{
     11257    /* The view is created when it is used: either in VideoProcessorBlt or ClearView. */
     11258    RT_NOREF(pThisCC, pDXContext, videoProcessorOutputViewId, pEntry);
     11259    return VINF_SUCCESS;
     11260}
     11261
     11262
     11263static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorBlt(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, VBSVGA3dVideoProcessorOutputViewId videoProcessorOutputViewId,
     11264                                                           uint32_t OutputFrame, uint32_t StreamCount, VBSVGA3dVideoProcessorStream const *pVideoProcessorStreams)
     11265{
     11266    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11267    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11268
     11269    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11270
     11271    DXVIEW *pVPOView;
     11272    int rc = dxEnsureVideoProcessorOutputView(pThisCC, pDXContext, videoProcessorOutputViewId, &pVPOView);
     11273    AssertRCReturn(rc, rc);
     11274
     11275    uint32_t cbStreams = StreamCount * sizeof(D3D11_VIDEO_PROCESSOR_STREAM);
     11276
     11277    /* ID3D11VideoProcessorInputView arrays for past and future frames. */
     11278    VBSVGA3dVideoProcessorStream const *pVPS = pVideoProcessorStreams;
     11279    for (uint32_t i = 0; i < StreamCount; ++i)
     11280    {
     11281        uint32_t const cIds = (pVPS->StereoFormatSeparate == 0 ? 1 : 2) * (pVPS->PastFrames + 1 + pVPS->FutureFrames);
     11282
     11283        uint32_t const cPastFutureViews = (pVPS->StereoFormatSeparate == 0 ? 1 : 2) * (pVPS->PastFrames + pVPS->FutureFrames);
     11284        cbStreams += cPastFutureViews * sizeof(ID3D11VideoProcessorInputView *);
     11285
     11286        pVPS = (VBSVGA3dVideoProcessorStream *)((uint8_t *)&pVPS[1] + cIds * sizeof(VBSVGA3dVideoProcessorInputViewId));
     11287    }
     11288
     11289    D3D11_VIDEO_PROCESSOR_STREAM *paStreams = (D3D11_VIDEO_PROCESSOR_STREAM *)RTMemTmpAllocZ(cbStreams);
     11290    AssertReturn(paStreams, VERR_NO_MEMORY);
     11291    ID3D11VideoProcessorInputView **ppSurfaces = (ID3D11VideoProcessorInputView **)&paStreams[StreamCount];
     11292
     11293    pVPS = pVideoProcessorStreams;
     11294    for (uint32_t i = 0; i < StreamCount; ++i)
     11295    {
     11296        D3D11_VIDEO_PROCESSOR_STREAM *d = &paStreams[i];
     11297        d->Enable            = pVPS->Enable;
     11298        d->OutputIndex       = pVPS->OutputIndex;
     11299        d->InputFrameOrField = pVPS->InputFrameOrField;
     11300        d->PastFrames        = pVPS->PastFrames;
     11301        d->FutureFrames      = pVPS->FutureFrames;
     11302
     11303        /*
     11304         * Fetch input frames.
     11305         */
     11306        uint32_t const cIds = (pVPS->StereoFormatSeparate == 0 ? 1 : 2) * (pVPS->PastFrames + 1 + pVPS->FutureFrames);
     11307        VBSVGA3dVideoProcessorInputViewId const *pId = (VBSVGA3dVideoProcessorInputViewId *)&pVPS[1];
     11308        DXVIEW *pVPIView;
     11309
     11310        /* Past frames. */
     11311        if (pVPS->PastFrames)
     11312        {
     11313            DEBUG_BREAKPOINT_TEST();
     11314            d->ppPastSurfaces = ppSurfaces;
     11315            for (UINT j = 0; j < pVPS->PastFrames; ++j, ++ppSurfaces)
     11316            {
     11317                rc = dxEnsureVideoProcessorInputView(pThisCC, pDXContext, *pId++, &pVPIView);
     11318                AssertRCReturnStmt(rc, RTMemTmpFree(paStreams), rc);
     11319                d->ppPastSurfaces[j] = pVPIView->u.pVideoProcessorInputView;
     11320            }
     11321        }
     11322
     11323        /* CurrentFrame */
     11324        rc = dxEnsureVideoProcessorInputView(pThisCC, pDXContext, *pId++, &pVPIView);
     11325        AssertRCReturnStmt(rc, RTMemTmpFree(paStreams), rc);
     11326        d->pInputSurface = pVPIView->u.pVideoProcessorInputView;
     11327
     11328        /* Future frames. */
     11329        if (pVPS->FutureFrames)
     11330        {
     11331            d->ppFutureSurfaces = ppSurfaces;
     11332            for (UINT j = 0; j < pVPS->FutureFrames; ++j, ++ppSurfaces)
     11333            {
     11334                rc = dxEnsureVideoProcessorInputView(pThisCC, pDXContext, *pId++, &pVPIView);
     11335                AssertRCReturnStmt(rc, RTMemTmpFree(paStreams), rc);
     11336                d->ppFutureSurfaces[j] = pVPIView->u.pVideoProcessorInputView;
     11337            }
     11338        }
     11339
     11340        /* Right frames for stereo. */
     11341        if (pVPS->StereoFormatSeparate)
     11342        {
     11343            /* Past frames. */
     11344            if (pVPS->PastFrames)
     11345            {
     11346                 d->ppPastSurfacesRight = ppSurfaces;
     11347                 for (UINT j = 0; j < pVPS->PastFrames; ++j, ++ppSurfaces)
     11348                 {
     11349                     rc = dxEnsureVideoProcessorInputView(pThisCC, pDXContext, *pId++, &pVPIView);
     11350                     AssertRCReturnStmt(rc, RTMemTmpFree(paStreams), rc);
     11351                     d->ppPastSurfacesRight[j] = pVPIView->u.pVideoProcessorInputView;
     11352                 }
     11353            }
     11354
     11355            /* CurrentFrame */
     11356            rc = dxEnsureVideoProcessorInputView(pThisCC, pDXContext, *pId++, &pVPIView);
     11357            AssertRCReturnStmt(rc, RTMemTmpFree(paStreams), rc);
     11358            d->pInputSurfaceRight = pVPIView->u.pVideoProcessorInputView;
     11359
     11360            /* Future frames. */
     11361            if (pVPS->FutureFrames)
     11362            {
     11363                d->ppFutureSurfacesRight = ppSurfaces;
     11364                for (UINT j = 0; j < pVPS->FutureFrames; ++j, ++ppSurfaces)
     11365                {
     11366                    rc = dxEnsureVideoProcessorInputView(pThisCC, pDXContext, *pId++, &pVPIView);
     11367                    AssertRCReturnStmt(rc, RTMemTmpFree(paStreams), rc);
     11368                    d->ppFutureSurfacesRight[j] = pVPIView->u.pVideoProcessorInputView;
     11369                }
     11370            }
     11371        }
     11372
     11373        pVPS = (VBSVGA3dVideoProcessorStream *)((uint8_t *)&pVPS[1] + cIds * sizeof(VBSVGA3dVideoProcessorInputViewId));
     11374    }
     11375
     11376    HRESULT hr = pDXDevice->pVideoContext->VideoProcessorBlt(pDXVideoProcessor->pVideoProcessor, pVPOView->u.pVideoProcessorOutputView,
     11377                                                             OutputFrame, StreamCount, paStreams);
     11378    RTMemTmpFree(paStreams);
     11379    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     11380
     11381    return VINF_SUCCESS;
     11382}
     11383
     11384
     11385static DECLCALLBACK(int) vmsvga3dBackVBDXDestroyVideoDecoder(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId)
     11386{
     11387    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
     11388    RT_NOREF(pBackend);
     11389
     11390    DXVIDEODECODER *pDXVideoDecoder = &pDXContext->pBackendDXContext->paVideoDecoder[videoDecoderId];
     11391    dxDestroyVideoDecoder(pDXVideoDecoder);
     11392
     11393    return VINF_SUCCESS;
     11394}
     11395
     11396
     11397static DECLCALLBACK(int) vmsvga3dBackVBDXDestroyVideoDecoderOutputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderOutputViewId videoDecoderOutputViewId)
     11398{
     11399    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
     11400    RT_NOREF(pBackend);
     11401
     11402    DXVIEW *pDXView = &pDXContext->pBackendDXContext->paVideoDecoderOutputView[videoDecoderOutputViewId];
     11403    dxViewDestroy(pDXView);
     11404
     11405    return VINF_SUCCESS;
     11406}
     11407
     11408
     11409static DECLCALLBACK(int) vmsvga3dBackVBDXDestroyVideoProcessor(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId)
     11410{
     11411    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
     11412    RT_NOREF(pBackend);
     11413
     11414    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11415    dxDestroyVideoProcessor(pDXVideoProcessor);
     11416
     11417    return VINF_SUCCESS;
     11418}
     11419
     11420
     11421static DECLCALLBACK(int) vmsvga3dBackVBDXDestroyVideoProcessorInputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorInputViewId videoProcessorInputViewId)
     11422{
     11423    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
     11424    RT_NOREF(pBackend);
     11425
     11426    DXVIEW *pDXView = &pDXContext->pBackendDXContext->paVideoProcessorInputView[videoProcessorInputViewId];
     11427    dxViewDestroy(pDXView);
     11428
     11429    return VINF_SUCCESS;
     11430}
     11431
     11432
     11433static DECLCALLBACK(int) vmsvga3dBackVBDXDestroyVideoProcessorOutputView(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorOutputViewId videoProcessorOutputViewId)
     11434{
     11435    PVMSVGA3DBACKEND pBackend = pThisCC->svga.p3dState->pBackend;
     11436    RT_NOREF(pBackend);
     11437
     11438    DXVIEW *pDXView = &pDXContext->pBackendDXContext->paVideoProcessorOutputView[videoProcessorOutputViewId];
     11439    dxViewDestroy(pDXView);
     11440
     11441    return VINF_SUCCESS;
     11442}
     11443
     11444
     11445static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetOutputTargetRect(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint8 enable, SVGASignedRect const &outputRect)
     11446{
     11447    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11448    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11449
     11450    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11451    dxVideoProcessorSetOutputTargetRect(pDXDevice, pDXVideoProcessor, enable, outputRect);
     11452    return VINF_SUCCESS;
     11453}
     11454
     11455
     11456static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetOutputBackgroundColor(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint32 YCbCr, VBSVGA3dVideoColor const &color)
     11457{
     11458    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11459    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11460
     11461    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11462    dxVideoProcessorSetOutputBackgroundColor(pDXDevice, pDXVideoProcessor, YCbCr, color);
     11463    return VINF_SUCCESS;
     11464}
     11465
     11466
     11467static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetOutputColorSpace(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, VBSVGA3dVideoProcessorColorSpace const &colorSpace)
     11468{
     11469    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11470    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11471
     11472    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11473    dxVideoProcessorSetOutputColorSpace(pDXDevice, pDXVideoProcessor, colorSpace);
     11474    return VINF_SUCCESS;
     11475}
     11476
     11477
     11478static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetOutputAlphaFillMode(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, VBSVGA3dVideoProcessorAlphaFillMode fillMode, uint32 streamIndex)
     11479{
     11480    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11481    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11482
     11483    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11484    dxVideoProcessorSetOutputAlphaFillMode(pDXDevice, pDXVideoProcessor, fillMode, streamIndex);
     11485    return VINF_SUCCESS;
     11486}
     11487
     11488
     11489static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetOutputConstriction(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint32 enabled, uint32 width, uint32 height)
     11490{
     11491    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11492    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11493
     11494    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11495    dxVideoProcessorSetOutputConstriction(pDXDevice, pDXVideoProcessor, enabled, width, height);
     11496    return VINF_SUCCESS;
     11497}
     11498
     11499
     11500static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetOutputStereoMode(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint32 enable)
     11501{
     11502    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11503    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11504
     11505    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11506    dxVideoProcessorSetOutputStereoMode(pDXDevice, pDXVideoProcessor, enable);
     11507    return VINF_SUCCESS;
     11508}
     11509
     11510
     11511static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamFrameFormat(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint32 streamIndex, VBSVGA3dVideoFrameFormat format)
     11512{
     11513    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11514    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11515
     11516    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11517    dxVideoProcessorSetStreamFrameFormat(pDXDevice, pDXVideoProcessor, streamIndex, format);
     11518    return VINF_SUCCESS;
     11519}
     11520
     11521
     11522static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamColorSpace(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint32 streamIndex, VBSVGA3dVideoProcessorColorSpace colorSpace)
     11523{
     11524    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11525    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11526
     11527    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11528    dxVideoProcessorSetStreamColorSpace(pDXDevice, pDXVideoProcessor, streamIndex, colorSpace);
     11529    return VINF_SUCCESS;
     11530}
     11531
     11532
     11533static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamOutputRate(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     11534                                                                           uint32 streamIndex, VBSVGA3dVideoProcessorOutputRate outputRate, uint32 repeatFrame, SVGA3dFraction64 const &customRate)
     11535{
     11536    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11537    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11538
     11539    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11540    dxVideoProcessorSetStreamOutputRate(pDXDevice, pDXVideoProcessor, streamIndex, outputRate, repeatFrame, customRate);
     11541    return VINF_SUCCESS;
     11542}
     11543
     11544
     11545static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamSourceRect(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     11546                                                                           uint32 streamIndex, uint32 enable, SVGASignedRect const &sourceRect)
     11547{
     11548    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11549    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11550
     11551    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11552    dxVideoProcessorSetStreamSourceRect(pDXDevice, pDXVideoProcessor, streamIndex, enable, sourceRect);
     11553    return VINF_SUCCESS;
     11554}
     11555
     11556
     11557static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamDestRect(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     11558                                                                         uint32 streamIndex, uint32 enable, SVGASignedRect const &destRect)
     11559{
     11560    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11561    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11562
     11563    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11564    dxVideoProcessorSetStreamDestRect(pDXDevice, pDXVideoProcessor, streamIndex, enable, destRect);
     11565    return VINF_SUCCESS;
     11566}
     11567
     11568
     11569static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamAlpha(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     11570                                                                      uint32 streamIndex, uint32 enable, float alpha)
     11571{
     11572    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11573    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11574
     11575    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11576    dxVideoProcessorSetStreamAlpha(pDXDevice, pDXVideoProcessor, streamIndex, enable, alpha);
     11577    return VINF_SUCCESS;
     11578}
     11579
     11580
     11581static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamPalette(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     11582                                                                        uint32 streamIndex, uint32_t cEntries, uint32_t const *paEntries)
     11583{
     11584    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11585    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11586
     11587    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11588    dxVideoProcessorSetStreamPalette(pDXDevice, pDXVideoProcessor, streamIndex, cEntries, paEntries);
     11589    return VINF_SUCCESS;
     11590}
     11591
     11592
     11593static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamPixelAspectRatio(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     11594                                                                                 uint32 streamIndex, uint32 enable, SVGA3dFraction64 const &sourceRatio, SVGA3dFraction64 const &destRatio)
     11595{
     11596    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11597    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11598
     11599    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11600    dxVideoProcessorSetStreamPixelAspectRatio(pDXDevice, pDXVideoProcessor, streamIndex, enable, sourceRatio, destRatio);
     11601    return VINF_SUCCESS;
     11602}
     11603
     11604
     11605static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamLumaKey(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     11606                                                                        uint32 streamIndex, uint32 enable, float lower, float upper)
     11607{
     11608    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11609    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11610
     11611    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11612    dxVideoProcessorSetStreamLumaKey(pDXDevice, pDXVideoProcessor, streamIndex, enable, lower, upper);
     11613    return VINF_SUCCESS;
     11614}
     11615
     11616
     11617static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamStereoFormat(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     11618                                                                             uint32 streamIndex, uint32 enable, VBSVGA3dVideoProcessorStereoFormat stereoFormat,
     11619                                                                             uint8 leftViewFrame0, uint8 baseViewFrame0, VBSVGA3dVideoProcessorStereoFlipMode flipMode, int32 monoOffset)
     11620{
     11621    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11622    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11623
     11624    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11625    dxVideoProcessorSetStreamStereoFormat(pDXDevice, pDXVideoProcessor, streamIndex, enable, stereoFormat,
     11626                                          leftViewFrame0, baseViewFrame0, flipMode, monoOffset);
     11627    return VINF_SUCCESS;
     11628}
     11629
     11630
     11631static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamAutoProcessingMode(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     11632                                                                                   uint32 streamIndex, uint32 enable)
     11633{
     11634    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11635    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11636
     11637    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11638    dxVideoProcessorSetStreamAutoProcessingMode(pDXDevice, pDXVideoProcessor, streamIndex, enable);
     11639    return VINF_SUCCESS;
     11640}
     11641
     11642
     11643static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamFilter(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     11644                                                                       uint32 streamIndex, uint32 enable, VBSVGA3dVideoProcessorFilter filter, int32 level)
     11645{
     11646    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11647    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11648
     11649    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11650    dxVideoProcessorSetStreamFilter(pDXDevice, pDXVideoProcessor, streamIndex, enable, filter, level);
     11651    return VINF_SUCCESS;
     11652}
     11653
     11654
     11655static DECLCALLBACK(int) vmsvga3dBackVBDXVideoProcessorSetStreamRotation(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     11656                                                                         uint32 streamIndex, uint32 enable, VBSVGA3dVideoProcessorRotation rotation)
     11657{
     11658    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11659    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11660
     11661    DXVIDEOPROCESSOR *pDXVideoProcessor = &pDXContext->pBackendDXContext->paVideoProcessor[videoProcessorId];
     11662    dxVideoProcessorSetStreamRotation(pDXDevice, pDXVideoProcessor, streamIndex, enable, rotation);
     11663    return VINF_SUCCESS;
     11664}
     11665
     11666
     11667static int dxGetVideoCapDecodeProfile(PVGASTATECC pThisCC, DXDEVICE *pDXDevice, void *pvData, uint32 cbData, uint32 *pcbOut)
     11668{
     11669    VBSVGA3dDecodeProfileInfo *paDecodeProfileInfo = (VBSVGA3dDecodeProfileInfo *)pvData;
     11670
     11671    UINT ProfileCount = pDXDevice->pVideoDevice->GetVideoDecoderProfileCount();
     11672    ProfileCount = RT_MIN(ProfileCount, cbData / sizeof(paDecodeProfileInfo[0]));
     11673
     11674#ifndef DEBUG_sunlover
     11675    /** @todo Allocation of video decoder output texture often fails on NVidia. Disable video decoding for now. */
     11676    if (pThisCC->svga.p3dState->pBackend->VendorId == 0x10de)
     11677        ProfileCount = 0;
     11678#else
     11679    RT_NOREF(pThisCC);
     11680#endif
     11681
     11682    for (UINT i = 0; i < ProfileCount; ++i)
     11683    {
     11684        VBSVGA3dDecodeProfileInfo *d = &paDecodeProfileInfo[i];
     11685
     11686        /* GUID and VBSVGA3dGuid are identical. */
     11687        GUID *pGuid = (GUID *)&d->DecodeProfile;
     11688        HRESULT hr = pDXDevice->pVideoDevice->GetVideoDecoderProfile(i, pGuid);
     11689        Assert(SUCCEEDED(hr));
     11690        if (SUCCEEDED(hr))
     11691        {
     11692            struct
     11693            {
     11694                DXGI_FORMAT format;
     11695                uint8 *pSupported;
     11696            } aFormats[] =
     11697            {
     11698                { DXGI_FORMAT_AYUV, &d->fAYUV },
     11699                { DXGI_FORMAT_NV12, &d->fNV12 },
     11700                { DXGI_FORMAT_YUY2, &d->fYUY2 },
     11701            };
     11702
     11703            for (unsigned idxFormat = 0; idxFormat < RT_ELEMENTS(aFormats); ++idxFormat)
     11704            {
     11705                BOOL Supported = FALSE;
     11706                pDXDevice->pVideoDevice->CheckVideoDecoderFormat(pGuid, aFormats[idxFormat].format, &Supported);
     11707                *aFormats[idxFormat].pSupported = RT_BOOL(Supported);
     11708            }
     11709        }
     11710
     11711        if (FAILED(hr))
     11712            RT_ZERO(*d);
     11713    }
     11714
     11715    *pcbOut = ProfileCount * sizeof(VBSVGA3dDecodeProfileInfo);
     11716    return VINF_SUCCESS;
     11717}
     11718
     11719
     11720static int dxGetVideoCapDecodeConfig(DXDEVICE *pDXDevice, void *pvData, uint32 cbData, uint32 *pcbOut)
     11721{
     11722    ASSERT_GUEST_RETURN(cbData >= sizeof(VBSVGA3dVideoDecoderDesc), VERR_INVALID_PARAMETER);
     11723    VBSVGA3dDecodeConfigInfo *pConfigInfo = (VBSVGA3dDecodeConfigInfo *)pvData;
     11724
     11725    D3D11_VIDEO_DECODER_DESC Desc;
     11726    RT_ZERO(Desc);
     11727    memcpy(&Desc.Guid, &pConfigInfo->desc.DecodeProfile, sizeof(GUID));
     11728    Desc.SampleWidth  = pConfigInfo->desc.SampleWidth;
     11729    Desc.SampleHeight = pConfigInfo->desc.SampleHeight;
     11730    Desc.OutputFormat = vmsvgaDXSurfaceFormat2Dxgi(pConfigInfo->desc.OutputFormat);
     11731
     11732    UINT ConfigCount;
     11733    HRESULT hr = pDXDevice->pVideoDevice->GetVideoDecoderConfigCount(&Desc, &ConfigCount);
     11734    if (FAILED(hr))
     11735        ConfigCount = 0;
     11736    ConfigCount = RT_MIN(ConfigCount, (cbData - sizeof(pConfigInfo->desc)) / sizeof(pConfigInfo->aConfig[0]));
     11737
     11738    UINT cConfigOut = 0;
     11739    for (UINT i = 0; i < ConfigCount; ++i)
     11740    {
     11741        D3D11_VIDEO_DECODER_CONFIG Config;
     11742        hr = pDXDevice->pVideoDevice->GetVideoDecoderConfig(&Desc, i, &Config);
     11743        Assert(SUCCEEDED(hr));
     11744        if (SUCCEEDED(hr))
     11745        {
     11746            /* Filter out configs with encryption. */
     11747            static GUID const NoEncrypt = { 0x1b81beD0, 0xa0c7,0x11d3,0xb9,0x84,0x00,0xc0,0x4f,0x2e,0x73,0xc5 };
     11748            if (   memcmp(&NoEncrypt, &Config.guidConfigBitstreamEncryption, sizeof(GUID)) == 0
     11749                && memcmp(&NoEncrypt, &Config.guidConfigMBcontrolEncryption, sizeof(GUID)) == 0
     11750                && memcmp(&NoEncrypt, &Config.guidConfigResidDiffEncryption, sizeof(GUID)) == 0)
     11751            {
     11752                VBSVGA3dVideoDecoderConfig *d = &pConfigInfo->aConfig[cConfigOut++];
     11753
     11754                memcpy(&d->guidConfigBitstreamEncryption, &Config.guidConfigBitstreamEncryption, sizeof(VBSVGA3dGuid));
     11755                memcpy(&d->guidConfigMBcontrolEncryption, &Config.guidConfigMBcontrolEncryption, sizeof(VBSVGA3dGuid));
     11756                memcpy(&d->guidConfigResidDiffEncryption, &Config.guidConfigResidDiffEncryption, sizeof(VBSVGA3dGuid));
     11757                d->ConfigBitstreamRaw             = Config.ConfigBitstreamRaw;
     11758                d->ConfigMBcontrolRasterOrder     = Config.ConfigMBcontrolRasterOrder;
     11759                d->ConfigResidDiffHost            = Config.ConfigResidDiffHost;
     11760                d->ConfigSpatialResid8            = Config.ConfigSpatialResid8;
     11761                d->ConfigResid8Subtraction        = Config.ConfigResid8Subtraction;
     11762                d->ConfigSpatialHost8or9Clipping  = Config.ConfigSpatialHost8or9Clipping;
     11763                d->ConfigSpatialResidInterleaved  = Config.ConfigSpatialResidInterleaved;
     11764                d->ConfigIntraResidUnsigned       = Config.ConfigIntraResidUnsigned;
     11765                d->ConfigResidDiffAccelerator     = Config.ConfigResidDiffAccelerator;
     11766                d->ConfigHostInverseScan          = Config.ConfigHostInverseScan;
     11767                d->ConfigSpecificIDCT             = Config.ConfigSpecificIDCT;
     11768                d->Config4GroupedCoefs            = Config.Config4GroupedCoefs;
     11769                d->ConfigMinRenderTargetBuffCount = Config.ConfigMinRenderTargetBuffCount;
     11770                d->ConfigDecoderSpecific          = Config.ConfigDecoderSpecific;
     11771            }
     11772        }
     11773    }
     11774
     11775    //DEBUG_BREAKPOINT_TEST();
     11776    *pcbOut = sizeof(VBSVGA3dVideoDecoderDesc) + cConfigOut * sizeof(VBSVGA3dVideoDecoderConfig);
     11777    return VINF_SUCCESS;
     11778}
     11779
     11780
     11781static int dxGetVideoCapProcessorEnum(DXDEVICE *pDXDevice, void *pvData, uint32 cbData, uint32 *pcbOut)
     11782{
     11783    ASSERT_GUEST_RETURN(cbData >= sizeof(VBSVGA3dProcessorEnumInfo), VERR_INVALID_PARAMETER);
     11784
     11785    VBSVGA3dProcessorEnumInfo *pInfo = (VBSVGA3dProcessorEnumInfo *)pvData;
     11786    RT_ZERO(pInfo->info);
     11787
     11788    D3D11_VIDEO_PROCESSOR_CONTENT_DESC ContentDesc;
     11789    RT_ZERO(ContentDesc);
     11790    ContentDesc.InputFrameFormat            = dxVideoFrameFormat(pInfo->desc.InputFrameFormat);
     11791    ContentDesc.InputFrameRate.Numerator    = pInfo->desc.InputFrameRate.numerator;
     11792    ContentDesc.InputFrameRate.Denominator  = pInfo->desc.InputFrameRate.denominator;
     11793    ContentDesc.InputWidth                  = pInfo->desc.InputWidth;
     11794    ContentDesc.InputHeight                 = pInfo->desc.InputHeight;
     11795    ContentDesc.OutputFrameRate.Numerator   = pInfo->desc.OutputFrameRate.numerator;
     11796    ContentDesc.OutputFrameRate.Denominator = pInfo->desc.OutputFrameRate.denominator;
     11797    ContentDesc.OutputWidth                 = pInfo->desc.OutputWidth;
     11798    ContentDesc.OutputHeight                = pInfo->desc.OutputHeight;
     11799    ContentDesc.Usage                       = dxVideoUsage(pInfo->desc.Usage);
     11800
     11801    ID3D11VideoProcessorEnumerator *pEnum;
     11802    HRESULT hr = pDXDevice->pVideoDevice->CreateVideoProcessorEnumerator(&ContentDesc, &pEnum);
     11803    AssertReturn(SUCCEEDED(hr), VERR_NOT_SUPPORTED);
     11804
     11805    struct
     11806    {
     11807        DXGI_FORMAT format;
     11808        uint8 *pFlags;
     11809    } aFormats[] =
     11810    {
     11811        { DXGI_FORMAT_R8_UNORM,            &pInfo->info.fR8_UNORM },
     11812        { DXGI_FORMAT_R16_UNORM,           &pInfo->info.fR16_UNORM },
     11813        { DXGI_FORMAT_NV12,                &pInfo->info.fNV12 },
     11814        { DXGI_FORMAT_YUY2,                &pInfo->info.fYUY2 },
     11815        { DXGI_FORMAT_R16G16B16A16_FLOAT,  &pInfo->info.fR16G16B16A16_FLOAT },
     11816        { DXGI_FORMAT_B8G8R8X8_UNORM,      &pInfo->info.fB8G8R8X8_UNORM },
     11817        { DXGI_FORMAT_B8G8R8A8_UNORM,      &pInfo->info.fB8G8R8A8_UNORM },
     11818        { DXGI_FORMAT_R8G8B8A8_UNORM,      &pInfo->info.fR8G8B8A8_UNORM },
     11819        { DXGI_FORMAT_R10G10B10A2_UNORM,   &pInfo->info.fR10G10B10A2_UNORM },
     11820        { DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM, &pInfo->info.fR10G10B10_XR_BIAS_A2_UNORM },
     11821        { DXGI_FORMAT_R8G8B8A8_UNORM_SRGB, &pInfo->info.fR8G8B8A8_UNORM_SRGB },
     11822        { DXGI_FORMAT_B8G8R8A8_UNORM_SRGB, &pInfo->info.fB8G8R8A8_UNORM_SRGB },
     11823    };
     11824
     11825    for (unsigned idxFormat = 0; idxFormat < RT_ELEMENTS(aFormats); ++idxFormat)
     11826    {
     11827        UINT Flags = 0;
     11828        hr = pEnum->CheckVideoProcessorFormat(aFormats[idxFormat].format, &Flags);
     11829        if (SUCCEEDED(hr))
     11830            *aFormats[idxFormat].pFlags = Flags;
     11831    }
     11832
     11833    D3D11_VIDEO_PROCESSOR_CAPS Caps;
     11834    hr = pEnum->GetVideoProcessorCaps(&Caps);
     11835    if (SUCCEEDED(hr))
     11836    {
     11837        pInfo->info.Caps.DeviceCaps              = Caps.DeviceCaps;
     11838        pInfo->info.Caps.FeatureCaps             = Caps.FeatureCaps;
     11839        pInfo->info.Caps.FilterCaps              = Caps.FilterCaps;
     11840        pInfo->info.Caps.InputFormatCaps         = Caps.InputFormatCaps;
     11841        pInfo->info.Caps.AutoStreamCaps          = Caps.AutoStreamCaps;
     11842        pInfo->info.Caps.StereoCaps              = Caps.StereoCaps;
     11843        pInfo->info.Caps.RateConversionCapsCount = RT_MIN(Caps.RateConversionCapsCount, VBSVGA3D_MAX_VIDEO_RATE_CONVERSION_CAPS);
     11844        pInfo->info.Caps.MaxInputStreams         = RT_MIN(Caps.MaxInputStreams, VBSVGA3D_MAX_VIDEO_STREAMS);
     11845        pInfo->info.Caps.MaxStreamStates         = RT_MIN(Caps.MaxStreamStates, VBSVGA3D_MAX_VIDEO_STREAMS);
     11846    }
     11847
     11848    D3D11_VIDEO_PROCESSOR_RATE_CONVERSION_CAPS RateCaps;
     11849    hr = pEnum->GetVideoProcessorRateConversionCaps(0, &RateCaps);
     11850    if (SUCCEEDED(hr))
     11851    {
     11852        pInfo->info.RateCaps.PastFrames      = RateCaps.PastFrames;
     11853        pInfo->info.RateCaps.FutureFrames    = RateCaps.FutureFrames;
     11854        pInfo->info.RateCaps.ProcessorCaps   = RateCaps.ProcessorCaps;
     11855        pInfo->info.RateCaps.ITelecineCaps   = RateCaps.ITelecineCaps;
     11856        pInfo->info.RateCaps.CustomRateCount = RT_MIN(RateCaps.CustomRateCount, VBSVGA3D_MAX_VIDEO_CUSTOM_RATE_CAPS);
     11857    }
     11858
     11859    for (unsigned i = 0; i < pInfo->info.RateCaps.CustomRateCount; ++i)
     11860    {
     11861        D3D11_VIDEO_PROCESSOR_CUSTOM_RATE Rate;
     11862        hr = pEnum->GetVideoProcessorCustomRate(0, i, &Rate);
     11863        if (SUCCEEDED(hr))
     11864        {
     11865            pInfo->info.aCustomRateCaps[i].CustomRate.numerator   = Rate.CustomRate.Numerator;
     11866            pInfo->info.aCustomRateCaps[i].CustomRate.denominator = Rate.CustomRate.Denominator;
     11867            pInfo->info.aCustomRateCaps[i].OutputFrames           = Rate.OutputFrames;
     11868            pInfo->info.aCustomRateCaps[i].InputInterlaced        = Rate.InputInterlaced;
     11869            pInfo->info.aCustomRateCaps[i].InputFramesOrFields    = Rate.InputFramesOrFields;
     11870        }
     11871    }
     11872
     11873    for (unsigned i = 0; i < VBSVGA3D_VP_MAX_FILTER_COUNT; ++i)
     11874    {
     11875        if (pInfo->info.Caps.FilterCaps & (1 << i))
     11876        {
     11877            D3D11_VIDEO_PROCESSOR_FILTER_RANGE Range;
     11878            hr = pEnum->GetVideoProcessorFilterRange((D3D11_VIDEO_PROCESSOR_FILTER)i, &Range);
     11879            if (SUCCEEDED(hr))
     11880            {
     11881                pInfo->info.aFilterRange[i].Minimum = Range.Minimum;
     11882                pInfo->info.aFilterRange[i].Maximum = Range.Maximum;
     11883                pInfo->info.aFilterRange[i].Default = Range.Default;
     11884                pInfo->info.aFilterRange[i].Multiplier = Range.Multiplier;
     11885            }
     11886        }
     11887    }
     11888
     11889    //DEBUG_BREAKPOINT_TEST();
     11890    D3D_RELEASE(pEnum);
     11891
     11892    *pcbOut = sizeof(VBSVGA3dProcessorEnumInfo);
     11893    return VINF_SUCCESS;
     11894}
     11895
     11896
     11897static DECLCALLBACK(int) vmsvga3dBackVBDXGetVideoCapability(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoCapability capability, void *pvData, uint32 cbData, uint32 *pcbOut)
     11898{
     11899    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11900    AssertReturn(pDXDevice->pVideoContext, VERR_INVALID_STATE);
     11901
     11902    switch (capability)
     11903    {
     11904        case VBSVGA3D_VIDEO_CAPABILITY_DECODE_PROFILE:
     11905            return dxGetVideoCapDecodeProfile(pThisCC, pDXDevice, pvData, cbData, pcbOut);
     11906        case VBSVGA3D_VIDEO_CAPABILITY_DECODE_CONFIG:
     11907            return dxGetVideoCapDecodeConfig(pDXDevice, pvData, cbData, pcbOut);
     11908        case VBSVGA3D_VIDEO_CAPABILITY_PROCESSOR_ENUM:
     11909            return dxGetVideoCapProcessorEnum(pDXDevice, pvData, cbData, pcbOut);
     11910        default:
     11911            break;
     11912    }
     11913
     11914    return VERR_NOT_SUPPORTED;
     11915}
     11916
     11917
     11918static DECLCALLBACK(int) vmsvga3dBackVBDXClearUAV(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId viewId,
     11919                                                  SVGA3dRGBAFloat const *pColor, uint32_t cRect, SVGASignedRect const *paRect)
     11920{
     11921    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11922    AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE);
     11923
     11924    DXVIEW *pDXView = &pDXContext->pBackendDXContext->paUnorderedAccessView[viewId];
     11925    if (!pDXView->u.pView)
     11926    {
     11927        /* (Re-)create the view, because a creation of a view is deferred until a draw or a clear call. */
     11928        SVGACOTableDXUAViewEntry const *pEntry = &pDXContext->cot.paUAView[viewId];
     11929        int rc = dxDefineUnorderedAccessView(pThisCC, pDXContext, viewId, pEntry);
     11930        AssertRCReturn(rc, rc);
     11931    }
     11932    pDXDevice->pImmediateContext->ClearView(pDXView->u.pView, pColor->value, (D3D11_RECT *)paRect, cRect);
     11933    return VINF_SUCCESS;
     11934}
     11935
     11936
     11937static DECLCALLBACK(int) vmsvga3dBackVBDXClearVDOV(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderOutputViewId viewId,
     11938                                                   SVGA3dRGBAFloat const *pColor, uint32_t cRect, SVGASignedRect const *paRect)
     11939{
     11940    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11941    AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE);
     11942
     11943    DXVIEW *pDXView;
     11944    int rc = dxEnsureVideoDecoderOutputView(pThisCC, pDXContext, viewId, &pDXView);
     11945    AssertRCReturn(rc, rc);
     11946
     11947    pDXDevice->pImmediateContext->ClearView(pDXView->u.pView, pColor->value, (D3D11_RECT *)paRect, cRect);
     11948    return VINF_SUCCESS;
     11949}
     11950
     11951
     11952static DECLCALLBACK(int) vmsvga3dBackVBDXClearVPIV(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorInputViewId viewId,
     11953                                                   SVGA3dRGBAFloat const *pColor, uint32_t cRect, SVGASignedRect const *paRect)
     11954{
     11955    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11956    AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE);
     11957
     11958    DXVIEW *pDXView;
     11959    int rc = dxEnsureVideoProcessorInputView(pThisCC, pDXContext, viewId, &pDXView);
     11960    AssertRCReturn(rc, rc);
     11961
     11962    pDXDevice->pImmediateContext->ClearView(pDXView->u.pView, pColor->value, (D3D11_RECT *)paRect, cRect);
     11963    return VINF_SUCCESS;
     11964}
     11965
     11966
     11967static DECLCALLBACK(int) vmsvga3dBackVBDXClearVPOV(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorOutputViewId viewId,
     11968                                                   SVGA3dRGBAFloat const *pColor, uint32_t cRect, SVGASignedRect const *paRect)
     11969{
     11970    DXDEVICE *pDXDevice = dxDeviceFromContext(pThisCC->svga.p3dState, pDXContext);
     11971    AssertReturn(pDXDevice->pDevice, VERR_INVALID_STATE);
     11972
     11973    DXVIEW *pDXView;
     11974    int rc = dxEnsureVideoProcessorOutputView(pThisCC, pDXContext, viewId, &pDXView);
     11975    AssertRCReturn(rc, rc);
     11976
     11977    pDXDevice->pImmediateContext->ClearView(pDXView->u.pView, pColor->value, (D3D11_RECT *)paRect, cRect);
     11978    return VINF_SUCCESS;
    990711979}
    990811980
     
    1013712209                p->pfnDXBindShaderIface           = vmsvga3dBackDXBindShaderIface;
    1013812210                p->pfnVBDXClearRenderTargetViewRegion = vmsvga3dBackVBDXClearRenderTargetViewRegion;
     12211                p->pfnVBDXClearUAV                = vmsvga3dBackVBDXClearUAV;
     12212            }
     12213        }
     12214        else
     12215        {
     12216            AssertFailed();
     12217            rc = VERR_INVALID_PARAMETER;
     12218        }
     12219    }
     12220    else if (RTStrCmp(pszInterfaceName, VMSVGA3D_BACKEND_INTERFACE_NAME_DXVIDEO) == 0)
     12221    {
     12222        if (cbInterfaceFuncs == sizeof(VMSVGA3DBACKENDFUNCSDXVIDEO))
     12223        {
     12224            if (pvInterfaceFuncs)
     12225            {
     12226                VMSVGA3DBACKENDFUNCSDXVIDEO *p = (VMSVGA3DBACKENDFUNCSDXVIDEO *)pvInterfaceFuncs;
     12227                p->pfnVBDXDefineVideoProcessor              = vmsvga3dBackVBDXDefineVideoProcessor;
     12228                p->pfnVBDXDefineVideoDecoderOutputView      = vmsvga3dBackVBDXDefineVideoDecoderOutputView;
     12229                p->pfnVBDXDefineVideoDecoder                = vmsvga3dBackVBDXDefineVideoDecoder;
     12230                p->pfnVBDXVideoDecoderBeginFrame            = vmsvga3dBackVBDXVideoDecoderBeginFrame;
     12231                p->pfnVBDXVideoDecoderSubmitBuffers         = vmsvga3dBackVBDXVideoDecoderSubmitBuffers;
     12232                p->pfnVBDXVideoDecoderEndFrame              = vmsvga3dBackVBDXVideoDecoderEndFrame;
     12233                p->pfnVBDXDefineVideoProcessorInputView     = vmsvga3dBackVBDXDefineVideoProcessorInputView;
     12234                p->pfnVBDXDefineVideoProcessorOutputView    = vmsvga3dBackVBDXDefineVideoProcessorOutputView;
     12235                p->pfnVBDXVideoProcessorBlt                 = vmsvga3dBackVBDXVideoProcessorBlt;
     12236                p->pfnVBDXDestroyVideoDecoder               = vmsvga3dBackVBDXDestroyVideoDecoder;
     12237                p->pfnVBDXDestroyVideoDecoderOutputView     = vmsvga3dBackVBDXDestroyVideoDecoderOutputView;
     12238                p->pfnVBDXDestroyVideoProcessor             = vmsvga3dBackVBDXDestroyVideoProcessor;
     12239                p->pfnVBDXDestroyVideoProcessorInputView    = vmsvga3dBackVBDXDestroyVideoProcessorInputView;
     12240                p->pfnVBDXDestroyVideoProcessorOutputView   = vmsvga3dBackVBDXDestroyVideoProcessorOutputView;
     12241                p->pfnVBDXVideoProcessorSetOutputTargetRect = vmsvga3dBackVBDXVideoProcessorSetOutputTargetRect;
     12242                p->pfnVBDXVideoProcessorSetOutputBackgroundColor = vmsvga3dBackVBDXVideoProcessorSetOutputBackgroundColor;
     12243                p->pfnVBDXVideoProcessorSetOutputColorSpace = vmsvga3dBackVBDXVideoProcessorSetOutputColorSpace;
     12244                p->pfnVBDXVideoProcessorSetOutputAlphaFillMode = vmsvga3dBackVBDXVideoProcessorSetOutputAlphaFillMode;
     12245                p->pfnVBDXVideoProcessorSetOutputConstriction = vmsvga3dBackVBDXVideoProcessorSetOutputConstriction;
     12246                p->pfnVBDXVideoProcessorSetOutputStereoMode = vmsvga3dBackVBDXVideoProcessorSetOutputStereoMode;
     12247                p->pfnVBDXVideoProcessorSetStreamFrameFormat = vmsvga3dBackVBDXVideoProcessorSetStreamFrameFormat;
     12248                p->pfnVBDXVideoProcessorSetStreamColorSpace = vmsvga3dBackVBDXVideoProcessorSetStreamColorSpace;
     12249                p->pfnVBDXVideoProcessorSetStreamOutputRate = vmsvga3dBackVBDXVideoProcessorSetStreamOutputRate;
     12250                p->pfnVBDXVideoProcessorSetStreamSourceRect = vmsvga3dBackVBDXVideoProcessorSetStreamSourceRect;
     12251                p->pfnVBDXVideoProcessorSetStreamDestRect   = vmsvga3dBackVBDXVideoProcessorSetStreamDestRect;
     12252                p->pfnVBDXVideoProcessorSetStreamAlpha      = vmsvga3dBackVBDXVideoProcessorSetStreamAlpha;
     12253                p->pfnVBDXVideoProcessorSetStreamPalette    = vmsvga3dBackVBDXVideoProcessorSetStreamPalette;
     12254                p->pfnVBDXVideoProcessorSetStreamPixelAspectRatio = vmsvga3dBackVBDXVideoProcessorSetStreamPixelAspectRatio;
     12255                p->pfnVBDXVideoProcessorSetStreamLumaKey    = vmsvga3dBackVBDXVideoProcessorSetStreamLumaKey;
     12256                p->pfnVBDXVideoProcessorSetStreamStereoFormat = vmsvga3dBackVBDXVideoProcessorSetStreamStereoFormat;
     12257                p->pfnVBDXVideoProcessorSetStreamAutoProcessingMode = vmsvga3dBackVBDXVideoProcessorSetStreamAutoProcessingMode;
     12258                p->pfnVBDXVideoProcessorSetStreamFilter     = vmsvga3dBackVBDXVideoProcessorSetStreamFilter;
     12259                p->pfnVBDXVideoProcessorSetStreamRotation   = vmsvga3dBackVBDXVideoProcessorSetStreamRotation;
     12260                p->pfnVBDXGetVideoCapability                = vmsvga3dBackVBDXGetVideoCapability;
     12261                p->pfnVBDXClearVDOV                         = vmsvga3dBackVBDXClearVDOV;
     12262                p->pfnVBDXClearVPIV                         = vmsvga3dBackVBDXClearVPIV;
     12263                p->pfnVBDXClearVPOV                         = vmsvga3dBackVBDXClearVPOV;
    1013912264            }
    1014012265        }
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx-savedstate.cpp

    r98783 r102520  
    141141    pHlp->pfnSSMGetMem(pSSM, &pDXContext->svgaDXContext, sizeof(SVGADXContextMobFormat));
    142142
    143     rc = pHlp->pfnSSMGetU32(pSSM, &u32);
     143    uint32_t cCOTMobs;
     144    rc = pHlp->pfnSSMGetU32(pSSM, &cCOTMobs);
    144145    AssertLogRelRCReturn(rc, rc);
    145     AssertReturn(u32 == RT_ELEMENTS(pDXContext->aCOTMobs), VERR_INVALID_STATE);
    146 
    147     for (unsigned i = 0; i < RT_ELEMENTS(pDXContext->aCOTMobs); ++i)
     146    AssertReturn(cCOTMobs <= RT_ELEMENTS(pDXContext->aCOTMobs), VERR_INVALID_STATE);
     147
     148    for (unsigned i = 0; i < cCOTMobs; ++i)
    148149    {
    149150        rc = pHlp->pfnSSMGetU32(pSSM, &u32);
     
    173174        {SVGA_COTABLE_DXSHADER,        sizeof(SVGACOTableDXShaderEntry),          &pDXContext->cot.cShader,          (void **)&pDXContext->cot.paShader},
    174175        {SVGA_COTABLE_UAVIEW,          sizeof(SVGACOTableDXUAViewEntry),          &pDXContext->cot.cUAView,          (void **)&pDXContext->cot.paUAView},
     176        {VBSVGA_COTABLE_VIDEOPROCESSOR, sizeof(VBSVGACOTableDXVideoProcessorEntry), &pDXContext->cot.cVideoProcessor, (void **)&pDXContext->cot.paVideoProcessor},
     177        {VBSVGA_COTABLE_VDOV,          sizeof(VBSVGACOTableDXVideoDecoderOutputViewEntry), &pDXContext->cot.cVideoDecoderOutputView, (void **)&pDXContext->cot.paVideoDecoderOutputView},
     178        {VBSVGA_COTABLE_VIDEODECODER,  sizeof(VBSVGACOTableDXVideoDecoderEntry), &pDXContext->cot.cVideoDecoder, (void **)&pDXContext->cot.paVideoDecoder},
     179        {VBSVGA_COTABLE_VPIV,          sizeof(VBSVGACOTableDXVideoProcessorInputViewEntry), &pDXContext->cot.cVideoProcessorInputView, (void **)&pDXContext->cot.paVideoProcessorInputView},
     180        {VBSVGA_COTABLE_VPOV,          sizeof(VBSVGACOTableDXVideoProcessorOutputViewEntry), &pDXContext->cot.cVideoProcessorOutputView, (void **)&pDXContext->cot.paVideoProcessorOutputView},
    175181    };
    176182
    177183    AssertCompile(RT_ELEMENTS(cot) == RT_ELEMENTS(pDXContext->aCOTMobs));
    178     for (unsigned i = 0; i < RT_ELEMENTS(cot); ++i)
    179     {
     184    for (unsigned i = 0; i < cCOTMobs; ++i)
     185    {
     186        uint32_t idxCOTable;
     187        if (cot[i].COTableType < SVGA_COTABLE_MAX)
     188            idxCOTable = cot[i].COTableType;
     189        else if (cot[i].COTableType >= VBSVGA_COTABLE_MIN && cot[i].COTableType < VBSVGA_COTABLE_MAX)
     190            idxCOTable = SVGA_COTABLE_MAX + (cot[i].COTableType - VBSVGA_COTABLE_MIN);
     191        else
     192            AssertFailedReturn(VERR_INVALID_STATE);
     193
    180194        uint32_t cEntries;
    181195        pHlp->pfnSSMGetU32(pSSM, &cEntries);
     
    185199
    186200        *cot[i].pcEntries = cEntries;
    187         *cot[i].ppaEntries = vmsvgaR3MobBackingStorePtr(pDXContext->aCOTMobs[cot[i].COTableType], 0);
     201        *cot[i].ppaEntries = vmsvgaR3MobBackingStorePtr(pDXContext->aCOTMobs[idxCOTable], 0);
    188202
    189203        if (cEntries)
     
    343357                        {
    344358                            uint8_t *pu8MapPlane = pu8Map;
    345                             for (uint32_t y = 0; y < dims.cyBlocks; ++y)
     359                            for (uint32_t y = 0; y < map.cRows; ++y)
    346360                            {
    347361                                rc = pHlp->pfnSSMPutMem(pSSM, pu8MapPlane, dims.cbRow);
     
    414428        {pDXContext->cot.cShader,          sizeof(SVGACOTableDXShaderEntry),          pDXContext->cot.paShader},
    415429        {pDXContext->cot.cUAView,          sizeof(SVGACOTableDXUAViewEntry),          pDXContext->cot.paUAView},
     430        {pDXContext->cot.cVideoProcessor,  sizeof(VBSVGACOTableDXVideoProcessorEntry), pDXContext->cot.paVideoProcessor},
     431        {pDXContext->cot.cVideoDecoderOutputView, sizeof(VBSVGACOTableDXVideoDecoderOutputViewEntry), pDXContext->cot.paVideoDecoderOutputView},
     432        {pDXContext->cot.cVideoDecoder,    sizeof(VBSVGACOTableDXVideoDecoderEntry),  pDXContext->cot.paVideoDecoder},
     433        {pDXContext->cot.cVideoProcessorInputView, sizeof(VBSVGACOTableDXVideoProcessorInputViewEntry), pDXContext->cot.paVideoProcessorInputView},
     434        {pDXContext->cot.cVideoProcessorOutputView, sizeof(VBSVGACOTableDXVideoProcessorOutputViewEntry), pDXContext->cot.paVideoProcessorOutputView},
    416435    };
    417436
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-dx.cpp

    r102142 r102520  
    21592159
    21602160static int dxSetOrGrowCOTable(PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, PVMSVGAMOB pMob,
    2161                               SVGACOTableType type, uint32_t validSizeInBytes, bool fGrow)
     2161                              SVGACOTableType enmType, uint32_t validSizeInBytes, bool fGrow)
    21622162{
    21632163    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
    21642164    int rc = VINF_SUCCESS;
    21652165
    2166     ASSERT_GUEST_RETURN(type < RT_ELEMENTS(pDXContext->aCOTMobs), VERR_INVALID_PARAMETER);
     2166    uint32_t idxCOTable;
     2167    if (enmType < SVGA_COTABLE_MAX)
     2168        idxCOTable = enmType;
     2169    else if (enmType >= VBSVGA_COTABLE_MIN && enmType < VBSVGA_COTABLE_MAX)
     2170        idxCOTable = SVGA_COTABLE_MAX + (enmType - VBSVGA_COTABLE_MIN);
     2171    else
     2172        ASSERT_GUEST_FAILED_RETURN(VERR_INVALID_PARAMETER);
    21672173    RT_UNTRUSTED_VALIDATED_FENCE();
    21682174
     
    21842190        validSizeInBytes = 0;
    21852191        cbCOT = 0;
    2186         vmsvgaR3MobBackingStoreDelete(pSvgaR3State, pDXContext->aCOTMobs[type]);
     2192        vmsvgaR3MobBackingStoreDelete(pSvgaR3State, pDXContext->aCOTMobs[idxCOTable]);
    21872193    }
    21882194
     
    21912197    if (RT_SUCCESS(rc))
    21922198    {
    2193         static uint32_t const s_acbEntry[SVGA_COTABLE_MAX] =
     2199        static uint32_t const s_acbEntry[] =
    21942200        {
    21952201            sizeof(SVGACOTableDXRTViewEntry),
     
    22052211            sizeof(SVGACOTableDXShaderEntry),
    22062212            sizeof(SVGACOTableDXUAViewEntry),
     2213            sizeof(VBSVGACOTableDXVideoProcessorEntry),
     2214            sizeof(VBSVGACOTableDXVideoDecoderOutputViewEntry),
     2215            sizeof(VBSVGACOTableDXVideoDecoderEntry),
     2216            sizeof(VBSVGACOTableDXVideoProcessorInputViewEntry),
     2217            sizeof(VBSVGACOTableDXVideoProcessorOutputViewEntry),
    22072218        };
    2208 
    2209         cEntries = cbCOT / s_acbEntry[type];
    2210         cValidEntries = validSizeInBytes / s_acbEntry[type];
     2219        AssertCompile(RT_ELEMENTS(s_acbEntry) == VBSVGA_NUM_COTABLES);
     2220
     2221        cEntries = cbCOT / s_acbEntry[idxCOTable];
     2222        cValidEntries = validSizeInBytes / s_acbEntry[idxCOTable];
    22112223    }
    22122224
     
    22142226    {
    22152227        if (   fGrow
    2216             && pDXContext->aCOTMobs[type]
     2228            && pDXContext->aCOTMobs[idxCOTable]
    22172229            && cValidEntries)
    22182230        {
    22192231            /* Copy entries from the current mob to the new mob. */
    2220             void const *pvSrc = vmsvgaR3MobBackingStorePtr(pDXContext->aCOTMobs[type], 0);
     2232            void const *pvSrc = vmsvgaR3MobBackingStorePtr(pDXContext->aCOTMobs[idxCOTable], 0);
    22212233            void *pvDst = vmsvgaR3MobBackingStorePtr(pMob, 0);
    22222234            if (pvSrc && pvDst)
     
    22292241    if (RT_SUCCESS(rc))
    22302242    {
    2231         pDXContext->aCOTMobs[type] = pMob;
     2243        pDXContext->aCOTMobs[idxCOTable] = pMob;
    22322244
    22332245        void *pvCOT = vmsvgaR3MobBackingStorePtr(pMob, 0);
    2234         switch (type)
     2246        switch (enmType)
    22352247        {
    22362248            case SVGA_COTABLE_RTVIEW:
     
    22832295                break;
    22842296            case SVGA_COTABLE_MAX: break; /* Compiler warning */
     2297            case VBSVGA_COTABLE_VIDEOPROCESSOR:
     2298                pDXContext->cot.paVideoProcessor  = (VBSVGACOTableDXVideoProcessorEntry *)pvCOT;
     2299                pDXContext->cot.cVideoProcessor   = cEntries;
     2300                break;
     2301            case VBSVGA_COTABLE_VDOV:
     2302                pDXContext->cot.paVideoDecoderOutputView  = (VBSVGACOTableDXVideoDecoderOutputViewEntry *)pvCOT;
     2303                pDXContext->cot.cVideoDecoderOutputView   = cEntries;
     2304                break;
     2305            case VBSVGA_COTABLE_VIDEODECODER:
     2306                pDXContext->cot.paVideoDecoder  = (VBSVGACOTableDXVideoDecoderEntry *)pvCOT;
     2307                pDXContext->cot.cVideoDecoder   = cEntries;
     2308                break;
     2309            case VBSVGA_COTABLE_VPIV:
     2310                pDXContext->cot.paVideoProcessorInputView  = (VBSVGACOTableDXVideoProcessorInputViewEntry *)pvCOT;
     2311                pDXContext->cot.cVideoProcessorInputView   = cEntries;
     2312                break;
     2313            case VBSVGA_COTABLE_VPOV:
     2314                pDXContext->cot.paVideoProcessorOutputView  = (VBSVGACOTableDXVideoProcessorOutputViewEntry *)pvCOT;
     2315                pDXContext->cot.cVideoProcessorOutputView   = cEntries;
     2316                break;
     2317            case VBSVGA_COTABLE_MAX: break; /* Compiler warning */
    22852318#ifndef DEBUG_sunlover
    22862319            default: break; /* Compiler warning. */
     
    22932326    /* Notify the backend. */
    22942327    if (RT_SUCCESS(rc))
    2295         rc = pSvgaR3State->pFuncsDX->pfnDXSetCOTable(pThisCC, pDXContext, type, cValidEntries);
     2328        rc = pSvgaR3State->pFuncsDX->pfnDXSetCOTable(pThisCC, pDXContext, enmType, cValidEntries);
    22962329
    22972330    return rc;
     
    32593292}
    32603293
     3294
     3295int vmsvga3dVBDXDefineVideoProcessor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessor const *pCmd)
     3296{
     3297    int rc;
     3298    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3299    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXDefineVideoProcessor, VERR_INVALID_STATE);
     3300    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3301    AssertReturn(p3dState, VERR_INVALID_STATE);
     3302
     3303    PVMSVGA3DDXCONTEXT pDXContext;
     3304    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3305    AssertRCReturn(rc, rc);
     3306
     3307    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3308
     3309    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3310    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3311    RT_UNTRUSTED_VALIDATED_FENCE();
     3312
     3313    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3314    pEntry->desc                    = pCmd->desc;
     3315
     3316    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXDefineVideoProcessor(pThisCC, pDXContext, videoProcessorId, pEntry);
     3317    return rc;
     3318}
     3319
     3320
     3321int vmsvga3dVBDXDefineVideoDecoderOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoDecoderOutputView const *pCmd)
     3322{
     3323    int rc;
     3324    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3325    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXDefineVideoDecoderOutputView, VERR_INVALID_STATE);
     3326    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3327    AssertReturn(p3dState, VERR_INVALID_STATE);
     3328
     3329    PVMSVGA3DDXCONTEXT pDXContext;
     3330    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3331    AssertRCReturn(rc, rc);
     3332
     3333    VBSVGA3dVideoDecoderOutputViewId const videoDecoderOutputViewId = pCmd->videoDecoderOutputViewId;
     3334
     3335    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoDecoderOutputView, VERR_INVALID_STATE);
     3336    ASSERT_GUEST_RETURN(videoDecoderOutputViewId < pDXContext->cot.cVideoDecoderOutputView, VERR_INVALID_PARAMETER);
     3337    RT_UNTRUSTED_VALIDATED_FENCE();
     3338
     3339    VBSVGACOTableDXVideoDecoderOutputViewEntry *pEntry = &pDXContext->cot.paVideoDecoderOutputView[videoDecoderOutputViewId];
     3340    pEntry->sid                     = pCmd->sid;
     3341    pEntry->desc                    = pCmd->desc;
     3342
     3343    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXDefineVideoDecoderOutputView(pThisCC, pDXContext, videoDecoderOutputViewId, pEntry);
     3344    return rc;
     3345}
     3346
     3347
     3348int vmsvga3dVBDXDefineVideoDecoder(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoDecoder const *pCmd)
     3349{
     3350    int rc;
     3351    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3352    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXDefineVideoDecoder, VERR_INVALID_STATE);
     3353    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3354    AssertReturn(p3dState, VERR_INVALID_STATE);
     3355
     3356    PVMSVGA3DDXCONTEXT pDXContext;
     3357    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3358    AssertRCReturn(rc, rc);
     3359
     3360    VBSVGA3dVideoDecoderId const videoDecoderId = pCmd->videoDecoderId;
     3361
     3362    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoDecoder, VERR_INVALID_STATE);
     3363    ASSERT_GUEST_RETURN(videoDecoderId < pDXContext->cot.cVideoDecoder, VERR_INVALID_PARAMETER);
     3364    RT_UNTRUSTED_VALIDATED_FENCE();
     3365
     3366    VBSVGACOTableDXVideoDecoderEntry *pEntry = &pDXContext->cot.paVideoDecoder[videoDecoderId];
     3367    pEntry->desc   = pCmd->desc;
     3368    pEntry->config = pCmd->config;
     3369    pEntry->vdovId = SVGA3D_INVALID_ID;
     3370
     3371    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXDefineVideoDecoder(pThisCC, pDXContext, videoDecoderId, pEntry);
     3372    return rc;
     3373}
     3374
     3375
     3376int vmsvga3dVBDXVideoDecoderBeginFrame(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderBeginFrame const *pCmd)
     3377{
     3378    int rc;
     3379    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3380    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoDecoderBeginFrame, VERR_INVALID_STATE);
     3381    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3382    AssertReturn(p3dState, VERR_INVALID_STATE);
     3383
     3384    PVMSVGA3DDXCONTEXT pDXContext;
     3385    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3386    AssertRCReturn(rc, rc);
     3387
     3388    VBSVGA3dVideoDecoderId const videoDecoderId = pCmd->videoDecoderId;
     3389
     3390    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoDecoder, VERR_INVALID_STATE);
     3391    ASSERT_GUEST_RETURN(videoDecoderId < pDXContext->cot.cVideoDecoder, VERR_INVALID_PARAMETER);
     3392
     3393    VBSVGA3dVideoDecoderOutputViewId const videoDecoderOutputViewId = pCmd->videoDecoderOutputViewId;
     3394
     3395    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoDecoderOutputView, VERR_INVALID_STATE);
     3396    ASSERT_GUEST_RETURN(videoDecoderOutputViewId < pDXContext->cot.cVideoDecoderOutputView, VERR_INVALID_PARAMETER);
     3397    RT_UNTRUSTED_VALIDATED_FENCE();
     3398
     3399    VBSVGACOTableDXVideoDecoderEntry *pEntry = &pDXContext->cot.paVideoDecoder[videoDecoderId];
     3400    pEntry->vdovId = videoDecoderOutputViewId;
     3401
     3402    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoDecoderBeginFrame(pThisCC, pDXContext, videoDecoderId, videoDecoderOutputViewId);
     3403    return rc;
     3404}
     3405
     3406
     3407int vmsvga3dVBDXVideoDecoderSubmitBuffers(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderSubmitBuffers const *pCmd, uint32_t cBuffer, VBSVGA3dVideoDecoderBufferDesc const *paBufferDesc)
     3408{
     3409    int rc;
     3410    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3411    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoDecoderSubmitBuffers, VERR_INVALID_STATE);
     3412    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3413    AssertReturn(p3dState, VERR_INVALID_STATE);
     3414
     3415    PVMSVGA3DDXCONTEXT pDXContext;
     3416    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3417    AssertRCReturn(rc, rc);
     3418
     3419    VBSVGA3dVideoDecoderId const videoDecoderId = pCmd->videoDecoderId;
     3420
     3421    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoDecoder, VERR_INVALID_STATE);
     3422    ASSERT_GUEST_RETURN(videoDecoderId < pDXContext->cot.cVideoDecoder, VERR_INVALID_PARAMETER);
     3423    RT_UNTRUSTED_VALIDATED_FENCE();
     3424
     3425    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoDecoderSubmitBuffers(pThisCC, pDXContext, videoDecoderId, cBuffer, paBufferDesc);
     3426    return rc;
     3427}
     3428
     3429
     3430int vmsvga3dVBDXVideoDecoderEndFrame(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderEndFrame const *pCmd)
     3431{
     3432    int rc;
     3433    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3434    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoDecoderEndFrame, VERR_INVALID_STATE);
     3435    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3436    AssertReturn(p3dState, VERR_INVALID_STATE);
     3437
     3438    PVMSVGA3DDXCONTEXT pDXContext;
     3439    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3440    AssertRCReturn(rc, rc);
     3441
     3442    VBSVGA3dVideoDecoderId const videoDecoderId = pCmd->videoDecoderId;
     3443
     3444    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoDecoder, VERR_INVALID_STATE);
     3445    ASSERT_GUEST_RETURN(videoDecoderId < pDXContext->cot.cVideoDecoder, VERR_INVALID_PARAMETER);
     3446    RT_UNTRUSTED_VALIDATED_FENCE();
     3447
     3448    VBSVGACOTableDXVideoDecoderEntry *pEntry = &pDXContext->cot.paVideoDecoder[videoDecoderId];
     3449    pEntry->vdovId = SVGA3D_INVALID_ID;
     3450
     3451    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoDecoderEndFrame(pThisCC, pDXContext, videoDecoderId);
     3452    return rc;
     3453}
     3454
     3455
     3456int vmsvga3dVBDXDefineVideoProcessorInputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessorInputView const *pCmd)
     3457{
     3458    int rc;
     3459    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3460    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXDefineVideoProcessorInputView, VERR_INVALID_STATE);
     3461    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3462    AssertReturn(p3dState, VERR_INVALID_STATE);
     3463
     3464    PVMSVGA3DDXCONTEXT pDXContext;
     3465    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3466    AssertRCReturn(rc, rc);
     3467
     3468    VBSVGA3dVideoProcessorInputViewId const videoProcessorInputViewId = pCmd->videoProcessorInputViewId;
     3469
     3470    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessorInputView, VERR_INVALID_STATE);
     3471    ASSERT_GUEST_RETURN(videoProcessorInputViewId < pDXContext->cot.cVideoProcessorInputView, VERR_INVALID_PARAMETER);
     3472    RT_UNTRUSTED_VALIDATED_FENCE();
     3473
     3474    VBSVGACOTableDXVideoProcessorInputViewEntry *pEntry = &pDXContext->cot.paVideoProcessorInputView[videoProcessorInputViewId];
     3475    pEntry->sid         = pCmd->sid;
     3476    pEntry->contentDesc = pCmd->contentDesc;
     3477    pEntry->desc        = pCmd->desc;
     3478
     3479    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXDefineVideoProcessorInputView(pThisCC, pDXContext, videoProcessorInputViewId, pEntry);
     3480    return rc;
     3481}
     3482
     3483
     3484int vmsvga3dVBDXDefineVideoProcessorOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessorOutputView const *pCmd)
     3485{
     3486    int rc;
     3487    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3488    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXDefineVideoProcessorOutputView, VERR_INVALID_STATE);
     3489    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3490    AssertReturn(p3dState, VERR_INVALID_STATE);
     3491
     3492    PVMSVGA3DDXCONTEXT pDXContext;
     3493    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3494    AssertRCReturn(rc, rc);
     3495
     3496    VBSVGA3dVideoProcessorOutputViewId const videoProcessorOutputViewId = pCmd->videoProcessorOutputViewId;
     3497
     3498    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessorOutputView, VERR_INVALID_STATE);
     3499    ASSERT_GUEST_RETURN(videoProcessorOutputViewId < pDXContext->cot.cVideoProcessorOutputView, VERR_INVALID_PARAMETER);
     3500    RT_UNTRUSTED_VALIDATED_FENCE();
     3501
     3502    VBSVGACOTableDXVideoProcessorOutputViewEntry *pEntry = &pDXContext->cot.paVideoProcessorOutputView[videoProcessorOutputViewId];
     3503    pEntry->sid         = pCmd->sid;
     3504    pEntry->contentDesc = pCmd->contentDesc;
     3505    pEntry->desc        = pCmd->desc;
     3506
     3507    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXDefineVideoProcessorOutputView(pThisCC, pDXContext, videoProcessorOutputViewId, pEntry);
     3508    return rc;
     3509}
     3510
     3511
     3512int vmsvga3dVBDXVideoProcessorBlt(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorBlt const *pCmd, uint32_t cbCmd)
     3513{
     3514    int rc;
     3515    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3516    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorBlt, VERR_INVALID_STATE);
     3517    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3518    AssertReturn(p3dState, VERR_INVALID_STATE);
     3519
     3520    PVMSVGA3DDXCONTEXT pDXContext;
     3521    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3522    AssertRCReturn(rc, rc);
     3523
     3524    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3525
     3526    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3527    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3528
     3529    VBSVGA3dVideoProcessorOutputViewId const videoProcessorOutputViewId = pCmd->videoProcessorOutputViewId;
     3530
     3531    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessorOutputView, VERR_INVALID_STATE);
     3532    ASSERT_GUEST_RETURN(videoProcessorOutputViewId < pDXContext->cot.cVideoProcessorOutputView, VERR_INVALID_PARAMETER);
     3533
     3534    ASSERT_GUEST_RETURN(pCmd->streamCount < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     3535    RT_UNTRUSTED_VALIDATED_FENCE();
     3536
     3537    VBSVGA3dVideoProcessorStream const *pVPS = (VBSVGA3dVideoProcessorStream *)&pCmd[1];
     3538    uint32_t cbLeft = cbCmd - sizeof(*pCmd);
     3539    for (uint32_t i = 0; i <  pCmd->streamCount; ++i)
     3540    {
     3541        ASSERT_GUEST_RETURN(cbLeft >= sizeof(VBSVGA3dVideoProcessorStream), VERR_INVALID_PARAMETER);
     3542        RT_UNTRUSTED_VALIDATED_FENCE();
     3543        cbLeft -= sizeof(VBSVGA3dVideoProcessorStream);
     3544
     3545        uint32_t const cMaxIds = cbLeft / sizeof(VBSVGA3dVideoProcessorInputViewId);
     3546        ASSERT_GUEST_RETURN(pVPS->PastFrames < cMaxIds, VERR_INVALID_PARAMETER);
     3547        ASSERT_GUEST_RETURN(pVPS->FutureFrames < cMaxIds, VERR_INVALID_PARAMETER);
     3548        RT_UNTRUSTED_VALIDATED_FENCE();
     3549
     3550        uint32_t const cIds = (pVPS->StereoFormatSeparate == 0 ? 1 : 2) * (pVPS->PastFrames + 1 + pVPS->FutureFrames);
     3551        ASSERT_GUEST_RETURN(cIds <= cMaxIds, VERR_INVALID_PARAMETER);
     3552        RT_UNTRUSTED_VALIDATED_FENCE();
     3553
     3554        VBSVGA3dVideoProcessorInputViewId const *pId = (VBSVGA3dVideoProcessorInputViewId *)&pVPS[1];
     3555        for (uint32_t j = 0; j < cIds; ++j)
     3556        {
     3557            VBSVGA3dVideoProcessorInputViewId const videoProcessorInputViewId = pId[j];
     3558
     3559            ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessorInputView, VERR_INVALID_STATE);
     3560            ASSERT_GUEST_RETURN(videoProcessorInputViewId < pDXContext->cot.cVideoProcessorInputView, VERR_INVALID_PARAMETER);
     3561            RT_UNTRUSTED_VALIDATED_FENCE();
     3562        }
     3563
     3564        pVPS = (VBSVGA3dVideoProcessorStream *)((uint8_t *)&pVPS[1] + cIds * sizeof(VBSVGA3dVideoProcessorInputViewId));
     3565        cbLeft -= cIds * sizeof(VBSVGA3dVideoProcessorInputViewId);
     3566    }
     3567
     3568    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorBlt(pThisCC, pDXContext,
     3569                                                               videoProcessorId, videoProcessorOutputViewId,
     3570                                                               pCmd->outputFrame, pCmd->streamCount,
     3571                                                               (VBSVGA3dVideoProcessorStream *)&pCmd[1]);
     3572    return rc;
     3573}
     3574
     3575
     3576int vmsvga3dVBDXDestroyVideoDecoder(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoDecoder const *pCmd)
     3577{
     3578    int rc;
     3579    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3580    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXDestroyVideoDecoder, VERR_INVALID_STATE);
     3581    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3582    AssertReturn(p3dState, VERR_INVALID_STATE);
     3583
     3584    PVMSVGA3DDXCONTEXT pDXContext;
     3585    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3586    AssertRCReturn(rc, rc);
     3587
     3588    VBSVGA3dVideoDecoderId const videoDecoderId = pCmd->videoDecoderId;
     3589
     3590    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoDecoder, VERR_INVALID_STATE);
     3591    ASSERT_GUEST_RETURN(videoDecoderId < pDXContext->cot.cVideoDecoder, VERR_INVALID_PARAMETER);
     3592    RT_UNTRUSTED_VALIDATED_FENCE();
     3593
     3594    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXDestroyVideoDecoder(pThisCC, pDXContext, videoDecoderId);
     3595
     3596    VBSVGACOTableDXVideoDecoderEntry *pEntry = &pDXContext->cot.paVideoDecoder[videoDecoderId];
     3597    RT_ZERO(*pEntry);
     3598
     3599    return rc;
     3600}
     3601
     3602
     3603int vmsvga3dVBDXDestroyVideoDecoderOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoDecoderOutputView const *pCmd)
     3604{
     3605    int rc;
     3606    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3607    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXDestroyVideoDecoderOutputView, VERR_INVALID_STATE);
     3608    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3609    AssertReturn(p3dState, VERR_INVALID_STATE);
     3610
     3611    PVMSVGA3DDXCONTEXT pDXContext;
     3612    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3613    AssertRCReturn(rc, rc);
     3614
     3615    VBSVGA3dVideoDecoderOutputViewId const videoDecoderOutputViewId = pCmd->videoDecoderOutputViewId;
     3616
     3617    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoDecoderOutputView, VERR_INVALID_STATE);
     3618    ASSERT_GUEST_RETURN(videoDecoderOutputViewId < pDXContext->cot.cVideoDecoderOutputView, VERR_INVALID_PARAMETER);
     3619    RT_UNTRUSTED_VALIDATED_FENCE();
     3620
     3621    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXDestroyVideoDecoderOutputView(pThisCC, pDXContext, videoDecoderOutputViewId);
     3622
     3623    VBSVGACOTableDXVideoDecoderOutputViewEntry *pEntry = &pDXContext->cot.paVideoDecoderOutputView[videoDecoderOutputViewId];
     3624    RT_ZERO(*pEntry);
     3625
     3626    return rc;
     3627}
     3628
     3629
     3630int vmsvga3dVBDXDestroyVideoProcessor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessor const *pCmd)
     3631{
     3632    int rc;
     3633    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3634    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXDestroyVideoProcessor, VERR_INVALID_STATE);
     3635    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3636    AssertReturn(p3dState, VERR_INVALID_STATE);
     3637
     3638    PVMSVGA3DDXCONTEXT pDXContext;
     3639    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3640    AssertRCReturn(rc, rc);
     3641
     3642    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3643
     3644    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3645    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3646    RT_UNTRUSTED_VALIDATED_FENCE();
     3647
     3648    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXDestroyVideoProcessor(pThisCC, pDXContext, videoProcessorId);
     3649
     3650    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3651    RT_ZERO(*pEntry);
     3652
     3653    return rc;
     3654}
     3655
     3656
     3657int vmsvga3dVBDXDestroyVideoProcessorInputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessorInputView const *pCmd)
     3658{
     3659    int rc;
     3660    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3661    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXDestroyVideoProcessorInputView, VERR_INVALID_STATE);
     3662    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3663    AssertReturn(p3dState, VERR_INVALID_STATE);
     3664
     3665    PVMSVGA3DDXCONTEXT pDXContext;
     3666    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3667    AssertRCReturn(rc, rc);
     3668
     3669    VBSVGA3dVideoProcessorInputViewId const videoProcessorInputViewId = pCmd->videoProcessorInputViewId;
     3670
     3671    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessorInputView, VERR_INVALID_STATE);
     3672    ASSERT_GUEST_RETURN(videoProcessorInputViewId < pDXContext->cot.cVideoProcessorInputView, VERR_INVALID_PARAMETER);
     3673    RT_UNTRUSTED_VALIDATED_FENCE();
     3674
     3675    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXDestroyVideoProcessorInputView(pThisCC, pDXContext, videoProcessorInputViewId);
     3676
     3677    VBSVGACOTableDXVideoProcessorInputViewEntry *pEntry = &pDXContext->cot.paVideoProcessorInputView[videoProcessorInputViewId];
     3678    RT_ZERO(*pEntry);
     3679
     3680    return rc;
     3681}
     3682
     3683
     3684int vmsvga3dVBDXDestroyVideoProcessorOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessorOutputView const *pCmd)
     3685{
     3686    int rc;
     3687    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3688    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXDestroyVideoProcessorOutputView, VERR_INVALID_STATE);
     3689    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3690    AssertReturn(p3dState, VERR_INVALID_STATE);
     3691
     3692    PVMSVGA3DDXCONTEXT pDXContext;
     3693    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3694    AssertRCReturn(rc, rc);
     3695
     3696    VBSVGA3dVideoProcessorOutputViewId const videoProcessorOutputViewId = pCmd->videoProcessorOutputViewId;
     3697
     3698    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessorOutputView, VERR_INVALID_STATE);
     3699    ASSERT_GUEST_RETURN(videoProcessorOutputViewId < pDXContext->cot.cVideoProcessorOutputView, VERR_INVALID_PARAMETER);
     3700    RT_UNTRUSTED_VALIDATED_FENCE();
     3701
     3702    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXDestroyVideoProcessorOutputView(pThisCC, pDXContext, videoProcessorOutputViewId);
     3703
     3704    VBSVGACOTableDXVideoProcessorOutputViewEntry *pEntry = &pDXContext->cot.paVideoProcessorOutputView[videoProcessorOutputViewId];
     3705    RT_ZERO(*pEntry);
     3706
     3707    return rc;
     3708}
     3709
     3710
     3711int vmsvga3dVBDXVideoProcessorSetOutputTargetRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputTargetRect const *pCmd)
     3712{
     3713    int rc;
     3714    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3715    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputTargetRect, VERR_INVALID_STATE);
     3716    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3717    AssertReturn(p3dState, VERR_INVALID_STATE);
     3718
     3719    PVMSVGA3DDXCONTEXT pDXContext;
     3720    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3721    AssertRCReturn(rc, rc);
     3722
     3723    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3724
     3725    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3726    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3727    RT_UNTRUSTED_VALIDATED_FENCE();
     3728
     3729    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3730    pEntry->output.SetMask |= VBSVGA3D_VP_SET_OUTPUT_TARGET_RECT;
     3731    pEntry->output.TargetRectEnable = RT_BOOL(pCmd->enable);
     3732    pEntry->output.TargetRect = pCmd->outputRect;
     3733
     3734    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputTargetRect(pThisCC, pDXContext, videoProcessorId,
     3735                                                                               pCmd->enable, pCmd->outputRect);
     3736    return rc;
     3737}
     3738
     3739
     3740int vmsvga3dVBDXVideoProcessorSetOutputBackgroundColor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputBackgroundColor const *pCmd)
     3741{
     3742    int rc;
     3743    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3744    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputBackgroundColor, VERR_INVALID_STATE);
     3745    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3746    AssertReturn(p3dState, VERR_INVALID_STATE);
     3747
     3748    PVMSVGA3DDXCONTEXT pDXContext;
     3749    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3750    AssertRCReturn(rc, rc);
     3751
     3752    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3753
     3754    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3755    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3756    RT_UNTRUSTED_VALIDATED_FENCE();
     3757
     3758    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3759    pEntry->output.SetMask |= VBSVGA3D_VP_SET_OUTPUT_BACKGROUND_COLOR;
     3760    pEntry->output.BackgroundColorYCbCr = pCmd->ycbcr;
     3761    pEntry->output.BackgroundColor = pCmd->color;
     3762
     3763    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputBackgroundColor(pThisCC, pDXContext, videoProcessorId, pCmd->ycbcr, pCmd->color);
     3764    return rc;
     3765}
     3766
     3767
     3768int vmsvga3dVBDXVideoProcessorSetOutputColorSpace(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputColorSpace const *pCmd)
     3769{
     3770    int rc;
     3771    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3772    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputColorSpace, VERR_INVALID_STATE);
     3773    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3774    AssertReturn(p3dState, VERR_INVALID_STATE);
     3775
     3776    PVMSVGA3DDXCONTEXT pDXContext;
     3777    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3778    AssertRCReturn(rc, rc);
     3779
     3780    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3781
     3782    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3783    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3784    RT_UNTRUSTED_VALIDATED_FENCE();
     3785
     3786    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3787    pEntry->output.SetMask |= VBSVGA3D_VP_SET_OUTPUT_COLOR_SPACE;
     3788    pEntry->output.ColorSpace = pCmd->colorSpace;
     3789
     3790    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputColorSpace(pThisCC, pDXContext, videoProcessorId, pCmd->colorSpace);
     3791    return rc;
     3792}
     3793
     3794
     3795int vmsvga3dVBDXVideoProcessorSetOutputAlphaFillMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputAlphaFillMode const *pCmd)
     3796{
     3797    int rc;
     3798    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3799    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputAlphaFillMode, VERR_INVALID_STATE);
     3800    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3801    AssertReturn(p3dState, VERR_INVALID_STATE);
     3802
     3803    PVMSVGA3DDXCONTEXT pDXContext;
     3804    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3805    AssertRCReturn(rc, rc);
     3806
     3807    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3808
     3809    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3810    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3811    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     3812    RT_UNTRUSTED_VALIDATED_FENCE();
     3813
     3814    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3815    pEntry->output.SetMask |= VBSVGA3D_VP_SET_OUTPUT_ALPHA_FILL_MODE;
     3816    pEntry->output.AlphaFillMode = pCmd->fillMode;
     3817    pEntry->output.AlphaFillStreamIndex = pCmd->streamIndex;
     3818
     3819    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputAlphaFillMode(pThisCC, pDXContext, videoProcessorId, pCmd->fillMode, pCmd->streamIndex);
     3820    return rc;
     3821}
     3822
     3823
     3824int vmsvga3dVBDXVideoProcessorSetOutputConstriction(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputConstriction const *pCmd)
     3825{
     3826    int rc;
     3827    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3828    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputConstriction, VERR_INVALID_STATE);
     3829    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3830    AssertReturn(p3dState, VERR_INVALID_STATE);
     3831
     3832    PVMSVGA3DDXCONTEXT pDXContext;
     3833    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3834    AssertRCReturn(rc, rc);
     3835
     3836    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3837
     3838    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3839    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3840    RT_UNTRUSTED_VALIDATED_FENCE();
     3841
     3842    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3843    pEntry->output.SetMask |= VBSVGA3D_VP_SET_OUTPUT_CONSTRICTION;
     3844    pEntry->output.ConstrictionEnable = RT_BOOL(pCmd->enabled);
     3845    pEntry->output.ConstrictionWidth = pCmd->width;
     3846    pEntry->output.ConstrictionHeight = pCmd->height;
     3847
     3848    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputConstriction(pThisCC, pDXContext, videoProcessorId, pCmd->enabled, pCmd->width, pCmd->height);
     3849    return rc;
     3850}
     3851
     3852
     3853int vmsvga3dVBDXVideoProcessorSetOutputStereoMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputStereoMode const *pCmd)
     3854{
     3855    int rc;
     3856    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3857    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputStereoMode, VERR_INVALID_STATE);
     3858    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3859    AssertReturn(p3dState, VERR_INVALID_STATE);
     3860
     3861    PVMSVGA3DDXCONTEXT pDXContext;
     3862    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3863    AssertRCReturn(rc, rc);
     3864
     3865    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3866
     3867    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3868    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3869    RT_UNTRUSTED_VALIDATED_FENCE();
     3870
     3871    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3872    pEntry->output.SetMask |= VBSVGA3D_VP_SET_OUTPUT_STEREO_MODE;
     3873    pEntry->output.StereoModeEnable = RT_BOOL(pCmd->enable);
     3874
     3875    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetOutputStereoMode(pThisCC, pDXContext, videoProcessorId, pCmd->enable);
     3876    return rc;
     3877}
     3878
     3879
     3880int vmsvga3dVBDXVideoProcessorSetStreamFrameFormat(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamFrameFormat const *pCmd)
     3881{
     3882    int rc;
     3883    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3884    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamFrameFormat, VERR_INVALID_STATE);
     3885    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3886    AssertReturn(p3dState, VERR_INVALID_STATE);
     3887
     3888    PVMSVGA3DDXCONTEXT pDXContext;
     3889    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3890    AssertRCReturn(rc, rc);
     3891
     3892    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3893
     3894    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3895    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3896    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     3897    RT_UNTRUSTED_VALIDATED_FENCE();
     3898
     3899    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3900    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     3901    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_FRAME_FORMAT;
     3902    pStreamState->FrameFormat = pCmd->format;
     3903
     3904    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamFrameFormat(pThisCC, pDXContext, videoProcessorId, pCmd->streamIndex, pCmd->format);
     3905    return rc;
     3906}
     3907
     3908
     3909int vmsvga3dVBDXVideoProcessorSetStreamColorSpace(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamColorSpace const *pCmd)
     3910{
     3911    int rc;
     3912    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3913    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamColorSpace, VERR_INVALID_STATE);
     3914    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3915    AssertReturn(p3dState, VERR_INVALID_STATE);
     3916
     3917    PVMSVGA3DDXCONTEXT pDXContext;
     3918    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3919    AssertRCReturn(rc, rc);
     3920
     3921    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3922
     3923    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3924    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3925    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     3926    RT_UNTRUSTED_VALIDATED_FENCE();
     3927
     3928    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3929    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     3930    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_COLOR_SPACE;
     3931    pStreamState->ColorSpace = pCmd->colorSpace;
     3932
     3933    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamColorSpace(pThisCC, pDXContext, videoProcessorId, pCmd->streamIndex, pCmd->colorSpace);
     3934    return rc;
     3935}
     3936
     3937
     3938int vmsvga3dVBDXVideoProcessorSetStreamOutputRate(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamOutputRate const *pCmd)
     3939{
     3940    int rc;
     3941    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3942    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamOutputRate, VERR_INVALID_STATE);
     3943    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3944    AssertReturn(p3dState, VERR_INVALID_STATE);
     3945
     3946    PVMSVGA3DDXCONTEXT pDXContext;
     3947    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3948    AssertRCReturn(rc, rc);
     3949
     3950    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3951
     3952    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3953    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3954    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     3955    RT_UNTRUSTED_VALIDATED_FENCE();
     3956
     3957    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3958    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     3959    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_OUTPUT_RATE;
     3960    pStreamState->OutputRate = pCmd->outputRate;
     3961    pStreamState->RepeatFrame = pCmd->repeatFrame;
     3962    pStreamState->CustomRate = pCmd->customRate;
     3963
     3964    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamOutputRate(pThisCC, pDXContext, videoProcessorId,
     3965                                                                                pCmd->streamIndex, pCmd->outputRate, pCmd->repeatFrame, pCmd->customRate);
     3966    return rc;
     3967}
     3968
     3969
     3970int vmsvga3dVBDXVideoProcessorSetStreamSourceRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamSourceRect const *pCmd)
     3971{
     3972    int rc;
     3973    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     3974    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamSourceRect, VERR_INVALID_STATE);
     3975    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     3976    AssertReturn(p3dState, VERR_INVALID_STATE);
     3977
     3978    PVMSVGA3DDXCONTEXT pDXContext;
     3979    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     3980    AssertRCReturn(rc, rc);
     3981
     3982    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     3983
     3984    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     3985    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     3986    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     3987    RT_UNTRUSTED_VALIDATED_FENCE();
     3988
     3989    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     3990    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     3991    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_SOURCE_RECT;
     3992    pStreamState->SourceRectEnable = RT_BOOL(pCmd->enable);
     3993    pStreamState->SourceRect = pCmd->sourceRect;
     3994
     3995    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamSourceRect(pThisCC, pDXContext, videoProcessorId,
     3996                                                                               pCmd->streamIndex, pCmd->enable, pCmd->sourceRect);
     3997    return rc;
     3998}
     3999
     4000
     4001int vmsvga3dVBDXVideoProcessorSetStreamDestRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamDestRect const *pCmd)
     4002{
     4003    int rc;
     4004    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4005    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamDestRect, VERR_INVALID_STATE);
     4006    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4007    AssertReturn(p3dState, VERR_INVALID_STATE);
     4008
     4009    PVMSVGA3DDXCONTEXT pDXContext;
     4010    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4011    AssertRCReturn(rc, rc);
     4012
     4013    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     4014
     4015    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     4016    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     4017    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     4018    RT_UNTRUSTED_VALIDATED_FENCE();
     4019
     4020    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     4021    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     4022    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_DEST_RECT;
     4023    pStreamState->DestRectEnable = RT_BOOL(pCmd->enable);
     4024    pStreamState->DestRect = pCmd->destRect;
     4025
     4026    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamDestRect(pThisCC, pDXContext, videoProcessorId,
     4027                                                                             pCmd->streamIndex, pCmd->enable, pCmd->destRect);
     4028    return rc;
     4029}
     4030
     4031
     4032int vmsvga3dVBDXVideoProcessorSetStreamAlpha(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamAlpha const *pCmd)
     4033{
     4034    int rc;
     4035    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4036    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamAlpha, VERR_INVALID_STATE);
     4037    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4038    AssertReturn(p3dState, VERR_INVALID_STATE);
     4039
     4040    PVMSVGA3DDXCONTEXT pDXContext;
     4041    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4042    AssertRCReturn(rc, rc);
     4043
     4044    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     4045
     4046    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     4047    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     4048    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     4049    RT_UNTRUSTED_VALIDATED_FENCE();
     4050
     4051    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     4052    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     4053    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_ALPHA;
     4054    pStreamState->AlphaEnable = RT_BOOL(pCmd->enable);
     4055    pStreamState->Alpha = pCmd->alpha;
     4056
     4057    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamAlpha(pThisCC, pDXContext, videoProcessorId,
     4058                                                                          pCmd->streamIndex, pCmd->enable, pCmd->alpha);
     4059    return rc;
     4060}
     4061
     4062
     4063int vmsvga3dVBDXVideoProcessorSetStreamPalette(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamPalette const *pCmd, uint32_t cEntries, uint32_t const *paEntries)
     4064{
     4065    int rc;
     4066    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4067    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamPalette, VERR_INVALID_STATE);
     4068    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4069    AssertReturn(p3dState, VERR_INVALID_STATE);
     4070
     4071    PVMSVGA3DDXCONTEXT pDXContext;
     4072    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4073    AssertRCReturn(rc, rc);
     4074
     4075    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     4076
     4077    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     4078    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     4079    ASSERT_GUEST_RETURN(cEntries <= VBSVGA3D_MAX_VIDEO_PALETTE_ENTRIES, VERR_INVALID_PARAMETER);
     4080    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     4081    RT_UNTRUSTED_VALIDATED_FENCE();
     4082
     4083    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     4084    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     4085    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_PALETTE;
     4086    pStreamState->PaletteCount = cEntries;
     4087    memcpy(pStreamState->aPalette, paEntries, cEntries * sizeof(paEntries[0]));
     4088
     4089    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamPalette(pThisCC, pDXContext, videoProcessorId,
     4090                                                                            pCmd->streamIndex, cEntries, paEntries);
     4091    return rc;
     4092}
     4093
     4094
     4095int vmsvga3dVBDXVideoProcessorSetStreamPixelAspectRatio(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamPixelAspectRatio const *pCmd)
     4096{
     4097    int rc;
     4098    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4099    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamPixelAspectRatio, VERR_INVALID_STATE);
     4100    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4101    AssertReturn(p3dState, VERR_INVALID_STATE);
     4102
     4103    PVMSVGA3DDXCONTEXT pDXContext;
     4104    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4105    AssertRCReturn(rc, rc);
     4106
     4107    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     4108
     4109    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     4110    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     4111    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     4112    RT_UNTRUSTED_VALIDATED_FENCE();
     4113
     4114    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     4115    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     4116    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_ASPECT_RATIO;
     4117    pStreamState->AspectRatioEnable = RT_BOOL(pCmd->enable);
     4118    pStreamState->AspectSourceRatio = pCmd->sourceRatio;
     4119    pStreamState->AspectDestRatio = pCmd->destRatio;
     4120
     4121    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamPixelAspectRatio(pThisCC, pDXContext, videoProcessorId,
     4122                                                                                     pCmd->streamIndex, pCmd->enable, pCmd->sourceRatio, pCmd->destRatio);
     4123    return rc;
     4124}
     4125
     4126
     4127int vmsvga3dVBDXVideoProcessorSetStreamLumaKey(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamLumaKey const *pCmd)
     4128{
     4129    int rc;
     4130    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4131    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamLumaKey, VERR_INVALID_STATE);
     4132    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4133    AssertReturn(p3dState, VERR_INVALID_STATE);
     4134
     4135    PVMSVGA3DDXCONTEXT pDXContext;
     4136    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4137    AssertRCReturn(rc, rc);
     4138
     4139    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     4140
     4141    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     4142    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     4143    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     4144    RT_UNTRUSTED_VALIDATED_FENCE();
     4145
     4146    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     4147    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     4148    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_LUMA_KEY;
     4149    pStreamState->LumaKeyEnable = RT_BOOL(pCmd->enable);
     4150    pStreamState->LumaKeyLower = pCmd->lower;
     4151    pStreamState->LumaKeyUpper = pCmd->upper;
     4152
     4153    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamLumaKey(pThisCC, pDXContext, videoProcessorId,
     4154                                                                            pCmd->streamIndex, pCmd->enable, pCmd->lower, pCmd->upper);
     4155    return rc;
     4156}
     4157
     4158
     4159int vmsvga3dVBDXVideoProcessorSetStreamStereoFormat(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamStereoFormat const *pCmd)
     4160{
     4161    int rc;
     4162    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4163    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamStereoFormat, VERR_INVALID_STATE);
     4164    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4165    AssertReturn(p3dState, VERR_INVALID_STATE);
     4166
     4167    PVMSVGA3DDXCONTEXT pDXContext;
     4168    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4169    AssertRCReturn(rc, rc);
     4170
     4171    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     4172
     4173    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     4174    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     4175    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     4176    RT_UNTRUSTED_VALIDATED_FENCE();
     4177
     4178    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     4179    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     4180    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_STEREO_FORMAT;
     4181    pStreamState->StereoFormatEnable = RT_BOOL(pCmd->enable);
     4182    pStreamState->StereoFormat = pCmd->stereoFormat;
     4183    pStreamState->LeftViewFrame0 = pCmd->leftViewFrame0;
     4184    pStreamState->BaseViewFrame0 = pCmd->baseViewFrame0;
     4185    pStreamState->FlipMode = pCmd->flipMode;
     4186    pStreamState->MonoOffset = pCmd->monoOffset;
     4187
     4188    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamStereoFormat(pThisCC, pDXContext, videoProcessorId,
     4189                                                                                 pCmd->streamIndex, pCmd->enable, pCmd->stereoFormat,
     4190                                                                                 pCmd->leftViewFrame0, pCmd->baseViewFrame0, pCmd->flipMode, pCmd->monoOffset);
     4191    return rc;
     4192}
     4193
     4194
     4195int vmsvga3dVBDXVideoProcessorSetStreamAutoProcessingMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamAutoProcessingMode const *pCmd)
     4196{
     4197    int rc;
     4198    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4199    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamAutoProcessingMode, VERR_INVALID_STATE);
     4200    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4201    AssertReturn(p3dState, VERR_INVALID_STATE);
     4202
     4203    PVMSVGA3DDXCONTEXT pDXContext;
     4204    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4205    AssertRCReturn(rc, rc);
     4206
     4207    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     4208
     4209    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     4210    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     4211    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     4212    RT_UNTRUSTED_VALIDATED_FENCE();
     4213
     4214    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     4215    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     4216    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_AUTO_PROCESSING_MODE;
     4217    pStreamState->AutoProcessingModeEnable = RT_BOOL(pCmd->enable);
     4218
     4219    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamAutoProcessingMode(pThisCC, pDXContext, videoProcessorId,
     4220                                                                                       pCmd->streamIndex, pCmd->enable);
     4221    return rc;
     4222}
     4223
     4224
     4225int vmsvga3dVBDXVideoProcessorSetStreamFilter(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamFilter const *pCmd)
     4226{
     4227    int rc;
     4228    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4229    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamFilter, VERR_INVALID_STATE);
     4230    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4231    AssertReturn(p3dState, VERR_INVALID_STATE);
     4232
     4233    PVMSVGA3DDXCONTEXT pDXContext;
     4234    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4235    AssertRCReturn(rc, rc);
     4236
     4237    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     4238
     4239    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     4240    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     4241    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     4242    ASSERT_GUEST_RETURN(pCmd->filter < VBSVGA3D_VP_MAX_FILTER_COUNT, VERR_INVALID_PARAMETER);
     4243    RT_UNTRUSTED_VALIDATED_FENCE();
     4244
     4245    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     4246    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     4247    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_FILTER;
     4248    if (pCmd->enable)
     4249        pStreamState->FilterEnableMask |= 1 << pCmd->filter;
     4250    else
     4251        pStreamState->FilterEnableMask &= ~(1 << pCmd->filter);
     4252    pStreamState->aFilter[pCmd->filter].Level = pCmd->level;
     4253
     4254    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamFilter(pThisCC, pDXContext, videoProcessorId,
     4255                                                                           pCmd->streamIndex, pCmd->enable, pCmd->filter, pCmd->level);
     4256    return rc;
     4257}
     4258
     4259
     4260int vmsvga3dVBDXVideoProcessorSetStreamRotation(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamRotation const *pCmd)
     4261{
     4262    int rc;
     4263    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4264    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamFilter, VERR_INVALID_STATE);
     4265    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4266    AssertReturn(p3dState, VERR_INVALID_STATE);
     4267
     4268    PVMSVGA3DDXCONTEXT pDXContext;
     4269    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4270    AssertRCReturn(rc, rc);
     4271
     4272    VBSVGA3dVideoProcessorId const videoProcessorId = pCmd->videoProcessorId;
     4273
     4274    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessor, VERR_INVALID_STATE);
     4275    ASSERT_GUEST_RETURN(videoProcessorId < pDXContext->cot.cVideoProcessor, VERR_INVALID_PARAMETER);
     4276    ASSERT_GUEST_RETURN(pCmd->streamIndex < VBSVGA3D_MAX_VIDEO_STREAMS, VERR_INVALID_PARAMETER);
     4277    RT_UNTRUSTED_VALIDATED_FENCE();
     4278
     4279    VBSVGACOTableDXVideoProcessorEntry *pEntry = &pDXContext->cot.paVideoProcessor[videoProcessorId];
     4280    VBSVGA3dVideoProcessorStreamState *pStreamState = &pEntry->aStreamState[pCmd->streamIndex];
     4281    pStreamState->SetMask |= VBSVGA3D_VP_SET_STREAM_ROTATION;
     4282    pStreamState->RotationEnable = RT_BOOL(pCmd->enable);
     4283    pStreamState->Rotation = pCmd->rotation;
     4284
     4285    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXVideoProcessorSetStreamRotation(pThisCC, pDXContext, videoProcessorId,
     4286                                                                           pCmd->streamIndex, pCmd->enable, pCmd->rotation);
     4287    return rc;
     4288}
     4289
     4290
     4291int vmsvga3dVBDXGetVideoCapability(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXGetVideoCapability const *pCmd)
     4292{
     4293    int rc;
     4294    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4295    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXGetVideoCapability, VERR_INVALID_STATE);
     4296    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4297    AssertReturn(p3dState, VERR_INVALID_STATE);
     4298
     4299    PVMSVGA3DDXCONTEXT pDXContext;
     4300    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4301    AssertRCReturn(rc, rc);
     4302
     4303    PVMSVGAMOB pMob = vmsvgaR3MobGet(pSvgaR3State, pCmd->mobid);
     4304    ASSERT_GUEST_RETURN(pMob, VERR_INVALID_PARAMETER);
     4305
     4306    uint32_t const cbMob = vmsvgaR3MobSize(pMob);
     4307    ASSERT_GUEST_RETURN(   pCmd->offsetInBytes < cbMob
     4308                        && pCmd->sizeInBytes <= cbMob - pCmd->offsetInBytes, VERR_INVALID_PARAMETER);
     4309
     4310    ASSERT_GUEST_RETURN(pCmd->sizeInBytes >= RT_UOFFSETOF(VBSVGA3dVideoCapabilityMobLayout, data), VERR_INVALID_PARAMETER);
     4311    RT_UNTRUSTED_VALIDATED_FENCE();
     4312
     4313    /* Create a memory pointer for the MOB, which is accessible by host. */
     4314    rc = vmsvgaR3MobBackingStoreCreate(pSvgaR3State, pMob, cbMob);
     4315    AssertReturn(RT_SUCCESS(rc), rc);
     4316
     4317    /* Get pointer to the data. This will also verify the offset. */
     4318    VBSVGA3dVideoCapabilityMobLayout *pCap = (VBSVGA3dVideoCapabilityMobLayout *)vmsvgaR3MobBackingStorePtr(pMob, pCmd->offsetInBytes);
     4319    AssertReturnStmt(pCap, vmsvgaR3MobBackingStoreDelete(pSvgaR3State, pMob), VERR_INTERNAL_ERROR);
     4320
     4321    pCap->cbDataOut = 0;
     4322    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXGetVideoCapability(pThisCC, pDXContext, pCmd->capability, &pCap->data,
     4323                                                                pCmd->sizeInBytes - RT_UOFFSETOF(VBSVGA3dVideoCapabilityMobLayout, data),
     4324                                                                &pCap->cbDataOut);
     4325
     4326    pCap->fenceValue = pCmd->fenceValue;
     4327    if (RT_SUCCESS(rc))
     4328        vmsvgaR3MobBackingStoreWriteToGuest(pSvgaR3State, pMob);
     4329
     4330    vmsvgaR3MobBackingStoreDelete(pSvgaR3State, pMob);
     4331    return rc;
     4332}
     4333
     4334
     4335int vmsvga3dVBDXClearRTV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView const *pCmd, uint32_t cRect, SVGASignedRect const *paRect)
     4336{
     4337    int rc;
     4338    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4339    AssertReturn(pSvgaR3State->pFuncsDX && pSvgaR3State->pFuncsDX->pfnVBDXClearRenderTargetViewRegion, VERR_INVALID_STATE);
     4340    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4341    AssertReturn(p3dState, VERR_INVALID_STATE);
     4342
     4343    PVMSVGA3DDXCONTEXT pDXContext;
     4344    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4345    AssertRCReturn(rc, rc);
     4346
     4347    SVGA3dRenderTargetViewId const renderTargetViewId = pCmd->viewId;
     4348
     4349    ASSERT_GUEST_RETURN(pDXContext->cot.paRTView, VERR_INVALID_STATE);
     4350    ASSERT_GUEST_RETURN(renderTargetViewId < pDXContext->cot.cRTView, VERR_INVALID_PARAMETER);
     4351    ASSERT_GUEST_RETURN(cRect <= 65536, VERR_INVALID_PARAMETER); /* Arbitrary limit. */
     4352    RT_UNTRUSTED_VALIDATED_FENCE();
     4353
     4354    rc = pSvgaR3State->pFuncsDX->pfnVBDXClearRenderTargetViewRegion(pThisCC, pDXContext, renderTargetViewId, &pCmd->color, cRect, paRect);
     4355    return rc;
     4356}
     4357
     4358
     4359int vmsvga3dVBDXClearUAV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView const *pCmd, uint32_t cRect, SVGASignedRect const *paRect)
     4360{
     4361    int rc;
     4362    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4363    AssertReturn(pSvgaR3State->pFuncsDX && pSvgaR3State->pFuncsDX->pfnVBDXClearUAV, VERR_INVALID_STATE);
     4364    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4365    AssertReturn(p3dState, VERR_INVALID_STATE);
     4366
     4367    PVMSVGA3DDXCONTEXT pDXContext;
     4368    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4369    AssertRCReturn(rc, rc);
     4370
     4371    SVGA3dUAViewId const viewId = pCmd->viewId;
     4372
     4373    ASSERT_GUEST_RETURN(pDXContext->cot.paUAView, VERR_INVALID_STATE);
     4374    ASSERT_GUEST_RETURN(viewId < pDXContext->cot.cUAView, VERR_INVALID_PARAMETER);
     4375    ASSERT_GUEST_RETURN(cRect <= 65536, VERR_INVALID_PARAMETER); /* Arbitrary limit. */
     4376    RT_UNTRUSTED_VALIDATED_FENCE();
     4377
     4378    rc = pSvgaR3State->pFuncsDX->pfnVBDXClearUAV(pThisCC, pDXContext, viewId, &pCmd->color, cRect, paRect);
     4379    return rc;
     4380}
     4381
     4382
     4383int vmsvga3dVBDXClearVDOV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView const *pCmd, uint32_t cRect, SVGASignedRect const *paRect)
     4384{
     4385    int rc;
     4386    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4387    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXClearVDOV, VERR_INVALID_STATE);
     4388    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4389    AssertReturn(p3dState, VERR_INVALID_STATE);
     4390
     4391    PVMSVGA3DDXCONTEXT pDXContext;
     4392    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4393    AssertRCReturn(rc, rc);
     4394
     4395    VBSVGA3dVideoDecoderOutputViewId const viewId = pCmd->viewId;
     4396
     4397    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoDecoderOutputView, VERR_INVALID_STATE);
     4398    ASSERT_GUEST_RETURN(viewId < pDXContext->cot.cVideoDecoderOutputView, VERR_INVALID_PARAMETER);
     4399    ASSERT_GUEST_RETURN(cRect <= 65536, VERR_INVALID_PARAMETER); /* Arbitrary limit. */
     4400    RT_UNTRUSTED_VALIDATED_FENCE();
     4401
     4402    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXClearVDOV(pThisCC, pDXContext, viewId, &pCmd->color, cRect, paRect);
     4403    return rc;
     4404}
     4405
     4406
     4407int vmsvga3dVBDXClearVPIV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView const *pCmd, uint32_t cRect, SVGASignedRect const *paRect)
     4408{
     4409    int rc;
     4410    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4411    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXClearVPIV, VERR_INVALID_STATE);
     4412    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4413    AssertReturn(p3dState, VERR_INVALID_STATE);
     4414
     4415    PVMSVGA3DDXCONTEXT pDXContext;
     4416    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4417    AssertRCReturn(rc, rc);
     4418
     4419    VBSVGA3dVideoProcessorInputViewId const viewId = pCmd->viewId;
     4420
     4421    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessorInputView, VERR_INVALID_STATE);
     4422    ASSERT_GUEST_RETURN(viewId < pDXContext->cot.cVideoProcessorInputView, VERR_INVALID_PARAMETER);
     4423    ASSERT_GUEST_RETURN(cRect <= 65536, VERR_INVALID_PARAMETER); /* Arbitrary limit. */
     4424    RT_UNTRUSTED_VALIDATED_FENCE();
     4425
     4426    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXClearVPIV(pThisCC, pDXContext, viewId, &pCmd->color, cRect, paRect);
     4427    return rc;
     4428}
     4429
     4430
     4431int vmsvga3dVBDXClearVPOV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView const *pCmd, uint32_t cRect, SVGASignedRect const *paRect)
     4432{
     4433    int rc;
     4434    PVMSVGAR3STATE const pSvgaR3State = pThisCC->svga.pSvgaR3State;
     4435    AssertReturn(pSvgaR3State->pFuncsDXVideo && pSvgaR3State->pFuncsDXVideo->pfnVBDXClearVPOV, VERR_INVALID_STATE);
     4436    PVMSVGA3DSTATE p3dState = pThisCC->svga.p3dState;
     4437    AssertReturn(p3dState, VERR_INVALID_STATE);
     4438
     4439    PVMSVGA3DDXCONTEXT pDXContext;
     4440    rc = vmsvga3dDXContextFromCid(p3dState, idDXContext, &pDXContext);
     4441    AssertRCReturn(rc, rc);
     4442
     4443    VBSVGA3dVideoProcessorOutputViewId const viewId = pCmd->viewId;
     4444
     4445    ASSERT_GUEST_RETURN(pDXContext->cot.paVideoProcessorOutputView, VERR_INVALID_STATE);
     4446    ASSERT_GUEST_RETURN(viewId < pDXContext->cot.cVideoProcessorOutputView, VERR_INVALID_PARAMETER);
     4447    ASSERT_GUEST_RETURN(cRect <= 65536, VERR_INVALID_PARAMETER); /* Arbitrary limit. */
     4448    RT_UNTRUSTED_VALIDATED_FENCE();
     4449
     4450    rc = pSvgaR3State->pFuncsDXVideo->pfnVBDXClearVPOV(pThisCC, pDXContext, viewId, &pCmd->color, cRect, paRect);
     4451    return rc;
     4452}
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-info.cpp

    r98103 r102520  
    668668    /** @todo try keep aspect...   */
    669669    uint32_t const cchLine = (cx + cxPerChar - 1) / cxPerChar;
    670     uint32_t const cbSrcPixel = vmsvga3dSurfaceFormatSize(enmFormat, NULL, NULL);
     670    uint32_t u32Dummy;
     671    uint32_t const cbSrcPixel = vmsvga3dSurfaceFormatSize(enmFormat, &u32Dummy, &u32Dummy, &u32Dummy);
    671672
    672673    /*
     
    17491750                    pszPath, pszNamePrefix, u32Seq, pSurface->id, i, pszNameSuffix);
    17501751
    1751         const uint32_t cbPixel = vmsvga3dSurfaceFormatSize(pSurface->format, NULL, NULL);
     1752        uint32_t u32Dummy;
     1753        const uint32_t cbPixel = vmsvga3dSurfaceFormatSize(pSurface->format, &u32Dummy, &u32Dummy, &u32Dummy);
    17521754        int rc = vmsvga3dInfoBmpWrite(szFilepath,
    17531755                                      pSurface->paMipmapLevels[i].pSurfaceData,
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-internal.h

    r98103 r102520  
    426426    /** Number of blocks: cBlocksX * cBlocksY * mipmapSize.depth. SSM: not saved, recalculated on load. */
    427427    uint32_t                cBlocks;
    428     /** The scanline/pitch size in bytes: at least cBlocksX * cbBlock. */
     428    /** The scanline/pitch size in bytes: at least cBlocksX * cbPitchBlock. */
    429429    uint32_t                cbSurfacePitch;
    430430    /** The size (in bytes) of the mipmap plane: cbSurfacePitch * cBlocksY */
     
    611611
    612612    uint32_t                cbBlock;        /* block/pixel size in bytes */
     613    uint32_t                cbPitchBlock;   /* block/pixel size of one row in bytes */
    613614    /* Dimensions of the surface block, usually 1x1 except for compressed formats. */
    614615    uint32_t                cxBlock;        /* Block width in pixels. SSM: not saved, recalculated on load. */
     
    9991000    SVGADXContextMobFormat    svgaDXContext;
    10001001    /* Context-Object Tables bound to this context. */
    1001     PVMSVGAMOB aCOTMobs[SVGA_COTABLE_MAX];
     1002    PVMSVGAMOB aCOTMobs[VBSVGA_NUM_COTABLES];
    10021003    struct
    10031004    {
     
    10261027        uint32_t                           cShader;
    10271028        uint32_t                           cUAView;
     1029
     1030        VBSVGACOTableDXVideoProcessorEntry *paVideoProcessor;
     1031        VBSVGACOTableDXVideoDecoderOutputViewEntry  *paVideoDecoderOutputView;
     1032        VBSVGACOTableDXVideoDecoderEntry  *paVideoDecoder;
     1033        VBSVGACOTableDXVideoProcessorInputViewEntry  *paVideoProcessorInputView;
     1034        VBSVGACOTableDXVideoProcessorOutputViewEntry  *paVideoProcessorOutputView;
     1035        uint32_t                           cVideoProcessor;
     1036        uint32_t                           cVideoDecoderOutputView;
     1037        uint32_t                           cVideoDecoder;
     1038        uint32_t                           cVideoProcessorInputView;
     1039        uint32_t                           cVideoProcessorOutputView;
    10281040    } cot;
    10291041} VMSVGA3DDXCONTEXT;
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d-shared.cpp

    r98103 r102520  
    5252#define VMSVGA3D_INCL_STRUCTURE_DESCRIPTORS
    5353#include "DevVGA-SVGA3d-internal.h"
     54
     55/* VMSVGA header with information about pixel formats. Declares a static array. */
     56#include "vmsvga_headers_begin.h"
     57#pragma pack(1) /* VMSVGA structures are '__packed'. */
     58#include <svga3d_surfacedefs.h>
     59#pragma pack()
     60#include "vmsvga_headers_end.h"
    5461
    5562
     
    296303uint32_t vmsvga3dSurfaceFormatSize(SVGA3dSurfaceFormat format,
    297304                                   uint32_t *pcxBlock,
    298                                    uint32_t *pcyBlock)
    299 {
    300     uint32_t u32 = 0;
    301     if (!pcxBlock) pcxBlock = &u32;
    302     if (!pcyBlock) pcyBlock = &u32;
    303 
    304     switch (format)
    305     {
    306     case SVGA3D_X8R8G8B8:
    307         *pcxBlock = 1;
    308         *pcyBlock = 1;
    309         return 4;
    310 
    311     case SVGA3D_A8R8G8B8:
    312         *pcxBlock = 1;
    313         *pcyBlock = 1;
    314         return 4;
    315 
    316     case SVGA3D_R5G6B5:
    317         *pcxBlock = 1;
    318         *pcyBlock = 1;
    319         return 2;
    320 
    321     case SVGA3D_X1R5G5B5:
    322         *pcxBlock = 1;
    323         *pcyBlock = 1;
    324         return 2;
    325 
    326     case SVGA3D_A1R5G5B5:
    327         *pcxBlock = 1;
    328         *pcyBlock = 1;
    329         return 2;
    330 
    331     case SVGA3D_A4R4G4B4:
    332         *pcxBlock = 1;
    333         *pcyBlock = 1;
    334         return 2;
    335 
    336     case SVGA3D_Z_D32:
    337         *pcxBlock = 1;
    338         *pcyBlock = 1;
    339         return 4;
    340 
    341     case SVGA3D_Z_D16:
    342         *pcxBlock = 1;
    343         *pcyBlock = 1;
    344         return 2;
    345 
    346     case SVGA3D_Z_D24S8:
    347         *pcxBlock = 1;
    348         *pcyBlock = 1;
    349         return 4;
    350 
    351     case SVGA3D_Z_D15S1:
    352         *pcxBlock = 1;
    353         *pcyBlock = 1;
    354         return 2;
    355 
    356     case SVGA3D_LUMINANCE8:
    357         *pcxBlock = 1;
    358         *pcyBlock = 1;
    359         return 1;
    360 
    361     case SVGA3D_LUMINANCE4_ALPHA4:
    362         *pcxBlock = 1;
    363         *pcyBlock = 1;
    364         return 1;
    365 
    366     case SVGA3D_LUMINANCE16:
    367         *pcxBlock = 1;
    368         *pcyBlock = 1;
    369         return 2;
    370 
    371     case SVGA3D_LUMINANCE8_ALPHA8:
    372         *pcxBlock = 1;
    373         *pcyBlock = 1;
    374         return 2;
    375 
    376     case SVGA3D_DXT1:
    377         *pcxBlock = 4;
    378         *pcyBlock = 4;
    379         return 8;
    380 
    381     case SVGA3D_DXT2:
    382         *pcxBlock = 4;
    383         *pcyBlock = 4;
    384         return 16;
    385 
    386     case SVGA3D_DXT3:
    387         *pcxBlock = 4;
    388         *pcyBlock = 4;
    389         return 16;
    390 
    391     case SVGA3D_DXT4:
    392         *pcxBlock = 4;
    393         *pcyBlock = 4;
    394         return 16;
    395 
    396     case SVGA3D_DXT5:
    397         *pcxBlock = 4;
    398         *pcyBlock = 4;
    399         return 16;
    400 
    401     case SVGA3D_BUMPU8V8:
    402         *pcxBlock = 1;
    403         *pcyBlock = 1;
    404         return 2;
    405 
    406     case SVGA3D_BUMPL6V5U5:
    407         *pcxBlock = 1;
    408         *pcyBlock = 1;
    409         return 2;
    410 
    411     case SVGA3D_BUMPX8L8V8U8:
    412         *pcxBlock = 1;
    413         *pcyBlock = 1;
    414         return 4;
    415 
    416     case SVGA3D_FORMAT_DEAD1:
    417         *pcxBlock = 1;
    418         *pcyBlock = 1;
    419         return 3;
    420 
    421     case SVGA3D_ARGB_S10E5:
    422         *pcxBlock = 1;
    423         *pcyBlock = 1;
    424         return 8;
    425 
    426     case SVGA3D_ARGB_S23E8:
    427         *pcxBlock = 1;
    428         *pcyBlock = 1;
    429         return 16;
    430 
    431     case SVGA3D_A2R10G10B10:
    432         *pcxBlock = 1;
    433         *pcyBlock = 1;
    434         return 4;
    435 
    436     case SVGA3D_V8U8:
    437         *pcxBlock = 1;
    438         *pcyBlock = 1;
    439         return 2;
    440 
    441     case SVGA3D_Q8W8V8U8:
    442         *pcxBlock = 1;
    443         *pcyBlock = 1;
    444         return 4;
    445 
    446     case SVGA3D_CxV8U8:
    447         *pcxBlock = 1;
    448         *pcyBlock = 1;
    449         return 2;
    450 
    451     case SVGA3D_X8L8V8U8:
    452         *pcxBlock = 1;
    453         *pcyBlock = 1;
    454         return 4;
    455 
    456     case SVGA3D_A2W10V10U10:
    457         *pcxBlock = 1;
    458         *pcyBlock = 1;
    459         return 4;
    460 
    461     case SVGA3D_ALPHA8:
    462         *pcxBlock = 1;
    463         *pcyBlock = 1;
    464         return 1;
    465 
    466     case SVGA3D_R_S10E5:
    467         *pcxBlock = 1;
    468         *pcyBlock = 1;
    469         return 2;
    470 
    471     case SVGA3D_R_S23E8:
    472         *pcxBlock = 1;
    473         *pcyBlock = 1;
    474         return 4;
    475 
    476     case SVGA3D_RG_S10E5:
    477         *pcxBlock = 1;
    478         *pcyBlock = 1;
    479         return 4;
    480 
    481     case SVGA3D_RG_S23E8:
    482         *pcxBlock = 1;
    483         *pcyBlock = 1;
    484         return 8;
    485 
    486     case SVGA3D_BUFFER:
    487         *pcxBlock = 1;
    488         *pcyBlock = 1;
    489         return 1;
    490 
    491     case SVGA3D_Z_D24X8:
    492         *pcxBlock = 1;
    493         *pcyBlock = 1;
    494         return 4;
    495 
    496     case SVGA3D_V16U16:
    497         *pcxBlock = 1;
    498         *pcyBlock = 1;
    499         return 4;
    500 
    501     case SVGA3D_G16R16:
    502         *pcxBlock = 1;
    503         *pcyBlock = 1;
    504         return 4;
    505 
    506     case SVGA3D_A16B16G16R16:
    507         *pcxBlock = 1;
    508         *pcyBlock = 1;
    509         return 8;
    510 
    511     case SVGA3D_UYVY:
    512         *pcxBlock = 2;
    513         *pcyBlock = 1;
    514         return 4;
    515 
    516     case SVGA3D_YUY2:
    517         *pcxBlock = 2;
    518         *pcyBlock = 1;
    519         return 4;
    520 
    521     case SVGA3D_NV12:
    522         *pcxBlock = 2;
    523         *pcyBlock = 2;
    524         return 6;
    525 
    526     case SVGA3D_FORMAT_DEAD2:
    527         *pcxBlock = 1;
    528         *pcyBlock = 1;
    529         return 4;
    530 
    531     case SVGA3D_R32G32B32A32_TYPELESS:
    532         *pcxBlock = 1;
    533         *pcyBlock = 1;
    534         return 16;
    535 
    536     case SVGA3D_R32G32B32A32_UINT:
    537         *pcxBlock = 1;
    538         *pcyBlock = 1;
    539         return 16;
    540 
    541     case SVGA3D_R32G32B32A32_SINT:
    542         *pcxBlock = 1;
    543         *pcyBlock = 1;
    544         return 16;
    545 
    546     case SVGA3D_R32G32B32_TYPELESS:
    547         *pcxBlock = 1;
    548         *pcyBlock = 1;
    549         return 12;
    550 
    551     case SVGA3D_R32G32B32_FLOAT:
    552         *pcxBlock = 1;
    553         *pcyBlock = 1;
    554         return 12;
    555 
    556     case SVGA3D_R32G32B32_UINT:
    557         *pcxBlock = 1;
    558         *pcyBlock = 1;
    559         return 12;
    560 
    561     case SVGA3D_R32G32B32_SINT:
    562         *pcxBlock = 1;
    563         *pcyBlock = 1;
    564         return 12;
    565 
    566     case SVGA3D_R16G16B16A16_TYPELESS:
    567         *pcxBlock = 1;
    568         *pcyBlock = 1;
    569         return 8;
    570 
    571     case SVGA3D_R16G16B16A16_UINT:
    572         *pcxBlock = 1;
    573         *pcyBlock = 1;
    574         return 8;
    575 
    576     case SVGA3D_R16G16B16A16_SNORM:
    577         *pcxBlock = 1;
    578         *pcyBlock = 1;
    579         return 8;
    580 
    581     case SVGA3D_R16G16B16A16_SINT:
    582         *pcxBlock = 1;
    583         *pcyBlock = 1;
    584         return 8;
    585 
    586     case SVGA3D_R32G32_TYPELESS:
    587         *pcxBlock = 1;
    588         *pcyBlock = 1;
    589         return 8;
    590 
    591     case SVGA3D_R32G32_UINT:
    592         *pcxBlock = 1;
    593         *pcyBlock = 1;
    594         return 8;
    595 
    596     case SVGA3D_R32G32_SINT:
    597         *pcxBlock = 1;
    598         *pcyBlock = 1;
    599         return 8;
    600 
    601     case SVGA3D_R32G8X24_TYPELESS:
    602         *pcxBlock = 1;
    603         *pcyBlock = 1;
    604         return 8;
    605 
    606     case SVGA3D_D32_FLOAT_S8X24_UINT:
    607         *pcxBlock = 1;
    608         *pcyBlock = 1;
    609         return 8;
    610 
    611     case SVGA3D_R32_FLOAT_X8X24:
    612         *pcxBlock = 1;
    613         *pcyBlock = 1;
    614         return 8;
    615 
    616     case SVGA3D_X32_G8X24_UINT:
    617         *pcxBlock = 1;
    618         *pcyBlock = 1;
    619         return 8;
    620 
    621     case SVGA3D_R10G10B10A2_TYPELESS:
    622         *pcxBlock = 1;
    623         *pcyBlock = 1;
    624         return 4;
    625 
    626     case SVGA3D_R10G10B10A2_UINT:
    627         *pcxBlock = 1;
    628         *pcyBlock = 1;
    629         return 4;
    630 
    631     case SVGA3D_R11G11B10_FLOAT:
    632         *pcxBlock = 1;
    633         *pcyBlock = 1;
    634         return 4;
    635 
    636     case SVGA3D_R8G8B8A8_TYPELESS:
    637         *pcxBlock = 1;
    638         *pcyBlock = 1;
    639         return 4;
    640 
    641     case SVGA3D_R8G8B8A8_UNORM:
    642         *pcxBlock = 1;
    643         *pcyBlock = 1;
    644         return 4;
    645 
    646     case SVGA3D_R8G8B8A8_UNORM_SRGB:
    647         *pcxBlock = 1;
    648         *pcyBlock = 1;
    649         return 4;
    650 
    651     case SVGA3D_R8G8B8A8_UINT:
    652         *pcxBlock = 1;
    653         *pcyBlock = 1;
    654         return 4;
    655 
    656     case SVGA3D_R8G8B8A8_SINT:
    657         *pcxBlock = 1;
    658         *pcyBlock = 1;
    659         return 4;
    660 
    661     case SVGA3D_R16G16_TYPELESS:
    662         *pcxBlock = 1;
    663         *pcyBlock = 1;
    664         return 4;
    665 
    666     case SVGA3D_R16G16_UINT:
    667         *pcxBlock = 1;
    668         *pcyBlock = 1;
    669         return 4;
    670 
    671     case SVGA3D_R16G16_SINT:
    672         *pcxBlock = 1;
    673         *pcyBlock = 1;
    674         return 4;
    675 
    676     case SVGA3D_R32_TYPELESS:
    677         *pcxBlock = 1;
    678         *pcyBlock = 1;
    679         return 4;
    680 
    681     case SVGA3D_D32_FLOAT:
    682         *pcxBlock = 1;
    683         *pcyBlock = 1;
    684         return 4;
    685 
    686     case SVGA3D_R32_UINT:
    687         *pcxBlock = 1;
    688         *pcyBlock = 1;
    689         return 4;
    690 
    691     case SVGA3D_R32_SINT:
    692         *pcxBlock = 1;
    693         *pcyBlock = 1;
    694         return 4;
    695 
    696     case SVGA3D_R24G8_TYPELESS:
    697         *pcxBlock = 1;
    698         *pcyBlock = 1;
    699         return 4;
    700 
    701     case SVGA3D_D24_UNORM_S8_UINT:
    702         *pcxBlock = 1;
    703         *pcyBlock = 1;
    704         return 4;
    705 
    706     case SVGA3D_R24_UNORM_X8:
    707         *pcxBlock = 1;
    708         *pcyBlock = 1;
    709         return 4;
    710 
    711     case SVGA3D_X24_G8_UINT:
    712         *pcxBlock = 1;
    713         *pcyBlock = 1;
    714         return 4;
    715 
    716     case SVGA3D_R8G8_TYPELESS:
    717         *pcxBlock = 1;
    718         *pcyBlock = 1;
    719         return 2;
    720 
    721     case SVGA3D_R8G8_UNORM:
    722         *pcxBlock = 1;
    723         *pcyBlock = 1;
    724         return 2;
    725 
    726     case SVGA3D_R8G8_UINT:
    727         *pcxBlock = 1;
    728         *pcyBlock = 1;
    729         return 2;
    730 
    731     case SVGA3D_R8G8_SINT:
    732         *pcxBlock = 1;
    733         *pcyBlock = 1;
    734         return 2;
    735 
    736     case SVGA3D_R16_TYPELESS:
    737         *pcxBlock = 1;
    738         *pcyBlock = 1;
    739         return 2;
    740 
    741     case SVGA3D_R16_UNORM:
    742         *pcxBlock = 1;
    743         *pcyBlock = 1;
    744         return 2;
    745 
    746     case SVGA3D_R16_UINT:
    747         *pcxBlock = 1;
    748         *pcyBlock = 1;
    749         return 2;
    750 
    751     case SVGA3D_R16_SNORM:
    752         *pcxBlock = 1;
    753         *pcyBlock = 1;
    754         return 2;
    755 
    756     case SVGA3D_R16_SINT:
    757         *pcxBlock = 1;
    758         *pcyBlock = 1;
    759         return 2;
    760 
    761     case SVGA3D_R8_TYPELESS:
    762         *pcxBlock = 1;
    763         *pcyBlock = 1;
    764         return 1;
    765 
    766     case SVGA3D_R8_UNORM:
    767         *pcxBlock = 1;
    768         *pcyBlock = 1;
    769         return 1;
    770 
    771     case SVGA3D_R8_UINT:
    772         *pcxBlock = 1;
    773         *pcyBlock = 1;
    774         return 1;
    775 
    776     case SVGA3D_R8_SNORM:
    777         *pcxBlock = 1;
    778         *pcyBlock = 1;
    779         return 1;
    780 
    781     case SVGA3D_R8_SINT:
    782         *pcxBlock = 1;
    783         *pcyBlock = 1;
    784         return 1;
    785 
    786     case SVGA3D_P8:
    787         *pcxBlock = 1;
    788         *pcyBlock = 1;
    789         return 1;
    790 
    791     case SVGA3D_R9G9B9E5_SHAREDEXP:
    792         *pcxBlock = 1;
    793         *pcyBlock = 1;
    794         return 4;
    795 
    796     case SVGA3D_R8G8_B8G8_UNORM:
    797         *pcxBlock = 2;
    798         *pcyBlock = 1;
    799         return 4;
    800 
    801     case SVGA3D_G8R8_G8B8_UNORM:
    802         *pcxBlock = 2;
    803         *pcyBlock = 1;
    804         return 4;
    805 
    806     case SVGA3D_BC1_TYPELESS:
    807         *pcxBlock = 4;
    808         *pcyBlock = 4;
    809         return 8;
    810 
    811     case SVGA3D_BC1_UNORM_SRGB:
    812         *pcxBlock = 4;
    813         *pcyBlock = 4;
    814         return 8;
    815 
    816     case SVGA3D_BC2_TYPELESS:
    817         *pcxBlock = 4;
    818         *pcyBlock = 4;
    819         return 16;
    820 
    821     case SVGA3D_BC2_UNORM_SRGB:
    822         *pcxBlock = 4;
    823         *pcyBlock = 4;
    824         return 16;
    825 
    826     case SVGA3D_BC3_TYPELESS:
    827         *pcxBlock = 4;
    828         *pcyBlock = 4;
    829         return 16;
    830 
    831     case SVGA3D_BC3_UNORM_SRGB:
    832         *pcxBlock = 4;
    833         *pcyBlock = 4;
    834         return 16;
    835 
    836     case SVGA3D_BC4_TYPELESS:
    837         *pcxBlock = 4;
    838         *pcyBlock = 4;
    839         return 8;
    840 
    841     case SVGA3D_ATI1:
    842         *pcxBlock = 4;
    843         *pcyBlock = 4;
    844         return 8;
    845 
    846     case SVGA3D_BC4_SNORM:
    847         *pcxBlock = 4;
    848         *pcyBlock = 4;
    849         return 8;
    850 
    851     case SVGA3D_BC5_TYPELESS:
    852         *pcxBlock = 4;
    853         *pcyBlock = 4;
    854         return 16;
    855 
    856     case SVGA3D_ATI2:
    857         *pcxBlock = 4;
    858         *pcyBlock = 4;
    859         return 16;
    860 
    861     case SVGA3D_BC5_SNORM:
    862         *pcxBlock = 4;
    863         *pcyBlock = 4;
    864         return 16;
    865 
    866     case SVGA3D_R10G10B10_XR_BIAS_A2_UNORM:
    867         *pcxBlock = 1;
    868         *pcyBlock = 1;
    869         return 4;
    870 
    871     case SVGA3D_B8G8R8A8_TYPELESS:
    872         *pcxBlock = 1;
    873         *pcyBlock = 1;
    874         return 4;
    875 
    876     case SVGA3D_B8G8R8A8_UNORM_SRGB:
    877         *pcxBlock = 1;
    878         *pcyBlock = 1;
    879         return 4;
    880 
    881     case SVGA3D_B8G8R8X8_TYPELESS:
    882         *pcxBlock = 1;
    883         *pcyBlock = 1;
    884         return 4;
    885 
    886     case SVGA3D_B8G8R8X8_UNORM_SRGB:
    887         *pcxBlock = 1;
    888         *pcyBlock = 1;
    889         return 4;
    890 
    891     case SVGA3D_Z_DF16:
    892         *pcxBlock = 1;
    893         *pcyBlock = 1;
    894         return 2;
    895 
    896     case SVGA3D_Z_DF24:
    897         *pcxBlock = 1;
    898         *pcyBlock = 1;
    899         return 4;
    900 
    901     case SVGA3D_Z_D24S8_INT:
    902         *pcxBlock = 1;
    903         *pcyBlock = 1;
    904         return 4;
    905 
    906     case SVGA3D_YV12:
    907         *pcxBlock = 2;
    908         *pcyBlock = 2;
    909         return 6;
    910 
    911     case SVGA3D_R32G32B32A32_FLOAT:
    912         *pcxBlock = 1;
    913         *pcyBlock = 1;
    914         return 16;
    915 
    916     case SVGA3D_R16G16B16A16_FLOAT:
    917         *pcxBlock = 1;
    918         *pcyBlock = 1;
    919         return 8;
    920 
    921     case SVGA3D_R16G16B16A16_UNORM:
    922         *pcxBlock = 1;
    923         *pcyBlock = 1;
    924         return 8;
    925 
    926     case SVGA3D_R32G32_FLOAT:
    927         *pcxBlock = 1;
    928         *pcyBlock = 1;
    929         return 8;
    930 
    931     case SVGA3D_R10G10B10A2_UNORM:
    932         *pcxBlock = 1;
    933         *pcyBlock = 1;
    934         return 4;
    935 
    936     case SVGA3D_R8G8B8A8_SNORM:
    937         *pcxBlock = 1;
    938         *pcyBlock = 1;
    939         return 4;
    940 
    941     case SVGA3D_R16G16_FLOAT:
    942         *pcxBlock = 1;
    943         *pcyBlock = 1;
    944         return 4;
    945 
    946     case SVGA3D_R16G16_UNORM:
    947         *pcxBlock = 1;
    948         *pcyBlock = 1;
    949         return 4;
    950 
    951     case SVGA3D_R16G16_SNORM:
    952         *pcxBlock = 1;
    953         *pcyBlock = 1;
    954         return 4;
    955 
    956     case SVGA3D_R32_FLOAT:
    957         *pcxBlock = 1;
    958         *pcyBlock = 1;
    959         return 4;
    960 
    961     case SVGA3D_R8G8_SNORM:
    962         *pcxBlock = 1;
    963         *pcyBlock = 1;
    964         return 2;
    965 
    966     case SVGA3D_R16_FLOAT:
    967         *pcxBlock = 1;
    968         *pcyBlock = 1;
    969         return 2;
    970 
    971     case SVGA3D_D16_UNORM:
    972         *pcxBlock = 1;
    973         *pcyBlock = 1;
    974         return 2;
    975 
    976     case SVGA3D_A8_UNORM:
    977         *pcxBlock = 1;
    978         *pcyBlock = 1;
    979         return 1;
    980 
    981     case SVGA3D_BC1_UNORM:
    982         *pcxBlock = 4;
    983         *pcyBlock = 4;
    984         return 8;
    985 
    986     case SVGA3D_BC2_UNORM:
    987         *pcxBlock = 4;
    988         *pcyBlock = 4;
    989         return 16;
    990 
    991     case SVGA3D_BC3_UNORM:
    992         *pcxBlock = 4;
    993         *pcyBlock = 4;
    994         return 16;
    995 
    996     case SVGA3D_B5G6R5_UNORM:
    997         *pcxBlock = 1;
    998         *pcyBlock = 1;
    999         return 2;
    1000 
    1001     case SVGA3D_B5G5R5A1_UNORM:
    1002         *pcxBlock = 1;
    1003         *pcyBlock = 1;
    1004         return 2;
    1005 
    1006     case SVGA3D_B8G8R8A8_UNORM:
    1007         *pcxBlock = 1;
    1008         *pcyBlock = 1;
    1009         return 4;
    1010 
    1011     case SVGA3D_B8G8R8X8_UNORM:
    1012         *pcxBlock = 1;
    1013         *pcyBlock = 1;
    1014         return 4;
    1015 
    1016     case SVGA3D_BC4_UNORM:
    1017         *pcxBlock = 4;
    1018         *pcyBlock = 4;
    1019         return 8;
    1020 
    1021     case SVGA3D_BC5_UNORM:
    1022         *pcxBlock = 4;
    1023         *pcyBlock = 4;
    1024         return 16;
    1025 
    1026     case SVGA3D_B4G4R4A4_UNORM:
    1027         *pcxBlock = 1;
    1028         *pcyBlock = 1;
    1029         return 2;
    1030 
    1031     case SVGA3D_BC6H_TYPELESS:
    1032         *pcxBlock = 4;
    1033         *pcyBlock = 4;
    1034         return 16;
    1035 
    1036     case SVGA3D_BC6H_UF16:
    1037         *pcxBlock = 4;
    1038         *pcyBlock = 4;
    1039         return 16;
    1040 
    1041     case SVGA3D_BC6H_SF16:
    1042         *pcxBlock = 4;
    1043         *pcyBlock = 4;
    1044         return 16;
    1045 
    1046     case SVGA3D_BC7_TYPELESS:
    1047         *pcxBlock = 4;
    1048         *pcyBlock = 4;
    1049         return 16;
    1050 
    1051     case SVGA3D_BC7_UNORM:
    1052         *pcxBlock = 4;
    1053         *pcyBlock = 4;
    1054         return 16;
    1055 
    1056     case SVGA3D_BC7_UNORM_SRGB:
    1057         *pcxBlock = 4;
    1058         *pcyBlock = 4;
    1059         return 16;
    1060 
    1061     case SVGA3D_AYUV:
    1062         *pcxBlock = 1;
    1063         *pcyBlock = 1;
    1064         return 4;
    1065 
    1066     default:
    1067         *pcxBlock = 1;
    1068         *pcyBlock = 1;
    1069         AssertFailedReturn(4);
    1070     }
     305                                   uint32_t *pcyBlock,
     306                                   uint32_t *pcbPitchBlock)
     307{
     308    const struct svga3d_surface_desc *desc = svga3dsurface_get_desc(format);
     309    *pcxBlock = desc->block_size.width;
     310    *pcyBlock = desc->block_size.height;
     311    *pcbPitchBlock = desc->pitch_bytes_per_block;
     312    return desc->bytes_per_block;
     313}
     314
     315void vmsvga3dSurfaceMipBufferSize(SVGA3dSurfaceFormat format, SVGA3dSize mipmapSize,
     316                                  uint32_t *pcBlocksX,
     317                                  uint32_t *pcBlocksY,
     318                                  uint32_t *pcbSurfacePitch,
     319                                  uint32_t *pcbSurfacePlane,
     320                                  uint32_t *pcbSurface)
     321{
     322    const struct svga3d_surface_desc *desc = svga3dsurface_get_desc(format);
     323
     324    uint32_t const cxBlocks = (mipmapSize.width + desc->block_size.width - 1) / desc->block_size.width;
     325    uint32_t const cyBlocks = (mipmapSize.height + desc->block_size.height - 1) / desc->block_size.height;
     326    uint32_t const czBlocks = (mipmapSize.depth + desc->block_size.depth - 1) / desc->block_size.depth;
     327
     328    uint32_t const cbPitch = cxBlocks * desc->pitch_bytes_per_block;
     329
     330    uint32_t cbSurfacePlane = clamped_umul32(cxBlocks, cyBlocks);
     331    cbSurfacePlane = clamped_umul32(cbSurfacePlane, desc->bytes_per_block);
     332
     333    uint32_t const cbSurface = clamped_umul32(cbSurfacePlane, czBlocks);
     334
     335    *pcBlocksX = cxBlocks;
     336    *pcBlocksY = cyBlocks;
     337    *pcbSurfacePitch = cbPitch;
     338    *pcbSurfacePlane = cbSurfacePlane;
     339    *pcbSurface = cbSurface;
    1071340}
    1072341
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.cpp

    r100008 r102520  
    235235    AssertReturn(pSurface->paMipmapLevels, VERR_NO_MEMORY);
    236236
    237     pSurface->cbBlock = vmsvga3dSurfaceFormatSize(format, &pSurface->cxBlock, &pSurface->cyBlock);
     237    pSurface->cbBlock = vmsvga3dSurfaceFormatSize(format, &pSurface->cxBlock, &pSurface->cyBlock, &pSurface->cbPitchBlock);
    238238    AssertReturn(pSurface->cbBlock, VERR_INVALID_PARAMETER);
    239239
     
    254254            uint32_t cBlocksX;
    255255            uint32_t cBlocksY;
    256             if (RT_LIKELY(pSurface->cxBlock == 1 && pSurface->cyBlock == 1))
    257             {
    258                 cBlocksX = mipmapSize.width;
    259                 cBlocksY = mipmapSize.height;
    260             }
    261             else
    262             {
    263                 cBlocksX = mipmapSize.width / pSurface->cxBlock;
    264                 if (mipmapSize.width % pSurface->cxBlock)
    265                     ++cBlocksX;
    266                 cBlocksY = mipmapSize.height / pSurface->cyBlock;
    267                 if (mipmapSize.height % pSurface->cyBlock)
    268                     ++cBlocksY;
    269             }
    270 
    271             AssertBreakStmt(cBlocksX > 0 && cBlocksY > 0 && mipmapSize.depth > 0, rc = VERR_INVALID_PARAMETER);
    272 
    273             const uint32_t cMaxBlocksX = cbMemRemaining / pSurface->cbBlock;
    274             AssertBreakStmt(cBlocksX < cMaxBlocksX, rc = VERR_INVALID_PARAMETER);
    275 
    276             const uint32_t cbSurfacePitch = pSurface->cbBlock * cBlocksX;
    277             LogFunc(("cbSurfacePitch=0x%x\n", cbSurfacePitch));
    278 
    279             const uint32_t cMaxBlocksY = cbMemRemaining / cbSurfacePitch;
    280             AssertBreakStmt(cBlocksY < cMaxBlocksY, rc = VERR_INVALID_PARAMETER);
    281 
    282             const uint32_t cbSurfacePlane = cbSurfacePitch * cBlocksY;
    283 
    284             const uint32_t cMaxDepth = cbMemRemaining / cbSurfacePlane;
    285             AssertBreakStmt(mipmapSize.depth < cMaxDepth, rc = VERR_INVALID_PARAMETER);
    286 
    287             const uint32_t cbSurface = cbSurfacePlane * mipmapSize.depth;
     256            uint32_t cbSurfacePitch;
     257            uint32_t cbSurfacePlane;
     258            uint32_t cbSurface;
     259            vmsvga3dSurfaceMipBufferSize(format, mipmapSize,
     260                                         &cBlocksX, &cBlocksY, &cbSurfacePitch, &cbSurfacePlane, &cbSurface);
     261            AssertBreakStmt(cbMemRemaining >= cbSurface, rc = VERR_INVALID_PARAMETER);
    288262
    289263            PVMSVGA3DMIPMAPLEVEL pMipmapLevel = &pSurface->paMipmapLevels[iMipmap];
     
    16111585    pMap->box          = *pBox;
    16121586    pMap->cbBlock      = pSurface->cbBlock;
    1613     pMap->cbRow        = cxBlocks * pSurface->cbBlock;
     1587    pMap->cxBlocks     = cxBlocks;
     1588    pMap->cyBlocks     = cyBlocks;
     1589    pMap->cbRow        = cxBlocks * pSurface->cbPitchBlock;
    16141590    pMap->cbRowPitch   = cbRowPitch;
    1615     pMap->cRows        = cyBlocks;
     1591    pMap->cRows        = (cyBlocks * pSurface->cbBlock) / pSurface->cbPitchBlock;
    16161592    pMap->cbDepthPitch = cbDepthPitch;
    16171593    pMap->pvData       = (uint8_t *)pvData
    1618                        + (pBox->x / pSurface->cxBlock) * pSurface->cbBlock
     1594                       + (pBox->x / pSurface->cxBlock) * pSurface->cbPitchBlock
    16191595                       + (pBox->y / pSurface->cyBlock) * cbRowPitch
    16201596                       + pBox->z * cbDepthPitch;
     
    17921768
    17931769    pResult->offSubresource = vmsvga3dCalcSubresourceOffset(pThisCC, pImage);
    1794     pResult->offBox   = (clipBox.x / pSurface->cxBlock) * pSurface->cbBlock
     1770    pResult->offBox   = (clipBox.x / pSurface->cxBlock) * pSurface->cbPitchBlock
    17951771                      + (clipBox.y / pSurface->cyBlock) * pMipLevel->cbSurfacePitch
    17961772                      + clipBox.z * pMipLevel->cbSurfacePlane;
    1797     pResult->cbRow    = cBlocksX * pSurface->cbBlock;
     1773    pResult->cbRow    = cBlocksX * pSurface->cbPitchBlock;
    17981774    pResult->cbPitch  = pMipLevel->cbSurfacePitch;
    17991775    pResult->cyBlocks = cBlocksY;
     1776    pResult->cRows    = (cBlocksY * pSurface->cbBlock) / pSurface->cbPitchBlock;
    18001777    pResult->cbDepthPitch = pMipLevel->cbSurfacePlane;
    18011778
  • trunk/src/VBox/Devices/Graphics/DevVGA-SVGA3d.h

    r99688 r102520  
    8888    SVGA3dBox box;
    8989    uint32_t cbBlock;        /* Size of pixel block, usualy of 1 pixel for uncompressed formats. */
     90    uint32_t cxBlocks;
     91    uint32_t cyBlocks;
    9092    uint32_t cbRow;          /* Bytes per row. */
    9193    uint32_t cbRowPitch;     /* Bytes between rows. */
    92     uint32_t cRows;          /* Number of rows. */
     94    uint32_t cRows;          /* Number of rows. It is greater than cxBlocks for planar formats. */
    9395    uint32_t cbDepthPitch;   /* Bytes between planes. */
    9496    void *pvData;
     
    178180    uint32_t cbRow;          /* Bytes per row. */
    179181    int32_t  cbPitch;        /* Bytes between rows. */
    180     uint32_t cyBlocks;       /* Number of rows. */
     182    uint32_t cyBlocks;       /* Image height in blocks. */
     183    uint32_t cRows;          /* Number of rows. It is greater than cyBlocks for planar formats. */
    181184    uint32_t cbDepthPitch;   /* Number of bytes between planes. */
    182185} VMSGA3D_BOX_DIMENSIONS;
     
    340343uint32_t vmsvga3dSurfaceFormatSize(SVGA3dSurfaceFormat format,
    341344                                   uint32_t *pu32BlockWidth,
    342                                    uint32_t *pu32BlockHeight);
     345                                   uint32_t *pu32BlockHeight,
     346                                   uint32_t *pcbPitchBlock);
     347void vmsvga3dSurfaceMipBufferSize(SVGA3dSurfaceFormat format, SVGA3dSize mipmapSize,
     348                                  uint32_t *pcBlocksX,
     349                                  uint32_t *pcBlocksY,
     350                                  uint32_t *pcbSurfacePitch,
     351                                  uint32_t *pcbSurfacePlane,
     352                                  uint32_t *pcbSurface);
     353
    343354
    344355#ifdef LOG_ENABLED
     
    551562    DECLCALLBACKMEMBER(int, pfnDXBindShaderIface,           (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext));
    552563    DECLCALLBACKMEMBER(int, pfnVBDXClearRenderTargetViewRegion, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dRenderTargetViewId renderTargetViewId, SVGA3dRGBAFloat const *pColor, uint32_t cRect, SVGASignedRect const *paRect));
     564    DECLCALLBACKMEMBER(int, pfnVBDXClearUAV,                (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, SVGA3dUAViewId viewId, SVGA3dRGBAFloat const *pColor, uint32_t cRect, SVGASignedRect const *paRect));
    553565} VMSVGA3DBACKENDFUNCSDX;
     566
     567#define VMSVGA3D_BACKEND_INTERFACE_NAME_DXVIDEO "DXVIDEO"
     568typedef struct
     569{
     570    DECLCALLBACKMEMBER(int, pfnVBDXDefineVideoProcessor,    (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, VBSVGACOTableDXVideoProcessorEntry const *pEntry));
     571    DECLCALLBACKMEMBER(int, pfnVBDXDefineVideoDecoderOutputView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderOutputViewId videoDecoderOutputViewId, VBSVGACOTableDXVideoDecoderOutputViewEntry const *pEntry));
     572    DECLCALLBACKMEMBER(int, pfnVBDXDefineVideoDecoder,      (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId, VBSVGACOTableDXVideoDecoderEntry const *pEntry));
     573    DECLCALLBACKMEMBER(int, pfnVBDXVideoDecoderBeginFrame,  (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId, VBSVGA3dVideoDecoderOutputViewId videoDecoderOutputViewId));
     574    DECLCALLBACKMEMBER(int, pfnVBDXVideoDecoderSubmitBuffers, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId, uint32_t cBuffer, VBSVGA3dVideoDecoderBufferDesc const *paBufferDesc));
     575    DECLCALLBACKMEMBER(int, pfnVBDXVideoDecoderEndFrame,    (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId));
     576    DECLCALLBACKMEMBER(int, pfnVBDXDefineVideoProcessorInputView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorInputViewId videoProcessorInputViewId, VBSVGACOTableDXVideoProcessorInputViewEntry const *pEntry));
     577    DECLCALLBACKMEMBER(int, pfnVBDXDefineVideoProcessorOutputView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorOutputViewId videoProcessorOutputViewId, VBSVGACOTableDXVideoProcessorOutputViewEntry const *pEntry));
     578    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorBlt, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, VBSVGA3dVideoProcessorOutputViewId videoProcessorOutputViewId,
     579                                                       uint32_t OutputFrame, uint32_t StreamCount, VBSVGA3dVideoProcessorStream const *pVideoProcessorStreams));
     580    DECLCALLBACKMEMBER(int, pfnVBDXDestroyVideoDecoder,     (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderId videoDecoderId));
     581    DECLCALLBACKMEMBER(int, pfnVBDXDestroyVideoDecoderOutputView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderOutputViewId videoDecoderOutputViewId));
     582    DECLCALLBACKMEMBER(int, pfnVBDXDestroyVideoProcessor,   (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId));
     583    DECLCALLBACKMEMBER(int, pfnVBDXDestroyVideoProcessorInputView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorInputViewId videoProcessorInputViewId));
     584    DECLCALLBACKMEMBER(int, pfnVBDXDestroyVideoProcessorOutputView, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorOutputViewId videoProcessorOutputViewId));
     585    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetOutputTargetRect, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint8 enable, SVGASignedRect const &outputRect));
     586    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetOutputBackgroundColor, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint32 YCbCr, VBSVGA3dVideoColor const &color));
     587    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetOutputColorSpace, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, VBSVGA3dVideoProcessorColorSpace const &colorSpace));
     588    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetOutputAlphaFillMode, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, VBSVGA3dVideoProcessorAlphaFillMode fillMode, uint32 streamIndex));
     589    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetOutputConstriction, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint32 enabled, uint32 width, uint32 height));
     590    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetOutputStereoMode, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint32 enable));
     591    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamFrameFormat, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint32 streamIndex, VBSVGA3dVideoFrameFormat format));
     592    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamColorSpace, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId, uint32 streamIndex, VBSVGA3dVideoProcessorColorSpace colorSpace));
     593    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamOutputRate, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     594                                                                       uint32 streamIndex, VBSVGA3dVideoProcessorOutputRate outputRate, uint32 repeatFrame, SVGA3dFraction64 const &customRate));
     595    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamSourceRect, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     596                                                                       uint32 streamIndex, uint32 enable, SVGASignedRect const &sourceRect));
     597    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamDestRect, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     598                                                                     uint32 streamIndex, uint32 enable, SVGASignedRect const &destRect));
     599    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamAlpha, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     600                                                                  uint32 streamIndex, uint32 enable, float alpha));
     601    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamPalette, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     602                                                                    uint32 streamIndex, uint32_t cEntries, uint32_t const *paEntries));
     603    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamPixelAspectRatio, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     604                                                                             uint32 streamIndex, uint32 enable, SVGA3dFraction64 const &sourceRatio, SVGA3dFraction64 const &destRatio));
     605    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamLumaKey, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     606                                                                    uint32 streamIndex, uint32 enable, float lower, float upper));
     607    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamStereoFormat, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     608                                                                         uint32 streamIndex, uint32 enable, VBSVGA3dVideoProcessorStereoFormat stereoFormat,
     609                                                                         uint8 leftViewFrame0, uint8 baseViewFrame0, VBSVGA3dVideoProcessorStereoFlipMode flipMode, int32 monoOffset));
     610    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamAutoProcessingMode, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     611                                                                               uint32 streamIndex, uint32 enable));
     612    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamFilter, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     613                                                                   uint32 streamIndex, uint32 enable, VBSVGA3dVideoProcessorFilter filter, int32 level));
     614    DECLCALLBACKMEMBER(int, pfnVBDXVideoProcessorSetStreamRotation, (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorId videoProcessorId,
     615                                                                     uint32 streamIndex, uint32 enable, VBSVGA3dVideoProcessorRotation rotation));
     616    DECLCALLBACKMEMBER(int, pfnVBDXGetVideoCapability,      (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoCapability capability, void *pvData, uint32 cbData, uint32 *pcbOut));
     617    DECLCALLBACKMEMBER(int, pfnVBDXClearVDOV,               (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoDecoderOutputViewId viewId, SVGA3dRGBAFloat const *pColor, uint32_t cRect, SVGASignedRect const *paRect));
     618    DECLCALLBACKMEMBER(int, pfnVBDXClearVPIV,               (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorInputViewId viewId, SVGA3dRGBAFloat const *pColor, uint32_t cRect, SVGASignedRect const *paRect));
     619    DECLCALLBACKMEMBER(int, pfnVBDXClearVPOV,               (PVGASTATECC pThisCC, PVMSVGA3DDXCONTEXT pDXContext, VBSVGA3dVideoProcessorOutputViewId viewId, SVGA3dRGBAFloat const *pColor, uint32_t cRect, SVGASignedRect const *paRect));
     620} VMSVGA3DBACKENDFUNCSDXVIDEO;
    554621
    555622typedef struct VMSVGA3DBACKENDDESC
     
    677744
    678745int vmsvga3dVBDXClearRenderTargetViewRegion(PVGASTATECC pThisCC, uint32_t idDXContext, SVGA3dCmdVBDXClearRenderTargetViewRegion const *pCmd, uint32_t cRect, SVGASignedRect const *paRect);
     746
     747int vmsvga3dVBDXDefineVideoProcessor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessor const *pCmd);
     748int vmsvga3dVBDXDefineVideoDecoderOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoDecoderOutputView const *pCmd);
     749int vmsvga3dVBDXDefineVideoDecoder(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoDecoder const *pCmd);
     750int vmsvga3dVBDXVideoDecoderBeginFrame(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderBeginFrame const *pCmd);
     751int vmsvga3dVBDXVideoDecoderSubmitBuffers(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderSubmitBuffers const *pCmd, uint32_t cBuffer, VBSVGA3dVideoDecoderBufferDesc const *paBufferDesc);
     752int vmsvga3dVBDXVideoDecoderEndFrame(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoDecoderEndFrame const *pCmd);
     753int vmsvga3dVBDXDefineVideoProcessorInputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessorInputView const *pCmd);
     754int vmsvga3dVBDXDefineVideoProcessorOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDefineVideoProcessorOutputView const *pCmd);
     755int vmsvga3dVBDXVideoProcessorBlt(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorBlt const *pCmd, uint32_t cbCmd);
     756int vmsvga3dVBDXDestroyVideoDecoder(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoDecoder const *pCmd);
     757int vmsvga3dVBDXDestroyVideoDecoderOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoDecoderOutputView const *pCmd);
     758int vmsvga3dVBDXDestroyVideoProcessor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessor const *pCmd);
     759int vmsvga3dVBDXDestroyVideoProcessorInputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessorInputView const *pCmd);
     760int vmsvga3dVBDXDestroyVideoProcessorOutputView(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXDestroyVideoProcessorOutputView const *pCmd);
     761int vmsvga3dVBDXVideoProcessorSetOutputTargetRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputTargetRect const *pCmd);
     762int vmsvga3dVBDXVideoProcessorSetOutputBackgroundColor(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputBackgroundColor const *pCmd);
     763int vmsvga3dVBDXVideoProcessorSetOutputColorSpace(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputColorSpace const *pCmd);
     764int vmsvga3dVBDXVideoProcessorSetOutputAlphaFillMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputAlphaFillMode const *pCmd);
     765int vmsvga3dVBDXVideoProcessorSetOutputConstriction(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputConstriction const *pCmd);
     766int vmsvga3dVBDXVideoProcessorSetOutputStereoMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetOutputStereoMode const *pCmd);
     767int vmsvga3dVBDXVideoProcessorSetStreamFrameFormat(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamFrameFormat const *pCmd);
     768int vmsvga3dVBDXVideoProcessorSetStreamColorSpace(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamColorSpace const *pCmd);
     769int vmsvga3dVBDXVideoProcessorSetStreamOutputRate(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamOutputRate const *pCmd);
     770int vmsvga3dVBDXVideoProcessorSetStreamSourceRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamSourceRect const *pCmd);
     771int vmsvga3dVBDXVideoProcessorSetStreamDestRect(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamDestRect const *pCmd);
     772int vmsvga3dVBDXVideoProcessorSetStreamAlpha(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamAlpha const *pCmd);
     773int vmsvga3dVBDXVideoProcessorSetStreamPalette(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamPalette const *pCmd, uint32_t cEntries, uint32_t const *paEntries);
     774int vmsvga3dVBDXVideoProcessorSetStreamPixelAspectRatio(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamPixelAspectRatio const *pCmd);
     775int vmsvga3dVBDXVideoProcessorSetStreamLumaKey(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamLumaKey const *pCmd);
     776int vmsvga3dVBDXVideoProcessorSetStreamStereoFormat(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamStereoFormat const *pCmd);
     777int vmsvga3dVBDXVideoProcessorSetStreamAutoProcessingMode(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamAutoProcessingMode const *pCmd);
     778int vmsvga3dVBDXVideoProcessorSetStreamFilter(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamFilter const *pCmd);
     779int vmsvga3dVBDXVideoProcessorSetStreamRotation(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXVideoProcessorSetStreamRotation const *pCmd);
     780int vmsvga3dVBDXGetVideoCapability(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXGetVideoCapability const *pCmd);
     781int vmsvga3dVBDXClearRTV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView const *pCmd, uint32_t cRect, SVGASignedRect const *paRect);
     782int vmsvga3dVBDXClearUAV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView const *pCmd, uint32_t cRect, SVGASignedRect const *paRect);
     783int vmsvga3dVBDXClearVDOV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView const *pCmd, uint32_t cRect, SVGASignedRect const *paRect);
     784int vmsvga3dVBDXClearVPIV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView const *pCmd, uint32_t cRect, SVGASignedRect const *paRect);
     785int vmsvga3dVBDXClearVPOV(PVGASTATECC pThisCC, uint32_t idDXContext, VBSVGA3dCmdDXClearView const *pCmd, uint32_t cRect, SVGASignedRect const *paRect);
     786
    679787#endif /* VMSVGA3D_DX */
    680788
  • trunk/src/VBox/Devices/Graphics/DevVGASavedState.h

    r100710 r102520  
    5757    } while (0)
    5858
    59 #define VGA_SAVEDSTATE_VERSION                   28
     59#define VGA_SAVEDSTATE_VERSION                   29
     60#define VGA_SAVEDSTATE_VERSION_VMSVGA_VIDEO      29 /* Video decoding and processing (new COTables). */
    6061#define VGA_SAVEDSTATE_VERSION_VMSVGA_SVGA3      28 /* SVGA 3 interface. */
    6162#define VGA_SAVEDSTATE_VERSION_VMSVGA_REG_CAP2   27 /* SVGA_REG_CAP2. */
Note: See TracChangeset for help on using the changeset viewer.

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