Skip to content

Commit bf884fc

Browse files
committed
Simplify drm device creation process
No logic is changed in this commit. Tracked-On: OAM-130974 Signed-off-by: Weifeng Liu <weifeng.liu@intel.com>
1 parent ccb064d commit bf884fc

File tree

1 file changed

+2
-20
lines changed

1 file changed

+2
-20
lines changed

drm/ResourceManager.cpp

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -126,33 +126,15 @@ void ResourceManager::Init() {
126126

127127
card_num_ = node_num;
128128

129-
// only have card0, is BM/GVT-d/Virtio
130129
if (node_num == 1) {
131130
std::ostringstream path;
132131
path << path_pattern << 0;
133132
auto dev = DrmDevice::CreateInstance(path.str(), this);
134133
if (dev) {
135134
drms_.emplace_back(std::move(dev));
136135
}
137-
}
138-
// is SR-IOV or iGPU + dGPU
139-
// if not find virtio_gpu, we choose igpu
140-
if (node_num == 2) {
141-
int card_id = FindVirtioGpuCard(this, path_pattern, 0, 1);
142-
if (card_id < 0) {
143-
card_id = 0;
144-
}
145-
std::ostringstream path;
146-
path << path_pattern << card_id;
147-
auto dev = DrmDevice::CreateInstance(path.str(), this);
148-
if (dev) {
149-
drms_.emplace_back(std::move(dev));
150-
}
151-
}
152-
// is SRI-IOV + dGPU, use virtio-gpu for display
153-
// if not find virtio_gpu, we choose igpu
154-
if (node_num == 3) {
155-
int card_id = FindVirtioGpuCard(this, path_pattern, 0, 2);
136+
} else if (node_num <= 3) {
137+
int card_id = FindVirtioGpuCard(this, path_pattern, 0, node_num - 1);
156138
if (card_id < 0) {
157139
card_id = 0;
158140
}

0 commit comments

Comments
 (0)