From patchwork Mon Mar 1 21:57:39 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 83074 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 o21Lv8ts009725 for ; Mon, 1 Mar 2010 21:57:46 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 977F99F37C; Mon, 1 Mar 2010 13:57:07 -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 BAB9F9F076 for ; Mon, 1 Mar 2010 13:57:03 -0800 (PST) Received: by mail.ffwll.ch (Postfix, from userid 1000) id 21FE720C433; Mon, 1 Mar 2010 22:57:03 +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-+--show_bug.cgi, 0.000-+--UD:show_bug.cgi, 0.000-+--show_bugcgi X-Spam-Status: No, score=-4.3 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 BB36020C431; 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 o21LvkmU029545; Mon, 1 Mar 2010 22:57:46 +0100 Received: (from daniel@localhost) by fliege.ffwll.ch (8.14.3/8.14.3/Submit) id o21Lvku5029544; Mon, 1 Mar 2010 22:57:46 +0100 From: Daniel Vetter To: intel-gfx@lists.freedesktop.org Date: Mon, 1 Mar 2010 22:57:39 +0100 Message-Id: X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <7e32a2f459646825e0f0c24a16bb0466dd150618.1267480130.git.daniel.vetter@ffwll.ch> References: <7e32a2f459646825e0f0c24a16bb0466dd150618.1267480130.git.daniel.vetter@ffwll.ch> In-Reply-To: References: Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 2/3] Xv: fixup XvMC on i915 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:46 +0000 (UTC) diff --git a/src/i830_video.c b/src/i830_video.c index 2092a18..3a6b71c 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -267,7 +267,7 @@ static void drmmode_overlay_off(ScrnInfoPtr scrn) static Bool drmmode_overlay_put_image(ScrnInfoPtr scrn, xf86CrtcPtr crtc, int id, short width, short height, - int dstPitch, + int dstPitch, int dstPitch2, BoxPtr dstBox, short src_w, short src_h, short drw_w, short drw_h) { @@ -282,7 +282,7 @@ drmmode_overlay_put_image(ScrnInfoPtr scrn, xf86CrtcPtr crtc, request.bo_handle = adaptor_priv->buf->handle; if (planar) { - request.stride_Y = dstPitch * 2; + request.stride_Y = dstPitch2; request.stride_UV = dstPitch; } else { request.stride_Y = dstPitch; @@ -959,12 +959,12 @@ static void i830_memcpy_plane(unsigned char *dst, unsigned char *src, static void I830CopyPlanarData(intel_adaptor_private *adaptor_priv, - unsigned char *buf, int srcPitch, - int srcPitch2, int dstPitch, int srcH, int top, int left, + unsigned char *buf, int srcPitch, int srcPitch2, + int dstPitch, int dstPitch2, + int srcH, int top, int left, int h, int w, int id) { unsigned char *src1, *src2, *src3, *dst_base, *dst1, *dst2, *dst3; - int dstPitch2 = dstPitch << 1; #if 0 ErrorF("I830CopyPlanarData: srcPitch %d, srcPitch %d, dstPitch %d\n" @@ -1181,7 +1181,7 @@ static int xvmc_passthrough(int id) static Bool i830_display_overlay(ScrnInfoPtr scrn, xf86CrtcPtr crtc, int id, short width, short height, - int dstPitch, + int dstPitch, int dstPitch2, BoxPtr dstBox, short src_w, short src_h, short drw_w, short drw_h) { @@ -1214,7 +1214,7 @@ i830_display_overlay(ScrnInfoPtr scrn, xf86CrtcPtr crtc, } return drmmode_overlay_put_image(scrn, crtc, id, width, height, - dstPitch, dstBox, + dstPitch, dstPitch2, dstBox, src_w, src_h, drw_w, drw_h); } @@ -1362,28 +1362,31 @@ i830_setup_dst_params(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, sho if (IS_I965G(intel)) pitchAlignMask = 255; else - pitchAlignMask = 63; + pitchAlignMask = 255; } + /* for i915 xvmc, hw requires 1kb aligned surfaces */ + if ((id == FOURCC_XVMC) && IS_I915(intel)) + pitchAlignMask = 0x3ff; + /* Determine the desired destination pitch (representing the chroma's pitch, * in the planar case. */ - switch (id) { - case FOURCC_YV12: - case FOURCC_I420: + if (is_planar_fourcc(id)) { if (adaptor_priv->rotation & (RR_Rotate_90 | RR_Rotate_270)) { *dstPitch = ((height / 2) + pitchAlignMask) & ~pitchAlignMask; + *dstPitch2 = + (height + pitchAlignMask) & ~pitchAlignMask; *size = *dstPitch * width * 3; } else { *dstPitch = ((width / 2) + pitchAlignMask) & ~pitchAlignMask; + *dstPitch2 = + (width + pitchAlignMask) & ~pitchAlignMask; *size = *dstPitch * height * 3; } - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - + } else { if (adaptor_priv->rotation & (RR_Rotate_90 | RR_Rotate_270)) { *dstPitch = ((height << 1) + pitchAlignMask) & ~pitchAlignMask; @@ -1393,18 +1396,7 @@ i830_setup_dst_params(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, sho ((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; + *dstPitch2 = 0; } #if 0 ErrorF("srcPitch: %d, dstPitch: %d, size: %d\n", srcPitch, *dstPitch, @@ -1415,12 +1407,12 @@ i830_setup_dst_params(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, sho if (adaptor_priv->rotation & (RR_Rotate_90 | RR_Rotate_270)) { adaptor_priv->UBufOffset = - adaptor_priv->YBufOffset + (*dstPitch * 2 * width); + adaptor_priv->YBufOffset + (*dstPitch2 * width); adaptor_priv->VBufOffset = adaptor_priv->UBufOffset + (*dstPitch * width / 2); } else { adaptor_priv->UBufOffset = - adaptor_priv->YBufOffset + (*dstPitch * 2 * height); + adaptor_priv->YBufOffset + (*dstPitch2 * height); adaptor_priv->VBufOffset = adaptor_priv->UBufOffset + (*dstPitch * height / 2); } @@ -1451,7 +1443,8 @@ i830_copy_video_data(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, /* copy data */ if (is_planar_fourcc(id)) { I830CopyPlanarData(adaptor_priv, buf, srcPitch, srcPitch2, - *dstPitch, height, top, left, nlines, + *dstPitch, *dstPitch2, + height, top, left, nlines, npixels, id); } else { I830CopyPackedData(adaptor_priv, buf, srcPitch, *dstPitch, top, left, @@ -1488,8 +1481,7 @@ I830PutImageTextured(ScrnInfoPtr scrn, intel_screen_private *intel = intel_get_screen_private(scrn); intel_adaptor_private *adaptor_priv = (intel_adaptor_private *) data; PixmapPtr pixmap = get_drawable_pixmap(drawable); - int dstPitch; - int dstPitch2 = 0; + int dstPitch, dstPitch2; BoxRec dstBox; xf86CrtcPtr crtc; int top, left, npixels, nlines; @@ -1515,8 +1507,8 @@ I830PutImageTextured(ScrnInfoPtr scrn, int size; i830_free_video_buffers(adaptor_priv); - i830_setup_dst_params(scrn, adaptor_priv, width, height, &dstPitch, - &dstPitch2, &size, id); + i830_setup_dst_params(scrn, adaptor_priv, width, height, + &dstPitch, &dstPitch2, &size, id); if (IS_I965G(intel)) { adaptor_priv->buf = @@ -1552,8 +1544,7 @@ I830PutImageTextured(ScrnInfoPtr scrn, drw_w, drw_h, pixmap); } else { I915DisplayVideoTextured(scrn, adaptor_priv, id, clipBoxes, - width, height, dstPitch, - dstPitch2, + width, height, dstPitch, dstPitch2, src_w, src_h, drw_w, drw_h, pixmap); } @@ -1575,8 +1566,8 @@ I830PutImageOverlay(ScrnInfoPtr scrn, DrawablePtr drawable) { intel_adaptor_private *adaptor_priv = (intel_adaptor_private *) data; - int dstPitch; - int dstPitch2 = 0; + ScreenPtr screen = screenInfo.screens[scrn->scrnIndex]; + int dstPitch, dstPitch2; BoxRec dstBox; xf86CrtcPtr crtc; int top, left, npixels, nlines; @@ -1622,7 +1613,7 @@ I830PutImageOverlay(ScrnInfoPtr scrn, return BadAlloc; if (!i830_display_overlay - (scrn, crtc, id, width, height, dstPitch, + (scrn, crtc, id, width, height, dstPitch, dstPitch2, &dstBox, src_w, src_h, drw_w, drw_h)) return BadAlloc;