From patchwork Tue Jul 3 19:14:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 10505011 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 1CDB560225 for ; Tue, 3 Jul 2018 19:17:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BBF928C60 for ; Tue, 3 Jul 2018 19:17:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3DDC28C7F; Tue, 3 Jul 2018 19:17:22 +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=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 64D1528C60 for ; Tue, 3 Jul 2018 19:17:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 26BF56E8DD; Tue, 3 Jul 2018 19:16:52 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-BY2-obe.outbound.protection.outlook.com (mail-eopbgr710088.outbound.protection.outlook.com [40.107.71.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 39EAB6E8DD for ; Tue, 3 Jul 2018 19:16:51 +0000 (UTC) Received: from fedoratest.localdomain (155.4.205.56) by DM6PR05MB4587.namprd05.prod.outlook.com (2603:10b6:5:9f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.11; Tue, 3 Jul 2018 19:16:48 +0000 From: Thomas Hellstrom To: dri-devel@lists.freedesktop.org Subject: [PATCH -next 11/15] drm/vmwgfx: Add gui_x/y to vmw_connector_state Date: Tue, 3 Jul 2018 21:14:56 +0200 Message-Id: <20180703191500.2374-12-thellstrom@vmware.com> X-Mailer: git-send-email 2.18.0.rc1 In-Reply-To: <20180703191500.2374-1-thellstrom@vmware.com> References: <20180703191500.2374-1-thellstrom@vmware.com> MIME-Version: 1.0 X-Originating-IP: [155.4.205.56] X-ClientProxiedBy: DM5PR21CA0042.namprd21.prod.outlook.com (2603:10b6:3:ed::28) To DM6PR05MB4587.namprd05.prod.outlook.com (2603:10b6:5:9f::24) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a8a3da79-abcb-4eca-b1ad-08d5e1198698 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:DM6PR05MB4587; X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4587; 3:sJlnmf2P+Rr5GhCCys3Gl5FEHv5BeMPzgw6Lj4gpv0zspyiGJWm448KSjUj/EL5/7K9B5hYS/Y4Cp0WAOwMHb3wBz4o29Aszo9NkASoEA5+JOpZmUZcqRqlc6HB/Yc8rgU+n5blZWzdvVziaZzXym42qfXmseKJTqsvm5jYJzDJkGL7FULC24RIFYbt9gNwlYQQsnqtPWDdWPeOWsPUVdYqMCFpiyqg9OVBpzxP+7u6qR6th1eJaTYrSmdIJPKNl; 25:dKfLL7itcX8KwbhVbPkbVu+gXjwvT91wQZJSCDpm8OCvusZs7jK5Im9OjAPV79y2wCUsDhw9rAnNc0OumOBa6IcYb7lzNwarSI2N+0y3l9ilDIslwrSnCX9dJj7jt7uTFD6je7JVFulSR7cRgSrOii0M4dp3rX15T2RfbVV4/xFa/ablBvpOWrrWHuB92AXcD8UTbkeRgmcTJI+kiGBx4eU/ltIjh8mHUIH4F57VicUX06Qb7tUaUP3nG1KT5khEWLULgr3LnJwXr5iWts0PJChuAYaAR4SZPjr0QYir3BZyvHJpqva1aF0Z2wfAH7bP2MzuokcDCfFrVA2DMQGkGw==; 31:4X+ZqM3nkuxsKKVG1vqmQquP1zqt4bUAqwy9V5akAZUPbuP5YqydL2TWtfKK+B2W9qUdl0PR0k4mTJxHC69NcyVA1c/3GYLcVSj2ovfabpvW848Th5q1aAC0nRNjhH7PWZOPHTTXsJlbQRH3J4Au4x9glLks0In18bazBYZysUKkWBj6t4O8XvCvQNmk3UVA5lhczybHUyocwV5uG8G6P7Ze0Uy4pTY4XE4nH+uq0eM= X-MS-TrafficTypeDiagnostic: DM6PR05MB4587: X-LD-Processed: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; DM6PR05MB4587; 20:quAnPufOzY72MhziHkr3tmEOhXEqc34peHJEM3gFYXNv/Da+22gEsppeRilbik8R5zXv1p0beqwRN+44x0brSX7ZyeSgkvbTszliULh6R0MDzBb+4lj6WiW4J3hn0td0p4aFimG7tTjUAi44soEwv4NwJTE6ZF0ETYQeigyrIBiQbj2YkN/9orrDTQkcEu9cdbn9Tmu0XV4DnrAJwAON3GmJzhnl9SWVeDVQJuXfrNIA9RttStziyXYUYY4VN2Qnbasvx6J7pHBLHE/ALYkiw1/leNDecBm7+FWrQoDkcEk8jCiD9yoP/YOhzgXw0HUdYpWIaJ71UDKNA8FCIlNoX2bf07gKTZdm8uodPEK+4Vd+W1b4OKs4/CukWA3NGpBpJ+EUojtbK0YX6IPHbpYHGywsY3+6olSfeQQO2kx836CqbSYf/yvhT3zQQbb6NfOH+EX/YqdqLiTPPdc2XYLgcxEZNOIqfQaEe13iK2waR1mFIyB0D4ncZiXmxQUI/aDM; 4:XUmCvUrBa41SBsONzFh11KVJqdcRMr4OPepHN5mbcHWzpMZUFcugC9BqxPI43Dph8r/IwLL+nM1QJO7KT1exiZPMcOJBsADuYfccavK0q6K4EA02+BRTZyX7DM4wXEE5SvMjaUex1YTcMvwmjbRdoxY6nh3z7+pwivH3naknDMOmiVWxuZ4CuULULUazkS81p8fBak97WUlsl56LTyw2kOh56w/7b5u14iss1OuF6k1mAzkYOZpjqtt3zlrh/LB7MKNt5/8vo+Ok7mSENc79g7bpZ7xHjexW57stefJZcm1Mie7eCjpeeMj11by0OMn6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(61668805478150); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231254)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:DM6PR05MB4587; BCL:0; PCL:0; RULEID:; SRVR:DM6PR05MB4587; X-Forefront-PRVS: 0722981D2A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(136003)(366004)(39860400002)(396003)(376002)(346002)(199004)(189003)(2361001)(53936002)(76176011)(68736007)(52116002)(51416003)(47776003)(26005)(2351001)(50226002)(16526019)(97736004)(86362001)(386003)(2906002)(6506007)(66066001)(186003)(316002)(16586007)(48376002)(446003)(6486002)(50466002)(54906003)(5024004)(11346002)(2616005)(1076002)(956004)(6116002)(6512007)(476003)(81166006)(8676002)(81156014)(36756003)(3846002)(5660300001)(486006)(107886003)(106356001)(305945005)(25786009)(7736002)(4326008)(478600001)(6916009)(105586002)(6666003)(8936002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR05MB4587; H:fedoratest.localdomain; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: vmware.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM6PR05MB4587; 23:Kcq/LmyrRJePeAfk/dV4ggNg310qLA1GvJWvECmz4?= =?us-ascii?Q?w/0yYu1tH5WoblSvXAxh87fzsCQ1bfuJ8vx4EHWVtr7uPnY9VpURX/S0qSY6?= =?us-ascii?Q?q8HnU1gqks2D3eqs641CyV1WDPbLALNPK2bqptfUgBqoL+96imtDbIyARoTB?= =?us-ascii?Q?QOZjFJZ3GjzQJ+txFEEGevduBiGFrmv2Ah8UYKz5pdYIOkoksmoDOHyhJFqL?= =?us-ascii?Q?wlvoNHxzKahrAhnVu9KD0nh1Nx+CkXO53Y6AahDP/5u95RTQ2riY0Lc8GeD8?= =?us-ascii?Q?yXqHECCXxnoes8wtDRlnRJdQRxdWVokEjd5iGURBp8cY5rL1gITZCfsHtTuO?= =?us-ascii?Q?t4nIp8YPmZ8ssBp4X9z4Ki/5vuRFjA0LAwUM+DAd4B5ph2eJ1PYqrRCRG/Z1?= =?us-ascii?Q?f511t1lgdjYnhzoXO8GQQdy/wdiJzmTKSh9Jfi9ZufUSyB+uklV4iAUHyXlP?= =?us-ascii?Q?XKGUrK8Pfy7LRoiWIu/FU57l/owVmMR5czuTrfs0eVAAxldP+Eqa0OfDFpiS?= =?us-ascii?Q?Qgcobfi4A6s2eLZgk9LMfN13WncgcJhXd0xvNOPH81oZGVgDXxWBq905hyan?= =?us-ascii?Q?ibkFNxGkKdmuubu510Oo1hbdCQd2oOO/EjSNJTxwl21IchwvUGVT2uEw8T2C?= =?us-ascii?Q?26x+wJLS4qyQNqmJfRBxsAE3loQ6SLS+JvklFGJ78w66JYoB8YdWJOdPV6V3?= =?us-ascii?Q?X7CdBW9DNjlHfGh4ig/giDAwQLZF6pT8TpD3IkFXWyzcnEannLsEdyhKA9KN?= =?us-ascii?Q?ltgdlG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hgLMSyf9plY0PTCjHOyJMKtm8nfnrqRTm40ZJ; 20:RwHZ+N/W+9p59bvpbKYfeSOXYpaiHcYB7qvBJczg4TUQakDnk1wWUP9C/37U3pM8W/vwbu+fdBG8zjNefmo7E4+Hyekds+Bys87l7sReZCLZqBWHoL1wvKi41g2tcz7Cn/IIRy1/ZsYVyA99CnWLNAe9omgSTEgXADb8ovyzM/Y= X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Jul 2018 19:16:48.3063 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a8a3da79-abcb-4eca-b1ad-08d5e1198698 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR05MB4587 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Hellstrom , Deepak Rawat , linux-graphics-maintainer@vmware.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Deepak Rawat As gui_x/y positioning is display unit is protected by requested_layout_mutex adding vmw_connector_state copy of the same and modeset commit will refer the state copy to sync with modeset_check state. v2: Tested with CONFIG_PROVE_LOCKING enabled. Signed-off-by: Deepak Rawat Reviewed-by: Thomas Hellstrom Signed-off-by: Thomas Hellstrom --- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 37 +++++++++++++++++++-------- drivers/gpu/drm/vmwgfx/vmwgfx_kms.h | 18 +++++++++++++ drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c | 38 +++++++++++++++++----------- drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c | 29 +++++++++++++-------- 4 files changed, 86 insertions(+), 36 deletions(-) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c index a592d10e5c76..0fb363458ab5 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -1609,26 +1609,43 @@ static int vmw_kms_check_topology(struct drm_device *dev, for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { struct vmw_display_unit *du = vmw_crtc_to_du(crtc); + struct drm_connector *connector; + struct drm_connector_state *conn_state; + struct vmw_connector_state *vmw_conn_state; if (!new_crtc_state->enable && old_crtc_state->enable) { rects[i].x1 = 0; rects[i].y1 = 0; rects[i].x2 = 0; rects[i].y2 = 0; + continue; } - if (new_crtc_state->enable) { - /* If display unit is not active cannot enable CRTC */ - if (!du->pref_active) { - ret = -EINVAL; - goto clean; - } + if (!du->pref_active) { + ret = -EINVAL; + goto clean; + } - rects[i].x1 = du->gui_x; - rects[i].y1 = du->gui_y; - rects[i].x2 = du->gui_x + new_crtc_state->mode.hdisplay; - rects[i].y2 = du->gui_y + new_crtc_state->mode.vdisplay; + /* + * For vmwgfx each crtc has only one connector attached and it + * is not changed so don't really need to check the + * crtc->connector_mask and iterate over it. + */ + connector = &du->connector; + conn_state = drm_atomic_get_connector_state(state, connector); + if (IS_ERR(conn_state)) { + ret = PTR_ERR(conn_state); + goto clean; } + + vmw_conn_state = vmw_connector_state_to_vcs(conn_state); + vmw_conn_state->gui_x = du->gui_x; + vmw_conn_state->gui_y = du->gui_y; + + rects[i].x1 = du->gui_x; + rects[i].y1 = du->gui_y; + rects[i].x2 = du->gui_x + new_crtc_state->mode.hdisplay; + rects[i].y2 = du->gui_y + new_crtc_state->mode.vdisplay; } ret = vmw_kms_check_display_memory(dev, dev->mode_config.num_crtc, diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h index ff1caed38f94..1f2b01862652 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.h @@ -192,6 +192,24 @@ struct vmw_connector_state { struct drm_connector_state base; bool is_implicit; + + /** + * @gui_x: + * + * vmwgfx connector property representing the x position of this display + * unit (connector is synonymous to display unit) in overall topology. + * This is what the device expect as xRoot while creating screen. + */ + int gui_x; + + /** + * @gui_y: + * + * vmwgfx connector property representing the y position of this display + * unit (connector is synonymous to display unit) in overall topology. + * This is what the device expect as yRoot while creating screen. + */ + int gui_y; }; /** diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c index 74dfd4621b7e..df21d5a6f84a 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c @@ -109,7 +109,7 @@ static void vmw_sou_crtc_destroy(struct drm_crtc *crtc) */ static int vmw_sou_fifo_create(struct vmw_private *dev_priv, struct vmw_screen_object_unit *sou, - uint32_t x, uint32_t y, + int x, int y, struct drm_display_mode *mode) { size_t fifo_size; @@ -139,13 +139,8 @@ static int vmw_sou_fifo_create(struct vmw_private *dev_priv, (sou->base.unit == 0 ? SVGA_SCREEN_IS_PRIMARY : 0); cmd->obj.size.width = mode->hdisplay; cmd->obj.size.height = mode->vdisplay; - if (sou->base.is_implicit) { - cmd->obj.root.x = x; - cmd->obj.root.y = y; - } else { - cmd->obj.root.x = sou->base.gui_x; - cmd->obj.root.y = sou->base.gui_y; - } + cmd->obj.root.x = x; + cmd->obj.root.y = y; sou->base.set_gui_x = cmd->obj.root.x; sou->base.set_gui_y = cmd->obj.root.y; @@ -222,12 +217,11 @@ static void vmw_sou_crtc_mode_set_nofb(struct drm_crtc *crtc) struct vmw_plane_state *vps; int ret; - - sou = vmw_crtc_to_sou(crtc); + sou = vmw_crtc_to_sou(crtc); dev_priv = vmw_priv(crtc->dev); - ps = crtc->primary->state; - fb = ps->fb; - vps = vmw_plane_state_to_vps(ps); + ps = crtc->primary->state; + fb = ps->fb; + vps = vmw_plane_state_to_vps(ps); vfb = (fb) ? vmw_framebuffer_to_vfb(fb) : NULL; @@ -240,11 +234,25 @@ static void vmw_sou_crtc_mode_set_nofb(struct drm_crtc *crtc) } if (vfb) { + struct drm_connector_state *conn_state; + struct vmw_connector_state *vmw_conn_state; + int x, y; + sou->buffer = vps->bo; sou->buffer_size = vps->bo_size; - ret = vmw_sou_fifo_create(dev_priv, sou, crtc->x, crtc->y, - &crtc->mode); + if (sou->base.is_implicit) { + x = crtc->x; + y = crtc->y; + } else { + conn_state = sou->base.connector.state; + vmw_conn_state = vmw_connector_state_to_vcs(conn_state); + + x = vmw_conn_state->gui_x; + y = vmw_conn_state->gui_y; + } + + ret = vmw_sou_fifo_create(dev_priv, sou, x, y, &crtc->mode); if (ret) DRM_ERROR("Failed to define Screen Object %dx%d\n", crtc->x, crtc->y); diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c index 537df9034008..15f2cb2a151b 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c @@ -178,13 +178,9 @@ static int vmw_stdu_define_st(struct vmw_private *dev_priv, cmd->body.height = mode->vdisplay; cmd->body.flags = (0 == cmd->body.stid) ? SVGA_STFLAG_PRIMARY : 0; cmd->body.dpi = 0; - if (stdu->base.is_implicit) { - cmd->body.xRoot = crtc_x; - cmd->body.yRoot = crtc_y; - } else { - cmd->body.xRoot = stdu->base.gui_x; - cmd->body.yRoot = stdu->base.gui_y; - } + cmd->body.xRoot = crtc_x; + cmd->body.yRoot = crtc_y; + stdu->base.set_gui_x = cmd->body.xRoot; stdu->base.set_gui_y = cmd->body.yRoot; @@ -374,11 +370,14 @@ static void vmw_stdu_crtc_mode_set_nofb(struct drm_crtc *crtc) { struct vmw_private *dev_priv; struct vmw_screen_target_display_unit *stdu; - int ret; - + struct drm_connector_state *conn_state; + struct vmw_connector_state *vmw_conn_state; + int x, y, ret; - stdu = vmw_crtc_to_stdu(crtc); + stdu = vmw_crtc_to_stdu(crtc); dev_priv = vmw_priv(crtc->dev); + conn_state = stdu->base.connector.state; + vmw_conn_state = vmw_connector_state_to_vcs(conn_state); if (stdu->defined) { ret = vmw_stdu_bind_st(dev_priv, stdu, NULL); @@ -397,8 +396,16 @@ static void vmw_stdu_crtc_mode_set_nofb(struct drm_crtc *crtc) if (!crtc->state->enable) return; + if (stdu->base.is_implicit) { + x = crtc->x; + y = crtc->y; + } else { + x = vmw_conn_state->gui_x; + y = vmw_conn_state->gui_y; + } + vmw_svga_enable(dev_priv); - ret = vmw_stdu_define_st(dev_priv, stdu, &crtc->mode, crtc->x, crtc->y); + ret = vmw_stdu_define_st(dev_priv, stdu, &crtc->mode, x, y); if (ret) DRM_ERROR("Failed to define Screen Target of size %dx%d\n",