Open zhuowp opened 2 months ago
In that case you may need to modify and build the driver with a modified swap chain buffer to one which supports outputting the correct format, making sure the swap chain is properly formatted, at least that's my best guess as of right now.
May I enquire to why you want to do this ?
@bud3699 Thanks for your reply. The key problem is that I do not know how to modify the swap chain to support yuv format. Do you have some idea to help me?
For you question, I'm trying to use virtio gpu driver from intel to display Windows image in qemu.(see https://github.com/intel/Display-Virtualization-for-Windows-OS ). But it took a long time to Copy and Map desktop images from swap chain to memory with intel-1235u cpu. Therefore, I want to try to take YUV data directly from Swapchain to see if the Copy time can be reduced by reducing the size of image data.
@zhuowp
I guess lets break it down
1) we need to make sure the Buffer is in the correct format for the swap chain 2) check if the Direct3D Device supports the format, maybe fall back if it doesn't just to be on safe side 3) If you want to do frame handling in the code then do so, process the YUV data 4) Set the colour encoding
Again, this is only theory, I'm still setting up my computer after a clean install of windows so I can't test as of now. I'm sorry if this didn't help
@bud3699 Thanks a lot. I'll try that.
Did it work ????
Did it work ????
Sorry for the late response.But I didn't figure out this. I Cannot find the API to specify the color format to YUV in swap chain directly.
When I read the Microsoft document about the function"IddCxSwapChainReleaseAndAcquireBuffer2", I found the remarks :
The color space of the surface passed in the [IDDCX_METADATA2](https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/iddcx/ns-iddcx-iddcx_metadata2) struct is also passed to the driver. This is because it may change on a per frame basis and not match the color space specified when a mode was committed.
So I'm not sure is there anything I can do to achive that.
I originally got the RGBA data from Swapchain, but it took a long time to Copy and Map it on my CPU. Therefore, I want to try to take YUV data directly from Swapchain to see if the Copy time can be reduced by reducing the size of image data.
In the functions: IddSampleEvtIddCxAdapterQueryTargetInfo IddSampleEvtIddCxParseMonitorDescription2 IddSampleEvtIddCxMonitorQueryTargetModes2 I sets YCbCr422 = IDDCX_BITS_PER_COMPONENT_8 and Rgb = IDDCX_BITS_PER_COMPONENT_NONE to make the color format of the virtual display YCbCr422, which does work. The color format of the virtual display did change to YCbCr422 in Windows setting, but the data I got from SwapChain was still in RGBA format.
What can I do to get YUV data directly from SwapChain