diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-10-18 15:51:11 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@redhat.com> | 2007-10-18 21:03:43 -0400 |
commit | 8fc635e6a8072c7cd2777d804dd6f8eda2eecc15 (patch) | |
tree | 8f2a77167fb5f0f0b0a4f3770cd72adc5bbf4afb /GL/glx/glxscreens.c | |
parent | 0af8180683247955ce4cfd48e6a5b4d00bbe618a (diff) |
Separate handling of GLX visuals and GLX FBConfigs.
XIDs for GLX visuals and FBConfigs used to be interchangable and the list of
GLX visuals was identical to the list for FBConfigs. This patch splits handling
of these two data types and allows the X server to pick and choose the FBConfigs
that are exposed as visuals.
Diffstat (limited to 'GL/glx/glxscreens.c')
-rw-r--r-- | GL/glx/glxscreens.c | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/GL/glx/glxscreens.c b/GL/glx/glxscreens.c index 3d69645f8..e2d3d4ae1 100644 --- a/GL/glx/glxscreens.c +++ b/GL/glx/glxscreens.c @@ -44,6 +44,7 @@ #include "glxserver.h" #include "glxutil.h" #include "glxext.h" +#include "glcontextmodes.h" static int glxScreenPrivateIndex; @@ -284,13 +285,28 @@ glxGetScreen(ScreenPtr pScreen) void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **privates) { - /* We keep this stub around for the DDX drivers that still - * call it. */ + /* We keep this stub around for the DDX drivers that still + * call it. */ +} + +static XID +findVisualForConfig(ScreenPtr pScreen, __GLcontextModes *m) +{ + int i; + + for (i = 0; i < pScreen->numVisuals; i++) { + if (_gl_convert_to_x_visual_type(m->visualType) == pScreen->visuals[i].class) + return pScreen->visuals[i].vid; + } + + return 0; } void __glXScreenInit(__GLXscreen *glxScreen, ScreenPtr pScreen) { static int glxGeneration; + __GLcontextModes *m; + int i; if (glxGeneration != serverGeneration) { @@ -301,6 +317,23 @@ void __glXScreenInit(__GLXscreen *glxScreen, ScreenPtr pScreen) glxGeneration = serverGeneration; } + i = 0; + for (m = glxScreen->fbconfigs; m != NULL; m = m->next) { + m->fbconfigID = i++; + m->visualID = findVisualForConfig(pScreen, m); + ErrorF("mapping fbconfig %d to visual 0x%02x\n", + m->fbconfigID, m->visualID); + } + glxScreen->numFBConfigs = i; + + /* Select a subset of fbconfigs that we send to the client when it + * asks for the glx visuals. All the fbconfigs here have a valid + * value for visual ID and each visual ID is only present once. + * This runs before composite adds its extra visual so we have to + * remember the number of visuals here.*/ + glxScreen->visuals = NULL; + glxScreen->numVisuals = 0; + glxScreen->pScreen = pScreen; glxScreen->GLextensions = xstrdup(GLServerExtensions); glxScreen->GLXvendor = xstrdup(GLXServerVendorName); |