aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/common/xf86xv.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-05-05 09:43:03 +0000
committermarha <marha@users.sourceforge.net>2010-05-05 09:43:03 +0000
commit0874ae23a16946781dd517cfdb011c691ad0b581 (patch)
tree8de31864935e96a5e59b9fe6ceb12390bbc474cd /xorg-server/hw/xfree86/common/xf86xv.c
parentd059ebdcb012228102f0b64f8cddf9464d5b625a (diff)
downloadvcxsrv-0874ae23a16946781dd517cfdb011c691ad0b581.tar.gz
vcxsrv-0874ae23a16946781dd517cfdb011c691ad0b581.tar.bz2
vcxsrv-0874ae23a16946781dd517cfdb011c691ad0b581.zip
svn merge -r571:HEAD "^/branches/released" .
Diffstat (limited to 'xorg-server/hw/xfree86/common/xf86xv.c')
-rw-r--r--xorg-server/hw/xfree86/common/xf86xv.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/xorg-server/hw/xfree86/common/xf86xv.c b/xorg-server/hw/xfree86/common/xf86xv.c
index bdcc4fc2b..2cc2f6093 100644
--- a/xorg-server/hw/xfree86/common/xf86xv.c
+++ b/xorg-server/hw/xfree86/common/xf86xv.c
@@ -186,7 +186,9 @@ typedef struct {
int num;
} OffscreenImageRec;
-static OffscreenImageRec OffscreenImages[MAXSCREENS];
+static int OffscreenPrivateKeyIndex;
+static DevPrivateKey OffscreenPrivateKey = &OffscreenPrivateKeyIndex;
+#define GetOffscreenImage(pScreen) ((OffscreenImageRec *) dixLookupPrivate(&(pScreen)->devPrivates, OffscreenPrivateKey))
Bool
xf86XVRegisterOffscreenImages(
@@ -194,9 +196,18 @@ xf86XVRegisterOffscreenImages(
XF86OffscreenImagePtr images,
int num
){
- OffscreenImages[pScreen->myNum].num = num;
- OffscreenImages[pScreen->myNum].images = images;
-
+ OffscreenImageRec *OffscreenImage;
+ /* This function may be called before xf86XVScreenInit, so there's
+ * no better place than this to call dixRequestPrivate to ensure we
+ * have space reserved. After the first call it is a no-op. */
+ if(!dixRequestPrivate(OffscreenPrivateKey, sizeof(OffscreenImageRec)) ||
+ !(OffscreenImage = GetOffscreenImage(pScreen)))
+ /* Every X.org driver assumes this function always succeeds, so
+ * just die on allocation failure. */
+ FatalError("Could not allocate private storage for XV offscreen images.\n");
+
+ OffscreenImage->num = num;
+ OffscreenImage->images = images;
return TRUE;
}
@@ -205,8 +216,9 @@ xf86XVQueryOffscreenImages(
ScreenPtr pScreen,
int *num
){
- *num = OffscreenImages[pScreen->myNum].num;
- return OffscreenImages[pScreen->myNum].images;
+ OffscreenImageRec *OffscreenImage = GetOffscreenImage(pScreen);
+ *num = OffscreenImage->num;
+ return OffscreenImage->images;
}
@@ -1177,9 +1189,6 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen)
XvAdaptorPtr pa;
int c;
- /* Clear offscreen images */
- memset(&OffscreenImages[pScreen->myNum], 0, sizeof(OffscreenImages[0]));
-
if(!ScreenPriv) return TRUE;
if(ScreenPriv->videoGC) {