From patchwork Tue Aug 11 14:06:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 40668 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 n7BE6rOj022200 for ; Tue, 11 Aug 2009 14:06:53 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2F47E9EDFE; Tue, 11 Aug 2009 07:06:53 -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 C8D099EDF0 for ; Tue, 11 Aug 2009 07:06:50 -0700 (PDT) Received: by mail.ffwll.ch (Postfix, from userid 1000) id 302D120C218; Wed, 12 Aug 2009 00:00:19 +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: 0.973-+--H*m:ffwll, 0.971-+--H*Ad:U*daniel.vetter, 0.947-+--H*Ad:D*ffwll.ch Received: from biene (unknown [192.168.23.129]) by mail.ffwll.ch (Postfix) with ESMTP id 5948920C21B; Wed, 12 Aug 2009 00:00:07 +0200 (CEST) Received: from daniel by biene with local (Exim 4.69) (envelope-from ) id 1Mas0A-0003eD-Jj; Tue, 11 Aug 2009 16:06:58 +0200 From: Daniel Vetter To: intel-gfx@lists.freedesktop.org Date: Tue, 11 Aug 2009 16:06:32 +0200 Message-Id: X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <0328734a90544a6cd72d9eaf64015db9d3462921.1249999028.git.daniel.vetter@ffwll.ch> References: <0328734a90544a6cd72d9eaf64015db9d3462921.1249999028.git.daniel.vetter@ffwll.ch> In-Reply-To: References: Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 02/18] Xv i830_display_video splitup: extract i830_overlay_cmd 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 This slightly moves around (and simplifies) the OSTRIDE reg programming, too. Signed-off-by: Daniel Vetter --- src/i830_video.c | 67 +++++++++++++++++++++++++++-------------------------- 1 files changed, 34 insertions(+), 33 deletions(-) diff --git a/src/i830_video.c b/src/i830_video.c index 2944563..d7ea568 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -1906,6 +1906,36 @@ i830_store_coeffs_in_overlay_regs(uint16_t *reg_coeffs, coeffPtr new_coeffs, } } +static uint32_t +i830_overlay_cmd(int id, int planar, unsigned char currentBuf) +{ + uint32_t OCMD = OVERLAY_ENABLE; + + if (planar) { + OVERLAY_DEBUG("YUV420\n"); + OCMD &= ~SOURCE_FORMAT; + OCMD &= ~OV_BYTE_ORDER; + OCMD |= YUV_420; + } else { + OVERLAY_DEBUG("YUV422\n"); + OCMD &= ~SOURCE_FORMAT; + OCMD |= YUV_422; + OCMD &= ~OV_BYTE_ORDER; + if (id == FOURCC_UYVY) + OCMD |= Y_SWAP; + } + + OCMD &= ~(BUFFER_SELECT | FIELD_SELECT); + if (currentBuf == 0) + OCMD |= BUFFER0; + else + OCMD |= BUFFER1; + + OVERLAY_DEBUG("OCMD is 0x%x\n", OCMD); + + return OCMD; +} + static double i830_limit_coeff(double coeff) { @@ -2041,7 +2071,6 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc, int planar; uint32_t swidth, swidthsw, sheigth; int tmp; - uint32_t OCMD; Bool scaleChanged = FALSE; OVERLAY_DEBUG("I830DisplayVideo: %dx%d (pitch %d)\n", width, height, @@ -2130,46 +2159,18 @@ i830_display_video(ScrnInfoPtr pScrn, xf86CrtcPtr crtc, scaleChanged = i830_update_scaling_factors(overlay, src_w, src_h, drw_w, drw_h); - OCMD = OVERLAY_ENABLE; - - switch (id) { - case FOURCC_YV12: - case FOURCC_I420: -#ifdef INTEL_XVMC - case FOURCC_XVMC: -#endif - OVERLAY_DEBUG("YUV420\n"); + if (planar) { #if 0 /* set UV vertical phase to -0.25 */ overlay->UV_VPH = 0x30003000; #endif + overlay->OSTRIDE = (dstPitch * 2) | (dstPitch << 16); OVERLAY_DEBUG("UV stride is %d, Y stride is %d\n", dstPitch, dstPitch * 2); - overlay->OSTRIDE = (dstPitch * 2) | (dstPitch << 16); - OCMD &= ~SOURCE_FORMAT; - OCMD &= ~OV_BYTE_ORDER; - OCMD |= YUV_420; - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - OVERLAY_DEBUG("YUV422\n"); + } else overlay->OSTRIDE = dstPitch; - OCMD &= ~SOURCE_FORMAT; - OCMD |= YUV_422; - OCMD &= ~OV_BYTE_ORDER; - if (id == FOURCC_UYVY) - OCMD |= Y_SWAP; - break; - } - OCMD &= ~(BUFFER_SELECT | FIELD_SELECT); - if (pPriv->currentBuf == 0) - OCMD |= BUFFER0; - else - OCMD |= BUFFER1; - - overlay->OCMD = OCMD; - OVERLAY_DEBUG("OCMD is 0x%x\n", OCMD); + overlay->OCMD = i830_overlay_cmd(id, planar, pPriv->currentBuf); /* make sure the overlay is on */ i830_overlay_on (pScrn);