vlc | branch: master | Steve Lhomme <rob...@ycbcr.xyz> | Mon Mar 2 15:41:45 2020 +0100| [60c0cb10694c9fc4314dbed080fe802fbb5a4fef] | committer: Steve Lhomme
d3d9_fmt: keep the adapter info while it's loaded No need to reload the same thing many times. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=60c0cb10694c9fc4314dbed080fe802fbb5a4fef --- modules/codec/avcodec/dxva2.c | 26 ++++++++++---------------- modules/video_chroma/d3d9_fmt.c | 7 +++---- modules/video_chroma/d3d9_fmt.h | 1 + 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index 59b8d88473..75fb22be70 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -328,13 +328,11 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat hwfmt, const if (err != VLC_SUCCESS) goto error; - D3DADAPTER_IDENTIFIER9 d3dai; - if (SUCCEEDED(IDirect3D9_GetAdapterIdentifier(d3d9_decoder->hd3d.obj, - d3d9_decoder->d3ddev.adapterId, 0, &d3dai))) { - msg_Info(va, "Using DXVA2 (%.*s, vendor %s(%lx), device %lx, revision %lx)", - (int)sizeof(d3dai.Description), d3dai.Description, - DxgiVendorStr(d3dai.VendorId), d3dai.VendorId, d3dai.DeviceId, d3dai.Revision); - } + const D3DADAPTER_IDENTIFIER9 *identifier = &d3d9_decoder->d3ddev.identifier; + msg_Info(va, "Using DXVA2 (%.*s, vendor %s(%lx), device %lx, revision %lx)", + (int)sizeof(identifier->Description), identifier->Description, + DxgiVendorStr(identifier->VendorId), identifier->VendorId, + identifier->DeviceId, identifier->Revision); d3d9_video_context_t *octx = GetD3D9ContextPrivate(sys->vctx); octx->format = sys->render; @@ -436,18 +434,14 @@ static int DxSetupOutput(vlc_va_t *va, const directx_va_mode_t *mode, const vide d3d9_decoder_device_t *d3d9_decoder = GetD3D9OpaqueContext(sys->vctx); - D3DADAPTER_IDENTIFIER9 identifier; - HRESULT hr = IDirect3D9_GetAdapterIdentifier(d3d9_decoder->hd3d.obj, d3d9_decoder->d3ddev.adapterId, 0, &identifier); - if (FAILED(hr)) - return VLC_EGENERIC; - - UINT driverBuild = identifier.DriverVersion.LowPart & 0xFFFF; - if (identifier.VendorId == GPU_MANUFACTURER_INTEL && (identifier.DriverVersion.LowPart >> 16) >= 100) + const D3DADAPTER_IDENTIFIER9 *identifier = &d3d9_decoder->d3ddev.identifier; + UINT driverBuild = identifier->DriverVersion.LowPart & 0xFFFF; + if (identifier->VendorId == GPU_MANUFACTURER_INTEL && (identifier->DriverVersion.LowPart >> 16) >= 100) { /* new Intel driver format */ - driverBuild += ((identifier.DriverVersion.LowPart >> 16) - 100) * 1000; + driverBuild += ((identifier->DriverVersion.LowPart >> 16) - 100) * 1000; } - if (!directx_va_canUseDecoder(va, identifier.VendorId, identifier.DeviceId, + if (!directx_va_canUseDecoder(va, identifier->VendorId, identifier->DeviceId, mode->guid, driverBuild)) { msg_Warn(va, "GPU blacklisted for %s codec", mode->name); diff --git a/modules/video_chroma/d3d9_fmt.c b/modules/video_chroma/d3d9_fmt.c index 0b3472367b..730a5b7a00 100644 --- a/modules/video_chroma/d3d9_fmt.c +++ b/modules/video_chroma/d3d9_fmt.c @@ -214,12 +214,11 @@ d3d9_handle_t *hd3d = &sys->dec_device.hd3d; } /* */ - D3DADAPTER_IDENTIFIER9 d3dai; - if (FAILED(IDirect3D9_GetAdapterIdentifier(hd3d->obj, AdapterToUse,0, &d3dai))) { + if (FAILED(IDirect3D9_GetAdapterIdentifier(hd3d->obj, AdapterToUse,0, &out->identifier))) { msg_Warn(o, "IDirect3D9_GetAdapterIdentifier failed"); } else { - msg_Dbg(o, "Direct3d9 Device: %s %lx %lx %lx", d3dai.Description, - d3dai.VendorId, d3dai.DeviceId, d3dai.Revision ); + msg_Dbg(o, "Direct3d9 Device: %s %lx %lx %lx", out->identifier.Description, + out->identifier.VendorId, out->identifier.DeviceId, out->identifier.Revision ); } DWORD thread_modes[] = { D3DCREATE_MULTITHREADED, 0 }; diff --git a/modules/video_chroma/d3d9_fmt.h b/modules/video_chroma/d3d9_fmt.h index ddff8e0f2f..396872357f 100644 --- a/modules/video_chroma/d3d9_fmt.h +++ b/modules/video_chroma/d3d9_fmt.h @@ -67,6 +67,7 @@ typedef struct UINT adapterId; D3DCAPS9 caps; + D3DADAPTER_IDENTIFIER9 identifier; } d3d9_device_t; typedef struct _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits