renderer: Tearing implementation (#3441)
This commit is contained in:
parent
1e513e25d5
commit
88b63a00b6
19 changed files with 231 additions and 61 deletions
|
|
@ -40,6 +40,8 @@ void CMonitor::onConnect(bool noRule) {
|
|||
hyprListener_monitorCommit.initCallback(&output->events.commit, &Events::listener_monitorCommit, this);
|
||||
hyprListener_monitorBind.initCallback(&output->events.bind, &Events::listener_monitorBind, this);
|
||||
|
||||
canTear = wlr_backend_is_drm(output->backend); // tearing only works on drm
|
||||
|
||||
if (m_bEnabled) {
|
||||
wlr_output_enable(output, 1);
|
||||
wlr_output_commit(output);
|
||||
|
|
|
|||
|
|
@ -81,6 +81,13 @@ class CMonitor {
|
|||
|
||||
CRegion lastFrameDamage; // stores last frame damage
|
||||
|
||||
// for tearing
|
||||
CWindow* solitaryClient = nullptr;
|
||||
bool canTear = false;
|
||||
bool nextRenderTorn = false;
|
||||
bool ignoreNextFlipEvent = false;
|
||||
bool renderingFromVblankEvent = false;
|
||||
|
||||
// for the special workspace. 0 means not open.
|
||||
int specialWorkspaceID = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -245,6 +245,15 @@ void Events::listener_commitSubsurface(void* owner, void* data) {
|
|||
|
||||
if (pNode->pSurface && pNode->pSurface->exists())
|
||||
g_pHyprRenderer->damageSurface(pNode->pSurface->wlr(), lx, ly, SCALE);
|
||||
|
||||
if (pNode->pWindowOwner) {
|
||||
// tearing: if solitary, redraw it. This still might be a single surface window
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(pNode->pWindowOwner->m_iMonitorID);
|
||||
if (PMONITOR->solitaryClient == pNode->pWindowOwner && pNode->pWindowOwner->canBeTorn() && PMONITOR->canTear) {
|
||||
PMONITOR->nextRenderTorn = true;
|
||||
g_pHyprRenderer->renderMonitor(PMONITOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Events::listener_destroySubsurface(void* owner, void* data) {
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ struct SConstraint {
|
|||
Vector2D getLogicConstraintSize();
|
||||
|
||||
bool operator==(const SConstraint& b) const {
|
||||
return constraint == b.constraint;
|
||||
return constraint == b.constraint;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -393,3 +393,14 @@ struct SSwitchDevice {
|
|||
return pWlrDevice == other.pWlrDevice;
|
||||
}
|
||||
};
|
||||
|
||||
struct STearingController {
|
||||
wlr_tearing_control_v1* pWlrHint = nullptr;
|
||||
|
||||
DYNLISTENER(set);
|
||||
DYNLISTENER(destroy);
|
||||
|
||||
bool operator==(const STearingController& other) {
|
||||
return pWlrHint == other.pWlrHint;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue