dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
To: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm: Factor-out drm_emit_vblank_event code. (v2)
Date: Mon, 02 May 2011 09:55:28 +1000	[thread overview]
Message-ID: <1304294128.25088.7.camel@Ed> (raw)
In-Reply-To: <20110429155528.GA3022@joi.lan>


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

On Fri, 2011-04-29 at 17:55 +0200, Marcin Slusarz wrote:
> On Fri, Apr 29, 2011 at 01:57:10PM +1000, christopher.halse.rogers@canonical.com wrote:
> > From: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
> > 
> > v2: Also pull out the drm_vblank_put call.
> > Signed-off-by: Christopher James Halse Rogers <christopher.halse.rogers@canonical.com>
> > ---
> >  drivers/gpu/drm/drm_irq.c |   44 ++++++++++++++++++--------------------------
> >  1 files changed, 18 insertions(+), 26 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> > index 982ca8c..da56685 100644
> > --- a/drivers/gpu/drm/drm_irq.c
> > +++ b/drivers/gpu/drm/drm_irq.c
> > @@ -931,6 +931,20 @@ void drm_vblank_put(struct drm_device *dev, int crtc)
> >  }
> >  EXPORT_SYMBOL(drm_vblank_put);
> >  
> > +static void drm_emit_vblank_event (struct drm_device *dev,
> > +				   struct drm_pending_vblank_event *e,
> > +				   unsigned int seq, struct timeval *now)
> > +{
> > +	e->event.sequence = seq;
> > +	e->event.tv_sec = now->tv_sec;
> > +	e->event.tv_usec = now->tv_usec;
> > +	drm_vblank_put(dev, e->pipe);
> > +	list_move_tail(&e->base.link, &e->base.file_priv->event_list);
> > +	wake_up_interruptible(&e->base.file_priv->event_wait);
> > +	trace_drm_vblank_event_delivered(e->base.pid, e->pipe,
> > +					 e->event.sequence);
> > +}
> > +
> >  void drm_vblank_off(struct drm_device *dev, int crtc)
> >  {
> >  	struct drm_pending_vblank_event *e, *t;
> > @@ -951,14 +965,7 @@ void drm_vblank_off(struct drm_device *dev, int crtc)
> >  			  wanted %d, current %d\n",
> >  			  e->event.sequence, seq);
> >  
> > -		e->event.sequence = seq;
> > -		e->event.tv_sec = now.tv_sec;
> > -		e->event.tv_usec = now.tv_usec;
> > -		drm_vblank_put(dev, e->pipe);
> > -		list_move_tail(&e->base.link, &e->base.file_priv->event_list);
> > -		wake_up_interruptible(&e->base.file_priv->event_wait);
> > -		trace_drm_vblank_event_delivered(e->base.pid, e->pipe,
> > -						 e->event.sequence);
> > +		drm_emit_vblank_event(dev, e, seq, &now);
> >  	}
> >  
> >  	WARN_ON(atomic_read(&dev->vblank_refcount[crtc]) != 0);
> > @@ -1104,18 +1111,10 @@ static int drm_queue_vblank_event(struct drm_device *dev, int pipe,
> >  				      vblwait->request.sequence);
> >  
> >  	e->event.sequence = vblwait->request.sequence;
> > +	list_add_tail(&e->base.link, &dev->vblank_event_list);
> 
> Is &dev->vblank_event_list == &e->base.file_priv->event_list?
> If they are not equal this is changing the behavior...

This gets moved to e->base.file_priv->event_list in
drm_emit_vblank_event ().  So it's doing a bit of useless work setting a
couple of pointers, but this doesn't change the behaviour.

> 
> >  	if ((seq - vblwait->request.sequence) <= (1 << 23)) {
> > -		e->event.sequence = seq;
> > -		e->event.tv_sec = now.tv_sec;
> > -		e->event.tv_usec = now.tv_usec;
> > -		drm_vblank_put(dev, pipe);
> > -		list_add_tail(&e->base.link, &e->base.file_priv->event_list);
> > -		wake_up_interruptible(&e->base.file_priv->event_wait);
> > -		vblwait->reply.sequence = seq;
> 
> Is it OK to drop this substitution?

Ahem.  No, it's not.  That's an overzealous delete key going off.  Hm.
Either the clients I was testing don't care about the reply, or the
clients I was testing always set _DRM_BLANK_NEXTONMISS.  I think it's
the latter.

Updated patch coming.

> 
> > -		trace_drm_vblank_event_delivered(current->pid, pipe,
> > -						 vblwait->request.sequence);
> > +		drm_emit_vblank_event(dev, e, seq, &now);
> >  	} else {
> > -		list_add_tail(&e->base.link, &dev->vblank_event_list);
> >  		vblwait->reply.sequence = vblwait->request.sequence;
> >  	}
> >  
> > @@ -1249,14 +1248,7 @@ void drm_handle_vblank_events(struct drm_device *dev, int crtc)
> >  		DRM_DEBUG("vblank event on %d, current %d\n",
> >  			  e->event.sequence, seq);
> >  
> > -		e->event.sequence = seq;
> > -		e->event.tv_sec = now.tv_sec;
> > -		e->event.tv_usec = now.tv_usec;
> > -		drm_vblank_put(dev, e->pipe);
> > -		list_move_tail(&e->base.link, &e->base.file_priv->event_list);
> > -		wake_up_interruptible(&e->base.file_priv->event_wait);
> > -		trace_drm_vblank_event_delivered(e->base.pid, e->pipe,
> > -						 e->event.sequence);
> > +		drm_emit_vblank_event(dev, e, seq, &now);
> >  	}
> >  
> >  	spin_unlock_irqrestore(&dev->event_lock, flags);
> > -- 



[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 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

  reply	other threads:[~2011-05-01 23:55 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27  6:10 [PATCH 1/3] drm: Send pending vblank events before disabling vblank christopher.halse.rogers
2011-04-27  6:10 ` [PATCH 2/3] drm: Warn if vblank state has become inconsistent christopher.halse.rogers
2011-04-27  8:38   ` Michel Dänzer
2011-04-27  6:10 ` [PATCH 3/3] drm: Factor-out drm_emit_vblank_event code christopher.halse.rogers
2011-04-27  8:36   ` Michel Dänzer
2011-04-27  8:48     ` Christopher James Halse Rogers
2011-04-27  9:06       ` Michel Dänzer
2011-04-28 20:36   ` Jesse Barnes
2011-04-29  3:57     ` [PATCH] drm: Factor-out drm_emit_vblank_event code. (v2) christopher.halse.rogers
2011-04-29  6:43       ` Michel Dänzer
2011-04-29 15:55       ` Marcin Slusarz
2011-05-01 23:55         ` Christopher James Halse Rogers [this message]
2011-05-02  0:09         ` [PATCH] drm: Factor-out drm_emit_vblank_event code. (v3) christopher.halse.rogers
2011-04-27  8:32 ` [PATCH 1/3] drm: Send pending vblank events before disabling vblank Michel Dänzer
2011-04-27  8:58   ` Christopher James Halse Rogers
2011-04-27  9:08     ` Michel Dänzer
2011-04-27  9:17       ` Christopher James Halse Rogers
2011-04-28  8:09       ` Christopher James Halse Rogers
2011-04-28 20:46         ` Jesse Barnes
2011-04-28 20:53           ` Jesse Barnes
2011-04-28 20:42   ` Jesse Barnes
2011-04-28 20:34 ` Jesse Barnes

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=1304294128.25088.7.camel@Ed \
    --to=christopher.halse.rogers@canonical.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=marcin.slusarz@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox