Expose Buffer scale factor in HiDPI

Méven meven29 at gmail.com
Mon Jun 29 16:29:58 UTC 2020


Hi all,

Currently in HiDPI setting, wayland protocols expose to clients an integer
scale per output with wl_output::scale.
But nowadays it is becoming more and more common for users to use a
fractional scaling, for instance 1.25 on a 4K display for instance allowing
to use a 3072x1728 logical resolution with a more detailed rendering.
Compositors such as Mutter, KWin or sway support this.

In such instances, clients read the scale value of 2 (the ceil value of the
fractional scale) and scale their content accordingly, and inform the
compositor with wl_surface::set_buffer_scale. They get their logical size
using xdg_output::logical_size. Clients' top-level surface buffers are in
effect fractional_scale * logical_size.

But one could imagine clients could make use of the fact the output real
buffer is not 2 but 1.25 and reduce the size of their rendering buffer,
allowing the compositor not to have to do any down scaling when
compositing. Video rendering for instance could make use of it.

My personal use case is to allow a screenshot program to export an output
rendering with its scaling factor so that it can be viewed at the right
scale.

1/ I would suggest adding to xdg_output a fractional_scale or real_scale
real value to expose this real buffer to clients.

2/ We could add a wl_surface.set_buffer_fractional_scale or
wl_surface.real_scale, to inform the compositor, that a surface uses a
fractional scale.

What do you think ?

-- 
Méven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20200629/be3f24c2/attachment.htm>


More information about the wayland-devel mailing list