Browse Source

direct3d11: remove the legacy (UWP) way of passing the swapchain/d3dcontext

pull/138/head
Steve Lhomme 4 years ago
parent
commit
954b60ff45
  1. 4
      modules/hw/d3d11/d3d11_filters.c
  2. 15
      modules/video_chroma/d3d11_fmt.c
  3. 2
      modules/video_chroma/d3d11_fmt.h
  4. 41
      modules/video_output/win32/d3d11_swapchain.cpp
  5. 1
      modules/video_output/win32/d3d11_swapchain.h
  6. 17
      modules/video_output/win32/direct3d11.cpp
  7. 10
      modules/video_output/win32/dxgi_swapchain.cpp

4
modules/hw/d3d11/d3d11_filters.c

@ -592,10 +592,6 @@ vlc_module_begin()
add_submodule()
set_description(N_("Direct3D11"))
set_callback_dec_device( D3D11OpenDecoderDeviceAny, 8 )
#ifdef VLC_WINSTORE_APP
/* LEGACY, the d3dcontext and swapchain were given by the host app */
add_integer("winrt-d3dcontext", 0x0, N_("Context"), NULL) /* ID3D11DeviceContext* */
#endif /* VLC_WINSTORE_APP */
add_shortcut ("d3d11")
add_submodule()

15
modules/video_chroma/d3d11_fmt.c

@ -539,21 +539,6 @@ d3d11_decoder_device_t *(D3D11_CreateDevice)(vlc_object_t *obj,
sys->external.cleanupDeviceCb = NULL;
HRESULT hr = E_FAIL;
#ifdef VLC_WINSTORE_APP
/* LEGACY, the d3dcontext and swapchain were given by the host app */
ID3D11DeviceContext *d3dcontext = (ID3D11DeviceContext*)(uintptr_t) var_InheritInteger(obj, "winrt-d3dcontext");
if ( likely(d3dcontext != NULL) )
{
HANDLE context_lock;
UINT dataSize = sizeof(context_lock);
HRESULT hr = ID3D11DeviceContext_GetPrivateData(d3dcontext, &GUID_CONTEXT_MUTEX, &dataSize, &context_lock);
if (FAILED(hr))
context_lock = NULL;
hr = D3D11_CreateDeviceExternal(obj, d3dcontext, context_lock, &sys->dec_device.d3d_dev);
}
else
#endif
{
libvlc_video_engine_t engineType = var_InheritInteger( obj, "vout-cb-type" );
libvlc_video_output_setup_cb setupDeviceCb = NULL;

2
modules/video_chroma/d3d11_fmt.h

@ -42,8 +42,6 @@ extern "C" {
#endif
DEFINE_GUID(GUID_CONTEXT_MUTEX, 0x472e8835, 0x3f8e, 0x4f93, 0xa0, 0xcb, 0x25, 0x79, 0x77, 0x6c, 0xed, 0x86);
/* see https://msdn.microsoft.com/windows/hardware/commercialize/design/compatibility/device-graphics
* https://docs.microsoft.com/en-us/windows-hardware/drivers/display/wddm-2-1-features#driver-versioning
* https://www.intel.com/content/www/us/en/support/articles/000005654/graphics-drivers.html

41
modules/video_output/win32/d3d11_swapchain.cpp

@ -84,28 +84,6 @@ static bool UpdateSwapchain( d3d11_local_swapchain *display, const libvlc_video_
display->swapchainTargetView[i].Reset();
const d3d_format_t *newPixelFormat = NULL;
#ifdef VLC_WINSTORE_APP
ComPtr<IDXGISwapChain1> dxgiswapChain = DXGI_GetSwapChain1(display->sys);
if (!dxgiswapChain.Get())
dxgiswapChain = static_cast<IDXGISwapChain1*>((void*)(uintptr_t)var_InheritInteger(display->obj, "winrt-swapchain"));
if (dxgiswapChain.Get())
{
DXGI_SWAP_CHAIN_DESC1 scd;
if (SUCCEEDED(dxgiswapChain->GetDesc1(&scd)))
{
for (const d3d_format_t *output_format = DxgiGetRenderFormatList();
output_format->name != NULL; ++output_format)
{
if (output_format->formatTexture == scd.Format &&
!is_d3d11_opaque(output_format->fourcc))
{
newPixelFormat = output_format;
break;
}
}
}
}
#else /* !VLC_WINSTORE_APP */
/* favor RGB formats first */
newPixelFormat = FindD3D11Format( display->obj, display->d3d_dev, 0, DXGI_RGB_FORMAT,
cfg->bitdepth > 8 ? 10 : 8,
@ -116,7 +94,6 @@ static bool UpdateSwapchain( d3d11_local_swapchain *display, const libvlc_video_
cfg->bitdepth > 8 ? 10 : 8,
0, 0,
DXGI_CHROMA_CPU, D3D11_FORMAT_SUPPORT_DISPLAY );
#endif /* !VLC_WINSTORE_APP */
if (unlikely(newPixelFormat == NULL)) {
msg_Err(display->obj, "Could not get the SwapChain format.");
return false;
@ -183,24 +160,6 @@ void D3D11_LocalSwapchainSetMetadata( void *opaque, libvlc_video_metadata_type_t
DXGI_LocalSwapchainSetMetadata( display->sys, type, metadata );
}
bool D3D11_LocalSwapchainWinstoreSize( void *opaque, uint32_t *width, uint32_t *height )
{
#ifdef VLC_WINSTORE_APP
d3d11_local_swapchain *display = static_cast<d3d11_local_swapchain *>(opaque);
/* legacy UWP mode, the width/height was set in GUID_SWAPCHAIN_WIDTH/HEIGHT */
UINT dataSize = sizeof(*width);
HRESULT hr = DXGI_GetSwapChain1(display->sys)->GetPrivateData(GUID_SWAPCHAIN_WIDTH, &dataSize, width);
if (SUCCEEDED(hr)) {
dataSize = sizeof(*height);
hr = DXGI_GetSwapChain1(display->sys)->GetPrivateData(GUID_SWAPCHAIN_HEIGHT, &dataSize, height);
return SUCCEEDED(hr);
}
#else
VLC_UNUSED(opaque); VLC_UNUSED(width); VLC_UNUSED(height);
#endif
return false;
}
bool D3D11_LocalSwapchainStartEndRendering( void *opaque, bool enter )
{
d3d11_local_swapchain *display = static_cast<d3d11_local_swapchain *>(opaque);

1
modules/video_output/win32/d3d11_swapchain.h

@ -37,7 +37,6 @@ void D3D11_LocalSwapchainCleanupDevice( void *opaque );
bool D3D11_LocalSwapchainUpdateOutput( void *opaque, const libvlc_video_render_cfg_t *cfg, libvlc_video_output_cfg_t *out );
bool D3D11_LocalSwapchainStartEndRendering( void *opaque, bool enter );
bool D3D11_LocalSwapchainSelectPlane( void *opaque, size_t plane, void *output );
bool D3D11_LocalSwapchainWinstoreSize( void *opaque, uint32_t *, uint32_t * );
void D3D11_LocalSwapchainSwap( void *opaque );
void D3D11_LocalSwapchainSetMetadata( void *opaque, libvlc_video_metadata_type_t, const void * );

17
modules/video_output/win32/direct3d11.cpp

@ -70,10 +70,6 @@ vlc_module_begin ()
add_bool("direct3d11-hw-blending", true, HW_BLENDING_TEXT, HW_BLENDING_LONGTEXT)
#ifdef VLC_WINSTORE_APP
add_integer("winrt-swapchain", 0x0, NULL, NULL) /* IDXGISwapChain1* */
#endif
add_shortcut("direct3d11")
set_callback_display(Open, 300)
vlc_module_end ()
@ -659,19 +655,6 @@ static void Prepare(vout_display_t *vd, picture_t *picture,
vout_display_sys_t *sys = static_cast<vout_display_sys_t *>(vd->sys);
d3d11_device_lock( sys->d3d_dev );
#ifdef VLC_WINSTORE_APP
if ( sys->swapCb == D3D11_LocalSwapchainSwap )
{
/* legacy UWP mode, the width/height was set in GUID_SWAPCHAIN_WIDTH/HEIGHT */
uint32_t i_width;
uint32_t i_height;
if (D3D11_LocalSwapchainWinstoreSize( sys->outside_opaque, &i_width, &i_height ))
{
if (i_width != vd->cfg->display.width || i_height != vd->cfg->display.height)
vout_display_SetSize(vd, i_width, i_height);
}
}
#endif
if ( sys->startEndRenderingCb( sys->outside_opaque, true ))
{
if ( sys->sendMetadataCb && picture->format.mastering.max_luminance )

10
modules/video_output/win32/dxgi_swapchain.cpp

@ -96,9 +96,6 @@ struct dxgi_swapchain
bool logged_capabilities = false;
};
DEFINE_GUID(GUID_SWAPCHAIN_WIDTH, 0xf1b59347, 0x1643, 0x411a, 0xad, 0x6b, 0xc7, 0x80, 0x17, 0x7a, 0x06, 0xb6);
DEFINE_GUID(GUID_SWAPCHAIN_HEIGHT, 0x6ea976a0, 0x9d60, 0x4bb7, 0xa5, 0xa9, 0x7d, 0xd1, 0x18, 0x7f, 0xc9, 0xbd);
#define DXGI_COLOR_RANGE_FULL 1 /* 0-255 */
#define DXGI_COLOR_RANGE_STUDIO 0 /* 16-235 */
@ -482,12 +479,7 @@ bool DXGI_UpdateSwapChain( dxgi_swapchain *display, IDXGIAdapter *dxgiadapter,
width, height);
}
#else /* VLC_WINSTORE_APP */
if ( !display->dxgiswapChain.Get() )
{
display->dxgiswapChain = static_cast<IDXGISwapChain1*>((void*)(uintptr_t)var_InheritInteger(display->obj, "winrt-swapchain"));
}
#endif /* VLC_WINSTORE_APP */
#endif /* !VLC_WINSTORE_APP */
if ( !display->dxgiswapChain.Get() )
return false;

Loading…
Cancel
Save