From patchwork Thu Aug 23 15:11:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru-Cosmin Gheorghe X-Patchwork-Id: 10574245 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 5CE9D5A4 for ; Thu, 23 Aug 2018 15:12:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C8D22C157 for ; Thu, 23 Aug 2018 15:12:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A9602C2DC; Thu, 23 Aug 2018 15:12:07 +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=BAD_ENC_HEADER,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 95B1B2C3E0 for ; Thu, 23 Aug 2018 15:11:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D41016E524; Thu, 23 Aug 2018 15:11:51 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30056.outbound.protection.outlook.com [40.107.3.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64C046E524 for ; Thu, 23 Aug 2018 15:11:50 +0000 (UTC) Received: from e114479-lin.cambridge.arm.com (217.140.106.49) by AM5PR0802MB2547.eurprd08.prod.outlook.com (2603:10a6:203:a0::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.15; Thu, 23 Aug 2018 15:11:47 +0000 From: Alexandru Gheorghe To: seanpaul@chromium.org, maarten.lankhorst@linux.intel.com, liviu.dudau@arm.com, brian.starkey@arm.com, airlied@linux.ie, dri-devel@lists.freedesktop.org, gustavo@padovan.org, ayan.halder@arm.com Subject: [PATCH] drm: Fix crtc color management when doing suspend/resume Date: Thu, 23 Aug 2018 16:11:17 +0100 Message-Id: <20180823151117.14834-1-alexandru-cosmin.gheorghe@arm.com> X-Mailer: git-send-email 2.18.0 MIME-Version: 1.0 X-Originating-IP: [217.140.106.49] X-ClientProxiedBy: HE1PR05CA0164.eurprd05.prod.outlook.com (2603:10a6:3:f8::12) To AM5PR0802MB2547.eurprd08.prod.outlook.com (2603:10a6:203:a0::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4d8c3e35-a005-4dfb-f59e-08d6090abf35 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4618075)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:AM5PR0802MB2547; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0802MB2547; 3:y042DUvLWvZqyURhefzt7w7fwWn3E18wRpXllOiT5s+owzRgIGmVD+dZAQkne3gvmh/bwfcL0tSTB3yzDQxr3WmF4fO+dC3KmfvrQbhaOsyQQAp3HZgd+nFeBM8y/UfmyO819xtim3wgbnUo/FeEpyvEQw0H6G+Njscrde+JsF4rgVRj36Q0BzkChP5DImzma+92kSXsUE7qalCU6GrNOyP95Y3LOYqECI+nxwJk7HHVOW8nviliYxJObZS/Knnk; 25:OhmCy1LhytU8EYAaVzXD7P5u9wNE81H7pWK2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LvKiPNwzpSalq23FZmFKCNoICK3dhz46IvA8v5+OTPBfxOeDXjtRkD184cIgoC23rc98RZxcxh/IfaUQPnt2r/CaIOTfrwflBh76QaP5ER/mAC0lMylYWZd/3c+sEPwwOmDbBJGKPV5jsOZP3YLJP9x3DjdDQJTIRQZFzD4RbWMpbfYGbP6zLktFVpwumpcO3cLmLt7yD4iucbzHDsUhbFj11awK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(3231311)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123558120)(201708071742011)(7699016); SRVR:AM5PR0802MB2547; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2547; X-Forefront-PRVS: 0773BB46AC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(376002)(346002)(39860400002)(396003)(136003)(366004)(189003)(199004)(25786009)(5660300001)(386003)(16526019)(1857600001)(316002)(16586007)(476003)(106356001)(26005)(105586002)(4326008)(486006)(186003)(956004)(2616005)(6486002)(7696005)(48376002)(47776003)(51416003)(81166006)(478600001)(2906002)(52116002)(8676002)(66066001)(81156014)(6116002)(3846002)(53936002)(50226002)(15650500001)(6636002)(36756003)(86362001)(68736007)(8936002)(1076002)(50466002)(97736004)(7736002)(6666003)(72206003)(14444005)(305945005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2547; H:e114479-lin.cambridge.arm.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-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0802MB2547; 23:BUn7cNt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VuLQxx6qGmuChkJ4EgvdxWWe/G5q8oEOHChn2Pp45ALPVWtxNud+hci4irdKA/QBugHOaXg15tzdHQpsRsvhD4fbUQcc2jZGbU3ZBbkRPTjMhsG2ymGPMPcxaiJAOcCLTiyDcRs=; 7:G7Uj2drGCumrDW+I4BHsqsVh5J6U5dNYM7lokpJKcspOVPeVNiIuPUwApp6vabQFuQn8QsrOmZsn4P8mcGfvYigCJIKPOb5MXlXo8j7En1O/sJtkF9e3SjjHvxn+esUsVgFRRf7P5oZf0He2NDU6ijcEI/rBcoLvjERunkTQGnZCXUwuDpMlfWff3+/IVExcw2GWWbd6bFLVcH25DvLZ+yCkohpyFb8hZjAk0Z8aWvBH6coS6OUcihWUT0XbLT28 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2018 15:11:47.2363 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4d8c3e35-a005-4dfb-f59e-08d6090abf35 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2547 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@arm.com, Alexandru Gheorghe Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP When doing suspend/resume drivers usually use the drm_atomic_helper_suspend/drm_atomic_helper_resume pair for saving the state and then re-comitting it. The problems is that drm_crtc_state has a bool field called color_mgmt_changed, which mali-dp and other drivers uses it to detect if coefficients need to be reprogrammed, but that never happens because the save state has color_mgmt_changed set to 0. Fix that by setting color_mgmt_changed to true if the crtc duplicated state differs from the reset state. Signed-off-by: Alexandru Gheorghe Reviewed-by: Brian Starkey --- drivers/gpu/drm/drm_atomic_helper.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index 6dd5036545ec..e88aa62bc822 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3196,8 +3196,13 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state, for_each_new_plane_in_state(state, plane, new_plane_state, i) state->planes[i].old_state = plane->state; - for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { state->crtcs[i].old_state = crtc->state; + new_crtc_state->color_mgmt_changed = + new_crtc_state->degamma_lut != crtc->state->degamma_lut || + new_crtc_state->ctm != crtc->state->ctm || + new_crtc_state->gamma_lut != crtc->state->gamma_lut; + } for_each_new_connector_in_state(state, connector, new_conn_state, i) state->connectors[i].old_state = connector->state;