devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hyungwon Hwang <human.hwang@samsung.com>
To: Hyungwon Hwang <human.hwang@samsung.com>
Cc: devicetree@vger.kernel.org, sw0312.kim@samsung.com,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/exynos: ipp: validate a GEM handle with multiple planes
Date: Fri, 12 Jun 2015 22:02:24 +0900	[thread overview]
Message-ID: <20150612220224.75594a95@hwh-ubuntu> (raw)
In-Reply-To: <1434113958-15877-18-git-send-email-human.hwang@samsung.com>

Please ignore this mail. I didn't know that "git send *" includes all
files in the subdirectories. I am very sorry for disturbing you.

Best regards,
Hyungwon Hwang

On Fri, 12 Jun 2015 21:59:12 +0900
Hyungwon Hwang <human.hwang@samsung.com> wrote:

> FIMC & GSC driver can calculate the offset of planes. So there are
> use cases which IPP receives just one GEM handle of an image with
> multiple plane. This patch extends ipp_validate_mem_node() to validate
> this case.
> 
> Signed-off-by: Hyungwon Hwang <human.hwang@samsung.com>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_ipp.c | 51
> ++++++++++++++++++++++++--------- 1 file changed, 38 insertions(+),
> 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_ipp.c
> b/drivers/gpu/drm/exynos/exynos_drm_ipp.c index 54c5cf4..b3dc778
> 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_ipp.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_ipp.c
> @@ -482,8 +482,8 @@ static int ipp_validate_mem_node(struct
> drm_device *drm_dev, {
>  	struct drm_exynos_ipp_config *ipp_cfg;
>  	unsigned int num_plane;
> -	unsigned long min_size, size;
> -	unsigned int bpp;
> +	unsigned long size, buf_size = 0, plane_size, img_size = 0;
> +	unsigned int bpp, width, height;
>  	int i;
>  
>  	ipp_cfg = &c_node->property.config[m_node->ops_id];
> @@ -497,20 +497,45 @@ static int ipp_validate_mem_node(struct
> drm_device *drm_dev,
>  	 * but it seems more than enough
>  	 */
>  	for (i = 0; i < num_plane; ++i) {
> -		if (!m_node->buf_info.handles[i]) {
> -			DRM_ERROR("invalid handle for plane %d\n",
> i);
> -			return -EINVAL;
> -		}
> +		width = ipp_cfg->sz.hsize;
> +		height = ipp_cfg->sz.vsize;
>  		bpp = drm_format_plane_cpp(ipp_cfg->fmt, i);
> -		min_size = (ipp_cfg->sz.hsize * ipp_cfg->sz.vsize *
> bpp) >> 3;
> -		size = exynos_drm_gem_get_size(drm_dev,
> -
> m_node->buf_info.handles[i],
> -					       c_node->filp);
> -		if (min_size > size) {
> -			DRM_ERROR("invalid size for plane %d\n", i);
> -			return -EINVAL;
> +
> +		/*
> +		 * The result of drm_format_plane_cpp() for chroma
> planes must
> +		 * be used with drm_format_xxxx_chroma_subsampling()
> for
> +		 * correct result.
> +		 */
> +		if (i > 0) {
> +			width /= drm_format_horz_chroma_subsampling(
> +
> ipp_cfg->fmt);
> +			height /= drm_format_vert_chroma_subsampling(
> +
> ipp_cfg->fmt); }
> +		plane_size = width * height * bpp;
> +		img_size += plane_size;
> +
> +		if (m_node->buf_info.handles[i]) {
> +			size = exynos_drm_gem_get_size(drm_dev,
> +					m_node->buf_info.handles[i],
> +					c_node->filp);
> +			if (plane_size > size) {
> +				DRM_ERROR(
> +					"buffer %d is smaller than
> required\n",
> +					i);
> +				return -EINVAL;
> +			}
> +
> +			buf_size += size;
> +		}
> +	}
> +
> +	if (buf_size < img_size) {
> +		DRM_ERROR("size of buffers(%lu) is smaller than
> image(%lu)\n",
> +			buf_size, img_size);
> +		return -EINVAL;
>  	}
> +
>  	return 0;
>  }
>  

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

  reply	other threads:[~2015-06-12 13:02 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-12 12:58 [PATCH v6 00/15] Add drivers for Exynos5433 display Hyungwon Hwang
2015-06-12 12:58 ` [PATCH v6 02/15] drm/exynos: Add the dependency for DRM_EXYNOS to DPI/DSI/DP Hyungwon Hwang
2015-06-12 12:58 ` [PATCH v6 03/15] drm/exynos: add drm_iommu_attach_device_if_possible() Hyungwon Hwang
2015-06-12 12:58 ` [PATCH v6 04/15] drm/exynos: fix the input prompt of Exynos7 DECON Hyungwon Hwang
2015-06-12 12:59 ` [PATCH v6 06/15] of: add helper for getting endpoint node of specific identifiers Hyungwon Hwang
2015-06-23  0:19   ` Dave Airlie
2015-06-23  2:29     ` Inki Dae
2015-06-12 12:59 ` [PATCH v6 07/15] drm/exynos: mic: add MIC driver Hyungwon Hwang
2015-06-12 12:59 ` [PATCH v6 12/15] drm/exynos: dsi: add support for Exynos5433 Hyungwon Hwang
2015-06-12 12:59 ` [PATCH v6 14/15] drm/exynos: dsi: do not set TE GPIO direction by input Hyungwon Hwang
2015-06-12 12:59 ` [PATCH 2/2] drm/exynos: ipp: validate a GEM handle with multiple planes Hyungwon Hwang
2015-06-12 13:02   ` Hyungwon Hwang [this message]
2015-06-12 12:59 ` [PATCH] ARM: dts: set display clock correctly for exynos4412-trats2 Hyungwon Hwang
2015-06-12 12:59 ` [PATCH 1/3] drm/panel: add s6e63j0x03 LCD panel driver Hyungwon Hwang
2015-06-12 13:02   ` Hyungwon Hwang
2015-06-12 12:59 ` [PATCH 3/3] ARM: dts: fix the clock-frequency of rinato board's panel Hyungwon Hwang
2015-06-12 13:02   ` Hyungwon Hwang
     [not found] ` <1434113958-15877-1-git-send-email-human.hwang-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-06-12 12:58   ` [PATCH v6 01/15] drm/exynos: remove the dependency of DP driver for ARCH_EXYNOS Hyungwon Hwang
2015-06-12 12:59   ` [PATCH v6 05/15] drm/exynos: add Exynos5433 decon driver Hyungwon Hwang
2015-06-12 12:59   ` [PATCH v6 08/15] drm/exynos: dsi: rename pll_clk to sclk_clk Hyungwon Hwang
2015-06-22 12:25     ` Inki Dae
2015-06-12 12:59   ` [PATCH v6 09/15] drm/exynos: dsi: add macros for register access Hyungwon Hwang
2015-06-12 12:59   ` [PATCH v6 10/15] drm/exynos: dsi: make use of driver data for static values Hyungwon Hwang
2015-06-12 12:59   ` [PATCH v6 11/15] drm/exynos: dsi: make use of array for clock access Hyungwon Hwang
2015-06-12 12:59   ` [PATCH v6 13/15] drm/exynos: dsi: add support for MIC driver as a bridge Hyungwon Hwang
2015-06-12 12:59   ` [PATCH v6 15/15] ARM: dts: rename the clock of MIPI DSI 'pll_clk' to 'sclk_mipi' Hyungwon Hwang
2015-06-22  9:10     ` Inki Dae
2015-06-22 11:42       ` Inki Dae
2015-06-22 11:59         ` Krzysztof Kozlowski
2015-06-22 12:10           ` Inki Dae
2015-06-22 12:20             ` Krzysztof Kozlowski
2015-06-22 12:35         ` Krzysztof Kozlowski
2015-06-23  2:10           ` Krzysztof Kozlowski
2015-06-23  2:28             ` Inki Dae
2015-06-23  4:00               ` Krzysztof Kozlowski
2015-06-12 12:59   ` [PATCH 1/2] drm/exynos: ipp: fix wrong index referencing a config element Hyungwon Hwang
2015-06-12 13:02     ` Hyungwon Hwang
2015-06-12 12:59   ` [PATCH 2/3] ARM: dts: Add the reference node for syscon to mipi phy for Exynos3250 Hyungwon Hwang
2015-06-12 13:02     ` Hyungwon Hwang
2015-06-12 12:59   ` [v3,2/3] drm/panel: add s6e63j0x03 LCD panel driver Hyungwon Hwang
     [not found] ` <1421653953-8187-2-git-send-email-human.hwang@samsung.com>
2015-06-12 13:03   ` Hyungwon Hwang

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=20150612220224.75594a95@hwh-ubuntu \
    --to=human.hwang@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=sw0312.kim@samsung.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;
as well as URLs for NNTP newsgroup(s).