Added parameter to take screenshot with screendump as PNG

Currently screendump only supports PPM format, which is un-compressed. Added
a "format" parameter to QMP and HMP screendump command to support PNG image
capture using libpng.

QMP example usage:
{ "execute": "screendump", "arguments": { "filename": "/tmp/image",
"format":"png" } }

HMP example usage:
screendump /tmp/image -f png

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/718

Signed-off-by: Kshitij Suri <kshitij.suri@nutanix.com>

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20220408071336.99839-3-kshitij.suri@nutanix.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Kshitij Suri 2022-04-08 07:13:35 +00:00 committed by Gerd Hoffmann
parent 95f8510ef4
commit 9a0a119a38
4 changed files with 136 additions and 12 deletions

View file

@ -244,11 +244,12 @@ ERST
{
.name = "screendump",
.args_type = "filename:F,device:s?,head:i?",
.params = "filename [device [head]]",
.help = "save screen from head 'head' of display device 'device' "
"into PPM image 'filename'",
.cmd = hmp_screendump,
.args_type = "filename:F,format:-fs,device:s?,head:i?",
.params = "filename [-f format] [device [head]]",
.help = "save screen from head 'head' of display device 'device'"
"in specified format 'format' as image 'filename'."
"Currently only 'png' and 'ppm' formats are supported.",
.cmd = hmp_screendump,
.coroutine = true,
},