Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add getting monitor render formats #13

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ pkg_check_modules(deps REQUIRED IMPORTED_TARGET
configure_file(aquamarine.pc.in aquamarine.pc @ONLY)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)

if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
message(STATUS "Configuring aquamarine in Debug")
Expand Down
2 changes: 1 addition & 1 deletion include/aquamarine/backend/Backend.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ namespace Aquamarine {
std::mutex eventLock;
} m_sEventLoopInternals;
};
};
};
1 change: 1 addition & 0 deletions include/aquamarine/backend/DRM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ namespace Aquamarine {
virtual void setCursorVisible(bool visible);
virtual Hyprutils::Math::Vector2D cursorPlaneSize();
virtual size_t getGammaSize();
virtual std::vector<SDRMFormat> getRenderFormats();

int getConnectorID();

Expand Down
1 change: 1 addition & 0 deletions include/aquamarine/backend/Headless.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace Aquamarine {
virtual Hyprutils::Memory::CSharedPointer<IBackendImplementation> getBackend();
virtual void scheduleFrame(const scheduleFrameReason reason = AQ_SCHEDULE_UNKNOWN);
virtual bool destroy();
virtual std::vector<SDRMFormat> getRenderFormats();

Hyprutils::Memory::CWeakPointer<CHeadlessOutput> self;

Expand Down
1 change: 1 addition & 0 deletions include/aquamarine/backend/Wayland.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace Aquamarine {
virtual void scheduleFrame(const scheduleFrameReason reason = AQ_SCHEDULE_UNKNOWN);
virtual Hyprutils::Math::Vector2D cursorPlaneSize();
virtual bool destroy();
virtual std::vector<SDRMFormat> getRenderFormats();

Hyprutils::Memory::CWeakPointer<CWaylandOutput> self;

Expand Down
10 changes: 6 additions & 4 deletions include/aquamarine/output/Output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <xf86drmMode.h>
#include "../allocator/Swapchain.hpp"
#include "../buffer/Buffer.hpp"
#include "../backend/Misc.hpp"

namespace Aquamarine {

Expand Down Expand Up @@ -114,9 +115,10 @@ namespace Aquamarine {
AQ_SCHEDULE_NEEDS_FRAME,
};

virtual bool commit() = 0;
virtual bool test() = 0;
virtual Hyprutils::Memory::CSharedPointer<IBackendImplementation> getBackend() = 0;
virtual bool commit() = 0;
virtual bool test() = 0;
virtual Hyprutils::Memory::CSharedPointer<IBackendImplementation> getBackend() = 0;
virtual std::vector<SDRMFormat> getRenderFormats() = 0;
virtual Hyprutils::Memory::CSharedPointer<SOutputMode> preferredMode();
virtual bool setCursor(Hyprutils::Memory::CSharedPointer<IBuffer> buffer, const Hyprutils::Math::Vector2D& hotspot);
virtual void moveCursor(const Hyprutils::Math::Vector2D& coord); // includes the hotspot
Expand Down Expand Up @@ -170,4 +172,4 @@ namespace Aquamarine {
Hyprutils::Signal::CSignal state;
} events;
};
}
}
5 changes: 5 additions & 0 deletions src/backend/Headless.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ bool Aquamarine::CHeadlessOutput::test() {
return true;
}

std::vector<SDRMFormat> Aquamarine::CHeadlessOutput::getRenderFormats() {
// not sure if this is right but prob doest matter
return backend->getRenderFormats();
}

Hyprutils::Memory::CSharedPointer<IBackendImplementation> Aquamarine::CHeadlessOutput::getBackend() {
return backend.lock();
}
Expand Down
7 changes: 7 additions & 0 deletions src/backend/Wayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,13 @@ Aquamarine::CWaylandOutput::~CWaylandOutput() {
waylandState.surface->sendDestroy();
}

std::vector<SDRMFormat> Aquamarine::CWaylandOutput::getRenderFormats() {
// TODO
// this is technically wrong because this returns the format table formats
// the actually supported formats are given by tranche formats
return backend->getRenderFormats();
}

bool Aquamarine::CWaylandOutput::destroy() {
events.destroy.emit();
waylandState.surface->sendAttach(nullptr, 0, 0);
Expand Down
4 changes: 4 additions & 0 deletions src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1533,6 +1533,10 @@ size_t Aquamarine::CDRMOutput::getGammaSize() {
return size;
}

std::vector<SDRMFormat> Aquamarine::CDRMOutput::getRenderFormats() {
return connector->crtc->primary->formats;
}

int Aquamarine::CDRMOutput::getConnectorID() {
return connector->id;
}
Expand Down