Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7261694imu; Tue, 22 Jan 2019 03:08:53 -0800 (PST) X-Google-Smtp-Source: ALg8bN7OkamZ2uilii5cgZDB7QaPjWFbAfg2zol7wdxRTSUVjL4pnPe+DD7gv4or8/+36gh4rn1f X-Received: by 2002:a17:902:f20d:: with SMTP id gn13mr32669384plb.11.1548155333138; Tue, 22 Jan 2019 03:08:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548155333; cv=none; d=google.com; s=arc-20160816; b=cE5KbQUzncax8FpI2icJn9E9QLFAIrv9p5VY6QfP6LFK60VqrzjKsF12GL0TL7+v3X 0a8OQRyIuZmNyhdQLuBJQ0XMNdk2z9hZJ+cIJINvx070/lYOrmNwsjliFBsLVJpVA0wW 0/pbjS3MrePjBsv2w38PtJmcKdLm7nNgNQfivZnxbJToBGVeiWFjV7NfQZUUNpEIynsN 9+9h4Aywqr8Gs/YzZ7T3n+8DiadyFIiPDpW8TVLaOlEBpCI8mF88WMXwx46+ran7Hd2u xqYVDyidjmP6RDQ2xHBstwOdFbjePE3XVMOjy07+9wPIIBY6B+r58pSzAVUGf/GNi0Jt LZJA== 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=vb4xDvSh1biit9LGbJpSX8k1vvn4pWKFaEw0wRBCD+k=; b=0EgDhACGLx+mfKpcqrcieYVm5/aq7cZbwK9KupITFqfqJV76EZsGqGL3IZ8NheryyK 0WuJQH8KDlJ55veHX1XDtFY7NkGR/CF+/lsdgWCkMlsCzguLOBUttOcPgNVisCOLJ7PY Bf/mHXhSTltAgdvVhbD+YquG16HrHMAo5hA3IzOPMirwzphQDi1fLfkgyR5im+q5d4YU p+qymhCq7JW8P5HJkKgj6yZq4BufVZYAHmn8LQ9aUnzmYzuWyZ4vkr+A9sGX5ChpGA3C /GyFU33b1DAFOkyHo2YL+ZINyE4jfZa9NQTMr/Q7vxPz9NMWBmuvuG+5DZrOAT7CQ8tS HEVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector1-arm-com header.b=qb8mk+x4; 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 bd12si15222255plb.193.2019.01.22.03.08.37; Tue, 22 Jan 2019 03:08:53 -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=qb8mk+x4; 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 S1728193AbfAVLG1 (ORCPT + 99 others); Tue, 22 Jan 2019 06:06:27 -0500 Received: from mail-eopbgr60069.outbound.protection.outlook.com ([40.107.6.69]:8733 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727048AbfAVLG1 (ORCPT ); Tue, 22 Jan 2019 06:06:27 -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=vb4xDvSh1biit9LGbJpSX8k1vvn4pWKFaEw0wRBCD+k=; b=qb8mk+x4bb8XnwtsdgXm1TLP7LVku1tPKAUbzjTp5jTZQUWO11f1NMO867XhKNox9Nmo6UvBZr2H2NglB5EZ1c3yCrLVTwjK6OnttWkwgGMu7vCMBUESvVdjcnYwEXDwEc5hd7d6V3Q4rB3XTU+DC6lttrbE5h0LmTtgkUshhXM= Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com (10.168.81.21) by DB6PR0801MB1671.eurprd08.prod.outlook.com (10.169.226.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1558.16; Tue, 22 Jan 2019 11:05:41 +0000 Received: from DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33]) by DB6PR0801MB1990.eurprd08.prod.outlook.com ([fe80::b9be:3d28:78a2:6e33%2]) with mapi id 15.20.1537.031; Tue, 22 Jan 2019 11:05:41 +0000 From: "james qian wang (Arm Technology China)" To: Liviu Dudau , "airlied@linux.ie" , Brian Starkey , "maarten.lankhorst@linux.intel.com" , "sean@poorly.run" CC: "Jonathan Chai (Arm Technology China)" , "Julien Yin (Arm Technology China)" , "thomas Sun (Arm Technology China)" , "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" , "linux-kernel@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , "james qian wang (Arm Technology China)" Subject: [PATCH v2 1/5] drm: Add drm_atomic_get_old/new_private_obj_state Thread-Topic: [PATCH v2 1/5] drm: Add drm_atomic_get_old/new_private_obj_state Thread-Index: AQHUskJpjHcM8yfRTkC5yESOCskYsg== Date: Tue, 22 Jan 2019 11:05:41 +0000 Message-ID: <20190122110431.5025-2-james.qian.wang@arm.com> References: <20190122110431.5025-1-james.qian.wang@arm.com> In-Reply-To: <20190122110431.5025-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: SYAPR01CA0021.ausprd01.prod.outlook.com (2603:10c6:1::33) To DB6PR0801MB1990.eurprd08.prod.outlook.com (2603:10a6:4:6c::21) authentication-results: spf=none (sender IP is ) smtp.mailfrom=james.qian.wang@arm.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;DB6PR0801MB1671;6:1Ew3bcHrRNgrypOvbgH/PXR6jh3YKTNftre/ya59NOY7IuDKZb0/71zdMxjTqE0kNul369rH9PybMZK7MRESvrce37hxIsyaXjhanDmQ1Zzu3PwVrRsReg+lEx4tQ44/Onb35ZAfvVDb/82K+iPVzltune5NfQC8ONYJ2dfcXUFiZEOZxMiHcQBhgHPPgo49s+VikGb3Dx8Tw02cV0dZKqr6+mVRGILIiCJZqV3D8CzBuZOBbjb7Rpf4Q0kQJ6wtJfJPHrT3RMcluGsmscWOII9mehNSTX2iAB1lcHH5lvBgrFogJ8i3InOyGSgiItk1Z9gp9jpoAEaPeH2W6xd+YdVH+x8vJ9LFloc3Xs2VnY+tlnkOOhCfvuBFfQZIH0xAVEi4bVy3Ns5dgXvTEJDKj/A2ozHKLjjTIPHb+IUvy5CPjkHKRzDSsaMP0j316a60k1trss7Ni9qQ4VDsToBDkA==;5:OL6B2RrUtqm2XpLL9DN3ToxoZeoR2nBAucQUl5PjoXvMTFnCefqfdwexJ1eadqOSQKkw3UE2xyVWhEQGz13pLGXClvFEmyM2812gUPryUyrMdAxpcI2NfMp1BMj608PUZ15ersJVy629zlccLUviEvJ472ZYron81epUh/EPy49K2T6tCZR6EWMHgcSaj1wRHIASyZVua/F91vNK4yH+zQ==;7:H8WyJeXTXzC7O9i8Unpfc+QVFZe+4CH8fWVldy1zaa3KjeJJqhMPiGyfk0kfMIKEniPshJ3ELdSYYc2+KkxANHCEoLxhUrD3N2RJZsm2Usn1YrWXdPLY21nojzbk++L2vj/jr1HC3mySK28C6YDbBw== x-ms-office365-filtering-correlation-id: 4b51e808-dd95-41ec-e031-08d680598b33 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600109)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:DB6PR0801MB1671; x-ms-traffictypediagnostic: DB6PR0801MB1671: nodisclaimer: True x-microsoft-antispam-prvs: x-forefront-prvs: 0925081676 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(396003)(39860400002)(376002)(346002)(366004)(199004)(189003)(2906002)(25786009)(86362001)(36756003)(6116002)(3846002)(4326008)(2201001)(6486002)(103116003)(66066001)(105586002)(106356001)(6512007)(2501003)(53936002)(97736004)(6436002)(446003)(68736007)(81166006)(476003)(50226002)(8676002)(71200400001)(71190400001)(316002)(6506007)(52116002)(81156014)(486006)(11346002)(110136005)(54906003)(99286004)(305945005)(102836004)(14454004)(7736002)(26005)(76176011)(386003)(55236004)(1076003)(8936002)(478600001)(2616005)(186003)(14444005)(256004);DIR:OUT;SFP:1101;SCL:1;SRVR:DB6PR0801MB1671;H:DB6PR0801MB1990.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: GoUHaHVPLnJBSVkN+fD/Y38NkpPOw9Qhvw+Q5Nozi6j6Djw8D5+mFmm6kQD7uv8ncw//+ZfnAfBFyYbdH2Lb+ScW3l4rtUKnueoanNS4AnG3tC4jcy8G3DEiZJis19JRGuyKRUTMVpbX/o1izpDNZo04DIEcMmfisn5Z9Pfml0iUa47JOiAGlchiTNcEu0e8Bdw9imGm+soS9YXMWhxHO7kxpYVQNoar7cg7IcvxlJEZ+PJT722AXvRYljCGDQzJAWduIHeYAtdakDs8g7BiTLWqidDofscmRfGjx3RwQtnXe4OTiOm2kfV/DXTGyFUpZIBdIagufKpldX5grMTvK/CjEhNAYiEnT1TlfyHCZZ1+DT3afTkiIMU59eYgDK8jY95PZk/VEHK/YsWSxrvLJ93K0eZBjZELTJ6iZaCpZxA= 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: 4b51e808-dd95-41ec-e031-08d680598b33 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Jan 2019 11:05:30.5224 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0801MB1671 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "james qian wang (Arm Technology China)" This pair of functions return the old/new private object state for the given private_obj, or NULL if the private_obj is not part of the global atomic state. Reviewed-by: Alexandru Gheorghe Signed-off-by: James Qian Wang (Arm Technology China) --- drivers/gpu/drm/drm_atomic.c | 45 +++++++++++++++++++++++++++++++++++- include/drm/drm_atomic.h | 6 +++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index 008224f376fe..900f9f9dedad 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -775,6 +775,50 @@ drm_atomic_get_private_obj_state(struct drm_atomic_sta= te *state, } EXPORT_SYMBOL(drm_atomic_get_private_obj_state); =20 +/** + * drm_atomic_get_old_private_obj_state + * @state: global atomic state object + * @obj: private_obj to grab + * + * This function returns the old private object state for the given privat= e_obj, + * or NULL if the private_obj is not part of the global atomic state. + */ +struct drm_private_state * +drm_atomic_get_old_private_obj_state(struct drm_atomic_state *state, + struct drm_private_obj *obj) +{ + int i; + + for (i =3D 0; i < state->num_private_objs; i++) + if (obj =3D=3D state->private_objs[i].ptr) + return state->private_objs[i].old_state; + + return NULL; +} +EXPORT_SYMBOL(drm_atomic_get_old_private_obj_state); + +/** + * drm_atomic_get_new_private_obj_state + * @state: global atomic state object + * @obj: private_obj to grab + * + * This function returns the new private object state for the given privat= e_obj, + * or NULL if the private_obj is not part of the global atomic state. + */ +struct drm_private_state * +drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, + struct drm_private_obj *obj) +{ + int i; + + for (i =3D 0; i < state->num_private_objs; i++) + if (obj =3D=3D state->private_objs[i].ptr) + return state->private_objs[i].new_state; + + return NULL; +} +EXPORT_SYMBOL(drm_atomic_get_new_private_obj_state); + /** * drm_atomic_get_connector_state - get connector state * @state: global atomic state object @@ -1214,4 +1258,3 @@ int drm_atomic_debugfs_init(struct drm_minor *minor) minor->debugfs_root, minor); } #endif - diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index cac4a1b6b0e8..a4489b2fe740 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -443,6 +443,12 @@ void drm_atomic_private_obj_fini(struct drm_private_ob= j *obj); struct drm_private_state * __must_check drm_atomic_get_private_obj_state(struct drm_atomic_state *state, struct drm_private_obj *obj); +struct drm_private_state * +drm_atomic_get_old_private_obj_state(struct drm_atomic_state *state, + struct drm_private_obj *obj); +struct drm_private_state * +drm_atomic_get_new_private_obj_state(struct drm_atomic_state *state, + struct drm_private_obj *obj); =20 /** * drm_atomic_get_existing_crtc_state - get crtc state, if it exists --=20 2.17.1