Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.

Work in progress, nothing stable here.


This repository contains a work-in-progress framebuffer graphics library for MirageOS, written in the OCaml programming language.

The library exposes basic operations such as pixel blitting, and input / window resize events.

The codebase is still under development and the interfaces are very volatile and change often. Contributions in the form of code, comments, ideas, research, or bug reports are very welcome, but please give me a heads-up in the form of a Github issue if you plan to introduce large changesets that may conflict with my local branches.


Currently two backends are supported:

I also have plans to implement an RDP/VNC backend that would act as a server exposing your graphical interfaces over a network connection.

Another backend I would like to see would be one using BuckleScript or js_of_ocaml to draw on a HTML5 Canvas inside a web browser.

Helpers for integration with other libraries

Included in this repository are some optional packages that let you use existing OCaml libraries with mirage-framebuffer.

They define functors to be applied with a framebuffer module, for example imagelib can be instantited with the TSDL backend: Framebuffer_image.Make( Framebuffer.Make(Framebuffer_tsdl) ).

  • mirage-framebuffer-imagelib: Helper library defining Framebuffer_image for Rodolphe Lepigre's imagelib, a pure picture format parser.

  • mirage-framebuffer-notty: Helper library defining Framebuffer_notty for use with David Kaloper's notty, a declarative (text-based) terminal library.

I hope that there will one day be a helper library for Daniel Bünzli's vg library for declarative 2D graphics, but there is no active development on this not full support yet.

Using the library

While it is intended to be used from MirageOS unikernels, taking advantage of its parametric compilation tooling to automatically select a backend, the library may also be used directly from your regular OCaml programs.

The main module defines a functor, Framebuffer.Make, which is applied with your backend of choice.

An example is included in test_tsdl/

Installing dependencies

# The main Framebuffer library:
opam pin add -n mirage-framebuffer ''

# imagelib helper:
opam pin add -n mirage-framebuffer-imagelib ''
opam pin add -n imagelib ''
opam pin add -n imagelib-unix ''

# Notty helper:
opam pin add -n mirage-framebuffer-notty ''

# TSDL backend:
opam pin add -n mirage-framebuffer-tsdl ''

# QubesOS backend:
opam pin add -n mirage-framebuffer-qubes ''
## Patches to mirage-qubes (upstreamed to master awaiting release):
opam pin add -n mirage-qubes.0.7.0 ''

# VG vector graphics library helper:
opam pin add -n mirage-framebuffer-vg ''

opam install imagelib-unix mirage-framebuffer{,-tsdl,-qubes,-notty,-imagelib,-vg}

Sample TSDL backend

make test

Sample VG renderer:

dune build test_vg -f

Projects using mirage-framebuffer:


Experimental portable bitmap framebuffer graphics for MirageOS








No releases published


No packages published