All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ying Liu <gnuiyl@gmail.com>
To: Philipp Zabel <p.zabel@pengutronix.de>
Cc: kernel@pengutronix.de, DRI Development <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 08/10] drm/imx: ipuv3-plane: add support for YUV 4:2:2 and 4:4:4, NV12, and NV16 formats
Date: Thu, 20 Oct 2016 14:21:01 +0800	[thread overview]
Message-ID: <CAOcKUNVecahCt937CL2NjJO_zL0dUdDGSGTaqmHu-XvqBiWruQ@mail.gmail.com> (raw)
In-Reply-To: <1476872477-29493-8-git-send-email-p.zabel@pengutronix.de>

On Wed, Oct 19, 2016 at 6:21 PM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> Hook up support for DRM_FORMAT_YUV422, DRM_FORMAT_YVU422,
> DRM_FORMAT_YUV444, DRM_FORMAT_YVU444, DRM_FORMAT_NV12,
> and DRM_FORMAT_NV16.
>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

Acked-by: Liu Ying <gnuiyl@gmail.com>

> ---
> Changes since v1:
>  - Make UBO/VBO swap for YVU formats more obvious in ipu_plane_atomic_update
> ---
>  drivers/gpu/drm/imx/ipuv3-plane.c | 60 ++++++++++++++++++++++++++++++---------
>  1 file changed, 47 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c
> index 52784cb..6a97e396 100644
> --- a/drivers/gpu/drm/imx/ipuv3-plane.c
> +++ b/drivers/gpu/drm/imx/ipuv3-plane.c
> @@ -50,6 +50,12 @@ static const uint32_t ipu_plane_formats[] = {
>         DRM_FORMAT_YVYU,
>         DRM_FORMAT_YUV420,
>         DRM_FORMAT_YVU420,
> +       DRM_FORMAT_YUV422,
> +       DRM_FORMAT_YVU422,
> +       DRM_FORMAT_YUV444,
> +       DRM_FORMAT_YVU444,
> +       DRM_FORMAT_NV12,
> +       DRM_FORMAT_NV16,
>         DRM_FORMAT_RGB565,
>  };
>
> @@ -292,6 +298,10 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
>         switch (fb->pixel_format) {
>         case DRM_FORMAT_YUV420:
>         case DRM_FORMAT_YVU420:
> +       case DRM_FORMAT_YUV422:
> +       case DRM_FORMAT_YVU422:
> +       case DRM_FORMAT_YUV444:
> +       case DRM_FORMAT_YVU444:
>                 /*
>                  * Multiplanar formats have to meet the following restrictions:
>                  * - The (up to) three plane addresses are EBA, EBA+UBO, EBA+VBO
> @@ -300,25 +310,34 @@ static int ipu_plane_atomic_check(struct drm_plane *plane,
>                  * - Only EBA may be changed while scanout is active
>                  * - The strides of U and V planes must be identical.
>                  */
> -               ubo = drm_plane_state_to_ubo(state);
>                 vbo = drm_plane_state_to_vbo(state);
>
> -               if ((ubo & 0x7) || (vbo & 0x7))
> -                       return -EINVAL;
> -
> -               if ((ubo > 0xfffff8) || (vbo > 0xfffff8))
> +               if (vbo & 0x7 || vbo > 0xfffff8)
>                         return -EINVAL;
>
>                 if (old_fb && (fb->pixel_format == old_fb->pixel_format)) {
> -                       old_ubo = drm_plane_state_to_ubo(old_state);
>                         old_vbo = drm_plane_state_to_vbo(old_state);
> -                       if (ubo != old_ubo || vbo != old_vbo)
> +                       if (vbo != old_vbo)
>                                 crtc_state->mode_changed = true;
>                 }
>
>                 if (fb->pitches[1] != fb->pitches[2])
>                         return -EINVAL;
>
> +               /* fall-through */
> +       case DRM_FORMAT_NV12:
> +       case DRM_FORMAT_NV16:
> +               ubo = drm_plane_state_to_ubo(state);
> +
> +               if (ubo & 0x7 || ubo > 0xfffff8)
> +                       return -EINVAL;
> +
> +               if (old_fb && (fb->pixel_format == old_fb->pixel_format)) {
> +                       old_ubo = drm_plane_state_to_ubo(old_state);
> +                       if (ubo != old_ubo)
> +                               crtc_state->mode_changed = true;
> +               }
> +
>                 if (fb->pitches[1] < 1 || fb->pitches[1] > 16384)
>                         return -EINVAL;
>
> @@ -409,20 +428,35 @@ static void ipu_plane_atomic_update(struct drm_plane *plane,
>         switch (fb->pixel_format) {
>         case DRM_FORMAT_YUV420:
>         case DRM_FORMAT_YVU420:
> +       case DRM_FORMAT_YUV422:
> +       case DRM_FORMAT_YVU422:
> +       case DRM_FORMAT_YUV444:
> +       case DRM_FORMAT_YVU444:
>                 ubo = drm_plane_state_to_ubo(state);
>                 vbo = drm_plane_state_to_vbo(state);
> +               if (fb->pixel_format == DRM_FORMAT_YVU420 ||
> +                   fb->pixel_format == DRM_FORMAT_YVU422 ||
> +                   fb->pixel_format == DRM_FORMAT_YVU444)
> +                       swap(ubo, vbo);
>
> -               if (fb->pixel_format == DRM_FORMAT_YUV420)
> -                       ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch,
> -                                                     fb->pitches[1], ubo, vbo);
> -               else
> -                       ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch,
> -                                                     fb->pitches[1], vbo, ubo);
> +               ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch,
> +                                             fb->pitches[1], ubo, vbo);
>
>                 dev_dbg(ipu_plane->base.dev->dev,
>                         "phy = %lu %lu %lu, x = %d, y = %d", eba, ubo, vbo,
>                         state->src_x >> 16, state->src_y >> 16);
>                 break;
> +       case DRM_FORMAT_NV12:
> +       case DRM_FORMAT_NV16:
> +               ubo = drm_plane_state_to_ubo(state);
> +
> +               ipu_cpmem_set_yuv_planar_full(ipu_plane->ipu_ch,
> +                                             fb->pitches[1], ubo, ubo);
> +
> +               dev_dbg(ipu_plane->base.dev->dev,
> +                       "phy = %lu %lu, x = %d, y = %d", eba, ubo,
> +                       state->src_x >> 16, state->src_y >> 16);
> +               break;
>         default:
>                 dev_dbg(ipu_plane->base.dev->dev, "phys = %lu, x = %d, y = %d",
>                         eba, state->src_x >> 16, state->src_y >> 16);
> --
> 2.9.3
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2016-10-20  6:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-19 10:21 [PATCH 01/10] drm/imx: ipuv3-plane: make sure x/y offsets are even in case of chroma subsampling Philipp Zabel
2016-10-19 10:21 ` [PATCH 02/10] drm/imx: ipuv3-plane: disable local alpha for planes without alpha channel Philipp Zabel
2016-10-19 10:21 ` [PATCH 03/10] drm/imx: ipuv3-plane: request modeset if plane offsets changed Philipp Zabel
2016-10-19 10:21 ` [PATCH 04/10] drm/imx: ipuv3-plane: merge ipu_plane_atomic_set_base into atomic_update Philipp Zabel
2016-10-19 10:21 ` [PATCH 05/10] drm/imx: ipuv3-plane: let drm_plane_state_to_ubo/vbo handle chroma subsampling other than 4:2:0 Philipp Zabel
2016-10-20  6:19   ` Ying Liu
2016-10-19 10:21 ` [PATCH 06/10] gpu: ipu-cpmem: remove unused ipu_cpmem_set_yuv_planar function Philipp Zabel
2016-10-20  6:20   ` Ying Liu
2016-10-19 10:21 ` [PATCH 07/10] gpu: ipu-v3: add YUV 4:4:4 support Philipp Zabel
2016-10-19 10:21 ` [PATCH 08/10] drm/imx: ipuv3-plane: add support for YUV 4:2:2 and 4:4:4, NV12, and NV16 formats Philipp Zabel
2016-10-20  6:21   ` Ying Liu [this message]
2016-10-19 10:21 ` [PATCH 09/10] gpu: ipu-v3: initially clear all interrupts Philipp Zabel
2016-10-19 10:21 ` [PATCH 10/10] drm/imx: ipuv3-plane: use drm_plane_helper_check_state, clipped coordinates Philipp Zabel
2016-10-19 10:31   ` Ville Syrjälä
2016-10-19 10:46     ` Philipp Zabel
2016-10-20  7:53   ` Ying Liu
2016-10-20  8:41     ` Ville Syrjälä
2016-10-20  8:51       ` Ying Liu
2016-10-20 13:20         ` Ville Syrjälä
2016-10-20 13:29         ` Philipp Zabel
2016-10-21  5:45           ` Ying Liu
2016-10-21  8:18             ` Philipp Zabel
2016-10-21  8:49               ` Ying Liu
2016-10-24 11:50                 ` Philipp Zabel
2016-10-25  2:59                   ` Ying Liu
2016-10-20  6:18 ` [PATCH 01/10] drm/imx: ipuv3-plane: make sure x/y offsets are even in case of chroma subsampling Ying Liu

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=CAOcKUNVecahCt937CL2NjJO_zL0dUdDGSGTaqmHu-XvqBiWruQ@mail.gmail.com \
    --to=gnuiyl@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@pengutronix.de \
    --cc=p.zabel@pengutronix.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.