diff --git a/sunshine/platform/linux/kmsgrab.cpp b/sunshine/platform/linux/kmsgrab.cpp index 6b0389f3..28ef656e 100644 --- a/sunshine/platform/linux/kmsgrab.cpp +++ b/sunshine/platform/linux/kmsgrab.cpp @@ -950,6 +950,10 @@ void correlate_to_wayland(std::vector &cds) { std::vector kms_display_names() { 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) { BOOST_LOG(warning) << "libgbm not initialized"sv; return {}; diff --git a/sunshine/platform/linux/x11grab.cpp b/sunshine/platform/linux/x11grab.cpp index 33797f24..d41bb533 100644 --- a/sunshine/platform/linux/x11grab.cpp +++ b/sunshine/platform/linux/x11grab.cpp @@ -421,14 +421,21 @@ struct x11_attr_t : public display_t { return -1; } - crtc_info_t crt_info { x11::rr::GetCrtcInfo(xdisplay.get(), screenr.get(), result->crtc) }; - 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; + if(result->crtc) { + crtc_info_t crt_info { x11::rr::GetCrtcInfo(xdisplay.get(), screenr.get(), result->crtc) }; + 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; - height = crt_info->height; - offset_x = crt_info->x; - offset_y = crt_info->y; + width = crt_info->width; + height = crt_info->height; + offset_x = crt_info->x; + 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 { width = xattr.width;