All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Mario Kleiner <mario.kleiner.de@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/qxl: Use drm_vblank_count()
Date: Wed, 17 Dec 2014 11:37:22 +0200	[thread overview]
Message-ID: <20141217093722.GL10649@intel.com> (raw)
In-Reply-To: <5490F12F.30401@gmail.com>

On Wed, Dec 17, 2014 at 03:57:51AM +0100, Mario Kleiner wrote:
> On 12/15/2014 04:56 PM, Thierry Reding wrote:
> > From: Thierry Reding <treding@nvidia.com>
> >
> > The QXL driver duplicates part of the core's drm_vblank_count(), so it
> > might as well use the core's variant for the extra goodies.
> >
> > Signed-off-by: Thierry Reding <treding@nvidia.com>
> > ---
> >   drivers/gpu/drm/qxl/qxl_drv.c | 7 +------
> >   1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
> > index 1d9b80c91a15..497024461a3c 100644
> > --- a/drivers/gpu/drm/qxl/qxl_drv.c
> > +++ b/drivers/gpu/drm/qxl/qxl_drv.c
> > @@ -196,11 +196,6 @@ static int qxl_pm_restore(struct device *dev)
> >   	return qxl_drm_resume(drm_dev, false);
> >   }
> >   
> > -static u32 qxl_noop_get_vblank_counter(struct drm_device *dev, int crtc)
> > -{
> > -	return dev->vblank[crtc].count.counter;
> > -}
> > -
> >   static int qxl_noop_enable_vblank(struct drm_device *dev, int crtc)
> >   {
> >   	return 0;
> > @@ -231,7 +226,7 @@ static struct drm_driver qxl_driver = {
> >   			   DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
> >   	.load = qxl_driver_load,
> >   	.unload = qxl_driver_unload,
> > -	.get_vblank_counter = qxl_noop_get_vblank_counter,
> > +	.get_vblank_counter = drm_vblank_count,
> >   	.enable_vblank = qxl_noop_enable_vblank,
> >   	.disable_vblank = qxl_noop_disable_vblank,
> >   
> 
> Hi
> 
> That doesn't really help, although it doesn't hurt either. Just wanted 
> to point out that both the old and new method implement a no-op. The 
> get_vblank_counter() driver function is meant to implement a hardware 
> vblank counter query. It's only use case atm. is to reinitialize the 
> dev->vblank[crtc].count.counter counter returned by drm_vblank_count().
> 
> The most honest implementation if there isn't any way to get a hw vblank 
> count would be to just "return 0;" - Same net effect, but at least a 
> marker in the code that there is future work to do.

Yeah 'return 0' is what we do in i915 when there's no hw counter. I did
consider changing it to drm_vblank_count() since that seems to be the
current fad. I was hoping it might allow removing some code from
drm_irq.c, but after some more thought that might not be the case.
I'll probably need to take another look at it.

> 
> I think a better solution would be if we wouldn't require 
> .get_vblank_counter to be non-NULL, don't fake implement it in 
> kms-drivers which can't do it, and make the drm core deal with lack of 
> hw counter queries, e.g., by not disabling vblank irqs.

That seems a bit drastic. The current delayed disable
seems quite reasonable to me. The count will remain accurate as long
as the vblank irq is enabled, and if you wait for so long that the
irq gets disabled, well, I don't think a very precise answer was
needed anyway.

I was hunting some bugs in the vblank code recently, and while doing
that I thought that I might change the code to use the timestamp
difference between disable->enable to calculate an approximate number
of vblanks lost and bump the counter appropriately. Didn't try it
yet though, but seems like a reasonable idea when there's no hw
counter. Though some care will be needed when dealing with
drm_vblank_off/on.

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2014-12-17  9:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-15 15:56 [PATCH] drm/qxl: Use drm_vblank_count() Thierry Reding
2014-12-17  2:57 ` Mario Kleiner
2014-12-17  9:37   ` Ville Syrjälä [this message]
2014-12-17 18:46     ` Mario Kleiner

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=20141217093722.GL10649@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=mario.kleiner.de@gmail.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.