From patchwork Mon Mar 1 21:57:38 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 83073 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o21Lv7Xt009723 for ; Mon, 1 Mar 2010 21:57:45 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A8BB59F076; Mon, 1 Mar 2010 13:57:06 -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 4607D9E918 for ; Mon, 1 Mar 2010 13:57:03 -0800 (PST) Received: by mail.ffwll.ch (Postfix, from userid 1000) id 1CA0C20C434; Mon, 1 Mar 2010 22:57:01 +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-+--100644, 0.000-+--signed-off-by, 0.000-+--signedoffby X-Spam-Status: No, score=-4.2 required=6.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Spammy: Received: from fliege.ffwll.ch (unknown [192.168.23.131]) by mail.ffwll.ch (Postfix) with ESMTP id 505BC20C3AA; Mon, 1 Mar 2010 22:56:51 +0100 (CET) Received: from fliege.ffwll.ch (localhost.localdomain [127.0.0.1]) by fliege.ffwll.ch (8.14.3/8.14.3) with ESMTP id o21Lvk8o029541; Mon, 1 Mar 2010 22:57:46 +0100 Received: (from daniel@localhost) by fliege.ffwll.ch (8.14.3/8.14.3/Submit) id o21LvkMe029540; Mon, 1 Mar 2010 22:57:46 +0100 From: Daniel Vetter To: intel-gfx@lists.freedesktop.org Date: Mon, 1 Mar 2010 22:57:38 +0100 Message-Id: <7e32a2f459646825e0f0c24a16bb0466dd150618.1267480130.git.daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: References: In-Reply-To: References: Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 1/3] Xv: fixup YUV plane offset for xvmc case X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.11 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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 01 Mar 2010 21:57:45 +0000 (UTC) diff --git a/src/i830_video.c b/src/i830_video.c index d1f391b..2092a18 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -574,7 +574,7 @@ static XF86VideoAdaptorPtr I830SetupImageVideoTextured(ScreenPtr screen) adapt->pAttributes = attrs; memcpy(attrs, TexturedAttributes, nAttributes * sizeof(XF86AttributeRec)); - if (IS_I915(intel)) + if (IS_I915G(intel) || IS_I915GM(intel)) adapt->nImages = NUM_IMAGES - XVMC_IMAGE; else adapt->nImages = NUM_IMAGES; @@ -1346,7 +1346,7 @@ i830_setup_video_buffer(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, } static void -i830_dst_pitch_and_size(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, short width, +i830_setup_dst_params(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, short width, short height, int *dstPitch, int *dstPitch2, int *size, int id) { @@ -1410,6 +1410,20 @@ i830_dst_pitch_and_size(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, s ErrorF("srcPitch: %d, dstPitch: %d, size: %d\n", srcPitch, *dstPitch, size); #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); + } } static Bool @@ -1428,27 +1442,12 @@ i830_copy_video_data(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, srcPitch = width << 1; } - i830_dst_pitch_and_size(scrn, adaptor_priv, width, height, dstPitch, + i830_setup_dst_params(scrn, adaptor_priv, width, height, dstPitch, dstPitch2, &size, id); if (!i830_setup_video_buffer(scrn, adaptor_priv, size, id, buf)) return FALSE; - /* fixup pointers */ - 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); - } - /* copy data */ if (is_planar_fourcc(id)) { I830CopyPlanarData(adaptor_priv, buf, srcPitch, srcPitch2, @@ -1513,16 +1512,27 @@ I830PutImageTextured(ScrnInfoPtr scrn, return Success; if (xvmc_passthrough(id)) { + int size; i830_free_video_buffers(adaptor_priv); + + i830_setup_dst_params(scrn, adaptor_priv, width, height, &dstPitch, + &dstPitch2, &size, id); + 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; + if (IS_I915G(intel) || IS_I915GM(intel)) { + /* XXX: i915 is not support and needs some + * serious care. grep for KMS in i915_hwmc.c */ + return BadAlloc; + } + /* fixup pointers */ + adaptor_priv->YBufOffset += (uint32_t) buf; + adaptor_priv->UBufOffset += (uint32_t) buf; + adaptor_priv->VBufOffset += (uint32_t) buf; } } else { if (!i830_copy_video_data(scrn, adaptor_priv, width, height,