linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo+renesas@jmondi.org>
Cc: kieran.bingham+renesas@ideasonboard.com, 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 v2 19/19] drm: rcar-du: kms: Update CMM in atomic commit tail
Date: Tue, 20 Aug 2019 21:42:15 +0300	[thread overview]
Message-ID: <20190820184215.GM10820@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20190706140746.29132-20-jacopo+renesas@jmondi.org>

Hi Jacopo,

Thank you for the patch.

On Sat, Jul 06, 2019 at 04:07:46PM +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.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c | 35 +++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> index b79cda2f5531..f9aece78ca5f 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -21,6 +21,7 @@
>  #include <linux/of_platform.h>
>  #include <linux/wait.h>
>  
> +#include "rcar_cmm.h"
>  #include "rcar_du_crtc.h"
>  #include "rcar_du_drv.h"
>  #include "rcar_du_encoder.h"
> @@ -287,6 +288,37 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
>   * Atomic Check and Update
>   */
>  
> +static void rcar_du_atomic_commit_update_cmm(struct drm_crtc *crtc,
> +					     struct drm_crtc_state *old_state)
> +{
> +	struct rcar_du_crtc *rcrtc = to_rcar_crtc(crtc);
> +	struct rcar_cmm_config cmm_config = {};
> +
> +	if (!rcrtc->cmm || !crtc->state->color_mgmt_changed)
> +		return;
> +
> +	if (!crtc->state->gamma_lut) {
> +		cmm_config.lut.enable = false;
> +		rcar_cmm_setup(rcrtc->cmm, &cmm_config);
> +
> +		return;
> +	}
> +
> +	cmm_config.lut.enable = true;
> +	cmm_config.lut.table = (struct drm_color_lut *)
> +			       crtc->state->gamma_lut->data;
> +
> +	/* Set LUT table size to 0 if entries should not be updated. */
> +	if (!old_state->gamma_lut ||
> +	    old_state->gamma_lut->base.id != crtc->state->gamma_lut->base.id)
> +		cmm_config.lut.size = crtc->state->gamma_lut->length
> +				    / sizeof(cmm_config.lut.table[0]);
> +	else
> +		cmm_config.lut.size = 0;
> +
> +	rcar_cmm_setup(rcrtc->cmm, &cmm_config);
> +}
> +
>  static int rcar_du_atomic_check(struct drm_device *dev,
>  				struct drm_atomic_state *state)
>  {
> @@ -329,6 +361,9 @@ static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
>  			rcdu->dpad1_source = rcrtc->index;
>  	}
>  
> +	for_each_old_crtc_in_state(old_state, crtc, crtc_state, i)
> +		rcar_du_atomic_commit_update_cmm(crtc, crtc_state);
> +

I think this looks good overall, but I wonder if we couldn't simplify
the CMM driver suspend/resume and LUT caching due to config while not
enabled by handling it on the DU side. I have a rework on the commit
tail handler in progress, I'll think how this could be done. For now I
think you can leave it as is.

>  	/* Apply the atomic update. */
>  	drm_atomic_helper_commit_modeset_disables(dev, old_state);
>  	drm_atomic_helper_commit_planes(dev, old_state,

-- 
Regards,

Laurent Pinchart

  parent reply	other threads:[~2019-08-20 18:42 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-06 14:07 [PATCH v2 00/19] drm: rcar-du: Add Color Management Module (CMM) Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 01/19] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation Jacopo Mondi
2019-07-08  7:58   ` Geert Uytterhoeven
2019-08-19 13:45     ` Geert Uytterhoeven
2019-08-20  7:48       ` Jacopo Mondi
2019-08-20  7:53         ` Geert Uytterhoeven
2019-08-20  8:05           ` Jacopo Mondi
2019-08-20 17:41           ` Laurent Pinchart
2019-08-20 18:08             ` Geert Uytterhoeven
2019-07-06 14:07 ` [PATCH v2 02/19] dt-bindings: display, renesas,du: Document cmms property Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 03/19] arm64: renesas: Update 'vsps' property Jacopo Mondi
2019-07-08  3:11   ` Laurent Pinchart
2019-07-09 13:10     ` Kieran Bingham
2019-08-21 12:16   ` Geert Uytterhoeven
2019-08-22 10:00     ` Jacopo Mondi
2019-08-22 15:02       ` Laurent Pinchart
2019-07-06 14:07 ` [PATCH v2 04/19] clk: renesas: r8a7796: Add CMM clocks Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 05/19] clk: renesas: r8a7795: " Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 06/19] clk: renesas: r8a77965: " Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 07/19] clk: renesas: r8a77990: " Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 08/19] clk: renesas: r8a77995: " Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 09/19] arm64: dts: renesas: r8a7796: Add CMM units Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 10/19] arm64: dts: renesas: r8a7795: " Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 11/19] arm64: dts: renesas: r8a77965: " Jacopo Mondi
2019-07-08  3:16   ` Laurent Pinchart
2019-07-06 14:07 ` [PATCH v2 12/19] arm64: dts: renesas: r8a77990: " Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 13/19] arm64: dts: renesas: r8a77995: " Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 14/19] drm: rcar-du: Add support for CMM Jacopo Mondi
2019-07-16 13:17   ` Ulrich Hecht
2019-08-20 17:37     ` Laurent Pinchart
2019-08-22 16:44       ` Jacopo Mondi
2019-08-20 17:34   ` Laurent Pinchart
2019-08-22 13:01     ` Jacopo Mondi
2019-08-22 15:10       ` Laurent Pinchart
2019-07-06 14:07 ` [PATCH v2 15/19] drm: rcar-du: Claim CMM support for Gen3 SoCs Jacopo Mondi
2019-07-16 13:18   ` Ulrich Hecht
2019-08-20 17:45   ` Laurent Pinchart
2019-07-06 14:07 ` [PATCH v2 16/19] drm: rcar-du: kms: Collect CMM instances Jacopo Mondi
2019-07-16 13:22   ` Ulrich Hecht
2019-08-20 17:54   ` Laurent Pinchart
2019-08-22 19:09     ` Jacopo Mondi
2019-07-06 14:07 ` [PATCH v2 17/19] drm: rcar-du: crtc: Enable and disable CMMs Jacopo Mondi
2019-07-16 13:31   ` Ulrich Hecht
2019-08-20 17:57   ` Laurent Pinchart
2019-07-06 14:07 ` [PATCH v2 18/19] drm: rcar-du: crtc: Register GAMMA_LUT properties Jacopo Mondi
2019-07-16 13:32   ` Ulrich Hecht
2019-08-20 18:02   ` Laurent Pinchart
2019-07-06 14:07 ` [PATCH v2 19/19] drm: rcar-du: kms: Update CMM in atomic commit tail Jacopo Mondi
2019-07-16 13:33   ` Ulrich Hecht
2019-08-20 18:42   ` Laurent Pinchart [this message]
2019-08-22 19:19     ` Jacopo Mondi
2019-08-22 19:54       ` 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=20190820184215.GM10820@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --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=jacopo+renesas@jmondi.org \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=koji.matsuoka.xm@renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=muroya@ksk.co.jp \
    /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).