From patchwork Tue Dec 1 13:32:33 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 63952 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 nB1DXNQ1002804 for ; Tue, 1 Dec 2009 13:33:23 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A3EE59EFC4; Tue, 1 Dec 2009 05:33:23 -0800 (PST) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail.ffwll.ch (cable-static-49-187.intergga.ch [157.161.49.187]) by gabe.freedesktop.org (Postfix) with ESMTP id D29099EFD2 for ; Tue, 1 Dec 2009 05:33:19 -0800 (PST) Received: by mail.ffwll.ch (Postfix, from userid 1000) id 9A0F920C222; Tue, 1 Dec 2009 14:33:18 +0100 (CET) X-Spam-ASN: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on orange.ffwll.ch X-Spam-Level: X-Spam-Hammy: 0.000-+--signed-off-by, 0.000-+--signedoffby, 0.000-+--100644 X-Spam-Status: No, score=-4.4 required=6.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Spammy: 0.965-+--H*Ad:U*daniel.vetter, 0.963-+--H*m:ffwll, 0.950-+--H*r:mail.ffwll.ch Received: from biene (unknown [192.168.23.129]) by mail.ffwll.ch (Postfix) with ESMTP id 9EF3A6800C; Tue, 1 Dec 2009 14:32:57 +0100 (CET) Received: from daniel by biene with local (Exim 4.69) (envelope-from ) id 1NFSqg-0000nX-0k; Tue, 01 Dec 2009 14:32:58 +0100 From: Daniel Vetter To: intel-gfx@lists.freedesktop.org Date: Tue, 1 Dec 2009 14:32:33 +0100 Message-Id: <49d9c184fd50758f3016a2baba9387e1567e5688.1259673868.git.daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.6.5.3 In-Reply-To: References: <6b93d5c17f0fb97e8018db344c234e19e36f3120.1259673868.git.daniel.vetter@ffwll.ch> <5daa18610a07c32f5b03d2a06f0837d1d8794d35.1259673868.git.daniel.vetter@ffwll.ch> <9e93c26b48c028b85cb87b19fc8214b61f6430bb.1259673868.git.daniel.vetter@ffwll.ch> In-Reply-To: References: Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 6/7] Xv: consolidate xmvc passthrough handling 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 diff --git a/src/i830_video.c b/src/i830_video.c index 9bb813a..ef3aae3 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -1367,22 +1367,12 @@ i830_setup_video_buffer(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, adaptor_priv->buf = NULL; } - 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, - "xv buffer", alloc_size, - 4096); - if (adaptor_priv->buf == NULL) - return FALSE; - } + if (adaptor_priv->buf == NULL) { + adaptor_priv->buf = drm_intel_bo_alloc(intel->bufmgr, + "xv buffer", alloc_size, + 4096); + if (adaptor_priv->buf == NULL) + return FALSE; } return TRUE; @@ -1401,11 +1391,6 @@ i830_dst_pitch_and_size(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, s */ if (adaptor_priv->textured) { pitchAlignMask = 3; -#ifdef INTEL_XVMC - /* for i915 xvmc, hw requires at least 1kb aligned surface */ - if ((id == FOURCC_XVMC) && IS_I915(intel)) - pitchAlignMask = 0x3ff; -#endif } else { if (IS_I965G(intel)) pitchAlignMask = 255; @@ -1483,38 +1468,25 @@ i830_copy_video_data(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, return FALSE; /* fixup pointers */ -#ifdef INTEL_XVMC - if (id == FOURCC_XVMC && IS_I915(intel)) { - adaptor_priv->YBufOffset = (uint32_t) ((uintptr_t) buf); - adaptor_priv->VBufOffset = adaptor_priv->YBufOffset + (*dstPitch2 * height); + adaptor_priv->YBufOffset = 0; + + if (adaptor_priv->rotation & (RR_Rotate_90 | RR_Rotate_270)) { adaptor_priv->UBufOffset = - adaptor_priv->VBufOffset + (*dstPitch * height / 2); + adaptor_priv->YBufOffset + (*dstPitch * 2 * width); + adaptor_priv->VBufOffset = + adaptor_priv->UBufOffset + (*dstPitch * width / 2); } else { -#endif - adaptor_priv->YBufOffset = 0; - - if (adaptor_priv->rotation & (RR_Rotate_90 | RR_Rotate_270)) { - adaptor_priv->UBufOffset = - adaptor_priv->YBufOffset + (*dstPitch * 2 * width); - adaptor_priv->VBufOffset = - adaptor_priv->UBufOffset + (*dstPitch * width / 2); - } else { - adaptor_priv->UBufOffset = - adaptor_priv->YBufOffset + (*dstPitch * 2 * height); - adaptor_priv->VBufOffset = - adaptor_priv->UBufOffset + (*dstPitch * height / 2); - } -#ifdef INTEL_XVMC + adaptor_priv->UBufOffset = + adaptor_priv->YBufOffset + (*dstPitch * 2 * height); + adaptor_priv->VBufOffset = + adaptor_priv->UBufOffset + (*dstPitch * height / 2); } -#endif /* copy data */ if (is_planar_fourcc(id)) { - if (!xvmc_passthrough(id)) { - I830CopyPlanarData(adaptor_priv, buf, srcPitch, srcPitch2, - *dstPitch, height, top, left, nlines, - npixels, id); - } + I830CopyPlanarData(adaptor_priv, buf, srcPitch, srcPitch2, + *dstPitch, height, top, left, nlines, + npixels, id); } else { I830CopyPackedData(adaptor_priv, buf, srcPitch, *dstPitch, top, left, nlines, npixels); @@ -1573,10 +1545,24 @@ I830PutImageTextured(ScrnInfoPtr scrn, width, height)) return Success; - if (!i830_copy_video_data(scrn, adaptor_priv, width, height, - &dstPitch, &dstPitch2, - top, left, npixels, nlines, id, buf)) - return BadAlloc; + 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 { + /* XXX: i915 is not support and needs some serious care. + * grep for KMS in i915_hwmc.c */ + return BadAlloc; + } + } else { + if (!i830_copy_video_data(scrn, adaptor_priv, width, height, + &dstPitch, &dstPitch2, + top, left, npixels, nlines, id, buf)) + return BadAlloc; + } if (crtc && adaptor_priv->SyncToVblank != 0) { i830_wait_for_scanline(scrn, pixmap, crtc, clipBoxes);