diff options
author | Dave Airlie <airlied@redhat.com> | 2009-09-29 11:49:09 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-09-30 10:00:07 +1000 |
commit | 6ffda5aae75272fabdc27d6f693ae827be119e95 (patch) | |
tree | 2ccf117a3972e9e83aa38278b25f1a6744abce0d /glx | |
parent | ad5c0d9efa47476ed5cf75c82265c73919e468b4 (diff) |
dix/glx/composite: consolidate visual resize in one place.
The previous code was copied and in both cases incorrectly fixed
up the colormaps after resizing the visuals, this patch consolidates
the visual resize + colormaps fixups in one place. This version
also consolidates the vid allocation for the DepthPtr inside the
function.
I'm not 100% sure colormap.[ch] is the correct place for this but
visuals are mostly created in fb and I know thats not the place to
be resizing them.
Fixes fd.o bug #19470.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'glx')
-rw-r--r-- | glx/glxscreens.c | 58 |
1 files changed, 3 insertions, 55 deletions
diff --git a/glx/glxscreens.c b/glx/glxscreens.c index ee3788d4b..6ce24b2b4 100644 --- a/glx/glxscreens.c +++ b/glx/glxscreens.c @@ -251,12 +251,8 @@ GLint glxConvertToXVisualType(int visualType) static VisualPtr AddScreenVisuals(ScreenPtr pScreen, int count, int d) { - XID *installedCmaps, *vids, vid; - int numInstalledCmaps, numVisuals, i, j; - VisualPtr visuals; - ColormapPtr installedCmap; + int i; DepthPtr depth; - int rc; depth = NULL; for (i = 0; i < pScreen->numDepths; i++) { @@ -268,56 +264,8 @@ AddScreenVisuals(ScreenPtr pScreen, int count, int d) if (depth == NULL) return NULL; - /* Find the installed colormaps */ - installedCmaps = xalloc (pScreen->maxInstalledCmaps * sizeof (XID)); - if (!installedCmaps) - return NULL; - - numInstalledCmaps = pScreen->ListInstalledColormaps(pScreen, installedCmaps); - - /* realloc the visual array to fit the new one in place */ - numVisuals = pScreen->numVisuals; - visuals = xrealloc(pScreen->visuals, (numVisuals + count) * sizeof(VisualRec)); - if (!visuals) { - xfree(installedCmaps); - return NULL; - } - - vids = xrealloc(depth->vids, (depth->numVids + count) * sizeof(XID)); - if (vids == NULL) { - xfree(installedCmaps); - xfree(visuals); - return NULL; - } - - /* - * Fix up any existing installed colormaps -- we'll assume that - * the only ones created so far have been installed. If this - * isn't true, we'll have to walk the resource database looking - * for all colormaps. - */ - for (i = 0; i < numInstalledCmaps; i++) { - rc = dixLookupResourceByType((pointer *)&installedCmap, - installedCmaps[i], RT_COLORMAP, - serverClient, DixReadAccess); - if (rc != Success) - continue; - j = installedCmap->pVisual - pScreen->visuals; - installedCmap->pVisual = &visuals[j]; - } - - xfree(installedCmaps); - - for (i = 0; i < count; i++) { - vid = FakeClientID(0); - visuals[pScreen->numVisuals + i].vid = vid; - vids[depth->numVids + i] = vid; - } - - pScreen->visuals = visuals; - pScreen->numVisuals += count; - depth->vids = vids; - depth->numVids += count; + if (ResizeVisualArray(pScreen, count, depth) == FALSE) + return NULL; /* Return a pointer to the first of the added visuals. */ return pScreen->visuals + pScreen->numVisuals - count; |