Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3423342imu; Mon, 24 Dec 2018 01:27:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN6onB4cY75N+Oj7mA3wRuZ/RmcQ648rCObnxesU/4GVj2ZqmKN0Nwu4bIWyk2qjyBI9aaoF X-Received: by 2002:a63:790e:: with SMTP id u14mr11737775pgc.452.1545643649160; Mon, 24 Dec 2018 01:27:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545643649; cv=none; d=google.com; s=arc-20160816; b=TuDJHxqTgsLcVXqdXWD+Cfclfv3y5W1AYmDbgbev4eZ1X0hH3ZdNGqOdffw6hBVoON YlTBN6tUw4NID1jZ0iVZBU0xmKHTLaxMu5OteDH/7vuY1qwQpYCG12y/bGIgXpLtsX8/ mxF4HH+lpB8OIodY8CfTM3M2MToGnxwWsKKbisx5uzZYhHWwV3ogGngig70/ETs8JrMu awlPMj/G0cD8ZeEEGgg7+HK20eufDnxTg6R6BKf632Ro1060zk0KWYu6K40UGbws2ace fzDiKdiodaQwc3I4ZcPGkkusJknaC8JDo7/XH64lYUlPaFV7OwJ0XLgxdpV/ADhsGB2w +HwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:nodisclaimer :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=fJaXMInjZMChn5UORrP5XzFhySM7dS7Ke9ALDiknM08=; b=tXK8/Lz+iufo81RwSoBXB8zw+mjzfkhVElvxR16BW/tWaiOuM9eI8DpwDSYzAQnIna gMf+Snio45fX9671wKvd4wFPO3AuocBObbi7eDmQwTRM6tIRCFD0Dh9ONdhA11YyW6q9 joVfgTiHHUrIqILYcyy66wSI41QUC7PV9g9Cx6+J8exTITVkG5DFHkKDnmB0a3LQQsEj JgHKuU0nz/eTZB86TfRXEIwm7Ho+agZaHAegOUwTXvvvyaHR4omF3nXqz8CaZ9IMJfcF J7puJ1lkO7qltgCbDcGRwlGVGijnL9EWdiD8SU5zeYsrRyetFilZptPtQjLqLqAr8sOO FxFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector1-arm-com header.b=NjWpRimS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si25858486pll.179.2018.12.24.01.27.14; Mon, 24 Dec 2018 01:27:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector1-arm-com header.b=NjWpRimS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725877AbeLXJZw (ORCPT + 99 others); Mon, 24 Dec 2018 04:25:52 -0500 Received: from mail-eopbgr150071.outbound.protection.outlook.com ([40.107.15.71]:31829 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725294AbeLXJZw (ORCPT ); Mon, 24 Dec 2018 04:25:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fJaXMInjZMChn5UORrP5XzFhySM7dS7Ke9ALDiknM08=; b=NjWpRimSwmp2L5QMQ6fUzreqgoIbth6sYa5Vo9yBtQSf1AcUEOmQNSAJjUsfQsIIE2FR/cvjgk8THhJGjDaEteVlxjPZ9VI9y4qpRo/pVqcXeHu9w0u+QQio3aqFgxemus36dHT6lqPPHkQQ7WOJ2G0zECygXn5KPHsQangP6wY= Received: from AM3PR08MB0611.eurprd08.prod.outlook.com (10.163.188.149) by AM3PR08MB0262.eurprd08.prod.outlook.com (10.161.35.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1446.23; Mon, 24 Dec 2018 09:25:47 +0000 Received: from AM3PR08MB0611.eurprd08.prod.outlook.com ([fe80::3c73:534c:9c6e:352d]) by AM3PR08MB0611.eurprd08.prod.outlook.com ([fe80::3c73:534c:9c6e:352d%2]) with mapi id 15.20.1446.026; Mon, 24 Dec 2018 09:25:47 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau CC: "Jonathan Chai (Arm Technology China)" , Brian Starkey , "Julien Yin (Arm Technology China)" , "thomas Sun (Arm Technology China)" , Alexandru-Cosmin Gheorghe , "Lowry Li (Arm Technology China)" , Ayan Halder , "Tiannan Zhu (Arm Technology China)" , "Jin Gao (Arm Technology China)" , "Yiqi Kang (Arm Technology China)" , nd , "malidp@foss.arm.com" , "airlied@linux.ie" , "yamada.masahiro@socionext.com" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "maarten.lankhorst@linux.intel.com" , "maxime.ripard@bootlin.com" , "sean@poorly.run" , "james qian wang (Arm Technology China)" Subject: [PATCH 03/11] drm/komeda: Add komeda_crtc_atomic_flush Thread-Topic: [PATCH 03/11] drm/komeda: Add komeda_crtc_atomic_flush Thread-Index: AQHUm2qnpeiZmYYETEWMorhI4veo0g== Date: Mon, 24 Dec 2018 09:25:47 +0000 Message-ID: <20181224092435.2792-4-james.qian.wang@arm.com> References: <20181224092435.2792-1-james.qian.wang@arm.com> In-Reply-To: <20181224092435.2792-1-james.qian.wang@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: SYXPR01CA0099.ausprd01.prod.outlook.com (2603:10c6:0:2e::32) To AM3PR08MB0611.eurprd08.prod.outlook.com (2a01:111:e400:c408::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AM3PR08MB0262;6:lbZW9Txw2wVOvTR9SX32ChtQmYz1oZEhRRv92wLsZD4naA/wuOSjCskONPSj6cXHqSJvNtvxzA0IQAFNZILo2JNjVqk0iQ0SOTipI7cDiBHXGm0xtepn+z5FIWK3KcrhWy92wfN1oyH1jMwqvoNlgAg8Jn1s1LoKivZkzcIPyk8eO6IveyM6fW8bswL4hLqy9b66CgUhVNj3nZD+aHfL12ACft9xVcV3ls8ug46oHZVOEZnhrfvdY55n/KTfsGJkhNGehjZBPo2OjcnfoydLmn0VpaceiMlhAye+60/4pnYy8mxf0nJffJWzaG+MXUmG1Jf7tr0qOKQS3xWLJ7ci2wPmT0y0bPjM521MjPR88UuvUpT5yX7D7VQMP/8XZt35t3NiDm07szN9tJ0mDl8M4C61FghrvdjQfSPuJXv2LXT3/I+kzcMHsvXxlwYORFF662bgdX2MpafU+k6KGdn7/A==;5:Irn1/rBaZdudjKz+U3Ui1gYapOHqT8PGwotQEkct+MS5mv3FpcQWEb7DxEj7CH3v1aTp1KMxOhDHkpuRKzAxi5RRDxg0t6aG7e3IiatEjTbg+mAoVGszky9TMN40PT6/Ff7ZOUku5j9Eq9Wv9IPnWTmWQrgHd1WqXEpfgGRbp+k=;7:mgGxJmsQlLmrcSdVhIVM/0VzknvaPNIcns/LaAkMaaBe/YT+a1Yo00no4wPx07HOEIIee72r0MXtA2LqeuMVtcT22Z/8gaMfAoO4kq6hSvD5FPd9KFPBG0RC1YDoZnazyJk+s/XemRv7+c7wvnvy5g== x-ms-office365-filtering-correlation-id: 94df6142-c1d6-4c62-17d1-08d66981c941 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:AM3PR08MB0262; x-ms-traffictypediagnostic: AM3PR08MB0262: nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(2401047)(8121501046)(10201501046)(3231475)(944501520)(52105112)(3002001)(93006095)(93001095)(6055026)(6041310)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:AM3PR08MB0262;BCL:0;PCL:0;RULEID:;SRVR:AM3PR08MB0262; x-forefront-prvs: 0896BFCE6C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(396003)(366004)(136003)(376002)(39850400004)(346002)(199004)(189003)(4326008)(256004)(305945005)(53936002)(6862004)(71190400001)(71200400001)(486006)(7736002)(97736004)(446003)(2906002)(52116002)(6116002)(76176011)(1076003)(6436002)(86362001)(6512007)(5660300001)(11346002)(186003)(26005)(68736007)(3846002)(2616005)(476003)(55236004)(386003)(102836004)(14444005)(6506007)(25786009)(103116003)(14454004)(105586002)(99286004)(54906003)(37006003)(6486002)(106356001)(316002)(8676002)(81166006)(81156014)(8936002)(6636002)(36756003)(478600001)(66066001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM3PR08MB0262;H:AM3PR08MB0611.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: /aAYzVk5ng2c7eHZsQrFeZ35a6Uk+O8mGw0gqdDv+lt4/lBPYnG2zReJbcZxLlGpcaPSdysip37Ehb985j4BZjDdIR7TLtIHjNNU++YEC6ZPlSmha2Hb/2w4QldnWeJTGEd82B064qP1lDfFLsLrifIJUcxEsSft/ntkcLyQI/HZByN9GfLpM7wtLQydL0jbfhVKPNZXpai/gHwmWHBkuZP3QC9iwpOZdnEgxoUCwU+yqt4XeJqFtK/FTcCg8nq0ipwf8YX8Ugm5xsUyDX1vYlKj5eZFfcAa4XtVfKdgHrTmvz0ac+jX00DjabXdiSx3 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94df6142-c1d6-4c62-17d1-08d66981c941 X-MS-Exchange-CrossTenant-originalarrivaltime: 24 Dec 2018 09:25:47.1460 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM3PR08MB0262 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A komeda flush is comprised two steps: 1. update pipeline/component state to HW. 2. call dev_func->flush to notify HW to kickoff the update. Signed-off-by: James (Qian) Wang --- .../gpu/drm/arm/display/komeda/d71/d71_dev.c | 11 ++++++ .../gpu/drm/arm/display/komeda/komeda_crtc.c | 33 +++++++++++++++++ .../gpu/drm/arm/display/komeda/komeda_dev.h | 3 ++ .../drm/arm/display/komeda/komeda_pipeline.h | 5 +++ .../display/komeda/komeda_pipeline_state.c | 37 +++++++++++++++++++ 5 files changed, 89 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c b/drivers/gpu= /drm/arm/display/komeda/d71/d71_dev.c index 895603695d79..ecbcf26e8ad6 100644 --- a/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c +++ b/drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c @@ -241,6 +241,16 @@ static int d71_disable_irq(struct komeda_dev *mdev) return 0; } =20 +static void d71_flush(struct komeda_dev *mdev, + int master_pipe, u32 active_pipes) +{ + struct d71_dev *d71 =3D mdev->chip_data; + u32 reg_offset =3D (master_pipe =3D=3D 0) ? + GCU_CONFIG_VALID0 : GCU_CONFIG_VALID1; + + malidp_write32(d71->gcu_addr, reg_offset, GCU_CONFIG_CVAL); +} + static int d71_reset(struct d71_dev *d71) { u32 __iomem *gcu =3D d71->gcu_addr; @@ -451,6 +461,7 @@ static struct komeda_dev_funcs d71_chip_funcs =3D { .irq_handler =3D d71_irq_handler, .enable_irq =3D d71_enable_irq, .disable_irq =3D d71_disable_irq, + .flush =3D d71_flush, }; =20 struct komeda_dev_funcs * diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu= /drm/arm/display/komeda/komeda_crtc.c index f84024aae155..b4640971e47e 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -58,8 +58,41 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrt= c, DRM_INFO("FLIP Done.\n"); } =20 +static void +komeda_crtc_do_flush(struct drm_crtc *crtc, + struct drm_crtc_state *old) +{ + struct komeda_crtc *kcrtc =3D to_kcrtc(crtc); + struct komeda_crtc_state *kcrtc_st =3D to_kcrtc_st(crtc->state); + struct komeda_dev *mdev =3D kcrtc->base.dev->dev_private; + struct komeda_pipeline *master =3D kcrtc->master; + + DRM_DEBUG_ATOMIC("CRTC%d_FLUSH: active_pipes: 0x%x, affected: 0x%x.\n", + drm_crtc_index(crtc), + kcrtc_st->active_pipes, kcrtc_st->affected_pipes); + + /* step 1: update the pipeline/component state to HW */ + if (has_bit(master->id, kcrtc_st->affected_pipes)) + komeda_pipeline_update(master, old->state); + + /* step 2: notify the HW to kickoff the update */ + mdev->funcs->flush(mdev, master->id, kcrtc_st->active_pipes); +} + +static void +komeda_crtc_atomic_flush(struct drm_crtc *crtc, + struct drm_crtc_state *old) +{ + /* commit with modeset will be handled in enable/disable */ + if (drm_atomic_crtc_needs_modeset(crtc->state)) + return; + + komeda_crtc_do_flush(crtc, old); +} + struct drm_crtc_helper_funcs komeda_crtc_helper_funcs =3D { .atomic_check =3D komeda_crtc_atomic_check, + .atomic_flush =3D komeda_crtc_atomic_flush, }; =20 static const struct drm_crtc_funcs komeda_crtc_funcs =3D { diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/= drm/arm/display/komeda/komeda_dev.h index 5f96d2f57c4e..686ce97ce30f 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h @@ -106,6 +106,9 @@ struct komeda_dev_funcs { =20 /** @dump_register: Optional, dump registers to seq_file */ void (*dump_register)(struct komeda_dev *mdev, struct seq_file *seq); + /** @flush: Notify the HW to flush or kickoff the update */ + void (*flush)(struct komeda_dev *mdev, + int master_pipe, u32 active_pipes); }; =20 /** diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers= /gpu/drm/arm/display/komeda/komeda_pipeline.h index 9a17d0152021..9a96ee906a36 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -421,4 +421,9 @@ int komeda_build_display_data_flow(struct komeda_crtc *= kcrtc, int komeda_release_unclaimed_resources(struct komeda_pipeline *pipe, struct komeda_crtc_state *kcrtc_st); =20 +void komeda_pipeline_disable(struct komeda_pipeline *pipe, + struct drm_atomic_state *old_state); +void komeda_pipeline_update(struct komeda_pipeline *pipe, + struct drm_atomic_state *old_state); + #endif /* _KOMEDA_PIPELINE_H_*/ diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/d= rivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c index 920d2b40e9cc..19d8ed904bf7 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -42,6 +42,18 @@ komeda_pipeline_get_state(struct komeda_pipeline *pipe, return priv_to_pipe_st(priv_st); } =20 +struct komeda_pipeline_state * +komeda_pipeline_get_old_state(struct komeda_pipeline *pipe, + struct drm_atomic_state *state) +{ + struct drm_private_state *priv_st; + + priv_st =3D drm_atomic_get_old_private_obj_state(state, &pipe->obj); + if (priv_st) + return priv_to_pipe_st(priv_st); + return NULL; +} + struct komeda_pipeline_state * komeda_pipeline_get_new_state(struct komeda_pipeline *pipe, struct drm_atomic_state *state) @@ -536,3 +548,28 @@ int komeda_release_unclaimed_resources(struct komeda_p= ipeline *pipe, =20 return 0; } + +void komeda_pipeline_update(struct komeda_pipeline *pipe, + struct drm_atomic_state *old_state) +{ + struct komeda_pipeline_state *new =3D priv_to_pipe_st(pipe->obj.state); + struct komeda_pipeline_state *old; + struct komeda_component *c; + u32 id, changed_comps =3D 0; + + old =3D komeda_pipeline_get_old_state(pipe, old_state); + + changed_comps =3D new->active_comps | old->active_comps; + + DRM_DEBUG_ATOMIC("PIPE%d: active_comps: 0x%x, changed: 0x%x.\n", + pipe->id, new->active_comps, changed_comps); + + dp_for_each_set_bit(id, changed_comps) { + c =3D komeda_pipeline_get_component(pipe, id); + + if (new->active_comps & BIT(c->id)) + c->funcs->update(c, priv_to_comp_st(c->obj.state)); + else + c->funcs->disable(c); + } +} --=20 2.17.1