mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 04:36:36 +08:00
VA sample: device autodetection changed
This commit is contained in:
parent
0aca3fb5af
commit
9a7df7a85d
@ -87,7 +87,6 @@ static unsigned readId(const char* devName, const char* idName)
|
||||
static int findAdapter(unsigned desiredVendorId)
|
||||
{
|
||||
int adapterIndex = -1;
|
||||
int numAdapters = 0;
|
||||
|
||||
Directory dir(VA_INTEL_PCI_DIR);
|
||||
|
||||
@ -101,10 +100,18 @@ static int findAdapter(unsigned desiredVendorId)
|
||||
unsigned vendorId = readId(name, "vendor");
|
||||
if (vendorId == desiredVendorId)
|
||||
{
|
||||
adapterIndex = numAdapters;
|
||||
char subdirName[256];
|
||||
snprintf(subdirName, sizeof(subdirName), "%s/%s/%s", VA_INTEL_PCI_DIR, name, "drm");
|
||||
Directory subdir(subdirName);
|
||||
for (int j = 0; j < subdir.count(); ++j)
|
||||
{
|
||||
if (!strncmp(subdir[j]->d_name, "card", 4))
|
||||
{
|
||||
adapterIndex = strtoul(subdir[j]->d_name + 4, NULL, 10);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
++numAdapters;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user