api: add getting monitor render formats (#13)

This commit is contained in:
Ikalco 2024-07-14 04:06:13 -05:00 committed by GitHub
parent 2efe4296f8
commit ad8261ba99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 27 additions and 5 deletions

View file

@ -31,6 +31,7 @@ pkg_check_modules(deps REQUIRED IMPORTED_TARGET
configure_file(aquamarine.pc.in aquamarine.pc @ONLY) configure_file(aquamarine.pc.in aquamarine.pc @ONLY)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG) if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
message(STATUS "Configuring aquamarine in Debug") message(STATUS "Configuring aquamarine in Debug")

View file

@ -158,4 +158,4 @@ namespace Aquamarine {
std::mutex eventLock; std::mutex eventLock;
} m_sEventLoopInternals; } m_sEventLoopInternals;
}; };
}; };

View file

@ -199,6 +199,7 @@ namespace Aquamarine {
virtual void setCursorVisible(bool visible); virtual void setCursorVisible(bool visible);
virtual Hyprutils::Math::Vector2D cursorPlaneSize(); virtual Hyprutils::Math::Vector2D cursorPlaneSize();
virtual size_t getGammaSize(); virtual size_t getGammaSize();
virtual std::vector<SDRMFormat> getRenderFormats();
int getConnectorID(); int getConnectorID();

View file

@ -17,6 +17,7 @@ namespace Aquamarine {
virtual Hyprutils::Memory::CSharedPointer<IBackendImplementation> getBackend(); virtual Hyprutils::Memory::CSharedPointer<IBackendImplementation> getBackend();
virtual void scheduleFrame(const scheduleFrameReason reason = AQ_SCHEDULE_UNKNOWN); virtual void scheduleFrame(const scheduleFrameReason reason = AQ_SCHEDULE_UNKNOWN);
virtual bool destroy(); virtual bool destroy();
virtual std::vector<SDRMFormat> getRenderFormats();
Hyprutils::Memory::CWeakPointer<CHeadlessOutput> self; Hyprutils::Memory::CWeakPointer<CHeadlessOutput> self;

View file

@ -49,6 +49,7 @@ namespace Aquamarine {
virtual void scheduleFrame(const scheduleFrameReason reason = AQ_SCHEDULE_UNKNOWN); virtual void scheduleFrame(const scheduleFrameReason reason = AQ_SCHEDULE_UNKNOWN);
virtual Hyprutils::Math::Vector2D cursorPlaneSize(); virtual Hyprutils::Math::Vector2D cursorPlaneSize();
virtual bool destroy(); virtual bool destroy();
virtual std::vector<SDRMFormat> getRenderFormats();
Hyprutils::Memory::CWeakPointer<CWaylandOutput> self; Hyprutils::Memory::CWeakPointer<CWaylandOutput> self;

View file

@ -9,6 +9,7 @@
#include <xf86drmMode.h> #include <xf86drmMode.h>
#include "../allocator/Swapchain.hpp" #include "../allocator/Swapchain.hpp"
#include "../buffer/Buffer.hpp" #include "../buffer/Buffer.hpp"
#include "../backend/Misc.hpp"
namespace Aquamarine { namespace Aquamarine {
@ -114,9 +115,10 @@ namespace Aquamarine {
AQ_SCHEDULE_NEEDS_FRAME, AQ_SCHEDULE_NEEDS_FRAME,
}; };
virtual bool commit() = 0; virtual bool commit() = 0;
virtual bool test() = 0; virtual bool test() = 0;
virtual Hyprutils::Memory::CSharedPointer<IBackendImplementation> getBackend() = 0; virtual Hyprutils::Memory::CSharedPointer<IBackendImplementation> getBackend() = 0;
virtual std::vector<SDRMFormat> getRenderFormats() = 0;
virtual Hyprutils::Memory::CSharedPointer<SOutputMode> preferredMode(); virtual Hyprutils::Memory::CSharedPointer<SOutputMode> preferredMode();
virtual bool setCursor(Hyprutils::Memory::CSharedPointer<IBuffer> buffer, const Hyprutils::Math::Vector2D& hotspot); virtual bool setCursor(Hyprutils::Memory::CSharedPointer<IBuffer> buffer, const Hyprutils::Math::Vector2D& hotspot);
virtual void moveCursor(const Hyprutils::Math::Vector2D& coord); // includes the hotspot virtual void moveCursor(const Hyprutils::Math::Vector2D& coord); // includes the hotspot
@ -170,4 +172,4 @@ namespace Aquamarine {
Hyprutils::Signal::CSignal state; Hyprutils::Signal::CSignal state;
} events; } events;
}; };
} }

View file

@ -50,6 +50,11 @@ bool Aquamarine::CHeadlessOutput::test() {
return true; 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() { Hyprutils::Memory::CSharedPointer<IBackendImplementation> Aquamarine::CHeadlessOutput::getBackend() {
return backend.lock(); return backend.lock();
} }

View file

@ -501,6 +501,13 @@ Aquamarine::CWaylandOutput::~CWaylandOutput() {
waylandState.surface->sendDestroy(); 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() { bool Aquamarine::CWaylandOutput::destroy() {
events.destroy.emit(); events.destroy.emit();
waylandState.surface->sendAttach(nullptr, 0, 0); waylandState.surface->sendAttach(nullptr, 0, 0);

View file

@ -1533,6 +1533,10 @@ size_t Aquamarine::CDRMOutput::getGammaSize() {
return size; return size;
} }
std::vector<SDRMFormat> Aquamarine::CDRMOutput::getRenderFormats() {
return connector->crtc->primary->formats;
}
int Aquamarine::CDRMOutput::getConnectorID() { int Aquamarine::CDRMOutput::getConnectorID() {
return connector->id; return connector->id;
} }