mirror of
https://github.com/LizardByte/Sunshine.git
synced 2025-08-10 00:52:16 +00:00
Test for availability of crct info before using it
This commit is contained in:
@@ -950,6 +950,10 @@ void correlate_to_wayland(std::vector<kms::card_descriptor_t> &cds) {
|
|||||||
std::vector<std::string> kms_display_names() {
|
std::vector<std::string> kms_display_names() {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
|
if(!fs::exists("/dev/dri")) {
|
||||||
|
BOOST_LOG(warning) << "Couldn't find /dev/dri, kmsgrab won't be enabled"sv;
|
||||||
|
}
|
||||||
|
|
||||||
if(!gbm::create_device) {
|
if(!gbm::create_device) {
|
||||||
BOOST_LOG(warning) << "libgbm not initialized"sv;
|
BOOST_LOG(warning) << "libgbm not initialized"sv;
|
||||||
return {};
|
return {};
|
||||||
|
|||||||
@@ -421,14 +421,21 @@ struct x11_attr_t : public display_t {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
crtc_info_t crt_info { x11::rr::GetCrtcInfo(xdisplay.get(), screenr.get(), result->crtc) };
|
if(result->crtc) {
|
||||||
BOOST_LOG(info)
|
crtc_info_t crt_info { x11::rr::GetCrtcInfo(xdisplay.get(), screenr.get(), result->crtc) };
|
||||||
<< "Streaming display: "sv << result->name << " with res "sv << crt_info->width << 'x' << crt_info->height << " offset by "sv << crt_info->x << 'x' << crt_info->y;
|
BOOST_LOG(info)
|
||||||
|
<< "Streaming display: "sv << result->name << " with res "sv << crt_info->width << 'x' << crt_info->height << " offset by "sv << crt_info->x << 'x' << crt_info->y;
|
||||||
|
|
||||||
width = crt_info->width;
|
width = crt_info->width;
|
||||||
height = crt_info->height;
|
height = crt_info->height;
|
||||||
offset_x = crt_info->x;
|
offset_x = crt_info->x;
|
||||||
offset_y = crt_info->y;
|
offset_y = crt_info->y;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
BOOST_LOG(warning) << "Couldn't get requested display info, defaulting to recording entire virtual desktop"sv;
|
||||||
|
width = xattr.width;
|
||||||
|
height = xattr.height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
width = xattr.width;
|
width = xattr.width;
|
||||||
|
|||||||
Reference in New Issue
Block a user