debug: move to hyprutils' logger (#12673)

This commit is contained in:
Vaxry 2025-12-18 17:23:24 +00:00 committed by GitHub
parent f88deb928a
commit 6175ecd4c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
147 changed files with 1696 additions and 1709 deletions

View file

@ -12,7 +12,7 @@ static std::vector<std::pair<pid_t, WP<CAsyncDialogBox>>> asyncDialogBoxes;
//
SP<CAsyncDialogBox> CAsyncDialogBox::create(const std::string& title, const std::string& description, std::vector<std::string> buttons) {
if (!NFsUtils::executableExistsInPath("hyprland-dialog")) {
Debug::log(ERR, "CAsyncDialogBox: cannot create, no hyprland-dialog");
Log::logger->log(Log::ERR, "CAsyncDialogBox: cannot create, no hyprland-dialog");
return nullptr;
}
@ -63,7 +63,7 @@ void CAsyncDialogBox::onWrite(int fd, uint32_t mask) {
// TODO: can we avoid this without risking a blocking read()?
int fdFlags = fcntl(fd, F_GETFL, 0);
if (fcntl(fd, F_SETFL, fdFlags | O_NONBLOCK) < 0) {
Debug::log(ERR, "CAsyncDialogBox::onWrite: fcntl 1 failed!");
Log::logger->log(Log::ERR, "CAsyncDialogBox::onWrite: fcntl 1 failed!");
return;
}
@ -73,13 +73,13 @@ void CAsyncDialogBox::onWrite(int fd, uint32_t mask) {
// restore the flags (otherwise libwayland won't give us a hangup)
if (fcntl(fd, F_SETFL, fdFlags) < 0) {
Debug::log(ERR, "CAsyncDialogBox::onWrite: fcntl 2 failed!");
Log::logger->log(Log::ERR, "CAsyncDialogBox::onWrite: fcntl 2 failed!");
return;
}
}
if (mask & (WL_EVENT_HANGUP | WL_EVENT_ERROR)) {
Debug::log(LOG, "CAsyncDialogBox: dialog {:x} hung up, closed.");
Log::logger->log(Log::DEBUG, "CAsyncDialogBox: dialog {:x} hung up, closed.");
m_promiseResolver->resolve(m_stdout);
std::erase_if(asyncDialogBoxes, [this](const auto& e) { return e.first == m_dialogPid; });
@ -102,7 +102,7 @@ SP<CPromise<std::string>> CAsyncDialogBox::open() {
int outPipe[2];
if (pipe(outPipe)) {
Debug::log(ERR, "CAsyncDialogBox::open: failed to pipe()");
Log::logger->log(Log::ERR, "CAsyncDialogBox::open: failed to pipe()");
return nullptr;
}
@ -113,14 +113,14 @@ SP<CPromise<std::string>> CAsyncDialogBox::open() {
m_readEventSource = wl_event_loop_add_fd(g_pEventLoopManager->m_wayland.loop, m_pipeReadFd.get(), WL_EVENT_READABLE, ::onFdWrite, this);
if (!m_readEventSource) {
Debug::log(ERR, "CAsyncDialogBox::open: failed to add read fd to loop");
Log::logger->log(Log::ERR, "CAsyncDialogBox::open: failed to add read fd to loop");
return nullptr;
}
m_selfReference = m_selfWeakReference.lock();
if (!proc.runAsync()) {
Debug::log(ERR, "CAsyncDialogBox::open: failed to run async");
Log::logger->log(Log::ERR, "CAsyncDialogBox::open: failed to run async");
wl_event_source_remove(m_readEventSource);
return nullptr;
}

View file

@ -1,7 +1,7 @@
#include "Format.hpp"
#include <vector>
#include "../includes.hpp"
#include "debug/Log.hpp"
#include "debug/log/Logger.hpp"
#include "../macros.hpp"
#include <xf86drm.h>
#include <drm_fourcc.h>

View file

@ -19,6 +19,7 @@
#include <fcntl.h>
#include <iomanip>
#include <sstream>
#include <fstream>
#ifdef HAS_EXECINFO
#include <execinfo.h>
#endif
@ -103,7 +104,7 @@ std::optional<float> getPlusMinusKeywordResult(std::string source, float relativ
try {
return relative + stof(source);
} catch (...) {
Debug::log(ERR, "Invalid arg \"{}\" in getPlusMinusKeywordResult!", source);
Log::logger->log(Log::ERR, "Invalid arg \"{}\" in getPlusMinusKeywordResult!", source);
return {};
}
}
@ -148,7 +149,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
const bool same_mon = in.substr(5).contains("m");
const bool next = in.substr(5).contains("n");
if ((same_mon || next) && !Desktop::focusState()->monitor()) {
Debug::log(ERR, "Empty monitor workspace on monitor null!");
Log::logger->log(Log::ERR, "Empty monitor workspace on monitor null!");
return {WORKSPACE_INVALID};
}
@ -186,14 +187,14 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
const auto PLASTWORKSPACE = g_pCompositor->getWorkspaceByID(PREVWORKSPACEIDNAME.id);
if (!PLASTWORKSPACE) {
Debug::log(LOG, "previous workspace {} doesn't exist yet", PREVWORKSPACEIDNAME.id);
Log::logger->log(Log::DEBUG, "previous workspace {} doesn't exist yet", PREVWORKSPACEIDNAME.id);
return {PREVWORKSPACEIDNAME.id, PREVWORKSPACEIDNAME.name};
}
return {PLASTWORKSPACE->m_id, PLASTWORKSPACE->m_name};
} else if (in == "next") {
if (!Desktop::focusState()->monitor() || !Desktop::focusState()->monitor()->m_activeWorkspace) {
Debug::log(ERR, "no active monitor or workspace for 'next'");
Log::logger->log(Log::ERR, "no active monitor or workspace for 'next'");
return {WORKSPACE_INVALID};
}
@ -211,7 +212,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
if (in[0] == 'r' && (in[1] == '-' || in[1] == '+' || in[1] == '~') && isNumber(in.substr(2))) {
bool absolute = in[1] == '~';
if (!Desktop::focusState()->monitor()) {
Debug::log(ERR, "Relative monitor workspace on monitor null!");
Log::logger->log(Log::ERR, "Relative monitor workspace on monitor null!");
return {WORKSPACE_INVALID};
}
@ -373,7 +374,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
bool absolute = in[1] == '~';
if (!Desktop::focusState()->monitor()) {
Debug::log(ERR, "Relative monitor workspace on monitor null!");
Log::logger->log(Log::ERR, "Relative monitor workspace on monitor null!");
return {WORKSPACE_INVALID};
}
@ -445,7 +446,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
result.id = std::max(sc<int>(PLUSMINUSRESULT.value()), 1);
} else {
Debug::log(ERR, "Relative workspace on no mon!");
Log::logger->log(Log::ERR, "Relative workspace on no mon!");
return {WORKSPACE_INVALID};
}
} else if (isNumber(in))
@ -524,12 +525,12 @@ void logSystemInfo() {
uname(&unameInfo);
Debug::log(LOG, "System name: {}", std::string{unameInfo.sysname});
Debug::log(LOG, "Node name: {}", std::string{unameInfo.nodename});
Debug::log(LOG, "Release: {}", std::string{unameInfo.release});
Debug::log(LOG, "Version: {}", std::string{unameInfo.version});
Log::logger->log(Log::DEBUG, "System name: {}", std::string{unameInfo.sysname});
Log::logger->log(Log::DEBUG, "Node name: {}", std::string{unameInfo.nodename});
Log::logger->log(Log::DEBUG, "Release: {}", std::string{unameInfo.release});
Log::logger->log(Log::DEBUG, "Version: {}", std::string{unameInfo.version});
Debug::log(NONE, "\n");
Log::logger->log(Log::DEBUG, "\n");
#if defined(__DragonFly__) || defined(__FreeBSD__)
const std::string GPUINFO = execAndGet("pciconf -lv | grep -F -A4 vga");
@ -555,16 +556,16 @@ void logSystemInfo() {
#else
const std::string GPUINFO = execAndGet("lspci -vnn | grep -E '(VGA|Display|3D)'");
#endif
Debug::log(LOG, "GPU information:\n{}\n", GPUINFO);
Log::logger->log(Log::DEBUG, "GPU information:\n{}\n", GPUINFO);
if (GPUINFO.contains("NVIDIA")) {
Debug::log(WARN, "Warning: you're using an NVIDIA GPU. Make sure you follow the instructions on the wiki if anything is amiss.\n");
Log::logger->log(Log::WARN, "Warning: you're using an NVIDIA GPU. Make sure you follow the instructions on the wiki if anything is amiss.\n");
}
// log etc
Debug::log(LOG, "os-release:");
Log::logger->log(Log::DEBUG, "os-release:");
Debug::log(NONE, "{}", NFsUtils::readFileAsString("/etc/os-release").value_or("error"));
Log::logger->log(Log::DEBUG, "{}", NFsUtils::readFileAsString("/etc/os-release").value_or("error"));
}
int64_t getPPIDof(int64_t pid) {
@ -767,17 +768,10 @@ std::vector<SCallstackFrameInfo> getBacktrace() {
}
void throwError(const std::string& err) {
Debug::log(CRIT, "Critical error thrown: {}", err);
Log::logger->log(Log::CRIT, "Critical error thrown: {}", err);
throw std::runtime_error(err);
}
bool envEnabled(const std::string& env) {
const auto ENV = getenv(env.c_str());
if (!ENV)
return false;
return std::string(ENV) == "1";
}
std::pair<CFileDescriptor, std::string> openExclusiveShm() {
// Only absolute paths can be shared across different shm_open() calls
std::string name = "/" + g_pTokenManager->getRandomUUID();
@ -872,7 +866,7 @@ bool isNvidiaDriverVersionAtLeast(int threshold) {
if (firstDot != std::string::npos)
driverMajor = std::stoi(driverInfo.substr(0, firstDot));
Debug::log(LOG, "Parsed NVIDIA major version: {}", driverMajor);
Log::logger->log(Log::DEBUG, "Parsed NVIDIA major version: {}", driverMajor);
} catch (std::exception& e) {
driverMajor = 0; // Default to 0 if parsing fails

View file

@ -36,7 +36,6 @@ std::optional<float> getPlusMinusKeywordResult(std::string in
double normalizeAngleRad(double ang);
std::vector<SCallstackFrameInfo> getBacktrace();
void throwError(const std::string& err);
bool envEnabled(const std::string& env);
Hyprutils::OS::CFileDescriptor allocateSHMFile(size_t len);
bool allocateSHMFilePair(size_t size, Hyprutils::OS::CFileDescriptor& rw_fd_ptr, Hyprutils::OS::CFileDescriptor& ro_fd_ptr);
float stringToPercentage(const std::string& VALUE, const float REL);

View file

@ -33,7 +33,7 @@
#include "../desktop/view/LayerSurface.hpp"
#include "../desktop/state/FocusState.hpp"
#include <aquamarine/output/Output.hpp>
#include "debug/Log.hpp"
#include "debug/log/Logger.hpp"
#include "debug/HyprNotificationOverlay.hpp"
#include "MonitorFrameScheduler.hpp"
#include <hyprutils/string/String.hpp>
@ -146,14 +146,14 @@ void CMonitor::onConnect(bool noRule) {
});
m_listeners.destroy = m_output->events.destroy.listen([this] {
Debug::log(LOG, "Destroy called for monitor {}", m_name);
Log::logger->log(Log::DEBUG, "Destroy called for monitor {}", m_name);
onDisconnect(true);
m_output = nullptr;
m_renderingInitPassed = false;
Debug::log(LOG, "Removing monitor {} from realMonitors", m_name);
Log::logger->log(Log::DEBUG, "Removing monitor {} from realMonitors", m_name);
std::erase_if(g_pCompositor->m_realMonitors, [&](PHLMONITOR& el) { return el.get() == this; });
});
@ -165,7 +165,7 @@ void CMonitor::onConnect(bool noRule) {
if (m_createdByUser)
return;
Debug::log(LOG, "Reapplying monitor rule for {} from a state request", m_name);
Log::logger->log(Log::DEBUG, "Reapplying monitor rule for {} from a state request", m_name);
applyMonitorRule(&m_activeMonitorRule, true);
return;
}
@ -224,7 +224,7 @@ void CMonitor::onConnect(bool noRule) {
m_output->state->setEnabled(false);
if (!m_state.commit())
Debug::log(ERR, "Couldn't commit disabled state on output {}", m_output->name);
Log::logger->log(Log::ERR, "Couldn't commit disabled state on output {}", m_output->name);
m_enabled = false;
@ -233,7 +233,7 @@ void CMonitor::onConnect(bool noRule) {
}
if (m_output->nonDesktop) {
Debug::log(LOG, "Not configuring non-desktop output");
Log::logger->log(Log::DEBUG, "Not configuring non-desktop output");
for (auto& [name, lease] : PROTO::lease) {
if (!lease || m_output->getBackend() != lease->getBackend())
@ -270,11 +270,11 @@ void CMonitor::onConnect(bool noRule) {
applyMonitorRule(&monitorRule, true);
if (!m_state.commit())
Debug::log(WARN, "state.commit() failed in CMonitor::onCommit");
Log::logger->log(Log::WARN, "state.commit() failed in CMonitor::onCommit");
m_damage.setSize(m_transformedSize);
Debug::log(LOG, "Added new monitor with name {} at {:j0} with size {:j0}, pointer {:x}", m_output->name, m_position, m_pixelSize, rc<uintptr_t>(m_output.get()));
Log::logger->log(Log::DEBUG, "Added new monitor with name {} at {:j0} with size {:j0}, pointer {:x}", m_output->name, m_position, m_pixelSize, rc<uintptr_t>(m_output.get()));
setupDefaultWS(monitorRule);
@ -317,18 +317,18 @@ void CMonitor::onConnect(bool noRule) {
}
}
Debug::log(LOG, "checking if we have seen this monitor before: {}", m_name);
Log::logger->log(Log::DEBUG, "checking if we have seen this monitor before: {}", m_name);
// if we saw this monitor before, set it to the workspace it was on
if (g_pCompositor->m_seenMonitorWorkspaceMap.contains(m_name)) {
auto workspaceID = g_pCompositor->m_seenMonitorWorkspaceMap[m_name];
Debug::log(LOG, "Monitor {} was on workspace {}, setting it to that", m_name, workspaceID);
Log::logger->log(Log::DEBUG, "Monitor {} was on workspace {}, setting it to that", m_name, workspaceID);
auto ws = g_pCompositor->getWorkspaceByID(workspaceID);
if (ws) {
g_pCompositor->moveWorkspaceToMonitor(ws, m_self.lock());
changeWorkspace(ws, true, false, false);
}
} else
Debug::log(LOG, "Monitor {} was not on any workspace", m_name);
Log::logger->log(Log::DEBUG, "Monitor {} was not on any workspace", m_name);
if (!found)
Desktop::focusState()->rawMonitorFocus(m_self.lock());
@ -360,7 +360,7 @@ void CMonitor::onDisconnect(bool destroy) {
if (!m_enabled || g_pCompositor->m_isShuttingDown)
return;
Debug::log(LOG, "onDisconnect called for {}", m_output->name);
Log::logger->log(Log::DEBUG, "onDisconnect called for {}", m_output->name);
m_events.disconnect.emit();
if (g_pHyprOpenGL)
@ -368,7 +368,7 @@ void CMonitor::onDisconnect(bool destroy) {
// record what workspace this monitor was on
if (m_activeWorkspace) {
Debug::log(LOG, "Disconnecting Monitor {} was on workspace {}", m_name, m_activeWorkspace->m_id);
Log::logger->log(Log::DEBUG, "Disconnecting Monitor {} was on workspace {}", m_name, m_activeWorkspace->m_id);
g_pCompositor->m_seenMonitorWorkspaceMap[m_name] = m_activeWorkspace->m_id;
}
@ -412,10 +412,10 @@ void CMonitor::onDisconnect(bool destroy) {
}
std::erase_if(g_pCompositor->m_monitors, [&](PHLMONITOR& el) { return el.get() == this; });
Debug::log(LOG, "Removed monitor {}!", m_name);
Log::logger->log(Log::DEBUG, "Removed monitor {}!", m_name);
if (!BACKUPMON) {
Debug::log(WARN, "Unplugged last monitor, entering an unsafe state. Good luck my friend.");
Log::logger->log(Log::WARN, "Unplugged last monitor, entering an unsafe state. Good luck my friend.");
g_pCompositor->enterUnsafeState();
}
@ -453,7 +453,7 @@ void CMonitor::onDisconnect(bool destroy) {
m_output->state->setEnabled(false);
if (!m_state.commit())
Debug::log(WARN, "state.commit() failed in CMonitor::onDisconnect");
Log::logger->log(Log::WARN, "state.commit() failed in CMonitor::onDisconnect");
if (Desktop::focusState()->monitor() == m_self)
Desktop::focusState()->rawMonitorFocus(BACKUPMON ? BACKUPMON : g_pCompositor->m_unsafeOutput.lock());
@ -560,7 +560,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
static auto PDISABLESCALECHECKS = CConfigValue<Hyprlang::INT>("debug:disable_scale_checks");
Debug::log(LOG, "Applying monitor rule for {}", m_name);
Log::logger->log(Log::DEBUG, "Applying monitor rule for {}", m_name);
m_activeMonitorRule = *pMonitorRule;
@ -585,7 +585,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
if (!m_enabled) {
onConnect(true); // enable it.
Debug::log(LOG, "Monitor {} is disabled but is requested to be enabled", m_name);
Log::logger->log(Log::DEBUG, "Monitor {} is disabled but is requested to be enabled", m_name);
force = true;
}
@ -605,7 +605,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
RULE->supportsWideColor == m_supportsWideColor && RULE->supportsHDR == m_supportsHDR && RULE->minLuminance == m_minLuminance && RULE->maxLuminance == m_maxLuminance &&
RULE->maxAvgLuminance == m_maxAvgLuminance && !std::memcmp(&m_customDrmMode, &RULE->drmMode, sizeof(m_customDrmMode)) && m_reservedArea == RULE->reservedArea) {
Debug::log(LOG, "Not applying a new rule to {} because it's already applied!", m_name);
Log::logger->log(Log::DEBUG, "Not applying a new rule to {} because it's already applied!", m_name);
setMirror(RULE->mirrorOf);
@ -642,7 +642,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
// last fallback is always preferred mode
if (!m_output->preferredMode())
Debug::log(ERR, "Monitor {} has NO PREFERRED MODE", m_output->name);
Log::logger->log(Log::ERR, "Monitor {} has NO PREFERRED MODE", m_output->name);
else
requestedModes.push_back(m_output->preferredMode());
@ -717,7 +717,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
// then if requested is custom, try custom mode first
if (RULE->drmMode.type == DRM_MODE_TYPE_USERDEF) {
if (m_output->getBackend()->type() != Aquamarine::eBackendType::AQ_BACKEND_DRM)
Debug::log(ERR, "Tried to set custom modeline on non-DRM output");
Log::logger->log(Log::ERR, "Tried to set custom modeline on non-DRM output");
else
requestedModes.push_back(makeShared<Aquamarine::SOutputMode>(
Aquamarine::SOutputMode{.pixelSize = {RULE->drmMode.hdisplay, RULE->drmMode.vdisplay}, .refreshRate = RULE->drmMode.vrefresh, .modeInfo = RULE->drmMode}));
@ -737,13 +737,13 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_drmFormat = DRM_FORMAT_XRGB8888;
m_output->state->resetExplicitFences();
if (Debug::m_trace) {
Debug::log(TRACE, "Monitor {} requested modes:", m_name);
if (Env::isTrace()) {
Log::logger->log(Log::TRACE, "Monitor {} requested modes:", m_name);
if (requestedModes.empty())
Debug::log(TRACE, "| None");
Log::logger->log(Log::TRACE, "| None");
else {
for (auto const& mode : requestedModes | std::views::reverse) {
Debug::log(TRACE, "| {:X0}@{:.2f}Hz", mode->pixelSize, mode->refreshRate / 1000.f);
Log::logger->log(Log::TRACE, "| {:X0}@{:.2f}Hz", mode->pixelSize, mode->refreshRate / 1000.f);
}
}
}
@ -755,7 +755,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_output->state->setCustomMode(mode);
if (!m_state.test()) {
Debug::log(ERR, "Monitor {}: REJECTED custom mode {}!", m_name, modeStr);
Log::logger->log(Log::ERR, "Monitor {}: REJECTED custom mode {}!", m_name, modeStr);
continue;
}
@ -764,9 +764,9 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_output->state->setMode(mode);
if (!m_state.test()) {
Debug::log(ERR, "Monitor {}: REJECTED available mode {}!", m_name, modeStr);
Log::logger->log(Log::ERR, "Monitor {}: REJECTED available mode {}!", m_name, modeStr);
if (mode->preferred)
Debug::log(ERR, "Monitor {}: REJECTED preferred mode!!!", m_name);
Log::logger->log(Log::ERR, "Monitor {}: REJECTED preferred mode!!!", m_name);
continue;
}
@ -780,11 +780,11 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
success = true;
if (mode->preferred)
Debug::log(LOG, "Monitor {}: requested {}, using preferred mode {}", m_name, requestedStr, modeStr);
Log::logger->log(Log::DEBUG, "Monitor {}: requested {}, using preferred mode {}", m_name, requestedStr, modeStr);
else if (mode->modeInfo.has_value() && mode->modeInfo->type == DRM_MODE_TYPE_USERDEF)
Debug::log(LOG, "Monitor {}: requested {}, using custom mode {}", m_name, requestedStr, modeStr);
Log::logger->log(Log::DEBUG, "Monitor {}: requested {}, using custom mode {}", m_name, requestedStr, modeStr);
else
Debug::log(LOG, "Monitor {}: requested {}, using available mode {}", m_name, requestedStr, modeStr);
Log::logger->log(Log::DEBUG, "Monitor {}: requested {}, using available mode {}", m_name, requestedStr, modeStr);
break;
}
@ -798,7 +798,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_output->state->setCustomMode(mode);
if (m_state.test()) {
Debug::log(LOG, "Monitor {}: requested {}, using custom mode {}", m_name, requestedStr, modeStr);
Log::logger->log(Log::DEBUG, "Monitor {}: requested {}, using custom mode {}", m_name, requestedStr, modeStr);
refreshRate = mode->refreshRate / 1000.f;
m_size = mode->pixelSize;
@ -807,7 +807,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
success = true;
} else
Debug::log(ERR, "Monitor {}: REJECTED custom mode {}!", m_name, modeStr);
Log::logger->log(Log::ERR, "Monitor {}: REJECTED custom mode {}!", m_name, modeStr);
}
// try any of the modes if none of the above work
@ -820,7 +820,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
auto errorMessage = I18n::i18nEngine()->localize(I18n::TXT_KEY_NOTIF_MONITOR_MODE_FAIL,
{{"name", m_name}, {"mode", std::format("{:X0}@{:.2f}Hz", mode->pixelSize, mode->refreshRate / 1000.f)}});
Debug::log(WARN, errorMessage);
Log::logger->log(Log::WARN, errorMessage);
g_pHyprNotificationOverlay->addNotification(errorMessage, CHyprColor(0xff0000ff), 5000, ICON_WARNING);
m_refreshRate = mode->refreshRate / 1000.f;
@ -835,7 +835,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
}
if (!success) {
Debug::log(ERR, "Monitor {} has NO FALLBACK MODES, and an INVALID one was requested: {:X0}@{:.2f}Hz", m_name, RULE->resolution, RULE->refreshRate);
Log::logger->log(Log::ERR, "Monitor {} has NO FALLBACK MODES, and an INVALID one was requested: {:X0}@{:.2f}Hz", m_name, RULE->resolution, RULE->refreshRate);
return true;
}
@ -863,9 +863,9 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_drmFormat = fmt.second;
if (!m_state.test()) {
Debug::log(ERR, "output {} failed basic test on format {}", m_name, fmt.first);
Log::logger->log(Log::ERR, "output {} failed basic test on format {}", m_name, fmt.first);
} else {
Debug::log(LOG, "output {} succeeded basic test on format {}", m_name, fmt.first);
Log::logger->log(Log::DEBUG, "output {} succeeded basic test on format {}", m_name, fmt.first);
if (RULE->enable10bit && fmt.first.contains("101010"))
set10bit = true;
break;
@ -937,13 +937,13 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
if (autoScale)
m_scale = std::round(scaleZero);
else {
Debug::log(ERR, "Invalid scale passed to monitor, {} failed to find a clean divisor", m_scale);
Log::logger->log(Log::ERR, "Invalid scale passed to monitor, {} failed to find a clean divisor", m_scale);
g_pConfigManager->addParseError("Invalid scale passed to monitor " + m_name + ", failed to find a clean divisor");
m_scale = getDefaultScale();
}
} else {
if (!autoScale) {
Debug::log(ERR, "Invalid scale passed to monitor, {} found suggestion {}", m_scale, searchScale);
Log::logger->log(Log::ERR, "Invalid scale passed to monitor, {} found suggestion {}", m_scale, searchScale);
static auto PDISABLENOTIFICATION = CConfigValue<Hyprlang::INT>("misc:disable_scale_notification");
if (!*PDISABLENOTIFICATION)
g_pHyprNotificationOverlay->addNotification(
@ -959,7 +959,7 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
m_output->scheduleFrame();
if (!m_state.commit())
Debug::log(ERR, "Couldn't commit output named {}", m_output->name);
Log::logger->log(Log::ERR, "Couldn't commit output named {}", m_output->name);
Vector2D xfmd = m_transform % 2 == 1 ? Vector2D{m_pixelSize.y, m_pixelSize.x} : m_pixelSize;
m_size = (xfmd / m_scale).round();
@ -994,8 +994,8 @@ bool CMonitor::applyMonitorRule(SMonitorRule* pMonitorRule, bool force) {
// reload to fix mirrors
g_pConfigManager->m_wantsMonitorReload = true;
Debug::log(LOG, "Monitor {} data dump: res {:X}@{:.2f}Hz, scale {:.2f}, transform {}, pos {:X}, 10b {}", m_name, m_pixelSize, m_refreshRate, m_scale, sc<int>(m_transform),
m_position, sc<int>(m_enabled10bit));
Log::logger->log(Log::DEBUG, "Monitor {} data dump: res {:X}@{:.2f}Hz, scale {:.2f}, transform {}, pos {:X}, 10b {}", m_name, m_pixelSize, m_refreshRate, m_scale,
sc<int>(m_transform), m_position, sc<int>(m_enabled10bit));
EMIT_HOOK_EVENT("monitorLayoutChanged", nullptr);
@ -1090,12 +1090,12 @@ void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) {
wsID = std::ranges::distance(g_pCompositor->getWorkspaces()) + 1;
newDefaultWorkspaceName = std::to_string(wsID);
Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"{}\" is invalid.", g_pConfigManager->getDefaultWorkspaceFor(m_name));
Log::logger->log(Log::DEBUG, "Invalid workspace= directive name in monitor parsing, workspace name \"{}\" is invalid.", g_pConfigManager->getDefaultWorkspaceFor(m_name));
}
auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(wsID);
Debug::log(LOG, "New monitor: WORKSPACEID {}, exists: {}", wsID, sc<int>(PNEWWORKSPACE != nullptr));
Log::logger->log(Log::DEBUG, "New monitor: WORKSPACEID {}, exists: {}", wsID, sc<int>(PNEWWORKSPACE != nullptr));
if (PNEWWORKSPACE) {
// workspace exists, move it to the newly connected monitor
@ -1124,12 +1124,12 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
return;
if (PMIRRORMON && PMIRRORMON->isMirror()) {
Debug::log(ERR, "Cannot mirror a mirror!");
Log::logger->log(Log::ERR, "Cannot mirror a mirror!");
return;
}
if (PMIRRORMON == m_self) {
Debug::log(ERR, "Cannot mirror self!");
Log::logger->log(Log::ERR, "Cannot mirror self!");
return;
}
@ -1257,7 +1257,7 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo
if (pWorkspace->m_isSpecialWorkspace) {
if (m_activeSpecialWorkspace != pWorkspace) {
Debug::log(LOG, "changeworkspace on special, togglespecialworkspace to id {}", pWorkspace->m_id);
Log::logger->log(Log::DEBUG, "changeworkspace on special, togglespecialworkspace to id {}", pWorkspace->m_id);
setSpecialWorkspace(pWorkspace);
}
return;
@ -1693,7 +1693,7 @@ uint8_t CMonitor::isTearingBlocked(bool full) {
if (!*PTEARINGENABLED) {
reasons |= TC_USER;
if (!full) {
Debug::log(WARN, "Tearing commit requested but the master switch general:allow_tearing is off, ignoring");
Log::logger->log(Log::WARN, "Tearing commit requested but the master switch general:allow_tearing is off, ignoring");
return reasons;
}
}
@ -1701,7 +1701,7 @@ uint8_t CMonitor::isTearingBlocked(bool full) {
if (g_pHyprOpenGL->m_renderData.mouseZoomFactor != 1.0) {
reasons |= TC_ZOOM;
if (!full) {
Debug::log(WARN, "Tearing commit requested but scale factor is not 1, ignoring");
Log::logger->log(Log::WARN, "Tearing commit requested but scale factor is not 1, ignoring");
return reasons;
}
}
@ -1709,7 +1709,7 @@ uint8_t CMonitor::isTearingBlocked(bool full) {
if (!m_tearingState.canTear) {
reasons |= TC_SUPPORT;
if (!full) {
Debug::log(WARN, "Tearing commit requested but monitor doesn't support it, ignoring");
Log::logger->log(Log::WARN, "Tearing commit requested but monitor doesn't support it, ignoring");
return reasons;
}
}
@ -1821,8 +1821,8 @@ bool CMonitor::attemptDirectScanout() {
const auto PSURFACE = PCANDIDATE->getSolitaryResource();
const auto params = PSURFACE->m_current.buffer->dmabuf();
Debug::log(TRACE, "attemptDirectScanout: surface {:x} passed, will attempt, buffer {} fmt: {} -> {} (mod {})", rc<uintptr_t>(PSURFACE.get()),
rc<uintptr_t>(PSURFACE->m_current.buffer.m_buffer.get()), m_drmFormat, params.format, params.modifier);
Log::logger->log(Log::TRACE, "attemptDirectScanout: surface {:x} passed, will attempt, buffer {} fmt: {} -> {} (mod {})", rc<uintptr_t>(PSURFACE.get()),
rc<uintptr_t>(PSURFACE->m_current.buffer.m_buffer.get()), m_drmFormat, params.format, params.modifier);
auto PBUFFER = PSURFACE->m_current.buffer.m_buffer;
@ -1832,12 +1832,12 @@ bool CMonitor::attemptDirectScanout() {
if (m_scanoutNeedsCursorUpdate) {
if (!m_state.test()) {
Debug::log(TRACE, "attemptDirectScanout: failed basic test on cursor update");
Log::logger->log(Log::TRACE, "attemptDirectScanout: failed basic test on cursor update");
return false;
}
if (!m_output->commit()) {
Debug::log(TRACE, "attemptDirectScanout: failed to commit cursor update");
Log::logger->log(Log::TRACE, "attemptDirectScanout: failed to commit cursor update");
m_lastScanout.reset();
return false;
}
@ -1865,12 +1865,12 @@ bool CMonitor::attemptDirectScanout() {
}
m_output->state->setBuffer(PBUFFER);
Debug::log(TRACE, "attemptDirectScanout: setting presentation mode");
Log::logger->log(Log::TRACE, "attemptDirectScanout: setting presentation mode");
m_output->state->setPresentationMode(m_tearingState.activelyTearing ? Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_IMMEDIATE :
Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_VSYNC);
if (!m_state.test()) {
Debug::log(TRACE, "attemptDirectScanout: failed basic test");
Log::logger->log(Log::TRACE, "attemptDirectScanout: failed basic test");
return false;
}
@ -1884,14 +1884,14 @@ bool CMonitor::attemptDirectScanout() {
bool ok = m_output->commit();
if (!ok) {
Debug::log(TRACE, "attemptDirectScanout: failed to scanout surface");
Log::logger->log(Log::TRACE, "attemptDirectScanout: failed to scanout surface");
m_lastScanout.reset();
return false;
}
if (m_lastScanout.expired()) {
m_lastScanout = PCANDIDATE;
Debug::log(LOG, "Entered a direct scanout to {:x}: \"{}\"", rc<uintptr_t>(PCANDIDATE.get()), PCANDIDATE->m_title);
Log::logger->log(Log::DEBUG, "Entered a direct scanout to {:x}: \"{}\"", rc<uintptr_t>(PCANDIDATE.get()), PCANDIDATE->m_title);
}
m_scanoutNeedsCursorUpdate = false;
@ -1947,7 +1947,7 @@ void CMonitor::commitDPMSState(bool state) {
m_output->state->setEnabled(state);
if (!m_state.commit()) {
Debug::log(ERR, "Couldn't commit output {} for DPMS = {}, will retry.", m_name, state);
Log::logger->log(Log::ERR, "Couldn't commit output {} for DPMS = {}, will retry.", m_name, state);
// retry in 2 frames. This could happen when the DRM backend rejects our commit
// because disable + enable were sent almost instantly
@ -1961,7 +1961,7 @@ void CMonitor::commitDPMSState(bool state) {
m_output->state->resetExplicitFences();
m_output->state->setEnabled(m_dpmsStatus);
if (!m_state.commit()) {
Debug::log(ERR, "Couldn't retry committing output {} for DPMS = {}", m_name, m_dpmsStatus);
Log::logger->log(Log::ERR, "Couldn't retry committing output {} for DPMS = {}", m_name, m_dpmsStatus);
return;
}
@ -1978,8 +1978,8 @@ void CMonitor::commitDPMSState(bool state) {
}
void CMonitor::debugLastPresentation(const std::string& message) {
Debug::log(TRACE, "{} (last presentation {} - {} fps)", message, m_lastPresentationTimer.getMillis(),
m_lastPresentationTimer.getMillis() > 0 ? 1000.0f / m_lastPresentationTimer.getMillis() : 0.0f);
Log::logger->log(Log::TRACE, "{} (last presentation {} - {} fps)", message, m_lastPresentationTimer.getMillis(),
m_lastPresentationTimer.getMillis() > 0 ? 1000.0f / m_lastPresentationTimer.getMillis() : 0.0f);
}
void CMonitor::onCursorMovedOnMonitor() {
@ -1991,7 +1991,7 @@ void CMonitor::onCursorMovedOnMonitor() {
// output->state->addDamage(CRegion{});
// output->state->setPresentationMode(Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_IMMEDIATE);
// if (!output->commit())
// Debug::log(ERR, "onCursorMovedOnMonitor: tearing and wanted to update cursor, failed.");
// Log::logger->log(Log::ERR, "onCursorMovedOnMonitor: tearing and wanted to update cursor, failed.");
// FIXME: try to do the above. We currently can't just render because drm is a fucking bitch
// and throws a "nO pRoP cAn Be ChAnGeD dUrInG AsYnC fLiP" on crtc_x
@ -2094,7 +2094,7 @@ CMonitorState::CMonitorState(CMonitor* owner) : m_owner(owner) {
void CMonitorState::ensureBufferPresent() {
const auto STATE = m_owner->m_output->state->state();
if (!STATE.enabled) {
Debug::log(TRACE, "CMonitorState::ensureBufferPresent: Ignoring, monitor is not enabled");
Log::logger->log(Log::TRACE, "CMonitorState::ensureBufferPresent: Ignoring, monitor is not enabled");
return;
}
@ -2105,7 +2105,7 @@ void CMonitorState::ensureBufferPresent() {
// this is required for modesetting being possible and might be missing in case of first tests in the renderer
// where we test modes and buffers
Debug::log(LOG, "CMonitorState::ensureBufferPresent: no buffer or mismatched format, attaching one from the swapchain for modeset being possible");
Log::logger->log(Log::DEBUG, "CMonitorState::ensureBufferPresent: no buffer or mismatched format, attaching one from the swapchain for modeset being possible");
m_owner->m_output->state->setBuffer(m_owner->m_output->swapchain->next(nullptr));
m_owner->m_output->swapchain->rollback(); // restore the counter, don't advance the swapchain
}
@ -2136,7 +2136,7 @@ bool CMonitorState::updateSwapchain() {
const auto& STATE = m_owner->m_output->state->state();
const auto& MODE = STATE.mode ? STATE.mode : STATE.customMode;
if (!MODE) {
Debug::log(WARN, "updateSwapchain: No mode?");
Log::logger->log(Log::WARN, "updateSwapchain: No mode?");
return true;
}
options.format = m_owner->m_drmFormat;

View file

@ -24,12 +24,12 @@ void CMonitorFrameScheduler::onSyncFired() {
if (std::chrono::duration_cast<std::chrono::microseconds>(hrc::now() - m_lastRenderBegun).count() / 1000.F < 1000.F / m_monitor->m_refreshRate) {
// we are in. Frame is valid. We can just render as normal.
Debug::log(TRACE, "CMonitorFrameScheduler: {} -> onSyncFired, didn't miss.", m_monitor->m_name);
Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> onSyncFired, didn't miss.", m_monitor->m_name);
m_renderAtFrame = true;
return;
}
Debug::log(TRACE, "CMonitorFrameScheduler: {} -> onSyncFired, missed.", m_monitor->m_name);
Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> onSyncFired, missed.", m_monitor->m_name);
// we are out. The frame is taking too long to render. Begin rendering immediately, but don't commit yet.
m_pendingThird = true;
@ -56,11 +56,11 @@ void CMonitorFrameScheduler::onPresented() {
if (!m_pendingThird)
return;
Debug::log(TRACE, "CMonitorFrameScheduler: {} -> onPresented, missed, committing pending.", m_monitor->m_name);
Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> onPresented, missed, committing pending.", m_monitor->m_name);
m_pendingThird = false;
Debug::log(TRACE, "CMonitorFrameScheduler: {} -> onPresented, missed, committing pending at the earliest convenience.", m_monitor->m_name);
Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> onPresented, missed, committing pending at the earliest convenience.", m_monitor->m_name);
m_pendingThird = false;
@ -101,11 +101,11 @@ void CMonitorFrameScheduler::onFrame() {
}
if (!m_renderAtFrame) {
Debug::log(TRACE, "CMonitorFrameScheduler: {} -> frame event, but m_renderAtFrame = false.", m_monitor->m_name);
Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> frame event, but m_renderAtFrame = false.", m_monitor->m_name);
return;
}
Debug::log(TRACE, "CMonitorFrameScheduler: {} -> frame event, render = true, rendering normally.", m_monitor->m_name);
Log::logger->log(Log::TRACE, "CMonitorFrameScheduler: {} -> frame event, render = true, rendering normally.", m_monitor->m_name);
m_lastRenderBegun = hrc::now();
@ -132,7 +132,7 @@ void CMonitorFrameScheduler::onFinishRender() {
bool CMonitorFrameScheduler::canRender() {
if ((g_pCompositor->m_aqBackend->hasSession() && !g_pCompositor->m_aqBackend->session->active) || !g_pCompositor->m_sessionActive || g_pCompositor->m_unsafeState) {
Debug::log(WARN, "Attempted to render frame on inactive session!");
Log::logger->log(Log::WARN, "Attempted to render frame on inactive session!");
if (g_pCompositor->m_unsafeState && std::ranges::any_of(g_pCompositor->m_monitors.begin(), g_pCompositor->m_monitors.end(), [&](auto& m) {
return m->m_output != g_pCompositor->m_unsafeOutput->m_output;

19
src/helpers/env/Env.cpp vendored Normal file
View file

@ -0,0 +1,19 @@
#include "Env.hpp"
#include <cstdlib>
#include <string_view>
bool Env::envEnabled(const std::string& env) {
auto ret = getenv(env.c_str());
if (!ret)
return false;
const std::string_view sv = ret;
return !sv.empty() && sv != "0";
}
bool Env::isTrace() {
static bool TRACE = envEnabled("HYPRLAND_TRACE");
return TRACE;
}

8
src/helpers/env/Env.hpp vendored Normal file
View file

@ -0,0 +1,8 @@
#pragma once
#include <string>
namespace Env {
bool envEnabled(const std::string& env);
bool isTrace();
}

View file

@ -1,8 +1,9 @@
#include "FsUtils.hpp"
#include "../../debug/Log.hpp"
#include "../../debug/log/Logger.hpp"
#include <cstdlib>
#include <filesystem>
#include <fstream>
#include <hyprutils/string/String.hpp>
#include <hyprutils/string/VarList.hpp>
@ -17,7 +18,7 @@ std::optional<std::string> NFsUtils::getDataHome() {
const auto HOME = getenv("HOME");
if (!HOME) {
Debug::log(ERR, "FsUtils::getDataHome: can't get data home: no $HOME or $XDG_DATA_HOME");
Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't get data home: no $HOME or $XDG_DATA_HOME");
return std::nullopt;
}
@ -27,26 +28,26 @@ std::optional<std::string> NFsUtils::getDataHome() {
std::error_code ec;
if (!std::filesystem::exists(dataRoot, ec) || ec) {
Debug::log(ERR, "FsUtils::getDataHome: can't get data home: inaccessible / missing");
Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't get data home: inaccessible / missing");
return std::nullopt;
}
dataRoot += "hyprland/";
if (!std::filesystem::exists(dataRoot, ec) || ec) {
Debug::log(LOG, "FsUtils::getDataHome: no hyprland data home, creating.");
Log::logger->log(Log::DEBUG, "FsUtils::getDataHome: no hyprland data home, creating.");
std::filesystem::create_directory(dataRoot, ec);
if (ec) {
Debug::log(ERR, "FsUtils::getDataHome: can't create new data home for hyprland");
Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't create new data home for hyprland");
return std::nullopt;
}
std::filesystem::permissions(dataRoot, std::filesystem::perms::owner_read | std::filesystem::perms::owner_write | std::filesystem::perms::owner_exec, ec);
if (ec)
Debug::log(WARN, "FsUtils::getDataHome: couldn't set perms on hyprland data store. Proceeding anyways.");
Log::logger->log(Log::WARN, "FsUtils::getDataHome: couldn't set perms on hyprland data store. Proceeding anyways.");
}
if (!std::filesystem::exists(dataRoot, ec) || ec) {
Debug::log(ERR, "FsUtils::getDataHome: no hyprland data home, failed to create.");
Log::logger->log(Log::ERR, "FsUtils::getDataHome: no hyprland data home, failed to create.");
return std::nullopt;
}
@ -69,7 +70,7 @@ std::optional<std::string> NFsUtils::readFileAsString(const std::string& path) {
bool NFsUtils::writeToFile(const std::string& path, const std::string& content) {
std::ofstream of(path, std::ios::trunc);
if (!of.good()) {
Debug::log(ERR, "CVersionKeeperManager: couldn't open an ofstream for writing the version file.");
Log::logger->log(Log::ERR, "CVersionKeeperManager: couldn't open an ofstream for writing the version file.");
return false;
}

View file

@ -1,6 +1,6 @@
#include "Expression.hpp"
#include "muParser.h"
#include "../../debug/Log.hpp"
#include "../../debug/log/Logger.hpp"
using namespace Math;
@ -16,7 +16,7 @@ std::optional<double> CExpression::compute(const std::string& expr) {
try {
m_parser->SetExpr(expr);
return m_parser->Eval();
} catch (mu::Parser::exception_type& e) { Debug::log(ERR, "CExpression::compute: mu threw: {}", e.GetMsg()); }
} catch (mu::Parser::exception_type& e) { Log::logger->log(Log::ERR, "CExpression::compute: mu threw: {}", e.GetMsg()); }
return std::nullopt;
}

View file

@ -25,7 +25,7 @@ CSyncReleaser::CSyncReleaser(SP<CSyncTimeline> timeline, uint64_t point) : m_tim
CSyncReleaser::~CSyncReleaser() {
if (!m_timeline) {
Debug::log(ERR, "CSyncReleaser destructing without a timeline");
Log::logger->log(Log::ERR, "CSyncReleaser destructing without a timeline");
return;
}

View file

@ -16,7 +16,7 @@ SP<CSyncTimeline> CSyncTimeline::create(int drmFD_) {
timeline->m_self = timeline;
if (drmSyncobjCreate(drmFD_, 0, &timeline->m_handle)) {
Debug::log(ERR, "CSyncTimeline: failed to create a drm syncobj??");
Log::logger->log(Log::ERR, "CSyncTimeline: failed to create a drm syncobj??");
return nullptr;
}
@ -33,7 +33,7 @@ SP<CSyncTimeline> CSyncTimeline::create(int drmFD_, CFileDescriptor&& drmSyncobj
timeline->m_self = timeline;
if (drmSyncobjFDToHandle(drmFD_, timeline->m_syncobjFD.get(), &timeline->m_handle)) {
Debug::log(ERR, "CSyncTimeline: failed to create a drm syncobj from fd??");
Log::logger->log(Log::ERR, "CSyncTimeline: failed to create a drm syncobj from fd??");
return nullptr;
}
@ -57,7 +57,7 @@ std::optional<bool> CSyncTimeline::check(uint64_t point, uint32_t flags) {
uint32_t signaled = 0;
int ret = drmSyncobjTimelineWait(m_drmFD, &m_handle, &point, 1, 0, flags, &signaled);
if (ret != 0 && ret != -ETIME_ERR) {
Debug::log(ERR, "CSyncTimeline::check: drmSyncobjTimelineWait failed");
Log::logger->log(Log::ERR, "CSyncTimeline::check: drmSyncobjTimelineWait failed");
return std::nullopt;
}
@ -68,12 +68,12 @@ bool CSyncTimeline::addWaiter(std::function<void()>&& waiter, uint64_t point, ui
auto eventFd = CFileDescriptor(eventfd(0, EFD_CLOEXEC));
if (!eventFd.isValid()) {
Debug::log(ERR, "CSyncTimeline::addWaiter: failed to acquire an eventfd");
Log::logger->log(Log::ERR, "CSyncTimeline::addWaiter: failed to acquire an eventfd");
return false;
}
if (drmSyncobjEventfd(m_drmFD, m_handle, point, eventFd.get(), flags)) {
Debug::log(ERR, "CSyncTimeline::addWaiter: drmSyncobjEventfd failed");
Log::logger->log(Log::ERR, "CSyncTimeline::addWaiter: drmSyncobjEventfd failed");
return false;
}
@ -87,18 +87,18 @@ CFileDescriptor CSyncTimeline::exportAsSyncFileFD(uint64_t src) {
uint32_t syncHandle = 0;
if (drmSyncobjCreate(m_drmFD, 0, &syncHandle)) {
Debug::log(ERR, "exportAsSyncFileFD: drmSyncobjCreate failed");
Log::logger->log(Log::ERR, "exportAsSyncFileFD: drmSyncobjCreate failed");
return {};
}
if (drmSyncobjTransfer(m_drmFD, syncHandle, 0, m_handle, src, 0)) {
Debug::log(ERR, "exportAsSyncFileFD: drmSyncobjTransfer failed");
Log::logger->log(Log::ERR, "exportAsSyncFileFD: drmSyncobjTransfer failed");
drmSyncobjDestroy(m_drmFD, syncHandle);
return {};
}
if (drmSyncobjExportSyncFile(m_drmFD, syncHandle, &sync)) {
Debug::log(ERR, "exportAsSyncFileFD: drmSyncobjExportSyncFile failed");
Log::logger->log(Log::ERR, "exportAsSyncFileFD: drmSyncobjExportSyncFile failed");
drmSyncobjDestroy(m_drmFD, syncHandle);
return {};
}
@ -111,18 +111,18 @@ bool CSyncTimeline::importFromSyncFileFD(uint64_t dst, CFileDescriptor& fd) {
uint32_t syncHandle = 0;
if (drmSyncobjCreate(m_drmFD, 0, &syncHandle)) {
Debug::log(ERR, "importFromSyncFileFD: drmSyncobjCreate failed");
Log::logger->log(Log::ERR, "importFromSyncFileFD: drmSyncobjCreate failed");
return false;
}
if (drmSyncobjImportSyncFile(m_drmFD, syncHandle, fd.get())) {
Debug::log(ERR, "importFromSyncFileFD: drmSyncobjImportSyncFile failed");
Log::logger->log(Log::ERR, "importFromSyncFileFD: drmSyncobjImportSyncFile failed");
drmSyncobjDestroy(m_drmFD, syncHandle);
return false;
}
if (drmSyncobjTransfer(m_drmFD, m_handle, dst, syncHandle, 0, 0)) {
Debug::log(ERR, "importFromSyncFileFD: drmSyncobjTransfer failed");
Log::logger->log(Log::ERR, "importFromSyncFileFD: drmSyncobjTransfer failed");
drmSyncobjDestroy(m_drmFD, syncHandle);
return false;
}
@ -133,12 +133,12 @@ bool CSyncTimeline::importFromSyncFileFD(uint64_t dst, CFileDescriptor& fd) {
bool CSyncTimeline::transfer(SP<CSyncTimeline> from, uint64_t fromPoint, uint64_t toPoint) {
if (m_drmFD != from->m_drmFD) {
Debug::log(ERR, "CSyncTimeline::transfer: cannot transfer timelines between gpus, {} -> {}", from->m_drmFD, m_drmFD);
Log::logger->log(Log::ERR, "CSyncTimeline::transfer: cannot transfer timelines between gpus, {} -> {}", from->m_drmFD, m_drmFD);
return false;
}
if (drmSyncobjTransfer(m_drmFD, m_handle, toPoint, from->m_handle, fromPoint, 0)) {
Debug::log(ERR, "CSyncTimeline::transfer: drmSyncobjTransfer failed");
Log::logger->log(Log::ERR, "CSyncTimeline::transfer: drmSyncobjTransfer failed");
return false;
}
@ -147,5 +147,5 @@ bool CSyncTimeline::transfer(SP<CSyncTimeline> from, uint64_t fromPoint, uint64_
void CSyncTimeline::signal(uint64_t point) {
if (drmSyncobjTimelineSignal(m_drmFD, &m_handle, &point, 1))
Debug::log(ERR, "CSyncTimeline::signal: drmSyncobjTimelineSignal failed");
Log::logger->log(Log::ERR, "CSyncTimeline::signal: drmSyncobjTimelineSignal failed");
}