linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Stone <daniel@fooishbar.org>
To: Xinwei Kong <kong.kongxinwei@hisilicon.com>
Cc: David Airlie <airlied@linux.ie>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will.deacon@arm.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	haojian.zhuang@linaro.org, james.yanglong@hisilicon.com,
	yinshengbao@hisilicon.com, xuyiping@hisilicon.com,
	xuwei5@hisilicon.com, qijiwen@hisilicon.com,
	puck.chen@hisilicon.com, yanhaifeng@hisilicon.com,
	fangdechun@hisilicon.com, andy.green@linaro.org,
	gongyu@hisilicon.com,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	ml.yang@hisilicon.com, liguozhu@hisilicon.com
Subject: Re: [PATCH RFC 0/8] Add New DRM Driver for Hisilicon's Hi6220 SoC
Date: Wed, 16 Sep 2015 16:23:35 +0100	[thread overview]
Message-ID: <CAPj87rPT4+YC56vnwmthM1063Dtxg-8pabk0xGbc96n8K_t9Fw@mail.gmail.com> (raw)
In-Reply-To: <1442309834-21420-1-git-send-email-kong.kongxinwei@hisilicon.com>

Hi Xinwei,
Thanks for this contribution! We look forward to seeing support for
these devices.

This isn't an exhaustive review, but two very high-level comments
which should result in a lot of changes ...

On 15 September 2015 at 10:37, Xinwei Kong
<kong.kongxinwei@hisilicon.com> wrote:
> 1. Hardware Detail
>   The display subsystem of Hi6220 SoC is shown as bellow:
>  +-----+       +----------+     +-----+     +---------+
>  |     |       |          |     |     |     |         |
>  | FB  |------>|   ADE    |---->| DSI |---->| External|
>  |     |       |          |     |     |     |  HDMI   |
>  +-----+       +----------+     +-----+     +---------+
>
> - ADE(Advanced Display Engine) is the display controller. It contains 7
> channels or pipes, 3 overlay and a LDI.
>   - A channel/pipe looks like: DMA-->clip-->scale-->ctrans/csc.
>   - Overlay is response to compose planes which come from 7 channels and
>   pass composed image to LDI.

This terminology is backwards from what we usually use in DRM, where
an overlay is a special case of DRM planes, and pipes are DRM CRTCs.

>   - LDI is response to generate timings and RGB data stream.
> - DSI converts the RGB data stream from ADE to DSI packets.
> - External HDMI module is connected with DSI bus. Now Hikey use a ADI's
>   ADV7533 external HDMI chip.

So this is basically just an implementation detail of DSI?

> 2. Software Detail
>   About the software organization and implementation detail:
> We have a main drm platform driver (hisi_drm_drv.c), ade platform driver
> (hisi_ade.c) and a dsi platform driver (hisi_drm_dsi.c). Ade driver
> implements the plane and crtc driver interfaces and dsi implements the
> encoder and connector driver interfaces. We take advantage of component
> framework to initialize each driver.
>   In order to support multi coming Hisilicon's SoCs, we plan to separate
> common driver code and SoC specific implemented code as possiple as we can.
> We abstract an ops for each component(crtc, plane, encoder and connector)
> to reuse the common interface implementation logic (FIXME: Not sure if we
> can achieve this target and if it is good or not). Thus, we put these
> common driver code into hisi_drm_drv/crtc/plane/encoder/connector.c files.

Please do not do this; in general, the abstraction layers cause more
problems than they create. We have only just finished removing all the
abstraction layers from drivers/gpu/drm/exynos/, which started off
with exactly the same idea, but only created problems. The issue is
that every time the DRM core interface changes, you have to make the
exact same changes in your copies of the interface. In general, there
seems to be no benefit to having these here: you can just assign the
DRM functions directly according to generation. See current Exynos for
an example of this.

The biggest issue though, is that this driver should become an atomic
modesetting driver. Atomic modesetting, rather than sending small
individual commands (enable CRTC, change plane position, etc) is based
on validating and passing around complete sets of hardware state.
Daniel Vetter's blog has an article on how to convert your driver:
http://blog.ffwll.ch/2014/11/atomic-modeset-support-for-kms-drivers.html

In addition, there are some drivers converted already that you can
look at: tegra (very simple), exynos (reasonably simple), fsl-dcu
(moderate), msm (quite complex), i915 (incredibly complex), rcar-du
(???).

Once your driver is converted to atomic and the abstraction layers
removed, then it will be much easier to review the submission in
detail.

Thanks very much!

Cheers,
Daniel

  parent reply	other threads:[~2015-09-16 15:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15  9:37 [PATCH RFC 0/8] Add New DRM Driver for Hisilicon's Hi6220 SoC Xinwei Kong
2015-09-15  9:37 ` [PATCH RFC 1/8] dt-bindings: Document the hi6220 bindings for DRM driver Xinwei Kong
2015-09-15 18:11   ` Rob Herring
2015-09-16  8:34     ` Xinwei Kong
2015-09-16  9:10       ` Archit Taneja
2015-09-17 12:14         ` Xinwei Kong
2015-09-15  9:37 ` [PATCH RFC 2/8] drm: hisilicon: Add new DRM driver for hisilicon Soc Xinwei Kong
2015-09-17 11:13   ` Archit Taneja
2015-09-15  9:37 ` [PATCH RFC 3/8] drm: hisilicon: Add the link to DRM/KMS interface Xinwei Kong
2015-09-15  9:37 ` [PATCH RFC 4/8] drm: hisilicon: fill interface function of plane\crtc part Xinwei Kong
2015-09-15  9:37 ` [PATCH RFC 5/8] drm: hisilicon: fill interface function of encoder\connector part Xinwei Kong
2015-09-17 11:39   ` Archit Taneja
2015-09-15  9:37 ` [PATCH RFC 6/8] drm: hisilicon: Add support for fbdev Xinwei Kong
2015-09-15 18:25   ` Rob Herring
2015-09-16  3:32     ` Xinwei Kong
     [not found]     ` <CAGd==05f+XVg4ZSDihftjB2wcOGkAou=AxXYXB+1=ckM2J6EBQ@mail.gmail.com>
2015-09-17 11:52       ` Rob Clark
2015-09-15  9:37 ` [PATCH RFC 7/8] drm: hisilicon: Add support for vblank Xinwei Kong
2015-09-15  9:37 ` [PATCH RFC 8/8] dts: hisilicon: Add drm driver device dts config for HiKey board Xinwei Kong
2015-09-16 15:23 ` Daniel Stone [this message]
2015-09-16 20:16   ` [PATCH RFC 0/8] Add New DRM Driver for Hisilicon's Hi6220 SoC Daniel Vetter
     [not found]     ` <CAGd==05NKAjH=hD=bqKNh052ff=osJ4WxwOdDb3xoC1Mgy6Jdg@mail.gmail.com>
2015-09-22  8:49       ` Daniel Vetter
2015-09-18 10:32   ` Xinwei Kong

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=CAPj87rPT4+YC56vnwmthM1063Dtxg-8pabk0xGbc96n8K_t9Fw@mail.gmail.com \
    --to=daniel@fooishbar.org \
    --cc=airlied@linux.ie \
    --cc=andy.green@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fangdechun@hisilicon.com \
    --cc=gongyu@hisilicon.com \
    --cc=haojian.zhuang@linaro.org \
    --cc=james.yanglong@hisilicon.com \
    --cc=kong.kongxinwei@hisilicon.com \
    --cc=liguozhu@hisilicon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ml.yang@hisilicon.com \
    --cc=puck.chen@hisilicon.com \
    --cc=qijiwen@hisilicon.com \
    --cc=will.deacon@arm.com \
    --cc=xuwei5@hisilicon.com \
    --cc=xuyiping@hisilicon.com \
    --cc=yanhaifeng@hisilicon.com \
    --cc=yinshengbao@hisilicon.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).