Skip to content

Commit

Permalink
Merge branch 'main' into hdr
Browse files Browse the repository at this point in the history
  • Loading branch information
UjinT34 committed Jan 2, 2025
2 parents f79e899 + f7082be commit 425e664
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 26 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0
0.5.1
18 changes: 9 additions & 9 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
inputs.hyprwayland-scanner.overlays.default
(final: prev: {
aquamarine = final.callPackage ./nix/default.nix {
stdenv = final.gcc13Stdenv;
stdenv = final.gcc14Stdenv;
version = version + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
};
aquamarine-with-tests = final.aquamarine.override {doCheck = true;};
Expand Down
1 change: 1 addition & 0 deletions src/allocator/GBM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ Aquamarine::CGBMBuffer::CGBMBuffer(const SAllocatorBufferParams& params, Hypruti

if (!foundFormat) {
allocator->backend->log(AQ_LOG_ERROR, std::format("GBM: Failed to allocate a GBM buffer: format {} isn't supported by primary backend", fourccToName(attrs.format)));
bo = nullptr;
return;
}

Expand Down
11 changes: 8 additions & 3 deletions src/allocator/Swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ bool Aquamarine::CSwapchain::reconfigure(const SSwapchainOptions& options_) {
return true;
}

if ((options_.format == options.format || options_.format == DRM_FORMAT_INVALID) && options_.size == options.size && options_.length == options.length)
if ((options_.format == options.format || options_.format == DRM_FORMAT_INVALID) && options_.size == options.size && options_.length == options.length &&
buffers.size() == options.length)
return true; // no need to reconfigure

if ((options_.format == options.format || options_.format == DRM_FORMAT_INVALID) && options_.size == options.size) {
Expand Down Expand Up @@ -70,7 +71,9 @@ SP<IBuffer> Aquamarine::CSwapchain::next(int* age) {
}

bool Aquamarine::CSwapchain::fullReconfigure(const SSwapchainOptions& options_) {
buffers.clear();
std::vector<Hyprutils::Memory::CSharedPointer<IBuffer>> bfs;
bfs.reserve(options_.length);

for (size_t i = 0; i < options_.length; ++i) {
auto buf = allocator->acquire(
SAllocatorBufferParams{.size = options_.size, .format = options_.format, .scanout = options_.scanout, .cursor = options_.cursor, .multigpu = options_.multigpu},
Expand All @@ -79,9 +82,11 @@ bool Aquamarine::CSwapchain::fullReconfigure(const SSwapchainOptions& options_)
allocator->getBackend()->log(AQ_LOG_ERROR, "Swapchain: Failed acquiring a buffer");
return false;
}
buffers.emplace_back(buf);
bfs.emplace_back(buf);
}

buffers = std::move(bfs);

return true;
}

Expand Down
23 changes: 12 additions & 11 deletions src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ static udev_enumerate* enumDRMCards(udev* udev) {
return nullptr;

udev_enumerate_add_match_subsystem(enumerate, "drm");
udev_enumerate_add_match_sysname(enumerate, DRM_PRIMARY_MINOR_NAME "[0-9]");
udev_enumerate_add_match_property(enumerate, "DEVTYPE", "drm_minor");
udev_enumerate_add_match_sysname(enumerate, DRM_PRIMARY_MINOR_NAME "[0-9]*");

if (udev_enumerate_scan_devices(enumerate)) {
udev_enumerate_unref(enumerate);
Expand Down Expand Up @@ -1497,11 +1498,6 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) {
return false;
}

if (!backend->rendererState.renderer) {
backend->backend->log(AQ_LOG_ERROR, "drm: No renderer attached to backend");
return false;
}

const auto& STATE = state->state();
const uint32_t COMMITTED = STATE.committed;

Expand All @@ -1512,11 +1508,6 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) {
}
}

if (STATE.drmFormat == DRM_FORMAT_INVALID) {
backend->backend->log(AQ_LOG_ERROR, "drm: No format for output");
return false;
}

if (COMMITTED & COutputState::eOutputStateProperties::AQ_OUTPUT_STATE_FORMAT) {
// verify the format is valid for the primary plane
bool ok = false;
Expand All @@ -1533,6 +1524,11 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) {
}
}

if (STATE.enabled && STATE.drmFormat == DRM_FORMAT_INVALID) {
backend->backend->log(AQ_LOG_ERROR, "drm: No format for output");
return false;
}

if (STATE.adaptiveSync && !connector->canDoVrr) {
backend->backend->log(AQ_LOG_ERROR, "drm: No Adaptive sync support for output");
return false;
Expand Down Expand Up @@ -1600,6 +1596,11 @@ bool Aquamarine::CDRMOutput::commitState(bool onlyTest) {
SP<CDRMFB> drmFB;

if (backend->shouldBlit()) {
if (!backend->rendererState.renderer) {
backend->backend->log(AQ_LOG_ERROR, "drm: No renderer attached to backend when required for blitting");
return false;
}

TRACE(backend->backend->log(AQ_LOG_TRACE, "drm: Backend requires blit, blitting"));

if (!mgpu.swapchain) {
Expand Down
2 changes: 1 addition & 1 deletion src/backend/drm/impl/Atomic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ bool Aquamarine::CDRMAtomicRequest::commit(uint32_t flagssss) {

if (auto ret = drmModeAtomicCommit(backend->gpu->fd, req, flagssss, &conn->pendingPageFlip); ret) {
backend->log((flagssss & DRM_MODE_ATOMIC_TEST_ONLY) ? AQ_LOG_DEBUG : AQ_LOG_ERROR,
std::format("atomic drm request: failed to commit: {}, flags: {}", strerror(-ret), flagsToStr(flagssss)));
std::format("atomic drm request: failed to commit: {}, flags: {}", strerror(ret == -1 ? errno : -ret), flagsToStr(flagssss)));
return false;
}

Expand Down

0 comments on commit 425e664

Please sign in to comment.