summaryrefslogtreecommitdiff
path: root/Xext
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-12-27 21:54:26 -0800
committerEric Anholt <eric@anholt.net>2014-08-06 20:12:20 -0700
commitcb42805c6675bbb9f0b37609fe2ffecc07f46290 (patch)
treecb0d912a31c782b9055026387711292cfcc4ac55 /Xext
parent8cb0da29404d3fed13c1cbedb5c6164e4733ea82 (diff)
xv: Move common code for adaptor cleanup to xvmain.c
Since any DDX XV screen cleanup would need this same code for freeing the tree of pointers for xv adaptors, move it to the dix. v2: Unconditionalize the pPorts freeing, to match the block above it. Signed-off-by: Eric Anholt <eric@anholt.net> Reviewed-by: Keith Packard <keithp@keithp.com> (v1)
Diffstat (limited to 'Xext')
-rw-r--r--Xext/xvdix.h1
-rw-r--r--Xext/xvmain.c39
2 files changed, 40 insertions, 0 deletions
diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index bb08cf4c7..f62adf883 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -235,6 +235,7 @@ extern _X_EXPORT int SProcXvDispatch(ClientPtr);
extern _X_EXPORT int XvScreenInit(ScreenPtr);
extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
extern _X_EXPORT unsigned long XvGetRTPort(void);
+extern _X_EXPORT void XvFreeAdaptor(XvAdaptorPtr pAdaptor);
extern _X_EXPORT int XvdiSendPortNotify(XvPortPtr, Atom, INT32);
extern _X_EXPORT int XvdiVideoStopped(XvPortPtr, int);
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index 00b5179bd..9084e40f3 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -1091,3 +1091,42 @@ WriteSwappedPortNotifyEvent(xvEvent * from, xvEvent * to)
cpswapl(from->u.portNotify.value, to->u.portNotify.value);
}
+
+void
+XvFreeAdaptor(XvAdaptorPtr pAdaptor)
+{
+ int i;
+
+ free(pAdaptor->name);
+ pAdaptor->name = NULL;
+
+ if (pAdaptor->pEncodings) {
+ XvEncodingPtr pEncode = pAdaptor->pEncodings;
+
+ for (i = 0; i < pAdaptor->nEncodings; i++, pEncode++)
+ free(pEncode->name);
+ free(pAdaptor->pEncodings);
+ pAdaptor->pEncodings = NULL;
+ }
+
+ free(pAdaptor->pFormats);
+ pAdaptor->pFormats = NULL;
+
+ free(pAdaptor->pPorts);
+ pAdaptor->pPorts = NULL;
+
+ if (pAdaptor->pAttributes) {
+ XvAttributePtr pAttribute = pAdaptor->pAttributes;
+
+ for (i = 0; i < pAdaptor->nAttributes; i++, pAttribute++)
+ free(pAttribute->name);
+ free(pAdaptor->pAttributes);
+ pAdaptor->pAttributes = NULL;
+ }
+
+ free(pAdaptor->pImages);
+ pAdaptor->pImages = NULL;
+
+ free(pAdaptor->devPriv.ptr);
+ pAdaptor->devPriv.ptr = NULL;
+}