From patchwork Fri Jul 1 18:24:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sinclair Yeh X-Patchwork-Id: 9210329 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 132A760752 for ; Fri, 1 Jul 2016 18:24:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 07F70286B6 for ; Fri, 1 Jul 2016 18:24:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0783286CF; Fri, 1 Jul 2016 18:24:49 +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]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EBB2286B6 for ; Fri, 1 Jul 2016 18:24:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E8E6C6E1D7; Fri, 1 Jul 2016 18:24:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp-outbound-1.vmware.com (smtp-outbound-1.vmware.com [208.91.2.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1FEDF6E1D7 for ; Fri, 1 Jul 2016 18:24:46 +0000 (UTC) Received: from sc9-mailhost3.vmware.com (sc9-mailhost3.vmware.com [10.113.161.73]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id F3A8B986D1; Fri, 1 Jul 2016 11:24:44 -0700 (PDT) Received: from EX13-CAS-005.vmware.com (ex13-cas-005.vmware.com [10.113.191.55]) by sc9-mailhost3.vmware.com (Postfix) with ESMTP id B266E40398; Fri, 1 Jul 2016 11:24:45 -0700 (PDT) Received: from EX13-CAS-002.vmware.com (10.113.191.52) by EX13-MBX-000.vmware.com (10.113.191.20) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Fri, 1 Jul 2016 11:24:45 -0700 Received: from NAM03-BY2-obe.outbound.protection.outlook.com (10.113.170.11) by EX13-CAS-002.vmware.com (10.113.191.52) with Microsoft SMTP Server (TLS) id 15.0.1156.6 via Frontend Transport; Fri, 1 Jul 2016 11:24:45 -0700 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=VCUIgsaOP1cwersqjBrUGnsyGcm+fbpNPODWyyhp5zQ=; b=Sz0UF2rGul4NrOW7xGj7FJjLoEkoEDJg94PZslW6ok2dTSBN+UYD/rcpPijz+VHwzZTCFT2ZWNAvfEDYEYkK74B+tz80+PRnqdsbv+8Qq4R96DRxLQ5LPaSV0gFGTlNlREXGjCVeiyn097+J0XOL38LUhCGelNmuKBfij0Vdx5g= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=syeh@vmware.com; Received: from promb-2n-dhcp105.eng.vmware.com (208.91.1.34) by CO2PR05MB698.namprd05.prod.outlook.com (10.141.229.13) with Microsoft SMTP Server (TLS) id 15.1.523.12; Fri, 1 Jul 2016 18:24:40 +0000 From: To: Subject: [PATCH 3/3] drm/vmwgfx: Delay pinning fbdev framebuffer until after mode set Date: Fri, 1 Jul 2016 11:24:10 -0700 Message-ID: <1467397450-3648-3-git-send-email-syeh@vmware.com> X-Mailer: git-send-email 2.8.2 In-Reply-To: <1467397450-3648-1-git-send-email-syeh@vmware.com> References: <1467397450-3648-1-git-send-email-syeh@vmware.com> MIME-Version: 1.0 X-Originating-IP: [208.91.1.34] X-ClientProxiedBy: CY1PR1101CA0035.namprd11.prod.outlook.com (10.169.17.45) To CO2PR05MB698.namprd05.prod.outlook.com (10.141.229.13) X-MS-Office365-Filtering-Correlation-Id: c32bc30d-3ab1-4da9-10d2-08d3a1dcf7de X-Microsoft-Exchange-Diagnostics: 1; CO2PR05MB698; 2:O4YL33jQ1m4yrcOCHOzVLutI7id+BOvXjjq9zTiN+5b0hKrC2aCJCCmFDyx0qC3sdSlocNS9pntu6t+7zKXZ+bRELH51mrOnXl+TL7qaG1MMcp2Jj9vaxMFVfMQ68DObFlyWnslRCVdEzVNd0KbdzDLSKqr3BmaeKTAg+rm+qRK1MpfRy7OBGnpyoWtabfAC; 3:d1hz9bOwS9I2GY74xBSBeLIcDJSSbagx4jOUg/YaqageAJ8PIb/nbPgOXYXqbjwGh5WAEagPDaWxfEXyjPVa+gXcLo/4CnEWD0OjBwx3qYw53o7je7MKTL9rJ7TWXi2X; 25:RR78eE8WFuMPyMmQkDwlcjk7u87ZLGVw3nFvMvbYTT9pLXRRzXWMVcagDrzYOpVIwoFU9Xi2rLtD6AchFJTFUfT3+LAvYuJDro6pDY/dCjop5zzDjB20Xsqx8GZlaQqd57RZtZ1k2pIt7XuWXc1KHkUJ2lsDI7atF7OT5YHmYhUNMw64ocaNy+PL6Bz82bO6IHU5LfKVuXiBFE7t+K7toU6f5O7xg5lHopxK4p+b+q6jm5ClY6aEN3f2AEodTvja2ei7GvY1Bd2Tyrm8n9uYIGzIJ+KGezVL1qqXWB+VoMz4EClH59GbOV+3Yurp2Hce2byQgl8YxBxAaashVXS5OZl7pj4RnOK0my28ji+cArj9GX3zoJCoBFrxVN7eCQ6Tc+wUX0l62icMSUqcbclEhzuJcF50f/0+XGkPWHkgE/s= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CO2PR05MB698; X-Microsoft-Exchange-Diagnostics: 1; CO2PR05MB698; 20:/IXeMJQTaq75p2Jz9Y8WtlpCuKLjnbc3iE/QE+uVCy9jWCLsZ9x8FBPWeT1FXwYPGOh28Czb1jgnGTPStpOGhmC34AXbvoVBqougAhtST4sL+KOQ9eQAjrXQkfpI2mNrF4qhx9Z0gZcIHivbjx8/BdZAtsQTwiGw/FMdxEBXCVgSA1GJFvr9lsv842uAWY2DdJFa1bt/QlhrB/fRFPjrQ+eu4hpi43U7cMjvcxqIpwCNoFsPGnOmiN4F6Kqi5ebl; 4:DS6Q+vJsC/1a/rIRub5eZ185JXWZtDjhxZWXvFBFYkbJI2x/MbFrWzfTnspHKs4daiNGJqRGeUdlZpzMBJvxg74iTwX0cs/h4GCSjvtxx4j4TwIoQ1sv6U/TJUsmGvgEHs7LwfQYKvlh4jvkO1i4fw0aNDsdqcpJ9idu4z+Ho123ZY9u+beN6CAj9UotZdC2sa86ygYo+Qwqinpm4zse8v9zPEGEXgSm6P/jUvqSJbKMUdiF5ht5L1tI4qTKo3q/9B4nv4sz6XqO4ue+duE1i6NrGxKB9KMPvtflgvZmph46NrsrjQGIM4XIEo87FFzKPAfJVLppfzZYH/7Xe2C7wkHLhZO/CIczCtzS5HWdh2Qw3sKHElMHdcTCIS8l9hGJayDWv8gMhWl/t+85hjhbNH8m8zBAtE6UBXNlM4xQLoAyP6broVArtNRXuXp7APbTjorT9N5o9VXlN29dmMQC8JUTawFSxhoE9hCvPe1dTIc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150)(158342451672863)(9452136761055); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:CO2PR05MB698; BCL:0; PCL:0; RULEID:; SRVR:CO2PR05MB698; X-Forefront-PRVS: 0990C54589 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(7916002)(199003)(189002)(2950100001)(8676002)(305945005)(86152002)(66066001)(81156014)(77096005)(7736002)(106356001)(81166006)(586003)(101416001)(3846002)(50466002)(42186005)(2876002)(4326007)(2906002)(86362001)(105586002)(97736004)(92566002)(19580395003)(19580405001)(50226002)(189998001)(110136002)(2351001)(5003940100001)(7846002)(47776003)(48376002)(76176999)(6116002)(36756003)(50986999)(68736007)(33646002)(229853001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR05MB698; H:promb-2n-dhcp105.eng.vmware.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR05MB698; 23:2E5cEXYfB04uBx+Mm5RjlvIbwD/unwAB9KXi4yqQ1C?= =?us-ascii?Q?Bhu8hLYJRbRPsLv5qSzOM8ifg3jYpS4cAhunz9irIfiaGix9W1Au5KKnALSe?= =?us-ascii?Q?hl9R+Az8pYMCcqMed+KkiJ3dHhQ40BqT0Qzzn4QMYmpxYeEs+b1s9ao0cRMU?= =?us-ascii?Q?H3pu5/MY0+8i+yyxmDy6WIykR0lyejAVRlAe3sxp2joF0RtV5iNCzT8NxHkc?= =?us-ascii?Q?pDZXQqrbc46P40XN8KDhSmcsYQjAWLncT8ARWDiB7UHb49Rnyj31mCRxr92G?= =?us-ascii?Q?FVlw2UCy0yU+sJBjb8U8G2jz1D//GWy3be9qVtxd/pKhOcUFn1OzdQyKHduf?= =?us-ascii?Q?cgzol9CrLeaQHgHDkeYskrDiaE1RAu2AQ/gbNDk8NH3Q02xIE7n+H6mG5NGl?= =?us-ascii?Q?KbZ0jyD+C6NCSb+jrTUktgiBr+7WZJ4/PH80hXAad6C3vZaKyVdoWZzojmFE?= =?us-ascii?Q?KiWUGTRWJKzGFz8iyTgmqGTQ5Rk4VECiFxZUR4reS83uoGrKH83T4xWamNW5?= =?us-ascii?Q?uu/a5yRRdhPb7echi/ClJMArlf4x3QYekjs/k9+r1HyLum2KBXbFFDblKtnZ?= =?us-ascii?Q?C0zW1iRDp8IIBGLME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jeEfzCspuk8Ah7gknxjnkmr6FIiYNL6VHhdhFq4GeK4asYRn7Hkg3nmr1Tl1GRr8UJN9DwYmtntlV4POdomCdpAJ8dHzq1iu4dn8rqPA==; 24:oVYmjGhFvVVBESnnCSR315fV1t5GucaBh2or9fTmHZKlp+NK8Znpk1Mmo1rPWYRFIyRESRet/OZRS3zwqCCuS98PFQStF3KuXUUgRO3F/RU=; 7:pGndXF8yR+aVU6c+isIkZ3hRqHDi1UC4ysEg/liNuTsw6xuruoUegP3Z9O1inJRHCt/HNraAV9QnBQGALnWKrz1tBMx7f6YT4XhOvfv02WJZIBFhk0ryYfx0f6H1VNPZg/6vviZR+qv/lL8A4SQbbaYMoqdqYFUbqiH17CIGVQ5W8T3KTFcMW20lIm2A23W6MS/TmT7QCJQuCBqg8cD7TxE/wo9tDrqgRU7DfmIiXlr9EcIla4ynhLvaNy7XHKlQK9bPUFNrW67SxTX8+xif2w== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CO2PR05MB698; 20:SiQpkVb2e6bAO2HzxeN6Mhz7mDJeAC7wn510LDAIR73x/zm7vZGbKhC8Thwl1v8hV3SEJAO5OQUtoecvTZKTRrlSIRJO/fN+1izXJsUzseRm5hx0Q08OvRnRBZutwgMo9OsIpBtLSlt1gr+1zkZgPF5Z/JrKuO271WwdbgjinIo= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jul 2016 18:24:40.7590 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO2PR05MB698 X-OriginatorOrg: vmware.com Cc: stable@vger.kernel.org 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 For the Screen Object display unit, we need to reserve a guest-invisible region equal to the size of the framebuffer for the host. This region can only be reserved in VRAM, whereas the guest-visible framebuffer can be reserved in either VRAM or GMR. As such priority should be given to the guest-invisible region otherwise in a limited VRAM situation, we can fail to allocate this region. This patch makes it so that vmw_sou_backing_alloc() is called before the framebuffer is pinned. Signed-off-by: Sinclair Yeh Reviewed-by: Thomas Hellstrom Cc: --- This is the last patch of a 3-patch series to fix console black screen issue on Ubuntu 16.04 server --- drivers/gpu/drm/vmwgfx/vmwgfx_fb.c | 47 ++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c index 679a4cb..66eaa30 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fb.c @@ -517,28 +517,6 @@ static int vmw_fb_kms_framebuffer(struct fb_info *info) par->set_fb = &vfb->base; - if (!par->bo_ptr) { - /* - * Pin before mapping. Since we don't know in what placement - * to pin, call into KMS to do it for us. - */ - ret = vfb->pin(vfb); - if (ret) { - DRM_ERROR("Could not pin the fbdev framebuffer.\n"); - return ret; - } - - ret = ttm_bo_kmap(&par->vmw_bo->base, 0, - par->vmw_bo->base.num_pages, &par->map); - if (ret) { - vfb->unpin(vfb); - DRM_ERROR("Could not map the fbdev framebuffer.\n"); - return ret; - } - - par->bo_ptr = ttm_kmap_obj_virtual(&par->map, &par->bo_iowrite); - } - return 0; } @@ -601,6 +579,31 @@ static int vmw_fb_set_par(struct fb_info *info) if (ret) goto out_unlock; + if (!par->bo_ptr) { + struct vmw_framebuffer *vfb = vmw_framebuffer_to_vfb(set.fb); + + /* + * Pin before mapping. Since we don't know in what placement + * to pin, call into KMS to do it for us. + */ + ret = vfb->pin(vfb); + if (ret) { + DRM_ERROR("Could not pin the fbdev framebuffer.\n"); + return ret; + } + + ret = ttm_bo_kmap(&par->vmw_bo->base, 0, + par->vmw_bo->base.num_pages, &par->map); + if (ret) { + vfb->unpin(vfb); + DRM_ERROR("Could not map the fbdev framebuffer.\n"); + return ret; + } + + par->bo_ptr = ttm_kmap_obj_virtual(&par->map, &par->bo_iowrite); + } + + vmw_fb_dirty_mark(par, par->fb_x, par->fb_y, par->set_fb->width, par->set_fb->height);