mirror of
https://github.com/hyprwm/Hyprland
synced 2025-02-17 01:02:51 +01:00
renderer: move to CFileDescriptor
use CFileDescriptors instead of manual fd handling
This commit is contained in:
parent
c058551ff1
commit
e8880af2c1
1 changed files with 7 additions and 10 deletions
|
@ -1510,10 +1510,10 @@ void CHyprRenderer::renderMonitor(PHLMONITOR pMonitor) {
|
|||
bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
|
||||
// apply timelines for explicit sync
|
||||
// save inFD otherwise reset will reset it
|
||||
auto inFD = pMonitor->output->state->state().explicitInFence;
|
||||
CFileDescriptor inFD(pMonitor->output->state->state().explicitInFence);
|
||||
pMonitor->output->state->resetExplicitFences();
|
||||
if (inFD >= 0)
|
||||
pMonitor->output->state->setExplicitInFence(inFD);
|
||||
if (inFD.isValid())
|
||||
pMonitor->output->state->setExplicitInFence(inFD.get());
|
||||
auto explicitOptions = getExplicitSyncSettings();
|
||||
if (explicitOptions.explicitEnabled && explicitOptions.explicitKMSEnabled)
|
||||
pMonitor->output->state->enableExplicitOutFenceForNextCommit();
|
||||
|
@ -1525,7 +1525,7 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
|
|||
|
||||
bool ok = pMonitor->state.commit();
|
||||
if (!ok) {
|
||||
if (inFD >= 0) {
|
||||
if (inFD.isValid()) {
|
||||
Debug::log(TRACE, "Monitor state commit failed, retrying without a fence");
|
||||
pMonitor->output->state->resetExplicitFences();
|
||||
ok = pMonitor->state.commit();
|
||||
|
@ -1543,12 +1543,9 @@ bool CHyprRenderer::commitPendingAndDoExplicitSync(PHLMONITOR pMonitor) {
|
|||
if (!explicitOptions.explicitEnabled)
|
||||
return ok;
|
||||
|
||||
if (inFD >= 0)
|
||||
close(inFD);
|
||||
|
||||
if (pMonitor->output->state->state().explicitOutFence >= 0) {
|
||||
Debug::log(TRACE, "Aquamarine returned an explicit out fence at {}", pMonitor->output->state->state().explicitOutFence);
|
||||
close(pMonitor->output->state->state().explicitOutFence);
|
||||
CFileDescriptor outFD(pMonitor->output->state->state().explicitOutFence);
|
||||
if (outFD.isValid()) {
|
||||
Debug::log(TRACE, "Aquamarine returned an explicit out fence at {}", outFD.get());
|
||||
} else
|
||||
Debug::log(TRACE, "Aquamarine did not return an explicit out fence");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue