-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
core: Accumulate render damage #9808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
I think you can just keep track of damage in surface.current, something like this diff --git a/src/desktop/WLSurface.cpp b/src/desktop/WLSurface.cpp
index 11da7b68..4f8e7429 100644
--- a/src/desktop/WLSurface.cpp
+++ b/src/desktop/WLSurface.cpp
@@ -99,6 +99,7 @@ CRegion CWLSurface::computeDamage() const {
return {};
CRegion damage = m_pResource->current.accumulateBufferDamage();
+ m_pResource->current.bufferDamage.clear();
damage.transform(wlTransformToHyprutils(m_pResource->current.transform), m_pResource->current.bufferSize.x, m_pResource->current.bufferSize.y);
const auto BUFSIZE = m_pResource->current.bufferSize;
diff --git a/src/protocols/types/SurfaceState.cpp b/src/protocols/types/SurfaceState.cpp
old mode 100644
new mode 100755
index a97f69b4..f81c6bb0
--- a/src/protocols/types/SurfaceState.cpp
+++ b/src/protocols/types/SurfaceState.cpp
@@ -74,8 +74,8 @@ void SSurfaceState::updateFrom(SSurfaceState& ref) {
}
if (ref.updated.damage) {
- damage = ref.damage;
- bufferDamage = ref.bufferDamage;
+ damage.add(ref.damage);
+ bufferDamage.add(ref.bufferDamage);
}
if (ref.updated.input)
diff --git a/src/protocols/types/SurfaceState.hpp b/src/protocols/types/SurfaceState.hpp
index 07ade832..b58aa9a8 100644
--- a/src/protocols/types/SurfaceState.hpp
+++ b/src/protocols/types/SurfaceState.hpp
@@ -55,7 +55,7 @@ struct SSurfaceState {
void updateSynchronousTexture(SP<CTexture> lastTexture);
// helpers
- CRegion accumulateBufferDamage(); // transforms state.damage and merges it into state.bufferDamage
+ CRegion accumulateBufferDamage(); // returns total damage in buffer coords
void updateFrom(SSurfaceState& ref); // updates this state based on a reference state.
void reset(); // resets pending state after commit
}; |
That breaks the damage passed to updating the shm texture and cursor. |
no regressions here, lgtm. |
src/desktop/WLSurface.cpp
Outdated
if (!m_pResource->current.texture) | ||
return {}; | ||
|
||
CRegion damage = m_pResource->current.accumulateBufferDamage(); | ||
CRegion damage = m_pResource->damageSinceLastRender; | ||
m_pResource->damageSinceLastRender.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is incredibly unintuitive and not documented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's already documented in the comment I added to computeRenderDamage in the .hpp. Should I rename the method or add additional documentation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just not do this. Why? Maybe add another method to explicitly clear render damage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I forgot about this. I added the separate method.
Actually I don't think this is necessary, because it looks like the surface should be damaged per commit not per render |
Describe your PR, what does it fix/add?
If a client commits multiple times before we next render, we should accumulate damage instead of replacing it.
Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
Nope
Is it ready for merging, or does it need work?
Ready for merging