[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: d3d11_fmt: check all the Display driver items
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Sun Oct 15 14:43:10 UTC 2023
Jean-Baptiste Kempf pushed to branch 3.0.x at VideoLAN / VLC
Commits:
380dee80 by Steve Lhomme at 2023-10-14T13:32:00+00:00
d3d11_fmt: check all the Display driver items
There might be holes in the index list but we need to check each of them
to find our driver.
- - - - -
e031a5cc by Steve Lhomme at 2023-10-14T13:32:00+00:00
direct3d11: settle legacy_shader before it's being used
It's used in Direct3D11CreateFormatResources(). We can update it every time
Direct3D11Open() is called.
- - - - -
2 changed files:
- modules/video_chroma/d3d11_fmt.c
- modules/video_output/win32/direct3d11.c
Changes:
=====================================
modules/video_chroma/d3d11_fmt.c
=====================================
@@ -146,21 +146,32 @@ int D3D11_AllocateShaderView(vlc_object_t *obj, ID3D11Device *d3ddevice,
#if !VLC_WINSTORE_APP
static HKEY GetAdapterRegistry(vlc_object_t *obj, DXGI_ADAPTER_DESC *adapterDesc)
{
- HKEY hKey;
+ HKEY hDisplayKey, hKey;
CHAR key[128];
CHAR szData[256], lookup[256];
DWORD len = 256;
LSTATUS ret;
+ ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}", 0, KEY_READ, &hDisplayKey);
+ if ( ret != ERROR_SUCCESS )
+ {
+ msg_Warn(obj, "failed to read the Display Adapter registry key (%ld)", ret);
+ return NULL;
+ }
+
+ char DisplayNum[16];
_snprintf(lookup, 256, "pci\\ven_%04x&dev_%04x", adapterDesc->VendorId, adapterDesc->DeviceId);
- for (int i=0;;i++)
+ for (DWORD k=0;; k++)
{
- _snprintf(key, 128, "SYSTEM\\CurrentControlSet\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}\\%04d", i);
- ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hKey);
+ ret = RegEnumKeyA(hDisplayKey, k, DisplayNum, ARRAY_SIZE(DisplayNum));
+ if (ret != ERROR_SUCCESS)
+ break;
+
+ ret = RegOpenKeyExA(hDisplayKey, DisplayNum, 0, KEY_READ, &hKey);
if ( ret != ERROR_SUCCESS )
{
- msg_Warn(obj, "failed to read the %d Display Adapter registry key (%ld)", i, ret);
- return NULL;
+ msg_Warn(obj, "failed to read the %s Display Adapter registry key (%ld)", DisplayNum, ret);
+ continue;
}
len = sizeof(szData);
@@ -168,13 +179,15 @@ static HKEY GetAdapterRegistry(vlc_object_t *obj, DXGI_ADAPTER_DESC *adapterDesc
if ( ret == ERROR_SUCCESS ) {
if (_strnicmp(lookup, szData, strlen(lookup)) == 0)
return hKey;
- msg_Dbg(obj, "different %d device %s vs %s", i, lookup, szData);
+ msg_Dbg(obj, "different %s device %s vs %s", DisplayNum, lookup, szData);
}
else
- msg_Warn(obj, "failed to get the %d MatchingDeviceId (%ld)", i, ret);
+ msg_Warn(obj, "failed to get the %s MatchingDeviceId (%ld)", DisplayNum, ret);
RegCloseKey(hKey);
}
+ RegCloseKey(hDisplayKey);
+
return NULL;
}
=====================================
modules/video_output/win32/direct3d11.c
=====================================
@@ -1570,10 +1570,6 @@ static int Direct3D11Open(vout_display_t *vd, bool external_device)
video_format_Copy(&sys->pool_fmt, &fmt);
- sys->legacy_shader = sys->d3d_dev.feature_level < D3D_FEATURE_LEVEL_10_0 ||
- (sys->scaleProc == NULL && !CanUseTextureArray(vd)) ||
- BogusZeroCopy(vd);
-
if (!sys->legacy_shader && is_d3d11_opaque(sys->pool_fmt.i_chroma))
{
sys->pool_fmt.i_width = (sys->pool_fmt.i_width + 0x7F) & ~0x7F;
@@ -1689,6 +1685,10 @@ static int SetupOutputFormat(vout_display_t *vd, video_format_t *fmt)
InitScaleProcessor(vd);
+ sys->legacy_shader = sys->d3d_dev.feature_level < D3D_FEATURE_LEVEL_10_0 ||
+ (sys->scaleProc == NULL && !CanUseTextureArray(vd)) ||
+ BogusZeroCopy(vd);
+
if (Direct3D11CreateFormatResources(vd, fmt)) {
msg_Err(vd, "Failed to allocate format resources");
return VLC_EGENERIC;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/05dd1fe652de9af906a9e44519926cbc02dfb5a2...e031a5cc893d00c1bc5c990bb100684703c1699c
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/05dd1fe652de9af906a9e44519926cbc02dfb5a2...e031a5cc893d00c1bc5c990bb100684703c1699c
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list