Re: [PATCH 3/3] drm: Add CRTC_GET_SEQUENCE and CRTC_QUEUE_SEQUENCE ioctls [v3]

From: Michel DÃnzer
Date: Wed Oct 11 2017 - 05:26:46 EST


On 11/10/17 02:45 AM, Keith Packard wrote:
> These provide crtc-id based functions instead of pipe-number, while
> also offering higher resolution time (ns) and wider frame count (64)
> as required by the Vulkan API.
>
> v2:
>
> * Check for DRIVER_MODESET in new crtc-based vblank ioctls
>
> Failing to check this will oops the driver.
>
> * Ensure vblank interupt is running in crtc_get_sequence ioctl
>
> The sequence and timing values are not correct while the
> interrupt is off, so make sure it's running before asking for
> them.
>
> * Short-circuit get_sequence if the counter is enabled and accurate
>
> Steal the idea from the code in wait_vblank to avoid the
> expense of drm_vblank_get/put
>
> * Return active state of crtc in crtc_get_sequence ioctl
>
> Might be useful for applications that aren't in charge of
> modesetting?
>
> * Use drm_crtc_vblank_get/put in new crtc-based vblank sequence ioctls
>
> Daniel Vetter prefers these over the old drm_vblank_put/get
> APIs.
>
> * Return s64 ns instead of u64 in new sequence event
>
> Suggested-by: Daniel Vetter <daniel@xxxxxxxx>
> Suggested-by: Ville SyrjÃlà <ville.syrjala@xxxxxxxxxxxxxxx>
>
> v3:
>
> * Removed FIRST_PIXEL_OUT_FLAG
> * Document that the timestamp in the query and event are
> that of the first pixel leaving the display engine for
> the display (using the same wording as the Vulkan spec).
>
> Suggested-by: Michel DÃnzer <michel@xxxxxxxxxxx>
> Acked-by: Dave Airlie <airlied@xxxxxxxxxx>
>
> Signed-off-by: Keith Packard <keithp@xxxxxxxxxx>

Just a nitpick:

> +/* Queue event to be delivered at specified sequence. Time stamp marks
> + * when the first pixel of the refresh cycle left the display engine
> + * for the display
> + */

[...]

> @@ -903,6 +929,16 @@ struct drm_event_vblank {
> __u32 crtc_id; /* 0 on older kernels that do not support this */
> };
>
> +/* Event delivered at sequence. Time stamp marks when the first pixel
> + * of the refresh cycle left the display engine for the display
> + */

Might be better to use "leaves" instead of "left", since the event is
usually delivered and processed before the first pixel leaves the
display engine.


--
Earthling Michel DÃnzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer