Skip to content

Commit

Permalink
DRM: Allow checking no-crtc connectors (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Aug 15, 2024
1 parent 9312aa2 commit 5893461
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/aquamarine/backend/DRM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ namespace Aquamarine {
struct SDRMCRTC {
uint32_t id = 0;
std::vector<SDRMLayer> layers;
int32_t refresh = 0;
int32_t refresh = 0; // unused

struct {
int gammaSize = 0;
Expand Down
16 changes: 6 additions & 10 deletions src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,10 +713,10 @@ void Aquamarine::CDRMBackend::scanConnectors() {

conn->status = drmConn->connection;

if (!conn->crtc) {
backend->log(AQ_LOG_DEBUG, std::format("drm: Ignoring connector {} because it has no CRTC", connectorID));
continue;
}
// if (!conn->crtc) {
// backend->log(AQ_LOG_DEBUG, std::format("drm: Ignoring connector {} because it has no CRTC", connectorID));
// continue;
// }

backend->log(AQ_LOG_DEBUG, std::format("drm: Connector {} connection state: {}", connectorID, (int)drmConn->connection));

Expand Down Expand Up @@ -1163,7 +1163,7 @@ void Aquamarine::SDRMConnector::connect(drmModeConnector* connector) {
return;
}

backend->backend->log(AQ_LOG_DEBUG, std::format("drm: Connecting connector {}, CRTC ID {}", szName, crtc ? crtc->id : -1));
backend->backend->log(AQ_LOG_DEBUG, std::format("drm: Connecting connector {}, {}", szName, crtc ? std::format("CRTC ID {}", crtc->id) : "no CRTC"));

output = SP<CDRMOutput>(new CDRMOutput(szName, backend, self.lock()));
output->self = output;
Expand Down Expand Up @@ -1197,19 +1197,15 @@ void Aquamarine::SDRMConnector::connect(drmModeConnector* connector) {

//uint64_t modeID = 0;
// getDRMProp(backend->gpu->fd, crtc->id, crtc->props.mode_id, &modeID);

crtc->refresh = calculateRefresh(drmMode);
}

backend->backend->log(AQ_LOG_DEBUG,
std::format("drm: Mode {}: {}x{}@{:.2f}Hz {}", i, (int)aqMode->pixelSize.x, (int)aqMode->pixelSize.y, aqMode->refreshRate / 1000.0,
aqMode->preferred ? " (preferred)" : ""));
}

if (!currentModeInfo && fallbackMode) {
if (!currentModeInfo && fallbackMode)
output->state->setMode(fallbackMode);
crtc->refresh = calculateRefresh(fallbackMode->modeInfo.value());
}

output->physicalSize = {(double)connector->mmWidth, (double)connector->mmHeight};

Expand Down

0 comments on commit 5893461

Please sign in to comment.