From patchwork Thu May 23 11:09:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Qian Wang X-Patchwork-Id: 10957429 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 33BCE76 for ; Thu, 23 May 2019 11:10:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1544428470 for ; Thu, 23 May 2019 11:10:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0424E28474; Thu, 23 May 2019 11:10:05 +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 E1D4227D16 for ; Thu, 23 May 2019 11:10:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 89C1A89DB5; Thu, 23 May 2019 11:10:02 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-ve1eur02on0607.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe06::607]) by gabe.freedesktop.org (Postfix) with ESMTPS id C05B389DB5 for ; Thu, 23 May 2019 11:10:00 +0000 (UTC) Received: from VE1PR08MB5006.eurprd08.prod.outlook.com (10.255.159.31) by AM0SPR01MB0043.eurprd08.prod.outlook.com (20.178.16.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1900.18; Thu, 23 May 2019 11:09:57 +0000 Received: from VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::206b:5cf6:97e:1358]) by VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::206b:5cf6:97e:1358%7]) with mapi id 15.20.1922.017; Thu, 23 May 2019 11:09:57 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey , "maarten.lankhorst@linux.intel.com" , "sean@poorly.run" Subject: [PATCH v2 1/6] drm/komeda: Attach scaler to drm as private object Thread-Topic: [PATCH v2 1/6] drm/komeda: Attach scaler to drm as private object Thread-Index: AQHVEVgOxJeSeZX9GU+RcpLRWDIdSQ== Date: Thu, 23 May 2019 11:09:57 +0000 Message-ID: <20190523110933.10742-2-james.qian.wang@arm.com> References: <20190523110933.10742-1-james.qian.wang@arm.com> In-Reply-To: <20190523110933.10742-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: HK2PR02CA0191.apcprd02.prod.outlook.com (2603:1096:201:21::27) To VE1PR08MB5006.eurprd08.prod.outlook.com (2603:10a6:803:113::31) x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 6a618328-9262-4db7-91ed-08d6df6f30d0 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600141)(711020)(4605104)(4618075)(2017052603328)(7193020); SRVR:AM0SPR01MB0043; x-ms-traffictypediagnostic: AM0SPR01MB0043: nodisclaimer: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1850; x-forefront-prvs: 00462943DE x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39860400002)(136003)(376002)(396003)(189003)(199004)(36756003)(1076003)(8936002)(103116003)(2616005)(446003)(54906003)(110136005)(4326008)(11346002)(53936002)(25786009)(6486002)(50226002)(256004)(81156014)(66066001)(68736007)(81166006)(486006)(2501003)(5024004)(99286004)(7736002)(386003)(5660300002)(66946007)(71200400001)(186003)(476003)(305945005)(6506007)(2201001)(2906002)(76176011)(55236004)(86362001)(102836004)(3846002)(26005)(6116002)(478600001)(316002)(66476007)(66556008)(73956011)(14454004)(6436002)(66446008)(6512007)(64756008)(52116002)(8676002)(71190400001); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0SPR01MB0043; H:VE1PR08MB5006.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: jPYezOkXaHeZfD0nCSjaRS8tNO/2BLmh+xSo4bYa2UJZRcwhTojGJDGdE6X64QwfNW7uwQgD6rH63jjwepzqnUE1cdmHmpfvrYdO6eUol0V93wae/c9Wj4yE1LXTzlTs012mPwZuY3yIRiwqCjPV4EGLrhAnXgzBbb07CGF+2SdFMn8W7Kr+8mPqLnUzvngVmdLj6pMA++GazdIKAn4oVq0TCfGMhMlVI3CfXn9n8/fOm/EXWHChJaNzu32wzl9AXPOtcUEDzkadxzToWYpSJ1C69TUC69whBXhzu/vSVe54+YbufrzrG5DNdviOtM4PcF2pTDN5PblDm5idZmC3IKKSLty69u77kI+udvtrEHlIgSqSJC3f8xSyyy5Hfk5FLQz9EC+DcvFtWv3X8IxsW/EsaWmo4aRVr7gl8Y3124w= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6a618328-9262-4db7-91ed-08d6df6f30d0 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 May 2019 11:09:57.6770 (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-Transport-CrossTenantHeadersStamped: AM0SPR01MB0043 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=39T5F2wcnsfC0J7zBBnSmblpeF5L+NLK6DLYspLeVb8=; b=k5EaMTInpjiUryTdu6ZUvpBMfXWGpE61PpDmB/KRui9sSsrAX36ctn5cB26SVCqgUCOOsno8CeZMkmkkM+kencKlL+pQIBUguXCrgjXMtLjbHG81tBqaKpA31JGpwbct53FyAkXJOvz+86mc7bPn89JhAPG2HoPW71+0pjmWVMg= X-Mailman-Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@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: nd , Ayan Halder , "Oscar Zhang \(Arm Technology China\)" , "Tiannan Zhu \(Arm Technology China\)" , "Jonathan Chai \(Arm Technology China\)" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "Julien Yin \(Arm Technology China\)" , "Channing Chen \(Arm Technology China\)" , "james qian wang \(Arm Technology China\)" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Lowry Li \(Arm Technology China\)" , Ben Davis Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP According to the komeda pipeline configuration, attach scaler to drm as private object. v2: Rebase Signed-off-by: James Qian Wang (Arm Technology China) --- .../arm/display/komeda/komeda_private_obj.c | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c b/drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c index d53bd6c23c5d..bac90ab8fdc9 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_private_obj.c @@ -60,6 +60,49 @@ static int komeda_layer_obj_add(struct komeda_kms_dev *kms, return 0; } +static struct drm_private_state * +komeda_scaler_atomic_duplicate_state(struct drm_private_obj *obj) +{ + struct komeda_scaler_state *st; + + st = kmemdup(obj->state, sizeof(*st), GFP_KERNEL); + if (!st) + return NULL; + + komeda_component_state_reset(&st->base); + __drm_atomic_helper_private_obj_duplicate_state(obj, &st->base.obj); + + return &st->base.obj; +} + +static void +komeda_scaler_atomic_destroy_state(struct drm_private_obj *obj, + struct drm_private_state *state) +{ + kfree(to_scaler_st(priv_to_comp_st(state))); +} + +static const struct drm_private_state_funcs komeda_scaler_obj_funcs = { + .atomic_duplicate_state = komeda_scaler_atomic_duplicate_state, + .atomic_destroy_state = komeda_scaler_atomic_destroy_state, +}; + +static int komeda_scaler_obj_add(struct komeda_kms_dev *kms, + struct komeda_scaler *scaler) +{ + struct komeda_scaler_state *st; + + st = kzalloc(sizeof(*st), GFP_KERNEL); + if (!st) + return -ENOMEM; + + st->base.component = &scaler->base; + drm_atomic_private_obj_init(&kms->base, + &scaler->base.obj, &st->base.obj, + &komeda_scaler_obj_funcs); + return 0; +} + static struct drm_private_state * komeda_compiz_atomic_duplicate_state(struct drm_private_obj *obj) { @@ -258,6 +301,12 @@ int komeda_kms_add_private_objs(struct komeda_kms_dev *kms, return err; } + for (j = 0; j < pipe->n_scalers; j++) { + err = komeda_scaler_obj_add(kms, pipe->scalers[j]); + if (err) + return err; + } + err = komeda_compiz_obj_add(kms, pipe->compiz); if (err) return err;