support headless

This commit is contained in:
Vaxry 2024-07-01 14:33:20 +02:00
parent 744d08af84
commit 8d22bf4883

View file

@ -227,6 +227,9 @@ void CCompositor::initServer() {
std::vector<Aquamarine::SBackendImplementationOptions> implementations; std::vector<Aquamarine::SBackendImplementationOptions> implementations;
Aquamarine::SBackendImplementationOptions option; Aquamarine::SBackendImplementationOptions option;
option.backendType = Aquamarine::eBackendType::AQ_BACKEND_HEADLESS;
option.backendRequestMode = Aquamarine::eBackendRequestMode::AQ_BACKEND_REQUEST_MANDATORY;
implementations.emplace_back(option);
option.backendType = Aquamarine::eBackendType::AQ_BACKEND_DRM; option.backendType = Aquamarine::eBackendType::AQ_BACKEND_DRM;
option.backendRequestMode = Aquamarine::eBackendRequestMode::AQ_BACKEND_REQUEST_IF_AVAILABLE; option.backendRequestMode = Aquamarine::eBackendRequestMode::AQ_BACKEND_REQUEST_IF_AVAILABLE;
implementations.emplace_back(option); implementations.emplace_back(option);
@ -533,23 +536,21 @@ void CCompositor::removeLockFile() {
} }
void CCompositor::prepareFallbackOutput() { void CCompositor::prepareFallbackOutput() {
// TODO: // create a backup monitor
// // create a backup monitor SP<Aquamarine::IBackendImplementation> headless;
// wlr_backend* headless = nullptr; for (auto& impl : m_pAqBackend->getImplementations()) {
// wlr_multi_for_each_backend( if (impl->type() == Aquamarine::AQ_BACKEND_HEADLESS) {
// m_sWLRBackend, headless = impl;
// [](wlr_backend* b, void* data) { break;
// if (wlr_backend_is_headless(b)) }
// *((wlr_backend**)data) = b; }
// },
// &headless);
// if (!headless) { if (!headless) {
// Debug::log(WARN, "Unsafe state will be ineffective, no fallback output"); Debug::log(WARN, "No headless in prepareFallbackOutput?!");
// return; return;
// } }
// wlr_headless_add_output(headless, 1920, 1080); headless->createOutput();
} }
void CCompositor::startCompositor() { void CCompositor::startCompositor() {
@ -2854,8 +2855,10 @@ static void checkDefaultCursorWarp(SP<CMonitor> PNEWMONITOR, std::string monitor
void CCompositor::onNewMonitor(SP<Aquamarine::IOutput> output) { void CCompositor::onNewMonitor(SP<Aquamarine::IOutput> output) {
// add it to real // add it to real
auto PNEWMONITOR = g_pCompositor->m_vRealMonitors.emplace_back(makeShared<CMonitor>()); auto PNEWMONITOR = g_pCompositor->m_vRealMonitors.emplace_back(makeShared<CMonitor>());
if (std::string("HEADLESS-1") == output->name) if (std::string("HEADLESS-1") == output->name) {
g_pCompositor->m_pUnsafeOutput = PNEWMONITOR.get(); g_pCompositor->m_pUnsafeOutput = PNEWMONITOR.get();
output->name = "FALLBACK"; // we are allowed to do this :)
}
Debug::log(LOG, "New output with name {}", output->name); Debug::log(LOG, "New output with name {}", output->name);