Module Kms.Fb

A framebuffer manages the inputs to a Crtc.

module Plane : sig ... end
type id = [ `Fb ] Id.t
type t = {
  1. fb_id : id;
  2. width : int;
  3. height : int;
  4. pixel_format : Fourcc.t;
  5. modifier : Modifier.t option;
  6. interlaced : bool;
  7. planes : Buffer.id option Plane.t list;
}
val get : Device.t -> id -> t

If the client is DRM master or has CAP_SYS_ADMIN, Plane.t.handle fields will be filled with GEM buffer handles. Fresh new GEM handles are always returned, even if another GEM handle referring to the same memory object already exists on the DRM file description. The caller is responsible for removing the new handles, e.g. via close_plane_handles. The same new handle will be returned for multiple planes in case they use the same memory object.

Otherwise, all handles will be None.

To obtain DMA-BUF FDs for each plane without leaking GEM handles, user-space can export each handle via Dmabuf.of_handle, then immediately close each unique handle via close_plane_handles.

val id : t -> id
val add : ?interlaced:bool -> ?modifier:Modifier.t -> Device.t -> size:(int * int) -> pixel_format:Fourcc.t -> planes:Buffer.id Plane.t list -> id
val dirty : Device.t -> id -> Rect.t list -> unit

Flush out the damaged area supplied as a clip rectangle list.

Code that does frontbuffer rendering must call this to flush out the changes on manual-update display outputs, e.g. usb display-link, mipi manual update panels or edp panel self refresh modes.

val close_plane_handles : Device.t -> t -> unit

Close each unique GEM handle in t.planes.

val rm : Device.t -> id -> unit

This removes a framebuffer previously added via add.

Warning: removing a framebuffer currently in-use on an enabled plane will disable that plane. The CRTC the plane is linked to may also be disabled (depending on driver capabilities).

val close : Device.t -> id -> unit

Like rm, except it doesn't disable planes and CRTCs. As long as the framebuffer is used by a plane, it's kept alive. When the plane no longer uses the framebuffer (because the framebuffer is replaced with another one, or the plane is disabled), the framebuffer is cleaned up.

This is useful to implement flicker-free transitions between two processes.

Depending on the threat model, user-space may want to ensure that the framebuffer doesn’t expose any sensitive user information: closed framebuffers attached to a plane can be read back by the next DRM master.

val pp : t Fmt.t