drm

package module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2023 License: BSD-1-Clause Imports: 8 Imported by: 0

README

drm

The Direct Rendering Manager (DRM) is a kernel framework to manage Graphical Processing Units (GPU). It's a kernel abstractions to GPU drivers and a userspace API designed to support the needs of complex graphics devices.

DRM was first implemented on Linux but ported to FreeBSD, NetBSD and Solaris (others?). It's the lower level interface between opengl and the graphics card. With this Go library, theoretically, now it's possible to create a X server or a pure OpenGL library in Go (no bindings).

Rationale

Enables the creation of a graphics stack in Go, avoiding the overhead of the existing C bindings. Another possibility is using Go to make GPGPU (like opencl).

Examples

See the examples directory.

Documentation

Overview

Package drm provides a library to interact with DRM (Direct Rendering Manager) and KMS (Kernel Mode Setting) interfaces. DRM is a low level interface for the graphics card (gpu) and this package enables the creation of graphics library on top of the kernel drm/kms subsystem.

Index

Constants

View Source
const (
	CapDumbBuffer uint64 = iota + 1
	CapVBlankHighCRTC
	CapDumbPreferredDepth
	CapDumbPreferShadow
	CapPrime
	CapTimestampMonotonic
	CapAsyncPageFlip
	CapCursorWidth
	CapCursorHeight

	CapAddFB2Modifiers = 0x10
)
View Source
const IOCTLBase = 'd'

Variables

View Source
var (
	// DRM_IOWR(0x00, struct drm_version)
	IOCTLVersion = ioctl.NewCode(ioctl.Read|ioctl.Write,
		uint16(unsafe.Sizeof(version{})), IOCTLBase, 0)

	// DRM_IOWR(0x0c, struct drm_get_cap)
	IOCTLGetCap = ioctl.NewCode(ioctl.Read|ioctl.Write,
		uint16(unsafe.Sizeof(capability{})), IOCTLBase, 0x0c)
)

Functions

func GetCap

func GetCap(file *os.File, capid uint64) (uint64, error)

func HasDumbBuffer

func HasDumbBuffer(file *os.File) bool

func OpenCard

func OpenCard(n int) (*os.File, error)

func OpenControlDev

func OpenControlDev(n int) (*os.File, error)

func OpenRenderDev

func OpenRenderDev(n int) (*os.File, error)

Types

type Version

type Version struct {
	Major, Minor, Patch int32
	Name                string // Name of the driver (eg.: i915)
	Date                string
	Desc                string
	// contains filtered or unexported fields
}

Version of DRM driver

func Available

func Available() (Version, error)

func GetVersion

func GetVersion(file *os.File) (Version, error)

func ListDevices

func ListDevices() []Version

Directories

Path Synopsis
examples
Port of modeset.c example to Go Source: https://github.com/dvdhrm/docs/blob/master/drm-howto/modeset.c
Port of modeset.c example to Go Source: https://github.com/dvdhrm/docs/blob/master/drm-howto/modeset.c

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL