* [PATCH-for-9.1 v2 0/3] ui/display: Introduce API to change console orientation
@ 2024-03-18 11:31 Philippe Mathieu-Daudé
2024-03-18 11:31 ` [PATCH-for-9.1 v2 1/3] ui/console: " Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-03-18 11:31 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Akihiko Odaki, qemu-arm, Marc-André Lureau,
Gerd Hoffmann, Peter Maydell, Philippe Mathieu-Daudé
Since v1:
- Move rotate_arcdegree to QemuGraphicConsole (Akihiko)
Hi,
The idea behind this series is to reduce the use of the
'graphic_rotate' global. It is only used by the Spitz
machine, so we could convert the '-rotate' argument to
a sugar property on the PXA2XX_LCD_TYPE model, but since
the Spitz machine has been deprecated recently (commit
a2531bb855 "Deprecate various old Arm machine types") it
doesn't seem worthwhile. So just extract the API to change
console orientation.
Regards,
Phil.
Philippe Mathieu-Daudé (3):
ui/console: Introduce API to change console orientation
hw/display/pxa2xx_lcd: Set rotation angle using
qemu_console_set_rotate
ui/console: Add 'rotate_arcdegree' field to allow per-console rotation
include/ui/console.h | 3 +++
hw/display/pxa2xx_lcd.c | 1 +
ui/console.c | 23 +++++++++++++++++++++++
ui/input.c | 9 ++++-----
4 files changed, 31 insertions(+), 5 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH-for-9.1 v2 1/3] ui/console: Introduce API to change console orientation
2024-03-18 11:31 [PATCH-for-9.1 v2 0/3] ui/display: Introduce API to change console orientation Philippe Mathieu-Daudé
@ 2024-03-18 11:31 ` Philippe Mathieu-Daudé
2024-03-19 2:54 ` Akihiko Odaki
2024-03-18 11:31 ` [PATCH-for-9.1 v2 2/3] hw/display/pxa2xx_lcd: Set rotation angle using qemu_console_set_rotate Philippe Mathieu-Daudé
2024-03-18 11:31 ` [PATCH-for-9.1 v2 3/3] ui/console: Add 'rotate_arcdegree' field to allow per-console rotation Philippe Mathieu-Daudé
2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-03-18 11:31 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Akihiko Odaki, qemu-arm, Marc-André Lureau,
Gerd Hoffmann, Peter Maydell, Philippe Mathieu-Daudé
Extract the following methods:
- qemu_console_set_rotate()
- qemu_console_is_rotated()
- qemu_console_get_rotate_arcdegree()
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/ui/console.h | 3 +++
ui/console.c | 16 ++++++++++++++++
ui/input.c | 9 ++++-----
3 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index a4a49ffc64..86ba36e391 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -422,15 +422,18 @@ bool qemu_console_is_visible(QemuConsole *con);
bool qemu_console_is_graphic(QemuConsole *con);
bool qemu_console_is_fixedsize(QemuConsole *con);
bool qemu_console_is_gl_blocked(QemuConsole *con);
+bool qemu_console_is_rotated(QemuConsole *con);
char *qemu_console_get_label(QemuConsole *con);
int qemu_console_get_index(QemuConsole *con);
uint32_t qemu_console_get_head(QemuConsole *con);
int qemu_console_get_width(QemuConsole *con, int fallback);
int qemu_console_get_height(QemuConsole *con, int fallback);
+unsigned qemu_console_get_rotate_arcdegree(QemuConsole *con);
/* Return the low-level window id for the console */
int qemu_console_get_window_id(QemuConsole *con);
/* Set the low-level window id for the console */
void qemu_console_set_window_id(QemuConsole *con, int window_id);
+void qemu_console_set_rotate(QemuConsole *con, unsigned arcdegree);
void console_select(unsigned int index);
void qemu_console_resize(QemuConsole *con, int width, int height);
diff --git a/ui/console.c b/ui/console.c
index 832055675c..84aee76846 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -37,6 +37,7 @@
#include "trace.h"
#include "exec/memory.h"
#include "qom/object.h"
+#include "sysemu/sysemu.h"
#include "console-priv.h"
@@ -207,6 +208,21 @@ void qemu_console_set_window_id(QemuConsole *con, int window_id)
con->window_id = window_id;
}
+void qemu_console_set_rotate(QemuConsole *con, unsigned arcdegree)
+{
+ graphic_rotate = arcdegree;
+}
+
+bool qemu_console_is_rotated(QemuConsole *con)
+{
+ return graphic_rotate != 0;
+}
+
+unsigned qemu_console_get_rotate_arcdegree(QemuConsole *con)
+{
+ return graphic_rotate;
+}
+
void graphic_hw_invalidate(QemuConsole *con)
{
if (!con) {
diff --git a/ui/input.c b/ui/input.c
index dc745860f4..951806bf05 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -1,5 +1,4 @@
#include "qemu/osdep.h"
-#include "sysemu/sysemu.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-ui.h"
#include "trace.h"
@@ -179,10 +178,10 @@ static int qemu_input_transform_invert_abs_value(int value)
return (int64_t)INPUT_EVENT_ABS_MAX - value + INPUT_EVENT_ABS_MIN;
}
-static void qemu_input_transform_abs_rotate(InputEvent *evt)
+static void qemu_input_transform_abs_rotate(QemuConsole *src, InputEvent *evt)
{
InputMoveEvent *move = evt->u.abs.data;
- switch (graphic_rotate) {
+ switch (qemu_console_get_rotate_arcdegree(src)) {
case 90:
if (move->axis == INPUT_AXIS_X) {
move->axis = INPUT_AXIS_Y;
@@ -341,8 +340,8 @@ void qemu_input_event_send_impl(QemuConsole *src, InputEvent *evt)
qemu_input_event_trace(src, evt);
/* pre processing */
- if (graphic_rotate && (evt->type == INPUT_EVENT_KIND_ABS)) {
- qemu_input_transform_abs_rotate(evt);
+ if (qemu_console_is_rotated(src) && (evt->type == INPUT_EVENT_KIND_ABS)) {
+ qemu_input_transform_abs_rotate(src, evt);
}
/* send event */
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH-for-9.1 v2 2/3] hw/display/pxa2xx_lcd: Set rotation angle using qemu_console_set_rotate
2024-03-18 11:31 [PATCH-for-9.1 v2 0/3] ui/display: Introduce API to change console orientation Philippe Mathieu-Daudé
2024-03-18 11:31 ` [PATCH-for-9.1 v2 1/3] ui/console: " Philippe Mathieu-Daudé
@ 2024-03-18 11:31 ` Philippe Mathieu-Daudé
2024-03-19 2:54 ` Akihiko Odaki
2024-03-18 11:31 ` [PATCH-for-9.1 v2 3/3] ui/console: Add 'rotate_arcdegree' field to allow per-console rotation Philippe Mathieu-Daudé
2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-03-18 11:31 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Akihiko Odaki, qemu-arm, Marc-André Lureau,
Gerd Hoffmann, Peter Maydell, Philippe Mathieu-Daudé
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/display/pxa2xx_lcd.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/display/pxa2xx_lcd.c b/hw/display/pxa2xx_lcd.c
index a9d0d981a0..7d03fa57d0 100644
--- a/hw/display/pxa2xx_lcd.c
+++ b/hw/display/pxa2xx_lcd.c
@@ -1439,6 +1439,7 @@ PXA2xxLCDState *pxa2xx_lcdc_init(MemoryRegion *sysmem,
memory_region_add_subregion(sysmem, base, &s->iomem);
s->con = graphic_console_init(NULL, 0, &pxa2xx_ops, s);
+ qemu_console_set_rotate(s->con, graphic_rotate);
vmstate_register(NULL, 0, &vmstate_pxa2xx_lcdc, s);
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH-for-9.1 v2 3/3] ui/console: Add 'rotate_arcdegree' field to allow per-console rotation
2024-03-18 11:31 [PATCH-for-9.1 v2 0/3] ui/display: Introduce API to change console orientation Philippe Mathieu-Daudé
2024-03-18 11:31 ` [PATCH-for-9.1 v2 1/3] ui/console: " Philippe Mathieu-Daudé
2024-03-18 11:31 ` [PATCH-for-9.1 v2 2/3] hw/display/pxa2xx_lcd: Set rotation angle using qemu_console_set_rotate Philippe Mathieu-Daudé
@ 2024-03-18 11:31 ` Philippe Mathieu-Daudé
2024-03-19 2:54 ` Akihiko Odaki
2 siblings, 1 reply; 7+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-03-18 11:31 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Akihiko Odaki, qemu-arm, Marc-André Lureau,
Gerd Hoffmann, Peter Maydell, Philippe Mathieu-Daudé
Add the 'rotate_arcdegree' field to QemuGraphicConsole and
remove the use of the 'graphic_rotate' global.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
ui/console.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index 84aee76846..94624c37ae 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"
@@ -51,6 +50,8 @@ typedef struct QemuGraphicConsole {
QEMUCursor *cursor;
int cursor_x, cursor_y, cursor_on;
+
+ unsigned rotate_arcdegree;
} QemuGraphicConsole;
typedef QemuConsoleClass QemuGraphicConsoleClass;
@@ -210,17 +211,23 @@ void qemu_console_set_window_id(QemuConsole *con, int window_id)
void qemu_console_set_rotate(QemuConsole *con, unsigned arcdegree)
{
- graphic_rotate = arcdegree;
+ QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
+
+ gc->rotate_arcdegree = arcdegree;
}
bool qemu_console_is_rotated(QemuConsole *con)
{
- return graphic_rotate != 0;
+ QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
+
+ return gc->rotate_arcdegree != 0;
}
unsigned qemu_console_get_rotate_arcdegree(QemuConsole *con)
{
- return graphic_rotate;
+ QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
+
+ return gc->rotate_arcdegree;
}
void graphic_hw_invalidate(QemuConsole *con)
--
2.41.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH-for-9.1 v2 1/3] ui/console: Introduce API to change console orientation
2024-03-18 11:31 ` [PATCH-for-9.1 v2 1/3] ui/console: " Philippe Mathieu-Daudé
@ 2024-03-19 2:54 ` Akihiko Odaki
0 siblings, 0 replies; 7+ messages in thread
From: Akihiko Odaki @ 2024-03-19 2:54 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, qemu-arm, Marc-André Lureau, Gerd Hoffmann,
Peter Maydell
On 2024/03/18 20:31, Philippe Mathieu-Daudé wrote:
> Extract the following methods:
>
> - qemu_console_set_rotate()
> - qemu_console_is_rotated()
> - qemu_console_get_rotate_arcdegree()
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> include/ui/console.h | 3 +++
> ui/console.c | 16 ++++++++++++++++
> ui/input.c | 9 ++++-----
> 3 files changed, 23 insertions(+), 5 deletions(-)
>
> diff --git a/include/ui/console.h b/include/ui/console.h
> index a4a49ffc64..86ba36e391 100644
> --- a/include/ui/console.h
> +++ b/include/ui/console.h
> @@ -422,15 +422,18 @@ bool qemu_console_is_visible(QemuConsole *con);
> bool qemu_console_is_graphic(QemuConsole *con);
> bool qemu_console_is_fixedsize(QemuConsole *con);
> bool qemu_console_is_gl_blocked(QemuConsole *con);
> +bool qemu_console_is_rotated(QemuConsole *con);
> char *qemu_console_get_label(QemuConsole *con);
> int qemu_console_get_index(QemuConsole *con);
> uint32_t qemu_console_get_head(QemuConsole *con);
> int qemu_console_get_width(QemuConsole *con, int fallback);
> int qemu_console_get_height(QemuConsole *con, int fallback);
> +unsigned qemu_console_get_rotate_arcdegree(QemuConsole *con);
> /* Return the low-level window id for the console */
> int qemu_console_get_window_id(QemuConsole *con);
> /* Set the low-level window id for the console */
> void qemu_console_set_window_id(QemuConsole *con, int window_id);
> +void qemu_console_set_rotate(QemuConsole *con, unsigned arcdegree);
>
> void console_select(unsigned int index);
> void qemu_console_resize(QemuConsole *con, int width, int height);
> diff --git a/ui/console.c b/ui/console.c
> index 832055675c..84aee76846 100644
> --- a/ui/console.c
> +++ b/ui/console.c
> @@ -37,6 +37,7 @@
> #include "trace.h"
> #include "exec/memory.h"
> #include "qom/object.h"
> +#include "sysemu/sysemu.h"
>
> #include "console-priv.h"
>
> @@ -207,6 +208,21 @@ void qemu_console_set_window_id(QemuConsole *con, int window_id)
> con->window_id = window_id;
> }
>
> +void qemu_console_set_rotate(QemuConsole *con, unsigned arcdegree)
> +{
> + graphic_rotate = arcdegree;
> +}
> +
> +bool qemu_console_is_rotated(QemuConsole *con)
> +{
> + return graphic_rotate != 0;
> +}
> +
> +unsigned qemu_console_get_rotate_arcdegree(QemuConsole *con)
> +{
> + return graphic_rotate;
> +}
> +
> void graphic_hw_invalidate(QemuConsole *con)
> {
> if (!con) {
> diff --git a/ui/input.c b/ui/input.c
> index dc745860f4..951806bf05 100644
> --- a/ui/input.c
> +++ b/ui/input.c
> @@ -1,5 +1,4 @@
> #include "qemu/osdep.h"
> -#include "sysemu/sysemu.h"
> #include "qapi/error.h"
> #include "qapi/qapi-commands-ui.h"
> #include "trace.h"
> @@ -179,10 +178,10 @@ static int qemu_input_transform_invert_abs_value(int value)
> return (int64_t)INPUT_EVENT_ABS_MAX - value + INPUT_EVENT_ABS_MIN;
> }
>
> -static void qemu_input_transform_abs_rotate(InputEvent *evt)
> +static void qemu_input_transform_abs_rotate(QemuConsole *src, InputEvent *evt)
> {
> InputMoveEvent *move = evt->u.abs.data;
> - switch (graphic_rotate) {
> + switch (qemu_console_get_rotate_arcdegree(src)) {
> case 90:
> if (move->axis == INPUT_AXIS_X) {
> move->axis = INPUT_AXIS_Y;
> @@ -341,8 +340,8 @@ void qemu_input_event_send_impl(QemuConsole *src, InputEvent *evt)
> qemu_input_event_trace(src, evt);
>
> /* pre processing */
> - if (graphic_rotate && (evt->type == INPUT_EVENT_KIND_ABS)) {
> - qemu_input_transform_abs_rotate(evt);
> + if (qemu_console_is_rotated(src) && (evt->type == INPUT_EVENT_KIND_ABS)) {
> + qemu_input_transform_abs_rotate(src, evt);
> }
>
> /* send event */
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH-for-9.1 v2 2/3] hw/display/pxa2xx_lcd: Set rotation angle using qemu_console_set_rotate
2024-03-18 11:31 ` [PATCH-for-9.1 v2 2/3] hw/display/pxa2xx_lcd: Set rotation angle using qemu_console_set_rotate Philippe Mathieu-Daudé
@ 2024-03-19 2:54 ` Akihiko Odaki
0 siblings, 0 replies; 7+ messages in thread
From: Akihiko Odaki @ 2024-03-19 2:54 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, qemu-arm, Marc-André Lureau, Gerd Hoffmann,
Peter Maydell
On 2024/03/18 20:31, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> hw/display/pxa2xx_lcd.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/hw/display/pxa2xx_lcd.c b/hw/display/pxa2xx_lcd.c
> index a9d0d981a0..7d03fa57d0 100644
> --- a/hw/display/pxa2xx_lcd.c
> +++ b/hw/display/pxa2xx_lcd.c
> @@ -1439,6 +1439,7 @@ PXA2xxLCDState *pxa2xx_lcdc_init(MemoryRegion *sysmem,
> memory_region_add_subregion(sysmem, base, &s->iomem);
>
> s->con = graphic_console_init(NULL, 0, &pxa2xx_ops, s);
> + qemu_console_set_rotate(s->con, graphic_rotate);
>
> vmstate_register(NULL, 0, &vmstate_pxa2xx_lcdc, s);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH-for-9.1 v2 3/3] ui/console: Add 'rotate_arcdegree' field to allow per-console rotation
2024-03-18 11:31 ` [PATCH-for-9.1 v2 3/3] ui/console: Add 'rotate_arcdegree' field to allow per-console rotation Philippe Mathieu-Daudé
@ 2024-03-19 2:54 ` Akihiko Odaki
0 siblings, 0 replies; 7+ messages in thread
From: Akihiko Odaki @ 2024-03-19 2:54 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, qemu-arm, Marc-André Lureau, Gerd Hoffmann,
Peter Maydell
On 2024/03/18 20:31, Philippe Mathieu-Daudé wrote:
> Add the 'rotate_arcdegree' field to QemuGraphicConsole and
> remove the use of the 'graphic_rotate' global.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
> ui/console.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/ui/console.c b/ui/console.c
> index 84aee76846..94624c37ae 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"
>
> @@ -51,6 +50,8 @@ typedef struct QemuGraphicConsole {
>
> QEMUCursor *cursor;
> int cursor_x, cursor_y, cursor_on;
> +
> + unsigned rotate_arcdegree;
> } QemuGraphicConsole;
>
> typedef QemuConsoleClass QemuGraphicConsoleClass;
> @@ -210,17 +211,23 @@ void qemu_console_set_window_id(QemuConsole *con, int window_id)
>
> void qemu_console_set_rotate(QemuConsole *con, unsigned arcdegree)
> {
> - graphic_rotate = arcdegree;
> + QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
> +
> + gc->rotate_arcdegree = arcdegree;
> }
>
> bool qemu_console_is_rotated(QemuConsole *con)
> {
> - return graphic_rotate != 0;
> + QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
> +
> + return gc->rotate_arcdegree != 0;
> }
>
> unsigned qemu_console_get_rotate_arcdegree(QemuConsole *con)
> {
> - return graphic_rotate;
> + QemuGraphicConsole *gc = QEMU_GRAPHIC_CONSOLE(con);
> +
> + return gc->rotate_arcdegree;
> }
>
> void graphic_hw_invalidate(QemuConsole *con)
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-03-19 2:55 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-18 11:31 [PATCH-for-9.1 v2 0/3] ui/display: Introduce API to change console orientation Philippe Mathieu-Daudé
2024-03-18 11:31 ` [PATCH-for-9.1 v2 1/3] ui/console: " Philippe Mathieu-Daudé
2024-03-19 2:54 ` Akihiko Odaki
2024-03-18 11:31 ` [PATCH-for-9.1 v2 2/3] hw/display/pxa2xx_lcd: Set rotation angle using qemu_console_set_rotate Philippe Mathieu-Daudé
2024-03-19 2:54 ` Akihiko Odaki
2024-03-18 11:31 ` [PATCH-for-9.1 v2 3/3] ui/console: Add 'rotate_arcdegree' field to allow per-console rotation Philippe Mathieu-Daudé
2024-03-19 2:54 ` Akihiko Odaki
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).