hwbuf

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package hwbuf provides Go bindings for Android HardwareBuffer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ARect

type ARect = capi.ARect

type Buffer

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

Buffer wraps the NDK AHardwareBuffer handle.

func NewBufferFromPointer

func NewBufferFromPointer(ptr unsafe.Pointer) *Buffer

NewBufferFromPointer wraps a raw AHardwareBuffer pointer.

func (*Buffer) Acquire

func (h *Buffer) Acquire()

Acquire calls the underlying NDK function.

func (*Buffer) Close

func (h *Buffer) Close() error

Close releases the underlying NDK handle.

func (*Buffer) GetID

func (h *Buffer) GetID(outID *uint64) error

GetID calls the underlying NDK function.

func (*Buffer) LockPlanes

func (h *Buffer) LockPlanes(usage uint64, fence int32, rect *ARect, outPlanes *HardwareBuffer_Planes) error

LockPlanes calls the underlying NDK function.

func (*Buffer) Pointer

func (h *Buffer) Pointer() unsafe.Pointer

Pointer returns the underlying pointer as unsafe.Pointer.

func (*Buffer) SendHandleToUnixSocket

func (h *Buffer) SendHandleToUnixSocket(socketFd int32) error

SendHandleToUnixSocket calls the underlying NDK function.

func (*Buffer) Unlock

func (h *Buffer) Unlock(fence *int32) error

Unlock calls the underlying NDK function.

type Error

type Error int32

Error represents an NDK error code.

func (Error) Error

func (e Error) Error() string

type Format

type Format int32
const (
	R8g8b8a8Unorm     Format = 1
	R8g8b8x8Unorm     Format = 2
	R8g8b8Unorm       Format = 3
	R5g6b5Unorm       Format = 4
	R16g16b16a16Float Format = 22
	R10g10b10a2Unorm  Format = 43
	Blob              Format = 33
	D16Unorm          Format = 48
	D24Unorm          Format = 49
	D24UnormS8Uint    Format = 50
	D32Float          Format = 51
	D32FloatS8Uint    Format = 52
	S8Uint            Format = 53
	Y8cb8cr8420       Format = 35
	YcbcrP010         Format = 54
	YcbcrP210         Format = 60
	R8Unorm           Format = 56
	R16Uint           Format = 57
	R16g16Uint        Format = 58
	R10g10b10a10Unorm Format = 59
)

func (Format) String

func (v Format) String() string

type HardwareBuffer_Desc

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

HardwareBuffer_Desc wraps the NDK AHardwareBuffer_Desc handle.

func NewHardwareBuffer_DescFromPointer

func NewHardwareBuffer_DescFromPointer(ptr unsafe.Pointer) *HardwareBuffer_Desc

NewHardwareBuffer_DescFromPointer wraps a raw AHardwareBuffer_Desc pointer.

func (*HardwareBuffer_Desc) Pointer

func (h *HardwareBuffer_Desc) Pointer() unsafe.Pointer

Pointer returns the underlying pointer as unsafe.Pointer.

type HardwareBuffer_Plane

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

HardwareBuffer_Plane wraps the NDK AHardwareBuffer_Plane handle.

func NewHardwareBuffer_PlaneFromPointer

func NewHardwareBuffer_PlaneFromPointer(ptr unsafe.Pointer) *HardwareBuffer_Plane

NewHardwareBuffer_PlaneFromPointer wraps a raw AHardwareBuffer_Plane pointer.

func (*HardwareBuffer_Plane) Pointer

func (h *HardwareBuffer_Plane) Pointer() unsafe.Pointer

Pointer returns the underlying pointer as unsafe.Pointer.

type HardwareBuffer_Planes

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

HardwareBuffer_Planes wraps the NDK AHardwareBuffer_Planes handle.

func NewHardwareBuffer_PlanesFromPointer

func NewHardwareBuffer_PlanesFromPointer(ptr unsafe.Pointer) *HardwareBuffer_Planes

NewHardwareBuffer_PlanesFromPointer wraps a raw AHardwareBuffer_Planes pointer.

func (*HardwareBuffer_Planes) Pointer

func (h *HardwareBuffer_Planes) Pointer() unsafe.Pointer

Pointer returns the underlying pointer as unsafe.Pointer.

type Usage

type Usage uint64
const (
	CpuReadNever      Usage = 0
	CpuReadRarely     Usage = 2
	CpuReadOften      Usage = 3
	CpuReadMask       Usage = 15
	CpuWriteNever     Usage = 0
	CpuWriteRarely    Usage = 32
	CpuWriteOften     Usage = 48
	CpuWriteMask      Usage = 240
	GpuSampledImage   Usage = 256
	GpuFramebuffer    Usage = 512
	GpuColorOutput    Usage = 512
	ComposerOverlay   Usage = 2048
	ProtectedContent  Usage = 16384
	VideoEncode       Usage = 65536
	SensorDirectData  Usage = 8388608
	GpuDataBuffer     Usage = 16777216
	GpuCubeMap        Usage = 33554432
	GpuMipmapComplete Usage = 67108864
	FrontBuffer       Usage = 4294967296
	Vendor0           Usage = 268435456
	Vendor1           Usage = 536870912
	Vendor2           Usage = 1073741824
	Vendor3           Usage = 0xFFFFFFFF80000000
	Vendor4           Usage = 281474976710656
	Vendor5           Usage = 562949953421312
	Vendor6           Usage = 1125899906842624
	Vendor7           Usage = 2251799813685248
	Vendor8           Usage = 4503599627370496
	Vendor9           Usage = 9007199254740992
	Vendor10          Usage = 18014398509481984
	Vendor11          Usage = 36028797018963968
	Vendor12          Usage = 72057594037927936
	Vendor13          Usage = 144115188075855872
	Vendor14          Usage = 288230376151711744
	Vendor15          Usage = 576460752303423488
	Vendor16          Usage = 1152921504606846976
	Vendor17          Usage = 2305843009213693952
	Vendor18          Usage = 4611686018427387904
	Vendor19          Usage = 0x8000000000000000
)

Jump to

Keyboard shortcuts

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