Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2017-08-21 10:52:10 +0300
committerHendrik Leppkes <h.leppkes@gmail.com>2017-08-21 10:52:10 +0300
commita3ee66c703a4188285d086d2062ebe0cc7321392 (patch)
tree18795fdad086198e984c643addb48132593d647b
parent1911009d231a27d7c87ed5d773356fb594e87a5f (diff)
d3d11: use copy-back when a specific device is selected
-rw-r--r--decoder/LAVVideo/VideoSettingsProp.cpp4
-rw-r--r--decoder/LAVVideo/decoders/d3d11va.cpp12
2 files changed, 9 insertions, 7 deletions
diff --git a/decoder/LAVVideo/VideoSettingsProp.cpp b/decoder/LAVVideo/VideoSettingsProp.cpp
index 75ebc5f2..c05986f3 100644
--- a/decoder/LAVVideo/VideoSettingsProp.cpp
+++ b/decoder/LAVVideo/VideoSettingsProp.cpp
@@ -386,11 +386,11 @@ HRESULT CLAVVideoSettingsProp::UpdateHWOptions()
const WCHAR hwHintNoDeviceChoice[] = L"The selected Hardware Decoder does not support using a specific device.";
const WCHAR hwHintDXVA2Display[] = L"DXVA2 requires an active display for GPUs to be available.\nNote that GPUs are listed once for each connected display.";
const WCHAR hwHintD3D11NotSupported[] = L"D3D11 requires Windows 8 or newer, and is not supported on this OS.";
- const WCHAR hwHintD3D11DeviceHint[] = L"The selected D3D11 device is only used in copy-back mode. In native mode the renderer determines the device used.";
+ const WCHAR hwHintD3D11DeviceHint[] = L"Selecting a specific device for D3D11 disables Native mode and forces Copy-Back, use Automatic for the best performance.";
SendDlgItemMessage(m_Dlg, IDC_HWACCEL_DEVICE_SELECT, CB_RESETCONTENT, 0, 0);
- SendDlgItemMessage(m_Dlg, IDC_HWACCEL_DEVICE_SELECT, CB_ADDSTRING, 0, (LPARAM)L"Automatic");
+ SendDlgItemMessage(m_Dlg, IDC_HWACCEL_DEVICE_SELECT, CB_ADDSTRING, 0, (hwAccel == HWAccel_D3D11) ? (LPARAM)L"Automatic (Native)" : (LPARAM)L"Automatic");
DWORD dwnDevices = m_pVideoSettings->GetHWAccelNumDevices(hwAccel);
for (DWORD dwDevice = 0; dwDevice < dwnDevices; dwDevice++)
diff --git a/decoder/LAVVideo/decoders/d3d11va.cpp b/decoder/LAVVideo/decoders/d3d11va.cpp
index 1691ecb9..263ba0ca 100644
--- a/decoder/LAVVideo/decoders/d3d11va.cpp
+++ b/decoder/LAVVideo/decoders/d3d11va.cpp
@@ -331,17 +331,19 @@ STDMETHODIMP CDecD3D11::PostConnect(IPin *pPin)
av_buffer_unref(&m_pDevCtx);
// device id
- UINT nDevice = 0;
+ UINT nDevice = m_pSettings->GetHWAccelDeviceIndex(HWAccel_D3D11, nullptr);
- // use the device the renderer recommends
- if (pD3D11DecoderConfiguration)
+ // in automatic mode use the device the renderer gives us
+ if (nDevice == LAVHWACCEL_DEVICE_DEFAULT && pD3D11DecoderConfiguration)
{
nDevice = pD3D11DecoderConfiguration->GetD3D11AdapterIndex();
}
else
{
+ // if a device is specified manually, fallback to copy-back and use the selected device
+ SafeRelease(&pD3D11DecoderConfiguration);
+
// use the configured device
- nDevice = m_pSettings->GetHWAccelDeviceIndex(HWAccel_D3D11, nullptr);
if (nDevice == LAVHWACCEL_DEVICE_DEFAULT)
nDevice = 0;
}
@@ -368,6 +370,7 @@ STDMETHODIMP CDecD3D11::PostConnect(IPin *pPin)
}
// check if the connection supports native mode
+ if (pD3D11DecoderConfiguration)
{
CMediaType mt = m_pCallback->GetOutputMediaType();
if ((m_SurfaceFormat == DXGI_FORMAT_NV12 && mt.subtype != MEDIASUBTYPE_NV12)
@@ -375,7 +378,6 @@ STDMETHODIMP CDecD3D11::PostConnect(IPin *pPin)
|| (m_SurfaceFormat == DXGI_FORMAT_P016 && mt.subtype != MEDIASUBTYPE_P016)) {
DbgLog((LOG_ERROR, 10, L"-> Connection is not the appropriate pixel format for D3D11 Native"));
- m_bReadBackFallback = false;
SafeRelease(&pD3D11DecoderConfiguration);
}
}