Commit 1e728c3e authored by Keith Packard's avatar Keith Packard
Browse files

Copy bits from parent window when allocating pixmaps so that Background ==

    None works.
Copy filter to backing picture during validation.
Mark picture serialNumber when setting Filter or Transform so Validate
    occurs.
Initialize xf86Screens[i]->pScreen to NULL so that RADEON driver doesn't
    crash during server reset using old pScreen.
parent 94330851
......@@ -418,24 +418,58 @@ compUnredirectOneSubwindow (WindowPtr pParent, WindowPtr pWin)
return Success;
}
Bool
compAllocPixmap (WindowPtr pWin)
static PixmapPtr
compNewPixmap (WindowPtr pWin, int x, int y, int w, int h)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
WindowPtr pParent = pWin->parent;
PixmapPtr pPixmap;
int bw = (int) pWin->borderWidth;
int x, y, w, h;
CompWindowPtr cw = GetCompWindow (pWin);
GCPtr pGC;
x = pWin->drawable.x - bw;
y = pWin->drawable.y - bw;
w = pWin->drawable.width + (bw << 1);
h = pWin->drawable.height + (bw << 1);
pPixmap = (*pScreen->CreatePixmap) (pScreen, w, h, pWin->drawable.depth);
if (!pPixmap)
return FALSE;
return 0;
pPixmap->screen_x = x;
pPixmap->screen_y = y;
pGC = GetScratchGC (pWin->drawable.depth, pScreen);
/*
* Copy bits from the parent into the new pixmap so that it will
* have "reasonable" contents in case for background None areas.
*/
if (pGC)
{
XID val = IncludeInferiors;
ValidateGC(&pPixmap->drawable, pGC);
dixChangeGC (serverClient, pGC, GCSubwindowMode, &val, NULL);
(*pGC->ops->CopyArea) (&pParent->drawable,
&pPixmap->drawable,
pGC,
x - pParent->drawable.x,
y - pParent->drawable.y,
w, h, 0, 0);
FreeScratchGC (pGC);
}
return pPixmap;
}
Bool
compAllocPixmap (WindowPtr pWin)
{
int bw = (int) pWin->borderWidth;
int x = pWin->drawable.x - bw;
int y = pWin->drawable.y - bw;
int w = pWin->drawable.width + (bw << 1);
int h = pWin->drawable.height + (bw << 1);
PixmapPtr pPixmap = compNewPixmap (pWin, x, y, w, h);
CompWindowPtr cw = GetCompWindow (pWin);
if (!pPixmap)
return FALSE;
pWin->redirectDraw = TRUE;
compSetPixmap (pWin, pPixmap);
cw->oldx = COMP_ORIGIN_INVALID;
......@@ -490,42 +524,22 @@ compReallocPixmap (WindowPtr pWin, int draw_x, int draw_y,
PixmapPtr pNew;
CompWindowPtr cw = GetCompWindow (pWin);
int pix_x, pix_y;
unsigned int pix_w, pix_h;
int pix_w, pix_h;
assert (cw && pWin->redirectDraw);
cw->oldx = pOld->screen_x;
cw->oldy = pOld->screen_y;
pix_x = draw_x - bw;
pix_y = draw_y - bw;
pix_w = w + (bw << 1);
pix_h = h + (bw << 1);
cw->oldx = pOld->screen_x;
cw->oldy = pOld->screen_y;
if (pix_w != pOld->drawable.width ||
pix_h != pOld->drawable.height)
if (pix_w != pOld->drawable.width || pix_h != pOld->drawable.height)
{
GCPtr pGC;
pNew = (*pScreen->CreatePixmap) (pScreen, pix_w, pix_h, pWin->drawable.depth);
pNew = compNewPixmap (pWin, pix_x, pix_y, pix_w, pix_h);
if (!pNew)
return FALSE;
cw->pOldPixmap = pOld;
compSetPixmap (pWin, pNew);
/*
* Copy new bits to align at same place on the screen. CopyWindow
* calls will patch up any differences
*/
pGC = GetScratchGC (pNew->drawable.depth, pScreen);
if (pGC)
{
ValidateGC(&pNew->drawable, pGC);
(*pGC->ops->CopyArea) (&pOld->drawable,
&pNew->drawable,
pGC,
pWin->drawable.x - draw_x,
pWin->drawable.y - draw_y,
pix_w, pix_h,
0, 0);
FreeScratchGC (pGC);
}
}
else
{
......
......@@ -905,6 +905,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
xf86Screens[i]->LoadPalette = NULL;
xf86Screens[i]->SetOverscan = NULL;
xf86Screens[i]->RRFunc = NULL;
xf86Screens[i]->pScreen = NULL;
scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
if (scr_index == i) {
/*
......
......@@ -207,8 +207,22 @@ cwValidatePicture (PicturePtr pPicture,
pBackingPicture = pPicturePrivate->pBackingPicture;
/*
* Always copy transform and filters because there's no
* indication of when they've changed
*/
SetPictureTransform(pBackingPicture, pPicture->transform);
/* XXX Set filters */
if (pBackingPicture->filter != pPicture->filter ||
pPicture->filter_nparams > 0)
{
char *filter = PictureGetFilterName (pPicture->filter);
SetPictureFilter(pBackingPicture,
filter, strlen (filter),
pPicture->filter_params,
pPicture->filter_nparams);
}
pPicturePrivate->stateChanges |= mask;
......
......@@ -272,5 +272,6 @@ SetPictureFilter (PicturePtr pPicture, char *name, int len, xFixed *params, int
for (i = 0; i < nparams; i++)
pPicture->filter_params[i] = params[i];
pPicture->filter = pFilter->id;
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
return Success;
}
......@@ -1177,6 +1177,8 @@ SetPictureTransform (PicturePtr pPicture,
pPicture->transform = 0;
}
}
pPicture->serialNumber |= GC_CHANGE_SERIAL_BIT;
return Success;
}
......@@ -1188,6 +1190,7 @@ CopyPicture (PicturePtr pSrc,
PictureScreenPtr ps = GetPictureScreen(pSrc->pDrawable->pScreen);
Mask origMask = mask;
pDst->serialNumber |= GC_CHANGE_SERIAL_BIT;
pDst->stateChanges |= mask;
while (mask) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment