Commit 9ab3f1bc authored by Jeremy White's avatar Jeremy White

In XSpice mode, enable the ability to specify the various ram buffer sizes.

Also adjust the mode selection to fit, and add a few larger modes.
parent 539ca283
......@@ -96,6 +96,36 @@ Section "Device"
# defaults to 4
#Option "NumHeads" "4"
#--------------------------------------------------------------
# Buffer Size notes:
# The following buffer sizes are used for Xspice only
# If you are using the DFPS mode, surface ram is not used,
# and you can set it to 1.
# Otherwise, the surface buffer should be at least as large
# as the frame buffer, and probably a multiple like 8.
# The command buffer ram should also be substantially larger
# than the frame buffer, and note that the frame buffer occupies
# the front of the command buffer. Hence, our default size
# is a command buffer 7x the size of the frame buffer.
# If you see 'Out of memory' errors in your xorg.log, you probably need
# to increase the surface or command buffer sizes.
#--------------------------------------------------------------
# The amount of surface buffer ram, in megabytes, to allocate
# defaults to 128
#Option "SurfaceBufferSize" "128"
# The amount of command buffer ram, in megabytes, to allocate
# defaults to 128
#Option "CommandBufferSize" "128"
# The amount of frame buffer ram, in megabytes, to reserve
# This is reserved out of the CommandBuffer RAM
# This governs the maximum size the X screen can be;
# 4 Heads at 1920x1080 require 32M of RAM
# defaults to 16
#Option "FrameBufferSize" "16"
# Set Spice Agent Mouse
# defaults to false
#Option "SpiceAgentMouse" "False"
......
......@@ -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,
};
......
......@@ -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))
......
......@@ -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,10 +104,9 @@ 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;
int i;
uint32_t fb;
int i, m;
memset(rom, 0, rom_size);
......@@ -124,36 +121,35 @@ void init_qxl_rom(qxl_screen_t* qxl, uint32_t rom_size)
rom->slots_end = 1;
rom->n_surfaces = (NUM_SURFACES);
modes->n_modes = (SPICE_ARRAY_SIZE(qxl_modes));
for (i = 0; i < modes->n_modes; i++) {
for (i = 0, m = 0; i < (SPICE_ARRAY_SIZE(qxl_modes)); i++) {
fb = qxl_modes[i].y_res * qxl_modes[i].stride;
if (maxfb < fb) {
maxfb = fb;
}
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);
modes->modes[i].bits = (qxl_modes[i].bits);
modes->modes[i].stride = (qxl_modes[i].stride);
modes->modes[i].x_mili = (qxl_modes[i].x_mili);
modes->modes[i].y_mili = (qxl_modes[i].y_mili);
modes->modes[i].orientation = (qxl_modes[i].orientation);
if (fb > qxl->surface0_size)
continue;
modes->modes[m].id = m;
modes->modes[m].x_res = qxl_modes[i].x_res;
modes->modes[m].y_res = qxl_modes[i].y_res;
modes->modes[m].bits = qxl_modes[i].bits;
modes->modes[m].stride = qxl_modes[i].stride;
modes->modes[m].x_mili = qxl_modes[i].x_mili;
modes->modes[m].y_mili = qxl_modes[i].y_mili;
modes->modes[m].orientation = qxl_modes[i].orientation;
m++;
}
if (maxfb < VGA_RAM_SIZE) // TODO - id != 0? (in original code from qxl.c)
maxfb = VGA_RAM_SIZE;
modes->n_modes = m;
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->num_pages = (num_pages);
rom->ram_header_offset = (VRAM_SIZE - ram_header_size);
rom->draw_area_offset = 0;
rom->surface0_area_size = qxl->surface0_size;
rom->pages_offset = rom->surface0_area_size;
rom->num_pages = num_pages;
rom->ram_header_offset = qxl->vram_size - ram_header_size;
qxl->shadow_rom = *qxl->rom; // TODO - do we need this?
}
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment