diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2007-06-25 10:37:12 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2007-07-19 17:28:35 +0800 |
commit | d038ffdfffb846e22f360faac5d469c8e59795ad (patch) | |
tree | fdb8918efc0c76fda90e6bbcd2457c53b5f66da4 | |
parent | a9bf7e28b91692c7c7a4915cdf9603cd2ef025ea (diff) |
Release resource allocated for surface/subpicture
-rw-r--r-- | src/i915_hwmc.c | 2 | ||||
-rw-r--r-- | src/xvmc/I915XvMC.c | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/i915_hwmc.c b/src/i915_hwmc.c index f9c36ac0..52c903c2 100644 --- a/src/i915_hwmc.c +++ b/src/i915_hwmc.c @@ -757,6 +757,7 @@ static void I915XvMCDestroySurface (ScrnInfoPtr pScrn, XvMCSurfacePtr pSurf) for (i = 0; i < I915_XVMC_MAX_SURFACES; i++) { if (pXvMC->surfaces[i] == pSurf->surface_id) { + drmRmMap(pI830->drmSubFD, pXvMC->sfprivs[i]->surface_handle); i830_free_memory(pScrn, pXvMC->sfprivs[i]->surface); xfree(pXvMC->sfprivs[i]); pXvMC->nsurfaces--; @@ -777,6 +778,7 @@ static void I915XvMCDestroySubpicture (ScrnInfoPtr pScrn, XvMCSubpicturePtr pSub for (i = 0; i < I915_XVMC_MAX_SURFACES; i++) { if (pXvMC->surfaces[i] == pSubp->subpicture_id) { + drmRmMap(pI830->drmSubFD, pXvMC->sfprivs[i]->surface_handle); i830_free_memory(pScrn, pXvMC->sfprivs[i]->surface); xfree(pXvMC->sfprivs[i]); pXvMC->nsurfaces--; diff --git a/src/xvmc/I915XvMC.c b/src/xvmc/I915XvMC.c index 937eee96..2f75d57b 100644 --- a/src/xvmc/I915XvMC.c +++ b/src/xvmc/I915XvMC.c @@ -1912,7 +1912,7 @@ Status XvMCCreateSurface(Display *display, XvMCContext *context, XvMCSurface *su pI915Surface->height = context->height; pI915Surface->privContext = pI915XvMC; pI915Surface->privSubPic = NULL; - + pI915Surface->srf.map = NULL; XLockDisplay(display); if ((ret = _xvmc_create_surface(display, context, surface, @@ -1984,8 +1984,11 @@ Status XvMCDestroySurface(Display *display, XvMCSurface *surface) if (pI915Surface->last_flip) XvMCSyncSurface(display,surface); + if (pI915Surface->srf.map) + drmUnmap(pI915Surface->srf.map, pI915Surface->srf.size); + XLockDisplay(display); - _xvmc_destroy_surface(display,surface); + _xvmc_destroy_surface(display, surface); XUnlockDisplay(display); free(pI915Surface); @@ -2626,6 +2629,7 @@ Status XvMCCreateSubpicture(Display *display, XvMCContext *context, &priv_count, &priv_data))) { printf("Unable to create XvMCSubpicture.\n"); free(pI915Subpicture); + subpicture->privData = NULL; return ret; } @@ -2674,6 +2678,8 @@ Status XvMCCreateSubpicture(Display *display, XvMCContext *context, break; default: + drmUnmap(pI915Subpicture->srf.map, pI915Subpicture->srf.size); + _xvmc_destroy_subpicture(display, subpicture); free(pI915Subpicture); subpicture->privData = NULL; return BadMatch; @@ -2802,6 +2808,9 @@ Status XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture) if (pI915Subpicture->last_render) XvMCSyncSubpicture(display, subpicture); + if (pI915Subpicture->srf.map) + drmUnmap(pI915Subpicture->srf.map, pI915Subpicture->srf.size); + XLockDisplay(display); _xvmc_destroy_subpicture(display,subpicture); XUnlockDisplay(display); |