All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Daniel Vetter <daniel@ffwll.ch>,
	Mark Yao <mark.yao@rock-chips.com>,
	heiko@sntech.de, David Airlie <airlied@gmail.com>,
	Rob Clark <robdclark@gmail.com>, Rob Herring <robh+dt@kernel.org>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Grant Likely <grant.likely@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	John Stultz <john.stultz@linaro.org>,
	Rom Lemarchand <romlem@google.com>,
	devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-api@vger.kernel.org, linux-rockchip@lists.infradead.org,
	dianders@chromium.org, marcheu@chromium.org, dbehr@chromium.org,
	olof@lixom.net, djkurtz@chromium.org, cf@rock-chips.com,
	xxm@rock-chips.com, huangtao@rock-chips.com,
	kever.yang@rock-chips.com, yxj@rock-chips.com, xw@rock-chips.com
Subject: Re: [PATCH v12 1/3] drm: rockchip: Add basic drm driver
Date: Tue, 18 Nov 2014 15:24:47 +0100	[thread overview]
Message-ID: <20141118142447.GC25711@phenom.ffwll.local> (raw)
In-Reply-To: <20141118142130.6c12ab50@bbrezillon>

On Tue, Nov 18, 2014 at 02:21:30PM +0100, Boris Brezillon wrote:
> Hi Daniel,
> 
> On Tue, 18 Nov 2014 09:32:34 +0100
> Daniel Vetter <daniel@ffwll.ch> wrote:
> 
> > On Tue, Nov 18, 2014 at 04:00:29PM +0800, Mark Yao wrote:
> > > From: Mark yao <mark.yao@rock-chips.com>
> > > 
> > > This patch adds the basic structure of a DRM Driver for Rockchip Socs.
> > > 
> > > Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
> > > Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
> > > Acked-by: Daniel Vetter <daniel@ffwll.ch>
> > > Reviewed-by: Rob Clark <robdclark@gmail.com>
> > > ---
> > > Changes in v2:
> > > - use the component framework to defer main drm driver probe
> > >   until all VOP devices have been probed.
> > > - use dma-mapping API with ARM_DMA_USE_IOMMU, create dma mapping by
> > >   master device and each vop device can shared the drm dma mapping.
> > > - use drm_crtc_init_with_planes and drm_universal_plane_init.
> > > - remove unnecessary middle layers.
> > > - add cursor set, move funcs to rockchip drm crtc.
> > > - use vop reset at first init
> > > - reference framebuffer when used and unreference when swap out vop
> > > 
> > > Changes in v3:
> > > - change "crtc->fb" to "crtc->primary-fb"
> > > Adviced by Daniel Vetter
> > > - init cursor plane with universal api, remove unnecessary cursor set,move 
> > > 
> > > Changes in v4:
> > > Adviced by David Herrmann
> > > - remove drm_platform_*() usage, use register drm device directly.
> > 
> > Minor fixup for that part below.
> > 
> > [snip]
> > 
> > > +static int rockchip_drm_bind(struct device *dev)
> > > +{
> > > +	struct drm_device *drm;
> > > +	int ret;
> > > +
> > > +	drm = drm_dev_alloc(&rockchip_drm_driver, dev);
> > > +	if (!drm)
> > > +		return -ENOMEM;
> > > +
> > > +	ret = drm_dev_set_unique(drm, "%s", dev_name(dev));
> > > +	if (ret)
> > > +		goto err_free;
> > 
> > Please call rockchip_drm_load here directly and don't put it as the ->load
> > function into the driver vtable. The point of the alloc/register split is
> > that the driver can be completely set up _before_ we register anything.
> > But for backwards compat and historical reasons ->load is called somewhere
> > in the middle (so that you could access the minor nodes if needed, since
> > some drivers do that).
> 
> I tried to do the same in the atmel-hlcdc DRM driver, but I need the
> primary drm_minor to register the connectors (see this kernel
> backtrace [1]), which means I either initialize the connector in the
> wrong place (currently part of the drm load process), or I just can't
> call atmel_hlcdc_dc_load before registering the drm device...

Hm right, wonder who that works with rockchip tbh.

We did split up the drm_connector setup into _init and register, so if you
want to do this then you need to move the call to drm_connector_register
below the call to drm_dev_register.

We should probably have a drm_connectors_register_all helper which does
this for all connectors on the connector list. And also grabs the
appropriate lock.

I guess it's somewhat obvious that no one yet actually tried this ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Daniel Vetter <daniel@ffwll.ch>,
	Mark Yao <mark.yao@rock-chips.com>,
	heiko@sntech.de, David Airlie <airlied@gmail.com>,
	Rob Clark <robdclark@gmail.com>, Rob Herring <robh+dt@kernel.org>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Randy Dunlap <rdunlap@infradead.org>,
	Grant Likely <grant.likely@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	John Stultz <john.stultz@linaro.org>,
	Rom Lemarchand <romlem@google.com>,
	devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-api@vger.kernel.org, linux-rockchip@lists.infradead.org,
	dianders@chromium.org, marcheu@chromium.org, dbehr@chromium.org,
	olof@lixom.net, djkurtz@chromium.org, cf@rock-chips.com,
	xxm@rock-chips.com, huangtao@rock-c
Subject: Re: [PATCH v12 1/3] drm: rockchip: Add basic drm driver
Date: Tue, 18 Nov 2014 15:24:47 +0100	[thread overview]
Message-ID: <20141118142447.GC25711@phenom.ffwll.local> (raw)
In-Reply-To: <20141118142130.6c12ab50@bbrezillon>

On Tue, Nov 18, 2014 at 02:21:30PM +0100, Boris Brezillon wrote:
> Hi Daniel,
> 
> On Tue, 18 Nov 2014 09:32:34 +0100
> Daniel Vetter <daniel@ffwll.ch> wrote:
> 
> > On Tue, Nov 18, 2014 at 04:00:29PM +0800, Mark Yao wrote:
> > > From: Mark yao <mark.yao@rock-chips.com>
> > > 
> > > This patch adds the basic structure of a DRM Driver for Rockchip Socs.
> > > 
> > > Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
> > > Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
> > > Acked-by: Daniel Vetter <daniel@ffwll.ch>
> > > Reviewed-by: Rob Clark <robdclark@gmail.com>
> > > ---
> > > Changes in v2:
> > > - use the component framework to defer main drm driver probe
> > >   until all VOP devices have been probed.
> > > - use dma-mapping API with ARM_DMA_USE_IOMMU, create dma mapping by
> > >   master device and each vop device can shared the drm dma mapping.
> > > - use drm_crtc_init_with_planes and drm_universal_plane_init.
> > > - remove unnecessary middle layers.
> > > - add cursor set, move funcs to rockchip drm crtc.
> > > - use vop reset at first init
> > > - reference framebuffer when used and unreference when swap out vop
> > > 
> > > Changes in v3:
> > > - change "crtc->fb" to "crtc->primary-fb"
> > > Adviced by Daniel Vetter
> > > - init cursor plane with universal api, remove unnecessary cursor set,move 
> > > 
> > > Changes in v4:
> > > Adviced by David Herrmann
> > > - remove drm_platform_*() usage, use register drm device directly.
> > 
> > Minor fixup for that part below.
> > 
> > [snip]
> > 
> > > +static int rockchip_drm_bind(struct device *dev)
> > > +{
> > > +	struct drm_device *drm;
> > > +	int ret;
> > > +
> > > +	drm = drm_dev_alloc(&rockchip_drm_driver, dev);
> > > +	if (!drm)
> > > +		return -ENOMEM;
> > > +
> > > +	ret = drm_dev_set_unique(drm, "%s", dev_name(dev));
> > > +	if (ret)
> > > +		goto err_free;
> > 
> > Please call rockchip_drm_load here directly and don't put it as the ->load
> > function into the driver vtable. The point of the alloc/register split is
> > that the driver can be completely set up _before_ we register anything.
> > But for backwards compat and historical reasons ->load is called somewhere
> > in the middle (so that you could access the minor nodes if needed, since
> > some drivers do that).
> 
> I tried to do the same in the atmel-hlcdc DRM driver, but I need the
> primary drm_minor to register the connectors (see this kernel
> backtrace [1]), which means I either initialize the connector in the
> wrong place (currently part of the drm load process), or I just can't
> call atmel_hlcdc_dc_load before registering the drm device...

Hm right, wonder who that works with rockchip tbh.

We did split up the drm_connector setup into _init and register, so if you
want to do this then you need to move the call to drm_connector_register
below the call to drm_dev_register.

We should probably have a drm_connectors_register_all helper which does
this for all connectors on the connector list. And also grabs the
appropriate lock.

I guess it's somewhat obvious that no one yet actually tried this ;-)
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-11-18 14:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18  7:59 [PATCH v12 0/3] Add drm driver for Rockchip Socs Mark Yao
2014-11-18  7:59 ` Mark Yao
2014-11-18  8:00 ` [PATCH v12 1/3] drm: rockchip: Add basic drm driver Mark Yao
2014-11-18  8:32   ` Daniel Vetter
2014-11-18  8:32     ` Daniel Vetter
2014-11-18  9:57     ` Mark yao
2014-11-18  9:57       ` Mark yao
2014-11-18 13:21     ` Boris Brezillon
2014-11-18 13:21       ` Boris Brezillon
2014-11-18 14:24       ` Daniel Vetter [this message]
2014-11-18 14:24         ` Daniel Vetter
2014-11-19  1:09         ` Mark yao
2014-11-19  1:09           ` Mark yao
2014-11-19  2:02           ` Mark yao
2014-11-19  9:04             ` Boris Brezillon
2014-11-19  9:04               ` Boris Brezillon
2014-11-19 13:17               ` Daniel Vetter
2014-11-19 13:17                 ` Daniel Vetter
2014-11-18  8:00 ` [PATCH v12 2/3] dt-bindings: video: Add for rockchip display subsytem Mark Yao
2014-11-18  8:01 ` [PATCH v12 3/3] dt-bindings: video: Add documentation for rockchip vop Mark Yao

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=20141118142447.GC25711@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@gmail.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=cf@rock-chips.com \
    --cc=dbehr@chromium.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=djkurtz@chromium.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=galak@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heiko@sntech.de \
    --cc=huangtao@rock-chips.com \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=john.stultz@linaro.org \
    --cc=kever.yang@rock-chips.com \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=marcheu@chromium.org \
    --cc=mark.rutland@arm.com \
    --cc=mark.yao@rock-chips.com \
    --cc=olof@lixom.net \
    --cc=pawel.moll@arm.com \
    --cc=rdunlap@infradead.org \
    --cc=robdclark@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=romlem@google.com \
    --cc=xw@rock-chips.com \
    --cc=xxm@rock-chips.com \
    --cc=yxj@rock-chips.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.