qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ui/console: Fix console resize with placeholder surface
@ 2024-02-07 17:20 Tianlan Zhou
  2024-02-07 21:07 ` Michael Tokarev
  2024-02-08 10:20 ` Marc-André Lureau
  0 siblings, 2 replies; 3+ messages in thread
From: Tianlan Zhou @ 2024-02-07 17:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Marc-André Lureau, Tianlan Zhou

In `qemu_console_resize()`, the old surface of the console is keeped if the new
console size is the same as the old one. If the old surface is a placeholder,
and the new size of console is the same as the placeholder surface (640*480),
the surface won't be replace.
In this situation, the surface's `QEMU_PLACEHOLDER_FLAG` flag is still set, so
the console won't be displayed in SDL display mode.
This patch fixes this problem by forcing a new surface if the old one is a
placeholder.

Signed-off-by: Tianlan Zhou <bobby825@126.com>
---
 ui/console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/console.c b/ui/console.c
index 7db921e3b7..832055675c 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1577,7 +1577,7 @@ void qemu_console_resize(QemuConsole *s, int width, int height)
     assert(QEMU_IS_GRAPHIC_CONSOLE(s));
 
     if ((s->scanout.kind != SCANOUT_SURFACE ||
-         (surface && surface->flags & QEMU_ALLOCATED_FLAG)) &&
+         (surface && !is_buffer_shared(surface) && !is_placeholder(surface))) &&
         qemu_console_get_width(s, -1) == width &&
         qemu_console_get_height(s, -1) == height) {
         return;
-- 
2.38.1.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ui/console: Fix console resize with placeholder surface
  2024-02-07 17:20 [PATCH] ui/console: Fix console resize with placeholder surface Tianlan Zhou
@ 2024-02-07 21:07 ` Michael Tokarev
  2024-02-08 10:20 ` Marc-André Lureau
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2024-02-07 21:07 UTC (permalink / raw)
  To: Tianlan Zhou, qemu-devel
  Cc: Gerd Hoffmann, Marc-André Lureau, qemu-stable

07.02.2024 20:20, Tianlan Zhou :
> In `qemu_console_resize()`, the old surface of the console is keeped if the new
> console size is the same as the old one. If the old surface is a placeholder,
> and the new size of console is the same as the placeholder surface (640*480),
> the surface won't be replace.
> In this situation, the surface's `QEMU_PLACEHOLDER_FLAG` flag is still set, so
> the console won't be displayed in SDL display mode.
> This patch fixes this problem by forcing a new surface if the old one is a
> placeholder.

Cc qemu-stable

/mjt


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ui/console: Fix console resize with placeholder surface
  2024-02-07 17:20 [PATCH] ui/console: Fix console resize with placeholder surface Tianlan Zhou
  2024-02-07 21:07 ` Michael Tokarev
@ 2024-02-08 10:20 ` Marc-André Lureau
  1 sibling, 0 replies; 3+ messages in thread
From: Marc-André Lureau @ 2024-02-08 10:20 UTC (permalink / raw)
  To: Tianlan Zhou; +Cc: qemu-devel, Gerd Hoffmann

Hi

On Wed, Feb 7, 2024 at 10:38 PM Tianlan Zhou <bobby825@126.com> wrote:
>
> In `qemu_console_resize()`, the old surface of the console is keeped if the new
> console size is the same as the old one. If the old surface is a placeholder,
> and the new size of console is the same as the placeholder surface (640*480),
> the surface won't be replace.
> In this situation, the surface's `QEMU_PLACEHOLDER_FLAG` flag is still set, so
> the console won't be displayed in SDL display mode.
> This patch fixes this problem by forcing a new surface if the old one is a
> placeholder.
>
> Signed-off-by: Tianlan Zhou <bobby825@126.com>
> ---
>  ui/console.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ui/console.c b/ui/console.c
> index 7db921e3b7..832055675c 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -1577,7 +1577,7 @@ void qemu_console_resize(QemuConsole *s, int width, int height)
>      assert(QEMU_IS_GRAPHIC_CONSOLE(s));
>
>      if ((s->scanout.kind != SCANOUT_SURFACE ||
> -         (surface && surface->flags & QEMU_ALLOCATED_FLAG)) &&
> +         (surface && !is_buffer_shared(surface) && !is_placeholder(surface))) &&
>          qemu_console_get_width(s, -1) == width &&
>          qemu_console_get_height(s, -1) == height) {
>          return;
> --
> 2.38.1.windows.1
>
>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

-- 
Marc-André Lureau


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-02-08 10:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-07 17:20 [PATCH] ui/console: Fix console resize with placeholder surface Tianlan Zhou
2024-02-07 21:07 ` Michael Tokarev
2024-02-08 10:20 ` Marc-André Lureau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).