-
Notifications
You must be signed in to change notification settings - Fork 13
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
#138 always round scales to nearest 1/8 to support fractional scaling and other recent compositor changes; use --log-threshold debug to see details #145
Conversation
@alex-courtis I've included the commits from your branch ( |
The issues there were probably due to my graphics driver or something, it works again now. However, it appears that both Hyprland and Wayfire behave different than Sway here: the output sizes after configuration are the same as computed with this PR's code but without the extra fractional-scale-v1 logic. So, perhaps this is a Sway bug after all and #144 would be sufficient? Or do the other compositors have it wrong? 😕 Will have to investigate more. Edit: here is the relevant Sway code. |
src/head.c
Outdated
* where the factor 120 comes from. It does not occur on Sway 1.8.1 (which doesn't yet have support for the | ||
* fractional scaling protocol). | ||
* | ||
* TODO: Can we "prove" that this is the right thing to do by looking at protocol specifications? |
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 couldn't find anything official; it looks like truncation however it's really not clear.
Wow... you do not waste time! Testing / reviewing now. |
#144 was just a hope. It covered river but not sway. We need a complete solution - this is the right way. For completeness I think we'll need to listen for the actual sizes after the scale is set. I'll branch an experiment off this branch. |
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 looking great! Many thanks for your speedy work...
inc/head.h
Outdated
@@ -26,6 +27,8 @@ struct HeadState { | |||
|
|||
struct Head { | |||
|
|||
struct Displ *displ; |
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.
Once we are happy we can probably refactor this away. I'm not a fan of back references ;)
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.
Removed this in d032ac6 in favor of a scaling_base
integer in Head
.
src/head.c
Outdated
* | ||
* Note that this is currently only *observed* behavior in a Sway revision with fractional-scale-v1, which is | ||
* where the factor 120 comes from. It does not occur on Sway 1.8.1 (which doesn't yet have support for the | ||
* fractional scaling protocol). |
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.
Whichever direction we go, this quantization should be appropriate in all situations.
I've created a branch https://github.com/alex-courtis/way-displays/tree/138-retrieve-output-dimensions which adds xdg-output-unstable-v1 and listens to output events. It's not hooked up to anything yet, however it is very useful for debugging, as it shows the actual logical x/y/w/h Edit: above branch now warns if calculated size does not match actual e.g. |
Great, that'll be very useful. It seems to me that taking an output's size after it was configured (and configuring them one after the other) is the only real way forward here, seeing as my changes don't work on some compositors. Of course, one could still clamp the scale to multiples of 0.125 as an intermediate fix. |
This PR is a bugfix that should resolve the specific issues with fractional scaling compositors and doesn't affect existing functionality. Clamping scales can be considered a feature (#40) and it doesn't seem to be needed to resolve this case. Listening to xdg-output may not ever be necessary and adds a lot of complexity i.e. an extra set step. Providing this branch passes all the test cases as per #145 (comment) we should just merge this and release as a PATCH. |
Apologies for the sporadic replies; I should have mentioned that I'm only able to work on this project <1 day per week. |
Alternative: just clamp scales by implementing #40 Do you think that would resolve this entire fractional scaling compositor issue? It would still be useful to have the ability to determine if the compositor does fractional scaling, as it's likely that we will need that some time in the future. |
While it fixes a bug for users of an unreleased Sway version, it does introduce the same problems for Hyprland though.
Yes, restricting allowed scales to multiples of 1/8ths should resolve all issues that I encountered in my tests. |
It seems that is the best solution here. It's disappointing; I like the "fractional scaling choice" and I have a feeling we'll need it in the future. Options:
|
Sorry for my infrequent responses. I'm currently travelling. I'd be happy to rework my PR to implement option 2, but will only be able to do so by end of January at the earliest. The other options also sound good to me though, and I wouldn't be mad if my PR ends up not being merged. :) |
No worries at all. I'm in a similar situation. |
Updated the PR to round the scale to a multiple of 1/8 if the compositor has fractional-scale-v1. |
I'm really happy with that: I've hardcoded fractional scaling on and the scales are sensible. It's working just fine with sway 1.8.1 and river master (fractional scaling). You've validated that it's resolved your initial failure case on sway master.
∴let's just do this: remove the test for fractional scaling and always use the new codepaths. |
We should keep In a subsequest PR we can add xdg-output-unstable to retrieve the positions, but that will again be information / warning only. |
Now uses a default scaling base of 8.
Removed the check for the fractional scaling protocol, scales are now always rounded to the nearest multiple of 1/8th. Let me know if that's not what you intended.
There's a debug log message in |
Fantastic! I'll review / test this one on Monday. |
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 fantastic, the calculated scales for 1/120 1/256 always produce correct logical positions and dimensions.
I hope you don't mind, I enhanced the logging and added some tests.
Real world testing: ARRANGE: ROW
ALIGN: BOTTOM
ORDER:
- LG Display 0x05EF
- M28U
- Gigabyte M32Q
SCALING: TRUE
AUTO_SCALE: TRUE
SCALE:
- NAME_DESC: LG Display 0x05EF
SCALE: 2.3
- NAME_DESC: M28U
SCALE: 1.7
- NAME_DESC: Gigabyte M32Q
SCALE: 1.9
VRR_OFF:
- LG Display 0x05EF
- M28U
- Gigabyte M32Q released:
Logical positions and scales do not add up. branch:
Everything adds up. |
fixes #138
Attempts to fix #138 by using a different "scaling base" when the compositor supports the new fractional-scale-v1 protocol.
With this PR, I observed no gaps or any overlap between the two outputs (each 3840x2160 pixels) at various tested scales. The issue with "flipping" scales (see discussion in #138) is also gone.
Tested on the following compositors:
I wanted to test on Hyprland 0.32.3 and Wayfire master as well (they would have fractional-scale-v1), but way-displays (even the released 0.9.0) fails to setup the layout when a fractional scale is used, so there is probably something else going on.