[Spice-devel] [PATCH spice-gtk] egl: Adjust to window scaling
Christophe Fergeau
cfergeau at redhat.com
Wed Mar 6 08:32:19 UTC 2019
On Sun, Mar 03, 2019 at 10:11:08AM +0200, Snir Sheriber wrote:
> When GDK_SCALE is != 1 and egl is used, the presented image does not
> fit to the window (scale of 2 is often used with hidpi monitors).
> Usually this is not a problem since all components are adjusted by
> gdk/gtk but with egl, pixel-based data is not being scaled. In this
> case window's scale value can be used in order to determine whether
> to use a pixel resource with higher resolution data.
> ---
>
> In order to reproduce the problem set spice with virgl/Intel-vGPU
> and run spice-gtk with GDK_SCALE=2
This bit belongs in the commit log imo, anything below --- is going to
be ignored by git am.
>
> This patch is kind of RFC, it fixes the issue, but it's a bit hacky
> and specific. I didn't come across other scale issues but it is likely
> that more of these exist and better and generic fix is needed.
>
> ---
> src/spice-widget-egl.c | 15 +++++++++++++--
> src/spice-widget-priv.h | 1 +
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
> index 43fccd7..814a580 100644
> --- a/src/spice-widget-egl.c
> +++ b/src/spice-widget-egl.c
> @@ -326,6 +326,8 @@ static gboolean spice_widget_init_egl_win(SpiceDisplay *display, GdkWindow *win,
> if (d->egl.surface)
> return TRUE;
>
> + d->egl.scale = gdk_window_get_scale_factor(win);
> +
> #ifdef GDK_WINDOWING_X11
> if (GDK_IS_X11_WINDOW(win)) {
> native = (EGLNativeWindowType)GDK_WINDOW_XID(win);
> @@ -431,15 +433,17 @@ void spice_egl_resize_display(SpiceDisplay *display, int w, int h)
> {
> SpiceDisplayPrivate *d = display->priv;
> int prog;
> + gint ws;
why not 'scale' rather than a cryptic 2 letter name? :)
I'm afraid I'm not familiar enough with this part of gtk+/spice-gtk to
give a review on the approach you took though :-/
Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20190306/81c46c22/attachment.sig>
More information about the Spice-devel
mailing list