XQuartz: Unify how we set our bitmasks for visuals
(cherry picked from commit c230b52c27
)
This commit is contained in:
parent
4a53fed41d
commit
ae65daab08
|
@ -55,8 +55,7 @@
|
|||
|
||||
#include "capabilities.h"
|
||||
#include "visualConfigs.h"
|
||||
|
||||
#define MASK(l,h) (((1 << (1 + h - l)) - 1) << l)
|
||||
#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) {
|
||||
|
@ -182,29 +181,22 @@ __GLXconfig *__glXAquaCreateVisualConfigs(int *numConfigsPtr, int screenNumber)
|
|||
}
|
||||
|
||||
// Color
|
||||
c->rgbBits = 0;
|
||||
|
||||
c->blueBits = conf->color_buffers[color].b;
|
||||
c->blueMask = MASK(c->rgbBits, c->rgbBits + c->blueBits - 1);
|
||||
c->rgbBits += c->blueBits;
|
||||
|
||||
c->greenBits = conf->color_buffers[color].g;
|
||||
c->greenMask = MASK(c->rgbBits, c->rgbBits + c->greenBits - 1);
|
||||
c->rgbBits += c->greenBits;
|
||||
|
||||
c->redBits = conf->color_buffers[color].r;
|
||||
c->redMask = MASK(c->rgbBits, c->rgbBits + c->redBits - 1);
|
||||
c->rgbBits += c->redBits;
|
||||
|
||||
if(GLCAPS_COLOR_BUF_INVALID_VALUE != conf->color_buffers[color].a) {
|
||||
c->alphaBits = conf->color_buffers[color].a;
|
||||
c->alphaMask = MASK(c->rgbBits, c->rgbBits + c->alphaBits - 1);
|
||||
c->rgbBits += c->alphaBits;
|
||||
} else {
|
||||
c->alphaBits = 0;
|
||||
c->alphaMask = 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);
|
||||
|
||||
// Accumulation Buffers
|
||||
if(conf->total_accum_buffers > 0) {
|
||||
c->accumRedBits = conf->accum_buffers[accum].r;
|
||||
|
|
|
@ -42,6 +42,7 @@ EXTRA_DIST = \
|
|||
X11Controller.h \
|
||||
applewmExt.h \
|
||||
darwin.h \
|
||||
darwinfb.h \
|
||||
darwinEvents.h \
|
||||
keysym2ucs.h \
|
||||
pseudoramiX.h \
|
||||
|
|
|
@ -217,17 +217,10 @@ static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv
|
|||
// TODO: Make PseudoColor visuals not suck in TrueColor mode
|
||||
// if(dfb->depth > 8)
|
||||
// miSetVisualTypesAndMasks(8, PseudoColorMask, 8, PseudoColor, 0, 0, 0);
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* These aren't used anymore. xpr/xprScreen.c initializes the dfb struct
|
||||
* above based on the display properties.
|
||||
*/
|
||||
if(dfb->depth > 15)
|
||||
miSetVisualTypesAndMasks(15, LARGE_VISUALS, 5, TrueColor, 0x7c00, 0x03e0, 0x001f);
|
||||
miSetVisualTypesAndMasks(15, TrueColorMask, 5, TrueColor, RM_ARGB(0,5,5,5), GM_ARGB(0,5,5,5), BM_ARGB(0,5,5,5));
|
||||
if(dfb->depth > 24)
|
||||
miSetVisualTypesAndMasks(24, LARGE_VISUALS, 8, TrueColor, 0x00ff0000, 0x0000ff00, 0x000000ff);
|
||||
#endif
|
||||
miSetVisualTypesAndMasks(24, TrueColorMask, 8, TrueColor, RM_ARGB(0,8,8,8), GM_ARGB(0,8,8,8), BM_ARGB(0,8,8,8));
|
||||
|
||||
miSetPixmapDepths();
|
||||
|
||||
|
@ -249,29 +242,6 @@ static Bool DarwinScreenInit(int index, ScreenPtr pScreen, int argc, char **argv
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
// ErrorF("Screen type: %d, %d=%d, %d=%d, %d=%d, %x=%x=%x, %x=%x=%x, %x=%x=%x\n", pScreen->visuals->class,
|
||||
// pScreen->visuals->offsetRed, dfb->bitsPerRGB * 2,
|
||||
// pScreen->visuals->offsetGreen, dfb->bitsPerRGB,
|
||||
// pScreen->visuals->offsetBlue, 0,
|
||||
// pScreen->visuals->redMask, dfb->redMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetRed,
|
||||
// pScreen->visuals->greenMask, dfb->greenMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetGreen,
|
||||
// pScreen->visuals->blueMask, dfb->blueMask, ((1<<dfb->bitsPerRGB)-1) << pScreen->visuals->offsetBlue);
|
||||
|
||||
// set the RGB order correctly for TrueColor
|
||||
// if (dfb->bitsPerPixel > 8) {
|
||||
// for (i = 0, visual = pScreen->visuals; // someday we may have more than 1
|
||||
// i < pScreen->numVisuals; i++, visual++) {
|
||||
// if (visual->class == TrueColor) {
|
||||
// visual->offsetRed = bitsPerRGB * 2;
|
||||
// visual->offsetGreen = bitsPerRGB;
|
||||
// visual->offsetBlue = 0;
|
||||
// visual->redMask = ((1<<bitsPerRGB)-1) << visual->offsetRed;
|
||||
// visual->greenMask = ((1<<bitsPerRGB)-1) << visual->offsetGreen;
|
||||
// visual->blueMask = ((1<<bitsPerRGB)-1) << visual->offsetBlue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
#ifdef RENDER
|
||||
if (! fbPictureInit(pScreen, 0, 0)) {
|
||||
return FALSE;
|
||||
|
|
|
@ -36,22 +36,7 @@
|
|||
|
||||
#include "threadSafety.h"
|
||||
|
||||
typedef struct {
|
||||
void *framebuffer;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
int pitch;
|
||||
int depth;
|
||||
int visuals;
|
||||
int bitsPerRGB;
|
||||
int bitsPerPixel;
|
||||
int preferredCVC;
|
||||
Pixel redMask;
|
||||
Pixel greenMask;
|
||||
Pixel blueMask;
|
||||
} DarwinFramebufferRec, *DarwinFramebufferPtr;
|
||||
#include "darwinfb.h"
|
||||
|
||||
// From darwin.c
|
||||
void DarwinPrintBanner(void);
|
||||
|
|
56
hw/xquartz/darwinfb.h
Normal file
56
hw/xquartz/darwinfb.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (C) 2009 Apple, Inc.
|
||||
* Copyright (c) 2001-2004 Torrey T. Lyons. All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* Except as contained in this notice, the name(s) of the above copyright
|
||||
* holders shall not be used in advertising or otherwise to promote the sale,
|
||||
* use or other dealings in this Software without prior written authorization.
|
||||
*/
|
||||
|
||||
#ifndef _DARWIN_FB_H
|
||||
#define _DARWIN_DB_H
|
||||
|
||||
#include "scrnintstr.h"
|
||||
|
||||
typedef struct {
|
||||
void *framebuffer;
|
||||
int x;
|
||||
int y;
|
||||
int width;
|
||||
int height;
|
||||
int pitch;
|
||||
int depth;
|
||||
int visuals;
|
||||
int bitsPerRGB;
|
||||
int bitsPerPixel;
|
||||
int preferredCVC;
|
||||
Pixel redMask;
|
||||
Pixel greenMask;
|
||||
Pixel blueMask;
|
||||
} DarwinFramebufferRec, *DarwinFramebufferPtr;
|
||||
|
||||
#define MASK_LH(l,h) (((1 << (1 + (h) - (l))) - 1) << (l))
|
||||
#define BM_ARGB(a,r,g,b) MASK_LH(0, (b) - 1)
|
||||
#define GM_ARGB(a,r,g,b) MASK_LH(b, (b) + (g) - 1)
|
||||
#define RM_ARGB(a,r,g,b) MASK_LH((b) + (g), (b) + (g) + (r) - 1)
|
||||
#define AM_ARGB(a,r,g,b) MASK_LH((b) + (g) + (r), (b) + (g) + (r) + (a) - 1)
|
||||
|
||||
#endif /* _DARWIN_FB_H */
|
|
@ -277,22 +277,9 @@ xprAddScreen(int index, ScreenPtr pScreen)
|
|||
|
||||
if(depth == -1) {
|
||||
depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
|
||||
//dfb->depth = CGDisplaySamplesPerPixel(kCGDirectMainDisplay) * CGDisplayBitsPerSample(kCGDirectMainDisplay);
|
||||
//dfb->bitsPerRGB = CGDisplayBitsPerSample(kCGDirectMainDisplay);
|
||||
//dfb->bitsPerPixel = CGDisplayBitsPerPixel(kCGDirectMainDisplay);
|
||||
}
|
||||
|
||||
switch(depth) {
|
||||
// case -8: // broken
|
||||
// dfb->visuals = (1 << StaticGray) | (1 << GrayScale);
|
||||
// dfb->preferredCVC = GrayScale;
|
||||
// dfb->depth = 8;
|
||||
// dfb->bitsPerRGB = 8;
|
||||
// dfb->bitsPerPixel = 8;
|
||||
// dfb->redMask = 0;
|
||||
// dfb->greenMask = 0;
|
||||
// dfb->blueMask = 0;
|
||||
// break;
|
||||
case 8: // pseudo-working
|
||||
dfb->visuals = PseudoColorMask;
|
||||
dfb->preferredCVC = PseudoColor;
|
||||
|
@ -309,9 +296,9 @@ xprAddScreen(int index, ScreenPtr pScreen)
|
|||
dfb->depth = 15;
|
||||
dfb->bitsPerRGB = 5;
|
||||
dfb->bitsPerPixel = 16;
|
||||
dfb->redMask = 0x7c00;
|
||||
dfb->greenMask = 0x03e0;
|
||||
dfb->blueMask = 0x001f;
|
||||
dfb->redMask = RM_ARGB(0,5,5,5);
|
||||
dfb->greenMask = GM_ARGB(0,5,5,5);
|
||||
dfb->blueMask = BM_ARGB(0,5,5,5);
|
||||
break;
|
||||
// case 24:
|
||||
default:
|
||||
|
@ -322,9 +309,9 @@ xprAddScreen(int index, ScreenPtr pScreen)
|
|||
dfb->depth = 24;
|
||||
dfb->bitsPerRGB = 8;
|
||||
dfb->bitsPerPixel = 32;
|
||||
dfb->redMask = 0x00ff0000;
|
||||
dfb->greenMask = 0x0000ff00;
|
||||
dfb->blueMask = 0x000000ff;
|
||||
dfb->redMask = RM_ARGB(0,8,8,8);
|
||||
dfb->greenMask = GM_ARGB(0,8,8,8);
|
||||
dfb->blueMask = BM_ARGB(0,8,8,8);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user