virtio-gpu: do not replace surface when scanout is disabled
PATCH 1/1 virtio-gpu: do not replace surface when scanout is disabled
Surface is replaced with a place holder whenever the surface res is unreferenced by the guest message. With this logic, there is very frequent switching between guest display and the place holder image, which is looking like a flickering display if the guest driver is designed to unref the current scanout resource before sending out a new scanout resource. So it is better to leave the current scanout image until there is a new one flushed by the guest.
--- hw/display/virtio-gpu.c | 1 - 1 file changed, 1 deletion(-)
hw/display/virtio-gpu.c +0 -1
@@ -387,7 +387,6 @@ static void virtio_gpu_disable_scanout(VirtIOGPU *g, int scanout_id) res->scanout_bitmask &= ~(1 << scanout_id); } -dpy_gfx_replace_surface (scanout->con,NULL ); scanout->resource_id =0 ; scanout->ds =NULL ; scanout->width =0 ;
Signature · 1 line
2.34.1
Hi
Quoted 8 lines · Dongwon Kim
Surface is replaced with a place holder whenever the surface res is unreferenced by the guest message. With this logic, there is very frequent switching between guest display and the place holder image, which is looking like a flickering display if the guest driver is designed to unref the current scanout resource before sending out a new scanout resource. So it is better to leave the current scanout image until there is a new one flushed by the guest.
Quoted 5 lines
Cc Gerd Hoffmann <[email protected]>Cc Marc-André Lureau <[email protected]>Cc Vivek Kasireddy <[email protected]>Signed-off-by Dongwon Kim <[email protected]>
Why is the driver not setting a different scanout before destroying the resource?
I think it's wrong to not replace the surface, as the associated scanout resource may be destroyed or explicitly disabled for various purposes, and we don't want to display garbage either.
---
Quoted 21 lines
hw/display/virtio-gpu.c | 1 - 1 file changed, 1 deletion(-)hw/display/virtio-gpu.c +0
-1@@ -387,7 +387,6 @@ static void virtio_gpu_disable_scanout(VirtIOGPU *g, int scanout_id) res->scanout_bitmask &= ~(1 << scanout_id); } -dpy_gfx_replace_surface (scanout->con,NULL ); scanout->resource_id =0 ; scanout->ds =NULL ;scanout->width = 0;--
2.34.1
Signature · 1 line
Marc-André Lureau
Quoted 18 lines · Marc-André Lureau
Hi
On Wed, Jun 28, 2023 at 12:32 AM Dongwon Kim <[email protected]> wrote:
Surface is replaced with a place holder whenever the surface res is unreferenced by the guest message. With this logic, there is very frequent switching between guest display and the place holder image, which is looking like a flickering display if the guest driver is designed to unref the current scanout resource before sending out a new scanout resource. So it is better to leave the current scanout image until there is a new one flushed by the guest.
Cc Gerd Hoffmann <[email protected]>Cc Marc-André Lureau <[email protected]>Cc Vivek Kasireddy <[email protected]>Signed-off-by Dongwon Kim <[email protected]>
Quoted 3 lines
Why is the driver not setting a different scanout before destroying the resource?
I think it's wrong to not replace the surface, as the associated scanout resource may be destroyed or explicitly disabled for various purposes, and we don't want to display garbage either.
Yeah..I got your point. This is to address very specific to our use-case with windows guest that runs virtio-gpu like driver that does unref before the next framebuffer is set. And I agree that this sequence doesn't look right. Let me check if we could change the sequence in the guest driver.
Quoted 26 lines
--- hw/display/virtio-gpu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c index 66cddd94d9..9d3e922c8f 100644 --- a/hw/display/virtio-gpu.c +++ b/hw/display/virtio-gpu.c @@ -387,7 +387,6 @@ static void virtio_gpu_disable_scanout(VirtIOGPU *g, int scanout_id) res->scanout_bitmask &= ~(1 << scanout_id); } - dpy_gfx_replace_surface(scanout->con, NULL); scanout->resource_id = 0; scanout->ds = NULL; scanout->width = 0; -- 2.34.1Signature · 1 line
Marc-André Lureau