From patchwork Tue Aug 11 14:06:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 40674 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 n7BE79sO022348 for ; Tue, 11 Aug 2009 14:07:09 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C39349EF73; Tue, 11 Aug 2009 07:07:08 -0700 (PDT) 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 91B7C9EE1B for ; Tue, 11 Aug 2009 07:07:06 -0700 (PDT) Received: by mail.ffwll.ch (Postfix, from userid 1000) id A685120C233; Wed, 12 Aug 2009 00:00:32 +0200 (CEST) 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-+--signedoffby, 0.000-+--signed-off-by, 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: Received: from biene (unknown [192.168.23.129]) by mail.ffwll.ch (Postfix) with ESMTP id 2258220C228; Wed, 12 Aug 2009 00:00:08 +0200 (CEST) Received: from daniel by biene with local (Exim 4.69) (envelope-from ) id 1Mas0B-0003eV-75; Tue, 11 Aug 2009 16:06:59 +0200 From: Daniel Vetter To: intel-gfx@lists.freedesktop.org Date: Tue, 11 Aug 2009 16:06:38 +0200 Message-Id: <3e0435569d2d7f58d58eb2f7c8a6952cc29b6934.1249999028.git.daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <8a3ddc0d78dcb40a14f8037b81cf202eaa40c301.1249999028.git.daniel.vetter@ffwll.ch> References: <0328734a90544a6cd72d9eaf64015db9d3462921.1249999028.git.daniel.vetter@ffwll.ch> <10614c7dd4ecbb1b4d3dd6a15b949cb389053f1f.1249999028.git.daniel.vetter@ffwll.ch> <891b387c6b31972a3e339508e57bd660b2991a17.1249999028.git.daniel.vetter@ffwll.ch> <2096013512e0099bfbb89439943c1b70cccabc92.1249999028.git.daniel.vetter@ffwll.ch> <8a3ddc0d78dcb40a14f8037b81cf202eaa40c301.1249999028.git.daniel.vetter@ffwll.ch> In-Reply-To: References: Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 08/18] Xv I830PutImage splitup: extract i830_dst_pitch_and_size 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 Just moves the code. Signed-off-by: Daniel Vetter --- src/i830_video.c | 126 +++++++++++++++++++++++++++++------------------------- 1 files changed, 68 insertions(+), 58 deletions(-) diff --git a/src/i830_video.c b/src/i830_video.c index 471fd44..98e9230 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -2157,6 +2157,72 @@ i830_fill_colorkey (ScreenPtr pScreen, uint32_t key, RegionPtr clipboxes) FreeScratchGC (gc); } +static void +i830_dst_pitch_and_size(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, short width, + short height, int *dstPitch, int *dstPitch2, int *size, int id) +{ + I830Ptr pI830 = I830PTR(pScrn); + int pitchAlignMask; + + /* Only needs to be DWORD-aligned for textured on i915, but overlay has + * stricter requirements. + */ + if (pPriv->textured) { + pitchAlignMask = 3; +#ifdef INTEL_XVMC + /* for i915 xvmc, hw requires at least 1kb aligned surface */ + if ((id == FOURCC_XVMC) && IS_I915(pI830)) + pitchAlignMask = 0x3ff; +#endif + } else { + if (IS_I965G(pI830)) + pitchAlignMask = 255; + else + pitchAlignMask = 63; + } + + /* Determine the desired destination pitch (representing the chroma's pitch, + * in the planar case. + */ + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: + if (pPriv->rotation & (RR_Rotate_90 | RR_Rotate_270)) { + *dstPitch = ((height / 2) + pitchAlignMask) & ~pitchAlignMask; + *size = *dstPitch * width * 3; + } else { + *dstPitch = ((width / 2) + pitchAlignMask) & ~pitchAlignMask; + *size = *dstPitch * height * 3; + } + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + + if (pPriv->rotation & (RR_Rotate_90 | RR_Rotate_270)) { + *dstPitch = ((height << 1) + pitchAlignMask) & ~pitchAlignMask; + *size = *dstPitch * width; + } else { + *dstPitch = ((width << 1) + pitchAlignMask) & ~pitchAlignMask; + *size = *dstPitch * height; + } + break; +#ifdef INTEL_XVMC + case FOURCC_XVMC: + *dstPitch = ((width / 2) + pitchAlignMask ) & ~pitchAlignMask; + *dstPitch2 = (width + pitchAlignMask ) & ~pitchAlignMask; + *size = 0; + break; +#endif + default: + *dstPitch = 0; + *size = 0; + break; + } +#if 0 + ErrorF("srcPitch: %d, dstPitch: %d, size: %d\n", srcPitch, *dstPitch, size); +#endif +} + /* * The source rectangle of the video is defined by (src_x, src_y, src_w, src_h). * The dest rectangle of the video is defined by (drw_x, drw_y, drw_w, drw_h). @@ -2191,7 +2257,6 @@ I830PutImage(ScrnInfoPtr pScrn, int dstPitch2 = 0; int top, left, npixels, nlines, size; BoxRec dstBox; - int pitchAlignMask; int alloc_size; xf86CrtcPtr crtc; @@ -2253,63 +2318,8 @@ I830PutImage(ScrnInfoPtr pScrn, srcPitch = width << 1; } - /* Only needs to be DWORD-aligned for textured on i915, but overlay has - * stricter requirements. - */ - if (pPriv->textured) { - pitchAlignMask = 3; -#ifdef INTEL_XVMC - /* for i915 xvmc, hw requires at least 1kb aligned surface */ - if ((id == FOURCC_XVMC) && IS_I915(pI830)) - pitchAlignMask = 0x3ff; -#endif - } else { - if (IS_I965G(pI830)) - pitchAlignMask = 255; - else - pitchAlignMask = 63; - } - - /* Determine the desired destination pitch (representing the chroma's pitch, - * in the planar case. - */ - switch (id) { - case FOURCC_YV12: - case FOURCC_I420: - if (pPriv->rotation & (RR_Rotate_90 | RR_Rotate_270)) { - dstPitch = ((height / 2) + pitchAlignMask) & ~pitchAlignMask; - size = dstPitch * width * 3; - } else { - dstPitch = ((width / 2) + pitchAlignMask) & ~pitchAlignMask; - size = dstPitch * height * 3; - } - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - - if (pPriv->rotation & (RR_Rotate_90 | RR_Rotate_270)) { - dstPitch = ((height << 1) + pitchAlignMask) & ~pitchAlignMask; - size = dstPitch * width; - } else { - dstPitch = ((width << 1) + pitchAlignMask) & ~pitchAlignMask; - size = dstPitch * height; - } - break; -#ifdef INTEL_XVMC - case FOURCC_XVMC: - dstPitch = ((width / 2) + pitchAlignMask ) & ~pitchAlignMask; - dstPitch2 = (width + pitchAlignMask ) & ~pitchAlignMask; - size = 0; - break; -#endif - default: - dstPitch = 0; - size = 0; - break; - } -#if 0 - ErrorF("srcPitch: %d, dstPitch: %d, size: %d\n", srcPitch, dstPitch, size); -#endif + i830_dst_pitch_and_size(pScrn, pPriv, width, height, &dstPitch, &dstPitch2, + &size, id); alloc_size = size; if (pPriv->doubleBuffer)