From patchwork Tue Dec 1 13:32:28 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 63948 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 nB1DXCrU002755 for ; Tue, 1 Dec 2009 13:33:12 GMT Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB9D89EF96; Tue, 1 Dec 2009 05:33:11 -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 93A419EF85 for ; Tue, 1 Dec 2009 05:33:09 -0800 (PST) Received: by mail.ffwll.ch (Postfix, from userid 1000) id 81A546800F; Tue, 1 Dec 2009 14:33:08 +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-+--struct, 0.000-+--signed-off-by, 0.000-+--signedoffby 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.998-1--8th, 0.997-1--Clip, 0.997-1--clip Received: from biene (unknown [192.168.23.129]) by mail.ffwll.ch (Postfix) with ESMTP id 0BFC320C205; Tue, 1 Dec 2009 14:32:56 +0100 (CET) Received: from daniel by biene with local (Exim 4.69) (envelope-from ) id 1NFSqe-0000nI-CV; Tue, 01 Dec 2009 14:32:56 +0100 From: Daniel Vetter To: intel-gfx@lists.freedesktop.org Date: Tue, 1 Dec 2009 14:32:28 +0100 Message-Id: <6b93d5c17f0fb97e8018db344c234e19e36f3120.1259673868.git.daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.6.5.3 In-Reply-To: References: In-Reply-To: References: Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 1/7] Xv: split up I830PutImage into textured and !textured case 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 diff --git a/src/i830_video.c b/src/i830_video.c index b0403d4..f5c129b 100644 --- a/src/i830_video.c +++ b/src/i830_video.c @@ -95,7 +95,10 @@ static int I830GetPortAttribute(ScrnInfoPtr, Atom, INT32 *, pointer); static void I830QueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); -static int I830PutImage(ScrnInfoPtr, short, short, short, short, short, short, +static int I830PutImageTextured(ScrnInfoPtr, short, short, short, short, short, short, + short, short, int, unsigned char *, short, short, + Bool, RegionPtr, pointer, DrawablePtr); +static int I830PutImageOverlay(ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char *, short, short, Bool, RegionPtr, pointer, DrawablePtr); static int I830QueryImageAttributes(ScrnInfoPtr, int, unsigned short *, @@ -488,7 +491,7 @@ static XF86VideoAdaptorPtr I830SetupImageVideoOverlay(ScreenPtr screen) adapt->SetPortAttribute = I830SetPortAttributeOverlay; adapt->GetPortAttribute = I830GetPortAttribute; adapt->QueryBestSize = I830QueryBestSize; - adapt->PutImage = I830PutImage; + adapt->PutImage = I830PutImageOverlay; adapt->QueryImageAttributes = I830QueryImageAttributes; adaptor_priv->textured = FALSE; @@ -584,7 +587,7 @@ static XF86VideoAdaptorPtr I830SetupImageVideoTextured(ScreenPtr screen) adapt->SetPortAttribute = I830SetPortAttributeTextured; adapt->GetPortAttribute = I830GetPortAttribute; adapt->QueryBestSize = I830QueryBestSize; - adapt->PutImage = I830PutImage; + adapt->PutImage = I830PutImageTextured; adapt->QueryImageAttributes = I830QueryImageAttributes; for (i = 0; i < nports; i++) { @@ -1519,7 +1522,7 @@ i830_copy_video_data(ScrnInfoPtr scrn, intel_adaptor_private *adaptor_priv, * compositing. It's a new argument to the function in the 1.1 server. */ static int -I830PutImage(ScrnInfoPtr scrn, +I830PutImageTextured(ScrnInfoPtr scrn, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, @@ -1531,7 +1534,6 @@ I830PutImage(ScrnInfoPtr scrn, { intel_screen_private *intel = intel_get_screen_private(scrn); intel_adaptor_private *adaptor_priv = (intel_adaptor_private *) data; - ScreenPtr screen = screenInfo.screens[scrn->scrnIndex]; PixmapPtr pixmap = get_drawable_pixmap(drawable); INT32 x1, x2, y1, y2; int dstPitch; @@ -1545,17 +1547,85 @@ I830PutImage(ScrnInfoPtr scrn, drw_y, drw_w, drw_h, width, height); #endif - if (!adaptor_priv->textured) { - /* If dst width and height are less than 1/8th the src size, the - * src/dst scale factor becomes larger than 8 and doesn't fit in - * the scale register. */ - if (src_w >= (drw_w * 8)) - drw_w = src_w / 7; + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; - if (src_h >= (drw_h * 8)) - drw_h = src_h / 7; + if (!i830_clip_video_helper(scrn, + adaptor_priv, + &crtc, + &dstBox, &x1, &x2, &y1, &y2, clipBoxes, + width, height)) + return Success; + + if (!i830_copy_video_data(scrn, adaptor_priv, width, height, + &dstPitch, &dstPitch2, + x1, y1, x2, y2, id, buf)) + return BadAlloc; + + if (crtc && adaptor_priv->SyncToVblank != 0) { + i830_wait_for_scanline(scrn, pixmap, crtc, clipBoxes); } + if (IS_I965G(intel)) { + I965DisplayVideoTextured(scrn, adaptor_priv, id, clipBoxes, + width, height, dstPitch, x1, + y1, x2, y2, src_w, src_h, + drw_w, drw_h, pixmap); + } else { + I915DisplayVideoTextured(scrn, adaptor_priv, id, clipBoxes, + width, height, dstPitch, + dstPitch2, x1, y1, x2, y2, + src_w, src_h, drw_w, drw_h, + pixmap); + } + + DamageDamageRegion(drawable, clipBoxes); + + return Success; +} + +static int +I830PutImageOverlay(ScrnInfoPtr scrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char *buf, + short width, short height, + Bool sync, RegionPtr clipBoxes, pointer data, + DrawablePtr drawable) +{ + intel_adaptor_private *adaptor_priv = (intel_adaptor_private *) data; + ScreenPtr screen = screenInfo.screens[scrn->scrnIndex]; + INT32 x1, x2, y1, y2; + int dstPitch; + int dstPitch2 = 0; + BoxRec dstBox; + xf86CrtcPtr crtc; + +#if 0 + ErrorF("I830PutImage: src: (%d,%d)(%d,%d), dst: (%d,%d)(%d,%d)\n" + "width %d, height %d\n", src_x, src_y, src_w, src_h, drw_x, + drw_y, drw_w, drw_h, width, height); +#endif + + /* If dst width and height are less than 1/8th the src size, the + * src/dst scale factor becomes larger than 8 and doesn't fit in + * the scale register. */ + if (src_w >= (drw_w * 8)) + drw_w = src_w / 7; + + if (src_h >= (drw_h * 8)) + drw_h = src_h / 7; + /* Clip */ x1 = src_x; x2 = src_x + src_w; @@ -1574,15 +1644,13 @@ I830PutImage(ScrnInfoPtr scrn, width, height)) return Success; - if (!adaptor_priv->textured) { - /* texture video handles rotation differently. */ - if (crtc) - adaptor_priv->rotation = crtc->rotation; - else { - xf86DrvMsg(scrn->scrnIndex, X_WARNING, - "Fail to clip video to any crtc!\n"); - return Success; - } + /* overlay can't handle rotation natively, store it for the copy func */ + if (crtc) + adaptor_priv->rotation = crtc->rotation; + else { + xf86DrvMsg(scrn->scrnIndex, X_WARNING, + "Fail to clip video to any crtc!\n"); + return Success; } if (!i830_copy_video_data(scrn, adaptor_priv, width, height, @@ -1590,36 +1658,15 @@ I830PutImage(ScrnInfoPtr scrn, x1, y1, x2, y2, id, buf)) return BadAlloc; - if (!adaptor_priv->textured) { - if (!i830_display_overlay - (scrn, crtc, id, width, height, dstPitch, x1, y1, x2, y2, - &dstBox, src_w, src_h, drw_w, drw_h)) - return BadAlloc; - - /* update cliplist */ - if (!REGION_EQUAL(scrn->pScreen, &adaptor_priv->clip, clipBoxes)) { - REGION_COPY(scrn->pScreen, &adaptor_priv->clip, clipBoxes); - i830_fill_colorkey(screen, adaptor_priv->colorKey, clipBoxes); - } - } else { - if (crtc && adaptor_priv->SyncToVblank != 0) { - i830_wait_for_scanline(scrn, pixmap, crtc, clipBoxes); - } - - if (IS_I965G(intel)) { - I965DisplayVideoTextured(scrn, adaptor_priv, id, clipBoxes, - width, height, dstPitch, x1, - y1, x2, y2, src_w, src_h, - drw_w, drw_h, pixmap); - } else { - I915DisplayVideoTextured(scrn, adaptor_priv, id, clipBoxes, - width, height, dstPitch, - dstPitch2, x1, y1, x2, y2, - src_w, src_h, drw_w, drw_h, - pixmap); - } + if (!i830_display_overlay + (scrn, crtc, id, width, height, dstPitch, x1, y1, x2, y2, + &dstBox, src_w, src_h, drw_w, drw_h)) + return BadAlloc; - DamageDamageRegion(drawable, clipBoxes); + /* update cliplist */ + if (!REGION_EQUAL(scrn->pScreen, &adaptor_priv->clip, clipBoxes)) { + REGION_COPY(scrn->pScreen, &adaptor_priv->clip, clipBoxes); + i830_fill_colorkey(screen, adaptor_priv->colorKey, clipBoxes); } adaptor_priv->videoStatus = CLIENT_VIDEO_ON; diff --git a/src/i830_video.h b/src/i830_video.h index a2beae0..8bb536c 100644 --- a/src/i830_video.h +++ b/src/i830_video.h @@ -47,6 +47,7 @@ typedef struct { uint32_t gamma4; uint32_t gamma5; + /* only used by the overlay */ uint32_t videoStatus; Time offTime; Time freeTime;