All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Xinliang Liu <xinliang.liu@linaro.org>,
	airlied@linux.ie, dri-devel@lists.freedesktop.org,
	liguozhu@hisilicon.com, linux-kernel@vger.kernel.org,
	benjamin.gaignard@linaro.org
Subject: Re: [PATCH] drm/crtc: Add a helper func to get a registered crtc from its index
Date: Wed, 26 Aug 2015 13:04:43 +0200	[thread overview]
Message-ID: <20150826110441.GA320@ulmo.nvidia.com> (raw)
In-Reply-To: <20150825093618.GA20434@phenom.ffwll.local>


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

On Tue, Aug 25, 2015 at 11:36:18AM +0200, Daniel Vetter wrote:
> On Tue, Aug 25, 2015 at 11:13:51AM +0800, Xinliang Liu wrote:
> > This patch add a helper func to get a registered crtc from its index.
> > In some case, where we know the crtc's index and we want to know the
> > crtc too.
> > 
> > For example, the enable_vblank func of struct drm_driver:
> > In the implementation of this func, we know the index of the crtc but
> > we want to know the crtc. This helper func can get the crtc easily.
> > A sample impelmentation of enable_vblank is as shown as bellow:
> > 
> > int hisi_drm_crtc_enable_vblank(struct drm_device *dev, int c)
> > {
> > 	struct drm_crtc *crtc = drm_get_crtc_from_index(dev, c);
> > 	struct hisi_crtc *hcrtc = to_hisi_crtc(crtc);
> > 	struct hisi_crtc_ops *ops = hcrtc->ops;
> > 	int ret = 0;
> > 
> > 	if (ops->enable_vblank)
> > 		ret = ops->enable_vblank(hcrtc);
> > 
> > 	return ret;
> > }
> > 
> > Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
> 
> Yeah unfortunately drm_irq.c is still stick in the old pre-KMS days. I
> think we should go a bit further here though to allow new drivers to be
> completely free of int pipe:

Of course you meant to say /unsigned/ int pipe =)

> - add a new array pointer dev->mode_conifg.crtc_arr, which is
>   (re-)allocated in drm_crtc_init_with_planes. Then a pipe->crtc lookup
>   will be just
> 
> 	crtc = dev->mode_config.crtc_arr[pipe];
> 
> - add new hooks for vblank handling int drm_crtc_helper_funcs for
>   enable_vblanke, disable_vblank, get_vblank_timestamp and get_scanoutpos.
>   Ofc also anotate the docs for the existing hooks and make it clear new
>   drivers should use the new ones. Ofc these new hooks should directly
>   take a struct drm_crtc * instead of inte pipe.

I have a couple patches to address this partially, which came about as a
result of the int crtc/crtc_id/pipe/whatever -> unsigned int pipe
conversion work that I've been doing.

> - change the code in drm_irq.c to wrap all callbacks and first check
>   whether the new ones are there and only if that's not the case call the
>   old ones.
> 
> With these changes drivers can be completely free of int pipe and use
> struct drm_crtc exclusivly I think, and the mess would be fully restricted
> to drm_irq.c.

I like the idea of moving the callbacks to drm_crtc_helper_funcs. That
allows us to introduce this step by step, without a flag date when every
driver needs to switch the drm_driver functions over.

Thierry

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

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

WARNING: multiple messages have this Message-ID (diff)
From: Thierry Reding <thierry.reding@gmail.com>
To: Xinliang Liu <xinliang.liu@linaro.org>,
	airlied@linux.ie, dri-devel@lists.freedesktop.org,
	liguozhu@hisilicon.com, linux-kernel@vger.kernel.org,
	benjamin.gaignard@linaro.org
Subject: Re: [PATCH] drm/crtc: Add a helper func to get a registered crtc from its index
Date: Wed, 26 Aug 2015 13:04:43 +0200	[thread overview]
Message-ID: <20150826110441.GA320@ulmo.nvidia.com> (raw)
In-Reply-To: <20150825093618.GA20434@phenom.ffwll.local>

[-- Attachment #1: Type: text/plain, Size: 2545 bytes --]

On Tue, Aug 25, 2015 at 11:36:18AM +0200, Daniel Vetter wrote:
> On Tue, Aug 25, 2015 at 11:13:51AM +0800, Xinliang Liu wrote:
> > This patch add a helper func to get a registered crtc from its index.
> > In some case, where we know the crtc's index and we want to know the
> > crtc too.
> > 
> > For example, the enable_vblank func of struct drm_driver:
> > In the implementation of this func, we know the index of the crtc but
> > we want to know the crtc. This helper func can get the crtc easily.
> > A sample impelmentation of enable_vblank is as shown as bellow:
> > 
> > int hisi_drm_crtc_enable_vblank(struct drm_device *dev, int c)
> > {
> > 	struct drm_crtc *crtc = drm_get_crtc_from_index(dev, c);
> > 	struct hisi_crtc *hcrtc = to_hisi_crtc(crtc);
> > 	struct hisi_crtc_ops *ops = hcrtc->ops;
> > 	int ret = 0;
> > 
> > 	if (ops->enable_vblank)
> > 		ret = ops->enable_vblank(hcrtc);
> > 
> > 	return ret;
> > }
> > 
> > Signed-off-by: Xinliang Liu <xinliang.liu@linaro.org>
> 
> Yeah unfortunately drm_irq.c is still stick in the old pre-KMS days. I
> think we should go a bit further here though to allow new drivers to be
> completely free of int pipe:

Of course you meant to say /unsigned/ int pipe =)

> - add a new array pointer dev->mode_conifg.crtc_arr, which is
>   (re-)allocated in drm_crtc_init_with_planes. Then a pipe->crtc lookup
>   will be just
> 
> 	crtc = dev->mode_config.crtc_arr[pipe];
> 
> - add new hooks for vblank handling int drm_crtc_helper_funcs for
>   enable_vblanke, disable_vblank, get_vblank_timestamp and get_scanoutpos.
>   Ofc also anotate the docs for the existing hooks and make it clear new
>   drivers should use the new ones. Ofc these new hooks should directly
>   take a struct drm_crtc * instead of inte pipe.

I have a couple patches to address this partially, which came about as a
result of the int crtc/crtc_id/pipe/whatever -> unsigned int pipe
conversion work that I've been doing.

> - change the code in drm_irq.c to wrap all callbacks and first check
>   whether the new ones are there and only if that's not the case call the
>   old ones.
> 
> With these changes drivers can be completely free of int pipe and use
> struct drm_crtc exclusivly I think, and the mess would be fully restricted
> to drm_irq.c.

I like the idea of moving the callbacks to drm_crtc_helper_funcs. That
allows us to introduce this step by step, without a flag date when every
driver needs to switch the drm_driver functions over.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2015-08-26 11:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25  3:13 [PATCH] drm/crtc: Add a helper func to get a registered crtc from its index Xinliang Liu
2015-08-25  3:13 ` Xinliang Liu
2015-08-25  9:36 ` Daniel Vetter
2015-08-25  9:36   ` Daniel Vetter
2015-08-26 11:04   ` Thierry Reding [this message]
2015-08-26 11:04     ` Thierry Reding
2015-09-11  2:36     ` Xinliang Liu
2015-09-10  8:07   ` Xinliang Liu
2015-09-10  9:46     ` Daniel Vetter
2015-09-10  9:46       ` Daniel Vetter
2015-09-11  2:42       ` Xinliang Liu

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=20150826110441.GA320@ulmo.nvidia.com \
    --to=thierry.reding@gmail.com \
    --cc=airlied@linux.ie \
    --cc=benjamin.gaignard@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=liguozhu@hisilicon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xinliang.liu@linaro.org \
    /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.