File: vpl_implementation_loader.h

package info (click to toggle)
libvpl-tools 1.4.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,652 kB
  • sloc: cpp: 107,469; python: 4,303; ansic: 3,202; sh: 159; lisp: 52; makefile: 13
file content (94 lines) | stat: -rw-r--r-- 3,105 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*############################################################################
  # Copyright (C) 2021 Intel Corporation
  #
  # SPDX-License-Identifier: MIT
  ############################################################################*/

#ifndef __VPL_IMPLEMENTATION_LOADER_H__
#define __VPL_IMPLEMENTATION_LOADER_H__

#include <memory>
#include <string>
#include <vector>
#include "vpl/mfxdispatcher.h"
#include "vpl/mfxvideo++.h"

#if defined(_WIN32)
    #include <dxgi.h>
#endif

// default behavior for dispatcher low-latency mode
// override via cmd-line switches -dispatcher:fullSearch or -dispatcher:lowLatency
#if defined(_WIN32)
    // Windows: enable dispatcher low-latency path
    #define DEF_DISP_FULLSEARCH false
#else
    // Linux: enable dispatcher full search
    #define DEF_DISP_FULLSEARCH true
#endif

class VPLImplementationLoader {
    std::shared_ptr<_mfxLoader> m_loader;
    std::shared_ptr<mfxImplDescription> m_idesc;

    mfxLoader m_Loader;
    mfxU32 m_ImplIndex;
    mfxImplType m_Impl;
    mfxU16 m_adapterType;
    mfxI32 m_dGfxIdx;
    mfxI32 m_adapterNum;
    mfxVersion m_MinVersion;
    // Extended device ID info, available in 2.6 and newer APIs
    mfxU32 m_PCIDomain;
    mfxU32 m_PCIBus;
    mfxU32 m_PCIDevice;
    mfxU32 m_PCIFunction;
    bool m_PCIDeviceSetup;
#if defined(_WIN32)
    mfxU64 m_LUID;
#else
    mfxU32 m_DRMRenderNodeNum;
    mfxU32 m_DRMRenderNodeNumUsed;
#endif

public:
    VPLImplementationLoader();
    ~VPLImplementationLoader();

    mfxStatus CreateConfig(char const* data, const char* propertyName);
    mfxStatus CreateConfig(mfxU16 data, const char* propertyName);
    mfxStatus CreateConfig(mfxU32 data, const char* propertyName);
    mfxStatus ConfigureImplementation(mfxIMPL impl);
    mfxStatus ConfigureAccelerationMode(mfxAccelerationMode accelerationMode, mfxIMPL impl);
    mfxStatus ConfigureVersion(mfxVersion const version);
    void SetAdapterType(mfxU16 adapterType);
    void SetDiscreteAdapterIndex(mfxI32 dGfxIdx);
    void SetAdapterNum(mfxI32 adapterNum);
    mfxStatus EnumImplementations();
    mfxStatus ConfigureAndEnumImplementations(mfxIMPL impl,
                                              mfxAccelerationMode accelerationMode,
                                              bool lowLatencyMode = true);
    mfxLoader GetLoader() const;
    mfxU32 GetImplIndex() const;
    std::string GetImplName() const;
    mfxU16 GetImplType() const;
    mfxVersion GetVersion() const;
    std::pair<mfxI16, mfxI32> GetDeviceIDAndAdapter() const;
    mfxU16 GetAdapterType() const;
    void SetMinVersion(mfxVersion const& version);
    mfxStatus SetPCIDevice(mfxI32 domain, mfxI32 bus, mfxI32 device, mfxI32 function);
#if defined(_WIN32)
    mfxStatus SetupLUID(LUID luid);
#else
    mfxStatus SetupDRMRenderNodeNum(mfxU32 DRMRenderNodeNum);
    mfxU32 GetDRMRenderNodeNumUsed();
#endif
};

class MainVideoSession : public MFXVideoSession {
public:
    mfxStatus CreateSession(VPLImplementationLoader* Loader);
    mfxStatus PrintLibInfo(VPLImplementationLoader* Loader);
};

#endif //__VPL_IMPLEMENTATION_LOADER_H__