Skip to contentSkip to conversation

tools/libxl: Improve videoram setting

PATCH Applied [email protected] 5 participants 6 messages Feb 11, 2013 – Mar 1, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v6 1/1 tools/libxl: Improve videoram setting

From: Fabio Fantoni <[email protected]>

- 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.
- Default and minimal videoram changed to 16 mb if stdvga is set and upstream qemu is being used. This is required by qemu 1.4 to avoid a xen memory error (qemu 1.3 doesn't complain about it, probably buggy).

Changes from v5:
- Default and minimal videoram changed to 16 mb if stdvga is set and upstream qemu is being used.

---
 docs/man/xl.cfg.pod.5      |   14 +++++---------
 tools/libxl/libxl_create.c |   18 +++++++++++++++++-
 tools/libxl/libxl_dm.c     |    6 ++++++
 3 files changed, 28 insertions(+), 10 deletions(-)
docs/man/xl.cfg.pod.5 +5 -9
index caba162..9c5cdcd 100644
@@ -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>
 
tools/libxl/libxl_create.c +17 -1
index a8dfe61..fa81f88 100644
@@ -197,8 +197,24 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
     case LIBXL_DOMAIN_TYPE_HVM:
         if (b_info->shadow_memkb == LIBXL_MEMKB_DEFAULT)
             b_info->shadow_memkb = 0;
-        if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
+
+        if (b_info->u.hvm.vga.kind == LIBXL_VGA_INTERFACE_TYPE_STD &&
+            b_info->device_model_version ==
+            LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+                if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
+                    b_info->video_memkb = 16 * 1024;
+                else if (b_info->video_memkb < (16 * 1024) ){
+                    LOG(ERROR,
+                    "videoram must be at least 16 mb with stdvga");
+                    return ERROR_INVAL;
+                }
+        } else if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
             b_info->video_memkb = 8 * 1024;
+        else if (b_info->video_memkb < (8 * 1024) ){
+            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;
tools/libxl/libxl_dm.c +6 -0
index 51f9914..465b1fd 100644
@@ -430,6 +430,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;
         }
 
Signature · 1 line
1.7.9.5
Acked-by on v6 1/1
#1 lore raw
Quoted 9 lines · On Mon, 11 Feb 2013, [email protected] wrote:

From: Fabio Fantoni <[email protected]>

- 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.
- Default and minimal videoram changed to 16 mb if stdvga is set and upstream qemu is being used. This is required by qemu 1.4 to avoid a xen memory error (qemu 1.3 doesn't complain about it, probably buggy).

Quoted 5 lines

Changes from v5:
- Default and minimal videoram changed to 16 mb if stdvga is set and upstream qemu is being used.

Quoted 84 lines
 docs/man/xl.cfg.pod.5      |   14 +++++---------
 tools/libxl/libxl_create.c |   18 +++++++++++++++++-
 tools/libxl/libxl_dm.c     |    6 ++++++
 3 files changed, 28 insertions(+), 10 deletions(-)
docs/man/xl.cfg.pod.5 +5 -9
index caba162..9c5cdcd 100644
@@ -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>
 
tools/libxl/libxl_create.c +17 -1
index a8dfe61..fa81f88 100644
@@ -197,8 +197,24 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
     case LIBXL_DOMAIN_TYPE_HVM:
         if (b_info->shadow_memkb == LIBXL_MEMKB_DEFAULT)
             b_info->shadow_memkb = 0;
-        if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
+
+        if (b_info->u.hvm.vga.kind == LIBXL_VGA_INTERFACE_TYPE_STD &&
+            b_info->device_model_version ==
+            LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+                if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
+                    b_info->video_memkb = 16 * 1024;
+                else if (b_info->video_memkb < (16 * 1024) ){
+                    LOG(ERROR,
+                    "videoram must be at least 16 mb with stdvga");
+                    return ERROR_INVAL;
+                }
+        } else if (b_info->video_memkb == LIBXL_MEMKB_DEFAULT)
             b_info->video_memkb = 8 * 1024;
+        else if (b_info->video_memkb < (8 * 1024) ){
+            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;
tools/libxl/libxl_dm.c +6 -0
index 51f9914..465b1fd 100644
@@ -430,6 +430,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;
         }
 
Signature · 1 line
1.7.9.5
Applied
#2 lore raw
Quoted 10 lines · Stefano Stabellini
Quoted 9 lines · On Mon, 11 Feb 2013, [email protected] wrote:

From: Fabio Fantoni <[email protected]>

- 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.
- Default and minimal videoram changed to 16 mb if stdvga is set and upstream qemu is being used. This is required by qemu 1.4 to avoid a xen memory error (qemu 1.3 doesn't complain about it, probably buggy).

Quoted 7 lines
Quoted 5 lines

Changes from v5:
- Default and minimal videoram changed to 16 mb if stdvga is set and upstream qemu is being used.

Applied, thanks.

#3 lore raw

Il 15/02/2013 14:46, Ian Campbell ha scritto:

Quoted 11 lines · Stefano Stabellini
Quoted 10 lines · On Mon, 11 Feb 2013, [email protected] wrote:
Quoted 9 lines

From: Fabio Fantoni <[email protected]>

- 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.
- Default and minimal videoram changed to 16 mb if stdvga is set and upstream qemu is being used. This is required by qemu 1.4 to avoid a xen memory error (qemu 1.3 doesn't complain about it, probably buggy).

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

Changes from v5:
- Default and minimal videoram changed to 16 mb if stdvga is set and upstream qemu is being used.

Applied, thanks.

This patch should be backported to xen 4.2.x for fix crash of qemu 1.4 with stdvga (tested with debian experimental package)

#4 lore raw

Il 16/02/2013 15:57, Fabio Fantoni ha scritto:

Quoted 20 lines

Il 15/02/2013 14:46, Ian Campbell ha scritto:

Quoted 19 lines · Stefano Stabellini
Quoted 18 lines · On Mon, 11 Feb 2013, [email protected] wrote:
Quoted 17 lines

From: Fabio Fantoni <[email protected]>

- 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.
- Default and minimal videoram changed to 16 mb if stdvga is set and upstream
qemu is being used. This is required by qemu 1.4 to avoid a xen
memory error
(qemu 1.3 doesn't complain about it, probably buggy).

Changes from v5:
- Default and minimal videoram changed to 16 mb if stdvga is set and upstream
qemu is being used.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Applied, thanks.

This patch should be backported to xen 4.2.x for fix crash of qemu 1.4 with stdvga (tested with debian experimental package)

Sorry for another mail about this, I see that 4.2.2 is near to be released but this patch is not backported.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#5 lore raw

Fabio Fantoni writes ("Re: [Xen-devel] [PATCH v6] tools/libxl: Improve videoram setting"):

Quoted 2 lines

Sorry for another mail about this, I see that 4.2.2 is near to be released but this patch is not backported.

Please don't apologise. Thanks for the reminder and I'm sorry that we haven't dealt with this yet.

However, the commit (2e814a017155b885e4d4b5a88dc05e7367a9722a in xen.git) doesn't apply cleanly to 4.2. There's a docs conflict. Would you like to fix up the conflict and post a backport ?

Thanks,
Ian.