From patchwork Mon Sep 30 22:28:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ezequiel Garcia X-Patchwork-Id: 11167695 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF55916C1 for ; Mon, 30 Sep 2019 22:28:43 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D793E21855 for ; Mon, 30 Sep 2019 22:28:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D793E21855 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=collabora.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 24E3E6E4F3; Mon, 30 Sep 2019 22:28:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id B1F9E6E4E8 for ; Mon, 30 Sep 2019 22:28:38 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 96BCC28A81A From: Ezequiel Garcia To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 5/5] RFC: drm/atomic-helper: Reapply color transformation after resume Date: Mon, 30 Sep 2019 19:28:02 -0300 Message-Id: <20190930222802.32088-6-ezequiel@collabora.com> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190930222802.32088-1-ezequiel@collabora.com> References: <20190930222802.32088-1-ezequiel@collabora.com> MIME-Version: 1.0 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: Mark Rutland , devicetree@vger.kernel.org, Jacopo Mondi , linux-kernel@vger.kernel.org, Rob Herring , Douglas Anderson , linux-rockchip@lists.infradead.org, Boris Brezillon , Sean Paul , kernel@collabora.com, Ezequiel Garcia Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Some platforms are not able to maintain the color transformation state after a system suspend/resume cycle. Set the colog_mgmt_changed flag so that CMM on the CRTCs in the suspend state are reapplied after system resume. Signed-off-by: Ezequiel Garcia --- This is an RFC, and it's mostly based on Jacopo Mondi's work https://lkml.org/lkml/2019/9/6/498. Changes from v2: * New patch. --- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c index e41db0f202ca..518488125575 100644 --- a/drivers/gpu/drm/drm_atomic_helper.c +++ b/drivers/gpu/drm/drm_atomic_helper.c @@ -3234,8 +3234,20 @@ int drm_atomic_helper_resume(struct drm_device *dev, struct drm_atomic_state *state) { struct drm_modeset_acquire_ctx ctx; + struct drm_crtc_state *crtc_state; + struct drm_crtc *crtc; + unsigned int i; int err; + for_each_new_crtc_in_state(state, crtc, crtc_state, i) { + /* + * Force re-enablement of CMM after system resume if any + * of the DRM color transformation properties was set in + * the state saved at system suspend time. + */ + if (crtc_state->gamma_lut) + crtc_state->color_mgmt_changed = true; + } drm_mode_config_reset(dev); DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, err);