kdrive: Remove unused overlay fb support
Xfbdev, Xephyr and Xfake all use only one framebuffer, so simplify implementation by removing overlay support. Reviewed-by: Adam Jackson <ajax@redhat.com> Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
This commit is contained in:
parent
730f7d1c4f
commit
7ee14154b2
|
@ -101,77 +101,77 @@ ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EphyrWantGrayScale)
|
if (EphyrWantGrayScale)
|
||||||
screen->fb[0].depth = 8;
|
screen->fb.depth = 8;
|
||||||
|
|
||||||
if (screen->fb[0].depth && screen->fb[0].depth != hostx_get_depth())
|
if (screen->fb.depth && screen->fb.depth != hostx_get_depth())
|
||||||
{
|
{
|
||||||
if (screen->fb[0].depth < hostx_get_depth()
|
if (screen->fb.depth < hostx_get_depth()
|
||||||
&& (screen->fb[0].depth == 24 || screen->fb[0].depth == 16
|
&& (screen->fb.depth == 24 || screen->fb.depth == 16
|
||||||
|| screen->fb[0].depth == 8))
|
|| screen->fb.depth == 8))
|
||||||
{
|
{
|
||||||
hostx_set_server_depth(screen, screen->fb[0].depth);
|
hostx_set_server_depth(screen, screen->fb.depth);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ErrorF("\nXephyr: requested screen depth not supported, setting to match hosts.\n");
|
ErrorF("\nXephyr: requested screen depth not supported, setting to match hosts.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
screen->fb[0].depth = hostx_get_server_depth(screen);
|
screen->fb.depth = hostx_get_server_depth(screen);
|
||||||
screen->rate = 72;
|
screen->rate = 72;
|
||||||
|
|
||||||
if (screen->fb[0].depth <= 8)
|
if (screen->fb.depth <= 8)
|
||||||
{
|
{
|
||||||
if (EphyrWantGrayScale)
|
if (EphyrWantGrayScale)
|
||||||
screen->fb[0].visuals = ((1 << StaticGray) | (1 << GrayScale));
|
screen->fb.visuals = ((1 << StaticGray) | (1 << GrayScale));
|
||||||
else
|
else
|
||||||
screen->fb[0].visuals = ((1 << StaticGray) |
|
screen->fb.visuals = ((1 << StaticGray) |
|
||||||
(1 << GrayScale) |
|
(1 << GrayScale) |
|
||||||
(1 << StaticColor) |
|
(1 << StaticColor) |
|
||||||
(1 << PseudoColor) |
|
(1 << PseudoColor) |
|
||||||
(1 << TrueColor) |
|
(1 << TrueColor) |
|
||||||
(1 << DirectColor));
|
(1 << DirectColor));
|
||||||
|
|
||||||
screen->fb[0].redMask = 0x00;
|
screen->fb.redMask = 0x00;
|
||||||
screen->fb[0].greenMask = 0x00;
|
screen->fb.greenMask = 0x00;
|
||||||
screen->fb[0].blueMask = 0x00;
|
screen->fb.blueMask = 0x00;
|
||||||
screen->fb[0].depth = 8;
|
screen->fb.depth = 8;
|
||||||
screen->fb[0].bitsPerPixel = 8;
|
screen->fb.bitsPerPixel = 8;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen->fb[0].visuals = (1 << TrueColor);
|
screen->fb.visuals = (1 << TrueColor);
|
||||||
|
|
||||||
if (screen->fb[0].depth <= 15)
|
if (screen->fb.depth <= 15)
|
||||||
{
|
{
|
||||||
screen->fb[0].depth = 15;
|
screen->fb.depth = 15;
|
||||||
screen->fb[0].bitsPerPixel = 16;
|
screen->fb.bitsPerPixel = 16;
|
||||||
}
|
}
|
||||||
else if (screen->fb[0].depth <= 16)
|
else if (screen->fb.depth <= 16)
|
||||||
{
|
{
|
||||||
screen->fb[0].depth = 16;
|
screen->fb.depth = 16;
|
||||||
screen->fb[0].bitsPerPixel = 16;
|
screen->fb.bitsPerPixel = 16;
|
||||||
}
|
}
|
||||||
else if (screen->fb[0].depth <= 24)
|
else if (screen->fb.depth <= 24)
|
||||||
{
|
{
|
||||||
screen->fb[0].depth = 24;
|
screen->fb.depth = 24;
|
||||||
screen->fb[0].bitsPerPixel = 32;
|
screen->fb.bitsPerPixel = 32;
|
||||||
}
|
}
|
||||||
else if (screen->fb[0].depth <= 30)
|
else if (screen->fb.depth <= 30)
|
||||||
{
|
{
|
||||||
screen->fb[0].depth = 30;
|
screen->fb.depth = 30;
|
||||||
screen->fb[0].bitsPerPixel = 32;
|
screen->fb.bitsPerPixel = 32;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ErrorF("\nXephyr: Unsupported screen depth %d\n",
|
ErrorF("\nXephyr: Unsupported screen depth %d\n",
|
||||||
screen->fb[0].depth);
|
screen->fb.depth);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask);
|
hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask);
|
||||||
|
|
||||||
screen->fb[0].redMask = (Pixel) redMask;
|
screen->fb.redMask = (Pixel) redMask;
|
||||||
screen->fb[0].greenMask = (Pixel) greenMask;
|
screen->fb.greenMask = (Pixel) greenMask;
|
||||||
screen->fb[0].blueMask = (Pixel) blueMask;
|
screen->fb.blueMask = (Pixel) blueMask;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
|
||||||
KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
|
KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height);
|
||||||
KdSetPointerMatrix (&m);
|
KdSetPointerMatrix (&m);
|
||||||
|
|
||||||
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
|
priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
|
||||||
|
|
||||||
buffer_height = ephyrBufferHeight(screen);
|
buffer_height = ephyrBufferHeight(screen);
|
||||||
|
|
||||||
|
@ -260,9 +260,9 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
|
||||||
{
|
{
|
||||||
scrpriv->shadow = FALSE;
|
scrpriv->shadow = FALSE;
|
||||||
|
|
||||||
screen->fb[0].byteStride = priv->bytes_per_line;
|
screen->fb.byteStride = priv->bytes_per_line;
|
||||||
screen->fb[0].pixelStride = screen->width;
|
screen->fb.pixelStride = screen->width;
|
||||||
screen->fb[0].frameBuffer = (CARD8 *) (priv->base);
|
screen->fb.frameBuffer = (CARD8 *) (priv->base);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -271,7 +271,7 @@ ephyrMapFramebuffer (KdScreenInfo *screen)
|
||||||
|
|
||||||
EPHYR_LOG("allocing shadow");
|
EPHYR_LOG("allocing shadow");
|
||||||
|
|
||||||
KdShadowFbAlloc (screen, 0,
|
KdShadowFbAlloc (screen,
|
||||||
scrpriv->randr & (RR_Rotate_90|RR_Rotate_270));
|
scrpriv->randr & (RR_Rotate_90|RR_Rotate_270));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ ephyrUnmapFramebuffer (KdScreenInfo *screen)
|
||||||
EphyrScrPriv *scrpriv = screen->driver;
|
EphyrScrPriv *scrpriv = screen->driver;
|
||||||
|
|
||||||
if (scrpriv->shadow)
|
if (scrpriv->shadow)
|
||||||
KdShadowFbFree (screen, 0);
|
KdShadowFbFree (screen);
|
||||||
|
|
||||||
/* Note, priv->base will get freed when XImage recreated */
|
/* Note, priv->base will get freed when XImage recreated */
|
||||||
|
|
||||||
|
@ -571,10 +571,10 @@ ephyrRandRSetConfig (ScreenPtr pScreen,
|
||||||
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
||||||
pScreen->width,
|
pScreen->width,
|
||||||
pScreen->height,
|
pScreen->height,
|
||||||
screen->fb[0].depth,
|
screen->fb.depth,
|
||||||
screen->fb[0].bitsPerPixel,
|
screen->fb.bitsPerPixel,
|
||||||
screen->fb[0].byteStride,
|
screen->fb.byteStride,
|
||||||
screen->fb[0].frameBuffer);
|
screen->fb.frameBuffer);
|
||||||
|
|
||||||
/* set the subpixel order */
|
/* set the subpixel order */
|
||||||
|
|
||||||
|
@ -735,7 +735,7 @@ ephyrScreenFini (KdScreenInfo *screen)
|
||||||
{
|
{
|
||||||
EphyrScrPriv *scrpriv = screen->driver;
|
EphyrScrPriv *scrpriv = screen->driver;
|
||||||
if (scrpriv->shadow) {
|
if (scrpriv->shadow) {
|
||||||
KdShadowFbFree (screen, 0);
|
KdShadowFbFree (screen);
|
||||||
}
|
}
|
||||||
xfree(screen->driver);
|
xfree(screen->driver);
|
||||||
screen->driver = NULL;
|
screen->driver = NULL;
|
||||||
|
@ -1027,7 +1027,7 @@ ephyrCardFini (KdCardInfo *card)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
ephyrGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
|
||||||
{
|
{
|
||||||
/* XXX Not sure if this is right */
|
/* XXX Not sure if this is right */
|
||||||
|
|
||||||
|
@ -1044,7 +1044,7 @@ ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
ephyrPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
|
||||||
{
|
{
|
||||||
int min, max, p;
|
int min, max, p;
|
||||||
|
|
||||||
|
|
|
@ -116,10 +116,10 @@ void
|
||||||
ephyrCardFini (KdCardInfo *card);
|
ephyrCardFini (KdCardInfo *card);
|
||||||
|
|
||||||
void
|
void
|
||||||
ephyrGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
|
ephyrGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
|
||||||
|
|
||||||
void
|
void
|
||||||
ephyrPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
|
ephyrPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
ephyrMapFramebuffer (KdScreenInfo *screen);
|
ephyrMapFramebuffer (KdScreenInfo *screen);
|
||||||
|
|
|
@ -302,7 +302,7 @@ ephyrInitVideo (ScreenPtr pScreen)
|
||||||
|
|
||||||
EPHYR_LOG ("enter\n") ;
|
EPHYR_LOG ("enter\n") ;
|
||||||
|
|
||||||
if (screen->fb[0].bitsPerPixel == 8) {
|
if (screen->fb.bitsPerPixel == 8) {
|
||||||
EPHYR_LOG_ERROR ("8 bits depth not supported\n") ;
|
EPHYR_LOG_ERROR ("8 bits depth not supported\n") ;
|
||||||
return FALSE ;
|
return FALSE ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,45 +69,45 @@ fakeScreenInitialize (KdScreenInfo *screen, FakeScrPriv *scrpriv)
|
||||||
if (screen->height <= 0)
|
if (screen->height <= 0)
|
||||||
screen->height = 1;
|
screen->height = 1;
|
||||||
|
|
||||||
if (!screen->fb[0].depth)
|
if (!screen->fb.depth)
|
||||||
screen->fb[0].depth = 16;
|
screen->fb.depth = 16;
|
||||||
|
|
||||||
if (screen->fb[0].depth <= 8)
|
if (screen->fb.depth <= 8)
|
||||||
{
|
{
|
||||||
screen->fb[0].visuals = ((1 << StaticGray) |
|
screen->fb.visuals = ((1 << StaticGray) |
|
||||||
(1 << GrayScale) |
|
(1 << GrayScale) |
|
||||||
(1 << StaticColor) |
|
(1 << StaticColor) |
|
||||||
(1 << PseudoColor) |
|
(1 << PseudoColor) |
|
||||||
(1 << TrueColor) |
|
(1 << TrueColor) |
|
||||||
(1 << DirectColor));
|
(1 << DirectColor));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen->fb[0].visuals = (1 << TrueColor);
|
screen->fb.visuals = (1 << TrueColor);
|
||||||
#define Mask(o,l) (((1 << l) - 1) << o)
|
#define Mask(o,l) (((1 << l) - 1) << o)
|
||||||
if (screen->fb[0].depth <= 15)
|
if (screen->fb.depth <= 15)
|
||||||
{
|
{
|
||||||
screen->fb[0].depth = 15;
|
screen->fb.depth = 15;
|
||||||
screen->fb[0].bitsPerPixel = 16;
|
screen->fb.bitsPerPixel = 16;
|
||||||
screen->fb[0].redMask = Mask (10, 5);
|
screen->fb.redMask = Mask (10, 5);
|
||||||
screen->fb[0].greenMask = Mask (5, 5);
|
screen->fb.greenMask = Mask (5, 5);
|
||||||
screen->fb[0].blueMask = Mask (0, 5);
|
screen->fb.blueMask = Mask (0, 5);
|
||||||
}
|
}
|
||||||
else if (screen->fb[0].depth <= 16)
|
else if (screen->fb.depth <= 16)
|
||||||
{
|
{
|
||||||
screen->fb[0].depth = 16;
|
screen->fb.depth = 16;
|
||||||
screen->fb[0].bitsPerPixel = 16;
|
screen->fb.bitsPerPixel = 16;
|
||||||
screen->fb[0].redMask = Mask (11, 5);
|
screen->fb.redMask = Mask (11, 5);
|
||||||
screen->fb[0].greenMask = Mask (5, 6);
|
screen->fb.greenMask = Mask (5, 6);
|
||||||
screen->fb[0].blueMask = Mask (0, 5);
|
screen->fb.blueMask = Mask (0, 5);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen->fb[0].depth = 24;
|
screen->fb.depth = 24;
|
||||||
screen->fb[0].bitsPerPixel = 32;
|
screen->fb.bitsPerPixel = 32;
|
||||||
screen->fb[0].redMask = Mask (16, 8);
|
screen->fb.redMask = Mask (16, 8);
|
||||||
screen->fb[0].greenMask = Mask (8, 8);
|
screen->fb.greenMask = Mask (8, 8);
|
||||||
screen->fb[0].blueMask = Mask (0, 8);
|
screen->fb.blueMask = Mask (0, 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,23 +167,22 @@ fakeMapFramebuffer (KdScreenInfo *screen)
|
||||||
|
|
||||||
KdSetPointerMatrix (&m);
|
KdSetPointerMatrix (&m);
|
||||||
|
|
||||||
priv->bytes_per_line = ((screen->width * screen->fb[0].bitsPerPixel + 31) >> 5) << 2;
|
priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2;
|
||||||
if (priv->base)
|
if (priv->base)
|
||||||
free (priv->base);
|
free (priv->base);
|
||||||
priv->base = malloc (priv->bytes_per_line * screen->height);
|
priv->base = malloc (priv->bytes_per_line * screen->height);
|
||||||
|
|
||||||
if (scrpriv->shadow)
|
if (scrpriv->shadow)
|
||||||
{
|
{
|
||||||
if (!KdShadowFbAlloc (screen, 0,
|
if (!KdShadowFbAlloc (screen, scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
|
||||||
scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen->fb[0].byteStride = priv->bytes_per_line;
|
screen->fb.byteStride = priv->bytes_per_line;
|
||||||
screen->fb[0].pixelStride = (priv->bytes_per_line * 8/
|
screen->fb.pixelStride = (priv->bytes_per_line * 8/
|
||||||
screen->fb[0].bitsPerPixel);
|
screen->fb.bitsPerPixel);
|
||||||
screen->fb[0].frameBuffer = (CARD8 *) (priv->base);
|
screen->fb.frameBuffer = (CARD8 *) (priv->base);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -216,7 +215,7 @@ Bool
|
||||||
fakeUnmapFramebuffer (KdScreenInfo *screen)
|
fakeUnmapFramebuffer (KdScreenInfo *screen)
|
||||||
{
|
{
|
||||||
FakePriv *priv = screen->card->driver;
|
FakePriv *priv = screen->card->driver;
|
||||||
KdShadowFbFree (screen, 0);
|
KdShadowFbFree (screen);
|
||||||
if (priv->base)
|
if (priv->base)
|
||||||
{
|
{
|
||||||
free (priv->base);
|
free (priv->base);
|
||||||
|
@ -338,10 +337,10 @@ fakeRandRSetConfig (ScreenPtr pScreen,
|
||||||
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
||||||
pScreen->width,
|
pScreen->width,
|
||||||
pScreen->height,
|
pScreen->height,
|
||||||
screen->fb[0].depth,
|
screen->fb.depth,
|
||||||
screen->fb[0].bitsPerPixel,
|
screen->fb.bitsPerPixel,
|
||||||
screen->fb[0].byteStride,
|
screen->fb.byteStride,
|
||||||
screen->fb[0].frameBuffer);
|
screen->fb.frameBuffer);
|
||||||
|
|
||||||
/* set the subpixel order */
|
/* set the subpixel order */
|
||||||
|
|
||||||
|
@ -460,7 +459,7 @@ fakeCardFini (KdCardInfo *card)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
fakeGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
|
||||||
{
|
{
|
||||||
while (n--)
|
while (n--)
|
||||||
{
|
{
|
||||||
|
@ -472,6 +471,6 @@ fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fakePutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
fakePutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,10 +85,10 @@ void
|
||||||
fakeCardFini (KdCardInfo *card);
|
fakeCardFini (KdCardInfo *card);
|
||||||
|
|
||||||
void
|
void
|
||||||
fakeGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
|
fakeGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
|
||||||
|
|
||||||
void
|
void
|
||||||
fakePutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
|
fakePutColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
fakeMapFramebuffer (KdScreenInfo *screen);
|
fakeMapFramebuffer (KdScreenInfo *screen);
|
||||||
|
|
|
@ -175,12 +175,12 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
|
||||||
}
|
}
|
||||||
screen->rate = 103; /* FIXME: should get proper value from fb driver */
|
screen->rate = 103; /* FIXME: should get proper value from fb driver */
|
||||||
}
|
}
|
||||||
if (!screen->fb[0].depth)
|
if (!screen->fb.depth)
|
||||||
{
|
{
|
||||||
if (k >= 0)
|
if (k >= 0)
|
||||||
screen->fb[0].depth = var.bits_per_pixel;
|
screen->fb.depth = var.bits_per_pixel;
|
||||||
else
|
else
|
||||||
screen->fb[0].depth = 16;
|
screen->fb.depth = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((screen->width != var.xres) || (screen->height != var.yres))
|
if ((screen->width != var.xres) || (screen->height != var.yres))
|
||||||
|
@ -196,7 +196,7 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
|
||||||
}
|
}
|
||||||
|
|
||||||
var.activate = FB_ACTIVATE_NOW;
|
var.activate = FB_ACTIVATE_NOW;
|
||||||
var.bits_per_pixel = screen->fb[0].depth;
|
var.bits_per_pixel = screen->fb.depth;
|
||||||
var.nonstd = 0;
|
var.nonstd = 0;
|
||||||
var.grayscale = 0;
|
var.grayscale = 0;
|
||||||
|
|
||||||
|
@ -222,60 +222,60 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
|
||||||
case FB_VISUAL_PSEUDOCOLOR:
|
case FB_VISUAL_PSEUDOCOLOR:
|
||||||
if (gray)
|
if (gray)
|
||||||
{
|
{
|
||||||
screen->fb[0].visuals = (1 << StaticGray);
|
screen->fb.visuals = (1 << StaticGray);
|
||||||
/* could also support GrayScale, but what's the point? */
|
/* could also support GrayScale, but what's the point? */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen->fb[0].visuals = ((1 << StaticGray) |
|
screen->fb.visuals = ((1 << StaticGray) |
|
||||||
(1 << GrayScale) |
|
(1 << GrayScale) |
|
||||||
(1 << StaticColor) |
|
(1 << StaticColor) |
|
||||||
(1 << PseudoColor) |
|
(1 << PseudoColor) |
|
||||||
(1 << TrueColor) |
|
(1 << TrueColor) |
|
||||||
(1 << DirectColor));
|
(1 << DirectColor));
|
||||||
}
|
}
|
||||||
screen->fb[0].blueMask = 0x00;
|
screen->fb.blueMask = 0x00;
|
||||||
screen->fb[0].greenMask = 0x00;
|
screen->fb.greenMask = 0x00;
|
||||||
screen->fb[0].redMask = 0x00;
|
screen->fb.redMask = 0x00;
|
||||||
break;
|
break;
|
||||||
case FB_VISUAL_STATIC_PSEUDOCOLOR:
|
case FB_VISUAL_STATIC_PSEUDOCOLOR:
|
||||||
if (gray)
|
if (gray)
|
||||||
{
|
{
|
||||||
screen->fb[0].visuals = (1 << StaticGray);
|
screen->fb.visuals = (1 << StaticGray);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen->fb[0].visuals = (1 << StaticColor);
|
screen->fb.visuals = (1 << StaticColor);
|
||||||
}
|
}
|
||||||
screen->fb[0].blueMask = 0x00;
|
screen->fb.blueMask = 0x00;
|
||||||
screen->fb[0].greenMask = 0x00;
|
screen->fb.greenMask = 0x00;
|
||||||
screen->fb[0].redMask = 0x00;
|
screen->fb.redMask = 0x00;
|
||||||
break;
|
break;
|
||||||
case FB_VISUAL_TRUECOLOR:
|
case FB_VISUAL_TRUECOLOR:
|
||||||
case FB_VISUAL_DIRECTCOLOR:
|
case FB_VISUAL_DIRECTCOLOR:
|
||||||
screen->fb[0].visuals = (1 << TrueColor);
|
screen->fb.visuals = (1 << TrueColor);
|
||||||
#define Mask(o,l) (((1 << l) - 1) << o)
|
#define Mask(o,l) (((1 << l) - 1) << o)
|
||||||
screen->fb[0].redMask = Mask (priv->var.red.offset, priv->var.red.length);
|
screen->fb.redMask = Mask (priv->var.red.offset, priv->var.red.length);
|
||||||
screen->fb[0].greenMask = Mask (priv->var.green.offset, priv->var.green.length);
|
screen->fb.greenMask = Mask (priv->var.green.offset, priv->var.green.length);
|
||||||
screen->fb[0].blueMask = Mask (priv->var.blue.offset, priv->var.blue.length);
|
screen->fb.blueMask = Mask (priv->var.blue.offset, priv->var.blue.length);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a kludge so that Render will work -- fill in the gaps
|
* This is a kludge so that Render will work -- fill in the gaps
|
||||||
* in the pixel
|
* in the pixel
|
||||||
*/
|
*/
|
||||||
screen->fb[0].redMask = fbdevMakeContig (screen->fb[0].redMask,
|
screen->fb.redMask = fbdevMakeContig (screen->fb.redMask,
|
||||||
screen->fb[0].greenMask|
|
screen->fb.greenMask|
|
||||||
screen->fb[0].blueMask);
|
screen->fb.blueMask);
|
||||||
|
|
||||||
screen->fb[0].greenMask = fbdevMakeContig (screen->fb[0].greenMask,
|
screen->fb.greenMask = fbdevMakeContig (screen->fb.greenMask,
|
||||||
screen->fb[0].redMask|
|
screen->fb.redMask|
|
||||||
screen->fb[0].blueMask);
|
screen->fb.blueMask);
|
||||||
|
|
||||||
screen->fb[0].blueMask = fbdevMakeContig (screen->fb[0].blueMask,
|
screen->fb.blueMask = fbdevMakeContig (screen->fb.blueMask,
|
||||||
screen->fb[0].redMask|
|
screen->fb.redMask|
|
||||||
screen->fb[0].greenMask);
|
screen->fb.greenMask);
|
||||||
|
|
||||||
allbits = screen->fb[0].redMask | screen->fb[0].greenMask | screen->fb[0].blueMask;
|
allbits = screen->fb.redMask | screen->fb.greenMask | screen->fb.blueMask;
|
||||||
depth = 32;
|
depth = 32;
|
||||||
while (depth && !(allbits & (1 << (depth - 1))))
|
while (depth && !(allbits & (1 << (depth - 1))))
|
||||||
depth--;
|
depth--;
|
||||||
|
@ -284,8 +284,8 @@ fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
screen->fb[0].depth = depth;
|
screen->fb.depth = depth;
|
||||||
screen->fb[0].bitsPerPixel = priv->var.bits_per_pixel;
|
screen->fb.bitsPerPixel = priv->var.bits_per_pixel;
|
||||||
|
|
||||||
scrpriv->randr = screen->randr;
|
scrpriv->randr = screen->randr;
|
||||||
|
|
||||||
|
@ -348,16 +348,16 @@ fbdevMapFramebuffer (KdScreenInfo *screen)
|
||||||
|
|
||||||
if (scrpriv->shadow)
|
if (scrpriv->shadow)
|
||||||
{
|
{
|
||||||
if (!KdShadowFbAlloc (screen, 0,
|
if (!KdShadowFbAlloc (screen,
|
||||||
scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
|
scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen->fb[0].byteStride = priv->fix.line_length;
|
screen->fb.byteStride = priv->fix.line_length;
|
||||||
screen->fb[0].pixelStride = (priv->fix.line_length * 8 /
|
screen->fb.pixelStride = (priv->fix.line_length * 8 /
|
||||||
priv->var.bits_per_pixel);
|
priv->var.bits_per_pixel);
|
||||||
screen->fb[0].frameBuffer = (CARD8 *) (priv->fb);
|
screen->fb.frameBuffer = (CARD8 *) (priv->fb);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -390,7 +390,7 @@ fbdevSetScreenSizes (ScreenPtr pScreen)
|
||||||
Bool
|
Bool
|
||||||
fbdevUnmapFramebuffer (KdScreenInfo *screen)
|
fbdevUnmapFramebuffer (KdScreenInfo *screen)
|
||||||
{
|
{
|
||||||
KdShadowFbFree (screen, 0);
|
KdShadowFbFree (screen);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -538,10 +538,10 @@ fbdevRandRSetConfig (ScreenPtr pScreen,
|
||||||
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
(*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen),
|
||||||
pScreen->width,
|
pScreen->width,
|
||||||
pScreen->height,
|
pScreen->height,
|
||||||
screen->fb[0].depth,
|
screen->fb.depth,
|
||||||
screen->fb[0].bitsPerPixel,
|
screen->fb.bitsPerPixel,
|
||||||
screen->fb[0].byteStride,
|
screen->fb.byteStride,
|
||||||
screen->fb[0].frameBuffer);
|
screen->fb.frameBuffer);
|
||||||
|
|
||||||
/* set the subpixel order */
|
/* set the subpixel order */
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ fbdevCreateColormap (ColormapPtr pmap)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
for (i = 0; i < nent; i++)
|
for (i = 0; i < nent; i++)
|
||||||
pdefs[i].pixel = i;
|
pdefs[i].pixel = i;
|
||||||
fbdevGetColors (pScreen, 0, nent, pdefs);
|
fbdevGetColors (pScreen, nent, pdefs);
|
||||||
for (i = 0; i < nent; i++)
|
for (i = 0; i < nent; i++)
|
||||||
{
|
{
|
||||||
pmap->red[i].co.local.red = pdefs[i].red;
|
pmap->red[i].co.local.red = pdefs[i].red;
|
||||||
|
@ -745,7 +745,7 @@ fbdevCardFini (KdCardInfo *card)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
FbdevPriv *priv = pScreenPriv->card->driver;
|
FbdevPriv *priv = pScreenPriv->card->driver;
|
||||||
|
@ -786,7 +786,7 @@ fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs)
|
fbdevPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
FbdevPriv *priv = pScreenPriv->card->driver;
|
FbdevPriv *priv = pScreenPriv->card->driver;
|
||||||
|
|
|
@ -94,10 +94,10 @@ void
|
||||||
fbdevCardFini (KdCardInfo *card);
|
fbdevCardFini (KdCardInfo *card);
|
||||||
|
|
||||||
void
|
void
|
||||||
fbdevGetColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
|
fbdevGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
|
||||||
|
|
||||||
void
|
void
|
||||||
fbdevPutColors (ScreenPtr pScreen, int fb, int n, xColorItem *pdefs);
|
fbdevPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
fbdevMapFramebuffer (KdScreenInfo *screen);
|
fbdevMapFramebuffer (KdScreenInfo *screen);
|
||||||
|
|
|
@ -15,7 +15,6 @@ endif
|
||||||
libkdrive_la_SOURCES = \
|
libkdrive_la_SOURCES = \
|
||||||
fourcc.h \
|
fourcc.h \
|
||||||
kcmap.c \
|
kcmap.c \
|
||||||
kcurscol.c \
|
|
||||||
kdrive.c \
|
kdrive.c \
|
||||||
kdrive.h \
|
kdrive.h \
|
||||||
kinfo.c \
|
kinfo.c \
|
||||||
|
|
|
@ -30,10 +30,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
KdSetColormap (ScreenPtr pScreen, int fb)
|
KdSetColormap (ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
ColormapPtr pCmap = pScreenPriv->pInstalledmap[fb];
|
ColormapPtr pCmap = pScreenPriv->pInstalledmap;
|
||||||
Pixel pixels[KD_MAX_PSEUDO_SIZE];
|
Pixel pixels[KD_MAX_PSEUDO_SIZE];
|
||||||
xrgb colors[KD_MAX_PSEUDO_SIZE];
|
xrgb colors[KD_MAX_PSEUDO_SIZE];
|
||||||
xColorItem defs[KD_MAX_PSEUDO_SIZE];
|
xColorItem defs[KD_MAX_PSEUDO_SIZE];
|
||||||
|
@ -41,7 +41,7 @@ KdSetColormap (ScreenPtr pScreen, int fb)
|
||||||
|
|
||||||
if (!pScreenPriv->card->cfuncs->putColors)
|
if (!pScreenPriv->card->cfuncs->putColors)
|
||||||
return;
|
return;
|
||||||
if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
|
if (pScreenPriv->screen->fb.depth > KD_MAX_PSEUDO_DEPTH)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pScreenPriv->enabled)
|
if (!pScreenPriv->enabled)
|
||||||
|
@ -55,12 +55,12 @@ KdSetColormap (ScreenPtr pScreen, int fb)
|
||||||
* true/direct as well as pseudo/static visuals
|
* true/direct as well as pseudo/static visuals
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
|
for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
|
||||||
pixels[i] = i;
|
pixels[i] = i;
|
||||||
|
|
||||||
QueryColors (pCmap, (1 << pScreenPriv->screen->fb[fb].depth), pixels, colors);
|
QueryColors (pCmap, (1 << pScreenPriv->screen->fb.depth), pixels, colors);
|
||||||
|
|
||||||
for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
|
for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
|
||||||
{
|
{
|
||||||
defs[i].pixel = i;
|
defs[i].pixel = i;
|
||||||
defs[i].red = colors[i].red;
|
defs[i].red = colors[i].red;
|
||||||
|
@ -69,8 +69,8 @@ KdSetColormap (ScreenPtr pScreen, int fb)
|
||||||
defs[i].flags = DoRed|DoGreen|DoBlue;
|
defs[i].flags = DoRed|DoGreen|DoBlue;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb,
|
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen,
|
||||||
(1 << pScreenPriv->screen->fb[fb].depth),
|
(1 << pScreenPriv->screen->fb.depth),
|
||||||
defs);
|
defs);
|
||||||
|
|
||||||
/* recolor hardware cursor */
|
/* recolor hardware cursor */
|
||||||
|
@ -87,77 +87,35 @@ KdEnableColormap (ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
int i;
|
int i;
|
||||||
int fb;
|
|
||||||
Bool done = FALSE;
|
|
||||||
|
|
||||||
if (!pScreenPriv->card->cfuncs->putColors)
|
if (!pScreenPriv->card->cfuncs->putColors)
|
||||||
return;
|
return;
|
||||||
for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
|
|
||||||
|
if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH)
|
||||||
{
|
{
|
||||||
if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH && !done)
|
for (i = 0; i < (1 << pScreenPriv->screen->fb.depth); i++)
|
||||||
{
|
pScreenPriv->systemPalette[i].pixel = i;
|
||||||
for (i = 0; i < (1 << pScreenPriv->screen->fb[fb].depth); i++)
|
(*pScreenPriv->card->cfuncs->getColors) (pScreen,
|
||||||
pScreenPriv->systemPalette[i].pixel = i;
|
(1 << pScreenPriv->screen->fb.depth),
|
||||||
(*pScreenPriv->card->cfuncs->getColors) (pScreen, fb,
|
pScreenPriv->systemPalette);
|
||||||
(1 << pScreenPriv->screen->fb[fb].depth),
|
|
||||||
pScreenPriv->systemPalette);
|
|
||||||
done = TRUE;
|
|
||||||
}
|
|
||||||
KdSetColormap (pScreen, fb);
|
|
||||||
}
|
}
|
||||||
|
KdSetColormap (pScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
KdDisableColormap (ScreenPtr pScreen)
|
KdDisableColormap (ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
int fb;
|
|
||||||
|
|
||||||
if (!pScreenPriv->card->cfuncs->putColors)
|
if (!pScreenPriv->card->cfuncs->putColors)
|
||||||
return;
|
return;
|
||||||
for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
|
|
||||||
{
|
|
||||||
if (pScreenPriv->screen->fb[fb].depth <= KD_MAX_PSEUDO_DEPTH)
|
|
||||||
{
|
|
||||||
(*pScreenPriv->card->cfuncs->putColors) (pScreen, fb,
|
|
||||||
(1 << pScreenPriv->screen->fb[fb].depth),
|
|
||||||
pScreenPriv->systemPalette);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
if (pScreenPriv->screen->fb.depth <= KD_MAX_PSEUDO_DEPTH)
|
||||||
KdColormapFb (ColormapPtr pCmap)
|
|
||||||
{
|
|
||||||
ScreenPtr pScreen = pCmap->pScreen;
|
|
||||||
KdScreenPriv (pScreen);
|
|
||||||
KdScreenInfo *screen = pScreenPriv->screen;
|
|
||||||
int d;
|
|
||||||
DepthPtr depth;
|
|
||||||
int v;
|
|
||||||
VisualID vid = pCmap->pVisual->vid;
|
|
||||||
int fb;
|
|
||||||
|
|
||||||
if (screen->fb[1].depth)
|
|
||||||
{
|
{
|
||||||
for (d = 0; d < pScreen->numDepths; d++)
|
(*pScreenPriv->card->cfuncs->putColors) (pScreen,
|
||||||
{
|
(1 << pScreenPriv->screen->fb.depth),
|
||||||
depth = &pScreen->allowedDepths[d];
|
pScreenPriv->systemPalette);
|
||||||
for (v = 0; v < depth->numVids; v++)
|
|
||||||
{
|
|
||||||
if (depth->vids[v] == vid)
|
|
||||||
{
|
|
||||||
for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
|
|
||||||
{
|
|
||||||
if (depth->depth == screen->fb[fb].depth)
|
|
||||||
return fb;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -173,20 +131,19 @@ void
|
||||||
KdInstallColormap (ColormapPtr pCmap)
|
KdInstallColormap (ColormapPtr pCmap)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pCmap->pScreen);
|
KdScreenPriv(pCmap->pScreen);
|
||||||
int fb = KdColormapFb (pCmap);
|
|
||||||
|
|
||||||
if (pCmap == pScreenPriv->pInstalledmap[fb])
|
if (pCmap == pScreenPriv->pInstalledmap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Tell X clients that the installed colormap is going away. */
|
/* Tell X clients that the installed colormap is going away. */
|
||||||
if (pScreenPriv->pInstalledmap[fb])
|
if (pScreenPriv->pInstalledmap)
|
||||||
WalkTree(pScreenPriv->pInstalledmap[fb]->pScreen, TellLostMap,
|
WalkTree(pScreenPriv->pInstalledmap->pScreen, TellLostMap,
|
||||||
(pointer) &(pScreenPriv->pInstalledmap[fb]->mid));
|
(pointer) &(pScreenPriv->pInstalledmap->mid));
|
||||||
|
|
||||||
/* Take note of the new installed colorscreen-> */
|
/* Take note of the new installed colorscreen-> */
|
||||||
pScreenPriv->pInstalledmap[fb] = pCmap;
|
pScreenPriv->pInstalledmap = pCmap;
|
||||||
|
|
||||||
KdSetColormap (pCmap->pScreen, fb);
|
KdSetColormap (pCmap->pScreen);
|
||||||
|
|
||||||
/* Tell X clients of the new colormap */
|
/* Tell X clients of the new colormap */
|
||||||
WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid));
|
WalkTree(pCmap->pScreen, TellGainedMap, (pointer) &(pCmap->mid));
|
||||||
|
@ -203,12 +160,11 @@ void
|
||||||
KdUninstallColormap (ColormapPtr pCmap)
|
KdUninstallColormap (ColormapPtr pCmap)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pCmap->pScreen);
|
KdScreenPriv(pCmap->pScreen);
|
||||||
int fb = KdColormapFb (pCmap);
|
|
||||||
Colormap defMapID;
|
Colormap defMapID;
|
||||||
ColormapPtr defMap;
|
ColormapPtr defMap;
|
||||||
|
|
||||||
/* ignore if not installed */
|
/* ignore if not installed */
|
||||||
if (pCmap != pScreenPriv->pInstalledmap[fb])
|
if (pCmap != pScreenPriv->pInstalledmap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* ignore attempts to uninstall default colormap */
|
/* ignore attempts to uninstall default colormap */
|
||||||
|
@ -216,17 +172,17 @@ KdUninstallColormap (ColormapPtr pCmap)
|
||||||
if ((Colormap) pCmap->mid == defMapID)
|
if ((Colormap) pCmap->mid == defMapID)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* install default if on same fb */
|
/* install default */
|
||||||
dixLookupResourceByType((pointer *)&defMap, defMapID, RT_COLORMAP,
|
dixLookupResourceByType((pointer *)&defMap, defMapID, RT_COLORMAP,
|
||||||
serverClient, DixInstallAccess);
|
serverClient, DixInstallAccess);
|
||||||
if (defMap && KdColormapFb (defMap) == fb)
|
if (defMap)
|
||||||
(*pCmap->pScreen->InstallColormap)(defMap);
|
(*pCmap->pScreen->InstallColormap)(defMap);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* uninstall and clear colormap pointer */
|
/* uninstall and clear colormap pointer */
|
||||||
WalkTree(pCmap->pScreen, TellLostMap,
|
WalkTree(pCmap->pScreen, TellLostMap,
|
||||||
(pointer) &(pCmap->mid));
|
(pointer) &(pCmap->mid));
|
||||||
pScreenPriv->pInstalledmap[fb] = 0;
|
pScreenPriv->pInstalledmap = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,16 +190,12 @@ int
|
||||||
KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps)
|
KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
int fb;
|
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
for (fb = 0; fb < KD_MAX_FB && pScreenPriv->screen->fb[fb].depth; fb++)
|
if (pScreenPriv->pInstalledmap)
|
||||||
{
|
{
|
||||||
if (pScreenPriv->pInstalledmap[fb])
|
*pCmaps++ = pScreenPriv->pInstalledmap->mid;
|
||||||
{
|
n++;
|
||||||
*pCmaps++ = pScreenPriv->pInstalledmap[fb]->mid;
|
|
||||||
n++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
@ -261,15 +213,14 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
|
||||||
KdScreenPriv(pCmap->pScreen);
|
KdScreenPriv(pCmap->pScreen);
|
||||||
VisualPtr pVisual;
|
VisualPtr pVisual;
|
||||||
xColorItem expanddefs[KD_MAX_PSEUDO_SIZE];
|
xColorItem expanddefs[KD_MAX_PSEUDO_SIZE];
|
||||||
int fb = KdColormapFb (pCmap);
|
|
||||||
|
|
||||||
if (pCmap != pScreenPriv->pInstalledmap[fb])
|
if (pCmap != pScreenPriv->pInstalledmap)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pScreenPriv->card->cfuncs->putColors)
|
if (!pScreenPriv->card->cfuncs->putColors)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pScreenPriv->screen->fb[fb].depth > KD_MAX_PSEUDO_DEPTH)
|
if (pScreenPriv->screen->fb.depth > KD_MAX_PSEUDO_DEPTH)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pScreenPriv->enabled)
|
if (!pScreenPriv->enabled)
|
||||||
|
@ -287,7 +238,7 @@ KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs)
|
||||||
pdefs = expanddefs;
|
pdefs = expanddefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, fb, ndef, pdefs);
|
(*pScreenPriv->card->cfuncs->putColors) (pCmap->pScreen, ndef, pdefs);
|
||||||
|
|
||||||
/* recolor hardware cursor */
|
/* recolor hardware cursor */
|
||||||
if (pScreenPriv->card->cfuncs->recolorCursor)
|
if (pScreenPriv->card->cfuncs->recolorCursor)
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright © 1999 Keith Packard
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
* documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
* the above copyright notice appear in all copies and that both that
|
|
||||||
* copyright notice and this permission notice appear in supporting
|
|
||||||
* documentation, and that the name of Keith Packard not be used in
|
|
||||||
* advertising or publicity pertaining to distribution of the software without
|
|
||||||
* specific, written prior permission. Keith Packard makes no
|
|
||||||
* representations about the suitability of this software for any purpose. It
|
|
||||||
* is provided "as is" without express or implied warranty.
|
|
||||||
*
|
|
||||||
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
|
||||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
|
|
||||||
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
|
||||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
||||||
* PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <kdrive-config.h>
|
|
||||||
#endif
|
|
||||||
#include "kdrive.h"
|
|
||||||
#include "cursorstr.h"
|
|
||||||
|
|
||||||
static int
|
|
||||||
KdComputeCmapShift (unsigned long mask)
|
|
||||||
{
|
|
||||||
int shift;
|
|
||||||
unsigned long bit;
|
|
||||||
|
|
||||||
shift = 16;
|
|
||||||
bit = 0x80000000;
|
|
||||||
while (!(mask & bit))
|
|
||||||
{
|
|
||||||
shift--;
|
|
||||||
bit >>= 1;
|
|
||||||
}
|
|
||||||
return shift;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define Shift(v,d) ((d) < 0 ? ((v) >> (-d)) : ((v) << (d)))
|
|
||||||
|
|
||||||
void
|
|
||||||
KdAllocateCursorPixels (ScreenPtr pScreen,
|
|
||||||
int fb,
|
|
||||||
CursorPtr pCursor,
|
|
||||||
Pixel *source,
|
|
||||||
Pixel *mask)
|
|
||||||
{
|
|
||||||
xColorItem sourceColor, maskColor;
|
|
||||||
int r, g, b;
|
|
||||||
KdScreenPriv(pScreen);
|
|
||||||
|
|
||||||
if (pScreenPriv->screen->fb[fb].redMask)
|
|
||||||
{
|
|
||||||
|
|
||||||
r = KdComputeCmapShift (pScreenPriv->screen->fb[fb].redMask);
|
|
||||||
g = KdComputeCmapShift (pScreenPriv->screen->fb[fb].greenMask);
|
|
||||||
b = KdComputeCmapShift (pScreenPriv->screen->fb[fb].blueMask);
|
|
||||||
*source = ((Shift(pCursor->foreRed,r) & pScreenPriv->screen->fb[fb].redMask) |
|
|
||||||
(Shift(pCursor->foreGreen,g) & pScreenPriv->screen->fb[fb].greenMask) |
|
|
||||||
(Shift(pCursor->foreBlue,b) & pScreenPriv->screen->fb[fb].blueMask));
|
|
||||||
*mask = ((Shift(pCursor->backRed,r) & pScreenPriv->screen->fb[fb].redMask) |
|
|
||||||
(Shift(pCursor->backGreen,g) & pScreenPriv->screen->fb[fb].greenMask) |
|
|
||||||
(Shift(pCursor->backBlue,b) & pScreenPriv->screen->fb[fb].blueMask));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* Set these to an invalid pixel value so that
|
|
||||||
* when the store colors comes through, the cursor
|
|
||||||
* won't get recolored
|
|
||||||
*/
|
|
||||||
*source = ~0;
|
|
||||||
*mask = ~0;
|
|
||||||
|
|
||||||
sourceColor.red = pCursor->foreRed;
|
|
||||||
sourceColor.green = pCursor->foreGreen;
|
|
||||||
sourceColor.blue = pCursor->foreBlue;
|
|
||||||
FakeAllocColor(pScreenPriv->pInstalledmap[fb], &sourceColor);
|
|
||||||
maskColor.red = pCursor->backRed;
|
|
||||||
maskColor.green = pCursor->backGreen;
|
|
||||||
maskColor.blue = pCursor->backBlue;
|
|
||||||
FakeAllocColor(pScreenPriv->pInstalledmap[fb], &maskColor);
|
|
||||||
FakeFreeColor(pScreenPriv->pInstalledmap[fb], sourceColor.pixel);
|
|
||||||
FakeFreeColor(pScreenPriv->pInstalledmap[fb], maskColor.pixel);
|
|
||||||
*source = sourceColor.pixel;
|
|
||||||
*mask = maskColor.pixel;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -389,7 +389,6 @@ KdParseScreen (KdScreenInfo *screen,
|
||||||
{
|
{
|
||||||
char delim;
|
char delim;
|
||||||
char save[1024];
|
char save[1024];
|
||||||
int fb;
|
|
||||||
int i;
|
int i;
|
||||||
int pixels, mm;
|
int pixels, mm;
|
||||||
|
|
||||||
|
@ -403,8 +402,7 @@ KdParseScreen (KdScreenInfo *screen,
|
||||||
screen->height_mm = 0;
|
screen->height_mm = 0;
|
||||||
screen->subpixel_order = kdSubpixelOrder;
|
screen->subpixel_order = kdSubpixelOrder;
|
||||||
screen->rate = 0;
|
screen->rate = 0;
|
||||||
for (fb = 0; fb < KD_MAX_FB; fb++)
|
screen->fb.depth = 0;
|
||||||
screen->fb[fb].depth = 0;
|
|
||||||
if (!arg)
|
if (!arg)
|
||||||
return;
|
return;
|
||||||
if (strlen (arg) >= sizeof (save))
|
if (strlen (arg) >= sizeof (save))
|
||||||
|
@ -477,25 +475,18 @@ KdParseScreen (KdScreenInfo *screen,
|
||||||
screen->randr |= RR_Reflect_Y;
|
screen->randr |= RR_Reflect_Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
fb = 0;
|
arg = KdParseFindNext (arg, "x/,", save, &delim);
|
||||||
while (fb < KD_MAX_FB)
|
if (save[0])
|
||||||
{
|
{
|
||||||
arg = KdParseFindNext (arg, "x/,", save, &delim);
|
screen->fb.depth = atoi(save);
|
||||||
if (!save[0])
|
|
||||||
break;
|
|
||||||
screen->fb[fb].depth = atoi(save);
|
|
||||||
if (delim == '/')
|
if (delim == '/')
|
||||||
{
|
{
|
||||||
arg = KdParseFindNext (arg, "x,", save, &delim);
|
arg = KdParseFindNext (arg, "x,", save, &delim);
|
||||||
if (!save[0])
|
if (save[0])
|
||||||
break;
|
screen->fb.bitsPerPixel = atoi (save);
|
||||||
screen->fb[fb].bitsPerPixel = atoi (save);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
screen->fb[fb].bitsPerPixel = 0;
|
screen->fb.bitsPerPixel = 0;
|
||||||
if (delim != ',')
|
|
||||||
break;
|
|
||||||
fb++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (delim == 'x')
|
if (delim == 'x')
|
||||||
|
@ -919,7 +910,6 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
|
||||||
KdScreenInfo *screen = kdCurrentScreen;
|
KdScreenInfo *screen = kdCurrentScreen;
|
||||||
KdCardInfo *card = screen->card;
|
KdCardInfo *card = screen->card;
|
||||||
KdPrivScreenPtr pScreenPriv;
|
KdPrivScreenPtr pScreenPriv;
|
||||||
int fb;
|
|
||||||
/*
|
/*
|
||||||
* note that screen->fb is set up for the nominal orientation
|
* note that screen->fb is set up for the nominal orientation
|
||||||
* of the screen; that means if randr is rotated, the values
|
* of the screen; that means if randr is rotated, the values
|
||||||
|
@ -949,8 +939,7 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
|
||||||
screen->pScreen = pScreen;
|
screen->pScreen = pScreen;
|
||||||
pScreenPriv->screen = screen;
|
pScreenPriv->screen = screen;
|
||||||
pScreenPriv->card = card;
|
pScreenPriv->card = card;
|
||||||
for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
|
pScreenPriv->bytesPerPixel = screen->fb.bitsPerPixel >> 3;
|
||||||
pScreenPriv->bytesPerPixel[fb] = screen->fb[fb].bitsPerPixel >> 3;
|
|
||||||
pScreenPriv->dpmsState = KD_DPMS_NORMAL;
|
pScreenPriv->dpmsState = KD_DPMS_NORMAL;
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
dixScreenOrigins[pScreen->myNum] = screen->origin;
|
dixScreenOrigins[pScreen->myNum] = screen->origin;
|
||||||
|
@ -964,11 +953,11 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
|
||||||
* backing store
|
* backing store
|
||||||
*/
|
*/
|
||||||
if (!fbSetupScreen (pScreen,
|
if (!fbSetupScreen (pScreen,
|
||||||
screen->fb[0].frameBuffer,
|
screen->fb.frameBuffer,
|
||||||
width, height,
|
width, height,
|
||||||
monitorResolution, monitorResolution,
|
monitorResolution, monitorResolution,
|
||||||
screen->fb[0].pixelStride,
|
screen->fb.pixelStride,
|
||||||
screen->fb[0].bitsPerPixel))
|
screen->fb.bitsPerPixel))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -984,36 +973,14 @@ KdScreenInit(int index, ScreenPtr pScreen, int argc, char **argv)
|
||||||
pScreen->SaveScreen = KdSaveScreen;
|
pScreen->SaveScreen = KdSaveScreen;
|
||||||
pScreen->CreateWindow = KdCreateWindow;
|
pScreen->CreateWindow = KdCreateWindow;
|
||||||
|
|
||||||
#if KD_MAX_FB > 1
|
if (!fbFinishScreenInit (pScreen,
|
||||||
if (screen->fb[1].depth)
|
screen->fb.frameBuffer,
|
||||||
|
width, height,
|
||||||
|
monitorResolution, monitorResolution,
|
||||||
|
screen->fb.pixelStride,
|
||||||
|
screen->fb.bitsPerPixel))
|
||||||
{
|
{
|
||||||
if (!fbOverlayFinishScreenInit (pScreen,
|
return FALSE;
|
||||||
screen->fb[0].frameBuffer,
|
|
||||||
screen->fb[1].frameBuffer,
|
|
||||||
width, height,
|
|
||||||
monitorResolution, monitorResolution,
|
|
||||||
screen->fb[0].pixelStride,
|
|
||||||
screen->fb[1].pixelStride,
|
|
||||||
screen->fb[0].bitsPerPixel,
|
|
||||||
screen->fb[1].bitsPerPixel,
|
|
||||||
screen->fb[0].depth,
|
|
||||||
screen->fb[1].depth))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
if (!fbFinishScreenInit (pScreen,
|
|
||||||
screen->fb[0].frameBuffer,
|
|
||||||
width, height,
|
|
||||||
monitorResolution, monitorResolution,
|
|
||||||
screen->fb[0].pixelStride,
|
|
||||||
screen->fb[0].bitsPerPixel))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1143,7 +1110,6 @@ KdSetPixmapFormats (ScreenInfo *pScreenInfo)
|
||||||
KdScreenInfo *screen;
|
KdScreenInfo *screen;
|
||||||
int i;
|
int i;
|
||||||
int bpp;
|
int bpp;
|
||||||
int fb;
|
|
||||||
PixmapFormatRec *format;
|
PixmapFormatRec *format;
|
||||||
|
|
||||||
for (i = 1; i <= 32; i++)
|
for (i = 1; i <= 32; i++)
|
||||||
|
@ -1159,16 +1125,13 @@ KdSetPixmapFormats (ScreenInfo *pScreenInfo)
|
||||||
{
|
{
|
||||||
for (screen = card->screenList; screen; screen = screen->next)
|
for (screen = card->screenList; screen; screen = screen->next)
|
||||||
{
|
{
|
||||||
for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
|
bpp = screen->fb.bitsPerPixel;
|
||||||
{
|
if (bpp == 24)
|
||||||
bpp = screen->fb[fb].bitsPerPixel;
|
bpp = 32;
|
||||||
if (bpp == 24)
|
if (!depthToBpp[screen->fb.depth])
|
||||||
bpp = 32;
|
depthToBpp[screen->fb.depth] = bpp;
|
||||||
if (!depthToBpp[screen->fb[fb].depth])
|
else if (depthToBpp[screen->fb.depth] != bpp)
|
||||||
depthToBpp[screen->fb[fb].depth] = bpp;
|
return FALSE;
|
||||||
else if (depthToBpp[screen->fb[fb].depth] != bpp)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1214,20 +1177,15 @@ KdAddScreen (ScreenInfo *pScreenInfo,
|
||||||
{
|
{
|
||||||
unsigned long visuals;
|
unsigned long visuals;
|
||||||
Pixel rm, gm, bm;
|
Pixel rm, gm, bm;
|
||||||
int fb;
|
|
||||||
|
|
||||||
visuals = 0;
|
visuals = 0;
|
||||||
rm = gm = bm = 0;
|
rm = gm = bm = 0;
|
||||||
for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
|
if (pScreenInfo->formats[i].depth == screen->fb.depth)
|
||||||
{
|
{
|
||||||
if (pScreenInfo->formats[i].depth == screen->fb[fb].depth)
|
visuals = screen->fb.visuals;
|
||||||
{
|
rm = screen->fb.redMask;
|
||||||
visuals = screen->fb[fb].visuals;
|
gm = screen->fb.greenMask;
|
||||||
rm = screen->fb[fb].redMask;
|
bm = screen->fb.blueMask;
|
||||||
gm = screen->fb[fb].greenMask;
|
|
||||||
bm = screen->fb[fb].blueMask;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
|
fbSetVisualTypesAndMasks (pScreenInfo->formats[i].depth,
|
||||||
visuals,
|
visuals,
|
||||||
|
@ -1246,10 +1204,9 @@ int
|
||||||
KdDepthToFb (ScreenPtr pScreen, int depth)
|
KdDepthToFb (ScreenPtr pScreen, int depth)
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
int fb;
|
|
||||||
|
|
||||||
for (fb = 0; fb <= KD_MAX_FB && pScreenPriv->screen->fb[fb].frameBuffer; fb++)
|
for (fb = 0; fb <= KD_MAX_FB && pScreenPriv->screen->fb.frameBuffer; fb++)
|
||||||
if (pScreenPriv->screen->fb[fb].depth == depth)
|
if (pScreenPriv->screen->fb.depth == depth)
|
||||||
return fb;
|
return fb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,10 +53,6 @@
|
||||||
#define KD_DPMS_POWERDOWN 3
|
#define KD_DPMS_POWERDOWN 3
|
||||||
#define KD_DPMS_MAX KD_DPMS_POWERDOWN
|
#define KD_DPMS_MAX KD_DPMS_POWERDOWN
|
||||||
|
|
||||||
#ifndef KD_MAX_FB
|
|
||||||
#define KD_MAX_FB FB_OVERLAY_MAX
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define Status int
|
#define Status int
|
||||||
|
|
||||||
typedef struct _KdCardInfo {
|
typedef struct _KdCardInfo {
|
||||||
|
@ -106,7 +102,7 @@ typedef struct _KdScreenInfo {
|
||||||
Bool softCursor;
|
Bool softCursor;
|
||||||
int mynum;
|
int mynum;
|
||||||
DDXPointRec origin;
|
DDXPointRec origin;
|
||||||
KdFrameBuffer fb[KD_MAX_FB];
|
KdFrameBuffer fb;
|
||||||
} KdScreenInfo;
|
} KdScreenInfo;
|
||||||
|
|
||||||
typedef struct _KdCardFuncs {
|
typedef struct _KdCardFuncs {
|
||||||
|
@ -134,8 +130,8 @@ typedef struct _KdCardFuncs {
|
||||||
void (*disableAccel) (ScreenPtr);
|
void (*disableAccel) (ScreenPtr);
|
||||||
void (*finiAccel) (ScreenPtr);
|
void (*finiAccel) (ScreenPtr);
|
||||||
|
|
||||||
void (*getColors) (ScreenPtr, int, int, xColorItem *);
|
void (*getColors) (ScreenPtr, int, xColorItem *);
|
||||||
void (*putColors) (ScreenPtr, int, int, xColorItem *);
|
void (*putColors) (ScreenPtr, int, xColorItem *);
|
||||||
|
|
||||||
} KdCardFuncs;
|
} KdCardFuncs;
|
||||||
|
|
||||||
|
@ -148,11 +144,11 @@ typedef struct {
|
||||||
|
|
||||||
Bool enabled;
|
Bool enabled;
|
||||||
Bool closed;
|
Bool closed;
|
||||||
int bytesPerPixel[KD_MAX_FB];
|
int bytesPerPixel;
|
||||||
|
|
||||||
int dpmsState;
|
int dpmsState;
|
||||||
|
|
||||||
ColormapPtr pInstalledmap[KD_MAX_FB]; /* current colormap */
|
ColormapPtr pInstalledmap; /* current colormap */
|
||||||
xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */
|
xColorItem systemPalette[KD_MAX_PSEUDO_SIZE];/* saved windows colors */
|
||||||
|
|
||||||
CreateScreenResourcesProcPtr CreateScreenResources;
|
CreateScreenResourcesProcPtr CreateScreenResources;
|
||||||
|
@ -370,7 +366,7 @@ extern GCOps kdNoopOps;
|
||||||
|
|
||||||
/* kcmap.c */
|
/* kcmap.c */
|
||||||
void
|
void
|
||||||
KdSetColormap (ScreenPtr pScreen, int fb);
|
KdSetColormap (ScreenPtr pScreen);
|
||||||
|
|
||||||
void
|
void
|
||||||
KdEnableColormap (ScreenPtr pScreen);
|
KdEnableColormap (ScreenPtr pScreen);
|
||||||
|
@ -390,14 +386,6 @@ KdListInstalledColormaps (ScreenPtr pScreen, Colormap *pCmaps);
|
||||||
void
|
void
|
||||||
KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs);
|
KdStoreColors (ColormapPtr pCmap, int ndef, xColorItem *pdefs);
|
||||||
|
|
||||||
/* kcurscol.c */
|
|
||||||
void
|
|
||||||
KdAllocateCursorPixels (ScreenPtr pScreen,
|
|
||||||
int fb,
|
|
||||||
CursorPtr pCursor,
|
|
||||||
Pixel *source,
|
|
||||||
Pixel *mask);
|
|
||||||
|
|
||||||
/* kdrive.c */
|
/* kdrive.c */
|
||||||
extern miPointerScreenFuncRec kdPointerScreenFuncs;
|
extern miPointerScreenFuncRec kdPointerScreenFuncs;
|
||||||
|
|
||||||
|
@ -646,10 +634,10 @@ KdRandRGetTiming (ScreenPtr pScreen,
|
||||||
|
|
||||||
/* kshadow.c */
|
/* kshadow.c */
|
||||||
Bool
|
Bool
|
||||||
KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate);
|
KdShadowFbAlloc (KdScreenInfo *screen, Bool rotate);
|
||||||
|
|
||||||
void
|
void
|
||||||
KdShadowFbFree (KdScreenInfo *screen, int fb);
|
KdShadowFbFree (KdScreenInfo *screen);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window);
|
KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindowProc window);
|
||||||
|
|
|
@ -321,12 +321,10 @@ KdTuneMode (KdScreenInfo *screen,
|
||||||
/*
|
/*
|
||||||
* Fix requested depth and geometry until it works
|
* Fix requested depth and geometry until it works
|
||||||
*/
|
*/
|
||||||
if (screen->fb[1].depth)
|
if (screen->fb.depth > 16)
|
||||||
screen->fb[1].depth = 0;
|
screen->fb.depth = 16;
|
||||||
else if (screen->fb[0].depth > 16)
|
else if (screen->fb.depth > 8)
|
||||||
screen->fb[0].depth = 16;
|
screen->fb.depth = 8;
|
||||||
else if (screen->fb[0].depth > 8)
|
|
||||||
screen->fb[0].depth = 8;
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
t = kdFindPrevSize (KdFindMode (screen, supported));
|
t = kdFindPrevSize (KdFindMode (screen, supported));
|
||||||
|
|
|
@ -26,36 +26,36 @@
|
||||||
#include "kdrive.h"
|
#include "kdrive.h"
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
KdShadowFbAlloc (KdScreenInfo *screen, int fb, Bool rotate)
|
KdShadowFbAlloc (KdScreenInfo *screen, Bool rotate)
|
||||||
{
|
{
|
||||||
int paddedWidth;
|
int paddedWidth;
|
||||||
void *buf;
|
void *buf;
|
||||||
int width = rotate ? screen->height : screen->width;
|
int width = rotate ? screen->height : screen->width;
|
||||||
int height = rotate ? screen->width : screen->height;
|
int height = rotate ? screen->width : screen->height;
|
||||||
int bpp = screen->fb[fb].bitsPerPixel;
|
int bpp = screen->fb.bitsPerPixel;
|
||||||
|
|
||||||
/* use fb computation for width */
|
/* use fb computation for width */
|
||||||
paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
|
paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
|
||||||
buf = xalloc (paddedWidth * height);
|
buf = xalloc (paddedWidth * height);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (screen->fb[fb].shadow)
|
if (screen->fb.shadow)
|
||||||
xfree (screen->fb[fb].frameBuffer);
|
xfree (screen->fb.frameBuffer);
|
||||||
screen->fb[fb].shadow = TRUE;
|
screen->fb.shadow = TRUE;
|
||||||
screen->fb[fb].frameBuffer = buf;
|
screen->fb.frameBuffer = buf;
|
||||||
screen->fb[fb].byteStride = paddedWidth;
|
screen->fb.byteStride = paddedWidth;
|
||||||
screen->fb[fb].pixelStride = paddedWidth * 8 / bpp;
|
screen->fb.pixelStride = paddedWidth * 8 / bpp;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
KdShadowFbFree (KdScreenInfo *screen, int fb)
|
KdShadowFbFree (KdScreenInfo *screen)
|
||||||
{
|
{
|
||||||
if (screen->fb[fb].shadow)
|
if (screen->fb.shadow)
|
||||||
{
|
{
|
||||||
xfree (screen->fb[fb].frameBuffer);
|
xfree (screen->fb.frameBuffer);
|
||||||
screen->fb[fb].frameBuffer = 0;
|
screen->fb.frameBuffer = 0;
|
||||||
screen->fb[fb].shadow = FALSE;
|
screen->fb.shadow = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,14 +64,12 @@ KdShadowSet (ScreenPtr pScreen, int randr, ShadowUpdateProc update, ShadowWindow
|
||||||
{
|
{
|
||||||
KdScreenPriv(pScreen);
|
KdScreenPriv(pScreen);
|
||||||
KdScreenInfo *screen = pScreenPriv->screen;
|
KdScreenInfo *screen = pScreenPriv->screen;
|
||||||
int fb;
|
|
||||||
|
|
||||||
shadowRemove (pScreen, pScreen->GetScreenPixmap(pScreen));
|
shadowRemove (pScreen, pScreen->GetScreenPixmap(pScreen));
|
||||||
for (fb = 0; fb < KD_MAX_FB && screen->fb[fb].depth; fb++)
|
if(screen->fb.shadow)
|
||||||
{
|
{
|
||||||
if (screen->fb[fb].shadow)
|
return shadowAdd (pScreen, pScreen->GetScreenPixmap(pScreen),
|
||||||
return shadowAdd (pScreen, pScreen->GetScreenPixmap(pScreen),
|
update, window, randr, 0);
|
||||||
update, window, randr, 0);
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user