All of lore.kernel.org
 help / color / mirror / Atom feed
From: Inki Dae <inki.dae@samsung.com>
To: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>,
	linux-samsung-soc@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org, emil.l.velikov@gmail.com,
	jy0922.shim@samsung.com, gustavo.padovan@collabora.co.uk
Subject: Re: [PATCH 07/14] exynos/fimg2d: add g2d_validate_xyz() functions
Date: Mon, 31 Aug 2015 22:18:33 +0900	[thread overview]
Message-ID: <55E45429.3070500@samsung.com> (raw)
In-Reply-To: <1440425649-9768-8-git-send-email-tjakobi@math.uni-bielefeld.de>

On 2015년 08월 24일 23:14, Tobias Jakobi wrote:
> The G2D headers define a number of modes through enums
> (like e.g. color, select, repeat, etc.).
> 
> This introduces g2d_validate_select_mode() and
> g2d_validate_blending_op() which validate a
> select mode or blending operation respectively.
> 
> Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> ---
>  exynos/exynos_fimg2d.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/exynos/exynos_fimg2d.c b/exynos/exynos_fimg2d.c
> index 2e04f4a..781aff5 100644
> --- a/exynos/exynos_fimg2d.c
> +++ b/exynos/exynos_fimg2d.c
> @@ -119,6 +119,50 @@ static unsigned int g2d_check_space(const struct g2d_context *ctx,
>  }
>  
>  /*
> + * g2d_validate_select_mode - validate select mode.
> + *
> + * @mode: the mode to validate
> + */
> +static unsigned int g2d_validate_select_mode(
> +	enum e_g2d_select_mode mode)
> +{
> +	switch (mode) {
> +	case G2D_SELECT_MODE_NORMAL:
> +	case G2D_SELECT_MODE_FGCOLOR:
> +	case G2D_SELECT_MODE_BGCOLOR:
> +		return 0;
> +	}

It's strange use a bit. Just check the range like below,

First, please add G2D_SELECT_MODE_MAX which has 3 << 0, and

if (G2D_SELECT_MODE_MAX < mode) {
	fprintf(strerr, "invalid command(0x%x)\n", mode);
	return -EINVAL;
}

And I think it'd be better to change return type of this function to int,

> +
> +	return 1;

so return 0

> +}
> +
> +/*
> + * g2d_validate_blending_op - validate blending operation.
> + *
> + * @operation: the operation to validate
> + */
> +static unsigned int g2d_validate_blending_op(
> +	enum e_g2d_op operation)
> +{
> +	switch (operation) {
> +	case G2D_OP_CLEAR:
> +	case G2D_OP_SRC:
> +	case G2D_OP_DST:
> +	case G2D_OP_OVER:
> +	case G2D_OP_INTERPOLATE:
> +	case G2D_OP_DISJOINT_CLEAR:
> +	case G2D_OP_DISJOINT_SRC:
> +	case G2D_OP_DISJOINT_DST:
> +	case G2D_OP_CONJOINT_CLEAR:
> +	case G2D_OP_CONJOINT_SRC:
> +	case G2D_OP_CONJOINT_DST:
> +		return 0;

Ditto, You could modify it like above.

Thanks,
Inki Dae

> +	}
> +
> +	return 1;
> +}
> +
> +/*
>   * g2d_add_cmd - set given command and value to user side command buffer.
>   *
>   * @ctx: a pointer to g2d_context structure.
> 

  reply	other threads:[~2015-08-31 13:18 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-24 14:13 [PATCH 00/14] drm/exynos: rewrite fimg2d error handling Tobias Jakobi
2015-08-24 14:13 ` [PATCH 01/14] exynos/fimg2d: fix empty buffer handling in g2d_flush() Tobias Jakobi
2015-08-24 14:13 ` [PATCH 02/14] exynos/fimg2d: simplify base address submission in g2d_scale_and_blend() Tobias Jakobi
2015-08-24 14:13 ` [PATCH 03/14] exynos/fimg2d: add g2d_check_space() Tobias Jakobi
2015-08-24 14:13 ` [PATCH 04/14] exynos/fimg2d: check buffer space in g2d_solid_fill() Tobias Jakobi
2015-08-31 13:01   ` Inki Dae
2015-08-31 19:27     ` Tobias Jakobi
2015-08-31 19:57       ` Emil Velikov
2015-09-01  0:41         ` Inki Dae
2015-08-24 14:14 ` [PATCH 05/14] exynos/fimg2d: check buffer space in g2d_copy() Tobias Jakobi
2015-08-31 13:06   ` Inki Dae
2015-08-24 14:14 ` [PATCH 06/14] exynos/fimg2d: check buffer space in g2d_copy_with_scale() Tobias Jakobi
2015-08-24 14:14 ` [PATCH 07/14] exynos/fimg2d: add g2d_validate_xyz() functions Tobias Jakobi
2015-08-31 13:18   ` Inki Dae [this message]
2015-08-31 18:45     ` Emil Velikov
2015-08-31 19:31       ` Tobias Jakobi
2015-08-24 14:14 ` [PATCH 08/14] exynos/fimg2d: check buffer space in g2d_blend() Tobias Jakobi
2015-08-31 13:19   ` Inki Dae
2015-08-24 14:14 ` [PATCH 09/14] exynos/fimg2d: check buffer space in g2d_scale_and_blend() Tobias Jakobi
2015-08-31 13:20   ` Inki Dae
2015-08-24 14:14 ` [PATCH 10/14] exynos/fimg2d: remove default case from g2d_get_blend_op() Tobias Jakobi
2015-08-31 13:25   ` Inki Dae
2015-08-31 18:53     ` Emil Velikov
2015-09-01  0:39       ` Inki Dae
2015-09-02 19:35         ` Tobias Jakobi
2015-08-24 14:14 ` [PATCH 11/14] exynos/fimg2d: remove superfluous initialization of g2d_point_val Tobias Jakobi
2015-08-24 14:14 ` [PATCH 12/14] exynos/fimg2d: make g2d_add_cmd() less heavy Tobias Jakobi
2015-08-24 14:14 ` [PATCH 13/14] exynos/fimg2d: add message prefix Tobias Jakobi
2015-08-27 17:21 ` [PATCH 00/14] drm/exynos: rewrite fimg2d error handling Emil Velikov
2015-08-27 20:46   ` Tobias Jakobi
2015-09-01  0:47     ` Inki Dae

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=55E45429.3070500@samsung.com \
    --to=inki.dae@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.l.velikov@gmail.com \
    --cc=gustavo.padovan@collabora.co.uk \
    --cc=jy0922.shim@samsung.com \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=tjakobi@math.uni-bielefeld.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.