Skip to content

Add VIRGL_RENDERER_D3D11_SHARE_TEXTURE (using ANGLE and D3D 11.1)

Marc-André Lureau requested to merge elmarco/virglrenderer:d3d into master

Provide a solution similar to DMABUF scanout sharing on Windows, to let the UI and the rendering run in different processes.

ANGLE on Windows offers some EGL extension to interact with the underlying Direct3D objects. For example, ANGLE_surface_d3d_texture_2d_share_handle offers a way to generate a shared handle from an EGLSurface, or ANGLE_d3d_texture_client_buffer to create EGLSurface or EGLImage from D3D textures.

But this extension alone isn't enough. EGLSurface aren't suited for virgl, since scanouts are rendered as textures. And sadly there is no out-of-the box solution to create shareable texture from ANGLE (how would you tell from glTexImage2D? perhaps there are extensions with extra attribs?)

So instead, use a similar approach as was done for GBM allocation, create the D3D texture ourself and bind it to the GL texture. This also allows us to use a more modern API (with D3D11_RESOURCE_MISC_SHARED_NTHANDLEs which offer better security and safety than the <11 API)

The user can lookup the associated D3D texture with virgl_renderer_resource_get_d3d11_texture2d() and manage the sharing & locking.

(qemu -display dbus + client are WIP)

Merge request reports

Loading