hidlalloc

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: CC0-1.0 Imports: 7 Imported by: 0

Documentation

Overview

Package hidlalloc implements the HIDL gralloc 3.0 IAllocator client for buffer allocation via hwbinder.

The emulator's camera HAL uses android.hardware.graphics.allocator@3.0 which runs on /dev/hwbinder. This package opens a separate hwbinder connection, looks up the allocator service via hwservicemanager, and calls allocate() with a BufferDescriptor constructed using the ranchu/goldfish encoding format.

BufferDescriptor format (goldfish/ranchu):

[0] width
[1] height
[2] layerCount
[3] format (PixelFormat as uint32)
[4] usage (low 32 bits of BufferUsage)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllocatorService

func GetAllocatorService(
	ctx context.Context,
	transport binder.Transport,
) (_ uint32, _err error)

GetAllocatorService looks up the gralloc 3.0 IAllocator service via hwservicemanager and returns its binder handle.

Types

type AllocateResult

type AllocateResult struct {
	// Error is the gralloc error code (0 = NONE).
	Error int32

	// Stride is the number of pixels between consecutive rows.
	Stride int32

	// Fds holds the file descriptors from the allocated native_handle.
	Fds []int32

	// Ints holds the integer data from the allocated native_handle.
	Ints []int32
}

AllocateResult holds the result of a gralloc 3.0 allocate() call.

func Allocate

func Allocate(
	ctx context.Context,
	transport binder.Transport,
	allocatorHandle uint32,
	width uint32,
	height uint32,
	layerCount uint32,
	format uint32,
	usage uint64,
	count uint32,
) (_ *AllocateResult, _err error)

Allocate calls IAllocator::allocate() via HIDL/hwbinder.

Jump to

Keyboard shortcuts

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