summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Peter Staplin <gps@Georges-Workstation.local>2008-11-03 19:52:48 -0700
committerJeremy Huddleston <jeremyhu@freedesktop.org>2008-11-05 19:23:41 -0800
commit34bb06b292dc8b07d8602941aab3e69a73811314 (patch)
treec5c69fbeee2e37d1376cf60d1ce4f1f43de7fef6
parent39e82a9b1250b23768136f3c397377a97f8b908c (diff)
XQuartz: GL: Work around problems with really deep visuals.
GL/capabilities.c: #if 0 (for now) any capabilities above 8 bits per channel, because they introduce drawing problems. GL/indirect.c: Comment out some visual setup code that shouldn't be running, and actually seemed to cause some problems. The current visualConfigs.c code seems to do a reasonable job of setting up visuals for XQuartz. GL/visualConfigs.c: Make use of the proper visual .class. Eliminate depth 0. It seems we really just want 24 for now, and 0 I think was a flaw in the original code. (cherry picked from commit 1e5f63f15e13a40a6e69a1505934d10d6990b6a2)
-rw-r--r--hw/xquartz/GL/capabilities.c10
-rw-r--r--hw/xquartz/GL/indirect.c11
-rw-r--r--hw/xquartz/GL/visualConfigs.c146
3 files changed, 95 insertions, 72 deletions
diff --git a/hw/xquartz/GL/capabilities.c b/hw/xquartz/GL/capabilities.c
index b38dba825..23d7c25c8 100644
--- a/hw/xquartz/GL/capabilities.c
+++ b/hw/xquartz/GL/capabilities.c
@@ -204,6 +204,15 @@ static int handleColorAndAccumulation(struct glColorBufCapabilities *c,
++offset;
}
+#if 0
+ /*
+ * Disable this path, because some part of libGL, X, or Xplugin
+ * doesn't work with sizes greater than 8.
+ * When this is enabled and visuals are chosen using depths
+ * such as 16, the result is that the windows don't redraw
+ * and are often white, until a resize.
+ */
+
/*12*/
if(kCGLRGB101010Bit & cmodes) {
c[offset].r = 10;
@@ -265,6 +274,7 @@ static int handleColorAndAccumulation(struct glColorBufCapabilities *c,
c[offset].a = 16;
++offset;
}
+#endif
/* FIXME should we handle the floating point color modes, and if so, how? */
diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c
index 2a15a81c5..22157e275 100644
--- a/hw/xquartz/GL/indirect.c
+++ b/hw/xquartz/GL/indirect.c
@@ -1155,8 +1155,15 @@ static __GLXscreen * __glXAquaScreenProbe(ScreenPtr pScreen) {
screen->base.createDrawable = __glXAquaScreenCreateDrawable;
screen->base.pScreen = pScreen;
- init_screen_visuals(screen);
-
+ /*
+ * These are both commented out, because they cause problems with
+ * the other visual config code, and visuals.
+ * This probe function is called normally on startup in direct
+ * mode too.
+ * They don't seem to be needed now that we have better visual
+ * setup.
+ */
+ //init_screen_visuals(screen);
//glAquaInitVisualConfigs();
return &screen->base;
diff --git a/hw/xquartz/GL/visualConfigs.c b/hw/xquartz/GL/visualConfigs.c
index 12e9777db..f7f253f05 100644
--- a/hw/xquartz/GL/visualConfigs.c
+++ b/hw/xquartz/GL/visualConfigs.c
@@ -86,6 +86,7 @@ void setVisualConfigs(void) {
conf->total_color_buffers indicates the RGB/RGBA color depths.
conf->total_accum_buffers iterations for accum (with at least 1 if equal to 0)
+
*/
assert(NULL != caps.configurations);
@@ -98,7 +99,6 @@ void setVisualConfigs(void) {
continue;
numConfigs += (conf->stereo ? 2 : 1)
- * 2 /*depth*/
* (conf->aux_buffers ? 2 : 1)
* conf->buffers
* ((conf->total_stencil_bit_depths > 0) ? conf->total_stencil_bit_depths : 1)
@@ -126,80 +126,86 @@ void setVisualConfigs(void) {
i = 0; /* current buffer */
for(conf = caps.configurations; conf; conf = conf->next) {
for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) {
- for(depth = 0; depth < 2; ++depth) {
- for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
- for(buffers = 0; buffers < conf->buffers; ++buffers) {
- for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ?
- conf->total_stencil_bit_depths : 1); ++stencil) {
- for(color = 0; color < conf->total_color_buffers; ++color) {
- for(accum = 0; accum < ((conf->total_accum_buffers > 0) ?
- conf->total_accum_buffers : 1); ++accum) {
- visualConfigs[i].vid = -1;
- visualConfigs[i].class = -1;
-
- visualConfigs[i].rgba = true;
- visualConfigs[i].redSize = conf->color_buffers[color].r;
- visualConfigs[i].greenSize = conf->color_buffers[color].g;
- visualConfigs[i].blueSize = conf->color_buffers[color].b;
- visualConfigs[i].alphaSize = conf->color_buffers[color].a;
+ for(aux = 0; aux < (conf->aux_buffers ? 2 : 1); ++aux) {
+ for(buffers = 0; buffers < conf->buffers; ++buffers) {
+ for(stencil = 0; stencil < ((conf->total_stencil_bit_depths > 0) ?
+ conf->total_stencil_bit_depths : 1); ++stencil) {
+ for(color = 0; color < conf->total_color_buffers; ++color) {
+ for(accum = 0; accum < ((conf->total_accum_buffers > 0) ?
+ conf->total_accum_buffers : 1); ++accum) {
+ visualConfigs[i].vid = (VisualID)(-1);
+ visualConfigs[i].class = TrueColor;
- visualConfigs[i].redMask = -1;
- visualConfigs[i].greenMask = -1;
- visualConfigs[i].blueMask = -1;
- visualConfigs[i].alphaMask = -1;
-
- if(conf->total_accum_buffers > 0) {
- visualConfigs[i].accumRedSize = conf->accum_buffers[accum].r;
- visualConfigs[i].accumGreenSize = conf->accum_buffers[accum].g;
- visualConfigs[i].accumBlueSize = conf->accum_buffers[accum].b;
- if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) {
- visualConfigs[i].accumAlphaSize = conf->accum_buffers[accum].a;
- } else {
- visualConfigs[i].accumAlphaSize = 0;
- }
+ visualConfigs[i].rgba = true;
+ visualConfigs[i].redSize = conf->color_buffers[color].r;
+ visualConfigs[i].greenSize = conf->color_buffers[color].g;
+ visualConfigs[i].blueSize = conf->color_buffers[color].b;
+ visualConfigs[i].alphaSize = conf->color_buffers[color].a;
+
+ visualConfigs[i].bufferSize = conf->color_buffers[color].r +
+ conf->color_buffers[color].g + conf->color_buffers[color].b +
+ conf->color_buffers[color].a;
+
+ /*
+ * I'm uncertain about these masks.
+ * I don't think we actually care what the values are in our
+ * libGL, so it doesn't seem to make a difference.
+ */
+ visualConfigs[i].redMask = -1;
+ visualConfigs[i].greenMask = -1;
+ visualConfigs[i].blueMask = -1;
+ visualConfigs[i].alphaMask = -1;
+
+ if(conf->total_accum_buffers > 0) {
+ visualConfigs[i].accumRedSize = conf->accum_buffers[accum].r;
+ visualConfigs[i].accumGreenSize = conf->accum_buffers[accum].g;
+ visualConfigs[i].accumBlueSize = conf->accum_buffers[accum].b;
+ if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) {
+ visualConfigs[i].accumAlphaSize = conf->accum_buffers[accum].a;
} else {
- visualConfigs[i].accumRedSize = 0;
- visualConfigs[i].accumGreenSize = 0;
- visualConfigs[i].accumBlueSize = 0;
visualConfigs[i].accumAlphaSize = 0;
}
-
- visualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE;
- visualConfigs[i].stereo = stereo ? TRUE : FALSE;
- visualConfigs[i].bufferSize = -1;
-
- visualConfigs[i].depthSize = depth ? 24 : 0;
-
- if(conf->total_stencil_bit_depths > 0) {
- visualConfigs[i].stencilSize = conf->stencil_bit_depths[stencil];
- } else {
- visualConfigs[i].stencilSize = 0;
- }
- visualConfigs[i].auxBuffers = aux ? conf->aux_buffers : 0;
- visualConfigs[i].level = 0;
-
- if(conf->accelerated) {
- visualConfigs[i].visualRating = GLX_NONE;
- } else {
- visualConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
- }
-
- visualConfigs[i].transparentPixel = GLX_NONE;
- visualConfigs[i].transparentRed = GLX_NONE;
- visualConfigs[i].transparentGreen = GLX_NONE;
- visualConfigs[i].transparentBlue = GLX_NONE;
- visualConfigs[i].transparentAlpha = GLX_NONE;
- visualConfigs[i].transparentIndex = GLX_NONE;
-
- /*
- TODO possibly handle:
- multiSampleSize;
- nMultiSampleBuffers;
- visualSelectGroup;
- */
-
- ++i;
+ } else {
+ visualConfigs[i].accumRedSize = 0;
+ visualConfigs[i].accumGreenSize = 0;
+ visualConfigs[i].accumBlueSize = 0;
+ visualConfigs[i].accumAlphaSize = 0;
}
+
+ visualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE;
+ visualConfigs[i].stereo = stereo ? TRUE : FALSE;
+
+ visualConfigs[i].depthSize = 24;
+
+ if(conf->total_stencil_bit_depths > 0) {
+ visualConfigs[i].stencilSize = conf->stencil_bit_depths[stencil];
+ } else {
+ visualConfigs[i].stencilSize = 0;
+ }
+ visualConfigs[i].auxBuffers = aux ? conf->aux_buffers : 0;
+ visualConfigs[i].level = 0;
+
+ if(conf->accelerated) {
+ visualConfigs[i].visualRating = GLX_NONE;
+ } else {
+ visualConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT;
+ }
+
+ visualConfigs[i].transparentPixel = GLX_NONE;
+ visualConfigs[i].transparentRed = GLX_NONE;
+ visualConfigs[i].transparentGreen = GLX_NONE;
+ visualConfigs[i].transparentBlue = GLX_NONE;
+ visualConfigs[i].transparentAlpha = GLX_NONE;
+ visualConfigs[i].transparentIndex = GLX_NONE;
+
+ /*
+ TODO possibly handle:
+ multiSampleSize;
+ nMultiSampleBuffers;
+ visualSelectGroup;
+ */
+
+ ++i;
}
}
}