drm

package module
v0.0.0-...-fbf6002 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: MIT Imports: 7 Imported by: 1

README

go-drm

GoDoc

libdrm for Go.

Disclaimer: this project is silly, you most certainly shouldn't use it.

License

MIT

Documentation

Overview

Package drm implements a userspace library for the Direct Rendering Manager.

Index

Constants

View Source
const (
	CapPrimeImport = 0x1
	CapPrimeExport = 0x2
)
View Source
const (
	DirName            = "/dev/dri"
	NodePatternPrimary = "/dev/dri/card*"
	NodePatternControl = "/dev/dri/controlD*"
	NodePatternRender  = "/dev/dri/renderD*"
)

Variables

This section is empty.

Functions

func ParsePath

func ParsePath(b []byte) (string, error)

Types

type AnyID

type AnyID interface {
	Type() ObjectType
	Object() ObjectID
}

func NewAnyID

func NewAnyID(id ObjectID, t ObjectType) AnyID

type BlobID

type BlobID ObjectID

func (BlobID) Object

func (id BlobID) Object() ObjectID

func (BlobID) Type

func (id BlobID) Type() ObjectType

type BusType

type BusType int
const (
	BusPCI      BusType = 0
	BusUSB      BusType = 1
	BusPlatform BusType = 2
	BusHost1x   BusType = 3
)

func (BusType) String

func (t BusType) String() string

type CRTCID

type CRTCID ObjectID

func (CRTCID) Object

func (id CRTCID) Object() ObjectID

func (CRTCID) Type

func (id CRTCID) Type() ObjectType

type Cap

type Cap uint64
const (
	CapDumbBuffer          Cap = 0x1
	CapVblankHighCRTC      Cap = 0x2
	CapDumbPreferredDepth  Cap = 0x3
	CapDumbPreferredShadow Cap = 0x4
	CapPrime               Cap = 0x5
	CapTimestampMonotonic  Cap = 0x6
	CapAsyncPageFlip       Cap = 0x7
	CapCursorWidth         Cap = 0x8
	CapCursorHeight        Cap = 0x9
	CapAddFB2Modifiers     Cap = 0x10
	CapPageFlipTarget      Cap = 0x11
	CapCRTCInVBlankEvent   Cap = 0x12
	CapSyncObj             Cap = 0x13
	CapSyncObjTimeline     Cap = 0x14
	CapAtomicAsyncPageFlip Cap = 0x15
)

func (Cap) String

func (c Cap) String() string

type ClientCap

type ClientCap uint64
const (
	ClientCapStereo3D            ClientCap = 1
	ClientCapUniversalPlanes     ClientCap = 2
	ClientCapAtomic              ClientCap = 3
	ClientCapAspectRatio         ClientCap = 4
	ClientCapWritebackConnectors ClientCap = 5
	ClientCapCursorPlaneHotspot  ClientCap = 6
)

func (ClientCap) String

func (c ClientCap) String() string

type ConnectorID

type ConnectorID ObjectID

func (ConnectorID) Object

func (id ConnectorID) Object() ObjectID

func (ConnectorID) Type

func (id ConnectorID) Type() ObjectType

type ConnectorStatus

type ConnectorStatus uint32
const (
	ConnectorStatusConnected    ConnectorStatus = 1
	ConnectorStatusDisconnected ConnectorStatus = 2
	ConnectorStatusUnknown      ConnectorStatus = 3
)

func (ConnectorStatus) String

func (s ConnectorStatus) String() string

type ConnectorType

type ConnectorType uint32
const (
	ConnectorUnknown     ConnectorType = 0
	ConnectorVGA         ConnectorType = 1
	ConnectorDVII        ConnectorType = 2
	ConnectorDVID        ConnectorType = 3
	ConnectorDVIA        ConnectorType = 4
	ConnectorComposite   ConnectorType = 5
	ConnectorSVideo      ConnectorType = 6
	ConnectorLVDS        ConnectorType = 7
	ConnectorComponent   ConnectorType = 8
	Connector9PinDIN     ConnectorType = 9
	ConnectorDisplayPort ConnectorType = 10
	ConnectorHDMIA       ConnectorType = 11
	ConnectorHDMIB       ConnectorType = 12
	ConnectorTV          ConnectorType = 13
	ConnectorEDP         ConnectorType = 14
	ConnectorVirtual     ConnectorType = 15
	ConnectorDSI         ConnectorType = 16
	ConnectorDPI         ConnectorType = 17
	ConnectorWriteback   ConnectorType = 18
)

func (ConnectorType) String

func (t ConnectorType) String() string

type Device

type Device interface {
	BusType() BusType
}

type EncoderID

type EncoderID ObjectID

func (EncoderID) Object

func (id EncoderID) Object() ObjectID

func (EncoderID) Type

func (id EncoderID) Type() ObjectType

type EncoderType

type EncoderType uint32
const (
	EncoderNone    EncoderType = 0
	EncoderDAC     EncoderType = 1
	EncoderTMDS    EncoderType = 2
	EncoderLVDS    EncoderType = 3
	EncoderTVDAC   EncoderType = 4
	EncoderVirtual EncoderType = 5
	EncoderDSI     EncoderType = 6
	EncoderDPMST   EncoderType = 7
	EncoderDPI     EncoderType = 8
)

func (EncoderType) String

func (t EncoderType) String() string

type FBID

type FBID ObjectID

func (FBID) Object

func (id FBID) Object() ObjectID

func (FBID) Type

func (id FBID) Type() ObjectType

type Format

type Format uint32
const (
	FormatABGR1555             Format = 0x35314241
	FormatABGR16161616         Format = 0x38344241
	FormatABGR16161616F        Format = 0x48344241
	FormatABGR2101010          Format = 0x30334241
	FormatABGR4444             Format = 0x32314241
	FormatABGR8888             Format = 0x34324241
	FormatARGB1555             Format = 0x35315241
	FormatARGB16161616         Format = 0x38345241
	FormatARGB16161616F        Format = 0x48345241
	FormatARGB2101010          Format = 0x30335241
	FormatARGB4444             Format = 0x32315241
	FormatARGB8888             Format = 0x34325241
	FormatAVUY8888             Format = 0x59555641
	FormatAXBXGXRX106106106106 Format = 0x30314241
	FormatAYUV                 Format = 0x56555941
	FormatBGR233               Format = 0x38524742
	FormatBGR565               Format = 0x36314742
	FormatBGR565_A8            Format = 0x38413542
	FormatBGR888               Format = 0x34324742
	FormatBGR888_A8            Format = 0x38413842
	FormatBGRA1010102          Format = 0x30334142
	FormatBGRA4444             Format = 0x32314142
	FormatBGRA5551             Format = 0x35314142
	FormatBGRA8888             Format = 0x34324142
	FormatBGRX1010102          Format = 0x30335842
	FormatBGRX4444             Format = 0x32315842
	FormatBGRX5551             Format = 0x35315842
	FormatBGRX8888             Format = 0x34325842
	FormatBGRX8888_A8          Format = 0x38415842
	FormatC1                   Format = 0x20203143
	FormatC2                   Format = 0x20203243
	FormatC4                   Format = 0x20203443
	FormatC8                   Format = 0x20203843
	FormatD1                   Format = 0x20203144
	FormatD2                   Format = 0x20203244
	FormatD4                   Format = 0x20203444
	FormatD8                   Format = 0x20203844
	FormatGR1616               Format = 0x32335247
	FormatGR88                 Format = 0x38385247
	FormatINVALID              Format = 0x0
	FormatNV12                 Format = 0x3231564E
	FormatNV15                 Format = 0x3531564E
	FormatNV16                 Format = 0x3631564E
	FormatNV20                 Format = 0x3032564E
	FormatNV21                 Format = 0x3132564E
	FormatNV24                 Format = 0x3432564E
	FormatNV30                 Format = 0x3033564E
	FormatNV42                 Format = 0x3234564E
	FormatNV61                 Format = 0x3136564E
	FormatP010                 Format = 0x30313050
	FormatP012                 Format = 0x32313050
	FormatP016                 Format = 0x36313050
	FormatP030                 Format = 0x30333050
	FormatP210                 Format = 0x30313250
	FormatQ401                 Format = 0x31303451
	FormatQ410                 Format = 0x30313451
	FormatR1                   Format = 0x20203152
	FormatR10                  Format = 0x20303152
	FormatR12                  Format = 0x20323152
	FormatR16                  Format = 0x20363152
	FormatR2                   Format = 0x20203252
	FormatR4                   Format = 0x20203452
	FormatR8                   Format = 0x20203852
	FormatRG1616               Format = 0x32334752
	FormatRG88                 Format = 0x38384752
	FormatRGB332               Format = 0x38424752
	FormatRGB565               Format = 0x36314752
	FormatRGB565_A8            Format = 0x38413552
	FormatRGB888               Format = 0x34324752
	FormatRGB888_A8            Format = 0x38413852
	FormatRGBA1010102          Format = 0x30334152
	FormatRGBA4444             Format = 0x32314152
	FormatRGBA5551             Format = 0x35314152
	FormatRGBA8888             Format = 0x34324152
	FormatRGBX1010102          Format = 0x30335852
	FormatRGBX4444             Format = 0x32315852
	FormatRGBX5551             Format = 0x35315852
	FormatRGBX8888             Format = 0x34325852
	FormatRGBX8888_A8          Format = 0x38415852
	FormatUYVY                 Format = 0x59565955
	FormatVUY101010            Format = 0x30335556
	FormatVUY888               Format = 0x34325556
	FormatVYUY                 Format = 0x59555956
	FormatX0L0                 Format = 0x304C3058
	FormatX0L2                 Format = 0x324C3058
	FormatXBGR1555             Format = 0x35314258
	FormatXBGR16161616         Format = 0x38344258
	FormatXBGR16161616F        Format = 0x48344258
	FormatXBGR2101010          Format = 0x30334258
	FormatXBGR4444             Format = 0x32314258
	FormatXBGR8888             Format = 0x34324258
	FormatXBGR8888_A8          Format = 0x38414258
	FormatXRGB1555             Format = 0x35315258
	FormatXRGB16161616         Format = 0x38345258
	FormatXRGB16161616F        Format = 0x48345258
	FormatXRGB2101010          Format = 0x30335258
	FormatXRGB4444             Format = 0x32315258
	FormatXRGB8888             Format = 0x34325258
	FormatXRGB8888_A8          Format = 0x38415258
	FormatXVUY8888             Format = 0x59555658
	FormatXVYU12_16161616      Format = 0x36335658
	FormatXVYU16161616         Format = 0x38345658
	FormatXVYU2101010          Format = 0x30335658
	FormatXYUV8888             Format = 0x56555958
	FormatY0L0                 Format = 0x304C3059
	FormatY0L2                 Format = 0x324C3059
	FormatY210                 Format = 0x30313259
	FormatY212                 Format = 0x32313259
	FormatY216                 Format = 0x36313259
	FormatY410                 Format = 0x30313459
	FormatY412                 Format = 0x32313459
	FormatY416                 Format = 0x36313459
	FormatYUV410               Format = 0x39565559
	FormatYUV411               Format = 0x31315559
	FormatYUV420               Format = 0x32315559
	FormatYUV420_10BIT         Format = 0x30315559
	FormatYUV420_8BIT          Format = 0x38305559
	FormatYUV422               Format = 0x36315559
	FormatYUV444               Format = 0x34325559
	FormatYUYV                 Format = 0x56595559
	FormatYVU410               Format = 0x39555659
	FormatYVU411               Format = 0x31315659
	FormatYVU420               Format = 0x32315659
	FormatYVU422               Format = 0x36315659
	FormatYVU444               Format = 0x34325659
	FormatYVYU                 Format = 0x55595659
)

func ParseFormats

func ParseFormats(b []byte) ([]Format, error)

func (Format) Name

func (f Format) Name() string

func (Format) String

func (f Format) String() string

type FormatModifierSet

type FormatModifierSet struct {
	// contains filtered or unexported fields
}

func ParseFormatModifierSet

func ParseFormatModifierSet(b []byte) (*FormatModifierSet, error)

func (*FormatModifierSet) Map

func (set *FormatModifierSet) Map() map[Modifier][]Format

type ModeCRTC

type ModeCRTC struct {
	ID        CRTCID
	FB        FBID
	X, Y      uint32
	GammaSize uint32
	Mode      *ModeModeInfo
}

type ModeCard

type ModeCard struct {
	FBs                                      []FBID
	CRTCs                                    []CRTCID
	Connectors                               []ConnectorID
	Encoders                                 []EncoderID
	MinWidth, MaxWidth, MinHeight, MaxHeight uint32
}

type ModeConnector

type ModeConnector struct {
	PossibleEncoders []EncoderID
	Modes            []ModeModeInfo

	Encoder EncoderID
	ID      ConnectorID
	Type    ConnectorType

	Status              ConnectorStatus
	PhyWidth, PhyHeight uint32 // mm
	Subpixel            Subpixel
}

type ModeEncoder

type ModeEncoder struct {
	ID                            EncoderID
	Type                          EncoderType
	CRTC                          CRTCID
	PossibleCRTCs, PossibleClones uint32
}

type ModeID

type ModeID ObjectID

func (ModeID) Object

func (id ModeID) Object() ObjectID

func (ModeID) Type

func (id ModeID) Type() ObjectType

type ModeModeInfo

type ModeModeInfo struct {
	Clock                                         uint32
	HDisplay, HSyncStart, HSyncEnd, HTotal, HSkew uint16
	VDisplay, VSyncStart, VSyncEnd, VTotal, VScan uint16

	VRefresh uint32

	Flags uint32
	Type  uint32
	Name  string
}

func ParseModeModeInfo

func ParseModeModeInfo(b []byte) (*ModeModeInfo, error)

type ModePlane

type ModePlane struct {
	ID PlaneID

	CRTC CRTCID
	FB   FBID

	PossibleCRTCs uint32
	GammaSize     uint32

	Formats []Format
}

type ModeProperty

type ModeProperty struct {
	ID   PropertyID
	Name string
	// contains filtered or unexported fields
}

func (*ModeProperty) Atomic

func (prop *ModeProperty) Atomic() bool

func (*ModeProperty) Blobs

func (prop *ModeProperty) Blobs() ([]ModePropertyBlob, bool)

func (*ModeProperty) Enums

func (prop *ModeProperty) Enums() ([]ModePropertyEnum, bool)

func (*ModeProperty) Immutable

func (prop *ModeProperty) Immutable() bool

func (*ModeProperty) ObjectType

func (prop *ModeProperty) ObjectType() (ObjectType, bool)

func (*ModeProperty) Range

func (prop *ModeProperty) Range() (low, high uint64, ok bool)

func (*ModeProperty) SignedRange

func (prop *ModeProperty) SignedRange() (low, high int64, ok bool)

func (*ModeProperty) Type

func (prop *ModeProperty) Type() PropertyType

type ModePropertyBlob

type ModePropertyBlob struct {
	ID   BlobID
	Size uint32
}

type ModePropertyEnum

type ModePropertyEnum struct {
	Name  string
	Value uint64
}

type Modifier

type Modifier uint64
const (
	ModifierALLWINNER_TILED                  Modifier = 0x900000000000001
	ModifierBROADCOM_SAND128                 Modifier = 0x700000000000004
	ModifierBROADCOM_SAND256                 Modifier = 0x700000000000005
	ModifierBROADCOM_SAND32                  Modifier = 0x700000000000002
	ModifierBROADCOM_SAND64                  Modifier = 0x700000000000003
	ModifierBROADCOM_UIF                     Modifier = 0x700000000000006
	ModifierBROADCOM_VC4_T_TILED             Modifier = 0x700000000000001
	ModifierGENERIC_16_16_TILE               Modifier = 0x400000000000002
	ModifierI915_4_TILED                     Modifier = 0x100000000000009
	ModifierI915_4_TILED_DG2_MC_CCS          Modifier = 0x10000000000000B
	ModifierI915_4_TILED_DG2_RC_CCS          Modifier = 0x10000000000000A
	ModifierI915_4_TILED_DG2_RC_CCS_CC       Modifier = 0x10000000000000C
	ModifierI915_4_TILED_MTL_MC_CCS          Modifier = 0x10000000000000E
	ModifierI915_4_TILED_MTL_RC_CCS          Modifier = 0x10000000000000D
	ModifierI915_4_TILED_MTL_RC_CCS_CC       Modifier = 0x10000000000000F
	ModifierI915_X_TILED                     Modifier = 0x100000000000001
	ModifierI915_Y_TILED                     Modifier = 0x100000000000002
	ModifierI915_Y_TILED_CCS                 Modifier = 0x100000000000004
	ModifierI915_Y_TILED_GEN12_MC_CCS        Modifier = 0x100000000000007
	ModifierI915_Y_TILED_GEN12_RC_CCS        Modifier = 0x100000000000006
	ModifierI915_Y_TILED_GEN12_RC_CCS_CC     Modifier = 0x100000000000008
	ModifierI915_Yf_TILED                    Modifier = 0x100000000000003
	ModifierI915_Yf_TILED_CCS                Modifier = 0x100000000000005
	ModifierINVALID                          Modifier = 0xFFFFFFFFFFFFFF
	ModifierLINEAR                           Modifier = 0x0
	ModifierNVIDIA_16BX2_BLOCK_EIGHT_GOB     Modifier = 0x300000000000013
	ModifierNVIDIA_16BX2_BLOCK_FOUR_GOB      Modifier = 0x300000000000012
	ModifierNVIDIA_16BX2_BLOCK_ONE_GOB       Modifier = 0x300000000000010
	ModifierNVIDIA_16BX2_BLOCK_SIXTEEN_GOB   Modifier = 0x300000000000014
	ModifierNVIDIA_16BX2_BLOCK_THIRTYTWO_GOB Modifier = 0x300000000000015
	ModifierNVIDIA_16BX2_BLOCK_TWO_GOB       Modifier = 0x300000000000011
	ModifierNVIDIA_TEGRA_TILED               Modifier = 0x300000000000001
	ModifierQCOM_COMPRESSED                  Modifier = 0x500000000000001
	ModifierQCOM_TILED2                      Modifier = 0x500000000000002
	ModifierQCOM_TILED3                      Modifier = 0x500000000000003
	ModifierSAMSUNG_64_32_TILE               Modifier = 0x400000000000001
	ModifierVIVANTE_SPLIT_SUPER_TILED        Modifier = 0x600000000000004
	ModifierVIVANTE_SPLIT_TILED              Modifier = 0x600000000000003
	ModifierVIVANTE_SUPER_TILED              Modifier = 0x600000000000002
	ModifierVIVANTE_TILED                    Modifier = 0x600000000000001
)

func (Modifier) Name

func (mod Modifier) Name() string

func (Modifier) String

func (mod Modifier) String() string

func (Modifier) Vendor

func (mod Modifier) Vendor() ModifierVendor

type ModifierVendor

type ModifierVendor uint8
const (
	ModifierVendorALLWINNER ModifierVendor = 0x9
	ModifierVendorAMD       ModifierVendor = 0x2
	ModifierVendorAMLOGIC   ModifierVendor = 0xA
	ModifierVendorARM       ModifierVendor = 0x8
	ModifierVendorBROADCOM  ModifierVendor = 0x7
	ModifierVendorINTEL     ModifierVendor = 0x1
	ModifierVendorNONE      ModifierVendor = 0x0
	ModifierVendorNVIDIA    ModifierVendor = 0x3
	ModifierVendorQCOM      ModifierVendor = 0x5
	ModifierVendorSAMSUNG   ModifierVendor = 0x4
	ModifierVendorVIVANTE   ModifierVendor = 0x6
)

func (ModifierVendor) String

func (vendor ModifierVendor) String() string

type Node

type Node struct {
	// contains filtered or unexported fields
}

func NewNode

func NewNode(fd uintptr) *Node

func (*Node) GetCap

func (n *Node) GetCap(cap Cap) (uint64, error)

func (*Node) GetDevice

func (n *Node) GetDevice() (Device, error)

func (*Node) ModeGetBlob

func (n *Node) ModeGetBlob(id BlobID) ([]byte, error)

func (*Node) ModeGetCRTC

func (n *Node) ModeGetCRTC(id CRTCID) (*ModeCRTC, error)

func (*Node) ModeGetConnector

func (n *Node) ModeGetConnector(id ConnectorID) (*ModeConnector, error)

func (*Node) ModeGetEncoder

func (n *Node) ModeGetEncoder(id EncoderID) (*ModeEncoder, error)

func (*Node) ModeGetPlane

func (n *Node) ModeGetPlane(id PlaneID) (*ModePlane, error)

func (*Node) ModeGetPlaneResources

func (n *Node) ModeGetPlaneResources() ([]PlaneID, error)

func (*Node) ModeGetProperty

func (n *Node) ModeGetProperty(id PropertyID) (*ModeProperty, error)

func (*Node) ModeGetResources

func (n *Node) ModeGetResources() (*ModeCard, error)

func (*Node) ModeObjectGetProperties

func (n *Node) ModeObjectGetProperties(id AnyID) (map[PropertyID]uint64, error)

func (*Node) SetClientCap

func (n *Node) SetClientCap(cap ClientCap, val uint64) error

func (*Node) Version

func (n *Node) Version() (*Version, error)

type NodeType

type NodeType int
const (
	NodePrimary NodeType = 0
	NodeControl NodeType = 1
	NodeRender  NodeType = 2
)

func (NodeType) String

func (t NodeType) String() string

type ObjectID

type ObjectID uint32

func (ObjectID) Object

func (id ObjectID) Object() ObjectID

func (ObjectID) Type

func (id ObjectID) Type() ObjectType

type ObjectType

type ObjectType uint32
const (
	ObjectAny       ObjectType = 0
	ObjectCRTC      ObjectType = 0xCCCCCCCC
	ObjectConnector ObjectType = 0xC0C0C0C0
	ObjectEncoder   ObjectType = 0xE0E0E0E0
	ObjectMode      ObjectType = 0xDEDEDEDE
	ObjectProperty  ObjectType = 0xB0B0B0B0
	ObjectFB        ObjectType = 0xFBFBFBFB
	ObjectBlob      ObjectType = 0xBBBBBBBB
	ObjectPlane     ObjectType = 0xEEEEEEEE
)

func (ObjectType) String

func (t ObjectType) String() string

type PCIDevice

type PCIDevice struct {
	Vendor, Device       uint32
	SubVendor, SubDevice uint32
}

func (*PCIDevice) BusType

func (d *PCIDevice) BusType() BusType

type PlaneID

type PlaneID ObjectID

func (PlaneID) Object

func (id PlaneID) Object() ObjectID

func (PlaneID) Type

func (id PlaneID) Type() ObjectType

type PlaneType

type PlaneType uint32
const (
	PlaneOverlay PlaneType = 0
	PlanePrimary PlaneType = 1
	PlaneCursor  PlaneType = 2
)

func (PlaneType) String

func (t PlaneType) String() string

type PropertyID

type PropertyID ObjectID

func (PropertyID) Object

func (id PropertyID) Object() ObjectID

func (PropertyID) Type

func (id PropertyID) Type() ObjectType

type PropertyType

type PropertyType uint32
const (
	// Legacy types
	PropertyRange   PropertyType = 1 << 1
	PropertyEnum    PropertyType = 1 << 3
	PropertyBlob    PropertyType = 1 << 4
	PropertyBitmask PropertyType = 1 << 5

	// Extended types
	PropertyObject      PropertyType = 1 << 6
	PropertySignedRange PropertyType = 2 << 6
)

func (PropertyType) String

func (t PropertyType) String() string

type Subpixel

type Subpixel uint32
const (
	SubpixelUnknown       Subpixel = 0
	SubpixelHorizontalRGB Subpixel = 1
	SubpixelHorizontalBGR Subpixel = 3
	SubpixelVerticalRGB   Subpixel = 4
	SubpixelVerticalBGR   Subpixel = 5
	SubpixelNone          Subpixel = 6
)

func (Subpixel) String

func (s Subpixel) String() string

type Version

type Version struct {
	Major, Minor, Patch int32
	Name, Date, Desc    string
}

Jump to

Keyboard shortcuts

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