From patchwork Tue Aug 11 14:06:35 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 40671 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 n7BE70IL022276 for ; Tue, 11 Aug 2009 14:07:00 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BEC809EE05; Tue, 11 Aug 2009 07:06:59 -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 9057A9EDF8 for ; Tue, 11 Aug 2009 07:06:55 -0700 (PDT) Received: by mail.ffwll.ch (Postfix, from userid 1000) id BFF4020C21B; Wed, 12 Aug 2009 00:00:23 +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-+--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.972-+--H*m:ffwll, 0.971-+--H*Ad:U*daniel.vetter Received: from biene (unknown [192.168.23.129]) by mail.ffwll.ch (Postfix) with ESMTP id C0CB820C224; Wed, 12 Aug 2009 00:00:07 +0200 (CEST) Received: from daniel by biene with local (Exim 4.69) (envelope-from ) id 1Mas0A-0003eM-S4; Tue, 11 Aug 2009 16:06:58 +0200 From: Daniel Vetter To: intel-gfx@lists.freedesktop.org Date: Tue, 11 Aug 2009 16:06:35 +0200 Message-Id: <891b387c6b31972a3e339508e57bd660b2991a17.1249999028.git.daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: References: <0328734a90544a6cd72d9eaf64015db9d3462921.1249999028.git.daniel.vetter@ffwll.ch> <10614c7dd4ecbb1b4d3dd6a15b949cb389053f1f.1249999028.git.daniel.vetter@ffwll.ch> In-Reply-To: References: Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 05/18] Xv: use is_planar_fourcc helper some more 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 Signed-off-by: Daniel Vetter --- src/i830_video.c | 81 ++++++++++++++++++----------------------------------- src/i830_video.h | 2 + src/i915_video.c | 17 +---------- src/i965_video.c | 36 ++++++++---------------- 4 files changed, 43 insertions(+), 93 deletions(-) diff --git a/src/i830_video.c b/src/i830_video.c index c27a8ba..4ac6689 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -1805,23 +1805,6 @@ i830_update_dst_box_to_crtc_coords(ScrnInfoPtr pScrn, xf86CrtcPtr crtc, return; } -static int -is_planar_fourcc(int id) -{ - switch (id) { - case FOURCC_YV12: - case FOURCC_I420: -#ifdef INTEL_XVMC - case FOURCC_XVMC: -#endif - return 1; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - return 0; - } -} - static void i830_store_coeffs_in_overlay_regs(uint16_t *reg_coeffs, coeffPtr new_coeffs, int max_taps) @@ -1991,6 +1974,25 @@ i830_update_scaling_factors(I830OverlayRegPtr overlay, return scaleChanged; } +int +is_planar_fourcc(int id) +{ + switch (id) { + case FOURCC_YV12: + case FOURCC_I420: +#ifdef INTEL_XVMC + case FOURCC_XVMC: +#endif + return 1; + case FOURCC_UYVY: + case FOURCC_YUY2: + return 0; + default: + ErrorF("Unknown format 0x%x\n", id); + return 0; + } +} + static void i830_display_overlay(ScrnInfoPtr pScrn, xf86CrtcPtr crtc, int id, short width, short height, @@ -2278,23 +2280,11 @@ I830PutImage(ScrnInfoPtr pScrn, } destId = id; - switch (id) { - case FOURCC_YV12: - case FOURCC_I420: + if (is_planar_fourcc(id)) { srcPitch = (width + 0x3) & ~0x3; srcPitch2 = ((width >> 1) + 0x3) & ~0x3; - break; -#ifdef INTEL_XVMC - case FOURCC_XVMC: - srcPitch = (width + 0x3) & ~0x3; - srcPitch2 = ((width >> 1) + 0x3) & ~0x3; - break; -#endif - case FOURCC_UYVY: - case FOURCC_YUY2: - default: + } else { srcPitch = width << 1; - break; } /* Only needs to be DWORD-aligned for textured on i915, but overlay has @@ -2438,33 +2428,18 @@ I830PutImage(ScrnInfoPtr pScrn, left = (x1 >> 16) & ~1; npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; - switch (id) { - case FOURCC_YV12: - case FOURCC_I420: - top &= ~1; - nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; - I830CopyPlanarData(pScrn, pPriv, buf, srcPitch, srcPitch2, dstPitch, - height, top, left, nlines, npixels, id); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - nlines = ((y2 + 0xffff) >> 16) - top; - I830CopyPackedData(pScrn, pPriv, buf, srcPitch, dstPitch, top, left, - nlines, npixels); - break; -#ifdef INTEL_XVMC - case FOURCC_XVMC: - if (pPriv->rotation != RR_Rotate_0) { + if (is_planar_fourcc(id)) { + if (id != FOURCC_XVMC + || 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; + } else { + nlines = ((y2 + 0xffff) >> 16) - top; + I830CopyPackedData(pScrn, pPriv, buf, srcPitch, dstPitch, top, left, + nlines, npixels); } if (!pPriv->textured) { diff --git a/src/i830_video.h b/src/i830_video.h index 03e2ba9..fb4ad29 100644 --- a/src/i830_video.h +++ b/src/i830_video.h @@ -91,3 +91,5 @@ void I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, void I830VideoBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask); void i965_free_video(ScrnInfoPtr scrn); + +int is_planar_fourcc(int id); diff --git a/src/i915_video.c b/src/i915_video.c index 3b4247c..b978a43 100644 --- a/src/i915_video.c +++ b/src/i915_video.c @@ -53,27 +53,12 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, int nbox_total = REGION_NUM_RECTS(dstRegion); int nbox_this_time; int dxo, dyo, pix_xoff, pix_yoff; - Bool planar; #if 0 ErrorF("I915DisplayVideo: %dx%d (pitch %d)\n", width, height, video_pitch); #endif - switch (id) { - case FOURCC_UYVY: - case FOURCC_YUY2: - planar = FALSE; - break; - case FOURCC_YV12: - case FOURCC_I420: - planar = TRUE; - break; - default: - ErrorF("Unknown format 0x%x\n", id); - return; - } - #define BYTES_FOR_BOXES(n) ((200 + (n) * 20) * 4) #define BOXES_IN_BYTES(s) ((((s)/4) - 200) / 20) #define BATCH_BYTES(p) ((p)->batch_bo->size - 16) @@ -147,7 +132,7 @@ I915DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, OUT_RELOC_PIXMAP(pPixmap, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, 0); ADVANCE_BATCH(); - if (!planar) { + if (!is_planar_fourcc(id)) { FS_LOCALS(10); BEGIN_BATCH(16); diff --git a/src/i965_video.c b/src/i965_video.c index 46a461f..810b761 100644 --- a/src/i965_video.c +++ b/src/i965_video.c @@ -1008,26 +1008,7 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, src_surf_base[0], src_surf_base[1], src_surf_base[2]); #endif - switch (id) { - case FOURCC_UYVY: - src_surf_format = BRW_SURFACEFORMAT_YCRCB_SWAPY; - n_src_surf = 1; - src_width[0] = width; - src_height[0] = height; - src_pitch[0] = video_pitch; - break; - case FOURCC_YUY2: - src_surf_format = BRW_SURFACEFORMAT_YCRCB_NORMAL; - src_width[0] = width; - src_height[0] = height; - src_pitch[0] = video_pitch; - n_src_surf = 1; - break; -#ifdef INTEL_XVMC - case FOURCC_XVMC: -#endif - case FOURCC_I420: - case FOURCC_YV12: + if (is_planar_fourcc(id)) { src_surf_format = BRW_SURFACEFORMAT_R8_UNORM; src_width[1] = src_width[0] = width; src_height[1] = src_height[0] = height; @@ -1036,10 +1017,17 @@ I965DisplayVideoTextured(ScrnInfoPtr pScrn, I830PortPrivPtr pPriv, int id, src_height[4] = src_height[5] = src_height[2] = src_height[3] = height / 2; src_pitch[4] = src_pitch[5] = src_pitch[2] = src_pitch[3] = video_pitch; n_src_surf = 6; - break; - default: - return; - } + } else { + if (id == FOURCC_UYVY) + src_surf_format = BRW_SURFACEFORMAT_YCRCB_SWAPY; + else + src_surf_format = BRW_SURFACEFORMAT_YCRCB_NORMAL; + + src_width[0] = width; + src_height[0] = height; + src_pitch[0] = video_pitch; + n_src_surf = 1; + } #if 0 ErrorF("dst surf: 0x%08x\n", state_base_offset + dest_surf_offset);