From patchwork Tue Jan 16 13:34:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10166963 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 C7ABC601E7 for ; Tue, 16 Jan 2018 13:35:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B8799280B0 for ; Tue, 16 Jan 2018 13:35:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ACCD82834A; Tue, 16 Jan 2018 13:35:40 +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 BADAC280B0 for ; Tue, 16 Jan 2018 13:35:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A12789991; Tue, 16 Jan 2018 13:35:36 +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-co1nam03on0083.outbound.protection.outlook.com [104.47.40.83]) by gabe.freedesktop.org (Postfix) with ESMTPS id E01F4891FB for ; Tue, 16 Jan 2018 13:35:23 +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=Zk1IorQ7cX7+c/MAGzTI0s6Zm5jVLPpEDGLGZ1x0gjE=; b=hvSO2IzVvwXHi3OgXhaZTS5eBi5Z3B5DPeXn0qbv5BU0OE4ec44IXVObtQm4KTkV/hYunW+/tfkDnorXcmEvSfvdL+FKgjajZr2bUgDy2H/aGyMuGwugNEyWzHR4v9X7agk1aOAWhgQwLJq/CXJLwxYhbK5+Hgy2ZiJAoTT7e9g= 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:21 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/7] drm/vmwgfx: Avoid iterating over display unit if crtc is available Date: Tue, 16 Jan 2018 14:34:28 +0100 Message-Id: <1516109674-10087-2-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: 64571431-93c4-45da-9e1f-08d55ce5fdbd 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:ByUhGtAV17muIDzQaqVATIlgRFl16N8MJqYU8bWBFvD8T1oQV3GrjLjiJuyjoBJGGIdw6j/ghn2kQrC5C9O40RKxs5jIxia7aNq+THje31IAVRBzvAvVIgDwpYz4cntdCg5ZIZS8TKYeQKdLVRGJWxZ7TjU8DjZZ2PqTW8njV6p2LVNznfGq2X8pnbX0TqQrrB5ifN3y/vAOVSqhFQv+SDc62J8VLf1rf3JIRz81DP73tVqPwmHI6qtV4Xs0tVbe; 25:CQQGSdqBZih3PjexS1OHCXGytA8kNMfeQS7fZkV56gpzDlPRU5YstZlKQj1UMEs/lSbEw94hrIdfOtUcZELyx4xKQmQd5leZHgzB8PrD7wvWLZmk835Vy3tpx+mZKvLQ+Aeu94WihyGBzHd7PF7zQLIEQawwmMh7N5+2PrJXTzHtoHKwpoE1jJYcoonEAT8EAllR2iC6kOVienUX310T5y0+ufNbrUph7K/NpOqpJLvJ5jBOAptg5FN7QPxBJJcgXQT2nuhgFSwgFKjfTy5sieT8glaChiHdxPXZIpV0hrkH2/ZWpzUl2lNGX21DERzn9xljiYGdaJlMqECQPCbtQA==; 31:dov+0664pxPANdVIY631RFdRK1uNjH+Lu/g4VQPb3QTXhdpIzcg23zI8ZYNlBbM1/dOMIJ7Acow+nfAzCW2YSJNWbUrzAFVRhTFZHQkh9FPL8VMmGaUy+10wp7tqXcmAEIrHoKA3yF5e6TwLmnChLZG9pt+DBiXtG5qtO4WobKG7kVjheaBLrdUyA7BqV330fauIsXEGRnF9twdxA8w3hnLMpPuwWsEjZrv5K+rpX1E= X-MS-TrafficTypeDiagnostic: BLUPR05MB755: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=thellstrom@vmware.com; X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB755; 20:9q406y/FaabpVzJzJqe5LeQurWIowofZ48412+Gyf/wNIdEz+XubByW062j6jksVig5JMlVNG7gPbx/1LfBvw2790vQbqtU4VFaU1NEB4EOzq4ELy/4ykTaQk3Slu+ckm/AiImK7yDod5a2PvMrd3vurcYNMD1Q7Uu9J1wORO5s9GFxSQ3OxaklPHvlN/0UovoeWmBNakZa9EoQWh9VTpsi5k91nFMGeNvVZE25sWw0pBg/qL9G2xUIvEmwlWaQ5TvaKe10EdNRpNr0F2ZtLs13hSQ2KnJzWOzsIOsSKbyb9P6Jt5hMMaBIm6pRYy7T0bq/ZVQ/MAUrLDHRsI1lwBKVP5wTs0sl5YtaRh2MSEEkhAczIwFo2bSz0QASdZ0slzYGnR3SEu9OLHWz+8qMZENESc9rytnSZxihqyZ8RlpcekRqzm5bJH2MPCAgojG8Sd+sM2MEkzKlsRqwhiD4QsvgMULclOGc8ewTndtSoNUayAlqXoqamdaNxLHofsT13; 4:/wEGkIPFVIDTvox6vUt5zFW7lEB44GLsCRE9SoL7ADkRm6LLpHn1UIRyGmaCTtGcIHWnNa2FLSgOGcZnwAFSXP32IBMVWczBBfOWyKGYHEf3ClqWeDukA0SGO9e5A/U/BSC/KKmB+zpweA6fo04ggDSZrP2neT7DofwKNjQAAqPlhi5Snj4Fkytl+JEri0hMmSRX8hXRvSDs8K47atvmxhX/BVo0Wle77jM3w+rXNUgbymVDkXcvjbmE8pMONrgvK3t7LJmV+DDqmGUKLhnd/93p5bGE/xGmThPbD0SSG2r9nUNl2qBPSftOczYCVCmZ 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)(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:vvGWRvE5Xrt/eFRLvNhKIrjUQmyto/kdyIX/RERvXT?= =?us-ascii?Q?s5sO9aXCtObYNqv3hMBoYKdoFOS0+Z3NaQNjK1TCoOO1xqmi4sg4n6x5h69G?= =?us-ascii?Q?Sv4VoXkz5zPDmL++tAhGK5gE6J0U9iratT99zin0jQtqhwgdUVVKtwfcknaQ?= =?us-ascii?Q?XTyxzxJ2UEXr8JuoauOhLOGxp6uCSQmO6hkqQhYOt/aXc5Vn7FjsM3ZdTY4h?= =?us-ascii?Q?dmWht0NI/Uq6bakMyA17PbTBcMYSa6oSUHIDb51OQiGJD4FzIl9IymWVHI/8?= =?us-ascii?Q?/RZbcAMZ4E/0eqAZ+CjSpOSJek0fzxeWfK+tLiXPXammOfbfEezwNIqa2zGS?= =?us-ascii?Q?t5o2LIof9RzpmlY+vKh3reb/6jkIu3P6GZ9WkRcf1jbGGYn1v0VWCZ+vmt6G?= =?us-ascii?Q?6zhshuy/zoYqEplZFxs5Z1eG01JyafaTsAFVtTYqF9hkpNouf2AsiIha89F6?= =?us-ascii?Q?++qMCnHlka8tOn7dFQT4M1+jxsqInRRhQJvP19ljo2Tcyggswzz07xs7AXBd?= =?us-ascii?Q?3PlCNNHvBvqDeoCC4yQX3WVMOFoV3MskNz8kOlauagH9xwEAIQUGlCoHVmVa?= =?us-ascii?Q?9T5JaiC6VsDvJm4GCrSdtLLggFd39QaxWYWqV7cNlhBBUUSLOMp3R8TQDAgT?= =?us-ascii?Q?d0uMQl4r1GhQfc5162iIA6d6R5TPHDwnQIFNtetZrNvoiLJeYrvj8F5reIwk?= =?us-ascii?Q?eRSHkGeCUXQcBa+741XTwdairi2PVz9sRI8n0/KpGSvUO3PFgjmwOixhJaNL?= =?us-ascii?Q?1fZOwPk+Fmjue81URB6EoAu+cpCiyYi3U1zWUgEhkbhgTKOKp330NJJg//PL?= =?us-ascii?Q?HrvafDvTbWzKrQLwiJHIrkH+RYFV7Yn3IDZNls3m/yMAQnAA876bFCSHmreJ?= =?us-ascii?Q?D45EuC2LwdewMrQb+i4+8Z7XTe5TezQ+dYz3u7H7kStkuF8wBRwlTH4s8oYV?= =?us-ascii?Q?2OKM0HaYqu9a+QGsn8ROsh1kyNMybyPYr3QRbeOuUds1ndaBbUoxbMxpd+Ux?= =?us-ascii?Q?MToObaKaqtXgbDAX4xFi7J0LBkNniaxmbXYLPrNV7xJpizgTjVr0nVrCvzcI?= =?us-ascii?Q?cWNykN9dtqQ9tcOidcpIcXmpbC2FhUUd3SrzJ/hp2CIKspoHnsuNfqnmIWz7?= =?us-ascii?Q?RLk2TRBdrZzIj6AX8jp2xhB8Dljdni?= X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB755; 6:qfOHOPlBPsTKP21EcDkGjkUKTkT49SqoYTr6cWplA4oEozXqaqCXDElZskmq2CrGkXX/Uq7tCQ1qaN/euwREpdsLAWu4BggdJDKFUDAg7Y3ze5wJVwPWgje2shEDhI5Lk2dxsSMzHOdlRWGiTj0HO8zkYOOW92LUFceNIlgGfOjg6aYWkAjbQ/7GmhHwd++2miKThbCrzf/fl8fi5U818370u39GS5vivkP3a4UvKr9NPWAJM/Evcb8X15BXbQa9MEMfTFH0ecaPqFIsPzlnnM8DFoff+454CUb9+coVGhb5W36GzluXc7g+gVa9L8J/zToF5WvYUjv8AXaMTXtadYJwBYRFMCh7tRrtzSC5chE=; 5:unevgCXQ2BQprFAa2FTNINt69UWo8kHrFDXd6nefzdhHvzsQIwiEmGBpxpPUWR2v0k4UB0fmpA4vtNPbFBRQR2UYzWe2aqEARLOP8ZmBWhD7ZF4DqSxsAmDU8F4Y3osUM4XBFIij0XZiHtG4CssXQTRVwGWVXAlQLzfM+pBXtv8=; 24:X97G5D+bl6bH0DaQJz19ICNNyS0huSdzkojDAXUV2euH0fsBcTCiRM34X588zaiJB8X92fVoDbjjYlLt5t9WpGwI2So9I576aruzhcZiE3E=; 7:TRG/Iz7c8U0tEZ2fE3bz9RshmEmp3E317PXGArK0stUaztMdq/73XHoAS3yjrVBTIhIBNRoMZzVZCp+JQCXv5qaFQdeXbHEw+/2z8kPYIN/O5lF4K8vEZCEiUbouv4zInvDM75YxF6ShhPAzO/M9Mn+sathkcFmbeOgcmrb9T+2ImOtaDUJlshtiOSEKuzI338h0N72uCre+GvO1DrsgpofcPq6GdUqV1b8b55dDugRKyz3G3uTCQUIMhhIYveLf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR05MB755; 20:3byj52fZXklDBNLiV9ODuon1EWvTLAZahtv7w1KxYEOlLICETGQAIGeD26mhVGXSOeTDsm7N1R7wIUPXQnd4D35s0WnHm09LG46wlmeY37m6x2VQEspyBPJRQqfdMv+0FFFSd089HHaHyh+H8PXjoclmYrdg21PQx0vTuXOtp6g= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2018 13:35:21.1965 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 64571431-93c4-45da-9e1f-08d55ce5fdbd X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR05MB755 Cc: Deepak Rawat 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: Deepak Rawat In case of page flip there is no need to iterate over all display unit in the function "vmw_kms_helper_dirty". If crtc is available then dirty commands is performed on that crtc only. Signed-off-by: Deepak Rawat Reviewed-by: Sinclair Yeh Reviewed-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 31 +++++++++++++++++++------------ drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 17 ++++++++++++----- drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 19 ++++++++++++++----- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 15 +++++++++++---- 4 files changed, 56 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index a2a93d7..cc98e01 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -900,11 +900,11 @@ static int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer, if (dev_priv->active_display_unit == vmw_du_screen_object) ret = vmw_kms_sou_do_surface_dirty(dev_priv, &vfbs->base, clips, NULL, NULL, 0, 0, - num_clips, inc, NULL); + num_clips, inc, NULL, NULL); else ret = vmw_kms_stdu_surface_dirty(dev_priv, &vfbs->base, clips, NULL, NULL, 0, 0, - num_clips, inc, NULL); + num_clips, inc, NULL, NULL); vmw_fifo_flush(dev_priv, false); ttm_read_unlock(&dev_priv->reservation_sem); @@ -940,11 +940,12 @@ int vmw_kms_readback(struct vmw_private *dev_priv, switch (dev_priv->active_display_unit) { case vmw_du_screen_object: return vmw_kms_sou_readback(dev_priv, file_priv, vfb, - user_fence_rep, vclips, num_clips); + user_fence_rep, vclips, num_clips, + NULL); case vmw_du_screen_target: return vmw_kms_stdu_dma(dev_priv, file_priv, vfb, user_fence_rep, NULL, vclips, num_clips, - 1, false, true); + 1, false, true, NULL); default: WARN_ONCE(true, "Readback called with invalid display system.\n"); @@ -1102,12 +1103,12 @@ static int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer, case vmw_du_screen_target: ret = vmw_kms_stdu_dma(dev_priv, NULL, &vfbd->base, NULL, clips, NULL, num_clips, increment, - true, true); + true, true, NULL); break; case vmw_du_screen_object: ret = vmw_kms_sou_do_dmabuf_dirty(dev_priv, &vfbd->base, clips, NULL, num_clips, - increment, true, NULL); + increment, true, NULL, NULL); break; case vmw_du_legacy: ret = vmw_kms_ldu_do_dmabuf_dirty(dev_priv, &vfbd->base, 0, 0, @@ -1593,7 +1594,7 @@ static int vmw_kms_generic_present(struct vmw_private *dev_priv, { return vmw_kms_sou_do_surface_dirty(dev_priv, vfb, NULL, clips, &surface->res, destX, destY, - num_clips, 1, NULL); + num_clips, 1, NULL, NULL); } @@ -1612,7 +1613,7 @@ int vmw_kms_present(struct vmw_private *dev_priv, case vmw_du_screen_target: ret = vmw_kms_stdu_surface_dirty(dev_priv, vfb, NULL, clips, &surface->res, destX, destY, - num_clips, 1, NULL); + num_clips, 1, NULL, NULL); break; case vmw_du_screen_object: ret = vmw_kms_generic_present(dev_priv, file_priv, vfb, surface, @@ -2340,10 +2341,16 @@ int vmw_kms_helper_dirty(struct vmw_private *dev_priv, dirty->dev_priv = dev_priv; - list_for_each_entry(crtc, &dev_priv->dev->mode_config.crtc_list, head) { - if (crtc->primary->fb != &framebuffer->base) - continue; - units[num_units++] = vmw_crtc_to_du(crtc); + /* If crtc is passed, no need to iterate over other display units */ + if (dirty->crtc) { + units[num_units++] = vmw_crtc_to_du(dirty->crtc); + } else { + list_for_each_entry(crtc, &dev_priv->dev->mode_config.crtc_list, + head) { + if (crtc->primary->fb != &framebuffer->base) + continue; + units[num_units++] = vmw_crtc_to_du(crtc); + } } for (k = 0; k < num_units; k++) { diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index ff9c838..70a7be2 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h @@ -50,6 +50,7 @@ * @unit: The current display unit. Set up by the helper before a call to @clip. * @cmd: The allocated fifo space. Set up by the helper before the first @clip * call. + * @crtc: The crtc for which to build dirty commands. * @num_hits: Number of clip rect commands for this display unit. * Cleared by the helper before the first @clip call. Updated by the @clip * callback. @@ -71,6 +72,7 @@ struct vmw_kms_dirty { struct vmw_private *dev_priv; struct vmw_display_unit *unit; void *cmd; + struct drm_crtc *crtc; u32 num_hits; s32 fb_x; s32 fb_y; @@ -398,20 +400,23 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv, s32 dest_x, s32 dest_y, unsigned num_clips, int inc, - struct vmw_fence_obj **out_fence); + struct vmw_fence_obj **out_fence, + struct drm_crtc *crtc); int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv, struct vmw_framebuffer *framebuffer, struct drm_clip_rect *clips, struct drm_vmw_rect *vclips, unsigned num_clips, int increment, bool interruptible, - struct vmw_fence_obj **out_fence); + struct vmw_fence_obj **out_fence, + struct drm_crtc *crtc); int vmw_kms_sou_readback(struct vmw_private *dev_priv, struct drm_file *file_priv, struct vmw_framebuffer *vfb, struct drm_vmw_fence_rep __user *user_fence_rep, struct drm_vmw_rect *vclips, - uint32_t num_clips); + uint32_t num_clips, + struct drm_crtc *crtc); /* * Screen Target Display Unit functions - vmwgfx_stdu.c @@ -425,7 +430,8 @@ int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv, s32 dest_x, s32 dest_y, unsigned num_clips, int inc, - struct vmw_fence_obj **out_fence); + struct vmw_fence_obj **out_fence, + struct drm_crtc *crtc); int vmw_kms_stdu_dma(struct vmw_private *dev_priv, struct drm_file *file_priv, struct vmw_framebuffer *vfb, @@ -435,7 +441,8 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, uint32_t num_clips, int increment, bool to_surface, - bool interruptible); + bool interruptible, + struct drm_crtc *crtc); int vmw_kms_set_config(struct drm_mode_set *set, struct drm_modeset_acquire_ctx *ctx); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index bc5f602..21f4019 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c @@ -341,11 +341,11 @@ static int vmw_sou_crtc_page_flip(struct drm_crtc *crtc, if (vfb->dmabuf) ret = vmw_kms_sou_do_dmabuf_dirty(dev_priv, vfb, NULL, &vclips, 1, 1, - true, &fence); + true, &fence, crtc); else ret = vmw_kms_sou_do_surface_dirty(dev_priv, vfb, NULL, &vclips, NULL, - 0, 0, 1, 1, &fence); + 0, 0, 1, 1, &fence, crtc); if (ret != 0) @@ -892,6 +892,7 @@ static void vmw_sou_surface_clip(struct vmw_kms_dirty *dirty) * @out_fence: If non-NULL, will return a ref-counted pointer to a * struct vmw_fence_obj. The returned fence pointer may be NULL in which * case the device has already synchronized. + * @crtc: If crtc is passed, perform surface dirty on that crtc only. * * Returns 0 on success, negative error code on failure. -ERESTARTSYS if * interrupted. @@ -904,7 +905,8 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv, s32 dest_x, s32 dest_y, unsigned num_clips, int inc, - struct vmw_fence_obj **out_fence) + struct vmw_fence_obj **out_fence, + struct drm_crtc *crtc) { struct vmw_framebuffer_surface *vfbs = container_of(framebuffer, typeof(*vfbs), base); @@ -923,6 +925,7 @@ int vmw_kms_sou_do_surface_dirty(struct vmw_private *dev_priv, sdirty.base.dev_priv = dev_priv; sdirty.base.fifo_reserve_size = sizeof(struct vmw_kms_sou_dirty_cmd) + sizeof(SVGASignedRect) * num_clips; + sdirty.base.crtc = crtc; sdirty.sid = srf->id; sdirty.left = sdirty.top = S32_MAX; @@ -994,6 +997,7 @@ static void vmw_sou_dmabuf_clip(struct vmw_kms_dirty *dirty) * @out_fence: If non-NULL, will return a ref-counted pointer to a * struct vmw_fence_obj. The returned fence pointer may be NULL in which * case the device has already synchronized. + * @crtc: If crtc is passed, perform dmabuf dirty on that crtc only. * * Returns 0 on success, negative error code on failure. -ERESTARTSYS if * interrupted. @@ -1004,7 +1008,8 @@ int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv, struct drm_vmw_rect *vclips, unsigned num_clips, int increment, bool interruptible, - struct vmw_fence_obj **out_fence) + struct vmw_fence_obj **out_fence, + struct drm_crtc *crtc) { struct vmw_dma_buffer *buf = container_of(framebuffer, struct vmw_framebuffer_dmabuf, @@ -1021,6 +1026,7 @@ int vmw_kms_sou_do_dmabuf_dirty(struct vmw_private *dev_priv, if (unlikely(ret != 0)) goto out_revert; + dirty.crtc = crtc; dirty.fifo_commit = vmw_sou_dmabuf_fifo_commit; dirty.clip = vmw_sou_dmabuf_clip; dirty.fifo_reserve_size = sizeof(struct vmw_kms_sou_dmabuf_blit) * @@ -1092,6 +1098,7 @@ static void vmw_sou_readback_clip(struct vmw_kms_dirty *dirty) * Must be set to non-NULL if @file_priv is non-NULL. * @vclips: Array of clip rects. * @num_clips: Number of clip rects in @vclips. + * @crtc: If crtc is passed, readback on that crtc only. * * Returns 0 on success, negative error code on failure. -ERESTARTSYS if * interrupted. @@ -1101,7 +1108,8 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv, struct vmw_framebuffer *vfb, struct drm_vmw_fence_rep __user *user_fence_rep, struct drm_vmw_rect *vclips, - uint32_t num_clips) + uint32_t num_clips, + struct drm_crtc *crtc) { struct vmw_dma_buffer *buf = container_of(vfb, struct vmw_framebuffer_dmabuf, base)->buffer; @@ -1116,6 +1124,7 @@ int vmw_kms_sou_readback(struct vmw_private *dev_priv, if (unlikely(ret != 0)) goto out_revert; + dirty.crtc = crtc; dirty.fifo_commit = vmw_sou_readback_fifo_commit; dirty.clip = vmw_sou_readback_clip; dirty.fifo_reserve_size = sizeof(struct vmw_kms_sou_readback_blit) * diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c index 90b5437..b2f7db6 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c @@ -530,10 +530,10 @@ static int vmw_stdu_crtc_page_flip(struct drm_crtc *crtc, if (vfb->dmabuf) ret = vmw_kms_stdu_dma(dev_priv, NULL, vfb, NULL, NULL, &vclips, - 1, 1, true, false); + 1, 1, true, false, crtc); else ret = vmw_kms_stdu_surface_dirty(dev_priv, vfb, NULL, &vclips, - NULL, 0, 0, 1, 1, NULL); + NULL, 0, 0, 1, 1, NULL, crtc); if (ret) { DRM_ERROR("Page flip update error %d.\n", ret); return ret; @@ -793,6 +793,7 @@ static void vmw_stdu_dmabuf_cpu_commit(struct vmw_kms_dirty *dirty) * @to_surface: Whether to DMA to the screen target system as opposed to * from the screen target system. * @interruptible: Whether to perform waits interruptible if possible. + * @crtc: If crtc is passed, perform stdu dma on that crtc only. * * If DMA-ing till the screen target system, the function will also notify * the screen target system that a bounding box of the cliprects has been @@ -809,7 +810,8 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, uint32_t num_clips, int increment, bool to_surface, - bool interruptible) + bool interruptible, + struct drm_crtc *crtc) { struct vmw_dma_buffer *buf = container_of(vfb, struct vmw_framebuffer_dmabuf, base)->buffer; @@ -843,6 +845,8 @@ int vmw_kms_stdu_dma(struct vmw_private *dev_priv, ddirty.base.fifo_reserve_size = 0; } + ddirty.base.crtc = crtc; + ret = vmw_kms_helper_dirty(dev_priv, vfb, clips, vclips, 0, 0, num_clips, increment, &ddirty.base); vmw_kms_helper_buffer_finish(dev_priv, file_priv, buf, NULL, @@ -954,6 +958,7 @@ static void vmw_kms_stdu_surface_fifo_commit(struct vmw_kms_dirty *dirty) * @out_fence: If non-NULL, will return a ref-counted pointer to a * struct vmw_fence_obj. The returned fence pointer may be NULL in which * case the device has already synchronized. + * @crtc: If crtc is passed, perform surface dirty on that crtc only. * * Returns 0 on success, negative error code on failure. -ERESTARTSYS if * interrupted. @@ -966,7 +971,8 @@ int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv, s32 dest_x, s32 dest_y, unsigned num_clips, int inc, - struct vmw_fence_obj **out_fence) + struct vmw_fence_obj **out_fence, + struct drm_crtc *crtc) { struct vmw_framebuffer_surface *vfbs = container_of(framebuffer, typeof(*vfbs), base); @@ -991,6 +997,7 @@ int vmw_kms_stdu_surface_dirty(struct vmw_private *dev_priv, sdirty.base.fifo_reserve_size = sizeof(struct vmw_stdu_surface_copy) + sizeof(SVGA3dCopyBox) * num_clips + sizeof(struct vmw_stdu_update); + sdirty.base.crtc = crtc; sdirty.sid = srf->id; sdirty.left = sdirty.top = S32_MAX; sdirty.right = sdirty.bottom = S32_MIN;