Skip to content

Commit 13b639f

Browse files
jonreckermav-intel
authored andcommitted
Add -props option to vpl-inspect
1 parent da36f2d commit 13b639f

File tree

2 files changed

+126
-1
lines changed

2 files changed

+126
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ GPUs from the command line.
1313
### Added
1414
- Intel® Media Transcode Accelerator as a supported device
1515
- New strings in vpl-inspect tool to improve readability of output.
16+
- Option ``-props`` to vpl-inspect tool to enable property-based
17+
capabilities query.
1618

1719
### Changed
1820
- Default Ubuntu build to 24.04.

tools/cli/vpl-inspect/src/vpl-inspect.cpp

Lines changed: 124 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
#include <stdio.h>
2020

2121
#include <algorithm>
22+
#include <list>
23+
#include <map>
24+
#include <sstream>
2225
#include <string>
2326

2427
#include "vpl/mfx.h"
@@ -461,6 +464,63 @@ const char *_print_ProfileType(mfxU32 fourcc, mfxU32 type) {
461464
}
462465

463466
// clang-format off
467+
468+
#ifdef ONEVPL_EXPERIMENTAL
469+
typedef struct {
470+
mfxU32 propData;
471+
mfxU8 *propStr;
472+
} ConfigPropInfo;
473+
474+
static const std::map<std::string, ConfigPropInfo> ConfigPropMap = {
475+
{ "basic:all", { 0, (mfxU8 *)"mfxImplDescription" } }, // no codec/vpp info, just query minimal (basic) info from mfxImplDescription
476+
477+
{ "dec:all", { 0, (mfxU8 *)"mfxImplDescription.mfxDecoderDescription" } },
478+
{ "enc:all", { 0, (mfxU8 *)"mfxImplDescription.mfxEncoderDescription" } },
479+
{ "vpp:all", { 0, (mfxU8 *)"mfxImplDescription.mfxVPPDescription" } },
480+
481+
{ "dec:av1", { MFX_CODEC_AV1, (mfxU8 *)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID" } },
482+
{ "dec:avc", { MFX_CODEC_AVC, (mfxU8 *)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID" } },
483+
{ "dec:hevc", { MFX_CODEC_HEVC, (mfxU8 *)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID" } },
484+
{ "dec:mpeg2", { MFX_CODEC_MPEG2, (mfxU8 *)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID" } },
485+
{ "dec:vc1", { MFX_CODEC_VC1, (mfxU8 *)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID" } },
486+
{ "dec:vp8", { MFX_CODEC_VP8, (mfxU8 *)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID" } },
487+
{ "dec:vp9", { MFX_CODEC_VP9, (mfxU8 *)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID" } },
488+
{ "dec:vvc", { MFX_CODEC_VVC, (mfxU8 *)"mfxImplDescription.mfxDecoderDescription.decoder.CodecID" } },
489+
490+
{ "enc:av1", { MFX_CODEC_AV1, (mfxU8 *)"mfxImplDescription.mfxEncoderDescription.encoder.CodecID" } },
491+
{ "enc:avc", { MFX_CODEC_AVC, (mfxU8 *)"mfxImplDescription.mfxEncoderDescription.encoder.CodecID" } },
492+
{ "enc:hevc", { MFX_CODEC_HEVC, (mfxU8 *)"mfxImplDescription.mfxEncoderDescription.encoder.CodecID" } },
493+
{ "enc:mpeg2", { MFX_CODEC_MPEG2, (mfxU8 *)"mfxImplDescription.mfxEncoderDescription.encoder.CodecID" } },
494+
{ "enc:vc1", { MFX_CODEC_VC1, (mfxU8 *)"mfxImplDescription.mfxEncoderDescription.encoder.CodecID" } },
495+
{ "enc:vp8", { MFX_CODEC_VP8, (mfxU8 *)"mfxImplDescription.mfxEncoderDescription.encoder.CodecID" } },
496+
{ "enc:vp9", { MFX_CODEC_VP9, (mfxU8 *)"mfxImplDescription.mfxEncoderDescription.encoder.CodecID" } },
497+
{ "enc:vvc", { MFX_CODEC_VVC, (mfxU8 *)"mfxImplDescription.mfxEncoderDescription.encoder.CodecID" } },
498+
499+
{ "vpp:3dlut", { MFX_EXTBUFF_VPP_3DLUT, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
500+
{ "vpp:aifrc", { MFX_EXTBUFF_VPP_AI_FRAME_INTERPOLATION, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
501+
{ "vpp:aisr", { MFX_EXTBUFF_VPP_AI_SUPER_RESOLUTION, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
502+
{ "vpp:auxd", { MFX_EXTBUFF_VPP_AUXDATA, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
503+
{ "vpp:csc", { MFX_EXTBUFF_VPP_COLOR_CONVERSION, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
504+
{ "vpp:cfill", { MFX_EXTBUFF_VPP_COLORFILL, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
505+
{ "vpp:comp", { MFX_EXTBUFF_VPP_COMPOSITE, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
506+
{ "vpp:deint", { MFX_EXTBUFF_VPP_DEINTERLACING, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
507+
{ "vpp:dns2", { MFX_EXTBUFF_VPP_DENOISE2, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
508+
{ "vpp:det", { MFX_EXTBUFF_VPP_DETAIL, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
509+
{ "vpp:douse", { MFX_EXTBUFF_VPP_DOUSE, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
510+
{ "vpp:fproc", { MFX_EXTBUFF_VPP_FIELD_PROCESSING, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
511+
{ "vpp:frc", { MFX_EXTBUFF_VPP_FRAME_RATE_CONVERSION, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
512+
{ "vpp:imgst", { MFX_EXTBUFF_VPP_IMAGE_STABILIZATION, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
513+
{ "vpp:mctf", { MFX_EXTBUFF_VPP_MCTF, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
514+
{ "vpp:mirr", { MFX_EXTBUFF_VPP_MIRRORING, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
515+
{ "vpp:perc", { MFX_EXTBUFF_VPP_PERC_ENC_PREFILTER, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
516+
{ "vpp:proc", { MFX_EXTBUFF_VPP_PROCAMP, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
517+
{ "vpp:rot", { MFX_EXTBUFF_VPP_ROTATION, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
518+
{ "vpp:scale", { MFX_EXTBUFF_VPP_SCALING, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
519+
{ "vpp:scnan", { MFX_EXTBUFF_VPP_SCENE_ANALYSIS, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
520+
{ "vpp:vsig", { MFX_EXTBUFF_VPP_VIDEO_SIGNAL_INFO, (mfxU8 *)"mfxImplDescription.mfxVPPDescription.filter.FilterFourCC" } },
521+
};
522+
#endif
523+
464524
static void Usage(void) {
465525
printf("\nUsage: vpl-inspect [options]\n");
466526
printf("\nIf no options are specified, print default capabilities report (MFX_IMPLCAPS_IMPLDESCSTRUCTURE)\n");
@@ -470,6 +530,10 @@ static void Usage(void) {
470530
printf(" -ex ............ print extended device ID info (MFX_IMPLCAPS_DEVICE_ID_EXTENDED)\n");
471531
printf(" -f ............. print list of implemented functions (MFX_IMPLCAPS_IMPLEMENTEDFUNCTIONS)\n");
472532
printf(" -d3d9 .......... only enumerate implementations supporting D3D9\n");
533+
#ifdef ONEVPL_EXPERIMENTAL
534+
printf(" -props ......... list of props as KV pairs, separated with commas (ex: -props dec:all,enc:av1)\n");
535+
printf(" use '-props list' to print list of available properties\n");
536+
#endif
473537
#if defined(_WIN32) || defined(_WIN64)
474538
printf(" -disp .......... print path to loaded dispatcher library\n");
475539
#endif
@@ -488,8 +552,10 @@ int main(int argc, char *argv[]) {
488552
bool bRequireD3D9 = false;
489553
bool bPrintExtendedDeviceID = false;
490554
bool bPrintDispInfo = false;
555+
bool bPropsQuery = false;
491556
#ifdef ONEVPL_EXPERIMENTAL
492557
bool bPrintSurfaceTypes = true;
558+
std::list<std::string> propStrList;
493559
#endif
494560

495561
for (int argIdx = 1; argIdx < argc; argIdx++) {
@@ -507,6 +573,33 @@ int main(int argc, char *argv[]) {
507573
else if (nextArg == "-d3d9") {
508574
bRequireD3D9 = true;
509575
}
576+
#ifdef ONEVPL_EXPERIMENTAL
577+
else if (nextArg == "-props") {
578+
bPropsQuery = true;
579+
bPrintSurfaceTypes = false;
580+
std::string propStr;
581+
if (++argIdx < argc) {
582+
propStr = argv[argIdx];
583+
584+
std::string s;
585+
std::stringstream propSS(propStr);
586+
while (getline(propSS, s, ',')) {
587+
propStrList.push_back(s);
588+
}
589+
}
590+
else {
591+
printf("Error - must specify which props\n");
592+
return -1;
593+
}
594+
595+
if (propStrList.front() == "list") {
596+
printf("Available props arguments:\n");
597+
for (auto const &it : ConfigPropMap)
598+
printf(" %s\n", it.first.c_str());
599+
return 0;
600+
}
601+
}
602+
#endif
510603
else if (nextArg == "-?" || nextArg == "-help") {
511604
Usage();
512605
return -1;
@@ -568,6 +661,36 @@ int main(int argc, char *argv[]) {
568661
}
569662
}
570663

664+
#ifdef ONEVPL_EXPERIMENTAL
665+
if (bPropsQuery) {
666+
mfxStatus sts;
667+
mfxVariant var = {};
668+
var.Version.Version = MFX_VARIANT_VERSION;
669+
670+
for (const std::string &propStr : propStrList) {
671+
mfxConfig cfg = MFXCreateConfig(
672+
loader); // create new config for every property, for e.g. multiple codecs
673+
674+
auto it = ConfigPropMap.find(propStr);
675+
if (it == ConfigPropMap.end()) {
676+
printf("Error - invalid property string %s\n", propStr.c_str());
677+
printf("run 'vplinspect -props list' for list of supported properties\n");
678+
return -1;
679+
}
680+
681+
// add property with MFX_VARIANT_TYPE_QUERY
682+
var.Type = static_cast<mfxVariantType>(MFX_VARIANT_TYPE_U32 | MFX_VARIANT_TYPE_QUERY);
683+
var.Data.U32 = it->second.propData;
684+
sts = MFXSetConfigFilterProperty(cfg, it->second.propStr, var);
685+
686+
if (sts) {
687+
printf("Error - MFXSetConfigFilterProperty() returned %d\n", sts);
688+
return -1;
689+
}
690+
}
691+
}
692+
#endif
693+
571694
int i = 0;
572695
mfxImplDescription *idesc;
573696
while (MFX_ERR_NONE == MFXEnumImplementations(loader,
@@ -631,7 +754,7 @@ int main(int argc, char *argv[]) {
631754
printf("%4sSubDeviceID: %s\n", "", dev->SubDevices[subdevice].SubDeviceID);
632755
}
633756

634-
if (bFullInfo) {
757+
if (bFullInfo || bPropsQuery) {
635758
/* mfxDecoderDescription */
636759
mfxDecoderDescription *dec = &idesc->Dec;
637760
printf("%2smfxDecoderDescription:\n", "");

0 commit comments

Comments
 (0)