mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-24 18:49:49 +01:00
minor fixes for new drm stuff
This commit is contained in:
parent
2dbb77b16b
commit
2b7c89474b
3 changed files with 57 additions and 2 deletions
|
@ -258,6 +258,7 @@ void CCompositor::initServer() {
|
|||
m_bInitialized = true;
|
||||
|
||||
m_iDRMFD = m_pAqBackend->drmFD();
|
||||
Debug::log(LOG, "Running on DRMFD: {}", m_iDRMFD);
|
||||
|
||||
initManagers(STAGE_BASICINIT);
|
||||
|
||||
|
@ -2852,6 +2853,8 @@ void CCompositor::onNewMonitor(SP<Aquamarine::IOutput> output) {
|
|||
if (std::string("HEADLESS-1") == output->name)
|
||||
g_pCompositor->m_pUnsafeOutput = PNEWMONITOR.get();
|
||||
|
||||
Debug::log(LOG, "New output with name {}", output->name);
|
||||
|
||||
PNEWMONITOR->szName = output->name;
|
||||
PNEWMONITOR->output = output;
|
||||
PNEWMONITOR->self = PNEWMONITOR;
|
||||
|
|
|
@ -131,6 +131,49 @@ std::string CHyprCtl::getMonitorData(Hyprutils::Memory::CSharedPointer<CMonitor>
|
|||
return result;
|
||||
}
|
||||
|
||||
std::string monitorsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||
CVarList vars(request, 0, ' ');
|
||||
auto allMonitors = false;
|
||||
|
||||
if (vars.size() > 2)
|
||||
return "too many args";
|
||||
|
||||
if (vars.size() == 2 && vars[1] == "all")
|
||||
allMonitors = true;
|
||||
|
||||
std::string result = "";
|
||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||
result += "[";
|
||||
|
||||
for (auto& m : allMonitors ? g_pCompositor->m_vRealMonitors : g_pCompositor->m_vMonitors) {
|
||||
result += CHyprCtl::getMonitorData(m, format);
|
||||
}
|
||||
|
||||
trimTrailingComma(result);
|
||||
|
||||
result += "]";
|
||||
} else {
|
||||
for (auto& m : allMonitors ? g_pCompositor->m_vRealMonitors : g_pCompositor->m_vMonitors) {
|
||||
if (!m->output || m->ID == -1ull)
|
||||
continue;
|
||||
|
||||
result += std::format(
|
||||
"Monitor {} (ID {}):\n\t{}x{}@{:.5f} at {}x{}\n\tdescription: {}\n\tmake: {}\n\tmodel: {}\n\tserial: {}\n\tactive workspace: {} ({})\n\t"
|
||||
"special workspace: {} ({})\n\treserved: {} {} {} {}\n\tscale: {:.2f}\n\ttransform: {}\n\tfocused: {}\n\t"
|
||||
"dpmsStatus: {}\n\tvrr: {}\n\tactivelyTearing: {}\n\tdisabled: {}\n\tcurrentFormat: {}\n\tavailableModes: {}\n\n",
|
||||
m->szName, m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, m->szShortDescription,
|
||||
m->output->make, m->output->model, m->output->serial, m->activeWorkspaceID(),
|
||||
(!m->activeWorkspace ? "" : m->activeWorkspace->m_szName), m->activeSpecialWorkspaceID(), (m->activeSpecialWorkspace ? m->activeSpecialWorkspace->m_szName : ""),
|
||||
(int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform,
|
||||
(m == g_pCompositor->m_pLastMonitor ? "yes" : "no"), (int)m->dpmsStatus, (int)(m->output->state ? m->output->state->state().adaptiveSync : false),
|
||||
m->tearingState.activelyTearing, !m->m_bEnabled, formatToString(m->drmFormat), availableModesForOutput(m.get(), format));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
static std::string getTagsData(PHLWINDOW w, eHyprCtlOutputFormat format) {
|
||||
const auto tags = w->m_tags.getTags();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ static int cursorTicker(void* data) {
|
|||
CHyprRenderer::CHyprRenderer() {
|
||||
if (g_pCompositor->m_pAqBackend->hasSession()) {
|
||||
for (auto& dev : g_pCompositor->m_pAqBackend->session->sessionDevices) {
|
||||
const auto DRMV = drmGetVersion(dev->fd);
|
||||
const auto DRMV = drmGetVersion(dev->fd);
|
||||
if (!DRMV)
|
||||
continue;
|
||||
std::string name = std::string{DRMV->name, DRMV->name_len};
|
||||
|
@ -1249,7 +1249,7 @@ void CHyprRenderer::renderMonitor(CMonitor* pMonitor) {
|
|||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
|
||||
// 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)
|
||||
return;
|
||||
|
@ -2604,6 +2604,15 @@ bool CHyprRenderer::beginRender(CMonitor* pMonitor, CRegion& damage, eRenderMode
|
|||
int bufferAge = 0;
|
||||
|
||||
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);
|
||||
if (!m_pCurrentBuffer) {
|
||||
Debug::log(ERR, "Failed to acquire swapchain buffer for {}", pMonitor->szName);
|
||||
|
|
Loading…
Reference in a new issue