diff mbox

[1/9] sysemu: add defines for sparc & ppc graphics_*

Message ID 1487715299-21102-2-git-send-email-kraxel@redhat.com
State New
Headers show

Commit Message

Gerd Hoffmann Feb. 21, 2017, 10:14 p.m. UTC
Add defines for the sparc and ppc arch specific graphics defaults.
They return the graphic_* values these variables are non-zero, and
the default values otherwise.

After switching over ppc and sparc to use these we don't need the
arch-specific initialization for the graphic_* variables any more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/sysemu/sysemu.h | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Thomas Huth Feb. 28, 2017, 2:50 p.m. UTC | #1
On 21.02.2017 23:14, Gerd Hoffmann wrote:
> Add defines for the sparc and ppc arch specific graphics defaults.
> They return the graphic_* values these variables are non-zero, and
> the default values otherwise.
> 
> After switching over ppc and sparc to use these we don't need the
> arch-specific initialization for the graphic_* variables any more.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  include/sysemu/sysemu.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
> index 576c7ce..9450788 100644
> --- a/include/sysemu/sysemu.h
> +++ b/include/sysemu/sysemu.h
> @@ -142,9 +142,16 @@ typedef enum {
>  extern int vga_interface_type;
>  #define xenfb_enabled (vga_interface_type == VGA_XENFB)
>  
> +#define sparc_graphic_width  (graphic_width  ? graphic_width  : 1024)
> +#define sparc_graphic_height (graphic_height ? graphic_height :  768)
> +#define sparc_graphic_depth  (graphic_depth  ? graphic_depth  :    8)
> +#define ppc_graphic_width    (graphic_width  ? graphic_width  :  800)
> +#define ppc_graphic_height   (graphic_height ? graphic_height :  600)
> +#define ppc_graphic_depth    (graphic_depth  ? graphic_depth  :   32)

I have to say that I really dislike the idea to hide this logic in such
macros. Could we please do it without such macros, i.e. by just adding
some code a la
	if (!graphic_width) {
		graphic_width = 800;
	}
to the right machine_init() functions instead?

 Thomas
diff mbox

Patch

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 576c7ce..9450788 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -142,9 +142,16 @@  typedef enum {
 extern int vga_interface_type;
 #define xenfb_enabled (vga_interface_type == VGA_XENFB)
 
+#define sparc_graphic_width  (graphic_width  ? graphic_width  : 1024)
+#define sparc_graphic_height (graphic_height ? graphic_height :  768)
+#define sparc_graphic_depth  (graphic_depth  ? graphic_depth  :    8)
+#define ppc_graphic_width    (graphic_width  ? graphic_width  :  800)
+#define ppc_graphic_height   (graphic_height ? graphic_height :  600)
+#define ppc_graphic_depth    (graphic_depth  ? graphic_depth  :   32)
 extern int graphic_width;
 extern int graphic_height;
 extern int graphic_depth;
+
 extern int display_opengl;
 extern const char *keyboard_layout;
 extern int win2k_install_hack;