From patchwork Mon Apr 15 07:09:04 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: 10900157 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 CA8EC922 for ; Mon, 15 Apr 2019 07:09:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B16F428812 for ; Mon, 15 Apr 2019 07:09:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A597B2881A; Mon, 15 Apr 2019 07:09:10 +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 5358228812 for ; Mon, 15 Apr 2019 07:09:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B85F8918A; Mon, 15 Apr 2019 07:09:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10086.outbound.protection.outlook.com [40.107.1.86]) by gabe.freedesktop.org (Postfix) with ESMTPS id 35D1F8918A for ; Mon, 15 Apr 2019 07:09:07 +0000 (UTC) Received: from VE1PR08MB5006.eurprd08.prod.outlook.com (10.255.159.31) by VE1PR08MB4765.eurprd08.prod.outlook.com (10.255.113.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1792.19; Mon, 15 Apr 2019 07:09:04 +0000 Received: from VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::6ca6:1d85:8903:90d7]) by VE1PR08MB5006.eurprd08.prod.outlook.com ([fe80::6ca6:1d85:8903:90d7%5]) with mapi id 15.20.1792.018; Mon, 15 Apr 2019 07:09:04 +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 v1 1/6] drm/komeda: Attach scaler to drm as private object Thread-Topic: [PATCH v1 1/6] drm/komeda: Attach scaler to drm as private object Thread-Index: AQHU81ocfDJ0fbJ8LU2n0DClmIk0YA== Date: Mon, 15 Apr 2019 07:09:04 +0000 Message-ID: <20190415070828.24075-2-james.qian.wang@arm.com> References: <20190415070828.24075-1-james.qian.wang@arm.com> In-Reply-To: <20190415070828.24075-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: HK0P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096:203:18::23) 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: e6783ece-5f58-42b0-14a0-08d6c1713e59 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600140)(711020)(4605104)(4618075)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VE1PR08MB4765; x-ms-traffictypediagnostic: VE1PR08MB4765: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 000800954F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(366004)(136003)(39860400002)(376002)(346002)(199004)(189003)(186003)(14454004)(5024004)(446003)(81156014)(486006)(66066001)(8676002)(26005)(5660300002)(6436002)(1076003)(103116003)(6512007)(76176011)(36756003)(476003)(2616005)(7736002)(4326008)(81166006)(11346002)(305945005)(2906002)(25786009)(71200400001)(71190400001)(68736007)(86362001)(2201001)(50226002)(102836004)(110136005)(97736004)(386003)(6506007)(55236004)(54906003)(256004)(8936002)(52116002)(106356001)(105586002)(2501003)(6486002)(53936002)(3846002)(478600001)(99286004)(316002)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:VE1PR08MB4765; H:VE1PR08MB5006.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: zmqcqUWuW0HPKFYjHnoMxyrdiwgGEs7phMEwWszYiRPYYxR7FDKkDjno7wncGpm7kD9AzHyIseYqkmsaJOG0wXUAybLo1V6+FY8/HBJzr5lbjQ1s1A4hBDrebmA54823JJEoa9bGwXW0cTUe6Jz4cEhBjRqtn+jscOrFtJjWIyZyb8QryfdJ+yZoZU3XMkgN8w7SS5iOu0TML9bD8qEAV/tkXlPZ3sm8fnUWiLYpcMlEMXclYTmH84w3kjVzSnU3FKwPUF0ZfiTnURPfLa2K0sRwM1gzVLiZmd1nVJB8x6v4nt6lBFrSlU1TPcxDCBOMi497ZSaCGDNtUsOFCQz4sfrw2HNrHA+hXoUMdSlYFDq1O3mT3DTJO2eAYE7Cqb/oCEx+pKIUpKyiVamNvPMzKkNYV4qZg5uKyBS44sNe1Kg= MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6783ece-5f58-42b0-14a0-08d6c1713e59 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Apr 2019 07:09:04.4567 (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: VE1PR08MB4765 X-Mailman-Original-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=HdO1jXCt8pMlZLgiQ1fU6agKEaJh+48odQxyBGK8qYk=; b=gZZ58SqjV6u+IvDI/1Gg3kujcj91qIo1qtLp/AB6zttS+FJJky+FtMxQ+XnIcJbW4kOO9gKVWQFpSE7Mo+TBOp7oJsoE+E36i2mdG6DT35Mg+PZJ2mFH9IeIKUglahdd8uNT01f8Xh3R8ZxET17QHIvdphVrEKtkm2ibdOKhHOM= 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 , "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\)" , "james qian wang \(Arm Technology China\)" , "Yiqi Kang \(Arm Technology China\)" , "thomas Sun \(Arm Technology China\)" , "Lowry Li \(Arm Technology China\)" 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. 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;