summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkem <kem>2002-11-15 18:14:45 +0000
committerkem <kem>2002-11-15 18:14:45 +0000
commit0c485deb4332a0e0720067b72eba42525a84594a (patch)
tree847254d32cd6bd2c7d23c3dd29464d53e1f7aaab
parent886a5d8b38d11814b1a0ee012395283af3dd6940 (diff)
Add offscreen and window optimization support to Render supportdmx-1-0-20021115-beta
-rw-r--r--xc/programs/Xserver/hw/dmx/dmxpict.c66
-rw-r--r--xc/programs/Xserver/hw/dmx/dmxpict.h2
-rw-r--r--xc/programs/Xserver/hw/dmx/dmxwindow.c40
-rw-r--r--xc/programs/Xserver/hw/dmx/dmxwindow.h34
4 files changed, 91 insertions, 51 deletions
diff --git a/xc/programs/Xserver/hw/dmx/dmxpict.c b/xc/programs/Xserver/hw/dmx/dmxpict.c
index 0c6eed2b9..507d36160 100644
--- a/xc/programs/Xserver/hw/dmx/dmxpict.c
+++ b/xc/programs/Xserver/hw/dmx/dmxpict.c
@@ -92,6 +92,26 @@ static Picture dmxDoCreatePicture(PicturePtr pPicture)
Drawable draw;
int i = 0;
+ if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV((WindowPtr)(pDraw));
+
+ if (!(draw = pWinPriv->window)) {
+ /* Window has not been created yet due to the window
+ * optimization. Delay picture creation until window is
+ * mapped.
+ */
+ pWinPriv->hasPict = TRUE;
+ return 0;
+ }
+ } else {
+ dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV((PixmapPtr)(pDraw));
+
+ if (!(draw = pPixPriv->pixmap)) {
+ /* FIXME: Zero width/height pixmap?? */
+ return 0;
+ }
+ }
+
while (++i) {
pFormat = XRenderFindFormat(dmxScreen->display, 0, 0, i);
if (!pFormat) break;
@@ -111,25 +131,22 @@ static Picture dmxDoCreatePicture(PicturePtr pPicture)
break;
}
- if (pPicture->pDrawable->type == DRAWABLE_WINDOW) {
- dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV((WindowPtr)(pDraw));
+ return XRenderCreatePicture(dmxScreen->display, draw, pFormat, 0, 0);
+}
- if (!(draw = pWinPriv->window)) {
- /* FIXME: Window has not been created/mapped yet?? */
- /* Force it with DMX_CREATE_AND_REALIZE_WINDOW()????? */
- /* Or, delay and handle it at lazy creation time????? */
- return 0;
- }
- } else {
- dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV((PixmapPtr)(pDraw));
+void dmxCreatePictureList(WindowPtr pWindow)
+{
+ PicturePtr pPicture = GetPictureWindow(pWindow);
- if (!(draw = pPixPriv->pixmap)) {
- /* FIXME: Zero width/height pixmap?? */
- return 0;
- }
- }
+ while (pPicture) {
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
- return XRenderCreatePicture(dmxScreen->display, draw, pFormat, 0, 0);
+ /* Create the picture for this window */
+ pPictPriv->pict = dmxDoCreatePicture(pPicture);
+ /* FIXME: Does ValidatePicture take care of the state changes?? */
+
+ pPicture = pPicture->pNext;
+ }
}
int dmxCreatePicture(PicturePtr pPicture)
@@ -155,6 +172,23 @@ int dmxCreatePicture(PicturePtr pPicture)
return ret;
}
+void dmxDestroyPictureList(WindowPtr pWindow)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ PicturePtr pPicture = GetPictureWindow(pWindow);
+
+ while (pPicture) {
+ dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture);
+ if (pPictPriv->pict) {
+ XRenderFreePicture(dmxScreen->display, pPictPriv->pict);
+ pPictPriv->pict = (Picture)0;
+ }
+
+ pPicture = pPicture->pNext;
+ }
+}
+
void dmxDestroyPicture(PicturePtr pPicture)
{
ScreenPtr pScreen = pPicture->pDrawable->pScreen;
diff --git a/xc/programs/Xserver/hw/dmx/dmxpict.h b/xc/programs/Xserver/hw/dmx/dmxpict.h
index 2cb43f6fd..a03a94a86 100644
--- a/xc/programs/Xserver/hw/dmx/dmxpict.h
+++ b/xc/programs/Xserver/hw/dmx/dmxpict.h
@@ -44,6 +44,8 @@ typedef struct _dmxPictPriv {
extern Bool dmxPictureInit(ScreenPtr pScreen,
PictFormatPtr formats, int nformats);
+extern void dmxCreatePictureList(WindowPtr pWindow);
+extern void dmxDestroyPictureList(WindowPtr pWindow);
extern int dmxCreatePicture(PicturePtr pPicture);
extern void dmxDestroyPicture(PicturePtr pPicture);
diff --git a/xc/programs/Xserver/hw/dmx/dmxwindow.c b/xc/programs/Xserver/hw/dmx/dmxwindow.c
index f7695ada5..85f092de4 100644
--- a/xc/programs/Xserver/hw/dmx/dmxwindow.c
+++ b/xc/programs/Xserver/hw/dmx/dmxwindow.c
@@ -38,6 +38,9 @@
#include "dmxpixmap.h"
#include "dmxcmap.h"
#include "dmxvisual.h"
+#ifdef RENDER
+#include "dmxpict.h"
+#endif
#include "windowstr.h"
@@ -145,7 +148,7 @@ static Window dmxCreateNonRootWindow(WindowPtr pWindow)
from ReparentWindow and the grandparent window has not yet been
created */
if (!parent) {
- DMX_CREATE_AND_REALIZE_WINDOW(pWindow->parent, FALSE);
+ dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
parent = pParentPriv->window;
}
@@ -185,6 +188,25 @@ static Window dmxCreateNonRootWindow(WindowPtr pWindow)
&attribs);
}
+void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync)
+{
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
+ DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum];
+ dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow);
+
+ pWinPriv->window = dmxCreateNonRootWindow(pWindow);
+ if (pWinPriv->restacked) dmxDoRestackWindow(pWindow);
+#ifdef SHAPE
+ if (pWinPriv->isShaped) dmxDoSetShape(pWindow);
+#endif
+#ifdef RENDER
+ if (pWinPriv->hasPict) dmxCreatePictureList(pWindow);
+#endif
+ if (pWinPriv->mapped) XMapWindow(dmxScreen->display,
+ pWinPriv->window);
+ if (doSync) dmxSync(dmxScreen, False);
+}
+
Bool dmxCreateWindow(WindowPtr pWindow)
{
ScreenPtr pScreen = pWindow->drawable.pScreen;
@@ -206,6 +228,9 @@ Bool dmxCreateWindow(WindowPtr pWindow)
#ifdef SHAPE
pWinPriv->isShaped = FALSE;
#endif
+#ifdef RENDER
+ pWinPriv->hasPict = FALSE;
+#endif
/* Only create the root window at this stage -- non-root windows are
created when they are mapped and are on-screen */
@@ -246,6 +271,9 @@ Bool dmxDestroyWindow(WindowPtr pWindow)
/* Destroy window on back-end server */
if (pWinPriv->window) {
+#if RENDER
+ dmxDestroyPictureList(pWindow);
+#endif
XDestroyWindow(dmxScreen->display, pWinPriv->window);
dmxSync(dmxScreen, False);
pWinPriv->window = (Window)0;
@@ -282,7 +310,7 @@ Bool dmxPositionWindow(WindowPtr pWindow, int x, int y)
/* If the window is now on-screen and it is mapped and it has not
been created yet, create it and map it */
if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
- DMX_CREATE_AND_REALIZE_WINDOW(pWindow, TRUE);
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
} else if (pWinPriv->window) {
/* Position window on back-end server */
m = CWX | CWY | CWWidth | CWHeight;
@@ -446,7 +474,7 @@ Bool dmxRealizeWindow(WindowPtr pWindow)
/* If the window hasn't been created and it's not offscreen, then
create it */
if (!pWinPriv->window && !pWinPriv->offscreen) {
- DMX_CREATE_AND_REALIZE_WINDOW(pWindow, FALSE);
+ dmxCreateAndRealizeWindow(pWindow, FALSE);
}
if (pWinPriv->window) {
@@ -672,7 +700,7 @@ void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
/* If the window is now on-screen and it is mapped and it has not
been created yet, create it and map it */
if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
- DMX_CREATE_AND_REALIZE_WINDOW(pWindow, TRUE);
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
} else if (pWinPriv->window) {
/* Move window on back-end server */
m = CWX | CWY | CWWidth | CWHeight;
@@ -714,7 +742,7 @@ void dmxResizeWindow(WindowPtr pWindow, int x, int y,
/* If the window is now on-screen and it is mapped and it has not
been created yet, create it and map it */
if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) {
- DMX_CREATE_AND_REALIZE_WINDOW(pWindow, TRUE);
+ dmxCreateAndRealizeWindow(pWindow, TRUE);
} else if (pWinPriv->window) {
/* Handle resizing on back-end server */
m = CWX | CWY | CWWidth | CWHeight;
@@ -745,7 +773,7 @@ void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent)
if (pWinPriv->window) {
if (!pParentPriv->window) {
- DMX_CREATE_AND_REALIZE_WINDOW(pWindow->parent, FALSE);
+ dmxCreateAndRealizeWindow(pWindow->parent, FALSE);
}
/* Handle reparenting on back-end server */
diff --git a/xc/programs/Xserver/hw/dmx/dmxwindow.h b/xc/programs/Xserver/hw/dmx/dmxwindow.h
index 417678d4d..f102f3383 100644
--- a/xc/programs/Xserver/hw/dmx/dmxwindow.h
+++ b/xc/programs/Xserver/hw/dmx/dmxwindow.h
@@ -48,11 +48,16 @@ typedef struct _dmxWinPriv {
#ifdef SHAPE
Bool isShaped;
#endif
+#ifdef RENDER
+ Bool hasPict;
+#endif
} dmxWinPrivRec, *dmxWinPrivPtr;
extern Bool dmxInitWindow(ScreenPtr pScreen);
+extern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync);
+
extern Bool dmxCreateWindow(WindowPtr pWindow);
extern Bool dmxDestroyWindow(WindowPtr pWindow);
extern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y);
@@ -122,33 +127,4 @@ do { \
DMX_WINDOW_X2(_pWin) <= 0 || \
DMX_WINDOW_Y2(_pWin) <= 0)
-#ifdef SHAPE
-#define DMX_CREATE_AND_REALIZE_WINDOW(_pWin, _doSync) \
-do { \
- ScreenPtr _pScreen = (_pWin)->drawable.pScreen; \
- DMXScreenInfo *_dmxScreen = &dmxScreens[_pScreen->myNum]; \
- dmxWinPrivPtr _pWinPriv = DMX_GET_WINDOW_PRIV(_pWin); \
- \
- _pWinPriv->window = dmxCreateNonRootWindow(_pWin); \
- if (_pWinPriv->restacked) dmxDoRestackWindow(_pWin); \
- if (_pWinPriv->isShaped) dmxDoSetShape(_pWin); \
- if (_pWinPriv->mapped) XMapWindow(_dmxScreen->display, \
- _pWinPriv->window); \
- if (_doSync) dmxSync(_dmxScreen, False); \
-} while (0)
-#else
-#define DMX_CREATE_AND_REALIZE_WINDOW(_pWin, _doSync) \
-do { \
- ScreenPtr _pScreen = (_pWin)->drawable.pScreen; \
- DMXScreenInfo *_dmxScreen = &dmxScreens[_pScreen->myNum]; \
- dmxWinPrivPtr _pWinPriv = DMX_GET_WINDOW_PRIV(_pWin); \
- \
- _pWinPriv->window = dmxCreateNonRootWindow(_pWin); \
- if (_pWinPriv->restacked) dmxDoRestackWindow(_pWin); \
- if (_pWinPriv->mapped) XMapWindow(_dmxScreen->display, \
- _pWinPriv->window); \
- if (_doSync) dmxSync(_dmxScreen, False); \
-} while (0)
-#endif
-
#endif /* DMXWINDOW_H */