Module Buffer.Dumb

A slow and inefficient buffer in host memory for testing, etc.

KMS dumb buffers provide a very primitive way to allocate a buffer object suitable for scanout and map it for software rendering. KMS dumb buffers are not suitable for hardware-accelerated rendering nor video decoding. KMS dumb buffers are not suitable to be displayed on any other device than the KMS device where they were allocated from.

type t = {
  1. bpp : int;
  2. width : int;
  3. height : int;
  4. handle : id;
  5. pitch : int;
  6. size : int64;
}
val create : Device.t -> bpp:int -> (int * int) -> t

create dev ~bpp (width, height) allocates memory for a width, height buffer with bpp bits per pixel.

Note that dumb buffers typically cannot be used as cursors (until we have "DRM_MODE_DUMB_CURSOR" support).

val map : Device.t -> t -> ('a, 'b) Stdlib.Bigarray.kind -> ('a, 'b, Stdlib.Bigarray.c_layout) Stdlib.Bigarray.Array2.t

map dev t kind makes t available as an OCaml Bigarray.

Note that the returned array may be wider than t.width, to match t.pitch.

  • raises Invalid_argument

    if kind is not compatible with t.bpp.

val destroy : Device.t -> id -> unit
val get_map_offset : Device.t -> id -> int64

Wraps the low-level "drmModeCreateDumbBuffer".

map will call this for you automatically.

val pp : t Fmt.t