From patchwork Wed Jun 7 13:24:22 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 9771529 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 70B2660350 for ; Wed, 7 Jun 2017 13:40:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62A02283BE for ; Wed, 7 Jun 2017 13:40:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 576BB28472; Wed, 7 Jun 2017 13:40:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EA45C283BE for ; Wed, 7 Jun 2017 13:40:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EA8F66E24B; Wed, 7 Jun 2017 13:40:21 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0084.outbound.protection.outlook.com [104.47.34.84]) by gabe.freedesktop.org (Postfix) with ESMTPS id D6A516E24A for ; Wed, 7 Jun 2017 13:40:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=onevmw.onmicrosoft.com; s=selector1-vmware-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=XT/Wo3NWKx9ZiqYkTcSC7RmcSOamq9kjRrAnBfPW2wo=; b=siZrzpyye9tpQhj/qY67HBM9Hy8g26PUKyncikGl2AxiuomayvZ8lYf9q0LakVher+jdA8sO/aWeThW0TewaGUmvnkyd04lESFFGkDJj4v7Xe0aK4iETgwcTrdxGEK3aMxVPJs2QAJTFEvQcG1gkE1OkN9UeMObrCRspK7YjfKI= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=vmware.com; Received: from ubuntu.localdomain (155.4.205.56) by BLUPR05MB753.namprd05.prod.outlook.com (10.141.208.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.3; Wed, 7 Jun 2017 13:25:01 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH -fixes 6/9] drm/vmwgfx: Fix large topology crash Date: Wed, 7 Jun 2017 15:24:22 +0200 Message-Id: <1496841865-2349-6-git-send-email-thellstrom@vmware.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1496841865-2349-1-git-send-email-thellstrom@vmware.com> References: <1496841865-2349-1-git-send-email-thellstrom@vmware.com> MIME-Version: 1.0 X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: BN6PR16CA0019.namprd16.prod.outlook.com (10.172.212.157) To BLUPR05MB753.namprd05.prod.outlook.com (10.141.208.140) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BLUPR05MB753: X-MS-Office365-Filtering-Correlation-Id: 6e2f67fe-f838-4845-4486-08d4ada89a0f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BLUPR05MB753; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB753; 3:60whBsiS7p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SRCo9f+WW3ifOzOw2yN+PoLU=; 20:8KnaU5VtlRSZP7gFbJlJKg1xKuu95xeN/6V1Rz/dO2GIg6mzwnviLQHMXnxgYxUcJHORDMpjQT57fnKMmECh6qjI98mvybzOl0xubMQ8DNgHqC8DlAcLQKxb/ReaeZlwKtpUOfLpfKSzHEoeC3ISCPBzhabG8DZZkDV5rRLKvcl81XPbGJH9t4ebquGls2CWeKADgJ1f9Yir8jTmUH0Ppguap2Kq6/99fmIneK7xcahQknzUkfwwtz2hvuJnKOXiWXIh1q+7oOKdSjI6i3zqgDTL2ZQHeOIlP2dx7yglkp4dfrTpcUVpXF+y+EariKYSe/QFAlvnjL7bIWSUHILyYyfd8GC0WZm4ZyUDFQ3k/+dD0cH9o3PYS74H1DWtdT3Vss1B1Yoig0UCGYy4ZIq1kw294ouSLOevrUCiJXE8OVbJAPhQcLXCMZugiOwS9Zl9RfCAre70CnUoO4FlU8hWponKyMs7nCjcu0ao6hRI45WiY6zRZtI2Rd48ZDUjTtSD X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(6041248)(20161123558100)(20161123562025)(20161123564025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BLUPR05MB753; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BLUPR05MB753; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR05MB753; 4:bHplJEm1mwNm73OgenlO+zPbScXGTx36A54f8rd9q/C?= =?us-ascii?Q?kdrCl7egWY896Jl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fd+?= =?us-ascii?Q?PcPJNjY1KM/Y4fWmH+pCTxMsSsKMG9u1cVixVa+cWvZMa6tYEjO1QVLQ2djC?= =?us-ascii?Q?zJjuKIWzqNRbiUiD2ub2JBOtIOxY2XZUk34IPNKJ9KER/j7E2lJ/4usems9D?= =?us-ascii?Q?wA7hTNc71OhJ3sHUGFOqjHNE5c0eKjPovS1gv2CYS/2XLLUp/+dunrDiVgKK?= =?us-ascii?Q?CcGznSHntKKlnV1lyr0I07HmZIWr02f3EPj5Ib29aJBhOofvIW/hGfqn9h0C?= =?us-ascii?Q?WHz8V0VPCMdo=3D?= X-Forefront-PRVS: 03319F6FEF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39410400002)(39400400002)(39450400003)(39850400002)(76176999)(38730400002)(107886003)(110136004)(2906002)(305945005)(47776003)(86362001)(66066001)(5660300001)(3846002)(6666003)(50986999)(5003940100001)(81166006)(6916009)(6116002)(478600001)(7736002)(2950100002)(50226002)(6506006)(2361001)(33646002)(6486002)(6512007)(25786009)(42186005)(189998001)(2351001)(4326008)(50466002)(48376002)(53936002)(36756003)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB753; H:ubuntu.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BLUPR05MB753; 23:CCXkdLkFI+C9xxEs2xTbw/rWXUrzIdeu8jrmtgoYX7?= =?us-ascii?Q?0UmVtIJYWptCl8FuSRUG0A7Yaz3PoSqKhkYjVTefn78kJJdbxflTzgPNWJQO?= =?us-ascii?Q?fbTCz8y+smeUbOhporj76dTByGPBkEd09dSJHVXVoPXc6nuD7Sp3v3rMx3En?= =?us-ascii?Q?RR0uIURyP0TGl0CnDkFrz9JsxGi0TyKe+Oj9q1QYplHb6K88mhzGlPIKfL2V?= =?us-ascii?Q?t48yKV2huYmuCBqb9lrzKI9z4wznNCW8vlfyY+FK9IlfzqcO5BMF25HO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nlQhBdhtG/C01Z0XXhnkA/zR0VFcUJ7zdlFeMtina+rad1Fs2XMKJdthHHRzTtIv8Cdn1FouFTvLWvAm9P0B6dY7kcB9kuc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB753; 7:Gw6rSer7o5nV77YCQrxM6KnPtZuniGVn9rNRs5jpWpIK80G6CUF875tR/l+o4BbzRD3qJ7kEKXUSK2JYzxNbXKfEjwN0LvoX2Caq/vkoaZpdtX411j4rTE1w50H722I0P5n1oYr2R2HkNNUCOtPcLAyMvw5M2FjtPB6NP27yzXXwfPM9qa5z6BLgPDRsu/TXvyOm2Qxz9zATpwyLNWdtju0I8zAr0TWrXwD6JQm/LsFQkcXUzTEfd2Fth9JaPmGaQYolyUfPUPQZUjlF1ZtlmiKwGPRq58Hyq8iDQIYY2dty4Lx1jXHUSW0VxV3YY3Ps4NdCeN2hlcMOuVUSyx7h0g==; 20:FEfvXg2PFmirxzEUKXnpAzP6eaUFn419D8fiDWx0PzxX4Smqq2CVR0DBfV7XYnq1xUau6OR2xOjUvg/ORNea+BPV6sR6BQnOGIfRThyGd+wanDIuFLunMBRz7dyd8FEF7b+B7XNC4iWXHGm3Z9qdWkXSAsx/UwT7n9SObHXiSus= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jun 2017 13:25:01.2354 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB753 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Sinclair Yeh The previous attempt at this had an issue with with num_clips > 1 because it would always end up using the coordinates of the last clip while using width and height calculated from the bounding box of all the clips. So if the last clip happens to be not at the top-left corner of the bounding box, the CPU blit operation would go out of bounds. The original intent was to coalesce all the clips into one blit, and to do that we need to also track the starting point of the content buffer. Signed-off-by: Sinclair Yeh Reviewed-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c index 60ace30..50be1f0 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c @@ -56,6 +56,8 @@ enum stdu_content_type { * @right: Right side of bounding box. * @top: Top side of bounding box. * @bottom: Bottom side of bounding box. + * @fb_left: Left side of the framebuffer/content bounding box + * @fb_top: Top of the framebuffer/content bounding box * @buf: DMA buffer when DMA-ing between buffer and screen targets. * @sid: Surface ID when copying between surface and screen targets. */ @@ -63,6 +65,7 @@ struct vmw_stdu_dirty { struct vmw_kms_dirty base; SVGA3dTransferType transfer; s32 left, right, top, bottom; + s32 fb_left, fb_top; u32 pitch; union { struct vmw_dma_buffer *buf; @@ -647,7 +650,7 @@ static void vmw_stdu_dmabuf_fifo_commit(struct vmw_kms_dirty *dirty) * * @dirty: The closure structure. * - * This function calculates the bounding box for all the incoming clips + * This function calculates the bounding box for all the incoming clips. */ static void vmw_stdu_dmabuf_cpu_clip(struct vmw_kms_dirty *dirty) { @@ -656,11 +659,19 @@ static void vmw_stdu_dmabuf_cpu_clip(struct vmw_kms_dirty *dirty) dirty->num_hits = 1; - /* Calculate bounding box */ + /* Calculate destination bounding box */ ddirty->left = min_t(s32, ddirty->left, dirty->unit_x1); ddirty->top = min_t(s32, ddirty->top, dirty->unit_y1); ddirty->right = max_t(s32, ddirty->right, dirty->unit_x2); ddirty->bottom = max_t(s32, ddirty->bottom, dirty->unit_y2); + + /* + * Calculate content bounding box. We only need the top-left + * coordinate because width and height will be the same as the + * destination bounding box above + */ + ddirty->fb_left = min_t(s32, ddirty->fb_left, dirty->fb_x); + ddirty->fb_top = min_t(s32, ddirty->fb_top, dirty->fb_y); } @@ -697,11 +708,11 @@ static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty) /* Assume we are blitting from Host (display_srf) to Guest (dmabuf) */ src_pitch = stdu->display_srf->base_size.width * stdu->cpp; src = ttm_kmap_obj_virtual(&stdu->host_map, ¬_used); - src += dirty->unit_y1 * src_pitch + dirty->unit_x1 * stdu->cpp; + src += ddirty->top * src_pitch + ddirty->left * stdu->cpp; dst_pitch = ddirty->pitch; dst = ttm_kmap_obj_virtual(&stdu->guest_map, ¬_used); - dst += dirty->fb_y * dst_pitch + dirty->fb_x * stdu->cpp; + dst += ddirty->fb_top * dst_pitch + ddirty->fb_left * stdu->cpp; /* Figure out the real direction */ @@ -760,7 +771,7 @@ static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty) } out_cleanup: - ddirty->left = ddirty->top = S32_MAX; + ddirty->left = ddirty->top = ddirty->fb_left = ddirty->fb_top = S32_MAX; ddirty->right = ddirty->bottom = S32_MIN; } @@ -812,6 +823,7 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, SVGA3D_READ_HOST_VRAM; ddirty.left = ddirty.top = S32_MAX; ddirty.right = ddirty.bottom = S32_MIN; + ddirty.fb_left = ddirty.fb_top = S32_MAX; ddirty.pitch = vfb->base.pitches[0]; ddirty.buf = buf; ddirty.base.fifo_commit = vmw_stdu_dmabuf_fifo_commit;