Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Mahesh Kumar <mahesh1.kumar@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v5 10/10] drm/rcar-du/crc: Implement get_crc_sources callback
Date: Wed, 08 Aug 2018 11:25:59 +0300	[thread overview]
Message-ID: <3028464.ZRMJlRgjZo@avalon> (raw)
In-Reply-To: <20180723104451.22003-1-mahesh1.kumar@intel.com>

Hi Mahesh,

Thank you for the patch.

On Monday, 23 July 2018 13:44:51 EEST Mahesh Kumar wrote:
> This patch implements get_crc_sources callback, which returns list of
> all the crc sources supported by driver in current platform.
> 
> Changes Since V1:
>  - move sources list per-crtc
>  - init sources-list only for gen3
> Changes Since V2:
>  - Adopt to driver style
>  - Address other review comments from Laurent Pinchart

I'm pretty sure this has changed since v4 as well.

> Signed-off-by: Mahesh Kumar <mahesh1.kumar@intel.com>
> Cc: dri-devel@lists.freedesktop.org
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 85 ++++++++++++++++++++++++++++++-
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  3 ++
>  2 files changed, 87 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c index 43e67cffdee0..39981ce422e1
> 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -691,6 +691,68 @@ static const struct drm_crtc_helper_funcs
> crtc_helper_funcs = {
>  	.atomic_disable = rcar_du_crtc_atomic_disable,
>  };
> 
> +static void rcar_du_crtc_crc_sources_list_init(struct rcar_du_crtc *rcrtc)

Let's shorten the function name to rcar_du_crtc_crc_init().

> +{
> +	struct rcar_du_device *rcdu = rcrtc->group->dev;
> +	const char **sources;
> +	unsigned int count;
> +	int i = -1;
> +
> +	/* CRC available only on Gen3 HW. */
> +	if (rcdu->info->gen < 3)
> +		return;
> +
> +	/* Reserve 1 for "auto" source. */
> +	count = rcrtc->vsp->num_planes + 1;
> +
> +	sources = kmalloc_array(count, sizeof(*sources), GFP_KERNEL);
> +	if (!sources)
> +		return;
> +
> +	sources[0] = kstrdup("auto", GFP_KERNEL);
> +	if (!sources[0])
> +		goto error;
> +
> +	for (i = 0; i < rcrtc->vsp->num_planes; ++i) {
> +		struct drm_plane *plane = &rcrtc->vsp->planes[i].plane;
> +		char name[16];
> +
> +		sprintf(name, "plane%u", plane->base.id);
> +		sources[i + 1] = kstrdup(name, GFP_KERNEL);
> +		if (!sources[i + 1])
> +			goto error;
> +	}
> +
> +	rcrtc->sources = sources;
> +	rcrtc->sources_count = count;
> +	return;
> +
> +error:
> +	while (i >= 0) {
> +		kfree(sources[i]);
> +		i--;
> +	}
> +	kfree(sources);
> +
> +	rcrtc->sources = NULL;
> +	rcrtc->sources_count = 0;

The two last lines are not needed as ->sources and ->sources_count are only 
initialized at the very end of the function if no error occurred.

> +}
> +
> +static void rcar_du_crtc_crc_sources_list_uninit(struct rcar_du_crtc
> *rcrtc)

Similarly, and for consistency as the driver uses the _cleanup suffix 
throughout the code, I would name this rcar_du_crtc_crc_cleanup().

With those three small changes,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> +{
> +	unsigned int i;
> +
> +	if (!rcrtc->sources)
> +		return;
> +
> +	for (i = 0; i < rcrtc->sources_count; i++)
> +		kfree(rcrtc->sources[i]);
> +	kfree(rcrtc->sources);
> +
> +	rcrtc->sources = NULL;
> +	rcrtc->sources_count = 0;
> +}

-- 
Regards,

Laurent Pinchart



_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-08-08  8:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-13 13:59 [PATCH 00/10] Improve crc-core driver interface Mahesh Kumar
2018-07-13 13:59 ` [PATCH v4 01/10] drm: crc: Introduce verify_crc_source callback Mahesh Kumar
2018-07-13 13:59 ` [PATCH v4 02/10] drm: crc: Introduce get_crc_sources callback Mahesh Kumar
2018-07-13 13:59 ` [PATCH v4 03/10] drm/rockchip/crc: Implement verify_crc_source callback Mahesh Kumar
2018-07-13 13:59 ` [PATCH v4 04/10] drm/amdgpu_dm/crc: " Mahesh Kumar
2018-07-13 13:59 ` [PATCH v4 05/10] drm/rcar-du/crc: " Mahesh Kumar
2018-07-19 10:56   ` Laurent Pinchart
2018-07-23 10:38     ` [PATCH v5 " Mahesh Kumar
2018-07-13 13:59 ` [PATCH v4 06/10] drm/i915/crc: implement " Mahesh Kumar
2018-07-13 13:59 ` [PATCH v4 07/10] drm/i915/crc: implement get_crc_sources callback Mahesh Kumar
2018-07-13 13:59 ` [PATCH v4 08/10] drm/crc: Cleanup crtc_crc_open function Mahesh Kumar
2018-07-13 13:59 ` [PATCH v4 09/10] Revert "drm: crc: Wait for a frame before returning from open()" Mahesh Kumar
2018-07-13 13:59 ` [PATCH v4 10/10] drm/rcar-du/crc: Implement get_crc_sources callback Mahesh Kumar
2018-07-19 11:12   ` Laurent Pinchart
2018-07-19 11:24     ` Kumar, Mahesh
2018-07-23 10:44     ` [PATCH v5 " Mahesh Kumar
2018-08-08  8:25       ` Laurent Pinchart [this message]
2018-08-08 15:26         ` [PATCH V6 " Mahesh Kumar
2018-08-13 12:13           ` Maarten Lankhorst
2018-07-13 14:16 ` ✗ Fi.CI.SPARSE: warning for Improve crc-core driver interface (rev7) Patchwork
2018-07-13 14:26 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-07-23 11:03 ` ✗ Fi.CI.SPARSE: warning for Improve crc-core driver interface (rev9) Patchwork
2018-07-23 11:19 ` ✗ Fi.CI.BAT: failure " Patchwork
2018-08-02 13:16 ` Patchwork
2018-08-08 15:49 ` ✗ Fi.CI.SPARSE: warning for Improve crc-core driver interface (rev10) Patchwork
2018-08-08 15:59 ` ✗ Fi.CI.BAT: failure " Patchwork

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=3028464.ZRMJlRgjZo@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=mahesh1.kumar@intel.com \
    /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