fantonifabio@tiscali.it
2013-Feb-06 15:29 UTC
[PATCH v5] tools/libxl: Improve videoram setting
From: Fabio Fantoni <fabio.fantoni@heliman.it> - If videoram setting is less than 8 mb shows error and exit. - Added videoram setting for qemu upstream with cirrus (added in qemu 1.3). - Updated xl.cfg man. Signed-off-by: Fabio Fantoni <fabio.fantoni@heliman.it> --- docs/man/xl.cfg.pod.5 | 14 +++++--------- tools/libxl/libxl_create.c | 4 ++++ tools/libxl/libxl_dm.c | 6 ++++++ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 index caba162..9c5cdcd 100644 --- a/docs/man/xl.cfg.pod.5 +++ b/docs/man/xl.cfg.pod.5 @@ -974,19 +974,15 @@ in the B<VFB_SPEC_STRING> for configuring virtual frame buffer devices Sets the amount of RAM which the emulated video card will contain, which in turn limits the resolutions and bit depths which will be -available. This option is only available when using the B<stdvga> -option (see below). +available. The default amount of video ram for stdvga is 8MB which is sufficient -for e.g. 1600x1200 at 32bpp. +for e.g. 1600x1200 at 32bpp and videoram option is currently working +only when using the qemu-xen-traditional device-model. When using the emulated Cirrus graphics card (B<stdvga=0>) the amount of video ram is fixed at 4MB which is sufficient -for 1024x768 at 32 bpp. - -videoram option is currently only available when using the -qemu-xen-traditional device-model. Upstream qemu-xen device-model -currently does not support changing the amount of video memory for the -emulated graphics device. +for 1024x768 at 32 bpp and videoram option is currently working +only when using the upstream qemu-xen device-model. =item B<stdvga=BOOLEAN> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index a8dfe61..cf545ef 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -199,6 +199,10 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, b_info->shadow_memkb = 0; if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT) b_info->video_memkb = 8 * 1024; + else if (b_info->video_memkb < 8192){ + LOG(ERROR,"videoram must be at least 8 mb"); + return ERROR_INVAL; + } if (b_info->u.hvm.timer_mode == LIBXL_TIMER_MODE_DEFAULT) b_info->u.hvm.timer_mode LIBXL_TIMER_MODE_NO_DELAY_FOR_MISSED_TICKS; diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index c265618..a2c99bd 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -433,6 +433,12 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, break; case LIBXL_VGA_INTERFACE_TYPE_CIRRUS: flexarray_vappend(dm_args, "-vga", "cirrus", NULL); + if (b_info->video_memkb) { + flexarray_vappend(dm_args, "-global", + libxl__sprintf(gc, "vga.vram_size_mb=%d", + libxl__sizekb_to_mb(b_info->video_memkb)), + NULL); + } break; } -- 1.7.9.5
Il 06/02/2013 16:29, fantonifabio@tiscali.it ha scritto:> From: Fabio Fantoni <fabio.fantoni@heliman.it> > > - If videoram setting is less than 8 mb shows error and exit. > - Added videoram setting for qemu upstream with cirrus (added in qemu 1.3). > - Updated xl.cfg man. > > Signed-off-by: Fabio Fantoni <fabio.fantoni@heliman.it> > --- > docs/man/xl.cfg.pod.5 | 14 +++++--------- > tools/libxl/libxl_create.c | 4 ++++ > tools/libxl/libxl_dm.c | 6 ++++++ > 3 files changed, 15 insertions(+), 9 deletions(-) > > diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5 > index caba162..9c5cdcd 100644 > --- a/docs/man/xl.cfg.pod.5 > +++ b/docs/man/xl.cfg.pod.5 > @@ -974,19 +974,15 @@ in the B<VFB_SPEC_STRING> for configuring virtual frame buffer devices > > Sets the amount of RAM which the emulated video card will contain, > which in turn limits the resolutions and bit depths which will be > -available. This option is only available when using the B<stdvga> > -option (see below). > +available. > The default amount of video ram for stdvga is 8MB which is sufficient > -for e.g. 1600x1200 at 32bpp. > +for e.g. 1600x1200 at 32bpp and videoram option is currently working > +only when using the qemu-xen-traditional device-model. > > When using the emulated Cirrus graphics card (B<stdvga=0>) > the amount of video ram is fixed at 4MB which is sufficient > -for 1024x768 at 32 bpp. > - > -videoram option is currently only available when using the > -qemu-xen-traditional device-model. Upstream qemu-xen device-model > -currently does not support changing the amount of video memory for the > -emulated graphics device. > +for 1024x768 at 32 bpp and videoram option is currently working > +only when using the upstream qemu-xen device-model. > > =item B<stdvga=BOOLEAN> > > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c > index a8dfe61..cf545ef 100644 > --- a/tools/libxl/libxl_create.c > +++ b/tools/libxl/libxl_create.c > @@ -199,6 +199,10 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, > b_info->shadow_memkb = 0; > if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT) > b_info->video_memkb = 8 * 1024; > + else if (b_info->video_memkb < 8192){ > + LOG(ERROR,"videoram must be at least 8 mb"); > + return ERROR_INVAL; > + } > if (b_info->u.hvm.timer_mode == LIBXL_TIMER_MODE_DEFAULT) > b_info->u.hvm.timer_mode > LIBXL_TIMER_MODE_NO_DELAY_FOR_MISSED_TICKS; > diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c > index c265618..a2c99bd 100644 > --- a/tools/libxl/libxl_dm.c > +++ b/tools/libxl/libxl_dm.c > @@ -433,6 +433,12 @@ static char ** libxl__build_device_model_args_new(libxl__gc *gc, > break; > case LIBXL_VGA_INTERFACE_TYPE_CIRRUS: > flexarray_vappend(dm_args, "-vga", "cirrus", NULL); > + if (b_info->video_memkb) { > + flexarray_vappend(dm_args, "-global", > + libxl__sprintf(gc, "vga.vram_size_mb=%d", > + libxl__sizekb_to_mb(b_info->video_memkb)), > + NULL); > + } > break; > } >This time should be correct, sent with "git send-mail". Tested also with older qemu (qemu-upstream-4.2-testing.git that have qemu 1.1), videoram setting with cirrus does not give error. I think is good to backport this patch also on 4.2.x to prevent setting of videoram < 8 mb and support cirrus memory setting if qemu is >=1.3 (some distro or user probably will have xen 4.2.x with qemu>=1.3).