From patchwork Tue Jan 16 13:34:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10166969 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 F38D8601E7 for ; Tue, 16 Jan 2018 13:35:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E659E28179 for ; Tue, 16 Jan 2018 13:35:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DAF6E28488; Tue, 16 Jan 2018 13:35:51 +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 77DA928179 for ; Tue, 16 Jan 2018 13:35:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D34889D7B; Tue, 16 Jan 2018 13:35:41 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0056.outbound.protection.outlook.com [104.47.40.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id E848189850 for ; Tue, 16 Jan 2018 13:35:30 +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=SCe56xGvqTGO5/AS7IuI3h8uYXIG+pB+gvvT3Zj2Mu8=; b=stQ70bKjq02L0bqpXu/bj8XLdZNt0j9MHZA1yj7FgYYDONzNOfHuecQ9cJZdT+ifeZvvz5DgRgpiAlkJUMwhq1jWn167nD8CFplWersN7ZdRS6bGWJQIdjkPfx//4uf8BKjRvitQOrXL18gHO+Sn/CsteqMGp2d4rUkEPpJRcRA= Received: from ubuntu.localdomain (155.4.205.56) by BLUPR05MB755.namprd05.prod.outlook.com (10.141.208.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.9; Tue, 16 Jan 2018 13:35:28 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH 7/7] drm/vmwgfx: Cursor update fixes Date: Tue, 16 Jan 2018 14:34:34 +0100 Message-Id: <1516109674-10087-8-git-send-email-thellstrom@vmware.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516109674-10087-1-git-send-email-thellstrom@vmware.com> References: <1516109674-10087-1-git-send-email-thellstrom@vmware.com> MIME-Version: 1.0 X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: DB6PR07CA0086.eurprd07.prod.outlook.com (10.175.238.24) To BLUPR05MB755.namprd05.prod.outlook.com (10.141.208.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3905bb00-3a89-45ee-431e-08d55ce601f3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(4534125)(4602075)(4627221)(201703031133081)(201702281549075)(2017052603307)(7153060)(7193020); SRVR:BLUPR05MB755; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB755; 3:O0eBFMZg3KoBdxXSTqwenCTi94dBrcok8enPEeEZZDKSlh2pxLEI1JllqRBjxZRLE6RJGCOLka/NC8JA+n/2idR78UC2nyOfCqpf+LmDJOdcg2rGVLUgvL5deZ8hWd0Bz7sZS/7NL/z/Ql/9YJ4yMeZZ4QKuzF2Qnrq3j1VQYUDyT9VMpBhRr4TUI7kZMx8e2Z6PhXmgPTotZbekzmtjqfFVsR7uYr3vxs6Ks2Q4k8JhwP9Fh3ye5W0ywVL/sWC9; 25:+KTYSWYPUxNjNiUEVCs3ExkFXASUCzUa0XY9ph4m47ZBbdrQRSr0u10pXI3NVmiZhSxpRWgDO0SH/JGoVXnKSi0SEGgHp11p/GcBEHFD7ld+RdlrECnTRRSUat+nYUfF/4smGahVfRon+t7tsE5fE/FlczGRqtrAOC2+FNp1ZgNTJ4PcdvY4cIkccYX11fK3W2qEJ2BLo7Dpg6Kvm5FGowFIz6K8Gaggd1PApAbW7w0IgSi6wyckvnypz4DnBbEZhQeM25K7bPqtAucsZP7ACHbg5Ro4EhV8O8fWJZJcAag+L9rKfh6Gu6YrEQy5oQgFU7fk071WClHKCWN3HFMbNQ==; 31:/a9sg4Finf6+ONSp6ZFnU29497raYO4ubSflkF+c9bgG75c2rRtk/GyQCH9iIbU4QIz7SDXjXqIh9+go1wb429iNBiIgNYpvkG2AFLr7HL+yZcZhdZd7NF/nSGxh0O7SEB/TpXaEB7q+AnlUDLUrh78rg+vBFfuoKhYkWKkmH/B226lxFgmDZYdTm2q9m+qm4YlekdtBPjavzwVtAQOX/UDahCEUbRLDo2foTaMVHcg= X-MS-TrafficTypeDiagnostic: BLUPR05MB755: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=thellstrom@vmware.com; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB755; 20:Gyx5a7UnZBU6IEOcPkkuSrAuzorjcTlWRDo5JZSLOKZ58/ECZhqUJLQQfd/kwOcMOGa06kUgo4AEPCwfeSfmMLO3IBmawmIlnMTJxjmXP0+nOBQhRiJS7Vm2yxsMfRfX1LVVsYRd3kd50UPe96iZC02/DaxN20KnYnWhMtJFZwfFYU/99Y2EvHnspOSISj5qDi47/gEwJJAi9blIAX5ZPBjfGtO6TqQXpqKwuRjxJSRbZpgmuU62uAgIm6FcG7TycGj1Ox7+k1vAMnCX72sr+eVpwaFJ3dUTWcfnmEQzDtqijCvyVseqvS40YYwzYukjcIvOtD+M5HGDD+lSVyPNpa3dec5W/Jqyjvk8pnelfz/iXYyUE7ed/RZLKDQEm2ed+tma18ke6YeUmF3qMUTBIfgrmJvHIvFMrzMJwnFQoKXwysrZdOvrQ6OHXjQerpUf/ygK9SZlCYTv3OVTeX/MH5xlq483kwb6J1OfTeFr7gLh4ft8BUbo+rHXjdha8OK7; 4:uOXgYnC0vxD09cMUL8Yt8TJ4Ebs2BGDxnsTy12jBtPr9ld1f+VGjh0qH0p4chr5oh5MvxxQM3nLwrTAWnmMut6CSRnPeAcgWqXsAzvN6NSQVeFknfZcRMkteQE4IZvZgSq5WtT2h+/Rx2a5zWqNFWa+zc2eLyveiMMUwaCFIrfanLFRFnlXZVVQVDKwrsAN55lMSPcLJt6SJj/TMnqPRoUMA5fKc1rqJ4F84lH+Clr0OrrmmUlvUbpvviUhXZUElj3fONsa6FqF7ij+e4/inGNIfUeYvSHjm7jNiQkYfAcVxznf00oYEcWsUHzrfM/Zw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(3231023)(2400035)(944501161)(10201501046)(93006095)(93001095)(6041268)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(20161123560045)(20161123562045)(6072148)(201708071742011); SRVR:BLUPR05MB755; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:BLUPR05MB755; X-Forefront-PRVS: 0554B1F54F X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(396003)(39380400002)(376002)(39860400002)(189003)(199004)(50466002)(7736002)(6666003)(6916009)(97736004)(106356001)(305945005)(6486002)(2950100002)(107886003)(478600001)(105586002)(2361001)(2351001)(5660300001)(3846002)(86362001)(6512007)(59450400001)(26005)(386003)(6116002)(76176011)(52116002)(6506007)(53936002)(51416003)(2906002)(68736007)(8936002)(316002)(16526018)(16586007)(8676002)(81166006)(81156014)(36756003)(25786009)(47776003)(4326008)(66066001)(48376002)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR05MB755; H:ubuntu.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A: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; BLUPR05MB755; 23:Gs05+dEU0DJEF77KdWUISf99H2qqaePCyc50mhOdc6?= =?us-ascii?Q?aymak7suv8kbUhaAc2S9YXPR9M+2MPa8ynJMU2GFZhoSnlVQJEohlAFKt/0i?= =?us-ascii?Q?rjz/HO2FUM2DCGF4k4kigStDtdlLK+2uPazoUSNRUeje/e9MUbsasSpON88I?= =?us-ascii?Q?o8cYSOuqFYid41JrTg9yHjWiAmsRlxSQ5h1KIUCAzqpMRJj6pR1Qkko33gtL?= =?us-ascii?Q?Cy5JbJmUvmwURtgiwWcJ6ZD6JTMqBgmRKhT6yOZfipCXH/uSbFphEn6t5frR?= =?us-ascii?Q?f6AFW+dYqPGiNHkMUePvfutpHWezvrEAOan51ue5KOH2NNE5e14I8zikdShh?= =?us-ascii?Q?uscv1eqn9CmXOSrkWjQnKOh5ail3pETw1euLT4VPUGd3RhxNaK6SZFFO4E6r?= =?us-ascii?Q?TrbZD/A/+QnXNiG9mS9eG8KSQawfR4dc7sxC6MRQOC7vNzUGIjQSgzJqe/s3?= =?us-ascii?Q?tdxPrIn4nJaZJgd5TqRkAoKma7vscRNhWt9w2+dqINibG6dJmmGIh/X4K8p+?= =?us-ascii?Q?kLOAS+h1z51DmjTwqgB94mkambAV60fAbhtKXLh6HMSK+ic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JkSQoa7aWVKCsLREPX0v9a7s63xAkwZTblriGWavLvEuetT/4ZpZT6OkGUYOX8ivQPQuIxp3VKH4lY1xUHAOchamk=; 5:anmFHx/yrPrtA+YAkjNnuNc7ctNt6xZgIBckVJIHF+KajlC3gdcA81fxKP96cXxuXVYqABCY1tsq8uH+k9a2fM0Jokc3+p2c+ofF0dVluC60lF4TtY8gEhHrtDejWClqjQL2TuB2fSdY28nL45b9b3+qb0cSmkPNu+Mv7JDs08M=; 24:93uWMJDwcKTyaCTtFMsJlCEBNdsPl9EFqRJ5CDJnaEtZU/boOoFLQzbv/QUl5ahJeI+VABIB0A5BqQi0v0Ls0F+IoUl0r3zJByf37kl7rUc=; 7:MIwqdsM0k2nXf50YpU0W7NpJj6XxF10FMYUSIL0CoMb0ihTioNi9WEXMF0O+O8e+mrnhHwumLzBGgMYGnha480dSNb779HD7qKL0lQaMryvmv+LNWGVu1LybhgiOrHAMw4weHbYtdT6AuOce4BfC/vBWQD8XOfrBqzPruiQAx7cAkgwiLcuXZwW26HIxY9YNlqi/lttTry6VeZc6Bf17IN2/sZKR4WT1plSi8Bva8atfA2hIElbj8616/QRfpnmM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB755; 20:BB7dgwroinxxX95Ehnh0BpI/jeU6Tq5zwtmeTEjipWxHdX9hfIwbJ3i/Gh53fNRMOQD64xKAIfIq54xrqQjG/iovQ/c6l0sP+SawqDI8gZM+eG/Mmm6oiFMVKEg+cbefmF7pTMPbhkwzIyX3oR9cVETFHk5QzUhLm/Mz8VVoo68= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2018 13:35:28.2590 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3905bb00-3a89-45ee-431e-08d55ce601f3 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB755 Cc: Thomas Hellstrom 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 Use drm_plane_helper_check_update also for the cursor plane. Avoid uploading a new cursor image on each cursor move and only upload cursor images on cursor fb changes, assuming that we're in effect page-flipping the cursor, which is exactly what the legacy helper does. Cursor front-buffer like rendering using atomic still needs some kind of atomic damage interface. Signed-off-by: Thomas Hellstrom Reviewed-by: Brian Paul --- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 45 ++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index 3f1ed51..34ee856 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -393,21 +393,24 @@ vmw_du_cursor_plane_atomic_update(struct drm_plane *plane, du->cursor_surface = vps->surf; du->cursor_dmabuf = vps->dmabuf; - /* setup new image */ - if (vps->surf) { - du->cursor_age = du->cursor_surface->snooper.age; - - ret = vmw_cursor_update_image(dev_priv, - vps->surf->snooper.image, - 64, 64, hotspot_x, hotspot_y); - } else if (vps->dmabuf) { - ret = vmw_cursor_update_dmabuf(dev_priv, vps->dmabuf, - plane->state->crtc_w, - plane->state->crtc_h, - hotspot_x, hotspot_y); - } else { - vmw_cursor_update_position(dev_priv, false, 0, 0); - return; + /* Do we have a new image? */ + if (!old_state || !old_state->fb || plane->state->fb != old_state->fb) { + if (vps->surf) { + du->cursor_age = du->cursor_surface->snooper.age; + + ret = vmw_cursor_update_image(dev_priv, + vps->surf->snooper.image, + 64, 64, hotspot_x, + hotspot_y); + } else if (vps->dmabuf) { + ret = vmw_cursor_update_dmabuf(dev_priv, vps->dmabuf, + plane->state->crtc_w, + plane->state->crtc_h, + hotspot_x, hotspot_y); + } else { + vmw_cursor_update_position(dev_priv, false, 0, 0); + return; + } } if (!ret) { @@ -503,11 +506,23 @@ int vmw_du_cursor_plane_atomic_check(struct drm_plane *plane, struct vmw_surface *surface = NULL; struct drm_framebuffer *fb = new_state->fb; + struct drm_rect src = drm_plane_state_src(new_state); + struct drm_rect dest = drm_plane_state_dest(new_state); + struct drm_rect clip = dest; /* Turning off */ if (!fb) return ret; + ret = drm_plane_helper_check_update(plane, new_state->crtc, fb, + &src, &dest, &clip, + DRM_MODE_ROTATE_0, + DRM_PLANE_HELPER_NO_SCALING, + DRM_PLANE_HELPER_NO_SCALING, + true, true, &new_state->visible); + if (!ret) + return ret; + /* A lot of the code assumes this */ if (new_state->crtc_w != 64 || new_state->crtc_h != 64) { DRM_ERROR("Invalid cursor dimensions (%d, %d)\n",