Re: [PATCH 0/9] ui: Improve scale handling

2025-06-01 Thread Weifeng Liu
On 5/30/25 6:56 PM, Michael Tokarev wrote:
> On 30.05.2025 09:39, Weifeng Liu wrote:
>> On Thu, 2025-05-29 at 10:23 +0300, Michael Tokarev wrote:
>
 PATCH 3 - 5 fix bugs in mouse position calculation due to not
 handling
 scale properly, for both gtk and sdl.

 PATCH 6 align scale update logic in gtk-egl with other
 implementations.

 PATCH 7 fix an issue that gtk window might keep enlarging/shrinking
 because
 ui info propagating to guest not considering scale.

 PATCH 8 and 9 align fixed-scale mode behavior in gtk-gl-area and
 gtk-egl with
 other implementations by adding appropriate padding to the window
 to preserve
 the scale.
>>> ...
 Weifeng Liu (9):
 ui/gtk: Document scale and coordinate handling
 ui/gtk: Use consistent naming for variables in different
 coordinates
 gtk/ui: Introduce helper gd_update_scale
 ui/gtk: Update scales in fixed-scale mode when rendering GL area
 ui/sdl: Consider scaling in mouse event handling
 ui/gtk: Don't update scale in fixed scale mode in gtk-egl.c
 ui/gtk: Consider scaling when propagating ui info
 ui/gtk-gl-area: Render guest content with padding in fixed-scale
 mode
 ui/gtk-egl: Render guest content with padding in fixed-scale
 mode
> ...
>> I think the first five patches are good candidates for backporting to
>> the stable branches, as they only address bugs without altering
>> existing behavior. [...]
>
> It somehow feels like *all* patches should be picked up, not just first
> 5 of them :)  BTW, the first one (Document scale handling) does not fix
> any bugs ;)
>

Great! Please apply all these patches to 10.0 branch. Let me know if
there's anything I can help with.

Best regards,
Weifeng



Re: [PATCH 0/9] ui: Improve scale handling

2025-05-30 Thread Michael Tokarev

Hi!

Thank you for your attention!

On 30.05.2025 09:39, Weifeng Liu wrote:

On Thu, 2025-05-29 at 10:23 +0300, Michael Tokarev wrote:

Is there anything here which should be picked up for qemu-stable
(current active branches: 7.2 and 10.0)?



I think the first five patches are good candidates for backporting to
the stable branches, as they only address bugs without altering
existing behavior. I was able to apply them cleanly to stable-10.0, but
porting them to 7.2 will require some additional effort. I'll send out
a new patch set once the backporting work is complete.


Please don't, - just forget about it in 7.2.  It's been here for quite
long already, and there was no complaints.  Let's keep it this way.
I'll apply it to 10.0.x series though.

Thank you!

/mjt



Re: [PATCH 0/9] ui: Improve scale handling

2025-05-30 Thread Michael Tokarev

On 30.05.2025 09:39, Weifeng Liu wrote:

On Thu, 2025-05-29 at 10:23 +0300, Michael Tokarev wrote:



PATCH 3 - 5 fix bugs in mouse position calculation due to not
handling
scale properly, for both gtk and sdl.

PATCH 6 align scale update logic in gtk-egl with other
implementations.

PATCH 7 fix an issue that gtk window might keep enlarging/shrinking
because
ui info propagating to guest not considering scale.

PATCH 8 and 9 align fixed-scale mode behavior in gtk-gl-area and
gtk-egl with
other implementations by adding appropriate padding to the window
to preserve
the scale.

...

Weifeng Liu (9):
    ui/gtk: Document scale and coordinate handling
    ui/gtk: Use consistent naming for variables in different
coordinates
    gtk/ui: Introduce helper gd_update_scale
    ui/gtk: Update scales in fixed-scale mode when rendering GL area
    ui/sdl: Consider scaling in mouse event handling
    ui/gtk: Don't update scale in fixed scale mode in gtk-egl.c
    ui/gtk: Consider scaling when propagating ui info
    ui/gtk-gl-area: Render guest content with padding in fixed-scale
mode
    ui/gtk-egl: Render guest content with padding in fixed-scale
mode

...

I think the first five patches are good candidates for backporting to
the stable branches, as they only address bugs without altering
existing behavior. [...]


It somehow feels like *all* patches should be picked up, not just first
5 of them :)  BTW, the first one (Document scale handling) does not fix
any bugs ;)

Thanks,

/mjt



Re: [PATCH 0/9] ui: Improve scale handling

2025-05-29 Thread Weifeng Liu
Hi Michael,

On Thu, 2025-05-29 at 10:23 +0300, Michael Tokarev wrote:
> On 11.05.2025 10:33, Weifeng Liu wrote:
> > Hi all,
> > 
> > Now we have quite a lot of display backends for different use
> > cases.
> > Even in the context of gtk, we have various implementations (e.g.,
> > gl=on
> > vs gl=off, X11 vs Wayland). However, behaviors to users are not
> > aligned
> > across the backends, especially in the part of scale handling. This
> > patch set attempts to improve scale handling.
> > 
> > We have to deal with various coordinates due to the existence of
> > scaling
> > in different level. Firstly, in desktop level, we could have a
> > global
> > window scale factor. Secondly, users might set a zooming factor to
> > adjust the size of guest content in scan-out level. Consequently,
> > 1) the
> > buffer from guest, 2) the host window and 3) OpenGl drawing area
> > inside
> > the host window are in distinct coordinates. It's important to
> > define
> > these coordinates and scales unambiguously and use a consistent
> > naming
> > convention for variables representing different concepts. The first
> > patch in this set tries to achieve this goal by adding a document
> > in
> > gtk.c, and the next patch (PATCH 2) attempts to align the code with
> > the
> > document.
> > 
> > PATCH 3 - 5 fix bugs in mouse position calculation due to not
> > handling
> > scale properly, for both gtk and sdl.
> > 
> > PATCH 6 align scale update logic in gtk-egl with other
> > implementations.
> > 
> > PATCH 7 fix an issue that gtk window might keep enlarging/shrinking
> > because
> > ui info propagating to guest not considering scale.
> > 
> > PATCH 8 and 9 align fixed-scale mode behavior in gtk-gl-area and
> > gtk-egl with
> > other implementations by adding appropriate padding to the window
> > to preserve
> > the scale.
> ...
> > Weifeng Liu (9):
> >    ui/gtk: Document scale and coordinate handling
> >    ui/gtk: Use consistent naming for variables in different
> > coordinates
> >    gtk/ui: Introduce helper gd_update_scale
> >    ui/gtk: Update scales in fixed-scale mode when rendering GL area
> >    ui/sdl: Consider scaling in mouse event handling
> >    ui/gtk: Don't update scale in fixed scale mode in gtk-egl.c
> >    ui/gtk: Consider scaling when propagating ui info
> >    ui/gtk-gl-area: Render guest content with padding in fixed-scale
> > mode
> >    ui/gtk-egl: Render guest content with padding in fixed-scale
> > mode
> 
> Is there anything here which should be picked up for qemu-stable
> (current active branches: 7.2 and 10.0)?
> 

I think the first five patches are good candidates for backporting to
the stable branches, as they only address bugs without altering
existing behavior. I was able to apply them cleanly to stable-10.0, but
porting them to 7.2 will require some additional effort. I'll send out
a new patch set once the backporting work is complete.

Best regards,
Weifeng

> Thanks,
> 
> /mjt



Re: [PATCH 0/9] ui: Improve scale handling

2025-05-29 Thread Michael Tokarev

On 11.05.2025 10:33, Weifeng Liu wrote:

Hi all,

Now we have quite a lot of display backends for different use cases.
Even in the context of gtk, we have various implementations (e.g., gl=on
vs gl=off, X11 vs Wayland). However, behaviors to users are not aligned
across the backends, especially in the part of scale handling. This
patch set attempts to improve scale handling.

We have to deal with various coordinates due to the existence of scaling
in different level. Firstly, in desktop level, we could have a global
window scale factor. Secondly, users might set a zooming factor to
adjust the size of guest content in scan-out level. Consequently, 1) the
buffer from guest, 2) the host window and 3) OpenGl drawing area inside
the host window are in distinct coordinates. It's important to define
these coordinates and scales unambiguously and use a consistent naming
convention for variables representing different concepts. The first
patch in this set tries to achieve this goal by adding a document in
gtk.c, and the next patch (PATCH 2) attempts to align the code with the
document.

PATCH 3 - 5 fix bugs in mouse position calculation due to not handling
scale properly, for both gtk and sdl.

PATCH 6 align scale update logic in gtk-egl with other implementations.

PATCH 7 fix an issue that gtk window might keep enlarging/shrinking because
ui info propagating to guest not considering scale.

PATCH 8 and 9 align fixed-scale mode behavior in gtk-gl-area and gtk-egl with
other implementations by adding appropriate padding to the window to preserve
the scale.

...

Weifeng Liu (9):
   ui/gtk: Document scale and coordinate handling
   ui/gtk: Use consistent naming for variables in different coordinates
   gtk/ui: Introduce helper gd_update_scale
   ui/gtk: Update scales in fixed-scale mode when rendering GL area
   ui/sdl: Consider scaling in mouse event handling
   ui/gtk: Don't update scale in fixed scale mode in gtk-egl.c
   ui/gtk: Consider scaling when propagating ui info
   ui/gtk-gl-area: Render guest content with padding in fixed-scale mode
   ui/gtk-egl: Render guest content with padding in fixed-scale mode


Is there anything here which should be picked up for qemu-stable
(current active branches: 7.2 and 10.0)?

Thanks,

/mjt



Re: [PATCH 0/9] ui: Improve scale handling

2025-05-12 Thread Gerd Hoffmann
On Sun, May 11, 2025 at 03:33:10PM +0800, Weifeng Liu wrote:
> Hi all,
> 
> Now we have quite a lot of display backends for different use cases.
> Even in the context of gtk, we have various implementations (e.g., gl=on
> vs gl=off, X11 vs Wayland). However, behaviors to users are not aligned
> across the backends, especially in the part of scale handling. This
> patch set attempts to improve scale handling.
> 
> We have to deal with various coordinates due to the existence of scaling
> in different level. Firstly, in desktop level, we could have a global
> window scale factor. Secondly, users might set a zooming factor to
> adjust the size of guest content in scan-out level. Consequently, 1) the
> buffer from guest, 2) the host window and 3) OpenGl drawing area inside
> the host window are in distinct coordinates. It's important to define
> these coordinates and scales unambiguously and use a consistent naming
> convention for variables representing different concepts. The first
> patch in this set tries to achieve this goal by adding a document in
> gtk.c, and the next patch (PATCH 2) attempts to align the code with the
> document.
> 
> PATCH 3 - 5 fix bugs in mouse position calculation due to not handling
> scale properly, for both gtk and sdl.
> 
> PATCH 6 align scale update logic in gtk-egl with other implementations.
> 
> PATCH 7 fix an issue that gtk window might keep enlarging/shrinking because 
> ui info propagating to guest not considering scale.
> 
> PATCH 8 and 9 align fixed-scale mode behavior in gtk-gl-area and gtk-egl with
> other implementations by adding appropriate padding to the window to preserve
> the scale.

Series:
Acked-by: Gerd Hoffmann 

take care,
  Gerd