All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 21/30] drm: omapdrm: dss: Pass omap_drm_private pointer to dss_mgr_ops
Date: Tue, 13 Feb 2018 21:58:01 +0100	[thread overview]
Message-ID: <20180213205801.bee6oomubn7bas7l@earth.universe> (raw)
In-Reply-To: <20180213120048.21603-22-laurent.pinchart@ideasonboard.com>


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

Hi,

On Tue, Feb 13, 2018 at 02:00:39PM +0200, Laurent Pinchart wrote:
> The dss_mgr_ops operations implemented by the omapdrm side have to look
> up the omap_crtc objects from global variables as they are only passed a
> channel number. In order to remove global variables in the omapdrm
> driver pass the omap_drm_private pointer to the dss_mgr_ops. This
> requires storing a pointer to the omap_drm_private in a global variable
> on the DSS side as a temporary measure until the omapdrm and omapdss
> drivers get merged.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/omapdss.h | 41 ++++++++++++++++++++++-------------
>  drivers/gpu/drm/omapdrm/dss/output.c  | 28 +++++++++++++++---------
>  drivers/gpu/drm/omapdrm/omap_crtc.c   | 31 +++++++++++++++-----------
>  drivers/gpu/drm/omapdrm/omap_crtc.h   |  2 +-
>  drivers/gpu/drm/omapdrm/omap_drv.c    |  2 +-
>  5 files changed, 64 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index aeaa337b29c7..318641f5bc24 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -59,6 +59,7 @@
>  #define DISPC_IRQ_ACBIAS_COUNT_STAT3	(1 << 29)
>  #define DISPC_IRQ_FRAMEDONE3		(1 << 30)
>  
> +struct omap_drm_private;
>  struct omap_dss_device;
>  struct dss_lcd_mgr_config;
>  struct snd_aes_iec958;
> @@ -635,25 +636,35 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port);
>  u32 dss_of_port_get_port_number(struct device_node *port);
>  
>  struct dss_mgr_ops {
> -	int (*connect)(enum omap_channel channel,
> -		struct omap_dss_device *dst);
> -	void (*disconnect)(enum omap_channel channel,
> -		struct omap_dss_device *dst);
> -
> -	void (*start_update)(enum omap_channel channel);
> -	int (*enable)(enum omap_channel channel);
> -	void (*disable)(enum omap_channel channel);
> -	void (*set_timings)(enum omap_channel channel,
> -			const struct videomode *vm);
> -	void (*set_lcd_config)(enum omap_channel channel,
> -			const struct dss_lcd_mgr_config *config);
> -	int (*register_framedone_handler)(enum omap_channel channel,
> +	int (*connect)(struct omap_drm_private *priv,
> +		       enum omap_channel channel,
> +		       struct omap_dss_device *dst);
> +	void (*disconnect)(struct omap_drm_private *priv,
> +			   enum omap_channel channel,
> +			   struct omap_dss_device *dst);
> +
> +	void (*start_update)(struct omap_drm_private *priv,
> +			     enum omap_channel channel);
> +	int (*enable)(struct omap_drm_private *priv,
> +		      enum omap_channel channel);
> +	void (*disable)(struct omap_drm_private *priv,
> +			enum omap_channel channel);
> +	void (*set_timings)(struct omap_drm_private *priv,
> +			    enum omap_channel channel,
> +			    const struct videomode *vm);
> +	void (*set_lcd_config)(struct omap_drm_private *priv,
> +			       enum omap_channel channel,
> +			       const struct dss_lcd_mgr_config *config);
> +	int (*register_framedone_handler)(struct omap_drm_private *priv,
> +			enum omap_channel channel,
>  			void (*handler)(void *), void *data);
> -	void (*unregister_framedone_handler)(enum omap_channel channel,
> +	void (*unregister_framedone_handler)(struct omap_drm_private *priv,
> +			enum omap_channel channel,
>  			void (*handler)(void *), void *data);
>  };
>  
> -int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops);
> +int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops,
> +			struct omap_drm_private *priv);
>  void dss_uninstall_mgr_ops(void);
>  
>  int dss_mgr_connect(struct omap_dss_device *dssdev,
> diff --git a/drivers/gpu/drm/omapdrm/dss/output.c b/drivers/gpu/drm/omapdrm/dss/output.c
> index 9ff29dea28ce..96b9d4cd505f 100644
> --- a/drivers/gpu/drm/omapdrm/dss/output.c
> +++ b/drivers/gpu/drm/omapdrm/dss/output.c
> @@ -170,13 +170,16 @@ struct omap_dss_device *omapdss_find_output_from_display(struct omap_dss_device
>  EXPORT_SYMBOL(omapdss_find_output_from_display);
>  
>  static const struct dss_mgr_ops *dss_mgr_ops;
> +static struct omap_drm_private *dss_mgr_ops_priv;
>  
> -int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops)
> +int dss_install_mgr_ops(const struct dss_mgr_ops *mgr_ops,
> +			struct omap_drm_private *priv)
>  {
>  	if (dss_mgr_ops)
>  		return -EBUSY;
>  
>  	dss_mgr_ops = mgr_ops;
> +	dss_mgr_ops_priv = priv;
>  
>  	return 0;
>  }
> @@ -185,58 +188,62 @@ EXPORT_SYMBOL(dss_install_mgr_ops);
>  void dss_uninstall_mgr_ops(void)
>  {
>  	dss_mgr_ops = NULL;
> +	dss_mgr_ops_priv = NULL;
>  }
>  EXPORT_SYMBOL(dss_uninstall_mgr_ops);
>  
>  int dss_mgr_connect(struct omap_dss_device *dssdev, struct omap_dss_device *dst)
>  {
> -	return dss_mgr_ops->connect(dssdev->dispc_channel, dst);
> +	return dss_mgr_ops->connect(dss_mgr_ops_priv,
> +				    dssdev->dispc_channel, dst);
>  }
>  EXPORT_SYMBOL(dss_mgr_connect);
>  
>  void dss_mgr_disconnect(struct omap_dss_device *dssdev,
>  			struct omap_dss_device *dst)
>  {
> -	dss_mgr_ops->disconnect(dssdev->dispc_channel, dst);
> +	dss_mgr_ops->disconnect(dss_mgr_ops_priv, dssdev->dispc_channel, dst);
>  }
>  EXPORT_SYMBOL(dss_mgr_disconnect);
>  
>  void dss_mgr_set_timings(struct omap_dss_device *dssdev,
>  			 const struct videomode *vm)
>  {
> -	dss_mgr_ops->set_timings(dssdev->dispc_channel, vm);
> +	dss_mgr_ops->set_timings(dss_mgr_ops_priv, dssdev->dispc_channel, vm);
>  }
>  EXPORT_SYMBOL(dss_mgr_set_timings);
>  
>  void dss_mgr_set_lcd_config(struct omap_dss_device *dssdev,
>  		const struct dss_lcd_mgr_config *config)
>  {
> -	dss_mgr_ops->set_lcd_config(dssdev->dispc_channel, config);
> +	dss_mgr_ops->set_lcd_config(dss_mgr_ops_priv,
> +				    dssdev->dispc_channel, config);
>  }
>  EXPORT_SYMBOL(dss_mgr_set_lcd_config);
>  
>  int dss_mgr_enable(struct omap_dss_device *dssdev)
>  {
> -	return dss_mgr_ops->enable(dssdev->dispc_channel);
> +	return dss_mgr_ops->enable(dss_mgr_ops_priv, dssdev->dispc_channel);
>  }
>  EXPORT_SYMBOL(dss_mgr_enable);
>  
>  void dss_mgr_disable(struct omap_dss_device *dssdev)
>  {
> -	dss_mgr_ops->disable(dssdev->dispc_channel);
> +	dss_mgr_ops->disable(dss_mgr_ops_priv, dssdev->dispc_channel);
>  }
>  EXPORT_SYMBOL(dss_mgr_disable);
>  
>  void dss_mgr_start_update(struct omap_dss_device *dssdev)
>  {
> -	dss_mgr_ops->start_update(dssdev->dispc_channel);
> +	dss_mgr_ops->start_update(dss_mgr_ops_priv, dssdev->dispc_channel);
>  }
>  EXPORT_SYMBOL(dss_mgr_start_update);
>  
>  int dss_mgr_register_framedone_handler(struct omap_dss_device *dssdev,
>  		void (*handler)(void *), void *data)
>  {
> -	return dss_mgr_ops->register_framedone_handler(dssdev->dispc_channel,
> +	return dss_mgr_ops->register_framedone_handler(dss_mgr_ops_priv,
> +						       dssdev->dispc_channel,
>  						       handler, data);
>  }
>  EXPORT_SYMBOL(dss_mgr_register_framedone_handler);
> @@ -244,7 +251,8 @@ EXPORT_SYMBOL(dss_mgr_register_framedone_handler);
>  void dss_mgr_unregister_framedone_handler(struct omap_dss_device *dssdev,
>  		void (*handler)(void *), void *data)
>  {
> -	dss_mgr_ops->unregister_framedone_handler(dssdev->dispc_channel,
> +	dss_mgr_ops->unregister_framedone_handler(dss_mgr_ops_priv,
> +						  dssdev->dispc_channel,
>  						  handler, data);
>  }
>  EXPORT_SYMBOL(dss_mgr_unregister_framedone_handler);
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c
> index 95615a86e9f7..61d8d17a4243 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.c
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
> @@ -113,7 +113,8 @@ static struct omap_crtc *omap_crtcs[8];
>  static struct omap_dss_device *omap_crtc_output[8];
>  
>  /* we can probably ignore these until we support command-mode panels: */
> -static int omap_crtc_dss_connect(enum omap_channel channel,
> +static int omap_crtc_dss_connect(struct omap_drm_private *priv,
> +		enum omap_channel channel,
>  		struct omap_dss_device *dst)
>  {
>  	const struct dispc_ops *dispc_ops = dispc_get_ops();
> @@ -130,14 +131,16 @@ static int omap_crtc_dss_connect(enum omap_channel channel,
>  	return 0;
>  }
>  
> -static void omap_crtc_dss_disconnect(enum omap_channel channel,
> +static void omap_crtc_dss_disconnect(struct omap_drm_private *priv,
> +		enum omap_channel channel,
>  		struct omap_dss_device *dst)
>  {
>  	omap_crtc_output[channel] = NULL;
>  	dst->dispc_channel_connected = false;
>  }
>  
> -static void omap_crtc_dss_start_update(enum omap_channel channel)
> +static void omap_crtc_dss_start_update(struct omap_drm_private *priv,
> +				       enum omap_channel channel)
>  {
>  }
>  
> @@ -207,10 +210,10 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable)
>  }
>  
>  
> -static int omap_crtc_dss_enable(enum omap_channel channel)
> +static int omap_crtc_dss_enable(struct omap_drm_private *priv,
> +				enum omap_channel channel)
>  {
>  	struct omap_crtc *omap_crtc = omap_crtcs[channel];
> -	struct omap_drm_private *priv = omap_crtc->base.dev->dev_private;
>  
>  	priv->dispc_ops->mgr_set_timings(omap_crtc->channel, &omap_crtc->vm);
>  	omap_crtc_set_enabled(&omap_crtc->base, true);
> @@ -218,14 +221,16 @@ static int omap_crtc_dss_enable(enum omap_channel channel)
>  	return 0;
>  }
>  
> -static void omap_crtc_dss_disable(enum omap_channel channel)
> +static void omap_crtc_dss_disable(struct omap_drm_private *priv,
> +				  enum omap_channel channel)
>  {
>  	struct omap_crtc *omap_crtc = omap_crtcs[channel];
>  
>  	omap_crtc_set_enabled(&omap_crtc->base, false);
>  }
>  
> -static void omap_crtc_dss_set_timings(enum omap_channel channel,
> +static void omap_crtc_dss_set_timings(struct omap_drm_private *priv,
> +		enum omap_channel channel,
>  		const struct videomode *vm)
>  {
>  	struct omap_crtc *omap_crtc = omap_crtcs[channel];
> @@ -233,25 +238,25 @@ static void omap_crtc_dss_set_timings(enum omap_channel channel,
>  	omap_crtc->vm = *vm;
>  }
>  
> -static void omap_crtc_dss_set_lcd_config(enum omap_channel channel,
> +static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv,
> +		enum omap_channel channel,
>  		const struct dss_lcd_mgr_config *config)
>  {
>  	struct omap_crtc *omap_crtc = omap_crtcs[channel];
> -	struct omap_drm_private *priv = omap_crtc->base.dev->dev_private;
>  
>  	DBG("%s", omap_crtc->name);
>  	priv->dispc_ops->mgr_set_lcd_config(omap_crtc->channel, config);
>  }
>  
>  static int omap_crtc_dss_register_framedone(
> -		enum omap_channel channel,
> +		struct omap_drm_private *priv, enum omap_channel channel,
>  		void (*handler)(void *), void *data)
>  {
>  	return 0;
>  }
>  
>  static void omap_crtc_dss_unregister_framedone(
> -		enum omap_channel channel,
> +		struct omap_drm_private *priv, enum omap_channel channel,
>  		void (*handler)(void *), void *data)
>  {
>  }
> @@ -669,11 +674,11 @@ static const char *channel_names[] = {
>  	[OMAP_DSS_CHANNEL_LCD3] = "lcd3",
>  };
>  
> -void omap_crtc_pre_init(void)
> +void omap_crtc_pre_init(struct omap_drm_private *priv)
>  {
>  	memset(omap_crtcs, 0, sizeof(omap_crtcs));
>  
> -	dss_install_mgr_ops(&mgr_ops);
> +	dss_install_mgr_ops(&mgr_ops, priv);
>  }
>  
>  void omap_crtc_pre_uninit(void)
> diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.h b/drivers/gpu/drm/omapdrm/omap_crtc.h
> index 7f01e730a050..eaab2d7f0324 100644
> --- a/drivers/gpu/drm/omapdrm/omap_crtc.h
> +++ b/drivers/gpu/drm/omapdrm/omap_crtc.h
> @@ -32,7 +32,7 @@ struct videomode;
>  
>  struct videomode *omap_crtc_timings(struct drm_crtc *crtc);
>  enum omap_channel omap_crtc_channel(struct drm_crtc *crtc);
> -void omap_crtc_pre_init(void);
> +void omap_crtc_pre_init(struct omap_drm_private *priv);
>  void omap_crtc_pre_uninit(void);
>  struct drm_crtc *omap_crtc_init(struct drm_device *dev,
>  		struct drm_plane *plane, struct omap_dss_device *dssdev);
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index b571cc04e08d..39e78f765f7e 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -521,7 +521,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev)
>  
>  	priv->dev = dev;
>  
> -	omap_crtc_pre_init();
> +	omap_crtc_pre_init(priv);
>  
>  	ret = omap_connect_dssdevs();
>  	if (ret)
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 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

  reply	other threads:[~2018-02-13 20:58 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-13 12:00 [PATCH v2 00/30] omapdrm: Allocate objects dynamically Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 01/30] drm: omapdrm: Split init and cleanup from probe and remove functions Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 02/30] drm: omapdrm: dss: Expose DSS data in a dss_device structure Laurent Pinchart
2018-02-13 20:05   ` Sebastian Reichel
2018-02-13 12:00 ` [PATCH v2 03/30] drm: omapdrm: dss: Pass DSS private structure to runtime PM functions Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 04/30] drm: omapdrm: dss: Pass PLL pointer to dss_ctrl_pll_enable() Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 05/30] drm: omapdrm: dss: Pass DSS pointer to dss_sdi_*() functions Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 06/30] drm: omapdrm: dss: Pass DSS pointer to dss_ops operations Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 07/30] drm: omapdrm: dss: Pass DSS pointer to dss_get_*_clk_source() Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 08/30] drm: omapdrm: dss: Pass DSS pointer to dss clock functions Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 09/30] drm: omapdrm: dss: Pass DSS pointer to remaining dss functions Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 10/30] drm: omapdrm: dss: Allocate the DSS private data structure dynamically Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 11/30] drm: omapdrm: dss: Support passing private data to debugfs show handlers Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 12/30] drm: omapdrm: dss: Store the registered plls array in struct dss_device Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 13/30] drm: omapdrm: dss: Store the debugfs root directory " Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 14/30] drm: omapdrm: dss: Don't unnecessarily cast to dev to pdev and back Laurent Pinchart
2018-02-13 20:23   ` Sebastian Reichel
2018-02-13 12:00 ` [PATCH v2 15/30] drm: omapdrm: dsi: Pass the dsi_data pointer to internal functions Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 16/30] drm: omapdrm: dsi: Combine two commonly used inline functions Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 17/30] drm: omapdrm: dsi: Use dev pointer directly in dsi_bind() function Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 18/30] drm: omapdrm: dsi: Store the struct device pointer in struct dsi_data Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 19/30] drm: omapdrm: dsi: Don't pass channel to dispc init/uninit functions Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 20/30] drm: omapdrm: dss: Pass omap_dss_device pointer to dss_mgr_*() functions Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 21/30] drm: omapdrm: dss: Pass omap_drm_private pointer to dss_mgr_ops Laurent Pinchart
2018-02-13 20:58   ` Sebastian Reichel [this message]
2018-02-13 12:00 ` [PATCH v2 22/30] drm: omapdrm: dss: Store DSS device pointer in the omapdrm private data Laurent Pinchart
2018-02-13 21:25   ` Sebastian Reichel
2018-02-14  8:31   ` Tomi Valkeinen
2018-02-14 15:34     ` Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 23/30] drm: omapdrm: dss: Store dispc ops in dss_device structure Laurent Pinchart
2018-02-13 21:32   ` Sebastian Reichel
2018-02-13 12:00 ` [PATCH v2 24/30] drm: omapdrm: dispc: Pass DISPC pointer to dispc_ops operations Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 25/30] drm: omapdrm: dispc: Pass DISPC pointer to remaining dispc API functions Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 26/30] drm: omapdrm: dispc: Allocate the dispc private data structure dynamically Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 27/30] drm: omapdrm: hdmi4: Allocate the omap_hdmi " Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 28/30] drm: omapdrm: hdmi5: " Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 29/30] drm: omapdrm: sdi: Allocate the sdi private " Laurent Pinchart
2018-02-13 12:00 ` [PATCH v2 30/30] drm: omapdrm: venc: Allocate the venc " Laurent Pinchart
2018-02-14 13:24 ` [PATCH v2 00/30] omapdrm: Allocate objects dynamically Tomi Valkeinen
2018-02-14 15:39   ` Laurent Pinchart
2018-02-14 15:52     ` Tomi Valkeinen
2018-02-28  8:35 ` 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=20180213205801.bee6oomubn7bas7l@earth.universe \
    --to=sre@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.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.