Re: [PATCH] [xf86-video-qxl] In XSpice mode, enable the ability to specify the various ram buffer sizes.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



With agent running we do.

On August 22, 2014 7:55:19 AM EDT, "Marc-André Lureau" <mlureau@xxxxxxxxxx> wrote:
Hi Jeremy

I wish we could have dynamic allocation for Xspice, avoiding those parameters, but this could be improved later.

Few remarks below:

----- Original Message -----
Also adjust the mode selection to fit, and add a few larger modes.

Signed-off-by: Jeremy White <jwhite@xxxxxxxxxxxxxxx>
---
examples/spiceqxl.xorg.conf.example | 13 +++++++++++++
src/qxl.h | 3 +++
src/qxl_driver.c | 19 +++++++++++++++----
src/spiceqxl_driver.c | 33 +++++++++++++++------------------
src/spiceqxl_driver.h | 7 +++----
5 files changed, 49 insertions(+), 26 deletions(-)

diff --git a/examples/spiceqxl.xorg.conf.example
b/examples/spiceqxl.xorg.conf.example
index be8a16b..8fd5d2f 100644
--- a/examples/spiceqxl.xorg.conf.example
+++ b/examples/spiceqxl.xorg.conf.example
@@ -96,6 +96,19 @@ Section "Device"
# defaults to 4
#Option "NumHeads" "4"

+ # The amount of frame buffer ram, in megabytes, to allocate
+ # defaults to 16
+ #Option "FrameBufferSize" "16"
+
+ # The amount of surface buffer ram, in megabytes, to allocate
+ # Must be larger than FrameBufferSize

Is there a runtime check for that?

+ # defaults to 128
+ #Option "SurfaceBufferSize" "128"
+
+ # The amount of command buffer ram, in megabytes, to allocate
+ # defaults to 128
+ #Option "CommandBufferSize" "128"
+
# Set Spice Agent Mouse
# defaults to false
#Option "SpiceAgentMouse" "False"
diff --git a/src/qxl.h b/src/qxl.h
index 19555ba..fa9b13f 100644
--- a/src/qxl.h
+++ b/src/qxl.h
@@ -154,6 +154,9 @@ enum {
OPTION_SPICE_VDAGENT_UINPUT_PATH,
OPTION_SPICE_VDAGENT_UID,
OPTION_SPICE_VDAGENT_GID,
+ OPTION_FRAME_BUFFER_SIZE,
+ OPTION_SURFACE_BUFFER_SIZE,
+ OPTION_COMMAND_BUFFER_SIZE,
#endif
OPTION_COUNT,
};
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index d9bf447..87cdca4 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -146,6 +146,12 @@ const OptionInfoRec DefaultOptions[] =
"SpiceVdagentUid", OPTV_INTEGER, {0}, FALSE},
{ OPTION_SPICE_VDAGENT_GID,
"SpiceVdagentGid", OPTV_INTEGER, {0}, FALSE},
+ { OPTION_FRAME_BUFFER_SIZE,
+ "FrameBufferSize", OPTV_INTEGER,
{DEFAULT_FRAME_BUFFER_SIZE}, FALSE},
+ { OPTION_SURFACE_BUFFER_SIZE,
+ "SurfaceBufferSize", OPTV_INTEGER,
{DEFAULT_SURFACE_BUFFER_SIZE}, FALSE},
+ { OPTION_COMMAND_BUFFER_SIZE,
+ "CommandBufferSize", OPTV_INTEGER,
{DEFAULT_COMMAND_BUFFER_SIZE}, FALSE},
#endif

{ -1, NULL, OPTV_NONE, {0}, FALSE }
@@ -190,11 +196,9 @@ unmap_memory_helper (qxl_screen_t *qxl)
static void
map_memory_helper (qxl_screen_t *qxl)
{
- qxl->ram = calloc (RAM_SIZE, 1);
- qxl->ram_size = RAM_SIZE;
+ qxl->ram = calloc (qxl->ram_size, 1);
qxl->ram_physical = qxl->ram;
- qxl->vram = calloc (VRAM_SIZE, 1);
- qxl->vram_size = VRAM_SIZE;
+ qxl->vram = calloc (qxl->vram_size, 1);
qxl->vram_physical = qxl->vram;
qxl->rom = calloc (ROM_SIZE, 1);

@@ -1081,6 +1085,13 @@ qxl_pre_init (ScrnInfoPtr pScrn, int flags)
strncpy(qxl->playback_fifo_dir, playback_fifo_dir,
sizeof(qxl->playback_fifo_dir));
else
qxl->playback_fifo_dir[0] = '\0';
+
+ qxl->surface0_size =
+ get_int_option (qxl->options, OPTION_FRAME_BUFFER_SIZE,
"QXL_FRAME_BUFFER_SIZE") << 20L;
+ qxl->vram_size =
+ get_int_option (qxl->options, OPTION_SURFACE_BUFFER_SIZE,
"QXL_SURFACE_BUFFER_SIZE") << 20L;
+ qxl->ram_size =
+ get_int_option (qxl->options, OPTION_COMMAND_BUFFER_SIZE,
"QXL_COMMAND_BUFFER_SIZE") << 20L;
#endif

if (!qxl_map_memory (qxl, scrnIndex))
diff --git a/src/spiceqxl_driver.c b/src/spiceqxl_driver.c
index 990467f..1561562 100644
--- a/src/spiceqxl_driver.c
+++ b/src/spiceqxl_driver.c
@@ -83,20 +83,18 @@ static QXLMode qxl_modes[] = {
QXL_MODE_EX(1600, 1200),
QXL_MODE_EX(1680, 1050),
QXL_MODE_EX(1920, 1080),
-#if VGA_RAM_SIZE >= (16 * 1024 * 1024)
- /* these modes need more than 8 MB video memory */
QXL_MODE_EX(1920, 1200),
QXL_MODE_EX(1920, 1440),
QXL_MODE_EX(2048, 1536),
QXL_MODE_EX(2560, 1440),
QXL_MODE_EX(2560, 1600),
-#endif
-#if VGA_RAM_SIZE >= (32 * 1024 * 1024)
- /* these modes need more than 16 MB video memory */
+ QXL_MODE_EX(3840, 1080),
QXL_MODE_EX(2560, 2048),
QXL_MODE_EX(2800, 2100),
QXL_MODE_EX(3200, 2400),
-#endif
+ QXL_MODE_EX(5760, 1080),
+ QXL_MODE_EX(7680, 1080),
+
};


@@ -106,9 +104,8 @@ void init_qxl_rom(qxl_screen_t* qxl, uint32_t rom_size)
QXLRom *rom = qxl->rom;
struct QXLModes *modes = (struct QXLModes *)(rom + 1);
uint32_t ram_header_size;
- uint32_t surface0_area_size;
uint32_t num_pages;
- uint32_t fb, maxfb = 0;
+ uint32_t fb;
int i;

memset(rom, 0, rom_size);
@@ -127,9 +124,12 @@ void init_qxl_rom(qxl_screen_t* qxl, uint32_t rom_size)
modes->n_modes = (SPICE_ARRAY_SIZE(qxl_modes));
for (i = 0; i < modes->n_modes; i++) {
fb = qxl_modes[i].y_res * qxl_modes[i].stride;
- if (maxfb < fb) {
- maxfb = fb;
+ if (fb > qxl->surface0_size)
+ {
+ modes->n_modes--; i--;
+ continue;

Isn't this going to check the same qxl_modes[i] until i == modes->n_modes?

}
+
modes->modes[i].id = (i);
modes->modes[i].x_res = (qxl_modes[i].x_res);
modes->modes[i].y_res = (qxl_modes[i].y_res);
@@ -139,21 +139,18 @@ void init_qxl_rom(qxl_screen_t* qxl, uint32_t rom_size)
modes->modes[i].y_mili = (qxl_modes[i].y_mili);
modes->modes[i].orientation = (qxl_modes[i].orientation);
}
- if (maxfb < VGA_RAM_SIZE) // TODO - id != 0? (in original code from
qxl.c)
- maxfb = VGA_RAM_SIZE;

ram_header_size = ALIGN(sizeof(struct QXLRam), 4096);
- surface0_area_size = ALIGN(maxfb, 4096);
- num_pages = VRAM_SIZE;
+ num_pages = qxl->vram_size;
num_pages -= ram_header_size;
- num_pages -= surface0_area_size;
+ num_pages -= qxl->surface0_size;
num_pages = num_pages / TARGET_PAGE_SIZE;

rom->draw_area_offset = (0);
- rom->surface0_area_size = (surface0_area_size);
- rom->pages_offset = (surface0_area_size);
+ rom->surface0_area_size = (qxl->surface0_size);
+ rom->pages_offset = (rom->surface0_area_size);
rom->num_pages = (num_pages);
- rom->ram_header_offset = (VRAM_SIZE - ram_header_size);
+ rom->ram_header_offset = (qxl->vram_size - ram_header_size);

qxl->shadow_rom = *qxl->rom; // TODO - do we need this?
}
diff --git a/src/spiceqxl_driver.h b/src/spiceqxl_driver.h
index c1a7c48..35d0f42 100644
--- a/src/spiceqxl_driver.h
+++ b/src/spiceqxl_driver.h
@@ -23,10 +23,9 @@
#ifndef SPICEQXL_DRIVER_H
#define SPICEQXL_DRIVER_H 1

-#define VGA_RAM_SIZE (16 * 1024 * 1024)
-
-#define RAM_SIZE (128L<<20) // must be >VGA_RAM_SIZE
-#define VRAM_SIZE (128L<<20)
+#define DEFAULT_FRAME_BUFFER_SIZE 16
+#define DEFAULT_SURFACE_BUFFER_SIZE 128
+#define DEFAULT_COMMAND_BUFFER_SIZE 128
#define ROM_SIZE (1<<20) // TODO - put correct size

void init_qxl_rom(qxl_screen_t* qxl, uint32_t rom_size);
--
1.7.10.4



Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel



Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]