mirror of
https://github.com/hyprwm/aquamarine.git
synced 2025-12-20 02:30:02 +01:00
drm: Avoid unnecessary modeset (fixed) (#184)
* feat: only do modeset when the mode is different from the current one * style: remove braces around 1-line if * fmt: run clang-format * drm: add reset function back and remove reset from start * drm: fix dpms on fastboot * fmt: run clang-format * Update Atomic.cpp
This commit is contained in:
parent
dfc1db15a0
commit
e2e3f8b4d8
3 changed files with 17 additions and 9 deletions
|
|
@ -895,7 +895,6 @@ void Aquamarine::CDRMBackend::scanLeases() {
|
|||
}
|
||||
|
||||
bool Aquamarine::CDRMBackend::start() {
|
||||
impl->reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,8 +100,19 @@ void Aquamarine::CDRMAtomicRequest::addConnector(Hyprutils::Memory::CSharedPoint
|
|||
TRACE(backend->log(AQ_LOG_TRACE, std::format("atomic addConnector values: CRTC {}, mode {}", enable ? connector->crtc->id : 0, data.atomic.modeBlob)));
|
||||
|
||||
conn = connector;
|
||||
if (enable) {
|
||||
drmModeModeInfo* currentMode = connector->getCurrentMode();
|
||||
bool modeDiffers = true;
|
||||
if (currentMode) {
|
||||
modeDiffers = memcmp(currentMode, &data.modeInfo, sizeof(drmModeModeInfo)) != 0;
|
||||
free(currentMode);
|
||||
}
|
||||
|
||||
if (modeDiffers)
|
||||
addConnectorModeset(connector, data);
|
||||
} else
|
||||
addConnectorModeset(connector, data);
|
||||
|
||||
addConnectorCursor(connector, data);
|
||||
|
||||
add(connector->id, connector->props.crtc_id, enable ? connector->crtc->id : 0);
|
||||
|
|
@ -181,7 +192,7 @@ void Aquamarine::CDRMAtomicRequest::addConnectorModeset(Hyprutils::Memory::CShar
|
|||
const auto& STATE = connector->output->state->state();
|
||||
const bool enable = STATE.enabled && data.mainFB;
|
||||
|
||||
add(connector->crtc->id, connector->crtc->props.mode_id, data.atomic.modeBlob);
|
||||
add(connector->crtc->id, connector->crtc->props.mode_id, enable ? data.atomic.modeBlob : 0);
|
||||
data.atomic.blobbed = true;
|
||||
|
||||
if (!enable)
|
||||
|
|
|
|||
|
|
@ -70,15 +70,13 @@ int main(int argc, char** argv, char** envp) {
|
|||
});
|
||||
|
||||
newMouseListener = aqBackend->events.newPointer.listen([](const SP<Aquamarine::IPointer>& pointer) {
|
||||
mouseMotionListener = pointer->events.warp.listen([](const Aquamarine::IPointer::SWarpEvent& event) {
|
||||
std::cout << "[Client] Mouse warped to " << std::format("{}", event.absolute) << "\n";
|
||||
});
|
||||
mouseMotionListener = pointer->events.warp.listen(
|
||||
[](const Aquamarine::IPointer::SWarpEvent& event) { std::cout << "[Client] Mouse warped to " << std::format("{}", event.absolute) << "\n"; });
|
||||
});
|
||||
|
||||
newKeyboardListener = aqBackend->events.newKeyboard.listen([](const SP<Aquamarine::IKeyboard>& keyboard) {
|
||||
keyboardKeyListener = keyboard->events.key.listen([](const Aquamarine::IKeyboard::SKeyEvent& event) {
|
||||
std::cout << "[Client] Key " << std::format("{}", event.key) << " state: " << event.pressed << " \n";
|
||||
});
|
||||
keyboardKeyListener = keyboard->events.key.listen(
|
||||
[](const Aquamarine::IKeyboard::SKeyEvent& event) { std::cout << "[Client] Key " << std::format("{}", event.key) << " state: " << event.pressed << " \n"; });
|
||||
});
|
||||
|
||||
if (!aqBackend || !aqBackend->start()) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue