Module Kms.Crtc

A CRT Controller.

Typically, one CRTC is used for each monitor, although it is possible to drive two identical monitors in mirror mode with only one.

type id = [ `Crtc ] Id.t
type t = {
  1. crtc_id : id;
  2. fb_id : Fb.id option;
  3. x : int;
    (*

    Position on the framebuffer

    *)
  4. y : int;
  5. width : int;
  6. height : int;
  7. mode : Mode_info.t option;
  8. gamma_size : int;
    (*

    Number of gamma stops

    *)
}
val get : Device.t -> id -> t
val id : t -> id
val set : Device.t -> id -> ?fb:Fb.id -> pos:(int * int) -> connectors:[ `Connector ] Id.t list -> Mode_info.t option -> unit

The old non-atomic API.

val page_flip : ?event:nativeint -> ?async:bool -> ?target:[ `None | `Absolute of Unsigned.UInt32.t | `Relative of int ] -> Device.t -> id -> Fb.id -> unit

page_flip dev id fb asks KMS to schedule a page flip for CRTC id.

Once any pending rendering targeting fb (as of ioctl time) has completed, the CRTC will be reprogrammed to display fb after the next vertical refresh. The call returns immediately, but subsequent rendering to the current fb will block in the execbuffer ioctl until the page flip happens. If a page flip is already pending as the ioctl is called, Unix.EBUSY will be raised.

  • parameter event

    Requests that drm sends back an event when the page flip is done. The event data will be returned as the user_data field in Event.Vblank.t.

  • parameter async

    Requests that the flip happen 'as soon as possible', meaning that it not delay waiting for vblank. This may cause tearing on the screen.

  • parameter target

    If `Absolute seq, seq denotes the absolute vblank sequence when the flip should take effect. If `Relative seq, seq denotes the relative (to the current one when the ioctl is called) vblank sequence when the flip should take effect (seq must be 0 or 1). `None is the same as `Relative 1, unless async is true, in which case it behaves as `Relative 0.

?target is merely to clarify the target for when code dealing with a page flip runs during a vertical blank period.

val queue_sequence : ?next_on_miss:bool -> user_data:nativeint -> Device.t -> id -> [ `Absolute of Unsigned.UInt64.t | `Relative of int ] -> Unsigned.UInt64.t

Queue an event to be delivered at the specified sequence. The timestamp marks when the first pixel of the refresh cycle leaves the display engine for the display.

  • parameter next_on_miss

    Use next sequence if we've missed.

val set_cursor : Device.t -> id -> ?hot:(int * int) -> size:(int * int) -> Buffer.id option -> unit
val move_cursor : Device.t -> id -> (int * int) -> unit
type gamma_lut = (int, Stdlib.Bigarray.int16_unsigned_elt, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array1.t
val get_gamma : Device.t -> t -> gamma_lut * gamma_lut * gamma_lut

Get the gamma table.

val set_gamma : Device.t -> t -> (gamma_lut * gamma_lut * gamma_lut) -> unit

Set the gamma table.

val pp : t Fmt.t

Properties

type 'a property = ([ `Crtc ], 'a) Property.t
val get_properties : Device.t -> id -> [ `Crtc ] Properties.Values.t
val active : bool property
val mode_id : Blob.id option property

Use Mode_info.get to load the blob data.

val vrr_enabled : bool property
val out_fence_ptr : Unix.file_descr option Ctypes.ptr option property

Hint: allocate a fence_ctype to hold the returned FD.

val fence_ctype : Unix.file_descr option Ctypes.typ