aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/render/picture.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/render/picture.c')
-rw-r--r--xorg-server/render/picture.c60
1 files changed, 53 insertions, 7 deletions
diff --git a/xorg-server/render/picture.c b/xorg-server/render/picture.c
index 956738734..a3670778e 100644
--- a/xorg-server/render/picture.c
+++ b/xorg-server/render/picture.c
@@ -44,7 +44,7 @@
#include "registry.h"
static int PictureScreenPrivateKeyIndex;
-_X_EXPORT DevPrivateKey PictureScreenPrivateKey = &PictureScreenPrivateKeyIndex;
+DevPrivateKey PictureScreenPrivateKey = &PictureScreenPrivateKeyIndex;
static int PictureWindowPrivateKeyIndex;
DevPrivateKey PictureWindowPrivateKey = &PictureWindowPrivateKeyIndex;
static int PictureGeneration;
@@ -200,6 +200,12 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
formats[nformats].format = PICT_x8r8g8b8;
formats[nformats].depth = 32;
nformats++;
+ formats[nformats].format = PICT_b8g8r8a8;
+ formats[nformats].depth = 32;
+ nformats++;
+ formats[nformats].format = PICT_b8g8r8x8;
+ formats[nformats].depth = 32;
+ nformats++;
/* now look through the depths and visuals adding other formats */
for (v = 0; v < pScreen->numVisuals; v++)
@@ -233,6 +239,12 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
{
type = PICT_TYPE_ABGR;
}
+ else if (pVisual->offsetRed == pVisual->offsetGreen - r &&
+ pVisual->offsetGreen == pVisual->offsetBlue - g &&
+ pVisual->offsetBlue == bpp - b)
+ {
+ type = PICT_TYPE_BGRA;
+ }
if (type != PICT_TYPE_OTHER)
{
format = PICT_FORMAT(bpp, type, 0, r, g, b);
@@ -310,6 +322,19 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
PICT_x8r8g8b8, pDepth->depth);
nformats = addFormat (formats, nformats,
PICT_x8b8g8r8, pDepth->depth);
+ nformats = addFormat (formats, nformats,
+ PICT_b8g8r8x8, pDepth->depth);
+ }
+ if (pDepth->depth >= 30)
+ {
+ nformats = addFormat (formats, nformats,
+ PICT_a2r10g10b10, pDepth->depth);
+ nformats = addFormat (formats, nformats,
+ PICT_x2r10g10b10, pDepth->depth);
+ nformats = addFormat (formats, nformats,
+ PICT_a2b10g10r10, pDepth->depth);
+ nformats = addFormat (formats, nformats,
+ PICT_x2b10g10r10, pDepth->depth);
}
break;
}
@@ -366,6 +391,24 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
pFormats[f].direct.red = 0;
break;
+ case PICT_TYPE_BGRA:
+ pFormats[f].type = PictTypeDirect;
+
+ pFormats[f].direct.blueMask = Mask(PICT_FORMAT_B(format));
+ pFormats[f].direct.blue = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format));
+
+ pFormats[f].direct.greenMask = Mask(PICT_FORMAT_G(format));
+ pFormats[f].direct.green = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
+ PICT_FORMAT_G(format));
+
+ pFormats[f].direct.redMask = Mask(PICT_FORMAT_R(format));
+ pFormats[f].direct.red = (PICT_FORMAT_BPP(format) - PICT_FORMAT_B(format) -
+ PICT_FORMAT_G(format) - PICT_FORMAT_R(format));
+
+ pFormats[f].direct.alphaMask = Mask(PICT_FORMAT_A(format));
+ pFormats[f].direct.alpha = 0;
+ break;
+
case PICT_TYPE_A:
pFormats[f].type = PictTypeDirect;
@@ -410,8 +453,9 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
return TRUE;
if (format->index.vid == pScreen->rootVisual) {
- format->index.pColormap =
- (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP);
+ dixLookupResourceByType((pointer *)&format->index.pColormap,
+ pScreen->defColormap, RT_COLORMAP,
+ serverClient, DixGetAttrAccess);
} else {
VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid);
if (CreateColormap(FakeClientID (0), pScreen, pVisual,
@@ -456,7 +500,7 @@ PictureFinishInit (void)
return TRUE;
}
-_X_EXPORT Bool
+Bool
PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel)
{
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
@@ -468,7 +512,7 @@ PictureSetSubpixelOrder (ScreenPtr pScreen, int subpixel)
}
-_X_EXPORT int
+int
PictureGetSubpixelOrder (ScreenPtr pScreen)
{
PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
@@ -568,7 +612,7 @@ PictureParseCmapPolicy (const char *name)
return PictureCmapPolicyInvalid;
}
-_X_EXPORT Bool
+Bool
PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
{
PictureScreenPtr ps;
@@ -621,8 +665,10 @@ PictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats)
type = PICT_TYPE_A;
else if (formats[n].direct.red > formats[n].direct.blue)
type = PICT_TYPE_ARGB;
- else
+ else if (formats[n].direct.red == 0)
type = PICT_TYPE_ABGR;
+ else
+ type = PICT_TYPE_BGRA;
a = Ones (formats[n].direct.alphaMask);
r = Ones (formats[n].direct.redMask);
g = Ones (formats[n].direct.greenMask);