@@ -2275,6 +2275,7 @@ I830PutImage(ScrnInfoPtr pScrn,
int pitchAlignMask;
int alloc_size;
xf86CrtcPtr crtc;
+ drm_intel_bo *xvmc_surface = NULL;
if (pPriv->textured)
overlay = NULL;
@@ -2409,6 +2410,11 @@ I830PutImage(ScrnInfoPtr pScrn,
if (pPriv->doubleBuffer)
alloc_size *= 2;
+ if (id == FOURCC_XVMC && IS_I965G(pI830)) {
+ xvmc_surface = drm_intel_bo_gem_create_from_name(pI830->bufmgr, "xvmc surface",
+ (unsigned int)buf);
+ }
+
/* Free the current buffer if we're going to have to reallocate */
if (pPriv->buf && pPriv->buf->size < alloc_size) {
if (!pPriv->textured)
@@ -2418,13 +2424,14 @@ I830PutImage(ScrnInfoPtr pScrn,
}
#ifdef INTEL_XVMC
- if (id == FOURCC_XVMC &&
- pPriv->rotation == RR_Rotate_0) {
+ if (id == FOURCC_XVMC) {
if (pPriv->buf) {
assert(pPriv->textured);
drm_intel_bo_unreference(pPriv->buf);
pPriv->buf = NULL;
}
+ if (IS_I965G(pI830))
+ pPriv->buf = xvmc_surface;
} else {
#endif
if (pPriv->buf == NULL) {
@@ -2504,14 +2511,6 @@ I830PutImage(ScrnInfoPtr pScrn,
break;
#ifdef INTEL_XVMC
case FOURCC_XVMC:
- if (pPriv->rotation != RR_Rotate_0) {
- top &= ~1;
- nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top;
- I830CopyPlanarData(pScrn, pPriv, buf, srcPitch, srcPitch2, dstPitch,
- height, top, left, nlines, npixels, id);
- }
-
- break;
#endif
default:
break;
@@ -2571,14 +2570,7 @@ I830PutImage(ScrnInfoPtr pScrn,
}
if (IS_I965G(pI830)) {
-#ifdef INTEL_XVMC
- if (id == FOURCC_XVMC && pPriv->rotation == RR_Rotate_0) {
- pPriv->YBuf0offset = buf - pI830->FbBase;
- pPriv->UBuf0offset = pPriv->YBuf0offset + height*width;
- pPriv->VBuf0offset = pPriv->UBuf0offset + height*width/4;
- }
-#endif
- I965DisplayVideoTextured(pScrn, pPriv, destId, clipBoxes, width, height,
+ I965DisplayVideoTextured(pScrn, pPriv, destId, clipBoxes, width, height,
dstPitch, x1, y1, x2, y2,
src_w, src_h, drw_w, drw_h, pPixmap);
} else {
@@ -48,7 +48,7 @@
#define XVMC_VLD 0x00020000
#endif
-static PutImageFuncPtr XvPutImage;
+static PutImageFuncPtr savedXvPutImage;
static int create_context(ScrnInfoPtr pScrn,
@@ -157,30 +157,22 @@ static int put_image(ScrnInfoPtr pScrn,
short height, Bool sync, RegionPtr clipBoxes, pointer data,
DrawablePtr pDraw)
{
- I830Ptr pI830 = I830PTR(pScrn);
struct intel_xvmc_command *cmd = (struct intel_xvmc_command *)buf;
- dri_bo *bo;
- if (id == FOURCC_XVMC) {
- bo = intel_bo_gem_create_from_name(pI830->bufmgr, "surface", cmd->handle);
- dri_bo_pin(bo, 0x1000);
- buf = pI830->FbBase + bo->offset;
- }
- XvPutImage(pScrn, src_x, src_y, drw_x, drw_y, src_w, src_h,
+ /* Let 'buf' take our surface bo handler */
+ if (id == FOURCC_XVMC)
+ buf = (unsigned char*)cmd->handle;
+
+ savedXvPutImage(pScrn, 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);
- }
-
return Success;
}
static Bool init(ScrnInfoPtr screen_info, XF86VideoAdaptorPtr adaptor)
{
- XvPutImage = adaptor->PutImage;
+ savedXvPutImage = adaptor->PutImage;
adaptor->PutImage = put_image;
return TRUE;
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> --- src/i830_video.c | 28 ++++++++++------------------ src/i965_hwmc.c | 22 +++++++--------------- 2 files changed, 17 insertions(+), 33 deletions(-)