[PATCH 6/8] hw/sparc: Set graphic display dimensions generically

Philippe Mathieu-Daudé posted 8 patches 1 month, 3 weeks ago
There is a newer version of this series
[PATCH 6/8] hw/sparc: Set graphic display dimensions generically
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
If a dimension is not set, have the machine init code
set the default value.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/sparc/sun4m.c        |  9 +++++++++
 hw/sparc64/sun4u.c      | 10 ++++++++++
 system/globals-target.c |  6 +-----
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 0c0d658d301..a17bdb36927 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -892,6 +892,15 @@ static void sun4m_hw_init(MachineState *machine)
                      hwdef->esp_base, slavio_irq[18],
                      hwdef->le_base, slavio_irq[16], &hostid);
 
+    if (!graphic_width) {
+        graphic_width = 1024;
+    }
+    if (!graphic_height) {
+        graphic_height = 768;
+    }
+    if (!graphic_depth) {
+        graphic_depth = 8;
+    }
     if (graphic_depth != 8 && graphic_depth != 24) {
         error_report("Unsupported depth: %d", graphic_depth);
         exit (1);
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 5d7787fc1a5..b8bda1eb816 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -666,6 +666,16 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
                                 sysbus_mmio_get_region(s, 0));
     nvram = NVRAM(dev);
  
+    if (!graphic_width) {
+        graphic_width = 1024;
+    }
+    if (!graphic_height) {
+        graphic_height = 768;
+    }
+    if (!graphic_depth) {
+        graphic_depth = 8;
+    }
+
     initrd_size = 0;
     initrd_addr = 0;
     kernel_size = sun4u_load_kernel(machine->kernel_filename,
diff --git a/system/globals-target.c b/system/globals-target.c
index e3f7d846ac0..17a27a06218 100644
--- a/system/globals-target.c
+++ b/system/globals-target.c
@@ -9,11 +9,7 @@
 #include "qemu/osdep.h"
 #include "system/system.h"
 
-#ifdef TARGET_SPARC
-int graphic_width = 1024;
-int graphic_height = 768;
-int graphic_depth = 8;
-#elif defined(TARGET_M68K)
+#if defined(TARGET_SPARC) || defined(TARGET_M68K)
 int graphic_width;
 int graphic_height;
 int graphic_depth;
-- 
2.52.0


Re: [PATCH 6/8] hw/sparc: Set graphic display dimensions generically
Posted by Mark Cave-Ayland 1 month, 3 weeks ago
On 14/02/2026 02:12, Philippe Mathieu-Daudé wrote:

> If a dimension is not set, have the machine init code
> set the default value.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/sparc/sun4m.c        |  9 +++++++++
>   hw/sparc64/sun4u.c      | 10 ++++++++++
>   system/globals-target.c |  6 +-----
>   3 files changed, 20 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 0c0d658d301..a17bdb36927 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -892,6 +892,15 @@ static void sun4m_hw_init(MachineState *machine)
>                        hwdef->esp_base, slavio_irq[18],
>                        hwdef->le_base, slavio_irq[16], &hostid);
>   
> +    if (!graphic_width) {
> +        graphic_width = 1024;
> +    }
> +    if (!graphic_height) {
> +        graphic_height = 768;
> +    }
> +    if (!graphic_depth) {
> +        graphic_depth = 8;
> +    }
>       if (graphic_depth != 8 && graphic_depth != 24) {
>           error_report("Unsupported depth: %d", graphic_depth);
>           exit (1);
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index 5d7787fc1a5..b8bda1eb816 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -666,6 +666,16 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
>                                   sysbus_mmio_get_region(s, 0));
>       nvram = NVRAM(dev);
>    
> +    if (!graphic_width) {
> +        graphic_width = 1024;
> +    }
> +    if (!graphic_height) {
> +        graphic_height = 768;
> +    }
> +    if (!graphic_depth) {
> +        graphic_depth = 8;
> +    }
> +
>       initrd_size = 0;
>       initrd_addr = 0;
>       kernel_size = sun4u_load_kernel(machine->kernel_filename,
> diff --git a/system/globals-target.c b/system/globals-target.c
> index e3f7d846ac0..17a27a06218 100644
> --- a/system/globals-target.c
> +++ b/system/globals-target.c
> @@ -9,11 +9,7 @@
>   #include "qemu/osdep.h"
>   #include "system/system.h"
>   
> -#ifdef TARGET_SPARC
> -int graphic_width = 1024;
> -int graphic_height = 768;
> -int graphic_depth = 8;
> -#elif defined(TARGET_M68K)
> +#if defined(TARGET_SPARC) || defined(TARGET_M68K)
>   int graphic_width;
>   int graphic_height;
>   int graphic_depth;

Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>


ATB,

Mark.


Re: [PATCH 6/8] hw/sparc: Set graphic display dimensions generically
Posted by Pierrick Bouvier 1 month, 3 weeks ago
On 2/13/26 6:12 PM, Philippe Mathieu-Daudé wrote:
> If a dimension is not set, have the machine init code
> set the default value.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/sparc/sun4m.c        |  9 +++++++++
>   hw/sparc64/sun4u.c      | 10 ++++++++++
>   system/globals-target.c |  6 +-----
>   3 files changed, 20 insertions(+), 5 deletions(-)
> 

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>