diff mbox series

[PATCH-for-9.1,3/3] ui/console: Add 'rotate_arcdegree' field to allow per-console rotation

Message ID 20240318100543.78846-4-philmd@linaro.org
State New
Headers show
Series ui/display: Introduce API to change console orientation | expand

Commit Message

Philippe Mathieu-Daudé March 18, 2024, 10:05 a.m. UTC
Add the 'rotate_arcdegree' field to QemuConsole and remove
the use of the 'graphic_rotate' global.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 ui/console-priv.h | 1 +
 ui/console.c      | 7 +++----
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Akihiko Odaki March 18, 2024, 10:36 a.m. UTC | #1
On 2024/03/18 19:05, Philippe Mathieu-Daudé wrote:
> Add the 'rotate_arcdegree' field to QemuConsole and remove
> the use of the 'graphic_rotate' global.

I think QemuGraphicConsole is a better place to put the field.

Regards,
Akihiko Odaki

> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   ui/console-priv.h | 1 +
>   ui/console.c      | 7 +++----
>   2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/ui/console-priv.h b/ui/console-priv.h
> index 88569ed2cc..6e54b476d9 100644
> --- a/ui/console-priv.h
> +++ b/ui/console-priv.h
> @@ -31,6 +31,7 @@ struct QemuConsole {
>       const GraphicHwOps *hw_ops;
>       void *hw;
>       CoQueue dump_queue;
> +    unsigned rotate_arcdegree;
>   
>       QTAILQ_ENTRY(QemuConsole) next;
>   };
> diff --git a/ui/console.c b/ui/console.c
> index 84aee76846..a36674bacf 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -37,7 +37,6 @@
>   #include "trace.h"
>   #include "exec/memory.h"
>   #include "qom/object.h"
> -#include "sysemu/sysemu.h"
>   
>   #include "console-priv.h"
>   
> @@ -210,17 +209,17 @@ void qemu_console_set_window_id(QemuConsole *con, int window_id)
>   
>   void qemu_console_set_rotate(QemuConsole *con, unsigned arcdegree)
>   {
> -    graphic_rotate = arcdegree;
> +    con->rotate_arcdegree = arcdegree;
>   }
>   
>   bool qemu_console_is_rotated(QemuConsole *con)
>   {
> -    return graphic_rotate != 0;
> +    return con->rotate_arcdegree != 0;
>   }
>   
>   unsigned qemu_console_get_rotate_arcdegree(QemuConsole *con)
>   {
> -    return graphic_rotate;
> +    return con->rotate_arcdegree;
>   }
>   
>   void graphic_hw_invalidate(QemuConsole *con)
Philippe Mathieu-Daudé March 18, 2024, 11:31 a.m. UTC | #2
On 18/3/24 11:36, Akihiko Odaki wrote:
> On 2024/03/18 19:05, Philippe Mathieu-Daudé wrote:
>> Add the 'rotate_arcdegree' field to QemuConsole and remove
>> the use of the 'graphic_rotate' global.
> 
> I think QemuGraphicConsole is a better place to put the field.

Good point.

> 
> Regards,
> Akihiko Odaki
diff mbox series

Patch

diff --git a/ui/console-priv.h b/ui/console-priv.h
index 88569ed2cc..6e54b476d9 100644
--- a/ui/console-priv.h
+++ b/ui/console-priv.h
@@ -31,6 +31,7 @@  struct QemuConsole {
     const GraphicHwOps *hw_ops;
     void *hw;
     CoQueue dump_queue;
+    unsigned rotate_arcdegree;
 
     QTAILQ_ENTRY(QemuConsole) next;
 };
diff --git a/ui/console.c b/ui/console.c
index 84aee76846..a36674bacf 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -37,7 +37,6 @@ 
 #include "trace.h"
 #include "exec/memory.h"
 #include "qom/object.h"
-#include "sysemu/sysemu.h"
 
 #include "console-priv.h"
 
@@ -210,17 +209,17 @@  void qemu_console_set_window_id(QemuConsole *con, int window_id)
 
 void qemu_console_set_rotate(QemuConsole *con, unsigned arcdegree)
 {
-    graphic_rotate = arcdegree;
+    con->rotate_arcdegree = arcdegree;
 }
 
 bool qemu_console_is_rotated(QemuConsole *con)
 {
-    return graphic_rotate != 0;
+    return con->rotate_arcdegree != 0;
 }
 
 unsigned qemu_console_get_rotate_arcdegree(QemuConsole *con)
 {
-    return graphic_rotate;
+    return con->rotate_arcdegree;
 }
 
 void graphic_hw_invalidate(QemuConsole *con)