mode

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

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

Index

Constants

View Source
const (
	DisplayInfoLen   = 32
	ConnectorNameLen = 32
	DisplayModeLen   = 32
	PropNameLen      = 32

	Connected         = 1
	Disconnected      = 2
	UnknownConnection = 3
)

Variables

This section is empty.

Functions

func AddFB

func AddFB(f *os.File, width, height uint16,
	depth, bpp uint8, pitch, boHandle uint32) (uint32, error)

func DestroyDumb

func DestroyDumb(f *os.File, handle uint32) error

func MapDumb

func MapDumb(f *os.File, handle uint32) (uint64, error)

func RmFB

func RmFB(f *os.File, handle uint32) error

func SetCrtc

func SetCrtc(f *os.File, crtcid, bufferid, x, y uint32, connectors *uint32, count int, modeInfo *Info) error

Types

type Connector

type Connector struct {
	mode.SysGetConnector

	ID            uint32
	EncoderID     uint32
	Type          uint32
	TypeID        uint32
	Connection    uint8
	Width, Height uint32
	Subpixel      uint8

	Modes []Info

	Props      []uint32
	PropValues []uint64

	Encoders []uint32
}

func GetConnector

func GetConnector(f *os.File, id uint32) (*Connector, error)

type Crtc

type Crtc struct {
	ID       uint32
	BufferID uint32 // FB id to connect to 0 = disconnect

	// Position on the framebuffer
	X uint32
	Y uint32

	Width     uint32
	Height    uint32
	ModeValid int
	Mode      Info

	GammaSize int // Number of gamma stops
}

func GetCrtc

func GetCrtc(f *os.File, id uint32) (*Crtc, error)

type Encoder

type Encoder struct {
	ID   uint32
	Type uint32

	CrtcID uint32

	PossibleCrtcs  uint32
	PossibleClones uint32
}

func GetEncoder

func GetEncoder(f *os.File, id uint32) (*Encoder, error)

type FB

type FB struct {
	Height uint32
	Width  uint32
	BPP    uint32
	Flags  uint32
	Handle uint32
	Pitch  uint32
	Size   uint64
}

func CreateFB

func CreateFB(f *os.File, width, height uint16, bpp uint32) (*FB, error)

type Info

type Info struct {
	Clock uint32

	Hdisplay   uint16
	HsyncStart uint16
	HsyncEnd   uint16
	Htotal     uint16
	Hskew      uint16

	Vdisplay   uint16
	VsyncStart uint16
	VsyncEnd   uint16
	Vtotal     uint16
	Vscan      uint16

	Vrefresh uint32

	Flags uint32
	Type  uint32
	Name  [DisplayModeLen]uint8
}

type Modeset

type Modeset struct {
	Width  uint16
	Height uint16

	Mode Info
	Conn uint32
	Crtc uint32
}

type Resources

type Resources struct {
	mode.SysResources

	Fbs        []uint32
	Crtcs      []uint32
	Connectors []uint32
	Encoders   []uint32
}

func GetResources

func GetResources(f *os.File) (*Resources, error)

type SimpleModeset

type SimpleModeset struct {
	Modesets []Modeset
	// contains filtered or unexported fields
}

func NewSimpleModeset

func NewSimpleModeset(file *os.File) (*SimpleModeset, error)

func (*SimpleModeset) SetCrtc

func (mset *SimpleModeset) SetCrtc(dev *Modeset, savedCrtc *Crtc) error

Jump to

Keyboard shortcuts

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