linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo@jmondi.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Jacopo Mondi <jacopo+renesas@jmondi.org>,
	kieran.bingham+renesas@ideasonboard.com, geert@linux-m68k.org,
	horms@verge.net.au, uli@fpond.eu, airlied@linux.ie,
	daniel@ffwll.ch, koji.matsuoka.xm@renesas.com, muroya@ksk.co.jp,
	VenkataRajesh.Kalakodima@in.bosch.com,
	Harsha.ManjulaMallikarjun@in.bosch.com,
	linux-renesas-soc@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 14/14] drm: rcar-du: Force CMM enablement when resuming
Date: Thu, 5 Sep 2019 12:58:09 +0200	[thread overview]
Message-ID: <20190905105809.iguzoqenlcriqegk@uno.localdomain> (raw)
In-Reply-To: <20190827000517.GC5274@pendragon.ideasonboard.com>

[-- Attachment #1: Type: text/plain, Size: 3517 bytes --]

Hi Laurent,

On Tue, Aug 27, 2019 at 03:05:17AM +0300, Laurent Pinchart wrote:
> Hi Jacopo,
>
> (Question for Daniel below)
>
> Thank you for the patch.
>
> On Sun, Aug 25, 2019 at 03:51:54PM +0200, Jacopo Mondi wrote:
> > 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 any of the DRM color
> > transformation properties 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.
> >
> > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> > ---
> >  drivers/gpu/drm/rcar-du/rcar_du_drv.c | 21 +++++++++++++++++++++
> >  1 file changed, 21 insertions(+)
> >
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > index 018480a8f35c..6e38495fb78f 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > @@ -17,6 +17,7 @@
> >  #include <linux/slab.h>
> >  #include <linux/wait.h>
> >
> > +#include <drm/drm_atomic.h>
> >  #include <drm/drm_atomic_helper.h>
> >  #include <drm/drm_fb_cma_helper.h>
> >  #include <drm/drm_fb_helper.h>
> > @@ -482,6 +483,26 @@ static int rcar_du_pm_suspend(struct device *dev)
> >  static int rcar_du_pm_resume(struct device *dev)
> >  {
> >  	struct rcar_du_device *rcdu = dev_get_drvdata(dev);
> > +	struct drm_atomic_state *state = rcdu->ddev->mode_config.suspend_state;
> > +	unsigned int i;
> > +
> > +	for (i = 0; i < rcdu->num_crtcs; ++i) {
> > +		struct drm_crtc *crtc = &rcdu->crtcs[i].crtc;
> > +		struct drm_crtc_state *crtc_state;
> > +
> > +		crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
> > +		if (!crtc_state)
> > +			continue;
>
> Shouldn't you get the new state here ?
>

I have followed the drm_atomic_helper_suspend() call stack, that calls
drm_atomic_helper_duplicate_state() which then assign the crtct state
with drm_atomic_get_crtc_state(), where I read:

       	crtc_state = drm_atomic_get_existing_crtc_state(state, crtc);
        ...
	state->crtcs[index].state = crtc_state;
	state->crtcs[index].old_state = crtc->state;
	state->crtcs[index].new_state = crtc_state;

So state or new_state for the purpose of getting back the crtc state
are the same if I'm not mistaken.

> > +
> > +		/*
> > +		 * 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->degamma_lut ||
> > +		    crtc_state->ctm)
>
> We don't support degamma_lut or crm, so I would drop those.

yeah, I added them as it was less code to change when we'll support
them. But for now they could be removed.

>
> With these small issues addressed,
>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
>
> Shouldn't we however squash this with the previous patch to avoid
> bisection issues ?
>

Which one in your opinion?
"drm: rcar-du: kms: Update CMM in atomic commit tail" ?
It seems to me they do quite different things though..

Thanks
  j

> > +			crtc_state->color_mgmt_changed = true;
>
> Daniel, is this something that would make sense in the KMS core (or
> helpers) ?
>
> > +	}
> >
> >  	return drm_mode_config_helper_resume(rcdu->ddev);
> >  }
>
> --
> Regards,
>
> Laurent Pinchart

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-09-05 10:56 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-25 13:51 [PATCH v3 00/14] drm: rcar-du: Add Color Management Module (CMM) Jacopo Mondi
2019-08-25 13:51 ` [PATCH v3 01/14] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation Jacopo Mondi
2019-08-26  7:34   ` Geert Uytterhoeven
2019-08-26  7:59     ` Jacopo Mondi
2019-08-26  8:38       ` Geert Uytterhoeven
2019-08-26 10:15       ` Laurent Pinchart
2019-08-30 18:01         ` Jacopo Mondi
2019-09-05 11:50           ` Laurent Pinchart
2019-09-05 12:05             ` Geert Uytterhoeven
2019-09-05 12:20               ` Laurent Pinchart
2019-09-05 13:28                 ` Jacopo Mondi
2019-08-25 13:51 ` [PATCH v3 02/14] dt-bindings: display, renesas,du: Document cmms property Jacopo Mondi
2019-08-27 20:29   ` Rob Herring
2019-08-28  7:32     ` Geert Uytterhoeven
2019-08-28  8:28       ` Laurent Pinchart
2019-08-25 13:51 ` [PATCH v3 03/14] arm64: dts: renesas: r8a7796: Add CMM units Jacopo Mondi
2019-08-26  7:28   ` Geert Uytterhoeven
2019-08-26  8:00     ` Jacopo Mondi
2019-08-26 22:43   ` Laurent Pinchart
2019-08-27  9:55     ` Jacopo Mondi
2019-08-27 10:12       ` Geert Uytterhoeven
2019-08-25 13:51 ` [PATCH v3 04/14] arm64: dts: renesas: r8a7795: " Jacopo Mondi
2019-08-26 22:45   ` Laurent Pinchart
2019-08-25 13:51 ` [PATCH v3 05/14] arm64: dts: renesas: r8a77965: " Jacopo Mondi
2019-08-26 22:45   ` Laurent Pinchart
2019-08-25 13:51 ` [PATCH v3 06/14] arm64: dts: renesas: r8a77990: " Jacopo Mondi
2019-08-26 22:47   ` Laurent Pinchart
2019-08-25 13:51 ` [PATCH v3 07/14] arm64: dts: renesas: r8a77995: " Jacopo Mondi
2019-08-26 22:47   ` Laurent Pinchart
2019-08-25 13:51 ` [PATCH v3 08/14] drm: rcar-du: Add support for CMM Jacopo Mondi
2019-08-26  7:31   ` Geert Uytterhoeven
2019-08-26  8:02     ` Jacopo Mondi
2019-08-27  0:24   ` Laurent Pinchart
2019-08-27 14:56     ` Jacopo Mondi
2019-08-27 15:48       ` Jacopo Mondi
2019-08-27 16:34       ` Laurent Pinchart
2019-09-05  9:57         ` Jacopo Mondi
2019-09-05 11:17           ` Laurent Pinchart
2019-09-05 13:14             ` Jacopo Mondi
2019-09-05 13:39               ` Laurent Pinchart
2019-08-25 13:51 ` [PATCH v3 09/14] drm: rcar-du: Claim CMM support for Gen3 SoCs Jacopo Mondi
2019-08-25 13:51 ` [PATCH v3 10/14] drm: rcar-du: kms: Collect CMM instances Jacopo Mondi
2019-08-26 23:51   ` Laurent Pinchart
2019-08-25 13:51 ` [PATCH v3 11/14] drm: rcar-du: crtc: Enable and disable CMMs Jacopo Mondi
2019-08-25 13:51 ` [PATCH v3 12/14] drm: rcar-du: crtc: Register GAMMA_LUT properties Jacopo Mondi
2019-08-25 13:51 ` [PATCH v3 13/14] drm: rcar-du: kms: Update CMM in atomic commit tail Jacopo Mondi
2019-08-27  0:00   ` Laurent Pinchart
2019-08-27  0:19     ` Laurent Pinchart
2019-08-27 14:44       ` Jacopo Mondi
2019-08-27 16:38         ` Laurent Pinchart
2019-08-25 13:51 ` [PATCH v3 14/14] drm: rcar-du: Force CMM enablement when resuming Jacopo Mondi
2019-08-27  0:05   ` Laurent Pinchart
2019-09-05 10:58     ` Jacopo Mondi [this message]
2019-09-05 11:25       ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190905105809.iguzoqenlcriqegk@uno.localdomain \
    --to=jacopo@jmondi.org \
    --cc=Harsha.ManjulaMallikarjun@in.bosch.com \
    --cc=VenkataRajesh.Kalakodima@in.bosch.com \
    --cc=airlied@linux.ie \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=geert@linux-m68k.org \
    --cc=horms@verge.net.au \
    --cc=jacopo+renesas@jmondi.org \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=koji.matsuoka.xm@renesas.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=muroya@ksk.co.jp \
    --cc=uli@fpond.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).