All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mario Kleiner <mario.kleiner@tuebingen.mpg.de>
To: Rob Clark <rob.clark@linaro.org>
Cc: patches@linaro.org, daniel.vetter@ffwll.ch,
	dri-devel@lists.freedesktop.org,
	laurent.pinchart@ideasonboard.com, gregkh@linuxfoundation.org,
	Rob Clark <rob@ti.com>,
	bskeggs@redhat.com
Subject: Re: [PATCH 10/11] drm/omap: use drm_send_vblank_event() helper
Date: Wed, 10 Oct 2012 05:33:10 +0200	[thread overview]
Message-ID: <5074EC76.6010106@tuebingen.mpg.de> (raw)
In-Reply-To: <1349725849-22433-11-git-send-email-rob.clark@linaro.org>

On 08.10.12 21:50, Rob Clark wrote:
> From: Rob Clark <rob@ti.com>
>
> Signed-off-by: Rob Clark <rob@ti.com>
> ---
>   drivers/staging/omapdrm/omap_crtc.c |   31 ++++++-------------------------
>   1 file changed, 6 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/staging/omapdrm/omap_crtc.c b/drivers/staging/omapdrm/omap_crtc.c
> index 732f2ad..74e019a 100644
> --- a/drivers/staging/omapdrm/omap_crtc.c
> +++ b/drivers/staging/omapdrm/omap_crtc.c
> @@ -114,40 +114,21 @@ static void omap_crtc_load_lut(struct drm_crtc *crtc)
>
>   static void vblank_cb(void *arg)
>   {
> -	static uint32_t sequence = 0;
>   	struct drm_crtc *crtc = arg;
>   	struct drm_device *dev = crtc->dev;
>   	struct omap_crtc *omap_crtc = to_omap_crtc(crtc);
> -	struct drm_pending_vblank_event *event = omap_crtc->event;
>   	unsigned long flags;
> -	struct timeval now;
>
>   	WARN_ON(!event);
> +	spin_lock_irqsave(&dev->event_lock, flags);
> +
> +	/* wakeup userspace */
> +	if (omap_crtc->event)
> +		drm_send_vblank_event(dev, -1, omap_crtc->event);
>
>   	omap_crtc->event = NULL;
>
> -	/* wakeup userspace */
> -	if (event) {
> -		do_gettimeofday(&now);
> -
> -		spin_lock_irqsave(&dev->event_lock, flags);
> -		/* TODO: we can't yet use the vblank time accounting,
> -		 * because omapdss lower layer is the one that knows
> -		 * the irq # and registers the handler, which more or
> -		 * less defeats how drm_irq works.. for now just fake
> -		 * the sequence number and use gettimeofday..
> -		 *
> -		event->event.sequence = drm_vblank_count_and_time(
> -				dev, omap_crtc->id, &now);
> -		 */

I think this TOO comment should be retained as a reminder that there is 
work to do.

> -		event->event.sequence = sequence++;

This is problematic. You lose the pseudo vblank counter implemented 
here, which is a violation of the spec, and from my own experience it 
causes extra pain and the need for awful workarounds in userspace 
clients. Nouveau-kms has the same problem for no good reason.

But then, on second thought, the way it is implemented here in the 
original is even more wrong, returning zero might be better.

-mario


> -		event->event.tv_sec = now.tv_sec;
> -		event->event.tv_usec = now.tv_usec;
> -		list_add_tail(&event->base.link,
> -				&event->base.file_priv->event_list);
> -		wake_up_interruptible(&event->base.file_priv->event_wait);
> -		spin_unlock_irqrestore(&dev->event_lock, flags);
> -	}
> +	spin_unlock_irqrestore(&dev->event_lock, flags);
>   }
>
>   static void page_flip_cb(void *arg)
>

  reply	other threads:[~2012-10-10  3:33 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-08 19:50 [PATCH 00/11] page-flip cleanups and fixes Rob Clark
2012-10-08 19:50 ` [PATCH 01/11] drm: add drm_send_vblank_event() helper Rob Clark
2012-10-08 21:26   ` Marcin Slusarz
2012-10-11 14:19   ` Laurent Pinchart
2012-10-11 14:43     ` Rob Clark
2012-10-13  0:28     ` Mario Kleiner
2012-10-16 12:53       ` Laurent Pinchart
2012-10-08 19:50 ` [PATCH 02/11] drm/i915: use " Rob Clark
2012-10-09  8:02   ` Daniel Vetter
2012-11-21 16:48   ` Daniel Vetter
2012-10-08 19:50 ` [PATCH 03/11] drm/nouveau: " Rob Clark
2012-10-08 19:50 ` [PATCH 04/11] drm/radeon: " Rob Clark
2012-10-08 19:50 ` [PATCH 05/11] drm/exynos: " Rob Clark
2013-05-21 23:19   ` Dave Airlie
2013-05-22  2:28     ` Inki Dae
2013-05-22  4:04   ` [PATCH] " Inki Dae
2013-05-22  4:51     ` Joonyoung Shim
2013-05-22  6:56       ` Inki Dae
2013-05-22  6:59     ` [PATCH RESEND] " Inki Dae
2012-10-08 19:50 ` [PATCH 06/11] drm/exynos: page flip fixes Rob Clark
2013-05-21 23:17   ` Dave Airlie
2013-05-22  2:36     ` Inki Dae
2012-10-08 19:50 ` [PATCH 07/11] drm/shmob: use drm_send_vblank_event() helper Rob Clark
2012-10-08 19:50 ` [PATCH 08/11] drm/imx: " Rob Clark
2012-10-08 19:50 ` [PATCH 09/11] drm/imx: page flip fixes Rob Clark
2013-05-21 23:18   ` Dave Airlie
2012-10-08 19:50 ` [PATCH 10/11] drm/omap: use drm_send_vblank_event() helper Rob Clark
2012-10-10  3:33   ` Mario Kleiner [this message]
2012-10-10 11:03     ` Rob Clark
2012-10-12 23:38       ` Mario Kleiner
2012-10-08 19:50 ` [PATCH 11/11] drm/omap: page-flip fixes Rob Clark
2012-10-09  9:35   ` Imre Deak
2012-10-09  9:38     ` Imre Deak
2012-10-08 20:51 ` [PATCH 00/11] page-flip cleanups and fixes Alex Deucher
2012-10-08 22:10 ` Marcin Slusarz
2012-10-09  5:17 ` Inki Dae
2012-10-22 22:39 ` Greg KH
2012-10-22 22:51   ` Rob Clark

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=5074EC76.6010106@tuebingen.mpg.de \
    --to=mario.kleiner@tuebingen.mpg.de \
    --cc=bskeggs@redhat.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=patches@linaro.org \
    --cc=rob.clark@linaro.org \
    --cc=rob@ti.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.