aboutsummaryrefslogtreecommitdiff
path: root/qemu-edid.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2020-09-27 18:57:47 +0400
committerGerd Hoffmann <kraxel@redhat.com>2020-09-29 10:08:25 +0200
commitfd36eade0187a4efe0507b41fae22277300d1c7a (patch)
tree02357862c1df0ef7e58f11ace0789600ae680103 /qemu-edid.c
parent6c8f847ac1356387692f224b48c7a83ac5918b5d (diff)
edid: use physical dimensions if available
Replace dpi with width_mm/height_mm in qemu_edid_info. Use it when set (non-zero) to compute the DPI and generate the EDID. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-id: 20200927145751.365446-3-marcandre.lureau@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'qemu-edid.c')
-rw-r--r--qemu-edid.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/qemu-edid.c b/qemu-edid.c
index 46eef70498..1db3372b98 100644
--- a/qemu-edid.c
+++ b/qemu-edid.c
@@ -9,7 +9,10 @@
#include "qemu/cutils.h"
#include "hw/display/edid.h"
-static qemu_edid_info info;
+static qemu_edid_info info = (qemu_edid_info) {
+ .prefx = 1024,
+ .prefy = 768,
+};
static void usage(FILE *out)
{
@@ -39,6 +42,7 @@ int main(int argc, char *argv[])
{
FILE *outfile = NULL;
uint8_t blob[256];
+ uint32_t dpi = 100;
int rc;
for (;;) {
@@ -83,7 +87,7 @@ int main(int argc, char *argv[])
}
break;
case 'd':
- if (qemu_strtoui(optarg, NULL, 10, &info.dpi) < 0) {
+ if (qemu_strtoui(optarg, NULL, 10, &dpi) < 0) {
fprintf(stderr, "not a number: %s\n", optarg);
exit(1);
}
@@ -110,6 +114,9 @@ int main(int argc, char *argv[])
outfile = stdout;
}
+ info.width_mm = qemu_edid_dpi_to_mm(dpi, info.prefx);
+ info.height_mm = qemu_edid_dpi_to_mm(dpi, info.prefy);
+
memset(blob, 0, sizeof(blob));
qemu_edid_generate(blob, sizeof(blob), &info);
fwrite(blob, sizeof(blob), 1, outfile);