go-drm: git.sr.ht/~emersion/go-drm Index | Files

package drm

import "git.sr.ht/~emersion/go-drm"

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

Index

Package Files

blob.go const.go const_linux.go device.go device_linux.go drm.go fourcc.go fourcc_generated.go ioctl.go node.go node_linux.go object.go prop.go

Constants

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

func ParsePath Uses

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

type AnyID Uses

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

func NewAnyID Uses

func NewAnyID(id ObjectID, t ObjectType) AnyID

type BlobID Uses

type BlobID ObjectID

func (BlobID) Object Uses

func (id BlobID) Object() ObjectID

func (BlobID) Type Uses

func (id BlobID) Type() ObjectType

type BusType Uses

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

func (BusType) String Uses

func (t BusType) String() string

type CRTCID Uses

type CRTCID ObjectID

func (CRTCID) Object Uses

func (id CRTCID) Object() ObjectID

func (CRTCID) Type Uses

func (id CRTCID) Type() ObjectType

type Cap Uses

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
)

func (Cap) String Uses

func (c Cap) String() string

type ClientCap Uses

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

func (ClientCap) String Uses

func (c ClientCap) String() string

type ConnectorID Uses

type ConnectorID ObjectID

func (ConnectorID) Object Uses

func (id ConnectorID) Object() ObjectID

func (ConnectorID) Type Uses

func (id ConnectorID) Type() ObjectType

type ConnectorStatus Uses

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

func (ConnectorStatus) String Uses

func (s ConnectorStatus) String() string

type ConnectorType Uses

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 Uses

func (t ConnectorType) String() string

type Device Uses

type Device interface {
    BusType() BusType
}

type EncoderID Uses

type EncoderID ObjectID

func (EncoderID) Object Uses

func (id EncoderID) Object() ObjectID

func (EncoderID) Type Uses

func (id EncoderID) Type() ObjectType

type EncoderType Uses

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 Uses

func (t EncoderType) String() string

type FBID Uses

type FBID ObjectID

func (FBID) Object Uses

func (id FBID) Object() ObjectID

func (FBID) Type Uses

func (id FBID) Type() ObjectType

type Format Uses

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

func ParseFormats Uses

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

func (Format) Name Uses

func (f Format) Name() string

func (Format) String Uses

func (f Format) String() string

type FormatModifierSet Uses

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

func ParseFormatModifierSet Uses

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

func (*FormatModifierSet) Map Uses

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

type ModeCRTC Uses

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

type ModeCard Uses

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

type ModeConnector Uses

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

    Encoder EncoderID
    ID      ConnectorID
    Type    ConnectorType

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

type ModeEncoder Uses

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

type ModeID Uses

type ModeID ObjectID

func (ModeID) Object Uses

func (id ModeID) Object() ObjectID

func (ModeID) Type Uses

func (id ModeID) Type() ObjectType

type ModeModeInfo Uses

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 Uses

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

type ModePlane Uses

type ModePlane struct {
    ID  PlaneID

    CRTC CRTCID
    FB   FBID

    PossibleCRTCs uint32
    GammaSize     uint32

    Formats []Format
}

type ModeProperty Uses

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

func (*ModeProperty) Atomic Uses

func (prop *ModeProperty) Atomic() bool

func (*ModeProperty) Blobs Uses

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

func (*ModeProperty) Enums Uses

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

func (*ModeProperty) Immutable Uses

func (prop *ModeProperty) Immutable() bool

func (*ModeProperty) ObjectType Uses

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

func (*ModeProperty) Range Uses

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

func (*ModeProperty) SignedRange Uses

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

func (*ModeProperty) Type Uses

func (prop *ModeProperty) Type() PropertyType

type ModePropertyBlob Uses

type ModePropertyBlob struct {
    ID   BlobID
    Size uint32
}

type ModePropertyEnum Uses

type ModePropertyEnum struct {
    Name  string
    Value uint64
}

type Modifier Uses

type Modifier uint64
const (
    ModifierGENERIC_16_16_TILE               Modifier = 0x400000000000002
    ModifierInvalid                          Modifier = 0xFFFFFFFFFFFFFF
    ModifierLinear                           Modifier = 0x0
    ModifierI915_X_TILED                     Modifier = 0x100000000000001
    ModifierI915_Y_TILED                     Modifier = 0x100000000000002
    ModifierI915_Yf_TILED                    Modifier = 0x100000000000003
    ModifierI915_Y_TILED_CCS                 Modifier = 0x100000000000004
    ModifierI915_Yf_TILED_CCS                Modifier = 0x100000000000005
    ModifierI915_Y_TILED_GEN12_RC_CCS        Modifier = 0x100000000000006
    ModifierI915_Y_TILED_GEN12_MC_CCS        Modifier = 0x100000000000007
    ModifierSAMSUNG_64_32_TILE               Modifier = 0x400000000000001
    ModifierQCOM_COMPRESSED                  Modifier = 0x500000000000001
    ModifierVIVANTE_TILED                    Modifier = 0x600000000000001
    ModifierVIVANTE_SUPER_TILED              Modifier = 0x600000000000002
    ModifierVIVANTE_SPLIT_TILED              Modifier = 0x600000000000003
    ModifierVIVANTE_SPLIT_SUPER_TILED        Modifier = 0x600000000000004
    ModifierNVIDIA_TEGRA_TILED               Modifier = 0x300000000000001
    ModifierNVIDIA_16BX2_BLOCK_ONE_GOB       Modifier = 0x300000000000010
    ModifierNVIDIA_16BX2_BLOCK_TWO_GOB       Modifier = 0x300000000000011
    ModifierNVIDIA_16BX2_BLOCK_FOUR_GOB      Modifier = 0x300000000000012
    ModifierNVIDIA_16BX2_BLOCK_EIGHT_GOB     Modifier = 0x300000000000013
    ModifierNVIDIA_16BX2_BLOCK_SIXTEEN_GOB   Modifier = 0x300000000000014
    ModifierNVIDIA_16BX2_BLOCK_THIRTYTWO_GOB Modifier = 0x300000000000015
    ModifierBROADCOM_VC4_T_TILED             Modifier = 0x700000000000001
    ModifierBROADCOM_SAND32                  Modifier = 0x700000000000002
    ModifierBROADCOM_SAND64                  Modifier = 0x700000000000003
    ModifierBROADCOM_SAND128                 Modifier = 0x700000000000004
    ModifierBROADCOM_SAND256                 Modifier = 0x700000000000005
    ModifierBROADCOM_UIF                     Modifier = 0x700000000000006
    ModifierARM_16X16_BLOCK_U_INTERLEAVED    Modifier = 0x810000000000001
    ModifierALLWINNER_TILED                  Modifier = 0x900000000000001
)

func (Modifier) Name Uses

func (mod Modifier) Name() string

func (Modifier) String Uses

func (mod Modifier) String() string

func (Modifier) Vendor Uses

func (mod Modifier) Vendor() ModifierVendor

type ModifierVendor Uses

type ModifierVendor uint8
const (
    ModifierVendorIntel     ModifierVendor = 0x1
    ModifierVendorAMD       ModifierVendor = 0x2
    ModifierVendorNVIDIA    ModifierVendor = 0x3
    ModifierVendorSamsung   ModifierVendor = 0x4
    ModifierVendorQcom      ModifierVendor = 0x5
    ModifierVendorVivante   ModifierVendor = 0x6
    ModifierVendorBroadcom  ModifierVendor = 0x7
    ModifierVendorARM       ModifierVendor = 0x8
    ModifierVendorAllwinner ModifierVendor = 0x9
    ModifierVendorAmlogic   ModifierVendor = 0xA
)

func (ModifierVendor) String Uses

func (vendor ModifierVendor) String() string

type Node Uses

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

func NewNode Uses

func NewNode(fd uintptr) *Node

func (*Node) GetCap Uses

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

func (*Node) GetDevice Uses

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

func (*Node) ModeGetBlob Uses

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

func (*Node) ModeGetCRTC Uses

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

func (*Node) ModeGetConnector Uses

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

func (*Node) ModeGetEncoder Uses

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

func (*Node) ModeGetPlane Uses

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

func (*Node) ModeGetPlaneResources Uses

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

func (*Node) ModeGetProperty Uses

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

func (*Node) ModeGetResources Uses

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

func (*Node) ModeObjectGetProperties Uses

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

func (*Node) SetClientCap Uses

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

func (*Node) Version Uses

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

type NodeType Uses

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

func (NodeType) String Uses

func (t NodeType) String() string

type ObjectID Uses

type ObjectID uint32

func (ObjectID) Object Uses

func (id ObjectID) Object() ObjectID

func (ObjectID) Type Uses

func (id ObjectID) Type() ObjectType

type ObjectType Uses

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 Uses

func (t ObjectType) String() string

type PCIDevice Uses

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

func (*PCIDevice) BusType Uses

func (d *PCIDevice) BusType() BusType

type PlaneID Uses

type PlaneID ObjectID

func (PlaneID) Object Uses

func (id PlaneID) Object() ObjectID

func (PlaneID) Type Uses

func (id PlaneID) Type() ObjectType

type PlaneType Uses

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

func (PlaneType) String Uses

func (t PlaneType) String() string

type PropertyID Uses

type PropertyID ObjectID

func (PropertyID) Object Uses

func (id PropertyID) Object() ObjectID

func (PropertyID) Type Uses

func (id PropertyID) Type() ObjectType

type PropertyType Uses

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 Uses

func (t PropertyType) String() string

type Subpixel Uses

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 Uses

func (s Subpixel) String() string

type Version Uses

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

Package drm imports 7 packages (graph). Updated 2021-01-13. Refresh now. Tools for package owners.