Commit eb10517a authored by Steve Lhomme's avatar Steve Lhomme Committed by Jean-Baptiste Kempf

dxgi_fmt: use a generic way to get the vendor string

Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent 25e71641
......@@ -422,7 +422,7 @@ codec_LTLIBRARIES += libvaapi_plugin.la
endif
libd3d9_common_la_SOURCES = video_chroma/d3d9_fmt.c video_chroma/d3d9_fmt.h \
video_chroma/dxgi_fmt.h
video_chroma/dxgi_fmt.c video_chroma/dxgi_fmt.h
libd3d9_common_la_LDFLAGS = -static
if HAVE_WIN32_DESKTOP
noinst_LTLIBRARIES += libd3d9_common.la
......
......@@ -447,18 +447,6 @@ static void D3dDestroyDevice(vlc_va_t *va)
*/
static char *DxDescribe(vlc_va_sys_t *sys)
{
static const struct {
unsigned id;
char name[32];
} vendors [] = {
{ GPU_MANUFACTURER_AMD, "ATI" },
{ GPU_MANUFACTURER_NVIDIA, "NVIDIA" },
{ GPU_MANUFACTURER_VIA, "VIA" },
{ GPU_MANUFACTURER_INTEL, "Intel" },
{ GPU_MANUFACTURER_S3, "S3 Graphics" },
{ GPU_MANUFACTURER_QUALCOMM, "Qualcomm" },
{ 0, "" }
};
IDXGIAdapter *p_adapter = D3D11DeviceAdapter(sys->d3d_dev.d3ddevice);
if (!p_adapter) {
......@@ -468,20 +456,12 @@ static char *DxDescribe(vlc_va_sys_t *sys)
char *description = NULL;
DXGI_ADAPTER_DESC adapterDesc;
if (SUCCEEDED(IDXGIAdapter_GetDesc(p_adapter, &adapterDesc))) {
const char *vendor = "Unknown";
for (int i = 0; vendors[i].id != 0; i++) {
if (vendors[i].id == adapterDesc.VendorId) {
vendor = vendors[i].name;
break;
}
}
char *utfdesc = FromWide(adapterDesc.Description);
if (likely(utfdesc!=NULL))
{
if (asprintf(&description, "D3D11VA (%s, vendor %u(%s), device %u, revision %u)",
utfdesc,
adapterDesc.VendorId, vendor, adapterDesc.DeviceId, adapterDesc.Revision) < 0)
adapterDesc.VendorId, DxgiVendorStr(adapterDesc.VendorId), adapterDesc.DeviceId, adapterDesc.Revision) < 0)
description = NULL;
free(utfdesc);
}
......
......@@ -368,36 +368,16 @@ static void D3dDestroyDevice(vlc_va_t *va)
*/
static char *DxDescribe(vlc_va_sys_t *sys)
{
static const struct {
unsigned id;
char name[32];
} vendors [] = {
{ 0x1002, "ATI" },
{ 0x10DE, "NVIDIA" },
{ 0x1106, "VIA" },
{ 0x8086, "Intel" },
{ 0x5333, "S3 Graphics" },
{ 0, "" }
};
D3DADAPTER_IDENTIFIER9 d3dai;
if (FAILED(IDirect3D9_GetAdapterIdentifier(sys->hd3d.obj,
sys->d3d_dev.adapterId, 0, &d3dai))) {
return NULL;
}
const char *vendor = "Unknown";
for (int i = 0; vendors[i].id != 0; i++) {
if (vendors[i].id == d3dai.VendorId) {
vendor = vendors[i].name;
break;
}
}
char *description;
if (asprintf(&description, "DXVA2 (%.*s, vendor %lu(%s), device %lu, revision %lu)",
if (asprintf(&description, "DXVA2 (%.*s, vendor %s(%lu), device %lu, revision %lu)",
(int)sizeof(d3dai.Description), d3dai.Description,
d3dai.VendorId, vendor, d3dai.DeviceId, d3dai.Revision) < 0)
DxgiVendorStr(d3dai.VendorId), d3dai.VendorId, d3dai.DeviceId, d3dai.Revision) < 0)
return NULL;
return description;
}
......
......@@ -124,3 +124,26 @@ void DxgiFormatMask(DXGI_FORMAT format, video_format_t *fmt)
fmt->i_bmask = 0xff000000;
}
}
const char *DxgiVendorStr(int gpu_vendor)
{
static const struct {
unsigned id;
const char name[32];
} vendors [] = {
{ GPU_MANUFACTURER_AMD, "ATI" },
{ GPU_MANUFACTURER_NVIDIA, "NVIDIA" },
{ GPU_MANUFACTURER_VIA, "VIA" },
{ GPU_MANUFACTURER_INTEL, "Intel" },
{ GPU_MANUFACTURER_S3, "S3 Graphics" },
{ GPU_MANUFACTURER_QUALCOMM, "Qualcomm" },
{ 0, "Unknown" }
};
int i = 0;
for (i = 0; vendors[i].id != 0; i++) {
if (vendors[i].id == gpu_vendor)
break;
}
return vendors[i].name;
}
......@@ -53,5 +53,6 @@ const char *DxgiFormatToStr(DXGI_FORMAT format);
vlc_fourcc_t DxgiFormatFourcc(DXGI_FORMAT format);
const d3d_format_t *GetRenderFormatList(void);
void DxgiFormatMask(DXGI_FORMAT format, video_format_t *);
const char *DxgiVendorStr(int gpu_vendor);
#endif /* include-guard */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment