[PATCH] gtk: Skip drawing if console surface is NULL

2025-07-14 Thread Weifeng Liu
laceholder surface to the console when there is nothing to display. Resolves: Coverity CID 1610328 Signed-off-by: Weifeng Liu --- ui/gtk-egl.c | 5 + ui/gtk-gl-area.c | 5 + 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/ui/gtk-egl.c b/ui/gtk-egl.c index 0b787bea25..

Re: [PULL 14/19] ui/gtk: Update scales in fixed-scale mode when rendering GL area

2025-07-11 Thread Weifeng Liu
Hi, On Fri, 2025-07-11 at 11:01 +0400, Marc-André Lureau wrote: > Hi > > On Thu, Jul 10, 2025 at 4:24 PM Peter Maydell > wrote: > > > > On Sat, 24 May 2025 at 18:37, wrote: > > > > > > From: Weifeng Liu > > > > > > When gl=on, sc

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 properl

[PATCH 0/2] ui/gtk: Add keep-aspect-ratio and scale option

2025-05-31 Thread Weifeng Liu
y Osipenko Best regards, Weifeng Weifeng Liu (2): ui/gtk: Add keep-aspect-ratio option ui/gtk: Add scale option include/ui/gtk.h | 2 ++ qapi/ui.json | 15 + ui/gtk.c | 58 3 files changed, 52 insertions(+), 23

[PATCH 2/2] ui/gtk: Add scale option

2025-05-31 Thread Weifeng Liu
n set a 0.5 scale for the virtual display to avoid magnification that might cause blurriness. Signed-off-by: Weifeng Liu --- include/ui/gtk.h | 1 + qapi/ui.json | 5 - ui/gtk.c | 46 +- 3 files changed, 34 insertions(+), 18 dele

[PATCH 1/2] ui/gtk: Add keep-aspect-ratio option

2025-05-31 Thread Weifeng Liu
. Suggested-by: BALATON Zoltan Suggested-by: Kim, Dongwon Signed-off-by: Weifeng Liu --- include/ui/gtk.h | 1 + qapi/ui.json | 12 ui/gtk.c | 12 ++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/ui/gtk.h b/include/ui/gtk.h index d3944046db

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 implement

Re: [PATCH 1/9] ui/gtk: Document scale and coordinate handling

2025-05-14 Thread Weifeng Liu
On Wed, 2025-05-14 at 13:50 +0200, BALATON Zoltan wrote: > On Wed, 14 May 2025, Weifeng Liu wrote: > > Hi Gerd, > > On Mon, 2025-05-12 at 13:46 +0200, Gerd Hoffmann wrote: > > > On Sun, May 11, 2025 at 03:33:11PM +0800, Weifeng Liu wrote: > > > > The existence o

Re: [PATCH 1/9] ui/gtk: Document scale and coordinate handling

2025-05-13 Thread Weifeng Liu
Hi Gerd, On Mon, 2025-05-12 at 13:46 +0200, Gerd Hoffmann wrote: > On Sun, May 11, 2025 at 03:33:11PM +0800, Weifeng Liu wrote: > > The existence of multiple scaling factors forces us to deal with > > various > > coordinate systems and this would be confusing. It would be

Re: [PATCH 3/9] gtk/ui: Introduce helper gd_update_scale

2025-05-13 Thread Weifeng Liu
t; > The code snippet updating scale_x/scale_y is general and will be > > > > used in next > > > > patch. Make it a function. > > > > > > > > Signed-off-by: Weifeng Liu > > > > --- > > > >  include/ui/gtk.h | 2 ++ > >

Re: [PATCH 8/9] ui/gtk-gl-area: Render guest content with padding in fixed-scale mode

2025-05-13 Thread Weifeng Liu
Hi, On Tue, 2025-05-13 at 11:52 +0200, BALATON Zoltan wrote: > On Tue, 13 May 2025, Weifeng Liu wrote: > > Hi, > > > > On Tue, 2025-05-13 at 00:37 +, Kim, Dongwon wrote: > > > Hi, > > > > > > > Subject: [PATCH 8/9] ui/gtk-gl-area: Render

Re: [PATCH 8/9] ui/gtk-gl-area: Render guest content with padding in fixed-scale mode

2025-05-12 Thread Weifeng Liu
he scale. However, in OpenGL mode > > (gl=on), guest surface is always painted to the whole canvas > > without any > > padding. This change tries to fix this bug by adding appropriate > > padding > > when drawing surfaces. > > > > Signed-off-by: Weifeng Liu &

Re: [PATCH 3/9] gtk/ui: Introduce helper gd_update_scale

2025-05-12 Thread Weifeng Liu
Hi Dongwon, On Tue, 2025-05-13 at 01:26 +, Kim, Dongwon wrote: > Hi, > > > Subject: [PATCH 3/9] gtk/ui: Introduce helper gd_update_scale > > > > The code snippet updating scale_x/scale_y is general and will be > > used in next > > patch. Make it a funct

[PATCH 1/9] ui/gtk: Document scale and coordinate handling

2025-05-11 Thread Weifeng Liu
The existence of multiple scaling factors forces us to deal with various coordinate systems and this would be confusing. It would be beneficial to define the concepts clearly and use consistent representation for variables in different coordinates. Signed-off-by: Weifeng Liu --- ui/gtk.c | 65

[PATCH 2/9] ui/gtk: Use consistent naming for variables in different coordinates

2025-05-11 Thread Weifeng Liu
Now that we've documented definitions and presentation of various coordinates, let's enforce the rules. Signed-off-by: Weifeng Liu --- ui/gtk-egl.c | 12 +++-- ui/gtk-gl-area.c | 14 ++--- ui/gtk.c | 133 --- 3 files c

[PATCH 3/9] gtk/ui: Introduce helper gd_update_scale

2025-05-11 Thread Weifeng Liu
The code snippet updating scale_x/scale_y is general and will be used in next patch. Make it a function. Signed-off-by: Weifeng Liu --- include/ui/gtk.h | 2 ++ ui/gtk.c | 30 +++--- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/include/ui

[PATCH 8/9] ui/gtk-gl-area: Render guest content with padding in fixed-scale mode

2025-05-11 Thread Weifeng Liu
. This change tries to fix this bug by adding appropriate padding when drawing surfaces. Signed-off-by: Weifeng Liu --- ui/gtk-gl-area.c | 33 - 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index db93cd6204

[PATCH 5/9] ui/sdl: Consider scaling in mouse event handling

2025-05-11 Thread Weifeng Liu
From: Weifeng Liu When using sdl display backend, if the window is scaled, incorrect mouse positions will be reported since scaling is not properly handled. Fix it by transforming the positions from window coordinate to guest buffer coordinate. Signed-off-by: Weifeng Liu --- ui/sdl2.c | 20

[PATCH 9/9] ui/gtk-egl: Render guest content with padding in fixed-scale mode

2025-05-11 Thread Weifeng Liu
Scaling was not respected when rendering frames in gtk-egl.c (used if gl=on and X11 mode). To fix this, add fields x and y to struct egl_fb for x offset and y offset so we can add padding to window. Signed-off-by: Weifeng Liu --- include/ui/egl-helpers.h | 4 +++- ui/egl-helpers.c | 10

[PATCH 4/9] ui/gtk: Update scales in fixed-scale mode when rendering GL area

2025-05-11 Thread Weifeng Liu
igned-off-by: Weifeng Liu --- ui/gtk-gl-area.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index ba9fbec432..db93cd6204 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -43,6 +43,8 @@ void gd_gl_area_draw(VirtualConsol

[PATCH 6/9] ui/gtk: Don't update scale in fixed scale mode in gtk-egl.c

2025-05-11 Thread Weifeng Liu
Scale shouldn't be changed until user explicitly requests it in fixed scale mode (full-screen=false and free-scale=false). Use function gd_update_scale to complete scale updating instead. Signed-off-by: Weifeng Liu --- ui/gtk-egl.c | 10 ++ 1 file changed, 6 insertions(+), 4 dele

[PATCH 0/9] ui: Improve scale handling

2025-05-11 Thread Weifeng Liu
fixed scale mode, full screen mode) - qemu-kvm -display sdl,gl=off - qemu-kvm -display sdl,gl=on Cc: Marc-André Lureau Cc: Gerd Hoffmann Cc: Dmitry Osipenko Cc: Alex Bennée Cc: Vivek Kasireddy Cc: Dongwon Kim Best regards, Weifeng Weifeng Liu (9): ui/gtk: Document scale and coordinate han

[PATCH 7/9] ui/gtk: Consider scaling when propagating ui info

2025-05-11 Thread Weifeng Liu
. 3. When the new guest scan-out command arrives, QEMU would request the window size to change to fit the new buffer size. This will trigger a resize event or a configure event, making us go back to step 1. Signed-off-by: Weifeng Liu --- ui/gtk.c | 25 +++-- 1 file

Re: [PATCH] ui/gtk: Properly apply x/y scale when rendering GL area

2025-05-10 Thread Weifeng Liu
+0400, Marc-André Lureau wrote: > Hi > > On Sat, Apr 19, 2025 at 1:51 PM Weifeng Liu wrote: > > > > On startup, scale_x and scale_y were set to 1 that didn't reflect the > > real situation of the scan-out, resulting in incorrect cursor > > coordinates to

Re: [PATCH] ui/gtk: Properly apply x/y scale when rendering GL area

2025-05-10 Thread Weifeng Liu
+0400, Marc-André Lureau wrote: > Hi > > On Sat, Apr 19, 2025 at 1:51 PM Weifeng Liu wrote: > > > > On startup, scale_x and scale_y were set to 1 that didn't reflect the > > real situation of the scan-out, resulting in incorrect cursor > > coordinates to

[PATCH] ui/gtk: Properly apply x/y scale when rendering GL area

2025-04-19 Thread Weifeng Liu
owski Cc: Gerd Hoffmann Signed-off-by: Weifeng Liu --- ui/gtk-gl-area.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c index 2c9a0db425..01235f876a 100644 --- a/ui/gtk-gl-area.c +++ b/ui/gtk-gl-area.c @@ -42,6 +42,7 @@ void gd_gl_area_draw(VirtualCo

Re: [PATCH 0/3] virtio-gpu: Enable virglrenderer backend for rutabaga

2024-06-06 Thread Weifeng Liu
Hi Alex, On Thu, 2024-06-06 at 11:43 +0100, Alex Bennée wrote: > Weifeng Liu writes: > > > Greetings, > > > > I'd like to introduce you my attempt to enable virglrenderer backend for > > rutabaga empowered virtio-gpu device. I am aware that there have bee

[PATCH 0/3] virtio-gpu: Enable virglrenderer backend for rutabaga

2024-06-05 Thread Weifeng Liu
-4694-bfb6-e72db9571...@daynix.com/T/ [2] https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5599645/1 [3] https://lore.kernel.org/kvm/20240229025759.1187910-1-steve...@google.com/ Weifeng Liu (3): virtio-gpu: rutabaga: Properly set stride when copying resources virtio-gpu: rutabaga:

[PATCH 1/3] virtio-gpu: rutabaga: Properly set stride when copying resources

2024-06-05 Thread Weifeng Liu
The stride is not correctly assigned when copying pixel data, causing images being displayed incomplete when using 2d component of rutabaga. Signed-off-by: Weifeng Liu --- hw/display/virtio-gpu-rutabaga.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/display/virtio-gpu-rutabaga.c b

[PATCH 3/3] virtio-gpu: rutabaga: Add options to enable virgl and venus contexts

2024-06-05 Thread Weifeng Liu
With this change, people will be able to use parameter like the one below to add start virglrenderer backed virtio-gpu-rutabaga device: -device virtio-vga-rutabaga,venus=on,virgl2=on,wsi=surfaceless Performance being suboptimal though, this would be the first step. Signed-off-by: Weifeng

[PATCH 2/3] virtio-gpu: rutabaga: Poll rutabaga upon events

2024-06-05 Thread Weifeng Liu
To make virglrenderer work properly, we must poll it periodically or when the event fd is readable, but this functionality is absent now. This change registers the event fd as a gsource to the main loop and attaches polling function as callback to the gsource. Signed-off-by: Weifeng Liu --- hw