diff options
author | Zhenyu Wang <zhenyuw@linux.intel.com> | 2009-09-28 18:35:57 +0800 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-10-15 12:36:17 -0700 |
commit | f171069608bf174d920921fa102b8619794ed272 (patch) | |
tree | e74650b3de3c4a55954e279c99da37cd6c6971cb /src | |
parent | aaedeffe00d9414bb03723dbc30b4938a07ce5fa (diff) |
i965 XvMC cleanup
Remove bo pin for surface buffer access, and remove access
attempt for possible unmapped framebuffer. Using xv buffer
pointer to pass current xvmc surface bo handler, which is
assigned to src image bo and handle that the same way as in Xv.
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
[anholt: Fixed up for conflict against the XV rework. Not tested, because
both mplayer and xine segfault with XVMC currently.]
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/i830_video.c | 27 | ||||
-rw-r--r-- | src/i965_hwmc.c | 28 |
2 files changed, 22 insertions, 33 deletions
diff --git a/src/i830_video.c b/src/i830_video.c index 848099d1..b0403d40 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -1165,10 +1165,10 @@ int is_planar_fourcc(int id) } } -static int xvmc_passthrough(int id, Rotation rotation) +static int xvmc_passthrough(int id) { #ifdef INTEL_XVMC - return id == FOURCC_XVMC && rotation == RR_Rotate_0; + return id == FOURCC_XVMC; #else return 0; #endif @@ -1331,17 +1331,24 @@ i830_wait_for_scanline(ScrnInfoPtr scrn, PixmapPtr pixmap, static Bool i830_setup_video_buffer(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, - int alloc_size, int id) + int alloc_size, int id, unsigned char *buf) { intel_screen_private *intel = intel_get_screen_private(scrn); + /* Free the current buffer if we're going to have to reallocate */ if (adaptor_priv->buf && adaptor_priv->buf->size < alloc_size) { drm_intel_bo_unreference(adaptor_priv->buf); adaptor_priv->buf = NULL; } - if (xvmc_passthrough(id, adaptor_priv->rotation)) { + if (xvmc_passthrough(id)) { i830_free_video_buffers(adaptor_priv); + if (IS_I965G(intel)) { + adaptor_priv->buf = + drm_intel_bo_gem_create_from_name(intel->bufmgr, + "xvmc surface", + (uintptr_t)buf); + } } else { if (adaptor_priv->buf == NULL) { adaptor_priv->buf = drm_intel_bo_alloc(intel->bufmgr, @@ -1447,7 +1454,7 @@ i830_copy_video_data(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, i830_dst_pitch_and_size(scrn, adaptor_priv, width, height, dstPitch, dstPitch2, &size, id); - if (!i830_setup_video_buffer(scrn, adaptor_priv, size, id)) + if (!i830_setup_video_buffer(scrn, adaptor_priv, size, id, buf)) return FALSE; /* fixup pointers */ @@ -1482,7 +1489,7 @@ i830_copy_video_data(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; if (is_planar_fourcc(id)) { - if (!xvmc_passthrough(id, adaptor_priv->rotation)) { + if (!xvmc_passthrough(id)) { top &= ~1; nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; I830CopyPlanarData(adaptor_priv, buf, srcPitch, srcPitch2, @@ -1600,14 +1607,6 @@ I830PutImage(ScrnInfoPtr scrn, } if (IS_I965G(intel)) { - if (xvmc_passthrough(id, adaptor_priv->rotation)) { - /* XXX: KMS */ - adaptor_priv->YBufOffset = (uintptr_t) buf; - adaptor_priv->UBufOffset = - adaptor_priv->YBufOffset + height * width; - adaptor_priv->VBufOffset = - adaptor_priv->UBufOffset + height * width / 4; - } I965DisplayVideoTextured(scrn, adaptor_priv, id, clipBoxes, width, height, dstPitch, x1, y1, x2, y2, src_w, src_h, diff --git a/src/i965_hwmc.c b/src/i965_hwmc.c index 76acb86a..3fe4f413 100644 --- a/src/i965_hwmc.c +++ b/src/i965_hwmc.c @@ -48,7 +48,7 @@ #define XVMC_VLD 0x00020000 #endif -static PutImageFuncPtr XvPutImage; +static PutImageFuncPtr savedXvPutImage; static int create_context(ScrnInfoPtr scrn, XvMCContextPtr context, int *num_privates, @@ -156,36 +156,26 @@ static int put_image(ScrnInfoPtr scrn, 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) + DrawablePtr drawable) { - intel_screen_private *intel = intel_get_screen_private(scrn); struct intel_xvmc_command *cmd = (struct intel_xvmc_command *)buf; - dri_bo *bo; if (id == FOURCC_XVMC) { - bo = intel_bo_gem_create_from_name(intel->bufmgr, "surface", - cmd->handle); - dri_bo_pin(bo, 0x1000); - /* XXX: KMS */ -#if 0 - buf = intel->FbBase + bo->offset; -#endif + /* Pass the GEM object name through the pointer arg. */ + buf = (void *)(uintptr_t)cmd->handle; } - XvPutImage(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); - if (id == FOURCC_XVMC) { - dri_bo_unpin(bo); - dri_bo_unreference(bo); - } + 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) { - XvPutImage = adaptor->PutImage; + savedXvPutImage = adaptor->PutImage; adaptor->PutImage = put_image; return TRUE; |