From patchwork Mon Sep 28 10:35:57 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhenyu Wang X-Patchwork-Id: 50358 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8S2eoVb015905 for ; Mon, 28 Sep 2009 02:40:50 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0007A9EFC5; Sun, 27 Sep 2009 19:40:48 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id C71D09EFAC for ; Sun, 27 Sep 2009 19:40:47 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 27 Sep 2009 19:25:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.44,463,1249282800"; d="scan'208";a="554257674" Received: from debian-t61.sh.intel.com (HELO localhost.localdomain) ([10.239.36.155]) by orsmga001.jf.intel.com with ESMTP; 27 Sep 2009 19:39:58 -0700 From: Zhenyu Wang To: intel-gfx@lists.freedesktop.org Date: Mon, 28 Sep 2009 18:35:57 +0800 Message-Id: <1254134158-5422-1-git-send-email-zhenyuw@linux.intel.com> X-Mailer: git-send-email 1.5.3.8 Subject: [Intel-gfx] [PATCH] i965 XvMC cleanup X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org 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 --- src/i830_video.c | 28 ++++++++++------------------ src/i965_hwmc.c | 22 +++++++--------------- 2 files changed, 17 insertions(+), 33 deletions(-) diff --git a/src/i830_video.c b/src/i830_video.c index 47c026d..cb6bd86 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -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 { diff --git a/src/i965_hwmc.c b/src/i965_hwmc.c index e7b5de1..8327010 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 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;