minor fixes for new drm stuff

This commit is contained in:
Vaxry 2024-06-24 23:22:27 +02:00
parent 48bf839230
commit 60d04e196d
2 changed files with 14 additions and 2 deletions

View file

@ -257,6 +257,7 @@ void CCompositor::initServer() {
m_bInitialized = true; m_bInitialized = true;
m_iDRMFD = m_pAqBackend->drmFD(); m_iDRMFD = m_pAqBackend->drmFD();
Debug::log(LOG, "Running on DRMFD: {}", m_iDRMFD);
initManagers(STAGE_BASICINIT); initManagers(STAGE_BASICINIT);
@ -2848,6 +2849,8 @@ void CCompositor::onNewMonitor(SP<Aquamarine::IOutput> output) {
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();
Debug::log(LOG, "New output with name {}", output->name);
PNEWMONITOR->szName = output->name; PNEWMONITOR->szName = output->name;
PNEWMONITOR->output = output; PNEWMONITOR->output = output;
PNEWMONITOR->self = PNEWMONITOR; PNEWMONITOR->self = PNEWMONITOR;

View file

@ -27,7 +27,7 @@ static int cursorTicker(void* data) {
CHyprRenderer::CHyprRenderer() { CHyprRenderer::CHyprRenderer() {
if (g_pCompositor->m_pAqBackend->hasSession()) { if (g_pCompositor->m_pAqBackend->hasSession()) {
for (auto& dev : g_pCompositor->m_pAqBackend->session->sessionDevices) { for (auto& dev : g_pCompositor->m_pAqBackend->session->sessionDevices) {
const auto DRMV = drmGetVersion(dev->fd); const auto DRMV = drmGetVersion(dev->fd);
if (!DRMV) if (!DRMV)
continue; continue;
std::string name = std::string{DRMV->name, DRMV->name_len}; std::string name = std::string{DRMV->name, DRMV->name_len};
@ -1246,7 +1246,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
clock_gettime(CLOCK_MONOTONIC, &now); clock_gettime(CLOCK_MONOTONIC, &now);
// check the damage // check the damage
bool hasChanged = /*pMonitor->output->needs_frame ||*/ pMonitor->damage.hasChanged(); bool hasChanged = pMonitor->output->needsFrame || pMonitor->damage.hasChanged();
if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && pMonitor->forceFullFrames == 0 && damageBlinkCleanup == 0) if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && pMonitor->forceFullFrames == 0 && damageBlinkCleanup == 0)
return; return;
@ -2601,6 +2601,15 @@ bool CHyprRenderer::beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode
int bufferAge = 0; int bufferAge = 0;
if (!buffer) { if (!buffer) {
Aquamarine::SSwapchainOptions opts = pMonitor->output->swapchain->currentOptions();
opts.length = 2;
opts.size = pMonitor->currentMode->pixelSize;
opts.format = pMonitor->drmFormat;
if (!pMonitor->output->swapchain->reconfigure(opts)) {
Debug::log(ERR, "Failed to reconfigure swapchain for {}", pMonitor->szName);
return false;
}
m_pCurrentBuffer = pMonitor->output->swapchain->next(&bufferAge); m_pCurrentBuffer = pMonitor->output->swapchain->next(&bufferAge);
if (!m_pCurrentBuffer) { if (!m_pCurrentBuffer) {
Debug::log(ERR, "Failed to acquire swapchain buffer for {}", pMonitor->szName); Debug::log(ERR, "Failed to acquire swapchain buffer for {}", pMonitor->szName);