Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp7435185ybn; Mon, 30 Sep 2019 13:55:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqxgyWubG6aTTZ5FigZBfDsgZC74Qj17j642W8dA/r/9Rz7UY2LEW3TcqRYl+DUaUYa3Dqyy X-Received: by 2002:a17:906:8043:: with SMTP id x3mr21127064ejw.221.1569876918356; Mon, 30 Sep 2019 13:55:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569876918; cv=none; d=google.com; s=arc-20160816; b=nl6f+5qnJGTDLWVf9DSZJlAbhZVQj9+mr0KPtOzSyXUqMCfoKShYUMMqkYDW5f2r1e rLcHAmxwhJH9Tvh36Qu5/QQQWUieavMoifian3oDwcxMx+diTMO5sxpKJTSP6VG+LjrR DpX8aw8DgHL4sifTQZQt5zAKKI8QnbA7GIiv9EntPVx128Xbxi0AWj0DigC1Cs0uvwZ6 SXMcJGA5m6/fqcNKtsiWLTpYmf+6JZUI1yYO2QltwmxzxdLtzc5Nmj4zPC8PupxFap9/ yjlTMKSKJtlbeOWrb3Fq9cbqYVuxUe+pwBN01RA5AHmhcSlAGzlyhovHzFAw/4ctfPdk DARQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=iUSGYolVAFQpzBLTS64gZ+uhE1uGjQ1WoweXsuT1zB0=; b=OLKkOIfK1dwCeSKY1rGufLxEQRpbqoNjMBQPt2dCmk74TJuJNeW8492e1X3KCZS8FU paBk/pyl/3uchkjFzb8WhK2+TUshLXF1G0+gN2kQiimlUhN28KljcmlSqTMnU1PKSiZB 068GuqWWVVdmd6CWXZHgcuG8vd7PbTZk6Q/gPoE77iiUJB0p+A3lICW71frPbzU1pQb2 2IuPBxDiikrfElIKOrnsT0/TPz9KIphm7HlxR7y1RZcmh+tFBpZolcnz9l661fU+3FIw ErfkQwW1HcIoEBQbcMd3zXz8I5tBB/TSDxEEleKQWhoORMPTDhMOWfOuiXGvqMBDWULU 7j2g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v17si7596903ejq.5.2019.09.30.13.54.53; Mon, 30 Sep 2019 13:55:18 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731549AbfI3Ux2 (ORCPT + 99 others); Mon, 30 Sep 2019 16:53:28 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:59518 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730485AbfI3Ux2 (ORCPT ); Mon, 30 Sep 2019 16:53:28 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id 7E39228B90F Message-ID: <8063b9555d5bce6f2c002e49da3b7afaca9ae0b4.camel@collabora.com> Subject: Re: [PATCH v4 8/9] drm: rcar-du: kms: Update CMM in atomic commit tail From: Ezequiel Garcia To: Jacopo Mondi , laurent.pinchart@ideasonboard.com, kieran.bingham+renesas@ideasonboard.com, geert@linux-m68k.org, horms@verge.net.au, uli+renesas@fpond.eu, VenkataRajesh.Kalakodima@in.bosch.com, airlied@linux.ie, daniel@ffwll.ch Cc: muroya@ksk.co.jp, koji.matsuoka.xm@renesas.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Harsha.ManjulaMallikarjun@in.bosch.com, Doug Anderson , Heiko Stuebner Date: Mon, 30 Sep 2019 17:53:00 -0300 In-Reply-To: <20190906135436.10622-9-jacopo+renesas@jmondi.org> References: <20190906135436.10622-1-jacopo+renesas@jmondi.org> <20190906135436.10622-9-jacopo+renesas@jmondi.org> Organization: Collabora Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +Doug, Heiko: On Fri, 2019-09-06 at 15:54 +0200, Jacopo Mondi wrote: > Update CMM settings at in the atomic commit tail helper method. > The CMM is updated with new gamma values provided to the driver > in the GAMMA_LUT blob property. > > When resuming from system suspend, the DU driver is responsible for > reprogramming and enabling the CMM unit if it was in use at the time the > system entered the suspend state. Force the color_mgmt_changed flag to > true if the DRM gamma lut color transformation property was set in the > CRTC state duplicated at suspend time, as the CMM gets reprogrammed only > if said flag is active in the rcar_du_atomic_commit_update_cmm() method. > > Reviewed-by: Ulrich Hecht > Reviewed-by: Laurent Pinchart > Signed-off-by: Jacopo Mondi > --- > > Daniel could you have a look if resume bits are worth being moved to the > DRM core? The color_mgmt_changed flag is set to false when the state is > duplicated if I read the code correctly, but when this happens in a > suspend/resume sequence its value should probably be restored to true if > any color management property was set in the crtc state when system entered > suspend. > Perhaps we can use the for_each_new_crtc_in_state() helper here, and move it to the core like this: --- 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; + } This probably is wrong, and should be instead constrained to some condition of some sort. FWIW, the Rockchip DRM is going to need this as well. Any ideas? Thanks, Ezequiel