diff mbox

[FFmpeg-devel] hwcontext_d3d11: Log adapter details on device creation

Message ID 7c81240a-7e90-9f73-2288-27856ccf458c@jkqxz.net
State Accepted
Commit 8bbf2dacbfb4ead1535dea411035994f507f517d
Headers show

Commit Message

Mark Thompson Nov. 14, 2017, 2:05 p.m. UTC
This is helpful to know what device has actually been used.
---
 libavutil/hwcontext_d3d11va.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Comments

Jan Ekström Nov. 25, 2017, 2:07 p.m. UTC | #1
On Tue, Nov 14, 2017 at 4:05 PM, Mark Thompson <sw@jkqxz.net> wrote:
> This is helpful to know what device has actually been used.
> ---

Change looks alright, and especially in multi-GPU contexts like
laptops this can be quite useful - as you would learn which device you
have just tried to utilize.

Jan
Mark Thompson Nov. 25, 2017, 4:13 p.m. UTC | #2
On 25/11/17 14:07, Jan Ekstrom wrote:
> On Tue, Nov 14, 2017 at 4:05 PM, Mark Thompson <sw@jkqxz.net> wrote:
>> This is helpful to know what device has actually been used.
>> ---
> 
> Change looks alright, and especially in multi-GPU contexts like
> laptops this can be quite useful - as you would learn which device you
> have just tried to utilize.

Yeah, that's exactly the intent (it is not straightforward at all to find what the adapter index numbers actually are by any other route).

Applied.

Thanks,

- Mark
diff mbox

Patch

diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c
index 65dd6651fc..769c81fd77 100644
--- a/libavutil/hwcontext_d3d11va.c
+++ b/libavutil/hwcontext_d3d11va.c
@@ -515,8 +515,15 @@  static int d3d11va_device_create(AVHWDeviceContext *ctx, const char *device,
 
     hr = mD3D11CreateDevice(pAdapter, pAdapter ? D3D_DRIVER_TYPE_UNKNOWN : D3D_DRIVER_TYPE_HARDWARE, NULL, creationFlags, NULL, 0,
                    D3D11_SDK_VERSION, &device_hwctx->device, NULL, NULL);
-    if (pAdapter)
+    if (pAdapter) {
+        DXGI_ADAPTER_DESC2 desc;
+        hr = IDXGIAdapter2_GetDesc(pAdapter, &desc);
+        if (!FAILED(hr)) {
+            av_log(ctx, AV_LOG_INFO, "Using device %04x:%04x (%ls).\n",
+                   desc.VendorId, desc.DeviceId, desc.Description);
+        }
         IDXGIAdapter_Release(pAdapter);
+    }
     if (FAILED(hr)) {
         av_log(ctx, AV_LOG_ERROR, "Failed to create Direct3D device (%lx)\n", (long)hr);
         return AVERROR_UNKNOWN;