Documentation
¶
Overview ¶
Package pidisp opens a display on a Raspberry Pi (or any Linux system) and renders image.RGBA frames onto it using double buffering.
It tries DRM/KMS first (via the drm sub-package) and falls back to the Linux framebuffer (/dev/fb0) automatically. Callers only see the Display interface; the backend is chosen at runtime.
Basic usage (zero-copy) ¶
d, err := pidisp.Open(pidisp.Options{Rotate: true})
if err != nil {
log.Fatal(err)
}
defer d.Close()
buf := d.BackBuffer()
// ... draw into buf ...
d.Flip()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestImage ¶
NewTestImage returns an RGBA image filled with a non-trivial pattern (R=x, G=y, B=x+y, A=255). Used by tests in the drm and fb sub-packages.
Types ¶
type Display ¶
type Display interface {
// Width returns the display width in pixels.
Width() int
// Height returns the display height in pixels.
Height() int
// BackBuffer returns the non-active buffer for rendering.
// The returned buffer may be drawn into directly.
// Call Flip to make the back buffer active (displayed).
BackBuffer() *image.RGBA
// Flip makes the back buffer the active (displayed) buffer
// and prepares a fresh back buffer for the next frame.
Flip()
// Blit copies img to the display. Deprecated: use BackBuffer and Flip instead.
Blit(img *image.RGBA)
// Close releases all resources held by the display.
Close()
}
Display is a handle to an open hardware display. Obtain one via Open; release it with [Close].
type Options ¶
type Options struct {
// Rotate requests 180° rotation of the output.
// On DRM/KMS devices this is offloaded to hardware; on fbdev it is done
// in software.
Rotate bool
// ForceFB skips DRM detection and opens /dev/fb0 directly. Useful for
// testing the fbdev path on a machine that supports both.
ForceFB bool
// Debug logs DRM device information (plane formats, connector details)
// before opening the display.
Debug bool
}
Options controls how the display is opened.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package drm drives a display via the Linux DRM/KMS kernel subsystem using raw ioctls — no libdrm or CGO required.
|
Package drm drives a display via the Linux DRM/KMS kernel subsystem using raw ioctls — no libdrm or CGO required. |
|
Package fb drives a Linux framebuffer device such as /dev/fb0 using a single ioctl and mmap — no external dependencies, no DRM master required.
|
Package fb drives a Linux framebuffer device such as /dev/fb0 using a single ioctl and mmap — no external dependencies, no DRM master required. |
Click to show internal directories.
Click to hide internal directories.