summaryrefslogtreecommitdiff
path: root/hw/vfb
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-04-26 18:23:27 -0700
committerJamey Sharp <jamey@minilop.net>2010-04-27 10:14:42 -0700
commitf9e3a2955d2ca73604c68fc9d51405581b832edb (patch)
treee3db1001dd610f642a11eb551c10450c9d22702a /hw/vfb
parent20e84b0b44e8b3b40a3ecab5b2e64a27de247b16 (diff)
Make Xvfb independent of MAXSCREENS.
If a -screen option specifies a screen number higher than any previously specified, reallocate the vfb-private array of screen-info structs. If built with a DIX that still has a MAXSCREENS limit, asking for too many screens won't be detected until InitOutput calls AddScreen. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Diffstat (limited to 'hw/vfb')
-rw-r--r--hw/vfb/InitOutput.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c
index f71082854..29857877e 100644
--- a/hw/vfb/InitOutput.c
+++ b/hw/vfb/InitOutput.c
@@ -104,7 +104,7 @@ typedef struct
} vfbScreenInfo, *vfbScreenInfoPtr;
static int vfbNumScreens;
-static vfbScreenInfo vfbScreens[MAXSCREENS];
+static vfbScreenInfo *vfbScreens;
static vfbScreenInfo defaultScreenInfo = {
.width = VFB_DEFAULT_WIDTH,
.height = VFB_DEFAULT_HEIGHT,
@@ -280,7 +280,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
int screenNum;
CHECK_FOR_REQUIRED_ARGUMENTS(2);
screenNum = atoi(argv[i+1]);
- if (screenNum < 0 || screenNum >= MAXSCREENS)
+ if (screenNum < 0)
{
ErrorF("Invalid screen number %d\n", screenNum);
UseMsg();
@@ -288,8 +288,14 @@ ddxProcessArgument(int argc, char *argv[], int i)
screenNum);
}
- for (; vfbNumScreens <= screenNum; ++vfbNumScreens)
- vfbScreens[vfbNumScreens] = defaultScreenInfo;
+ if (vfbNumScreens <= screenNum)
+ {
+ vfbScreens = xrealloc(vfbScreens, sizeof(*vfbScreens) * (screenNum + 1));
+ if (!vfbScreens)
+ FatalError("Not enough memory for screen %d\n", screenNum);
+ for (; vfbNumScreens <= screenNum; ++vfbNumScreens)
+ vfbScreens[vfbNumScreens] = defaultScreenInfo;
+ }
if (3 != sscanf(argv[i+2], "%dx%dx%d",
&vfbScreens[screenNum].width,
@@ -953,7 +959,7 @@ InitOutput(ScreenInfo *screenInfo, int argc, char **argv)
if (vfbNumScreens < 1)
{
- vfbScreens[0] = defaultScreenInfo;
+ vfbScreens = &defaultScreenInfo;
vfbNumScreens = 1;
}
for (i = 0; i < vfbNumScreens; i++)