aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xext/xvmc.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-06-11 12:14:52 +0000
committermarha <marha@users.sourceforge.net>2010-06-11 12:14:52 +0000
commit4c61bf84b11e26e6f22648668c95ea760a379163 (patch)
tree0ac762ab2815eae283dded7447ad7cb5a54b926a /xorg-server/Xext/xvmc.c
parente1dabd2ce8be0d70c6c15353b58de256129dfd1f (diff)
downloadvcxsrv-4c61bf84b11e26e6f22648668c95ea760a379163.tar.gz
vcxsrv-4c61bf84b11e26e6f22648668c95ea760a379163.tar.bz2
vcxsrv-4c61bf84b11e26e6f22648668c95ea760a379163.zip
xserver git update 11/6/2010
Diffstat (limited to 'xorg-server/Xext/xvmc.c')
-rw-r--r--xorg-server/Xext/xvmc.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/xorg-server/Xext/xvmc.c b/xorg-server/Xext/xvmc.c
index 4866d1d45..9b9dd0bc2 100644
--- a/xorg-server/Xext/xvmc.c
+++ b/xorg-server/Xext/xvmc.c
@@ -33,8 +33,9 @@
#define DR_CLIENT_DRIVER_NAME_SIZE 48
#define DR_BUSID_SIZE 48
-static int XvMCScreenKeyIndex;
-static DevPrivateKey XvMCScreenKey;
+static DevPrivateKeyRec XvMCScreenKeyRec;
+#define XvMCScreenKey (&XvMCScreenKeyRec)
+static Bool XvMCInUse;
unsigned long XvMCGeneration = 0;
@@ -138,7 +139,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- if(XvMCScreenKey) { /* any adaptors at all */
+ if(XvMCInUse) { /* any adaptors at all */
ScreenPtr pScreen = pPort->pAdaptor->pScreen;
if((pScreenPriv = XVMC_GET_PRIVATE(pScreen))) { /* any this screen */
for(i = 0; i < pScreenPriv->num_adaptors; i++) {
@@ -193,7 +194,7 @@ ProcXvMCCreateContext(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
- if(XvMCScreenKey == NULL) /* no XvMC adaptors */
+ if(!XvMCInUse) /* no XvMC adaptors */
return BadMatch;
if(!(pScreenPriv = XVMC_GET_PRIVATE(pScreen))) /* none this screen */
@@ -258,8 +259,7 @@ ProcXvMCCreateContext(ClientPtr client)
WriteToClient(client, dwords << 2, (char*)data);
AddResource(pContext->context_id, XvMCRTContext, pContext);
- if(data)
- free(data);
+ free(data);
return Success;
}
@@ -326,8 +326,7 @@ ProcXvMCCreateSurface(ClientPtr client)
WriteToClient(client, dwords << 2, (char*)data);
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
- if(data)
- free(data);
+ free(data);
pContext->refcnt++;
@@ -443,8 +442,7 @@ ProcXvMCCreateSubpicture(ClientPtr client)
WriteToClient(client, dwords << 2, (char*)data);
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
- if(data)
- free(data);
+ free(data);
pContext->refcnt++;
@@ -716,7 +714,8 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
{
XvMCScreenPtr pScreenPriv;
- XvMCScreenKey = &XvMCScreenKeyIndex;
+ if (!dixRegisterPrivateKey(&XvMCScreenKeyRec, PRIVATE_SCREEN, 0))
+ return BadAlloc;
if(!(pScreenPriv = malloc(sizeof(XvMCScreenRec))))
return BadAlloc;
@@ -734,6 +733,8 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
pScreenPriv->minor = 0;
pScreenPriv->patchLevel = 0;
+ XvMCInUse = TRUE;
+
return Success;
}