aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2020-09-03 07:09:31 +0200
committerHelge Deller <deller@gmx.de>2020-09-03 17:30:04 +0200
commit95aad497d9f1cc96b6913e61c95fca116af69b93 (patch)
tree3727287d7a887e4b1b70de4fd12f7731d3e01bfd
parent3b65b742543bc6c2ad35e3b42401a26b48a87f26 (diff)
hw/display/artist: Verify artist screen resolution
Artist hardware is limited to 2048 x 2048 pixels. STI ROMs allow at minimum 640 x 480 pixels. Qemu users can adjust the screen size on the command line with: -global artist.width=800 -global artist.height=600 but we need to ensure that the screen size stays inside the given boundaries, otherwise print an error message and adjust. Signed-off-by: Helge Deller <deller@gmx.de> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--hw/display/artist.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/hw/display/artist.c b/hw/display/artist.c
index 71982559c6..ff1532fdc1 100644
--- a/hw/display/artist.c
+++ b/hw/display/artist.c
@@ -1374,6 +1374,18 @@ static void artist_realizefn(DeviceState *dev, Error **errp)
struct vram_buffer *buf;
hwaddr offset = 0;
+ if (s->width > 2048 || s->height > 2048) {
+ error_report("artist: screen size can not exceed 2048 x 2048 pixel.");
+ s->width = MIN(s->width, 2048);
+ s->height = MIN(s->height, 2048);
+ }
+
+ if (s->width < 640 || s->height < 480) {
+ error_report("artist: minimum screen size is 640 x 480 pixel.");
+ s->width = MAX(s->width, 640);
+ s->height = MAX(s->height, 480);
+ }
+
memory_region_init(&s->mem_as_root, OBJECT(dev), "artist", ~0ull);
address_space_init(&s->as, &s->mem_as_root, "artist");