Skip to content

Commit 79c9c23

Browse files
Try fix probing failed issue on some weird systems
1 parent 50087cd commit 79c9c23

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/platform/windows/display_base.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,13 @@ namespace platf::dxgi {
419419

420420
// Try probing with different GPU preferences and verify_frame_capture flag
421421
if (validate_and_test_gpu_preference(display_name, true)) {
422+
set_gpu_preference = true;
422423
return true;
423424
}
424425

425426
// If no valid configuration was found, try again with verify_frame_capture == false
426427
if (validate_and_test_gpu_preference(display_name, false)) {
428+
set_gpu_preference = true;
427429
return true;
428430
}
429431

src/process.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,14 +252,23 @@ namespace proc {
252252
// Set primary display if needed
253253
if (shouldActuallySetPrimary) {
254254
auto disp = shouldSetVDisplayPrimary ? vdisplayName : prevPrimaryDisplayName;
255-
BOOST_LOG(info) << "Setting display " << disp << " primary!!!";
255+
BOOST_LOG(info) << "Setting display " << disp << " primary";
256256

257-
VDISPLAY::setPrimaryDisplay(disp.c_str());
257+
if (!VDISPLAY::setPrimaryDisplay(disp.c_str())) {
258+
BOOST_LOG(info) << "Setting display " << disp << " primary failed! Are you using Windows 11 24H2?";
259+
}
258260
}
259261

260262
// Set virtual_display to true when everything went fine
261263
this->virtual_display = true;
262264
this->display_name = platf::to_utf8(vdisplayName);
265+
266+
if (config::video.headless_mode) {
267+
// When using headless mode, we don't care which display user configured to use.
268+
// So we always set output_name to the newly created virtual display as a workaround for
269+
// empty name when probing graphics cards.
270+
config::video.output_name = this->display_name;
271+
}
263272
}
264273
}
265274
#endif

0 commit comments

Comments
 (0)