Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1642486

Re: [linux-sunxi] Re: [PATCH v7 05/13] drm/sun4i: abstract a engine type

From Maxime Ripard <maxime.ripard@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [linux-sunxi] Re: [PATCH v7 05/13] drm/sun4i: abstract a engine type
Date 2017-05-16 14:20 +0200
Message-ID <tHJCi-5vb-37@gated-at.bofh.it> (permalink)
References <tH4IN-3Wa-3@gated-at.bofh.it> <tH4IP-3Wa-39@gated-at.bofh.it> <tHkuf-6eH-41@gated-at.bofh.it> <tHkDT-6ia-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Mon, May 15, 2017 at 05:35:02PM +0800, Icenowy Zheng wrote:
> 
> 
> 于 2017年5月15日 GMT+08:00 下午5:20:01, Maxime Ripard <maxime.ripard@free-electrons.com> 写到:
> >On Mon, May 15, 2017 at 12:30:37AM +0800, Icenowy Zheng wrote:
> >> As we are going to add support for the Allwinner DE2 engine in
> >sun4i-drm
> >> driver, we will finally have two types of display engines -- the DE1
> >> backend and the DE2 mixer. They both do some display blending and
> >feed
> >> graphics data to TCON, and is part of the "Display Engine" called by
> >> Allwinner, so I choose to call them both "engine" here.
> >> 
> >> Abstract the engine type to a new struct with an ops struct, which
> >contains
> >> functions that should be called outside the engine-specified code (in
> >> TCON, CRTC or TV Encoder code).
> >> 
> >> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> >> Reviewed-by: Chen-Yu Tsai <wens@csie.org>
> >> ---
> >> Changes in v7:
> >> - Mention "Display Engine" for the name "engine".
> >> - Fixed some small issues found by Chen-Yu and added his ACK.
> >> Changes in v6:
> >> - Rebased on wens's multi-pipeline patchset.
> >> - Split out Makefile changes.
> >
> >You also added a get_id callback here...
> >
> >> +static const struct sunxi_engine_ops sun4i_backend_engine_ops = {
> >> +	.commit				= sun4i_backend_commit,
> >> +	.layers_init			= sun4i_layers_init,
> >> +	.apply_color_correction		= sun4i_backend_apply_color_correction,
> >> +	.disable_color_correction	= sun4i_backend_disable_color_correction,
> >> +};
> >> +
> >
> >... that you don't populate ...
> >
> >> @@ -477,7 +481,7 @@ static int sun4i_tcon_bind(struct device *dev,
> >struct device *master,
> >>  	dev_set_drvdata(dev, tcon);
> >>  	tcon->drm = drm;
> >>  	tcon->dev = dev;
> >> -	tcon->id = backend->id;
> >> +	tcon->id = sunxi_engine_get_id(engine);
> >
> >... that you call to fill the TCON ID ...
> >
> >> +/**
> >> + * sunxi_engine_get_id - Get the ID of the engine.
> >> + * @engine:	pointer to the engine
> >> + *
> >> + * If the ID is not necessary, just do not implement it in
> >sunxi_engine_ops,
> >> + * and a default -1 will be returned.
> >> + */
> >> +static inline int
> >> +sunxi_engine_get_id(struct sunxi_engine *engine)
> >> +{
> >> +	if (engine->ops && engine->ops->get_id)
> >> +		return engine->ops->get_id(engine);
> >> +
> >> +	return -1;
> >
> >... and will return -1 if not populated, which essentially means that
> >instead of having 0 or 1, we're now having -1 as our id.
> >
> >This is a regression, and I'm even wondering if we can't just store
> >the ID in the sunxi_engine structure. Is anything preventing us to do
> >that, instead of using a callback?
> 
> Some engines (de2 mixer) doesn't use the ID. But 0 is a valid ID here.

Surely it will at some point.

> If we just store it in sunxi_engine, it should be assigned -1 for de2 mixer.
> Is this applicable?
> 
> If it's okay I will do so.

Yes, it sounds reasonable.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v7 00/13] Initial Allwinner Display Engine 2.0 Support Icenowy Zheng <icenowy@aosc.io> - 2017-05-14 18:40 +0200
  [PATCH v7 04/13] drm/sun4i: return only planes for layers created Icenowy Zheng <icenowy@aosc.io> - 2017-05-14 18:40 +0200
    Re: [PATCH v7 04/13] drm/sun4i: return only planes for layers created Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-05-15 11:30 +0200
  [PATCH v7 10/13] drm/sun4i: tcon: add support for V3s TCON Icenowy Zheng <icenowy@aosc.io> - 2017-05-14 18:40 +0200
  [PATCH v7 12/13] ARM: sun8i: v3s: add pinmux for LCD pins of V3s SoC Icenowy Zheng <icenowy@aosc.io> - 2017-05-14 18:40 +0200
  [PATCH v7 05/13] drm/sun4i: abstract a engine type Icenowy Zheng <icenowy@aosc.io> - 2017-05-14 18:40 +0200
    Re: [PATCH v7 05/13] drm/sun4i: abstract a engine type Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-05-15 11:30 +0200
      Re: [linux-sunxi] Re: [PATCH v7 05/13] drm/sun4i: abstract a engine type Icenowy Zheng <icenowy@aosc.io> - 2017-05-15 11:40 +0200
        Re: [linux-sunxi] Re: [PATCH v7 05/13] drm/sun4i: abstract a engine  type Maxime Ripard <maxime.ripard@free-electrons.com> - 2017-05-16 14:20 +0200

csiph-web