<div dir="ltr">looks good to me, ack<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Aug 22, 2014 at 5:08 PM, Jeremy White <span dir="ltr"><<a href="mailto:jwhite@codeweavers.com" target="_blank">jwhite@codeweavers.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">Also adjust the mode selection to fit, and add a few larger modes.<br>
<br>
Signed-off-by: Jeremy White <<a href="mailto:jwhite@codeweavers.com">jwhite@codeweavers.com</a>><br>
---<br>
</div> examples/spiceqxl.xorg.conf.example | 30 ++++++++++++++++++<br>
src/qxl.h | 3 ++<br>
src/qxl_driver.c | 19 ++++++++---<br>
src/spiceqxl_driver.c | 60 ++++++++++++++++-------------------<br>
src/spiceqxl_driver.h | 7 ++--<br>
5 files changed, 79 insertions(+), 40 deletions(-)<br>
<br>
diff --git a/examples/spiceqxl.xorg.conf.example b/examples/spiceqxl.xorg.conf.example<br>
index be8a16b..597a5bd 100644<br>
--- a/examples/spiceqxl.xorg.conf.example<br>
+++ b/examples/spiceqxl.xorg.conf.example<br>
@@ -96,6 +96,36 @@ Section "Device"<br>
<div class=""> # defaults to 4<br>
#Option "NumHeads" "4"<br>
<br>
</div>+ #--------------------------------------------------------------<br>
+ # Buffer Size notes:<br>
+ # The following buffer sizes are used for Xspice only<br>
+ # If you are using the DFPS mode, surface ram is not used,<br>
+ # and you can set it to 1.<br>
+ # Otherwise, the surface buffer should be at least as large<br>
+ # as the frame buffer, and probably a multiple like 8.<br>
+ # The command buffer ram should also be substantially larger<br>
+ # than the frame buffer, and note that the frame buffer occupies<br>
+ # the front of the command buffer. Hence, our default size<br>
+ # is a command buffer 7x the size of the frame buffer.<br>
+ # If you see 'Out of memory' errors in your xorg.log, you probably need<br>
+ # to increase the surface or command buffer sizes.<br>
+ #--------------------------------------------------------------<br>
<div class="">+<br>
+ # The amount of surface buffer ram, in megabytes, to allocate<br>
</div><div class="">+ # defaults to 128<br>
+ #Option "SurfaceBufferSize" "128"<br>
+<br>
+ # The amount of command buffer ram, in megabytes, to allocate<br>
+ # defaults to 128<br>
+ #Option "CommandBufferSize" "128"<br>
+<br>
</div>+ # The amount of frame buffer ram, in megabytes, to reserve<br>
+ # This is reserved out of the CommandBuffer RAM<br>
+ # This governs the maximum size the X screen can be;<br>
+ # 4 Heads at 1920x1080 require 32M of RAM<br>
<div class="">+ # defaults to 16<br>
+ #Option "FrameBufferSize" "16"<br>
+<br>
</div><div class=""> # Set Spice Agent Mouse<br>
# defaults to false<br>
#Option "SpiceAgentMouse" "False"<br>
diff --git a/src/qxl.h b/src/qxl.h<br>
index 19555ba..fa9b13f 100644<br>
--- a/src/qxl.h<br>
+++ b/src/qxl.h<br>
@@ -154,6 +154,9 @@ enum {<br>
OPTION_SPICE_VDAGENT_UINPUT_PATH,<br>
OPTION_SPICE_VDAGENT_UID,<br>
OPTION_SPICE_VDAGENT_GID,<br>
+ OPTION_FRAME_BUFFER_SIZE,<br>
+ OPTION_SURFACE_BUFFER_SIZE,<br>
+ OPTION_COMMAND_BUFFER_SIZE,<br>
#endif<br>
OPTION_COUNT,<br>
};<br>
diff --git a/src/qxl_driver.c b/src/qxl_driver.c<br>
</div>index 7436a62..072953c 100644<br>
<div><div class="h5">--- a/src/qxl_driver.c<br>
+++ b/src/qxl_driver.c<br>
@@ -146,6 +146,12 @@ const OptionInfoRec DefaultOptions[] =<br>
"SpiceVdagentUid", OPTV_INTEGER, {0}, FALSE},<br>
{ OPTION_SPICE_VDAGENT_GID,<br>
"SpiceVdagentGid", OPTV_INTEGER, {0}, FALSE},<br>
+ { OPTION_FRAME_BUFFER_SIZE,<br>
+ "FrameBufferSize", OPTV_INTEGER, {DEFAULT_FRAME_BUFFER_SIZE}, FALSE},<br>
+ { OPTION_SURFACE_BUFFER_SIZE,<br>
+ "SurfaceBufferSize", OPTV_INTEGER, {DEFAULT_SURFACE_BUFFER_SIZE}, FALSE},<br>
+ { OPTION_COMMAND_BUFFER_SIZE,<br>
+ "CommandBufferSize", OPTV_INTEGER, {DEFAULT_COMMAND_BUFFER_SIZE}, FALSE},<br>
#endif<br>
<br>
{ -1, NULL, OPTV_NONE, {0}, FALSE }<br>
@@ -190,11 +196,9 @@ unmap_memory_helper (qxl_screen_t *qxl)<br>
static void<br>
map_memory_helper (qxl_screen_t *qxl)<br>
{<br>
- qxl->ram = calloc (RAM_SIZE, 1);<br>
- qxl->ram_size = RAM_SIZE;<br>
+ qxl->ram = calloc (qxl->ram_size, 1);<br>
qxl->ram_physical = qxl->ram;<br>
- qxl->vram = calloc (VRAM_SIZE, 1);<br>
- qxl->vram_size = VRAM_SIZE;<br>
+ qxl->vram = calloc (qxl->vram_size, 1);<br>
qxl->vram_physical = qxl->vram;<br>
qxl->rom = calloc (ROM_SIZE, 1);<br>
<br>
@@ -1081,6 +1085,13 @@ qxl_pre_init (ScrnInfoPtr pScrn, int flags)<br>
strncpy(qxl->playback_fifo_dir, playback_fifo_dir, sizeof(qxl->playback_fifo_dir));<br>
else<br>
qxl->playback_fifo_dir[0] = '\0';<br>
+<br>
+ qxl->surface0_size =<br>
+ get_int_option (qxl->options, OPTION_FRAME_BUFFER_SIZE, "QXL_FRAME_BUFFER_SIZE") << 20L;<br>
+ qxl->vram_size =<br>
+ get_int_option (qxl->options, OPTION_SURFACE_BUFFER_SIZE, "QXL_SURFACE_BUFFER_SIZE") << 20L;<br>
+ qxl->ram_size =<br>
+ get_int_option (qxl->options, OPTION_COMMAND_BUFFER_SIZE, "QXL_COMMAND_BUFFER_SIZE") << 20L;<br>
#endif<br>
<br>
if (!qxl_map_memory (qxl, scrnIndex))<br>
diff --git a/src/spiceqxl_driver.c b/src/spiceqxl_driver.c<br>
</div></div>index 990467f..68a2a70 100644<br>
<div class="">--- a/src/spiceqxl_driver.c<br>
+++ b/src/spiceqxl_driver.c<br>
@@ -83,20 +83,18 @@ static QXLMode qxl_modes[] = {<br>
QXL_MODE_EX(1600, 1200),<br>
QXL_MODE_EX(1680, 1050),<br>
QXL_MODE_EX(1920, 1080),<br>
-#if VGA_RAM_SIZE >= (16 * 1024 * 1024)<br>
- /* these modes need more than 8 MB video memory */<br>
QXL_MODE_EX(1920, 1200),<br>
QXL_MODE_EX(1920, 1440),<br>
QXL_MODE_EX(2048, 1536),<br>
QXL_MODE_EX(2560, 1440),<br>
QXL_MODE_EX(2560, 1600),<br>
-#endif<br>
-#if VGA_RAM_SIZE >= (32 * 1024 * 1024)<br>
- /* these modes need more than 16 MB video memory */<br>
+ QXL_MODE_EX(3840, 1080),<br>
QXL_MODE_EX(2560, 2048),<br>
QXL_MODE_EX(2800, 2100),<br>
QXL_MODE_EX(3200, 2400),<br>
-#endif<br>
+ QXL_MODE_EX(5760, 1080),<br>
+ QXL_MODE_EX(7680, 1080),<br>
+<br>
};<br>
<br>
<br>
</div>@@ -106,10 +104,9 @@ void init_qxl_rom(qxl_screen_t* qxl, uint32_t rom_size)<br>
<div class=""> QXLRom *rom = qxl->rom;<br>
struct QXLModes *modes = (struct QXLModes *)(rom + 1);<br>
uint32_t ram_header_size;<br>
- uint32_t surface0_area_size;<br>
uint32_t num_pages;<br>
- uint32_t fb, maxfb = 0;<br>
</div>- int i;<br>
+ uint32_t fb;<br>
+ int i, m;<br>
<br>
memset(rom, 0, rom_size);<br>
<br>
@@ -124,36 +121,35 @@ void init_qxl_rom(qxl_screen_t* qxl, uint32_t rom_size)<br>
rom->slots_end = 1;<br>
rom->n_surfaces = (NUM_SURFACES);<br>
<br>
- modes->n_modes = (SPICE_ARRAY_SIZE(qxl_modes));<br>
- for (i = 0; i < modes->n_modes; i++) {<br>
+ for (i = 0, m = 0; i < (SPICE_ARRAY_SIZE(qxl_modes)); i++) {<br>
<div class=""> fb = qxl_modes[i].y_res * qxl_modes[i].stride;<br>
- if (maxfb < fb) {<br>
- maxfb = fb;<br>
</div>- }<br>
- modes->modes[i].id = (i);<br>
- modes->modes[i].x_res = (qxl_modes[i].x_res);<br>
- modes->modes[i].y_res = (qxl_modes[i].y_res);<br>
- modes->modes[i].bits = (qxl_modes[i].bits);<br>
- modes->modes[i].stride = (qxl_modes[i].stride);<br>
- modes->modes[i].x_mili = (qxl_modes[i].x_mili);<br>
- modes->modes[i].y_mili = (qxl_modes[i].y_mili);<br>
- modes->modes[i].orientation = (qxl_modes[i].orientation);<br>
<div class="">+ if (fb > qxl->surface0_size)<br>
</div>+ continue;<br>
+<br>
+ modes->modes[m].id = m;<br>
+ modes->modes[m].x_res = qxl_modes[i].x_res;<br>
+ modes->modes[m].y_res = qxl_modes[i].y_res;<br>
+ modes->modes[m].bits = qxl_modes[i].bits;<br>
+ modes->modes[m].stride = qxl_modes[i].stride;<br>
+ modes->modes[m].x_mili = qxl_modes[i].x_mili;<br>
+ modes->modes[m].y_mili = qxl_modes[i].y_mili;<br>
+ modes->modes[m].orientation = qxl_modes[i].orientation;<br>
+<br>
+ m++;<br>
<div class=""> }<br>
- if (maxfb < VGA_RAM_SIZE) // TODO - id != 0? (in original code from qxl.c)<br>
- maxfb = VGA_RAM_SIZE;<br>
</div>+ modes->n_modes = m;<br>
<div class=""><br>
ram_header_size = ALIGN(sizeof(struct QXLRam), 4096);<br>
- surface0_area_size = ALIGN(maxfb, 4096);<br>
- num_pages = VRAM_SIZE;<br>
+ num_pages = qxl->vram_size;<br>
num_pages -= ram_header_size;<br>
- num_pages -= surface0_area_size;<br>
+ num_pages -= qxl->surface0_size;<br>
num_pages = num_pages / TARGET_PAGE_SIZE;<br>
<br>
</div>- rom->draw_area_offset = (0);<br>
<div class="">- rom->surface0_area_size = (surface0_area_size);<br>
- rom->pages_offset = (surface0_area_size);<br>
</div>- rom->num_pages = (num_pages);<br>
<div class="">- rom->ram_header_offset = (VRAM_SIZE - ram_header_size);<br>
</div>+ rom->draw_area_offset = 0;<br>
+ rom->surface0_area_size = qxl->surface0_size;<br>
+ rom->pages_offset = rom->surface0_area_size;<br>
+ rom->num_pages = num_pages;<br>
+ rom->ram_header_offset = qxl->vram_size - ram_header_size;<br>
<div class="im HOEnZb"><br>
qxl->shadow_rom = *qxl->rom; // TODO - do we need this?<br>
}<br>
diff --git a/src/spiceqxl_driver.h b/src/spiceqxl_driver.h<br>
index c1a7c48..35d0f42 100644<br>
--- a/src/spiceqxl_driver.h<br>
+++ b/src/spiceqxl_driver.h<br>
@@ -23,10 +23,9 @@<br>
#ifndef SPICEQXL_DRIVER_H<br>
#define SPICEQXL_DRIVER_H 1<br>
<br>
-#define VGA_RAM_SIZE (16 * 1024 * 1024)<br>
-<br>
-#define RAM_SIZE (128L<<20) // must be >VGA_RAM_SIZE<br>
-#define VRAM_SIZE (128L<<20)<br>
+#define DEFAULT_FRAME_BUFFER_SIZE 16<br>
+#define DEFAULT_SURFACE_BUFFER_SIZE 128<br>
+#define DEFAULT_COMMAND_BUFFER_SIZE 128<br>
#define ROM_SIZE (1<<20) // TODO - put correct size<br>
<br>
void init_qxl_rom(qxl_screen_t* qxl, uint32_t rom_size);<br>
--<br>
1.7.10.4<br>
<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Spice-devel mailing list<br>
<a href="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/spice-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/spice-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Marc-André Lureau
</div>