From 89f4ce9d6f31d817eb68dede9b066b0af1416fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ekstr=C3=B6m?= Date: Mon, 14 Oct 2019 20:30:09 +0300 Subject: vo_gpu/d3d11: switch adapter selection to case-insensitive startswith This lets users set values such as "intel" or "nvidia" as the adapter vendor is generally noted in the beginning of the description string. --- DOCS/man/options.rst | 4 ++++ video/out/d3d11/context.c | 2 +- video/out/gpu/d3d11_helpers.c | 7 ++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index e3f6a53ab7..2bebb56ea5 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -4705,6 +4705,10 @@ The following video options are currently all specific to ``--vo=gpu`` and Will pick the default adapter if unset. Alternatives are listed when the name "help" is given. + Checks for matches based on the start of the string, case + insensitive. Thus, if the description of the adapter starts with + the vendor name, that can be utilized as the selection parameter. + Hardware decoders utilizing the D3D11 rendering abstraction's helper functionality to receive a device, such as D3D11VA or DXVA2's DXGI mode, will be affected by this choice. diff --git a/video/out/d3d11/context.c b/video/out/d3d11/context.c index be595eff3d..62c0f5772f 100644 --- a/video/out/d3d11/context.c +++ b/video/out/d3d11/context.c @@ -117,7 +117,7 @@ static int d3d11_validate_adapter(struct mp_log *log, } if (!adapter_matched) { - mp_err(log, "No adapter with name '%.*s'!\n", BSTR_P(param)); + mp_err(log, "No adapter matching '%.*s'!\n", BSTR_P(param)); } return adapter_matched ? 0 : M_OPT_INVALID; diff --git a/video/out/gpu/d3d11_helpers.c b/video/out/gpu/d3d11_helpers.c index 6ea778a875..73d2c667a8 100644 --- a/video/out/gpu/d3d11_helpers.c +++ b/video/out/gpu/d3d11_helpers.c @@ -204,8 +204,9 @@ static IDXGIAdapter1 *get_d3d11_adapter(struct mp_log *log, adapter_description ? adapter_description : ""); } - if (adapter_description && - bstr_equals0(requested_adapter_name, adapter_description)) + if (adapter_description && requested_adapter_name.len && + bstr_case_startswith(bstr0(adapter_description), + requested_adapter_name)) { picked_adapter = adapter; break; @@ -282,7 +283,7 @@ bool mp_d3d11_create_present_device(struct mp_log *log, adapter = get_d3d11_adapter(log, bstr0(adapter_name), NULL); if (adapter_name && !adapter) { - mp_warn(log, "Adapter '%s' was not found in the system! " + mp_warn(log, "Adapter matching '%s' was not found in the system! " "Will fall back to the default adapter.\n", adapter_name); } -- cgit v1.2.3