All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Keith Packard <keithp@keithp.com>
Cc: Daniel Vetter <daniel@ffwll.ch>,
	linux-kernel@vger.kernel.org, Dave Airlie <airlied@redhat.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/3] drm: Widen vblank count to 64 bits. Change vblank time precision to ns
Date: Fri, 7 Jul 2017 14:16:40 +0200	[thread overview]
Message-ID: <20170707121640.4oedsdmpwhi4neyj@phenom.ffwll.local> (raw)
In-Reply-To: <86tw2pd314.fsf@keithp.com>

On Thu, Jul 06, 2017 at 07:59:51AM -0700, Keith Packard wrote:
> Daniel Vetter <daniel@ffwll.ch> writes:
> 
> > Extending the reported/sw vblank counter to u64 makes sense imo, but do we
> > have to extend the driver interfaces too? If there's no 64 bit hw vblank
> > currently I think I'd be good to postpone that part, simply because I'm
> > too lazy to audit all the drivers for correctly setting max_vblank_count
> > after your change :-)
> 
> As I said, it's easy enough to do that; I figured I'd do the obvious
> part and let you decide if you wanted that or not. We could also
> set max_vblank_count to 0xffffffff if it wasn't set by the driver,
> and/or add a WARN_ON_ONCE if it wasn't set. Given that it takes over two
> years to wrap this counter at 60Hz, we're never likely to hit a bug in
> testing.
> 
> Let me know what you think; I'm not invested in any particular solution
> at this point.

Setting a default would be what I suggested if it's possible. But for hw
without a vblank counter (gen2, and apparently every armsoc display ip
under the sun, dunno why), we need to set it to 0, while vblanks are
otherwise fully supported. Given that vblank counters aren't a thing
everywhere, and that it takes them forever to wrap, I don't think hw will
ever gain 64bit vblank counters.

I'd drop that part (but keep 64 everywhere else ofc).

> > Other thought on this, since you bother to change all the types: Afaik
> > both timespec and timeval suffer from the 32bit issues.
> 
> I'm not sure what 32bit issues you're concerned about here? We don't
> compare these values, just report them up to user space.

Year 2038 32bit wrap-around bug. Yes I believe/fear drm will still be
around then :-)

> > If we bother with changing everything I think it'd be neat to switch
> > all internal interfaces over to ktime, and only convert to the
> > userspace types once when we generate the event. I think that's how
> > cool hackers are supposed to do it, but not fully sure.
> 
> Yeah, I can definitely get behind that plan. A simple 64-bit value
> instead of a struct with two semi-related values which are hard to do
> arithmetic on.

So Arnd said on irc yesterday that one downside of ktime is that you get
to do a 64bit division when talking to old userspace interfaces that still
use the second/nanoseconds split. For super high-perf stuff where you need
to support old userspace interfaces there's a ktime_get_ts64 to optimize
that a bit. Given that we report vblank events on the order of 60fps to
userspace I think we can ignore that. 

Arnd also promised to update Documentation/ioctl/botching-up-ioctls.txt.

Anyway, ktime internally, converting to timeval/spec (old events) or s64 ns (new
events) sounds like the the approach to pick here.

> > Otherwise looks all good, but haven't yet carefully hunted for fumbles in
> > review before the above is clear.
> 
> Thanks. I'll switch over to ktime and wait to hear what your thoughts
> are on the vblank count interface changes.

Thanks, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

WARNING: multiple messages have this Message-ID (diff)
From: Daniel Vetter <daniel@ffwll.ch>
To: Keith Packard <keithp@keithp.com>
Cc: Dave Airlie <airlied@redhat.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] drm: Widen vblank count to 64 bits. Change vblank time precision to ns
Date: Fri, 7 Jul 2017 14:16:40 +0200	[thread overview]
Message-ID: <20170707121640.4oedsdmpwhi4neyj@phenom.ffwll.local> (raw)
In-Reply-To: <86tw2pd314.fsf@keithp.com>

On Thu, Jul 06, 2017 at 07:59:51AM -0700, Keith Packard wrote:
> Daniel Vetter <daniel@ffwll.ch> writes:
> 
> > Extending the reported/sw vblank counter to u64 makes sense imo, but do we
> > have to extend the driver interfaces too? If there's no 64 bit hw vblank
> > currently I think I'd be good to postpone that part, simply because I'm
> > too lazy to audit all the drivers for correctly setting max_vblank_count
> > after your change :-)
> 
> As I said, it's easy enough to do that; I figured I'd do the obvious
> part and let you decide if you wanted that or not. We could also
> set max_vblank_count to 0xffffffff if it wasn't set by the driver,
> and/or add a WARN_ON_ONCE if it wasn't set. Given that it takes over two
> years to wrap this counter at 60Hz, we're never likely to hit a bug in
> testing.
> 
> Let me know what you think; I'm not invested in any particular solution
> at this point.

Setting a default would be what I suggested if it's possible. But for hw
without a vblank counter (gen2, and apparently every armsoc display ip
under the sun, dunno why), we need to set it to 0, while vblanks are
otherwise fully supported. Given that vblank counters aren't a thing
everywhere, and that it takes them forever to wrap, I don't think hw will
ever gain 64bit vblank counters.

I'd drop that part (but keep 64 everywhere else ofc).

> > Other thought on this, since you bother to change all the types: Afaik
> > both timespec and timeval suffer from the 32bit issues.
> 
> I'm not sure what 32bit issues you're concerned about here? We don't
> compare these values, just report them up to user space.

Year 2038 32bit wrap-around bug. Yes I believe/fear drm will still be
around then :-)

> > If we bother with changing everything I think it'd be neat to switch
> > all internal interfaces over to ktime, and only convert to the
> > userspace types once when we generate the event. I think that's how
> > cool hackers are supposed to do it, but not fully sure.
> 
> Yeah, I can definitely get behind that plan. A simple 64-bit value
> instead of a struct with two semi-related values which are hard to do
> arithmetic on.

So Arnd said on irc yesterday that one downside of ktime is that you get
to do a 64bit division when talking to old userspace interfaces that still
use the second/nanoseconds split. For super high-perf stuff where you need
to support old userspace interfaces there's a ktime_get_ts64 to optimize
that a bit. Given that we report vblank events on the order of 60fps to
userspace I think we can ignore that. 

Arnd also promised to update Documentation/ioctl/botching-up-ioctls.txt.

Anyway, ktime internally, converting to timeval/spec (old events) or s64 ns (new
events) sounds like the the approach to pick here.

> > Otherwise looks all good, but haven't yet carefully hunted for fumbles in
> > review before the above is clear.
> 
> Thanks. I'll switch over to ktime and wait to hear what your thoughts
> are on the vblank count interface changes.

Thanks, Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2017-07-07 12:16 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-05 22:10 [PATCH 0/3] drm: Add CRTC-id based ioctls for vblank query/event Keith Packard
2017-07-05 22:10 ` Keith Packard
2017-07-05 22:10 ` [PATCH 1/3] drm: Widen vblank count to 64 bits. Change vblank time precision to ns Keith Packard
2017-07-05 22:10   ` Keith Packard
2017-07-06  7:19   ` Daniel Vetter
2017-07-06  7:19     ` Daniel Vetter
2017-07-06 14:59     ` Keith Packard
2017-07-06 14:59       ` Keith Packard
2017-07-07 12:16       ` Daniel Vetter [this message]
2017-07-07 12:16         ` Daniel Vetter
2017-07-25 20:54         ` Keith Packard
2017-07-25 20:54           ` Keith Packard
2017-07-06  7:45   ` Michel Dänzer
2017-07-06  7:45     ` Michel Dänzer
2017-07-06  8:05     ` Michel Dänzer
2017-07-06  8:05       ` Michel Dänzer
2017-07-06 15:11       ` Keith Packard
2017-07-06 15:04     ` Keith Packard
2017-07-06 15:04       ` Keith Packard
2017-07-07  1:34       ` Michel Dänzer
2017-07-07  1:34         ` Michel Dänzer
2017-07-07  2:05         ` Michel Dänzer
2017-07-07  2:05           ` Michel Dänzer
2017-07-05 22:10 ` [PATCH 2/3] drm: Reorganize drm_pending_event to support future event types Keith Packard
2017-07-05 22:10   ` Keith Packard
2017-07-06  7:30   ` Daniel Vetter
2017-07-06 15:36     ` Keith Packard
2017-07-06 15:36       ` Keith Packard
2017-07-07 12:05       ` Daniel Vetter
2017-07-07 12:05         ` Daniel Vetter
2017-07-05 22:10 ` [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls Keith Packard
2017-07-05 22:10   ` Keith Packard
2017-07-06  7:53   ` Daniel Vetter
2017-07-06 10:16     ` Ville Syrjälä
2017-07-06 10:16       ` Ville Syrjälä
2017-07-06 11:04       ` Daniel Vetter
2017-07-06 14:08         ` Ville Syrjälä
2017-07-06 16:28           ` Keith Packard
2017-07-06 16:28             ` Keith Packard
2017-07-06 17:59             ` Ville Syrjälä
2017-07-06 17:59               ` Ville Syrjälä
2017-07-06 18:22               ` Keith Packard
2017-07-06 18:22                 ` Keith Packard
2017-07-06 18:59                 ` Ville Syrjälä
2017-07-06 18:59                   ` Ville Syrjälä
2017-07-06 19:46                   ` Keith Packard
2017-07-06 19:46                     ` Keith Packard
2017-07-06 16:27     ` Keith Packard
2017-07-06 16:27       ` Keith Packard
2017-07-06 21:49       ` Daniel Vetter
2017-07-06 21:49         ` Daniel Vetter
2017-08-01  5:03 ` [PATCH 0/3] drm: Add CRTC-id based ioctls for vblank query/event Keith Packard
2017-08-01  5:03   ` Keith Packard
2017-08-01  5:03   ` [PATCH 1/3] drm: Widen vblank UAPI to 64 bits. Change vblank time to ktime_t [v2] Keith Packard
2017-08-01  5:03     ` Keith Packard
2017-08-02  8:53     ` Daniel Vetter
2017-08-02  8:53       ` Daniel Vetter
2017-08-02  9:41       ` Michel Dänzer
2017-08-02  9:41         ` Michel Dänzer
2017-08-06 17:35       ` Keith Packard
2017-08-06 17:35         ` Keith Packard
2017-08-01  5:03   ` [PATCH 2/3] drm: Reorganize drm_pending_event to support future event types [v2] Keith Packard
2017-08-02  9:05     ` Daniel Vetter
2017-08-01  5:03   ` [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v2] Keith Packard
2017-08-01  5:03     ` Keith Packard
2017-08-02  9:25     ` Daniel Vetter
2017-08-02  9:25       ` Daniel Vetter
2017-08-06  3:32       ` Keith Packard
2017-08-06  3:32         ` Keith Packard
2017-08-07  3:02         ` Michel Dänzer
2017-08-07  3:02           ` Michel Dänzer
2017-08-07  8:34         ` Daniel Vetter
2017-08-07  8:34           ` Daniel Vetter
2017-10-09 17:18           ` Keith Packard
2017-10-09 17:18             ` Keith Packard
2017-10-10  8:55             ` Daniel Vetter
2017-10-10  8:55               ` Daniel Vetter
2017-08-02  9:45     ` Michel Dänzer
2017-08-06  3:42       ` Keith Packard
2017-08-06  3:42         ` Keith Packard
2017-08-07  3:03         ` Michel Dänzer
2017-08-07  3:03           ` Michel Dänzer

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=20170707121640.4oedsdmpwhi4neyj@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=keithp@keithp.com \
    --cc=linux-kernel@vger.kernel.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.