From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Jyri Sarha <jsarha@ti.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 08/16] drm/omap: add format_is_yuv() helper
Date: Wed, 24 May 2017 12:38:36 +0300 [thread overview]
Message-ID: <2896688.5JFetRt2Le@avalon> (raw)
In-Reply-To: <1493893412-12178-9-git-send-email-tomi.valkeinen@ti.com>
Hi Tomi,
Thank you for the patch.
On Thursday 04 May 2017 13:23:24 Tomi Valkeinen wrote:
> In a few places the dispc driver needs to know whether the pixel format
> is an YUV format. Add a helper to figure that out.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
> drivers/gpu/drm/omapdrm/dss/dispc.c | 56 ++++++++++++++--------------------
> 1 file changed, 23 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c
> b/drivers/gpu/drm/omapdrm/dss/dispc.c index 48bb71eafa56..9dfef8fdff67
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/dispc.c
> +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
> @@ -978,6 +978,18 @@ static void dispc_ovl_set_color_mode(enum omap_plane_id
> plane, REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), m, 4, 1);
> }
>
> +static bool format_is_yuv(enum omap_color_mode color_mode)
> +{
> + switch (color_mode) {
> + case OMAP_DSS_COLOR_YUV2:
> + case OMAP_DSS_COLOR_UYVY:
> + case OMAP_DSS_COLOR_NV12:
> + return true;
> + default:
> + return false;
> + }
> +}
> +
> static void dispc_ovl_configure_burst_type(enum omap_plane_id plane,
> enum omap_dss_rotation_type rotation_type)
> {
> @@ -1703,9 +1715,8 @@ static void dispc_ovl_set_scaling_uv(enum
> omap_plane_id plane,
>
> if (!dss_has_feature(FEAT_HANDLE_UV_SEPARATE))
> return;
> - if ((color_mode != OMAP_DSS_COLOR_YUV2 &&
> - color_mode != OMAP_DSS_COLOR_UYVY &&
> - color_mode != OMAP_DSS_COLOR_NV12)) {
> +
> + if (!format_is_yuv(color_mode)) {
> /* reset chroma resampling for RGB formats */
> if (plane != OMAP_DSS_WB)
> REG_FLD_MOD(DISPC_OVL_ATTRIBUTES2(plane), 0, 8, 8);
> @@ -2384,19 +2395,9 @@ static int dispc_ovl_setup_common(enum omap_plane_id
> plane, if (paddr == 0 && rotation_type != OMAP_DSS_ROT_TILER)
> return -EINVAL;
>
> - switch (color_mode) {
> - case OMAP_DSS_COLOR_YUV2:
> - case OMAP_DSS_COLOR_UYVY:
> - case OMAP_DSS_COLOR_NV12:
> - if (in_width & 1) {
> - DSSERR("input width %d is not even for YUV format\n",
> - in_width);
> - return -EINVAL;
> - }
> - break;
> -
> - default:
> - break;
> + if (format_is_yuv(color_mode) && (in_width & 1)) {
> + DSSERR("input width %d is not even for YUV format\n",
in_width);
> + return -EINVAL;
> }
This is a condition that should be checked by omapdrm in the atomic_check
phase, to avoid returning an error in the atomic_commit phase.
> out_width = out_width == 0 ? width : out_width;
> @@ -2433,26 +2434,15 @@ static int dispc_ovl_setup_common(enum omap_plane_id
> plane, DSSDBG("predecimation %d x %x, new input size %d x %d\n",
> x_predecim, y_predecim, in_width, in_height);
>
> - switch (color_mode) {
> - case OMAP_DSS_COLOR_YUV2:
> - case OMAP_DSS_COLOR_UYVY:
> - case OMAP_DSS_COLOR_NV12:
> - if (in_width & 1) {
> - DSSDBG("predecimated input width is not even for YUV
format\n");
> - DSSDBG("adjusting input width %d -> %d\n",
> - in_width, in_width & ~1);
> -
> - in_width &= ~1;
> - }
> - break;
> + if (format_is_yuv(color_mode) && (in_width & 1)) {
> + DSSDBG("predecimated input width is not even for YUV
format\n");
> + DSSDBG("adjusting input width %d -> %d\n",
> + in_width, in_width & ~1);
>
> - default:
> - break;
> + in_width &= ~1;
> }
Same here.
We can fix that as a follow-up patch, so
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> - if (color_mode == OMAP_DSS_COLOR_YUV2 ||
> - color_mode == OMAP_DSS_COLOR_UYVY ||
> - color_mode == OMAP_DSS_COLOR_NV12)
> + if (format_is_yuv(color_mode))
> cconv = 1;
>
> if (ilace && !fieldmode) {
--
Regards,
Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-05-24 9:38 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-04 10:23 [PATCH 00/16] drm/omap: misc cleanups and pixel format change Tomi Valkeinen
2017-05-04 10:23 ` [PATCH 01/16] drm/omap: fix passing rotation parameter to dispc Tomi Valkeinen
2017-05-04 10:23 ` [PATCH 02/16] drm/omap: fix setting & clearing DOUBLESTRIDE Tomi Valkeinen
2017-05-24 12:36 ` Laurent Pinchart
2017-05-04 10:23 ` [PATCH 03/16] drm/omap: remove CLUT Tomi Valkeinen
2017-05-24 12:37 ` Laurent Pinchart
2017-05-04 10:23 ` [PATCH 04/16] drm/omap: ratelimit OCP error Tomi Valkeinen
2017-05-24 12:38 ` Laurent Pinchart
2017-05-04 10:23 ` [PATCH 05/16] drm/omap: remove rfbi Tomi Valkeinen
2017-05-04 10:23 ` [PATCH 06/16] drm/omap: remove dma & vrfb rotation Tomi Valkeinen
2017-05-24 9:31 ` Laurent Pinchart
2017-05-24 10:13 ` Tomi Valkeinen
2017-05-24 10:53 ` Laurent Pinchart
2017-05-04 10:23 ` [PATCH 07/16] drm/omap: cleanup offset calculation Tomi Valkeinen
2017-05-24 9:33 ` Laurent Pinchart
2017-05-04 10:23 ` [PATCH 08/16] drm/omap: add format_is_yuv() helper Tomi Valkeinen
2017-05-24 9:38 ` Laurent Pinchart [this message]
2017-05-04 10:23 ` [PATCH 09/16] drm/omap: remove unneeded prototypes Tomi Valkeinen
2017-05-24 9:43 ` Laurent Pinchart
2017-05-04 10:23 ` [PATCH 10/16] drm/omap: remove unused 'supported_modes' field Tomi Valkeinen
2017-05-24 9:46 ` Laurent Pinchart
2017-05-04 10:23 ` [PATCH 11/16] drm/omap: change supported_modes to an array Tomi Valkeinen
2017-05-24 10:44 ` Laurent Pinchart
2017-05-04 10:23 ` [PATCH 12/16] drm/omap: use DRM_FORMAT_* instead of OMAP_DSS_COLOR_* Tomi Valkeinen
2017-05-24 10:36 ` Laurent Pinchart
2017-05-04 10:23 ` [PATCH 13/16] drm/omap: use u32 instead of enum omap_color_mode Tomi Valkeinen
2017-05-24 10:28 ` Laurent Pinchart
2017-05-24 10:37 ` Tomi Valkeinen
2017-05-24 10:46 ` Laurent Pinchart
2017-05-24 11:01 ` Tomi Valkeinen
2017-05-04 10:23 ` [PATCH 14/16] drm/omap: remove omap_framebuffer_get_formats() Tomi Valkeinen
2017-05-24 10:33 ` Laurent Pinchart
2017-05-04 10:23 ` [PATCH 15/16] drm/omap: cleanup formats array Tomi Valkeinen
2017-05-24 10:48 ` Laurent Pinchart
2017-05-04 10:23 ` [PATCH 16/16] drm/omap: rename color_mode to fourcc Tomi Valkeinen
2017-05-24 10:49 ` Laurent Pinchart
2017-05-16 6:41 ` [PATCH 00/16] drm/omap: misc cleanups and pixel format change Tomi Valkeinen
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=2896688.5JFetRt2Le@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jsarha@ti.com \
--cc=tomi.valkeinen@ti.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 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.