d3d11: make the code to decide whether to use the external pool more generic

This code will go away once we use the push model.
This commit is contained in:
Steve Lhomme 2018-02-20 08:47:35 +01:00
parent b62b868c75
commit 571ea8ffbb
4 changed files with 17 additions and 8 deletions

View File

@ -648,9 +648,7 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, const video_format_t *
msg_Dbg(va, "Using output format %s for decoder %s", DxgiFormatToStr(processorInput[idx]), psz_decoder_name);
if ( sys->render == processorInput[idx] )
{
/* NVIDIA cards crash when calling CreateVideoDecoderOutputView
* on more than 30 slices */
if (sys->totalTextureSlices <= 30 || !isNvidiaHardware(sys->d3d_dev.d3ddevice))
if (CanUseVoutPool(&sys->d3d_dev, sys->totalTextureSlices))
dx_sys->can_extern_pool = true;
else
msg_Warn( va, "NVIDIA GPU with too many slices (%d) detected, use internal pool",

View File

@ -349,6 +349,19 @@ bool isNvidiaHardware(ID3D11Device *d3ddev)
return result;
}
bool CanUseVoutPool(d3d11_device_t *d3d_dev, UINT slices)
{
#if VLC_WINSTORE_APP
/* Phones and the Xbox are memory constrained, rely on the d3d11va pool
* which is always smaller, we still get direct rendering from the decoder */
return false;
#else
/* NVIDIA cards crash when calling CreateVideoDecoderOutputView
* on more than 30 slices */
return slices <= 30 || !isNvidiaHardware(d3d_dev->d3ddevice);
#endif
}
int D3D11CheckDriverVersion(d3d11_device_t *d3d_dev, UINT vendorId, const struct wddm_version *min_ver)
{
IDXGIAdapter *pAdapter = D3D11DeviceAdapter(d3d_dev->d3ddevice);

View File

@ -108,6 +108,7 @@ void D3D11_Destroy(d3d11_handle_t *);
bool isXboxHardware(ID3D11Device *d3ddev);
bool isNvidiaHardware(ID3D11Device *d3ddev);
bool CanUseVoutPool(d3d11_device_t *, UINT slices);
IDXGIAdapter *D3D11DeviceAdapter(ID3D11Device *d3ddev);
int D3D11CheckDriverVersion(d3d11_device_t *, UINT vendorId,
const struct wddm_version *min_ver);

View File

@ -587,12 +587,9 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned pool_size)
surface_fmt.i_width = sys->picQuad.i_width;
surface_fmt.i_height = sys->picQuad.i_height;
#if VLC_WINSTORE_APP
/* Phones and the Xbox are memory constrained, rely on the d3d11va pool
* which is always smaller, we still get direct rendering from the decoder */
if (is_d3d11_opaque(surface_fmt.i_chroma))
if (is_d3d11_opaque(surface_fmt.i_chroma) && !CanUseVoutPool(&sys->d3d_dev, pool_size))
/* only provide enough for the filters, we can still do direct rendering */
pool_size = __MIN(pool_size, 6);
#endif
if (SetupQuad( vd, &surface_fmt, &sys->picQuad, &sys->sys.rect_src_clipped,
sys->picQuadConfig, sys->picQuadPixelShader,