diff options
-rw-r--r-- | src/i830_driver.c | 5 | ||||
-rw-r--r-- | src/i830_hwmc.c | 121 | ||||
-rw-r--r-- | src/i830_hwmc.h | 4 | ||||
-rw-r--r-- | src/i830_video.c | 14 |
4 files changed, 7 insertions, 137 deletions
diff --git a/src/i830_driver.c b/src/i830_driver.c index 22e8472d..95b02f3a 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -1340,11 +1340,6 @@ static void i830AdjustFrame(int scrnIndex, int x, int y, int flags) static void I830FreeScreen(int scrnIndex, int flags) { ScrnInfoPtr scrn = xf86Screens[scrnIndex]; -#ifdef INTEL_XVMC - intel_screen_private *intel = intel_get_screen_private(scrn); - if (intel && intel->XvMCEnabled) - intel_xvmc_finish(xf86Screens[scrnIndex]); -#endif i830_close_drm_master(scrn); diff --git a/src/i830_hwmc.c b/src/i830_hwmc.c index 18b1328e..0c21b8ee 100644 --- a/src/i830_hwmc.c +++ b/src/i830_hwmc.c @@ -80,33 +80,6 @@ Bool intel_xvmc_probe(ScrnInfoPtr scrn) return TRUE; } -void intel_xvmc_finish(ScrnInfoPtr scrn) -{ - if (!xvmc_driver) - return; - (*xvmc_driver->fini) (scrn); -} - -Bool intel_xvmc_driver_init(ScreenPtr pScreen, XF86VideoAdaptorPtr xv_adaptor) -{ - ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; - intel_screen_private *intel = intel_get_screen_private(scrn); - struct drm_i915_setparam sp; - int ret; - - if (!xvmc_driver) { - ErrorF("Failed to probe XvMC driver.\n"); - return FALSE; - } - - if (!(*xvmc_driver->init) (scrn, xv_adaptor)) { - ErrorF("XvMC driver initialize failed.\n"); - return FALSE; - } - - return TRUE; -} - Bool intel_xvmc_screen_init(ScreenPtr pScreen) { ScrnInfoPtr scrn = xf86Screens[pScreen->myNum]; @@ -121,7 +94,6 @@ Bool intel_xvmc_screen_init(ScreenPtr pScreen) "[XvMC] %s driver initialized.\n", xvmc_driver->name); } else { - intel_xvmc_finish(scrn); intel->XvMCEnabled = FALSE; xf86DrvMsg(scrn->scrnIndex, X_INFO, "[XvMC] Failed to initialize XvMC.\n"); @@ -146,10 +118,6 @@ Bool intel_xvmc_screen_init(ScreenPtr pScreen) #define I915_XVMC_MAX_CONTEXTS 4 #define I915_XVMC_MAX_SURFACES 20 -typedef struct _I915XvMC { - PutImageFuncPtr savePutImage; -} I915XvMC, *I915XvMCPtr; - static XF86MCSurfaceInfoRec i915_YV12_mpg2_surface = { SURFACE_TYPE_MPEG2_MPML, XVMC_CHROMA_FORMAT_420, @@ -289,52 +257,6 @@ static void i915_xvmc_destroy_subpict(ScrnInfoPtr scrn, return; } -static int i915_xvmc_put_image(ScrnInfoPtr scrn, - short src_x, short src_y, - short drw_x, short drw_y, short src_w, - short src_h, short drw_w, short drw_h, - int id, unsigned char *buf, short width, - short height, Bool sync, RegionPtr clipBoxes, - pointer data, DrawablePtr pDraw) -{ - I915XvMCPtr pXvMC = (I915XvMCPtr) xvmc_driver->devPrivate; - struct intel_xvmc_command *xvmc_cmd = (struct intel_xvmc_command *)buf; - int ret; - - if (FOURCC_XVMC == id) { - /* Pass the GEM object name through the pointer arg. */ - buf = (void *)(uintptr_t)xvmc_cmd->handle; - } - - ret = - pXvMC->savePutImage(scrn, src_x, src_y, drw_x, drw_y, src_w, src_h, - drw_w, drw_h, id, buf, width, height, sync, - clipBoxes, data, pDraw); - return ret; -} - -static Bool i915_xvmc_init(ScrnInfoPtr scrn, XF86VideoAdaptorPtr XvAdapt) -{ - I915XvMCPtr pXvMC; - - pXvMC = (I915XvMCPtr) xcalloc(1, sizeof(I915XvMC)); - if (!pXvMC) { - xf86DrvMsg(scrn->scrnIndex, X_WARNING, - "[XvMC] alloc driver private failed!\n"); - return FALSE; - } - xvmc_driver->devPrivate = (void *)pXvMC; - /* set up wrappers */ - pXvMC->savePutImage = XvAdapt->PutImage; - XvAdapt->PutImage = i915_xvmc_put_image; - return TRUE; -} - -static void i915_xvmc_fini(ScrnInfoPtr scrn) -{ - xfree(xvmc_driver->devPrivate); -} - /* Fill in the device dependent adaptor record. * This is named "Intel(R) Textured Video" because this code falls under the * XV extenstion, the name must match or it won't be used. @@ -367,8 +289,6 @@ struct intel_xvmc_driver i915_xvmc_driver = { .name = "i915_xvmc", .adaptor = &pAdapt, .flag = XVMC_I915_MPEG2_MC, - .init = i915_xvmc_init, - .fini = i915_xvmc_fini, }; /* i965 and later hwmc support */ @@ -380,8 +300,6 @@ struct intel_xvmc_driver i915_xvmc_driver = { #define XVMC_VLD 0x00020000 #endif -static PutImageFuncPtr savedXvPutImage; - static int create_context(ScrnInfoPtr scrn, XvMCContextPtr context, int *num_privates, CARD32 ** private) @@ -481,41 +399,6 @@ static void destroy_subpicture(ScrnInfoPtr scrn, XvMCSubpicturePtr subpicture) { } -static int put_image(ScrnInfoPtr scrn, - short src_x, short src_y, - short drw_x, short drw_y, short src_w, - short src_h, short drw_w, short drw_h, - int id, unsigned char *buf, short width, - short height, Bool sync, RegionPtr clipBoxes, pointer data, - DrawablePtr drawable) -{ - struct intel_xvmc_command *cmd = (struct intel_xvmc_command *)buf; - - if (id == FOURCC_XVMC) { - /* Pass the GEM object name through the pointer arg. */ - buf = (void *)(uintptr_t)cmd->handle; - } - - savedXvPutImage(scrn, src_x, src_y, drw_x, drw_y, src_w, src_h, - drw_w, drw_h, id, buf, - width, height, sync, clipBoxes, - data, drawable); - - return Success; -} - -static Bool init(ScrnInfoPtr screen_info, XF86VideoAdaptorPtr adaptor) -{ - savedXvPutImage = adaptor->PutImage; - adaptor->PutImage = put_image; - - return TRUE; -} - -static void fini(ScrnInfoPtr screen_info) -{ -} - static XF86MCSurfaceInfoRec yv12_mpeg2_vld_surface = { FOURCC_YV12, XVMC_CHROMA_FORMAT_420, @@ -601,14 +484,10 @@ struct intel_xvmc_driver i965_xvmc_driver = { .name = "i965_xvmc", .adaptor = &adaptor, .flag = XVMC_I965_MPEG2_MC, - .init = init, - .fini = fini }; struct intel_xvmc_driver vld_xvmc_driver = { .name = "xvmc_vld", .adaptor = &adaptor_vld, .flag = XVMC_I965_MPEG2_VLD, - .init = init, - .fini = fini }; diff --git a/src/i830_hwmc.h b/src/i830_hwmc.h index fcb54d4f..599b5be0 100644 --- a/src/i830_hwmc.h +++ b/src/i830_hwmc.h @@ -86,8 +86,6 @@ struct intel_xvmc_driver { XF86MCAdaptorPtr adaptor; unsigned int flag; /* more items for xvmv surface manage? */ - Bool(*init) (ScrnInfoPtr, XF86VideoAdaptorPtr); - void (*fini) (ScrnInfoPtr); void *devPrivate; }; @@ -97,9 +95,7 @@ extern struct intel_xvmc_driver i965_xvmc_driver; extern struct intel_xvmc_driver vld_xvmc_driver; extern Bool intel_xvmc_probe(ScrnInfoPtr); -extern Bool intel_xvmc_driver_init(ScreenPtr, XF86VideoAdaptorPtr); extern Bool intel_xvmc_screen_init(ScreenPtr); -extern void intel_xvmc_finish(ScrnInfoPtr); #endif #endif diff --git a/src/i830_video.c b/src/i830_video.c index db728638..c2a02b5b 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -406,11 +406,8 @@ void I830InitVideo(ScreenPtr screen) adaptors[num_adaptors++] = overlayAdaptor; #ifdef INTEL_XVMC - if (intel_xvmc_probe(scrn)) { - if (texturedAdaptor) - xvmc_status = - intel_xvmc_driver_init(screen, texturedAdaptor); - } + if (intel_xvmc_probe(scrn)) + xvmc_status = TRUE; #endif if (num_adaptors) { @@ -422,7 +419,7 @@ void I830InitVideo(ScreenPtr screen) } #ifdef INTEL_XVMC - if (xvmc_status) + if (xvmc_status && texturedAdaptor) intel_xvmc_screen_init(screen); #endif xfree(adaptors); @@ -1507,6 +1504,9 @@ I830PutImageTextured(ScrnInfoPtr scrn, if (xvmc_passthrough(id)) { int size; + struct intel_xvmc_command *cmd + = (struct intel_xvmc_command *)buf; + i830_free_video_buffers(adaptor_priv); i830_setup_dst_params(scrn, adaptor_priv, width, height, @@ -1521,7 +1521,7 @@ I830PutImageTextured(ScrnInfoPtr scrn, adaptor_priv->buf = drm_intel_bo_gem_create_from_name(intel->bufmgr, "xvmc surface", - (uintptr_t)buf); + cmd->handle); } else { if (!i830_copy_video_data(scrn, adaptor_priv, width, height, &dstPitch, &dstPitch2, |