On Monday, June 11, 2007 6:42:09 Keith Packard wrote: > On Mon, 2007-06-11 at 15:20 -0700, Jesse Barnes wrote: > > +static u32 last_vblank; /* protected by dev->vbl_lock */ > > uh. per crtc?
Oh, hm yeah. I guess it'll have to go in drm_device. > > + atomic_add(diff, &dev->vblank_count[crtc]); > > Ok, I think this is reasonable, although different from what I > suggested. This is just wraparound handling. > > + seq = atomic_read(&dev->vblank_count[crtc]); > > Isn't this way too early? Seems like you'd want to get a reasonably > up-to-date value here; should this be after drm_vblank_get? Oh you're right about that, otherwise we'll end up with lots of events in the past. > > > +u32 i915_get_vblank_counter(drm_device_t *dev, int crtc) > > +{ > > + drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; > > + return i915_vblank_counter(dev, crtc) + dev_priv->vblank_offset[crtc]; > > +} > > I thought you were doing the offset stuff in core? I thought about it, but if I did, it would require lots of DDX changes I think? Dave convinced me it should actually be a driver specific SETPARAM, so after posting this patch I converted to that interface. > > + > > +int i915_premodeset(DRM_IOCTL_ARGS) > > +{ > > + DRM_DEVICE; > > + drm_i915_private_t *dev_priv = dev->dev_private; > > + > > + int crtc = data; > > + > > + if (crtc > 1) { > > + DRM_ERROR("bad crtc\n"); > > + return -EINVAL; > > + } > > + > > + dev_priv->vblank_premodeset[crtc] = i915_vblank_counter(dev, crtc); > > + return 0; > > +} > > + > > +int i915_postmodeset(DRM_IOCTL_ARGS) > > +{ > > + DRM_DEVICE; > > + drm_i915_private_t *dev_priv = dev->dev_private; > > + u32 new; > > + int crtc = data; > > + > > + if (crtc > 1) { > > + DRM_ERROR("bad crtc\n"); > > + return -EINVAL; > > + } > > + > > + new = i915_vblank_counter(dev, crtc); > > + dev_priv->vblank_offset[crtc] = dev_priv->vblank_premodeset[crtc] - > > new; + return 0; > > +} > > Ah, ok, offsets in driver. Since most drivers don't do randr-1.2 yet, poking around in their modesetting code to make a generic DRM call seemed like overkill. I think a per-driver setparam will get away from this, though either way we'll be stuck with a dead interface once kernel modesetting is ready. Jesse ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ -- _______________________________________________ Dri-devel mailing list Dri-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dri-devel