xserver: Branch 'master' - 3 commits
Michel Daenzer
daenzer at kemper.freedesktop.org
Tue Feb 20 20:22:30 EET 2007
hw/xfree86/dri/dri.c | 135 +++++++++++++++++++++++++++++++++++++--------
hw/xfree86/dri/dri.h | 5 +
hw/xfree86/dri/dristruct.h | 3 +
3 files changed, 118 insertions(+), 25 deletions(-)
New commits:
diff-tree 3344a4eda704edc7dc30037f095de277a60a70bb (from 3c7a27dc77595ad018bb7c4f7cef6bc178268cb6)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Thu Feb 15 16:27:50 2007 +0100
DRI: Make sure number of DRI windows is accurate in driver ClipNotify hook.
Always call DRI{De,In}creaseNumberVisible (which in turn calls
DRIDriverClipNotify) after updating pDRIPriv->nrWindows.
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index bdef75a..c183e2a 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -1134,11 +1134,11 @@ DRICreateDrawable(ScreenPtr pScreen, Dra
pWin->devPrivates[DRIWindowPrivIndex].ptr =
(pointer)pDRIDrawablePriv;
+ pDRIPriv->nrWindows++;
+
if (pDRIDrawablePriv->nrects)
DRIIncreaseNumberVisible(pScreen);
- pDRIPriv->nrWindows++;
-
/* track this in case this window is destroyed */
AddResource(id, DRIDrawablePrivResType, (pointer)pWin);
}
@@ -1210,13 +1210,13 @@ DRIDrawablePrivDelete(pointer pResource,
return FALSE;
}
- if (pDRIDrawablePriv->nrects)
- DRIDecreaseNumberVisible(pDrawable->pScreen);
-
xfree(pDRIDrawablePriv);
pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL;
pDRIPriv->nrWindows--;
+
+ if (REGION_NUM_RECTS(&pWin->clipList))
+ DRIDecreaseNumberVisible(pDrawable->pScreen);
}
else { /* pixmap (or for GLX 1.3, a PBuffer) */
/* NOT_DONE */
diff-tree 3c7a27dc77595ad018bb7c4f7cef6bc178268cb6 (from eedf148e5a1273ebbf4dc8dcac9c435712fc00ea)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Wed Feb 14 16:17:18 2007 +0100
DRI: New ClipNotify driver hook.
The hook is called whenever the clipList of any DRI window changes, be it via
DRIClipNotify, DRICreateDrawable or DRIDrawablePrivDelete. This allows the
driver to keep track of which DRI windows are visible where.
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index ebfe28b..bdef75a 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -1007,6 +1007,55 @@ DRITransitionTo2d(ScreenPtr pScreen)
}
+static int
+DRIDCNTreeTraversal(WindowPtr pWin, pointer data)
+{
+ DRIDrawablePrivPtr pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin);
+
+ if (pDRIDrawablePriv) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (REGION_NUM_RECTS(&pWin->clipList) > 0) {
+ WindowPtr *pDRIWindows = (WindowPtr*)data;
+ int i = 0;
+
+ while (pDRIWindows[i])
+ i++;
+
+ pDRIWindows[i] = pWin;
+
+ pDRIPriv->nrWalked++;
+ }
+
+ if (pDRIPriv->nrWindows == pDRIPriv->nrWalked)
+ return WT_STOPWALKING;
+ }
+
+ return WT_WALKCHILDREN;
+}
+
+static void
+DRIDriverClipNotify(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ if (pDRIPriv->pDriverInfo->ClipNotify) {
+ WindowPtr *pDRIWindows = xcalloc(sizeof(WindowPtr), pDRIPriv->nrWindows);
+ DRIInfoPtr pDRIInfo = pDRIPriv->pDriverInfo;
+
+ if (pDRIPriv->nrWindows > 0) {
+ pDRIPriv->nrWalked = 0;
+ TraverseTree(WindowTable[pScreen->myNum], DRIDCNTreeTraversal,
+ (pointer)pDRIWindows);
+ }
+
+ pDRIInfo->ClipNotify(pScreen, pDRIWindows, pDRIPriv->nrWindows);
+
+ xfree(pDRIWindows);
+ }
+}
+
static void
DRIIncreaseNumberVisible(ScreenPtr pScreen)
{
@@ -1022,6 +1071,8 @@ DRIIncreaseNumberVisible(ScreenPtr pScre
default:
break;
}
+
+ DRIDriverClipNotify(pScreen);
}
static void
@@ -1039,6 +1090,8 @@ DRIDecreaseNumberVisible(ScreenPtr pScre
default:
break;
}
+
+ DRIDriverClipNotify(pScreen);
}
Bool
@@ -1880,6 +1933,8 @@ DRIClipNotify(WindowPtr pWin, int dx, in
DRIIncreaseNumberVisible(pScreen);
else if (!nrects && pDRIDrawablePriv->nrects)
DRIDecreaseNumberVisible(pScreen);
+ else
+ DRIDriverClipNotify(pScreen);
pDRIDrawablePriv->nrects = nrects;
diff --git a/hw/xfree86/dri/dri.h b/hw/xfree86/dri/dri.h
index dca0edd..f65c571 100644
--- a/hw/xfree86/dri/dri.h
+++ b/hw/xfree86/dri/dri.h
@@ -107,7 +107,7 @@ typedef struct {
*/
#define DRIINFO_MAJOR_VERSION 5
-#define DRIINFO_MINOR_VERSION 0
+#define DRIINFO_MINOR_VERSION 1
#define DRIINFO_PATCH_VERSION 0
typedef struct {
@@ -173,6 +173,9 @@ typedef struct {
/* New with DRI version 4.1.0 */
void (*TransitionSingleToMulti3D)(ScreenPtr pScreen);
void (*TransitionMultiToSingle3D)(ScreenPtr pScreen);
+
+ /* New with DRI version 5.1.0 */
+ void (*ClipNotify)(ScreenPtr pScreen, WindowPtr *ppWin, int num);
} DRIInfoRec, *DRIInfoPtr;
diff --git a/hw/xfree86/dri/dristruct.h b/hw/xfree86/dri/dristruct.h
index 7579806..9c42ff9 100644
--- a/hw/xfree86/dri/dristruct.h
+++ b/hw/xfree86/dri/dristruct.h
@@ -89,6 +89,7 @@ typedef struct _DRIScreenPrivRec
DRIInfoPtr pDriverInfo;
int nrWindows;
int nrWindowsVisible;
+ int nrWalked;
drm_clip_rect_t private_buffer_rect; /* management of private buffers */
DrawablePtr fullscreen; /* pointer to fullscreen drawable */
drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
diff-tree eedf148e5a1273ebbf4dc8dcac9c435712fc00ea (from 8a42af6a935b1cf0e15102e986bb527f4fab31a8)
Author: Michel Dänzer <michel at tungstengraphics.com>
Date: Fri Feb 2 18:27:40 2007 +0100
Track number of visible DRI windows separately for transitions.
This allows e.g. doing page flipping with multiple DRI windows as long as
only one of them is visible.
diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c
index 5337f9a..ebfe28b 100644
--- a/hw/xfree86/dri/dri.c
+++ b/hw/xfree86/dri/dri.c
@@ -204,6 +204,7 @@ DRIScreenInit(ScreenPtr pScreen, DRIInfo
pDRIPriv->directRenderingSupport = TRUE;
pDRIPriv->pDriverInfo = pDRIInfo;
pDRIPriv->nrWindows = 0;
+ pDRIPriv->nrWindowsVisible = 0;
pDRIPriv->fullscreen = NULL;
pDRIPriv->createDummyCtx = pDRIInfo->createDummyCtx;
@@ -1006,6 +1007,40 @@ DRITransitionTo2d(ScreenPtr pScreen)
}
+static void
+DRIIncreaseNumberVisible(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ switch (++pDRIPriv->nrWindowsVisible) {
+ case 1:
+ DRITransitionTo3d( pScreen );
+ break;
+ case 2:
+ DRITransitionToSharedBuffers( pScreen );
+ break;
+ default:
+ break;
+ }
+}
+
+static void
+DRIDecreaseNumberVisible(ScreenPtr pScreen)
+{
+ DRIScreenPrivPtr pDRIPriv = DRI_SCREEN_PRIV(pScreen);
+
+ switch (--pDRIPriv->nrWindowsVisible) {
+ case 0:
+ DRITransitionTo2d( pScreen );
+ break;
+ case 1:
+ DRITransitionToPrivateBuffers( pScreen );
+ break;
+ default:
+ break;
+ }
+}
+
Bool
DRICreateDrawable(ScreenPtr pScreen, Drawable id,
DrawablePtr pDrawable, drm_drawable_t * hHWDrawable)
@@ -1040,21 +1075,16 @@ DRICreateDrawable(ScreenPtr pScreen, Dra
pDRIDrawablePriv->pScreen = pScreen;
pDRIDrawablePriv->refCount = 1;
pDRIDrawablePriv->drawableIndex = -1;
+ pDRIDrawablePriv->nrects = REGION_NUM_RECTS(&pWin->clipList);
/* save private off of preallocated index */
pWin->devPrivates[DRIWindowPrivIndex].ptr =
(pointer)pDRIDrawablePriv;
- switch (++pDRIPriv->nrWindows) {
- case 1:
- DRITransitionTo3d( pScreen );
- break;
- case 2:
- DRITransitionToSharedBuffers( pScreen );
- break;
- default:
- break;
- }
+ if (pDRIDrawablePriv->nrects)
+ DRIIncreaseNumberVisible(pScreen);
+
+ pDRIPriv->nrWindows++;
/* track this in case this window is destroyed */
AddResource(id, DRIDrawablePrivResType, (pointer)pWin);
@@ -1126,19 +1156,14 @@ DRIDrawablePrivDelete(pointer pResource,
pDRIDrawablePriv->hwDrawable)) {
return FALSE;
}
+
+ if (pDRIDrawablePriv->nrects)
+ DRIDecreaseNumberVisible(pDrawable->pScreen);
+
xfree(pDRIDrawablePriv);
pWin->devPrivates[DRIWindowPrivIndex].ptr = NULL;
- switch (--pDRIPriv->nrWindows) {
- case 0:
- DRITransitionTo2d( pDrawable->pScreen );
- break;
- case 1:
- DRITransitionToPrivateBuffers( pDrawable->pScreen );
- break;
- default:
- break;
- }
+ pDRIPriv->nrWindows--;
}
else { /* pixmap (or for GLX 1.3, a PBuffer) */
/* NOT_DONE */
@@ -1276,7 +1301,7 @@ DRIGetDrawableInfo(ScreenPtr pScreen,
*backX = *X;
*backY = *Y;
- if (pDRIPriv->nrWindows == 1 && *numClipRects) {
+ if (pDRIPriv->nrWindowsVisible == 1 && *numClipRects) {
/* Use a single cliprect. */
int x0 = *X;
@@ -1652,7 +1677,7 @@ DRICopyWindow(WindowPtr pWin, DDXPointRe
if(!pDRIPriv) return;
- if(pDRIPriv->nrWindows > 0) {
+ if(pDRIPriv->nrWindowsVisible > 0) {
RegionRec reg;
REGION_NULL(pScreen, ®);
@@ -1844,19 +1869,26 @@ DRIClipNotify(WindowPtr pWin, int dx, in
if(!pDRIPriv) return;
if ((pDRIDrawablePriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin))) {
+ int nrects = REGION_NUM_RECTS(&pWin->clipList);
if(!pDRIPriv->windowsTouched) {
DRILockTree(pScreen);
pDRIPriv->windowsTouched = TRUE;
}
+ if (nrects && !pDRIDrawablePriv->nrects)
+ DRIIncreaseNumberVisible(pScreen);
+ else if (!nrects && pDRIDrawablePriv->nrects)
+ DRIDecreaseNumberVisible(pScreen);
+
+ pDRIDrawablePriv->nrects = nrects;
+
pDRIPriv->pSAREA->drawableTable[pDRIDrawablePriv->drawableIndex].stamp
= DRIDrawableValidationStamp++;
drmUpdateDrawableInfo(pDRIPriv->drmFD, pDRIDrawablePriv->hwDrawable,
DRM_DRAWABLE_CLIPRECTS,
- REGION_NUM_RECTS(&pWin->clipList),
- REGION_RECTS(&pWin->clipList));
+ nrects, REGION_RECTS(&pWin->clipList));
}
/* call lower wrapped functions */
diff --git a/hw/xfree86/dri/dristruct.h b/hw/xfree86/dri/dristruct.h
index 340c59a..7579806 100644
--- a/hw/xfree86/dri/dristruct.h
+++ b/hw/xfree86/dri/dristruct.h
@@ -53,6 +53,7 @@ typedef struct _DRIDrawablePrivRec
int drawableIndex;
ScreenPtr pScreen;
int refCount;
+ int nrects;
} DRIDrawablePrivRec, *DRIDrawablePrivPtr;
struct _DRIContextPrivRec
@@ -87,6 +88,7 @@ typedef struct _DRIScreenPrivRec
void** partial3DContextStore; /* parital 3D context */
DRIInfoPtr pDriverInfo;
int nrWindows;
+ int nrWindowsVisible;
drm_clip_rect_t private_buffer_rect; /* management of private buffers */
DrawablePtr fullscreen; /* pointer to fullscreen drawable */
drm_clip_rect_t fullscreen_rect; /* fake rect for fullscreen mode */
More information about the xorg-commit
mailing list