mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: VenkataRajesh.Kalakodima@in.bosch.com
Cc: linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
Subject: Re: [PATCH 7/8] drm: rcar-du: update gamma and ctm properties in commit tail
Date: Thu, 4 Apr 2019 13:19:23 +0300	[thread overview]
Message-ID: <20190404101923.GG5800@pendragon.ideasonboard.com> (raw)
In-Reply-To: <1554297284-14009-8-git-send-email-VenkataRajesh.Kalakodima@in.bosch.com>

Hi Kalakodima,

Thank you for the patch.

On Wed, Apr 03, 2019 at 06:44:43PM +0530, VenkataRajesh.Kalakodima@in.bosch.com wrote:
> From: kalakodima venkata rajesh <venkatarajesh.kalakodima@in.bosch.com>
> 
> Update gamma and ctm properties if there is a change.
> 
> Signed-off-by: Harsha M M <harsha.manjulamallikarjun@in.bosch.com>
> 
>    - Fix compilation issues when for_each_crtc_in_state is not defined
>    - Resolved checkpatch errors
>    - Resolved merge conflicts according to latest version
> 
> Signed-off-by: kalakodima venkata rajesh <venkatarajesh.kalakodima@in.bosch.com>
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c | 25 +++++++++++++++++++++++++
>  include/drm/drm_atomic.h              | 25 +++++++++++++++++++++++++
>  2 files changed, 50 insertions(+)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> index f0bc7cc..4d9a19c 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -246,6 +246,10 @@ static int rcar_du_atomic_check(struct drm_device *dev,
>  static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
>  {
>  	struct drm_device *dev = old_state->dev;
> +	struct drm_crtc *crtc;
> +	struct drm_crtc_state *crtc_state;
> +	struct rcar_du_crtc *rcrtc;
> +	int i;
>  
>  	/* Apply the atomic update. */
>  	drm_atomic_helper_commit_modeset_disables(dev, old_state);
> @@ -253,6 +257,27 @@ static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
>  					DRM_PLANE_COMMIT_ACTIVE_ONLY);
>  	drm_atomic_helper_commit_modeset_enables(dev, old_state);
>  
> +	/* Update gamma and ctm properties for all crtc in present
> +	 * state. Update is done only if there is a change
> +	 */
> +	for_each_crtc_in_state(old_state, crtc, crtc_state, i) {
> +		rcrtc = to_rcar_crtc(crtc);
> +
> +		if (rcrtc->lut_handle) {
> +			rcar_du_cmm_update_lut_and_free
> +			  (rcrtc->lut_handle,
> +			   (struct drm_color_lut *)crtc->state->gamma_lut->data,
> +			   (crtc->state->gamma_lut->length /
> +			   sizeof(struct drm_color_lut)));
> +			rcrtc->lut_handle = NULL;
> +		}
> +		if (rcrtc->clu_handle) {
> +			rcar_du_cmm_update_clu_and_free
> +			  (rcrtc->clu_handle,
> +			   (struct drm_color_ctm *)crtc->state->ctm->data);
> +			rcrtc->clu_handle = NULL;
> +		}
> +	}
>  	drm_atomic_helper_commit_hw_done(old_state);
>  	drm_atomic_helper_wait_for_flip_done(dev, old_state);

We're in the process of reworking the commit tail handler, so I expect
major changes will be needed here.

>  
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index 1e71315..d22ccd8 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -693,6 +693,31 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
>  			     (new_connector_state) = (__state)->connectors[__i].new_state, 1))
>  
>  /**
> + * for_each_crtc_in_state - iterate over all connectors in an atomic update
> + * @__state: &struct drm_atomic_state pointer
> + * @crtc: &struct drm_crtc iteration cursor
> + * @crtc_state: &struct drm_crtc_state iteration cursor
> + * @__i: int iteration cursor, for macro-internal use
> + *
> + * This iterates over all CRTCs in an atomic update. Note that before the
> + * software state is committed (by calling drm_atomic_helper_swap_state(), this
> + * points to the new state, while afterwards it points to the old state. Due to
> + * this tricky confusion this macro is deprecated.
> + *
> + * FIXME:
> + *
> + * Replace all usage of this with one of the explicit iterators below and then
> + * remove this macro.

Then don't add it :-) In general you should look at the code you want to
upstream, this feels like it was a blind copy from a BSP without giving
it much consideration.

> + */
> +#define for_each_crtc_in_state(__state, crtc, crtc_state, __i)	\
> +	for ((__i) = 0;						\
> +	     ((__i) < ((__state)->dev->mode_config.num_crtc)) &&	\
> +	     ((crtc) = ((__state)->crtcs[__i].ptr),			\
> +	     (crtc_state) = ((__state)->crtcs[__i].state), 1);	\
> +	     (__i)++)						\
> +		for_each_if(crtc_state)
> +
> +/**
>   * for_each_oldnew_crtc_in_state - iterate over all CRTCs in an atomic update
>   * @__state: &struct drm_atomic_state pointer
>   * @crtc: &struct drm_crtc iteration cursor

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2019-04-04 10:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-03 13:14 [PATCH 0/8] v4.19.0 Added Color Management Module VenkataRajesh.Kalakodima
2019-04-03 13:14 ` [PATCH 1/8] drm: Add DU CMM support functions VenkataRajesh.Kalakodima
2019-04-04 10:09   ` Laurent Pinchart
2019-04-03 13:14 ` [PATCH 2/8] drm: Add DU CMM support boot and clk changes VenkataRajesh.Kalakodima
2019-04-04 10:12   ` Laurent Pinchart
2019-04-03 13:14 ` [PATCH 3/8] drm: rcar-du: Give a name to clu table samples VenkataRajesh.Kalakodima
2019-04-04 10:15   ` Laurent Pinchart
2019-04-03 13:14 ` [PATCH 4/8] drm: rcar-du: Refactor the code with new functions VenkataRajesh.Kalakodima
2019-04-03 13:14 ` [PATCH 5/8] drm: rcar-du: Implement interfaces to set clu and lut using drm data structures VenkataRajesh.Kalakodima
2019-04-04  7:50   ` Daniel Vetter
2019-04-04 15:40     ` Ville Syrjälä
2019-04-05  8:39       ` Harsha Manjula Mallikarjun (RBEI/ECF3)
2019-04-03 13:14 ` [PATCH 6/8] drm: rcar-du: Implement atomic_check to check for gamma and ctm properties VenkataRajesh.Kalakodima
2019-04-03 13:14 ` [PATCH 7/8] drm: rcar-du: update gamma and ctm properties in commit tail VenkataRajesh.Kalakodima
2019-04-04 10:19   ` Laurent Pinchart [this message]
2019-04-03 13:14 ` [PATCH 8/8] drm: rcar-du: Add shutdown callback function in platform_driver VenkataRajesh.Kalakodima
2019-04-04  7:47   ` Daniel Vetter
2019-04-04 10:26   ` Laurent Pinchart
2019-04-04  9:45 ` [PATCH 0/8] v4.19.0 Added Color Management Module Laurent Pinchart
2019-04-04  9:46   ` 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=20190404101923.GG5800@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=VenkataRajesh.Kalakodima@in.bosch.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=harsha.manjulamallikarjun@in.bosch.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    /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

Powered by JetHome