mirror of
https://github.com/hyprwm/aquamarine.git
synced 2024-11-17 04:56:00 +01:00
drm: recheck crtcs before connecting on udev event (#65)
This commit is contained in:
parent
3989aa9b2f
commit
abb3c81c59
2 changed files with 11 additions and 9 deletions
|
@ -367,7 +367,7 @@ namespace Aquamarine {
|
||||||
bool initMgpu();
|
bool initMgpu();
|
||||||
bool grabFormats();
|
bool grabFormats();
|
||||||
bool shouldBlit();
|
bool shouldBlit();
|
||||||
void scanConnectors();
|
void scanConnectors(bool allowConnect = true);
|
||||||
void scanLeases();
|
void scanLeases();
|
||||||
void restoreAfterVT();
|
void restoreAfterVT();
|
||||||
void recheckCRTCs();
|
void recheckCRTCs();
|
||||||
|
|
|
@ -658,7 +658,7 @@ bool Aquamarine::CDRMBackend::registerGPU(SP<CSessionDevice> gpu_, SP<CDRMBacken
|
||||||
auto E = std::any_cast<CSessionDevice::SChangeEvent>(d);
|
auto E = std::any_cast<CSessionDevice::SChangeEvent>(d);
|
||||||
if (E.type == CSessionDevice::AQ_SESSION_EVENT_CHANGE_HOTPLUG) {
|
if (E.type == CSessionDevice::AQ_SESSION_EVENT_CHANGE_HOTPLUG) {
|
||||||
backend->log(AQ_LOG_DEBUG, std::format("drm: Got a hotplug event for {}", gpuName));
|
backend->log(AQ_LOG_DEBUG, std::format("drm: Got a hotplug event for {}", gpuName));
|
||||||
scanConnectors();
|
scanConnectors(false);
|
||||||
recheckCRTCs();
|
recheckCRTCs();
|
||||||
} else if (E.type == CSessionDevice::AQ_SESSION_EVENT_CHANGE_LEASE) {
|
} else if (E.type == CSessionDevice::AQ_SESSION_EVENT_CHANGE_LEASE) {
|
||||||
backend->log(AQ_LOG_DEBUG, std::format("drm: Got a lease event for {}", gpuName));
|
backend->log(AQ_LOG_DEBUG, std::format("drm: Got a lease event for {}", gpuName));
|
||||||
|
@ -676,7 +676,7 @@ eBackendType Aquamarine::CDRMBackend::type() {
|
||||||
return eBackendType::AQ_BACKEND_DRM;
|
return eBackendType::AQ_BACKEND_DRM;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Aquamarine::CDRMBackend::scanConnectors() {
|
void Aquamarine::CDRMBackend::scanConnectors(bool allowConnect) {
|
||||||
backend->log(AQ_LOG_DEBUG, std::format("drm: Scanning connectors for {}", gpu->path));
|
backend->log(AQ_LOG_DEBUG, std::format("drm: Scanning connectors for {}", gpu->path));
|
||||||
|
|
||||||
auto resources = drmModeGetResources(gpu->fd);
|
auto resources = drmModeGetResources(gpu->fd);
|
||||||
|
@ -722,12 +722,14 @@ void Aquamarine::CDRMBackend::scanConnectors() {
|
||||||
|
|
||||||
backend->log(AQ_LOG_DEBUG, std::format("drm: Connector {} connection state: {}", connectorID, (int)drmConn->connection));
|
backend->log(AQ_LOG_DEBUG, std::format("drm: Connector {} connection state: {}", connectorID, (int)drmConn->connection));
|
||||||
|
|
||||||
if (conn->status == DRM_MODE_CONNECTED && !conn->output) {
|
if (allowConnect) {
|
||||||
backend->log(AQ_LOG_DEBUG, std::format("drm: Connector {} connected", conn->szName));
|
if (conn->status == DRM_MODE_CONNECTED && !conn->output) {
|
||||||
conn->connect(drmConn);
|
backend->log(AQ_LOG_DEBUG, std::format("drm: Connector {} connected", conn->szName));
|
||||||
} else if (conn->status != DRM_MODE_CONNECTED && conn->output) {
|
conn->connect(drmConn);
|
||||||
backend->log(AQ_LOG_DEBUG, std::format("drm: Connector {} disconnected", conn->szName));
|
} else if (conn->status != DRM_MODE_CONNECTED && conn->output) {
|
||||||
conn->disconnect();
|
backend->log(AQ_LOG_DEBUG, std::format("drm: Connector {} disconnected", conn->szName));
|
||||||
|
conn->disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
drmModeFreeConnector(drmConn);
|
drmModeFreeConnector(drmConn);
|
||||||
|
|
Loading…
Reference in a new issue