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)
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")

View file

@ -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();

View file

@ -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;

View file

@ -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;

View file

@ -9,6 +9,7 @@
#include <xf86drmMode.h>
#include "../allocator/Swapchain.hpp"
#include "../buffer/Buffer.hpp"
#include "../backend/Misc.hpp"
namespace Aquamarine {
@ -117,6 +118,7 @@ namespace Aquamarine {
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

View file

@ -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();
}

View file

@ -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);

View file

@ -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;
}