diff options
author | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-03-26 14:23:28 +0200 |
commit | 76bcc36ed305418a3ddc5752d287ede894243e1b (patch) | |
tree | bacb320c825768471ce56f058f17ce863d592376 /xorg-server/hw/xquartz/GL/visualConfigs.c | |
parent | 7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff) | |
parent | 0f834b91a4768673833ab4917e87d86c237bb1a6 (diff) | |
download | vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2 vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
pixman/pixman/pixman-mmx.c
xorg-server/Xext/shm.c
xorg-server/Xext/syncsrv.h
xorg-server/Xext/xvmain.c
xorg-server/Xi/exevents.c
xorg-server/Xi/opendev.c
xorg-server/composite/compalloc.c
xorg-server/composite/compoverlay.c
xorg-server/dix/colormap.c
xorg-server/dix/devices.c
xorg-server/dix/dispatch.c
xorg-server/dix/dixfonts.c
xorg-server/dix/eventconvert.c
xorg-server/dix/events.c
xorg-server/dix/gc.c
xorg-server/dix/getevents.c
xorg-server/dix/main.c
xorg-server/dix/privates.c
xorg-server/dix/registry.c
xorg-server/dix/resource.c
xorg-server/exa/exa_accel.c
xorg-server/exa/exa_migration_classic.c
xorg-server/exa/exa_unaccel.c
xorg-server/fb/fb.h
xorg-server/fb/fbcopy.c
xorg-server/fb/fbpixmap.c
xorg-server/glx/dispatch.h
xorg-server/glx/glapi.h
xorg-server/glx/glapi_gentable.c
xorg-server/glx/glapitable.h
xorg-server/glx/glprocs.h
xorg-server/glx/glxcmds.c
xorg-server/glx/glxcmdsswap.c
xorg-server/glx/glxdricommon.c
xorg-server/glx/glxdriswrast.c
xorg-server/glx/glxext.c
xorg-server/glx/indirect_dispatch.c
xorg-server/glx/indirect_dispatch.h
xorg-server/glx/indirect_dispatch_swap.c
xorg-server/glx/indirect_size.h
xorg-server/glx/indirect_size_get.h
xorg-server/glx/indirect_table.c
xorg-server/glx/indirect_util.c
xorg-server/glx/rensize.c
xorg-server/glx/single2swap.c
xorg-server/glx/singlepix.c
xorg-server/glx/singlepixswap.c
xorg-server/glx/singlesize.c
xorg-server/hw/dmx/dmxinit.c
xorg-server/hw/kdrive/ephyr/ephyr.c
xorg-server/hw/kdrive/ephyr/hostx.c
xorg-server/hw/kdrive/ephyr/hostx.h
xorg-server/hw/kdrive/src/kinput.c
xorg-server/hw/xfree86/common/compiler.h
xorg-server/hw/xwin/InitInput.c
xorg-server/hw/xwin/InitOutput.c
xorg-server/hw/xwin/ddraw.h
xorg-server/hw/xwin/glx/glwrap.c
xorg-server/hw/xwin/glx/indirect.c
xorg-server/hw/xwin/glx/wgl_ext_api.h
xorg-server/hw/xwin/glx/winpriv.c
xorg-server/hw/xwin/win.h
xorg-server/hw/xwin/winallpriv.c
xorg-server/hw/xwin/winauth.c
xorg-server/hw/xwin/winclipboard.h
xorg-server/hw/xwin/winclipboardinit.c
xorg-server/hw/xwin/winclipboardthread.c
xorg-server/hw/xwin/winclipboardunicode.c
xorg-server/hw/xwin/winclipboardwndproc.c
xorg-server/hw/xwin/winclipboardwrappers.c
xorg-server/hw/xwin/winclipboardxevents.c
xorg-server/hw/xwin/wincmap.c
xorg-server/hw/xwin/winconfig.c
xorg-server/hw/xwin/wincreatewnd.c
xorg-server/hw/xwin/wincursor.c
xorg-server/hw/xwin/windialogs.c
xorg-server/hw/xwin/winengine.c
xorg-server/hw/xwin/winerror.c
xorg-server/hw/xwin/wingc.c
xorg-server/hw/xwin/wingetsp.c
xorg-server/hw/xwin/winkeybd.c
xorg-server/hw/xwin/winkeybd.h
xorg-server/hw/xwin/winlayouts.h
xorg-server/hw/xwin/winmisc.c
xorg-server/hw/xwin/winmonitors.c
xorg-server/hw/xwin/winmouse.c
xorg-server/hw/xwin/winmsg.c
xorg-server/hw/xwin/winmsg.h
xorg-server/hw/xwin/winmultiwindowclass.c
xorg-server/hw/xwin/winmultiwindowicons.c
xorg-server/hw/xwin/winmultiwindowshape.c
xorg-server/hw/xwin/winmultiwindowwindow.c
xorg-server/hw/xwin/winmultiwindowwm.c
xorg-server/hw/xwin/winmultiwindowwndproc.c
xorg-server/hw/xwin/winnativegdi.c
xorg-server/hw/xwin/winpfbdd.c
xorg-server/hw/xwin/winpixmap.c
xorg-server/hw/xwin/winpolyline.c
xorg-server/hw/xwin/winprefs.c
xorg-server/hw/xwin/winprocarg.c
xorg-server/hw/xwin/winregistry.c
xorg-server/hw/xwin/winscrinit.c
xorg-server/hw/xwin/winsetsp.c
xorg-server/hw/xwin/winshaddd.c
xorg-server/hw/xwin/winshadddnl.c
xorg-server/hw/xwin/winshadgdi.c
xorg-server/hw/xwin/wintrayicon.c
xorg-server/hw/xwin/winwin32rootless.c
xorg-server/hw/xwin/winwin32rootlesswindow.c
xorg-server/hw/xwin/winwin32rootlesswndproc.c
xorg-server/hw/xwin/winwindow.c
xorg-server/hw/xwin/winwindow.h
xorg-server/hw/xwin/winwindowswm.c
xorg-server/hw/xwin/winwndproc.c
xorg-server/include/callback.h
xorg-server/include/dixstruct.h
xorg-server/include/misc.h
xorg-server/include/os.h
xorg-server/include/scrnintstr.h
xorg-server/mi/micmap.c
xorg-server/mi/miinitext.c
xorg-server/mi/mioverlay.c
xorg-server/mi/misprite.c
xorg-server/mi/mivaltree.c
xorg-server/mi/miwindow.c
xorg-server/miext/damage/damage.c
xorg-server/miext/rootless/rootlessGC.c
xorg-server/miext/rootless/rootlessWindow.c
xorg-server/os/WaitFor.c
xorg-server/os/access.c
xorg-server/os/connection.c
xorg-server/os/io.c
xorg-server/os/log.c
xorg-server/os/osinit.c
xorg-server/os/utils.c
xorg-server/os/xdmcp.c
xorg-server/os/xprintf.c
xorg-server/os/xstrans.c
xorg-server/render/mipict.c
xorg-server/xkb/xkbActions.c
xorg-server/xkb/xkbInit.c
xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/hw/xquartz/GL/visualConfigs.c')
-rw-r--r-- | xorg-server/hw/xquartz/GL/visualConfigs.c | 282 |
1 files changed, 169 insertions, 113 deletions
diff --git a/xorg-server/hw/xquartz/GL/visualConfigs.c b/xorg-server/hw/xquartz/GL/visualConfigs.c index 2c2a9a29e..c02427c99 100644 --- a/xorg-server/hw/xquartz/GL/visualConfigs.c +++ b/xorg-server/hw/xquartz/GL/visualConfigs.c @@ -58,83 +58,98 @@ #include "darwinfb.h" /* Based originally on code from indirect.c which was based on code from i830_dri.c. */ -__GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) { +__GLXconfig * +__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) +{ int numConfigs = 0; __GLXconfig *visualConfigs, *c; struct glCapabilities caps; struct glCapabilitiesConfig *conf; int stereo, depth, aux, buffers, stencil, accum, color, msample; - - if(getGlCapabilities(&caps)) { + + if (getGlCapabilities(&caps)) { ErrorF("error from getGlCapabilities()!\n"); return NULL; } - + /* - conf->stereo is 0 or 1, but we need at least 1 iteration of the loop, - so we treat a true conf->stereo as 2. - - The depth size is 0 or 24. Thus we do 2 iterations for that. - - conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1. - - conf->buffers indicates whether we have single or double buffering. - - conf->total_stencil_bit_depths - - 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) - - conf->total_depth_buffer_depths - - conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1 - for the 0 multisampling config. - + conf->stereo is 0 or 1, but we need at least 1 iteration of the loop, + so we treat a true conf->stereo as 2. + + The depth size is 0 or 24. Thus we do 2 iterations for that. + + conf->aux_buffers (when available/non-zero) result in 2 iterations instead of 1. + + conf->buffers indicates whether we have single or double buffering. + + conf->total_stencil_bit_depths + + 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) + + conf->total_depth_buffer_depths + + conf->multisample_buffers iterations (with at least 1 if equal to 0). We add 1 + for the 0 multisampling config. + */ - + assert(NULL != caps.configurations); - + numConfigs = 0; - - for(conf = caps.configurations; conf; conf = conf->next) { - if(conf->total_color_buffers <= 0) + + for (conf = caps.configurations; conf; conf = conf->next) { + if (conf->total_color_buffers <= 0) continue; - - numConfigs += (conf->stereo ? 2 : 1) - * (conf->aux_buffers ? 2 : 1) - * conf->buffers - * ((conf->total_stencil_bit_depths > 0) ? conf->total_stencil_bit_depths : 1) - * conf->total_color_buffers - * ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1) - * conf->total_depth_buffer_depths - * (conf->multisample_buffers + 1); + + numConfigs += (conf->stereo ? 2 : 1) + * (conf->aux_buffers ? 2 : 1) + * conf->buffers + * + ((conf->total_stencil_bit_depths > + 0) ? conf->total_stencil_bit_depths : 1) + * conf->total_color_buffers * + ((conf->total_accum_buffers > 0) ? conf->total_accum_buffers : 1) + * conf->total_depth_buffer_depths * (conf->multisample_buffers + 1); } - - if(numConfigsPtr) - *numConfigsPtr = numConfigs; - + + if (numConfigsPtr) + *numConfigsPtr = numConfigs; + visualConfigs = calloc(sizeof(*visualConfigs), numConfigs); - - if(NULL == visualConfigs) { + + if (NULL == visualConfigs) { ErrorF("xcalloc failure when allocating visualConfigs\n"); freeGlCapabilities(&caps); return NULL; } - - c = visualConfigs; /* current buffer */ - for(conf = caps.configurations; conf; conf = conf->next) { - for(stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) { - 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) { - for(depth = 0; depth < conf->total_depth_buffer_depths; ++depth) { - for(msample = 0; msample < (conf->multisample_buffers + 1); ++msample) { - + + c = visualConfigs; /* current buffer */ + for (conf = caps.configurations; conf; conf = conf->next) { + for (stereo = 0; stereo < (conf->stereo ? 2 : 1); ++stereo) { + 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) { + for (depth = 0; + depth < conf->total_depth_buffer_depths; + ++depth) { + for (msample = 0; + msample < + (conf->multisample_buffers + 1); + ++msample) { + // Global c->visualID = -1; c->visualType = GLX_TRUE_COLOR; @@ -144,99 +159,137 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) c->level = 0; c->indexBits = 0; - c->pixmapMode = 0; // TODO: What should this be? - - if(conf->accelerated) { + c->pixmapMode = 0; // TODO: What should this be? + + if (conf->accelerated) { c->visualRating = GLX_NONE; - } else { - c->visualRating = GLX_SLOW_VISUAL_EXT; } - + else { + c->visualRating = + GLX_SLOW_VISUAL_EXT; + } + c->transparentPixel = GLX_NONE; c->transparentRed = GLX_NONE; c->transparentGreen = GLX_NONE; c->transparentBlue = GLX_NONE; c->transparentAlpha = GLX_NONE; c->transparentIndex = GLX_NONE; - + c->visualSelectGroup = 0; - + c->swapMethod = GLX_SWAP_UNDEFINED_OML; - + // Stereo c->stereoMode = stereo ? TRUE : FALSE; // Aux buffers - c->numAuxBuffers = aux ? conf->aux_buffers : 0; - + c->numAuxBuffers = + aux ? conf->aux_buffers : 0; + // Double Buffered - c->doubleBufferMode = buffers ? TRUE : FALSE; + c->doubleBufferMode = + buffers ? TRUE : FALSE; // Stencil Buffer - if(conf->total_stencil_bit_depths > 0) { - c->stencilBits = conf->stencil_bit_depths[stencil]; - } else { + if (conf->total_stencil_bit_depths > 0) { + c->stencilBits = + conf-> + stencil_bit_depths[stencil]; + } + else { c->stencilBits = 0; } - + // Color - if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->color_buffers[color].a) { - c->alphaBits = conf->color_buffers[color].a; - } else { + if (GLCAPS_COLOR_BUF_INVALID_VALUE != + conf->color_buffers[color].a) { + c->alphaBits = + conf->color_buffers[color].a; + } + else { c->alphaBits = 0; } - c->redBits = conf->color_buffers[color].r; - c->greenBits = conf->color_buffers[color].g; - c->blueBits = conf->color_buffers[color].b; - - c->rgbBits = c->alphaBits + c->redBits + c->greenBits + c->blueBits; - - c->alphaMask = AM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits); - c->redMask = RM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits); - c->greenMask = GM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits); - c->blueMask = BM_ARGB(c->alphaBits, c->redBits, c->greenBits, c->blueBits); - + c->redBits = + conf->color_buffers[color].r; + c->greenBits = + conf->color_buffers[color].g; + c->blueBits = + conf->color_buffers[color].b; + + c->rgbBits = + c->alphaBits + c->redBits + + c->greenBits + c->blueBits; + + c->alphaMask = + AM_ARGB(c->alphaBits, c->redBits, + c->greenBits, c->blueBits); + c->redMask = + RM_ARGB(c->alphaBits, c->redBits, + c->greenBits, c->blueBits); + c->greenMask = + GM_ARGB(c->alphaBits, c->redBits, + c->greenBits, c->blueBits); + c->blueMask = + BM_ARGB(c->alphaBits, c->redBits, + c->greenBits, c->blueBits); + // Accumulation Buffers - if(conf->total_accum_buffers > 0) { - c->accumRedBits = conf->accum_buffers[accum].r; - c->accumGreenBits = conf->accum_buffers[accum].g; - c->accumBlueBits = conf->accum_buffers[accum].b; - if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->accum_buffers[accum].a) { - c->accumAlphaBits = conf->accum_buffers[accum].a; - } else { + if (conf->total_accum_buffers > 0) { + c->accumRedBits = + conf->accum_buffers[accum].r; + c->accumGreenBits = + conf->accum_buffers[accum].g; + c->accumBlueBits = + conf->accum_buffers[accum].b; + if (GLCAPS_COLOR_BUF_INVALID_VALUE + != + conf->accum_buffers[accum].a) { + c->accumAlphaBits = + conf->accum_buffers[accum]. + a; + } + else { c->accumAlphaBits = 0; } - } else { + } + else { c->accumRedBits = 0; c->accumGreenBits = 0; c->accumBlueBits = 0; c->accumAlphaBits = 0; - } + } // Depth - c->depthBits = conf->depth_buffers[depth]; - + c->depthBits = + conf->depth_buffers[depth]; + // MultiSample - if(msample > 0) { - c->samples = conf->multisample_samples; - c->sampleBuffers = conf->multisample_buffers; - } else { + if (msample > 0) { + c->samples = + conf->multisample_samples; + c->sampleBuffers = + conf->multisample_buffers; + } + else { c->samples = 0; c->sampleBuffers = 0; } - + /* * The Apple libGL supports GLXPixmaps and * GLXPbuffers in direct mode. */ /* SGIX_fbconfig / GLX 1.3 */ - c->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT | GLX_PBUFFER_BIT; + c->drawableType = + GLX_WINDOW_BIT | GLX_PIXMAP_BIT | + GLX_PBUFFER_BIT; c->renderType = GLX_RGBA_BIT; c->xRenderable = GL_TRUE; c->fbconfigID = -1; - + /* SGIX_pbuffer / GLX 1.3 */ - + /* * The CGL layer provides a way of retrieving * the maximum pbuffer width/height, but only @@ -247,21 +300,22 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) */ c->maxPbufferWidth = 8192; c->maxPbufferHeight = 8192; - c->maxPbufferPixels = /*Do we need this?*/ 0; + c->maxPbufferPixels = + /*Do we need this? */ 0; /* * There is no introspection for this sort of thing * with CGL. What should we do realistically? */ c->optimalPbufferWidth = 0; c->optimalPbufferHeight = 0; - + /* EXT_texture_from_pixmap */ c->bindToTextureRgb = 0; c->bindToTextureRgba = 0; c->bindToMipmapTexture = 0; c->bindToTextureTargets = 0; c->yInverted = 0; - + c = c->next; } } @@ -273,12 +327,14 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber) } } - (c-1)->next = NULL; + (c - 1)->next = NULL; if (c - visualConfigs != numConfigs) { - FatalError("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", numConfigs, (int)(c - visualConfigs)); + FatalError + ("numConfigs calculation error in setVisualConfigs! numConfigs is %d i is %d\n", + numConfigs, (int) (c - visualConfigs)); } - + freeGlCapabilities(&caps); return visualConfigs; } |