Merge pull request #19560 from mshabunin:va-sample-fix

pull/19562/head
Alexander Alekhin 4 years ago
commit 504ff978c5
  1. 13
      samples/va_intel/display.cpp.inc

@ -87,7 +87,6 @@ static unsigned readId(const char* devName, const char* idName)
static int findAdapter(unsigned desiredVendorId) static int findAdapter(unsigned desiredVendorId)
{ {
int adapterIndex = -1; int adapterIndex = -1;
int numAdapters = 0;
Directory dir(VA_INTEL_PCI_DIR); Directory dir(VA_INTEL_PCI_DIR);
@ -101,10 +100,18 @@ static int findAdapter(unsigned desiredVendorId)
unsigned vendorId = readId(name, "vendor"); unsigned vendorId = readId(name, "vendor");
if (vendorId == desiredVendorId) 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; break;
} }
++numAdapters;
} }
} }

Loading…
Cancel
Save