dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Robert Foss <robert.foss@linaro.org>
To: Liu Ying <victor.liu@nxp.com>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>,
	Jonas Karlman <jonas@kwiboo.se>, David Airlie <airlied@linux.ie>,
	agx@sigxcpu.org, Neil Armstrong <narmstrong@baylibre.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	robert.chiras@nxp.com, linux-imx@nxp.com
Subject: Re: [PATCH v3 1/3] drm/bridge: nwl-dsi: Force a full modeset when crtc_state->active is changed to be true
Date: Fri, 30 Apr 2021 11:56:28 +0200	[thread overview]
Message-ID: <CAG3jFytcPzo81t8hubAf4Gb1zrVzZVB5D6qP-Dnchef6Zus25Q@mail.gmail.com> (raw)
In-Reply-To: <1619170003-4817-2-git-send-email-victor.liu@nxp.com>


[-- Attachment #1.1: Type: text/plain, Size: 6520 bytes --]

Hey Liu,

This patch does not apply on upstream-drm-misc/drm-misc-next. When it
passes local testing & building, I'm ready to merge it.

On Fri, 23 Apr 2021 at 11:42, Liu Ying <victor.liu@nxp.com> wrote:

> This patch replaces ->mode_fixup() with ->atomic_check() so that
> a full modeset can be requested from there when crtc_state->active
> is changed to be true(which implies only connector's DPMS is brought
> out of "Off" status, though not necessarily).  Bridge functions are
> added or changed to accommodate the ->atomic_check() callback.  That
> full modeset is needed by the up-coming patch which gets MIPI DSI
> controller and PHY ready in ->mode_set(), because it makes sure
> ->mode_set() and ->atomic_disable() are called in pairs.
>
> Cc: Andrzej Hajda <a.hajda@samsung.com>
> Cc: Neil Armstrong <narmstrong@baylibre.com>
> Cc: Robert Foss <robert.foss@linaro.org>
> Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
> Cc: Jonas Karlman <jonas@kwiboo.se>
> Cc: Jernej Skrabec <jernej.skrabec@siol.net>
> Cc: David Airlie <airlied@linux.ie>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> Cc: Guido Günther <agx@sigxcpu.org>
> Cc: Robert Chiras <robert.chiras@nxp.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Signed-off-by: Liu Ying <victor.liu@nxp.com>
> ---
> v2->v3:
> * Split from the single patch in v2 to clarify changes. (Neil)
>
>  drivers/gpu/drm/bridge/nwl-dsi.c | 61 ++++++++++++++++++++------------
>  1 file changed, 39 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c
> b/drivers/gpu/drm/bridge/nwl-dsi.c
> index 66b67402f1acd..c65ca860712d2 100644
> --- a/drivers/gpu/drm/bridge/nwl-dsi.c
> +++ b/drivers/gpu/drm/bridge/nwl-dsi.c
> @@ -21,6 +21,7 @@
>  #include <linux/sys_soc.h>
>  #include <linux/time64.h>
>
> +#include <drm/drm_atomic_state_helper.h>
>  #include <drm/drm_bridge.h>
>  #include <drm/drm_mipi_dsi.h>
>  #include <drm/drm_of.h>
> @@ -742,7 +743,9 @@ static int nwl_dsi_disable(struct nwl_dsi *dsi)
>         return 0;
>  }
>
> -static void nwl_dsi_bridge_disable(struct drm_bridge *bridge)
> +static void
> +nwl_dsi_bridge_atomic_disable(struct drm_bridge *bridge,
> +                             struct drm_bridge_state *old_bridge_state)
>  {
>         struct nwl_dsi *dsi = bridge_to_dsi(bridge);
>         int ret;
> @@ -803,17 +806,6 @@ static int nwl_dsi_get_dphy_params(struct nwl_dsi
> *dsi,
>         return 0;
>  }
>
> -static bool nwl_dsi_bridge_mode_fixup(struct drm_bridge *bridge,
> -                                     const struct drm_display_mode *mode,
> -                                     struct drm_display_mode
> *adjusted_mode)
> -{
> -       /* At least LCDIF + NWL needs active high sync */
> -       adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC |
> DRM_MODE_FLAG_PVSYNC);
> -       adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC |
> DRM_MODE_FLAG_NVSYNC);
> -
> -       return true;
> -}
> -
>  static enum drm_mode_status
>  nwl_dsi_bridge_mode_valid(struct drm_bridge *bridge,
>                           const struct drm_display_info *info,
> @@ -831,6 +823,24 @@ nwl_dsi_bridge_mode_valid(struct drm_bridge *bridge,
>         return MODE_OK;
>  }
>
> +static int nwl_dsi_bridge_atomic_check(struct drm_bridge *bridge,
> +                                      struct drm_bridge_state
> *bridge_state,
> +                                      struct drm_crtc_state *crtc_state,
> +                                      struct drm_connector_state
> *conn_state)
> +{
> +       struct drm_display_mode *adjusted_mode =
> &crtc_state->adjusted_mode;
> +
> +       /* At least LCDIF + NWL needs active high sync */
> +       adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC |
> DRM_MODE_FLAG_PVSYNC);
> +       adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC |
> DRM_MODE_FLAG_NVSYNC);
> +
> +       /* Do a full modeset if crtc_state->active is changed to be true.
> */
> +       if (crtc_state->active_changed && crtc_state->active)
> +               crtc_state->mode_changed = true;
> +
> +       return 0;
> +}
> +
>  static void
>  nwl_dsi_bridge_mode_set(struct drm_bridge *bridge,
>                         const struct drm_display_mode *mode,
> @@ -862,7 +872,9 @@ nwl_dsi_bridge_mode_set(struct drm_bridge *bridge,
>         drm_mode_debug_printmodeline(adjusted_mode);
>  }
>
> -static void nwl_dsi_bridge_pre_enable(struct drm_bridge *bridge)
> +static void
> +nwl_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
> +                                struct drm_bridge_state *old_bridge_state)
>  {
>         struct nwl_dsi *dsi = bridge_to_dsi(bridge);
>         int ret;
> @@ -897,7 +909,9 @@ static void nwl_dsi_bridge_pre_enable(struct
> drm_bridge *bridge)
>         }
>  }
>
> -static void nwl_dsi_bridge_enable(struct drm_bridge *bridge)
> +static void
> +nwl_dsi_bridge_atomic_enable(struct drm_bridge *bridge,
> +                            struct drm_bridge_state *old_bridge_state)
>  {
>         struct nwl_dsi *dsi = bridge_to_dsi(bridge);
>         int ret;
> @@ -942,14 +956,17 @@ static void nwl_dsi_bridge_detach(struct drm_bridge
> *bridge)
>  }
>
>  static const struct drm_bridge_funcs nwl_dsi_bridge_funcs = {
> -       .pre_enable = nwl_dsi_bridge_pre_enable,
> -       .enable     = nwl_dsi_bridge_enable,
> -       .disable    = nwl_dsi_bridge_disable,
> -       .mode_fixup = nwl_dsi_bridge_mode_fixup,
> -       .mode_set   = nwl_dsi_bridge_mode_set,
> -       .mode_valid = nwl_dsi_bridge_mode_valid,
> -       .attach     = nwl_dsi_bridge_attach,
> -       .detach     = nwl_dsi_bridge_detach,
> +       .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
> +       .atomic_destroy_state   = drm_atomic_helper_bridge_destroy_state,
> +       .atomic_reset           = drm_atomic_helper_bridge_reset,
> +       .atomic_check           = nwl_dsi_bridge_atomic_check,
> +       .atomic_pre_enable      = nwl_dsi_bridge_atomic_pre_enable,
> +       .atomic_enable          = nwl_dsi_bridge_atomic_enable,
> +       .atomic_disable         = nwl_dsi_bridge_atomic_disable,
> +       .mode_set               = nwl_dsi_bridge_mode_set,
> +       .mode_valid             = nwl_dsi_bridge_mode_valid,
> +       .attach                 = nwl_dsi_bridge_attach,
> +       .detach                 = nwl_dsi_bridge_detach,
>  };
>
>  static int nwl_dsi_parse_dt(struct nwl_dsi *dsi)
> --
> 2.25.1
>
>

[-- Attachment #1.2: Type: text/html, Size: 8402 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

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

  parent reply	other threads:[~2021-04-30  9:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23  9:26 [PATCH v3 0/3] drm/bridge: nwl-dsi: Get MIPI DSI controller and PHY ready in ->mode_set() Liu Ying
2021-04-23  9:26 ` [PATCH v3 1/3] drm/bridge: nwl-dsi: Force a full modeset when crtc_state->active is changed to be true Liu Ying
2021-04-30  8:35   ` Neil Armstrong
2021-04-30  9:56   ` Robert Foss [this message]
2021-04-30 11:45     ` Liu Ying
2021-04-30 11:49       ` Robert Foss
2021-04-23  9:26 ` [PATCH v3 2/3] drm/bridge: nwl-dsi: Remove a check on unchanged HS clock rate from ->mode_set() Liu Ying
2021-04-30  8:35   ` Neil Armstrong
2021-04-23  9:26 ` [PATCH v3 3/3] drm/bridge: nwl-dsi: Get MIPI DSI controller and PHY ready in ->mode_set() Liu Ying
2021-04-30  8:35   ` Neil Armstrong
2021-04-26  7:43 ` [PATCH v3 0/3] " Neil Armstrong
2021-04-30  8:35 ` Neil Armstrong
2021-04-30  9:17 ` Guido Günther

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=CAG3jFytcPzo81t8hubAf4Gb1zrVzZVB5D6qP-Dnchef6Zus25Q@mail.gmail.com \
    --to=robert.foss@linaro.org \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=agx@sigxcpu.org \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    --cc=robert.chiras@nxp.com \
    --cc=victor.liu@nxp.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).