summaryrefslogtreecommitdiff
path: root/src/i915_hwmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/i915_hwmc.c')
-rw-r--r--src/i915_hwmc.c78
1 files changed, 23 insertions, 55 deletions
diff --git a/src/i915_hwmc.c b/src/i915_hwmc.c
index 7a8a0730..32a08795 100644
--- a/src/i915_hwmc.c
+++ b/src/i915_hwmc.c
@@ -55,6 +55,7 @@
#include "xf86xvpriv.h"
#endif
+#include "i830_hwmc.h"
#include "i915_hwmc.h"
#define I915_XVMC_MAX_BUFFERS 2
@@ -195,11 +196,6 @@ static XF86MCAdaptorRec pAdapt =
(xf86XvMCDestroySubpictureProcPtr)I915XvMCDestroySubpicture
};
-static XF86MCAdaptorPtr ppAdapt[1] =
-{
- (XF86MCAdaptorPtr)&pAdapt
-};
-
/*
* Init and clean up the screen private parts of XvMC.
*/
@@ -220,14 +216,12 @@ static void initI915XvMC(I915XvMCPtr xvmc)
xvmc->nsurfaces = 0;
}
-//XXX
-static void cleanupI915XvMC(I915XvMCPtr xvmc, XF86VideoAdaptorPtr * XvAdaptors, int XvAdaptorCount)
+static void cleanupI915XvMC(I915XvMCPtr xvmc)
{
- unsigned int i;
+ int i;
for (i = 0; i < I915_XVMC_MAX_CONTEXTS; i++) {
xvmc->contexts[i] = 0;
-
if (xvmc->ctxprivs[i]) {
xfree(xvmc->ctxprivs[i]);
xvmc->ctxprivs[i] = NULL;
@@ -236,7 +230,6 @@ static void cleanupI915XvMC(I915XvMCPtr xvmc, XF86VideoAdaptorPtr * XvAdaptors,
for (i = 0; i < I915_XVMC_MAX_SURFACES; i++) {
xvmc->surfaces[i] = 0;
-
if (xvmc->sfprivs[i]) {
xfree(xvmc->sfprivs[i]);
xvmc->sfprivs[i] = NULL;
@@ -857,36 +850,22 @@ static int I915XvMCPutImage(ScrnInfoPtr pScrn, short src_x, short src_y,
return ret;
}
-/*********************************** Public Function **************************************/
-
-/**************************************************************************
- *
- * I915InitMC
- *
- * Inputs:
- * Screen pointer
- *
- * Outputs:
- * None
- *
- **************************************************************************/
+static int i915_xvmc_putimage_size(ScrnInfoPtr pScrn)
+{
+ return sizeof(I915XvMCCommandBuffer);
+}
-Bool I915XvMCInit(ScreenPtr pScreen, XF86VideoAdaptorPtr XvAdapt)
+static Bool i915_xvmc_init(ScrnInfoPtr pScrn, XF86VideoAdaptorPtr XvAdapt)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
I915XvMCPtr pXvMC;
- if (!IS_I9XX(pI830) || IS_I965G(pI830))
- return FALSE;
-
pXvMC = (I915XvMCPtr)xcalloc(1, sizeof(I915XvMC));
if (!pXvMC) {
xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
"[XvMC] alloc driver private failed!\n");
return FALSE;
}
- pI830->xvmc = pXvMC;
+ xvmc_driver->devPrivate = (void*)pXvMC;
initI915XvMC(pXvMC);
/* set up wrappers */
@@ -895,32 +874,21 @@ Bool I915XvMCInit(ScreenPtr pScreen, XF86VideoAdaptorPtr XvAdapt)
return TRUE;
}
-Bool I915XvMCScreenInit(ScreenPtr pScreen)
+static void i915_xvmc_fini(ScrnInfoPtr pScrn)
{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- I830Ptr pI830 = I830PTR(pScrn);
+ I915XvMCPtr pXvMC = (I915XvMCPtr)xvmc_driver->devPrivate;
- if (xf86XvMCScreenInit(pScreen, 1, ppAdapt)) {
- xf86DrvMsg(pScrn->scrnIndex, X_INFO,
- "[XvMC] Initialized XvMC.\n");
- pI830->XvMCEnabled = TRUE;
- } else {
- xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
- "[XvMC] xf86 XvMC initial failed\n");
- pI830->XvMCEnabled = FALSE;
- xfree(pI830->xvmc);
- pI830->xvmc = NULL;
- return FALSE;
- }
- return TRUE;
+ cleanupI915XvMC(pXvMC);
+ xfree(xvmc_driver->devPrivate);
}
-unsigned long I915XvMCPutImageSize(ScrnInfoPtr pScrn)
-{
- I830Ptr pI830 = I830PTR(pScrn);
-
- if (pI830->XvMCEnabled)
- return sizeof(I915XvMCCommandBuffer);
-
- return 0;
-}
+/* new xvmc driver interface */
+struct intel_xvmc_driver i915_xvmc_driver = {
+ "i915_xvmc",
+ &pAdapt,
+ XVMC_DRIVER_MPEG2_MC,
+ i915_xvmc_init,
+ i915_xvmc_fini,
+ i915_xvmc_putimage_size,
+ NULL
+};