From patchwork Mon Jun 3 06:31:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lowry Li (Arm Technology China)" X-Patchwork-Id: 10972393 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17998933 for ; Mon, 3 Jun 2019 06:31:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0618928852 for ; Mon, 3 Jun 2019 06:31:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC97228866; Mon, 3 Jun 2019 06:31:54 +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=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 22C6028852 for ; Mon, 3 Jun 2019 06:31:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 59B3489686; Mon, 3 Jun 2019 06:31:53 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00074.outbound.protection.outlook.com [40.107.0.74]) by gabe.freedesktop.org (Postfix) with ESMTPS id AFE5489686 for ; Mon, 3 Jun 2019 06:31:51 +0000 (UTC) Received: from VI1PR08MB5488.eurprd08.prod.outlook.com (52.133.246.150) by VI1PR08MB4605.eurprd08.prod.outlook.com (20.178.13.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1943.17; Mon, 3 Jun 2019 06:31:49 +0000 Received: from VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::ada6:12ed:65d0:4629]) by VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::ada6:12ed:65d0:4629%4]) with mapi id 15.20.1922.025; Mon, 3 Jun 2019 06:31:49 +0000 From: "Lowry Li (Arm Technology China)" To: Liviu Dudau , "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v1 1/2] drm/komeda: Add slave pipeline support Thread-Topic: [PATCH v1 1/2] drm/komeda: Add slave pipeline support Thread-Index: AQHVGdYFbzV08y9A6kO6ercEAK5Q3Q== Date: Mon, 3 Jun 2019 06:31:48 +0000 Message-ID: <1559543462-32264-2-git-send-email-lowry.li@arm.com> References: <1559543462-32264-1-git-send-email-lowry.li@arm.com> In-Reply-To: <1559543462-32264-1-git-send-email-lowry.li@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK0PR01CA0060.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::24) To VI1PR08MB5488.eurprd08.prod.outlook.com (2603:10a6:803:137::22) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.9.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 94058442-8f10-442f-3b87-08d6e7ed281f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VI1PR08MB4605; x-ms-traffictypediagnostic: VI1PR08MB4605: nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:75; x-forefront-prvs: 0057EE387C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(376002)(346002)(366004)(39860400002)(189003)(199004)(102836004)(6512007)(36756003)(110136005)(26005)(54906003)(486006)(256004)(386003)(186003)(14444005)(6506007)(99286004)(446003)(11346002)(55236004)(52116002)(66446008)(66476007)(53936002)(66946007)(64756008)(68736007)(4326008)(6636002)(2616005)(476003)(76176011)(73956011)(66556008)(86362001)(72206003)(14454004)(478600001)(25786009)(6486002)(5660300002)(50226002)(2906002)(8936002)(316002)(2501003)(30864003)(81156014)(81166006)(66066001)(8676002)(7736002)(6436002)(6116002)(5024004)(71200400001)(71190400001)(3846002)(305945005)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB4605; H:VI1PR08MB5488.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: WwC8B3QUsNVZFIC5pmiPuEYNULMRaMFSkpBn4gjf6C+gSdGfsdFLDWZz1yOsNIO+dE/CM3iaVUzeEJzUWnGr3LzfR3SUvQBBv0k3LhL3FzXT3Q8ZxefM/TKQzAOhFCHEVFaJEGaoSig/RB6PzPrrT2uGuJ7TOb42ysZgBAxjmY+5tTYNkdRm/mHvWQ1RI6uO04GnsRW/d2ThL+EungQAxhw+balGYm92IY+YDC7s2Gj0ByH4uS9bwmrpBVrFPxqu5Fh+XaEk/euEshoP1ZaRwYZgVFwGiTUDKUabsz2ypUl9EDHSuzUScchdgbOJvnWSjSycwgMJN0HauHpy0uO5/v7zSv/d9mA4u0hZkUpH5TtU4Ly4x0huAtZq/L3W+o2fRlOaGuYSevR3ue17BEBsoeoqI6+uX1tT7RmU+YuNgCw= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94058442-8f10-442f-3b87-08d6e7ed281f X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jun 2019 06:31:48.8796 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Lowry.Li@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4605 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=34dm3IgU5lZDAaTpazdrCxzU9twsyVhGBUZ+pdSsQ80=; b=mzVaSG6f3fKkIBKMHRxp8is3C3WjEWqTxnpRPnD0VH9EL+Z1MGq0Qchv0HEqFftHGlE5xZopFL+WGfPtQIrOcdgDNbBabda72np7CcwXlFRUkGlJNHPNsNu5mvRm+5huUsvaGklH6xCeFhlt4jPGTNCfIv397u+6LusuBq7vWOs= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; 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: Ayan Halder , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , nd Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP One crtc can use two komeda_pipeline, and one works as master and as slave. the slave pipeline doesn't have its own output and timing ctrlr, but pre-composite the input layer data flow and then feed the result to master. the pipeline configuration like: slave-layer-0 \ ... slave->CU slave-layer-4 / \ \ master-layer-0 --------> master->CU -> ... ... / master-layer-4 ------> Since komeda Compiz doesn't output alpha, so the slave->CU result only can be used as bottom input when blend it with master input data flows. Signed-off-by: Lowry Li (Arm Technology China) --- drivers/gpu/drm/arm/display/komeda/komeda_crtc.c | 41 ++++++++++++++++++++-- drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 10 ++++++ drivers/gpu/drm/arm/display/komeda/komeda_kms.h | 9 +++++ .../gpu/drm/arm/display/komeda/komeda_pipeline.c | 22 ++++++++++++ .../gpu/drm/arm/display/komeda/komeda_pipeline.h | 2 ++ .../drm/arm/display/komeda/komeda_pipeline_state.c | 15 ++++++++ drivers/gpu/drm/arm/display/komeda/komeda_plane.c | 32 ++++++++++++++++- 7 files changed, 128 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 18c23f8..b5190a1 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -64,6 +64,10 @@ static void komeda_crtc_update_clock_ratio(struct komeda_crtc_state *kcrtc_st) } /* release unclaimed pipeline resources */ + err = komeda_release_unclaimed_resources(kcrtc->slave, kcrtc_st); + if (err) + return err; + err = komeda_release_unclaimed_resources(kcrtc->master, kcrtc_st); if (err) return err; @@ -230,6 +234,7 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, struct komeda_crtc_state *kcrtc_st = to_kcrtc_st(crtc->state); struct komeda_dev *mdev = kcrtc->base.dev->dev_private; struct komeda_pipeline *master = kcrtc->master; + struct komeda_pipeline *slave = kcrtc->slave; struct komeda_wb_connector *wb_conn = kcrtc->wb_conn; struct drm_connector_state *conn_st; @@ -241,6 +246,9 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, if (has_bit(master->id, kcrtc_st->affected_pipes)) komeda_pipeline_update(master, old->state); + if (slave && has_bit(slave->id, kcrtc_st->affected_pipes)) + komeda_pipeline_update(slave, old->state); + conn_st = wb_conn ? wb_conn->base.base.state : NULL; if (conn_st && conn_st->writeback_job) drm_writeback_queue_job(&wb_conn->base, conn_st); @@ -266,6 +274,7 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, struct komeda_crtc_state *old_st = to_kcrtc_st(old); struct komeda_dev *mdev = crtc->dev->dev_private; struct komeda_pipeline *master = kcrtc->master; + struct komeda_pipeline *slave = kcrtc->slave; struct completion *disable_done = &crtc->state->commit->flip_done; struct completion temp; int timeout; @@ -274,6 +283,9 @@ void komeda_crtc_handle_event(struct komeda_crtc *kcrtc, drm_crtc_index(crtc), old_st->active_pipes, old_st->affected_pipes); + if (slave && has_bit(slave->id, old_st->active_pipes)) + komeda_pipeline_disable(slave, old->state); + if (has_bit(master->id, old_st->active_pipes)) komeda_pipeline_disable(master, old->state); @@ -425,6 +437,7 @@ static void komeda_crtc_reset(struct drm_crtc *crtc) new->affected_pipes = old->active_pipes; new->clock_ratio = old->clock_ratio; + new->max_slave_zorder = old->max_slave_zorder; return &new->base; } @@ -499,7 +512,7 @@ int komeda_kms_setup_crtcs(struct komeda_kms_dev *kms, master = mdev->pipelines[i]; crtc->master = master; - crtc->slave = NULL; + crtc->slave = komeda_pipeline_get_slave(master); if (crtc->slave) sprintf(str, "pipe-%d", crtc->slave->id); @@ -533,6 +546,26 @@ static int komeda_crtc_create_clock_ratio_property(struct komeda_crtc *kcrtc) return 0; } +static int komeda_crtc_create_slave_planes_property(struct komeda_crtc *kcrtc) +{ + struct drm_crtc *crtc = &kcrtc->base; + struct drm_property *prop; + + if (kcrtc->slave_planes == 0) + return 0; + + prop = drm_property_create_range(crtc->dev, DRM_MODE_PROP_IMMUTABLE, + "slave_planes", 0, U32_MAX); + if (!prop) + return -ENOMEM; + + drm_object_attach_property(&crtc->base, prop, kcrtc->slave_planes); + + kcrtc->slave_planes_property = prop; + + return 0; +} + static struct drm_plane * get_crtc_primary(struct komeda_kms_dev *kms, struct komeda_crtc *crtc) { @@ -575,7 +608,11 @@ static int komeda_crtc_add(struct komeda_kms_dev *kms, drm_crtc_enable_color_mgmt(crtc, 0, true, KOMEDA_COLOR_LUT_SIZE); - return 0; + err = komeda_crtc_create_slave_planes_property(kcrtc); + if (err) + return err; + + return err; } int komeda_kms_add_crtcs(struct komeda_kms_dev *kms, struct komeda_dev *mdev) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index 5d10c55..8543860 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -143,6 +143,8 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc, struct drm_crtc_state *crtc_st) { struct drm_atomic_state *state = crtc_st->state; + struct komeda_crtc *kcrtc = to_kcrtc(crtc); + struct komeda_crtc_state *kcrtc_st = to_kcrtc_st(crtc_st); struct komeda_plane_state *kplane_st; struct drm_plane_state *plane_st; struct drm_framebuffer *fb; @@ -167,6 +169,8 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc, return err; } + kcrtc_st->max_slave_zorder = 0; + list_for_each_entry(kplane_st, &zorder_list, zlist_node) { plane_st = &kplane_st->base; fb = plane_st->fb; @@ -185,6 +189,12 @@ static int komeda_crtc_normalize_zpos(struct drm_crtc *crtc, DRM_DEBUG_ATOMIC("[PLANE:%d:%s] zpos:%d, normalized zpos: %d\n", plane->base.id, plane->name, plane_st->zpos, plane_st->normalized_zpos); + + /* calculate max slave zorder */ + if (has_bit(drm_plane_index(plane), kcrtc->slave_planes)) + kcrtc_st->max_slave_zorder = + max(plane_st->normalized_zpos, + kcrtc_st->max_slave_zorder); } crtc_st->zpos_changed = true; diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h index a20cdda..e7fa00e 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.h @@ -86,6 +86,9 @@ struct komeda_crtc { */ struct komeda_pipeline *slave; + /** @slave_planes: komeda slave planes mask */ + u32 slave_planes; + /** @wb_conn: komeda write back connector */ struct komeda_wb_connector *wb_conn; @@ -94,6 +97,9 @@ struct komeda_crtc { /** @clock_ratio_property: property for ratio of (mclk << 32)/pxlclk */ struct drm_property *clock_ratio_property; + + /** @slave_planes_property: property for slaves of the planes */ + struct drm_property *slave_planes_property; }; /** @@ -119,6 +125,9 @@ struct komeda_crtc_state { /** @clock_ratio: ratio of (mclk << 32)/pxlclk */ u64 clock_ratio; + + /** @max_slave_zorder: the maximum of slave zorder */ + u32 max_slave_zorder; }; /** struct komeda_kms_dev - for gather KMS related things */ diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c index 0b76e2a..0bb443b 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.c @@ -146,6 +146,14 @@ struct komeda_component * return c; } +static struct komeda_component * +komeda_component_pickup_input(struct komeda_component *c, u32 avail_comps) +{ + u32 avail_inputs = c->supported_inputs & (avail_comps); + + return komeda_pipeline_get_first_component(c->pipeline, avail_inputs); +} + /** komeda_component_add - Add a component to &komeda_pipeline */ struct komeda_component * komeda_component_add(struct komeda_pipeline *pipe, @@ -300,6 +308,20 @@ static void komeda_pipeline_assemble(struct komeda_pipeline *pipe) } } +/* if pipeline_A accept another pipeline_B's component as input, treat + * pipeline_B as slave of pipeline_A. + */ +struct komeda_pipeline * +komeda_pipeline_get_slave(struct komeda_pipeline *master) +{ + struct komeda_component *slave; + + slave = komeda_component_pickup_input(&master->compiz->base, + KOMEDA_PIPELINE_COMPIZS); + + return slave ? slave->pipeline : NULL; +} + int komeda_assemble_pipelines(struct komeda_dev *mdev) { struct komeda_pipeline *pipe; diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h index 9057dc5..0c3f101 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h @@ -472,6 +472,8 @@ struct komeda_pipeline * const struct komeda_pipeline_funcs *funcs); void komeda_pipeline_destroy(struct komeda_dev *mdev, struct komeda_pipeline *pipe); +struct komeda_pipeline * +komeda_pipeline_get_slave(struct komeda_pipeline *master); int komeda_assemble_pipelines(struct komeda_dev *mdev); struct komeda_component * komeda_pipeline_get_component(struct komeda_pipeline *pipe, int id); diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c index afd857e..44a51d8 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c @@ -1129,10 +1129,25 @@ int komeda_build_display_data_flow(struct komeda_crtc *kcrtc, struct komeda_crtc_state *kcrtc_st) { struct komeda_pipeline *master = kcrtc->master; + struct komeda_pipeline *slave = kcrtc->slave; struct komeda_data_flow_cfg m_dflow; /* master data flow */ + struct komeda_data_flow_cfg s_dflow; /* slave data flow */ int err; memset(&m_dflow, 0, sizeof(m_dflow)); + memset(&s_dflow, 0, sizeof(s_dflow)); + + if (slave && has_bit(slave->id, kcrtc_st->active_pipes)) { + err = komeda_compiz_validate(slave->compiz, kcrtc_st, &s_dflow); + if (err) + return err; + + /* merge the slave dflow into master pipeline */ + err = komeda_compiz_set_input(master->compiz, kcrtc_st, + &s_dflow); + if (err) + return err; + } err = komeda_compiz_validate(master->compiz, kcrtc_st, &m_dflow); if (err) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c index acf43b0..0474a7b 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_plane.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_plane.c @@ -14,15 +14,27 @@ static int komeda_plane_init_data_flow(struct drm_plane_state *st, + struct komeda_crtc_state *kcrtc_st, struct komeda_data_flow_cfg *dflow) { + struct komeda_plane *kplane = to_kplane(st->plane); struct komeda_plane_state *kplane_st = to_kplane_st(st); struct drm_framebuffer *fb = st->fb; const struct komeda_format_caps *caps = to_kfb(fb)->format_caps; + struct komeda_pipeline *pipe = kplane->layer->base.pipeline; memset(dflow, 0, sizeof(*dflow)); dflow->blending_zorder = st->normalized_zpos; + if (pipe == to_kcrtc(st->crtc)->master) + dflow->blending_zorder -= kcrtc_st->max_slave_zorder; + if (dflow->blending_zorder < 0) { + DRM_DEBUG_ATOMIC("%s zorder:%d < max_slave_zorder: %d.\n", + st->plane->name, st->normalized_zpos, + kcrtc_st->max_slave_zorder); + return -EINVAL; + } + dflow->pixel_blend_mode = st->pixel_blend_mode; dflow->layer_alpha = st->alpha >> 8; @@ -88,7 +100,7 @@ kcrtc_st = to_kcrtc_st(crtc_st); - err = komeda_plane_init_data_flow(state, &dflow); + err = komeda_plane_init_data_flow(state, kcrtc_st, &dflow); if (err) return err; @@ -288,6 +300,22 @@ static u32 get_possible_crtcs(struct komeda_kms_dev *kms, return possible_crtcs; } +static void +komeda_set_crtc_plane_mask(struct komeda_kms_dev *kms, + struct komeda_pipeline *pipe, + struct drm_plane *plane) +{ + struct komeda_crtc *kcrtc; + int i; + + for (i = 0; i < kms->n_crtcs; i++) { + kcrtc = &kms->crtcs[i]; + + if (pipe == kcrtc->slave) + kcrtc->slave_planes |= BIT(drm_plane_index(plane)); + } +} + /* use Layer0 as primary */ static u32 get_plane_type(struct komeda_kms_dev *kms, struct komeda_component *c) @@ -366,6 +394,8 @@ static int komeda_plane_add(struct komeda_kms_dev *kms, if (err) goto cleanup; + komeda_set_crtc_plane_mask(kms, c->pipeline, plane); + return 0; cleanup: komeda_plane_destroy(plane); From patchwork Mon Jun 3 06:31:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lowry Li (Arm Technology China)" X-Patchwork-Id: 10972395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D1DF2933 for ; Mon, 3 Jun 2019 06:31:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C029328852 for ; Mon, 3 Jun 2019 06:31:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B474028861; Mon, 3 Jun 2019 06:31:59 +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=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 65E8928852 for ; Mon, 3 Jun 2019 06:31:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7392E8969E; Mon, 3 Jun 2019 06:31:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-am5eur02on060b.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe07::60b]) by gabe.freedesktop.org (Postfix) with ESMTPS id EECBF8969E for ; Mon, 3 Jun 2019 06:31:56 +0000 (UTC) Received: from VI1PR08MB5488.eurprd08.prod.outlook.com (52.133.246.150) by VI1PR08MB4605.eurprd08.prod.outlook.com (20.178.13.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1943.17; Mon, 3 Jun 2019 06:31:54 +0000 Received: from VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::ada6:12ed:65d0:4629]) by VI1PR08MB5488.eurprd08.prod.outlook.com ([fe80::ada6:12ed:65d0:4629%4]) with mapi id 15.20.1922.025; Mon, 3 Jun 2019 06:31:54 +0000 From: "Lowry Li (Arm Technology China)" To: Liviu Dudau , "james qian wang (Arm Technology China)" , "maarten.lankhorst@linux.intel.com" , "seanpaul@chromium.org" , "airlied@linux.ie" , Brian Starkey Subject: [PATCH v1 2/2] drm/komeda: Adds komeda_kms_drop_master Thread-Topic: [PATCH v1 2/2] drm/komeda: Adds komeda_kms_drop_master Thread-Index: AQHVGdYIJROjMKA2IkGllIHYR3H/0A== Date: Mon, 3 Jun 2019 06:31:54 +0000 Message-ID: <1559543462-32264-3-git-send-email-lowry.li@arm.com> References: <1559543462-32264-1-git-send-email-lowry.li@arm.com> In-Reply-To: <1559543462-32264-1-git-send-email-lowry.li@arm.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [113.29.88.7] x-clientproxiedby: HK0PR01CA0060.apcprd01.prod.exchangelabs.com (2603:1096:203:a6::24) To VI1PR08MB5488.eurprd08.prod.outlook.com (2603:10a6:803:137::22) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 1.9.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ce025073-05f2-4da8-7caa-08d6e7ed2b28 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VI1PR08MB4605; x-ms-traffictypediagnostic: VI1PR08MB4605: nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:67; x-forefront-prvs: 0057EE387C x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(136003)(396003)(376002)(346002)(366004)(39860400002)(189003)(199004)(102836004)(6512007)(36756003)(110136005)(26005)(54906003)(486006)(256004)(386003)(186003)(14444005)(6506007)(99286004)(446003)(11346002)(55236004)(52116002)(66446008)(66476007)(53936002)(66946007)(64756008)(68736007)(4326008)(6636002)(2616005)(476003)(76176011)(73956011)(66556008)(86362001)(72206003)(14454004)(478600001)(25786009)(6486002)(5660300002)(50226002)(2906002)(8936002)(316002)(2501003)(81156014)(81166006)(66066001)(8676002)(7736002)(6436002)(6116002)(71200400001)(71190400001)(3846002)(305945005)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR08MB4605; H:VI1PR08MB5488.eurprd08.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: O714nvBvVGfxVKj9xGJOtSM24yBtik+2Dv0SxCPWFlLEV8XwAmk1fFNz13evzm7z6D+B95OvEKDsC2BQC4TbFfjOzbbyUMGvjxw5bWg7n0JjmMXMAZERYzd2tgnKGniNt+SU6K3bN2aFDUoMcGAn2iiUg9hrQdFwuOxPEvbs2PDw9+PwjPnnSQtVk2KEQoiC0HIF+JLVM1Yt2aRxmfTB9Dm3qkX9HvOWFnPUIq1202zQMexba7hhQVSd6tIREVifSr/Idb9n5m3ljUY4dGkOK7QXHBemZ537rVcEW3Ff6ldcxph9yQPbWNRWnucFzq9hut0qRArwzddfIdMZH7so/q2XcYTeT6Ch2kTIRb0OPIytgRHbQMmmQaeuzGn6+TR3kNKmYuRZsNdGwJ7KGWJurhTn9TkbXhhkVEvCghYTA80= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce025073-05f2-4da8-7caa-08d6e7ed2b28 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jun 2019 06:31:54.2096 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Lowry.Li@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4605 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m9tozB7RgQ21imy9KivQaH+Savx9XekgE6jkQuEEJGk=; b=ZV8pK5q8Yairm7Oi9Nuek8pU4cUrji/dWCsyCF08u2pdlip326NwqJ0fUHlo/X96XA1auFXVAHw8v/Jb5tdvX0TJgiidPQJQeL5LAjStsidQWtAKpNoDgKiSRPivotzmu5ZkDEBHwyWaxCzaFB3fsoV94hWVe8NJ3DfprRspmP0= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Lowry.Li@arm.com; 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: Ayan Halder , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , nd Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The komeda internal resources (pipelines) are shared between crtcs, and resources release by disable_crtc. This commit is working for once user forgot disabling crtc like app quit abnomally, and then the resources can not be used by another crtc. Adds drop_master to shutdown the device and make sure all the komeda resources have been released and can be used for the next usage. Signed-off-by: Lowry Li (Arm Technology China) --- drivers/gpu/drm/arm/display/komeda/komeda_kms.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c index 8543860..647bce5 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c @@ -54,11 +54,24 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data) return status; } +/* Komeda internal resources (pipelines) are shared between crtcs, and resources + * are released by disable_crtc. But if user forget disabling crtc like app quit + * abnormally, the resources can not be used by another crtc. + * Use drop_master to shutdown the device and make sure all the komeda resources + * have been released, and can be used for the next usage. + */ +static void komeda_kms_drop_master(struct drm_device *dev, + struct drm_file *file_priv) +{ + drm_atomic_helper_shutdown(dev); +} + static struct drm_driver komeda_kms_driver = { .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_PRIME | DRIVER_HAVE_IRQ, .lastclose = drm_fb_helper_lastclose, .irq_handler = komeda_kms_irq_handler, + .master_drop = komeda_kms_drop_master, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, .dumb_create = komeda_gem_cma_dumb_create,