diff options
author | Peter Harris <pharris@opentext.com> | 2017-05-12 13:51:46 -0400 |
---|---|---|
committer | Peter Harris <pharris@opentext.com> | 2017-05-12 13:55:31 -0400 |
commit | a96648c4631e02a8848667a5039fc988ef58e21e (patch) | |
tree | efa1d45840106a0f127260456ed664fdfcbe4f9b /xts5 | |
parent | ea595bb1250b6f8e42d5eacd2b0cb0d20e3161b5 (diff) |
There is no reason to test all 481 (to pick the server I'm running at
the moment) visuals generated by GLX, when the visuals do not differ
from each other in any way tested by xts.
Diffstat (limited to 'xts5')
-rw-r--r-- | xts5/src/lib/nextvinf.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/xts5/src/lib/nextvinf.c b/xts5/src/lib/nextvinf.c index 834cbf5c..1c01afd1 100644 --- a/xts5/src/lib/nextvinf.c +++ b/xts5/src/lib/nextvinf.c @@ -143,6 +143,7 @@ static int Ndepths; int CurVinf; static void iddebug(); +static void uniquify(); /* * Start again at the beginning of the list of visual classes. @@ -204,6 +205,13 @@ XVisualInfo vi; Vinfop = XGetVisualInfo(Dsp, VisualScreenMask, &vi, &Nvis); /* + * GLX creates a plethora of identical visuals. There is no + * need to test them all, since the core rendering code is very + * probably identical in each case. + */ + uniquify(); + + /* * For debuging purposes only consider a subset of the available * visuals. */ @@ -380,3 +388,42 @@ int nreal = Nvis; } free(viptmp); } + +static void +uniquify(void) +{ +XVisualInfo *viptmp; +int i; +int nreal = Nvis; + + /* + * Copy the original (this is realy only being done this way + * to avoid mixing free and XFree.) + */ + viptmp = (XVisualInfo*)malloc(nreal * sizeof(XVisualInfo)); + if (viptmp == 0) + return; + for (i = 0; i < nreal; i++) + viptmp[i] = Vinfop[i]; + + /* + * Copy back any visual that is different from the previous visual, + * keeping count of found ones as we go along. Note that the list may + * contain visualids for different screens. + */ + Nvis = 0; + for (i = 0; i < nreal; i++) { + if (!Nvis || + viptmp[i].screen != Vinfop[Nvis-1].screen || + viptmp[i].depth != Vinfop[Nvis-1].depth || + viptmp[i].class != Vinfop[Nvis-1].class || + viptmp[i].red_mask != Vinfop[Nvis-1].red_mask || + viptmp[i].green_mask != Vinfop[Nvis-1].green_mask || + viptmp[i].blue_mask != Vinfop[Nvis-1].blue_mask || + viptmp[i].colormap_size != Vinfop[Nvis-1].colormap_size || + viptmp[i].bits_per_rgb != Vinfop[Nvis-1].bits_per_rgb) { + Vinfop[Nvis++] = viptmp[i]; + } + } + free(viptmp); +} |