-
-
Notifications
You must be signed in to change notification settings - Fork 897
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
Fix mirrored displays when transformed and preserve aspect ratio #5697
Conversation
historical reasons for back when it didn't exist. If you want to, you can make this MR use it (and remove mirrorFB) |
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.
lgtm, I assume it works (I am not weird, I dont rotate my monitors)
uh oh, clang-format missing |
The transforms and the mirroring are working correctly, but I am seeing some graphical glitches with the blur of floating windows when mirroring from one orientation to another. They seem to be present on the
oh yes, my bad, i'll fix it |
right thats probably why we used mirroredFB, I forgot. Expanding damage |
9b00957
to
c3ec16f
Compare
After too many hours of experimenting and debugging yesterday, I've also come to the conclusion that we need an extra framebuffer. The point is that we can't use the I guess we could "fix" this by not using double buffering for mirror monitors, or only using the "latest" damage and not the union (i.e. not passing the damage through the monitor's ring). However, that wouldn't stop artifacts from appearing in other scenarios, like when using different refresh-rate monitors, and would be really janky. So unless you have a better idea, I think using an extra framebuffer is the more robust and reliable solution. I've now reimplemented the
I've tested this implementation a fair bit, so I think it should be ready now. |
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.
// yes, this breaks mirrors of mirrors
this shouldn't be allowed anyways lole
lgtm!
…ratio (hyprwm#5697) * renderer: transform mirror buffer and preserve mirror aspect ratio * renderer: render mirrors directly from offloadFB * renderer: fix formatting * renderer: use monitorMirrorFB again, but properly damage mirrors * renderer: clean mirrors after reload and support cursor zoom mirroring
Describe your PR, what does it fix/add?
Currently, the mirroring of monitors is unusable with different aspect ratios or straight out broken when using transformed monitors.
This PR does the following:
This makes mirroring usable when the source and/or target monitor is transformed. I also think preserving the aspect ratio should be the normal behaviour, as stretching is not what's ideal in most usecases.
Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
As mentioned, we currently copy the buffer of the monitor into a separate mirror buffer which is then drawn on the target monitors. The buffer of the monitor is already transformed with the monitor transform, so this PR renders the buffer with the inverse transform.
To do that, the transform and the matrices of the monitor are temporarily changed for this one render, which is a bit of a janky solution. Otherwise we'd have to override or add a second transform in the
renderTextureInternalWithDamage
which would probably require a lot of changes.Also, for what reason is the monitor framebuffer copied to the mirror buffer, which is then rendered? Couldn't we just directly render the
offloadFB
of the mirrored monitor on the target?Is it ready for merging, or does it need work?
The current approach works fine on both my systems, and I did quite a bit of testing with all possible transforms. So I think it is ready.
I could also do a "cleaner" implementation as mentioned above (i.e. pass an extra transform to the render method) if you want.