Skip to content

Commit

Permalink
qmp/hmp: disable screendump if PIXMAN is missing
Browse files Browse the repository at this point in the history
The command requires color conversion and line-by-line feeding. We could
have a simple fallback for simple formats though.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
  • Loading branch information
elmarco committed Nov 7, 2023
1 parent 600179c commit f38aa2c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions hmp-commands.hx
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ SRST

ERST

#ifdef CONFIG_PIXMAN
{
.name = "screendump",
.args_type = "filename:F,format:-fs,device:s?,head:i?",
Expand All @@ -267,6 +268,7 @@ SRST
``screendump`` *filename*
Save screen into PPM image *filename*.
ERST
#endif

{
.name = "logfile",
Expand Down
3 changes: 2 additions & 1 deletion qapi/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@
{ 'command': 'screendump',
'data': {'filename': 'str', '*device': 'str', '*head': 'int',
'*format': 'ImageFormat'},
'coroutine': true }
'coroutine': true,
'if': 'CONFIG_PIXMAN' }

##
# == Spice
Expand Down
2 changes: 2 additions & 0 deletions ui/ui-hmp-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ void sendkey_completion(ReadLineState *rs, int nb_args, const char *str)
}
}

#ifdef CONFIG_PIXMAN
void coroutine_fn
hmp_screendump(Monitor *mon, const QDict *qdict)
{
Expand All @@ -458,6 +459,7 @@ hmp_screendump(Monitor *mon, const QDict *qdict)
end:
hmp_handle_error(mon, err);
}
#endif

void hmp_client_migrate_info(Monitor *mon, const QDict *qdict)
{
Expand Down
2 changes: 2 additions & 0 deletions ui/ui-qmp-cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ void qmp_client_migrate_info(const char *protocol, const char *hostname,
error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "protocol", "'spice'");
}

#ifdef CONFIG_PIXMAN
#ifdef CONFIG_PNG
/**
* png_save: Take a screenshot as PNG
Expand Down Expand Up @@ -391,3 +392,4 @@ qmp_screendump(const char *filename, const char *device,
}
}
}
#endif /* CONFIG_PIXMAN */

0 comments on commit f38aa2c

Please sign in to comment.