logging: add AQ_TRACE for omitting trace logs

This commit is contained in:
Vaxry 2024-07-02 14:42:24 +02:00
parent 874183997f
commit 2f220d9301
6 changed files with 59 additions and 41 deletions

View file

@ -2,6 +2,7 @@
#include <aquamarine/backend/Backend.hpp> #include <aquamarine/backend/Backend.hpp>
#include <aquamarine/allocator/Swapchain.hpp> #include <aquamarine/allocator/Swapchain.hpp>
#include "FormatUtils.hpp" #include "FormatUtils.hpp"
#include "Shared.hpp"
#include <xf86drm.h> #include <xf86drm.h>
#include <gbm.h> #include <gbm.h>
@ -105,9 +106,9 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti
allocator->backend->log(AQ_LOG_WARNING, "GBM: Using modifier-less allocation"); allocator->backend->log(AQ_LOG_WARNING, "GBM: Using modifier-less allocation");
bo = gbm_bo_create(allocator->gbmDevice, params.size.x, params.size.y, params.format, flags); bo = gbm_bo_create(allocator->gbmDevice, params.size.x, params.size.y, params.format, flags);
} else { } else {
allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: Using modifier-based allocation, modifiers: {}", explicitModifiers.size())); TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: Using modifier-based allocation, modifiers: {}", explicitModifiers.size())));
for (auto& mod : explicitModifiers) { for (auto& mod : explicitModifiers) {
allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: | mod 0x{:x}", mod)); TRACE(allocator->backend->log(AQ_LOG_TRACE, std::format("GBM: | mod 0x{:x}", mod)));
} }
bo = gbm_bo_create_with_modifiers(allocator->gbmDevice, params.size.x, params.size.y, params.format, explicitModifiers.data(), explicitModifiers.size()); bo = gbm_bo_create_with_modifiers(allocator->gbmDevice, params.size.x, params.size.y, params.format, explicitModifiers.data(), explicitModifiers.size());

View file

@ -86,26 +86,26 @@ bool Aquamarine::CWaylandBackend::start() {
backend->log(AQ_LOG_DEBUG, std::format("Got registry at 0x{:x}", (uintptr_t)waylandState.registry->resource())); backend->log(AQ_LOG_DEBUG, std::format("Got registry at 0x{:x}", (uintptr_t)waylandState.registry->resource()));
waylandState.registry->setGlobal([this](CCWlRegistry* r, uint32_t id, const char* name, uint32_t version) { waylandState.registry->setGlobal([this](CCWlRegistry* r, uint32_t id, const char* name, uint32_t version) {
backend->log(AQ_LOG_TRACE, std::format(" | received global: {} (version {}) with id {}", name, version, id)); TRACE(backend->log(AQ_LOG_TRACE, std::format(" | received global: {} (version {}) with id {}", name, version, id)));
const std::string NAME = name; const std::string NAME = name;
if (NAME == "wl_seat") { if (NAME == "wl_seat") {
backend->log(AQ_LOG_TRACE, std::format(" > binding to global: {} (version {}) with id {}", name, 9, id)); TRACE(backend->log(AQ_LOG_TRACE, std::format(" > binding to global: {} (version {}) with id {}", name, 9, id)));
waylandState.seat = makeShared<CCWlSeat>((wl_proxy*)wl_registry_bind((wl_registry*)waylandState.registry->resource(), id, &wl_seat_interface, 9)); waylandState.seat = makeShared<CCWlSeat>((wl_proxy*)wl_registry_bind((wl_registry*)waylandState.registry->resource(), id, &wl_seat_interface, 9));
initSeat(); initSeat();
} else if (NAME == "xdg_wm_base") { } else if (NAME == "xdg_wm_base") {
backend->log(AQ_LOG_TRACE, std::format(" > binding to global: {} (version {}) with id {}", name, 6, id)); TRACE(backend->log(AQ_LOG_TRACE, std::format(" > binding to global: {} (version {}) with id {}", name, 6, id)));
waylandState.xdg = makeShared<CCXdgWmBase>((wl_proxy*)wl_registry_bind((wl_registry*)waylandState.registry->resource(), id, &xdg_wm_base_interface, 6)); waylandState.xdg = makeShared<CCXdgWmBase>((wl_proxy*)wl_registry_bind((wl_registry*)waylandState.registry->resource(), id, &xdg_wm_base_interface, 6));
initShell(); initShell();
} else if (NAME == "wl_compositor") { } else if (NAME == "wl_compositor") {
backend->log(AQ_LOG_TRACE, std::format(" > binding to global: {} (version {}) with id {}", name, 6, id)); TRACE(backend->log(AQ_LOG_TRACE, std::format(" > binding to global: {} (version {}) with id {}", name, 6, id)));
waylandState.compositor = makeShared<CCWlCompositor>((wl_proxy*)wl_registry_bind((wl_registry*)waylandState.registry->resource(), id, &wl_compositor_interface, 6)); waylandState.compositor = makeShared<CCWlCompositor>((wl_proxy*)wl_registry_bind((wl_registry*)waylandState.registry->resource(), id, &wl_compositor_interface, 6));
} else if (NAME == "wl_shm") { } else if (NAME == "wl_shm") {
backend->log(AQ_LOG_TRACE, std::format(" > binding to global: {} (version {}) with id {}", name, 1, id)); TRACE(backend->log(AQ_LOG_TRACE, std::format(" > binding to global: {} (version {}) with id {}", name, 1, id)));
waylandState.shm = makeShared<CCWlShm>((wl_proxy*)wl_registry_bind((wl_registry*)waylandState.registry->resource(), id, &wl_shm_interface, 1)); waylandState.shm = makeShared<CCWlShm>((wl_proxy*)wl_registry_bind((wl_registry*)waylandState.registry->resource(), id, &wl_shm_interface, 1));
} else if (NAME == "zwp_linux_dmabuf_v1") { } else if (NAME == "zwp_linux_dmabuf_v1") {
backend->log(AQ_LOG_TRACE, std::format(" > binding to global: {} (version {}) with id {}", name, 5, id)); TRACE(backend->log(AQ_LOG_TRACE, std::format(" > binding to global: {} (version {}) with id {}", name, 5, id)));
waylandState.dmabuf = waylandState.dmabuf =
makeShared<CCZwpLinuxDmabufV1>((wl_proxy*)wl_registry_bind((wl_registry*)waylandState.registry->resource(), id, &zwp_linux_dmabuf_v1_interface, 5)); makeShared<CCZwpLinuxDmabufV1>((wl_proxy*)wl_registry_bind((wl_registry*)waylandState.registry->resource(), id, &zwp_linux_dmabuf_v1_interface, 5));
if (!initDmabuf()) { if (!initDmabuf()) {

View file

@ -542,7 +542,7 @@ static void handlePF(int fd, unsigned seq, unsigned tv_sec, unsigned tv_usec, un
const auto& BACKEND = pageFlip->connector->backend; const auto& BACKEND = pageFlip->connector->backend;
BACKEND->log(AQ_LOG_TRACE, std::format("drm: pf event seq {} sec {} usec {} crtc {}", seq, tv_sec, tv_usec, crtc_id)); TRACE(BACKEND->log(AQ_LOG_TRACE, std::format("drm: pf event seq {} sec {} usec {} crtc {}", seq, tv_sec, tv_usec, crtc_id)));
if (pageFlip->connector->status != DRM_MODE_CONNECTED || !pageFlip->connector->crtc) { if (pageFlip->connector->status != DRM_MODE_CONNECTED || !pageFlip->connector->crtc) {
BACKEND->log(AQ_LOG_DEBUG, "drm: Ignoring a pf event from a disabled crtc / connector"); BACKEND->log(AQ_LOG_DEBUG, "drm: Ignoring a pf event from a disabled crtc / connector");
@ -612,7 +612,7 @@ std::vector<SDRMFormat> Aquamarine::CDRMBackend::getRenderFormats() {
continue; continue;
if (primary) { if (primary) {
backend->log(AQ_LOG_TRACE, std::format("drm: getRenderFormats on secondary {}", gpu->path)); TRACE(backend->log(AQ_LOG_TRACE, std::format("drm: getRenderFormats on secondary {}", gpu->path)));
// this is a secondary GPU renderer. In order to receive buffers, // this is a secondary GPU renderer. In order to receive buffers,
// we'll force linear modifiers. // we'll force linear modifiers.
@ -636,7 +636,7 @@ std::vector<SDRMFormat> Aquamarine::CDRMBackend::getCursorFormats() {
continue; continue;
if (primary) { if (primary) {
backend->log(AQ_LOG_TRACE, std::format("drm: getCursorFormats on secondary {}", gpu->path)); TRACE(backend->log(AQ_LOG_TRACE, std::format("drm: getCursorFormats on secondary {}", gpu->path)));
// this is a secondary GPU renderer. In order to receive buffers, // this is a secondary GPU renderer. In order to receive buffers,
// we'll force linear modifiers. // we'll force linear modifiers.
@ -679,7 +679,7 @@ bool Aquamarine::SDRMPlane::init(drmModePlane* plane) {
else else
formats.emplace_back(SDRMFormat{.drmFormat = plane->formats[i], .modifiers = {DRM_FORMAT_MOD_LINEAR}}); formats.emplace_back(SDRMFormat{.drmFormat = plane->formats[i], .modifiers = {DRM_FORMAT_MOD_LINEAR}});
backend->backend->log(AQ_LOG_TRACE, std::format("drm: | Format {}", fourccToName(plane->formats[i]))); TRACE(backend->backend->log(AQ_LOG_TRACE, std::format("drm: | Format {}", fourccToName(plane->formats[i]))));
} }
if (props.in_formats && backend->drmProps.supportsAddFb2Modifiers) { if (props.in_formats && backend->drmProps.supportsAddFb2Modifiers) {
@ -701,7 +701,7 @@ bool Aquamarine::SDRMPlane::init(drmModePlane* plane) {
while (drmModeFormatModifierBlobIterNext(blob, &iter)) { while (drmModeFormatModifierBlobIterNext(blob, &iter)) {
auto it = std::find_if(formats.begin(), formats.end(), [iter](const auto& e) { return e.drmFormat == iter.fmt; }); auto it = std::find_if(formats.begin(), formats.end(), [iter](const auto& e) { return e.drmFormat == iter.fmt; });
backend->backend->log(AQ_LOG_TRACE, std::format("drm: | Modifier {} with format {}", iter.mod, fourccToName(iter.fmt))); TRACE(backend->backend->log(AQ_LOG_TRACE, std::format("drm: | Modifier {} with format {}", iter.mod, fourccToName(iter.fmt))));
if (it == formats.end()) if (it == formats.end())
formats.emplace_back(SDRMFormat{.drmFormat = iter.fmt, .modifiers = {iter.mod}}); formats.emplace_back(SDRMFormat{.drmFormat = iter.fmt, .modifiers = {iter.mod}});
@ -735,7 +735,7 @@ bool Aquamarine::SDRMPlane::init(drmModePlane* plane) {
SP<SDRMCRTC> Aquamarine::SDRMConnector::getCurrentCRTC(const drmModeConnector* connector) { SP<SDRMCRTC> Aquamarine::SDRMConnector::getCurrentCRTC(const drmModeConnector* connector) {
uint32_t crtcID = 0; uint32_t crtcID = 0;
if (props.crtc_id) { if (props.crtc_id) {
backend->backend->log(AQ_LOG_TRACE, "drm: Using crtc_id for finding crtc"); TRACE(backend->backend->log(AQ_LOG_TRACE, "drm: Using crtc_id for finding crtc"));
uint64_t value = 0; uint64_t value = 0;
if (!getDRMProp(backend->gpu->fd, id, props.crtc_id, &value)) { if (!getDRMProp(backend->gpu->fd, id, props.crtc_id, &value)) {
backend->backend->log(AQ_LOG_ERROR, "drm: Failed to get CRTC_ID"); backend->backend->log(AQ_LOG_ERROR, "drm: Failed to get CRTC_ID");
@ -743,7 +743,7 @@ SP<SDRMCRTC> Aquamarine::SDRMConnector::getCurrentCRTC(const drmModeConnector* c
} }
crtcID = static_cast<uint32_t>(value); crtcID = static_cast<uint32_t>(value);
} else if (connector->encoder_id) { } else if (connector->encoder_id) {
backend->backend->log(AQ_LOG_TRACE, "drm: Using encoder_id for finding crtc"); TRACE(backend->backend->log(AQ_LOG_TRACE, "drm: Using encoder_id for finding crtc"));
auto encoder = drmModeGetEncoder(backend->gpu->fd, connector->encoder_id); auto encoder = drmModeGetEncoder(backend->gpu->fd, connector->encoder_id);
if (!encoder) { if (!encoder) {
backend->backend->log(AQ_LOG_ERROR, "drm: drmModeGetEncoder failed"); backend->backend->log(AQ_LOG_ERROR, "drm: drmModeGetEncoder failed");
@ -1085,7 +1085,7 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) {
} }
if ((COMMITTED & COutputState::eOutputStateProperties::AQ_OUTPUT_STATE_BUFFER) && STATE.buffer->attachments.has(AQ_ATTACHMENT_DRM_KMS_UNIMPORTABLE)) { if ((COMMITTED & COutputState::eOutputStateProperties::AQ_OUTPUT_STATE_BUFFER) && STATE.buffer->attachments.has(AQ_ATTACHMENT_DRM_KMS_UNIMPORTABLE)) {
backend->backend->log(AQ_LOG_TRACE, "drm: Cannot commit a KMS-unimportable buffer."); TRACE(backend->backend->log(AQ_LOG_TRACE, "drm: Cannot commit a KMS-unimportable buffer."));
return false; return false;
} }
@ -1124,7 +1124,7 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) {
SDRMConnectorCommitData data; SDRMConnectorCommitData data;
if (STATE.buffer) { if (STATE.buffer) {
backend->backend->log(AQ_LOG_TRACE, "drm: Committed a buffer, updating state"); TRACE(backend->backend->log(AQ_LOG_TRACE, "drm: Committed a buffer, updating state"));
SP<CDRMFB> drmFB; SP<CDRMFB> drmFB;
auto buf = STATE.buffer; auto buf = STATE.buffer;
@ -1156,7 +1156,7 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) {
// TODO: add an API to detect this and request drm_dumb linear buffers. Or do something, // TODO: add an API to detect this and request drm_dumb linear buffers. Or do something,
// idk // idk
if (data.cursorFB->buffer->dmabuf().modifier == DRM_FORMAT_MOD_INVALID) { if (data.cursorFB->buffer->dmabuf().modifier == DRM_FORMAT_MOD_INVALID) {
backend->backend->log(AQ_LOG_TRACE, "drm: Dropping invalid buffer for cursor plane"); TRACE(backend->backend->log(AQ_LOG_TRACE, "drm: Dropping invalid buffer for cursor plane"));
data.cursorFB = nullptr; data.cursorFB = nullptr;
} }
} }
@ -1266,7 +1266,7 @@ SP<CDRMFB> Aquamarine::CDRMFB::create(SP<IBuffer> buffer_, Hyprutils::Memory::CW
if (buffer_->attachments.has(AQ_ATTACHMENT_DRM_BUFFER)) { if (buffer_->attachments.has(AQ_ATTACHMENT_DRM_BUFFER)) {
auto at = (CDRMBufferAttachment*)buffer_->attachments.get(AQ_ATTACHMENT_DRM_BUFFER).get(); auto at = (CDRMBufferAttachment*)buffer_->attachments.get(AQ_ATTACHMENT_DRM_BUFFER).get();
fb = at->fb; fb = at->fb;
backend_->log(AQ_LOG_TRACE, std::format("drm: CDRMFB: buffer has drmfb attachment with fb {:x}", (uintptr_t)fb.get())); TRACE(backend_->log(AQ_LOG_TRACE, std::format("drm: CDRMFB: buffer has drmfb attachment with fb {:x}", (uintptr_t)fb.get())));
} }
if (fb) { if (fb) {
@ -1311,7 +1311,7 @@ void Aquamarine::CDRMFB::import() {
return; return;
} }
backend->backend->log(AQ_LOG_TRACE, std::format("drm: CDRMFB: plane {} has fd {}, got handle {}", i, attrs.fds.at(i), boHandles.at(i))); TRACE(backend->backend->log(AQ_LOG_TRACE, std::format("drm: CDRMFB: plane {} has fd {}, got handle {}", i, attrs.fds.at(i), boHandles.at(i))));
} }
id = submitBuffer(); id = submitBuffer();
@ -1322,7 +1322,7 @@ void Aquamarine::CDRMFB::import() {
return; return;
} }
backend->backend->log(AQ_LOG_TRACE, std::format("drm: new buffer {}", id)); TRACE(backend->backend->log(AQ_LOG_TRACE, std::format("drm: new buffer {}", id)));
// FIXME: why does this implode when it doesnt on wlroots or kwin? // FIXME: why does this implode when it doesnt on wlroots or kwin?
// closeHandles(); // closeHandles();
@ -1379,7 +1379,7 @@ void Aquamarine::CDRMFB::drop() {
closeHandles(); closeHandles();
backend->backend->log(AQ_LOG_TRACE, std::format("drm: dropping buffer {}", id)); TRACE(backend->backend->log(AQ_LOG_TRACE, std::format("drm: dropping buffer {}", id)));
int ret = drmModeCloseFB(backend->gpu->fd, id); int ret = drmModeCloseFB(backend->gpu->fd, id);
if (ret == -EINVAL) if (ret == -EINVAL)
@ -1398,9 +1398,9 @@ uint32_t Aquamarine::CDRMFB::submitBuffer() {
} }
if (backend->drmProps.supportsAddFb2Modifiers && attrs.modifier != DRM_FORMAT_MOD_INVALID) { if (backend->drmProps.supportsAddFb2Modifiers && attrs.modifier != DRM_FORMAT_MOD_INVALID) {
backend->backend->log(AQ_LOG_TRACE, TRACE(backend->backend->log(AQ_LOG_TRACE,
std::format("drm: Using drmModeAddFB2WithModifiers to import buffer into KMS: Size {} with format {} and mod {}", attrs.size, std::format("drm: Using drmModeAddFB2WithModifiers to import buffer into KMS: Size {} with format {} and mod {}", attrs.size,
fourccToName(attrs.format), attrs.modifier)); fourccToName(attrs.format), attrs.modifier)));
if (drmModeAddFB2WithModifiers(backend->gpu->fd, attrs.size.x, attrs.size.y, attrs.format, boHandles.data(), attrs.strides.data(), attrs.offsets.data(), mods.data(), if (drmModeAddFB2WithModifiers(backend->gpu->fd, attrs.size.x, attrs.size.y, attrs.format, boHandles.data(), attrs.strides.data(), attrs.offsets.data(), mods.data(),
&newID, DRM_MODE_FB_MODIFIERS)) { &newID, DRM_MODE_FB_MODIFIERS)) {
backend->backend->log(AQ_LOG_ERROR, "drm: Failed to submit a buffer with drmModeAddFB2WithModifiers"); backend->backend->log(AQ_LOG_ERROR, "drm: Failed to submit a buffer with drmModeAddFB2WithModifiers");
@ -1412,9 +1412,9 @@ uint32_t Aquamarine::CDRMFB::submitBuffer() {
return 0; return 0;
} }
backend->backend->log( TRACE(backend->backend->log(
AQ_LOG_TRACE, AQ_LOG_TRACE,
std::format("drm: Using drmModeAddFB2 to import buffer into KMS: Size {} with format {} and mod {}", attrs.size, fourccToName(attrs.format), attrs.modifier)); std::format("drm: Using drmModeAddFB2 to import buffer into KMS: Size {} with format {} and mod {}", attrs.size, fourccToName(attrs.format), attrs.modifier)));
if (drmModeAddFB2(backend->gpu->fd, attrs.size.x, attrs.size.y, attrs.format, boHandles.data(), attrs.strides.data(), attrs.offsets.data(), &newID, 0)) { if (drmModeAddFB2(backend->gpu->fd, attrs.size.x, attrs.size.y, attrs.format, boHandles.data(), attrs.strides.data(), attrs.offsets.data(), &newID, 0)) {
backend->backend->log(AQ_LOG_ERROR, "drm: Failed to submit a buffer with drmModeAddFB2"); backend->backend->log(AQ_LOG_ERROR, "drm: Failed to submit a buffer with drmModeAddFB2");

View file

@ -3,6 +3,7 @@
#include <xf86drm.h> #include <xf86drm.h>
#include <xf86drmMode.h> #include <xf86drmMode.h>
#include <sys/mman.h> #include <sys/mman.h>
#include "Shared.hpp"
using namespace Aquamarine; using namespace Aquamarine;
using namespace Hyprutils::Memory; using namespace Hyprutils::Memory;
@ -24,7 +25,7 @@ void Aquamarine::CDRMAtomicRequest::add(uint32_t id, uint32_t prop, uint64_t val
if (failed) if (failed)
return; return;
backend->log(AQ_LOG_TRACE, std::format("atomic drm request: adding id {} prop {} with value {}", id, prop, val)); TRACE(backend->log(AQ_LOG_TRACE, std::format("atomic drm request: adding id {} prop {} with value {}", id, prop, val)));
if (id == 0 || prop == 0) { if (id == 0 || prop == 0) {
backend->log(AQ_LOG_ERROR, "atomic drm request: failed to add prop: id / prop == 0"); backend->log(AQ_LOG_ERROR, "atomic drm request: failed to add prop: id / prop == 0");
@ -45,7 +46,7 @@ void Aquamarine::CDRMAtomicRequest::planeProps(Hyprutils::Memory::CSharedPointer
if (!fb || !crtc) { if (!fb || !crtc) {
// Disable the plane // Disable the plane
backend->log(AQ_LOG_TRACE, std::format("atomic planeProps: disabling plane {}", plane->id)); TRACE(backend->log(AQ_LOG_TRACE, std::format("atomic planeProps: disabling plane {}", plane->id)));
add(plane->id, plane->props.fb_id, 0); add(plane->id, plane->props.fb_id, 0);
add(plane->id, plane->props.crtc_id, 0); add(plane->id, plane->props.crtc_id, 0);
add(plane->id, plane->props.crtc_x, (uint64_t)pos.x); add(plane->id, plane->props.crtc_x, (uint64_t)pos.x);
@ -53,10 +54,10 @@ void Aquamarine::CDRMAtomicRequest::planeProps(Hyprutils::Memory::CSharedPointer
return; return;
} }
backend->log(AQ_LOG_TRACE, TRACE(backend->log(AQ_LOG_TRACE,
std::format("atomic planeProps: prop blobs: src_x {}, src_y {}, src_w {}, src_h {}, crtc_w {}, crtc_h {}, fb_id {}, crtc_id {}, crtc_x {}, crtc_y {}", std::format("atomic planeProps: prop blobs: src_x {}, src_y {}, src_w {}, src_h {}, crtc_w {}, crtc_h {}, fb_id {}, crtc_id {}, crtc_x {}, crtc_y {}",
plane->props.src_x, plane->props.src_y, plane->props.src_w, plane->props.src_h, plane->props.crtc_w, plane->props.crtc_h, plane->props.fb_id, plane->props.src_x, plane->props.src_y, plane->props.src_w, plane->props.src_h, plane->props.crtc_w, plane->props.crtc_h, plane->props.fb_id,
plane->props.crtc_id, plane->props.crtc_x, plane->props.crtc_y)); plane->props.crtc_id, plane->props.crtc_x, plane->props.crtc_y)));
// src_ are 16.16 fixed point (lol) // src_ are 16.16 fixed point (lol)
add(plane->id, plane->props.src_x, 0); add(plane->id, plane->props.src_x, 0);
@ -75,9 +76,9 @@ void Aquamarine::CDRMAtomicRequest::addConnector(Hyprutils::Memory::CSharedPoint
const auto& STATE = connector->output->state->state(); const auto& STATE = connector->output->state->state();
const bool enable = STATE.enabled && data.mainFB; const bool enable = STATE.enabled && data.mainFB;
backend->log(AQ_LOG_TRACE, TRACE(backend->log(AQ_LOG_TRACE,
std::format("atomic addConnector blobs: mode_id {}, active {}, crtc_id {}, link_status {}, content_type {}", connector->crtc->props.mode_id, std::format("atomic addConnector blobs: mode_id {}, active {}, crtc_id {}, link_status {}, content_type {}", connector->crtc->props.mode_id,
connector->crtc->props.active, connector->props.crtc_id, connector->props.link_status, connector->props.content_type)); connector->crtc->props.active, connector->props.crtc_id, connector->props.link_status, connector->props.content_type)));
add(connector->id, connector->props.crtc_id, enable ? connector->crtc->id : 0); add(connector->id, connector->props.crtc_id, enable ? connector->crtc->id : 0);
@ -221,9 +222,9 @@ bool Aquamarine::CDRMAtomicImpl::prepareConnector(Hyprutils::Memory::CSharedPoin
return false; return false;
} }
connector->backend->log(AQ_LOG_TRACE, TRACE(connector->backend->log(AQ_LOG_TRACE,
std::format("Connector blob id {}: clock {}, {}x{}, vrefresh {}, name: {}", data.atomic.modeBlob, data.modeInfo.clock, data.modeInfo.hdisplay, std::format("Connector blob id {}: clock {}, {}x{}, vrefresh {}, name: {}", data.atomic.modeBlob, data.modeInfo.clock,
data.modeInfo.vdisplay, data.modeInfo.vrefresh, data.modeInfo.name)); data.modeInfo.hdisplay, data.modeInfo.vdisplay, data.modeInfo.vrefresh, data.modeInfo.name)));
} }
} }

View file

@ -6,6 +6,7 @@
namespace Aquamarine { namespace Aquamarine {
bool envEnabled(const std::string& env); bool envEnabled(const std::string& env);
bool isTrace();
}; };
#define RASSERT(expr, reason, ...) \ #define RASSERT(expr, reason, ...) \
@ -18,3 +19,10 @@ namespace Aquamarine {
} }
#define ASSERT(expr) RASSERT(expr, "?") #define ASSERT(expr) RASSERT(expr, "?")
#define TRACE(expr) \
{ \
if (Aquamarine::isTrace()) { \
expr; \
} \
}

View file

@ -5,3 +5,11 @@ bool Aquamarine::envEnabled(const std::string& env) {
auto e = getenv(env.c_str()); auto e = getenv(env.c_str());
return e && e == std::string{"1"}; return e && e == std::string{"1"};
} }
static bool trace = []() -> bool {
return Aquamarine::envEnabled("AQ_TRACE");
}();
bool Aquamarine::isTrace() {
return trace;
}