display

package
v0.0.0-...-e9d5adc Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REQUEST_BUFFER          = 0x1
	SET_BUFFER_COUNT        = 0x2
	DEQUEUE_BUFFER          = 0x3
	DETACH_BUFFER           = 0x4
	DETACH_NEXT_BUFFER      = 0x5
	ATTACH_BUFFER           = 0x6
	QUEUE_BUFFER            = 0x7
	CANCEL_BUFFER           = 0x8
	QUERY                   = 0x9
	CONNECT                 = 0xA
	DISCONNECT              = 0xB
	ALLOCATE_BUFFERS        = 0xD
	SET_PREALLOCATED_BUFFER = 0xE
)
View Source
const (
	/* buffer is never read in software */
	GRALLOC_USAGE_SW_READ_NEVER = 0x00000000
	/* buffer is rarely read in software */
	GRALLOC_USAGE_SW_READ_RARELY = 0x00000002
	/* buffer is often read in software */
	GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003
	/* mask for the software read values */
	GRALLOC_USAGE_SW_READ_MASK = 0x0000000F
	/* buffer is never written in software */
	GRALLOC_USAGE_SW_WRITE_NEVER = 0x00000000
	/* buffer is rarely written in software */
	GRALLOC_USAGE_SW_WRITE_RARELY = 0x00000020
	/* buffer is often written in software */
	GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030
	/* mask for the software write values */
	GRALLOC_USAGE_SW_WRITE_MASK = 0x000000F0
	/* buffer will be used as an OpenGL ES texture */
	GRALLOC_USAGE_HW_TEXTURE = 0x00000100
	/* buffer will be used as an OpenGL ES render target */
	GRALLOC_USAGE_HW_RENDER = 0x00000200
	/* buffer will be used by the 2D hardware blitter */
	GRALLOC_USAGE_HW_2D = 0x00000400
	/* buffer will be used by the HWComposer HAL module */
	GRALLOC_USAGE_HW_COMPOSER = 0x00000800
	/* buffer will be used with the framebuffer device */
	GRALLOC_USAGE_HW_FB = 0x00001000
	/* buffer should be displayed full-screen on an external display when
	 * possible */
	GRALLOC_USAGE_EXTERNAL_DISP = 0x00002000
	/* Must have a hardware-protected path to external display sink for
	 * this buffer.  If a hardware-protected path is not available, then
	 * either don't composite only this buffer (preferred) to the
	 * external sink, or (less desirable) do not route the entire
	 * composition to the external sink.  */
	GRALLOC_USAGE_PROTECTED = 0x00004000
	/* buffer may be used as a cursor */
	GRALLOC_USAGE_CURSOR = 0x00008000
	/* buffer will be used with the HW video encoder */
	GRALLOC_USAGE_HW_VIDEO_ENCODER = 0x00010000
	/* buffer will be written by the HW camera pipeline */
	GRALLOC_USAGE_HW_CAMERA_WRITE = 0x00020000
	/* buffer will be read by the HW camera pipeline */
	GRALLOC_USAGE_HW_CAMERA_READ = 0x00040000
	/* buffer will be used as part of zero-shutter-lag queue */
	GRALLOC_USAGE_HW_CAMERA_ZSL = 0x00060000
	/* mask for the camera access values */
	GRALLOC_USAGE_HW_CAMERA_MASK = 0x00060000
	/* mask for the software usage bit-mask */
	GRALLOC_USAGE_HW_MASK = 0x00071F00
	/* buffer will be used as a RenderScript Allocation */
	GRALLOC_USAGE_RENDERSCRIPT = 0x00100000
)
View Source
const (
	// From Android window.h.
	/* attributes queriable with query() */
	NativeWindowWidth  = 0
	NativeWindowHeight = 1
	NativeWindowFormat = 2
)
View Source
const NativeWindowAPICPU = 2

From Android window.h.

parameter for NATIVE_WINDOW_[API_][DIS]CONNECT

...

Buffers will be queued after being filled using the CPU

Variables

This section is empty.

Functions

func Finalize

func Finalize()

func GFXSlowSwizzlingBlit

func GFXSlowSwizzlingBlit(buffer []byte, image []byte, w, h, tx, ty int)

func GetVSyncEvent

func GetVSyncEvent() (nxtypes.ReventHandle, error)

func IGBPDequeueBuffer

func IGBPDequeueBuffer(igbp vi.IGBP, width, height uint32, pixelFormat graphics.PixelFormat, usage uint32, getFrameTimestamps bool) (status, slot uint32, fence Fence, outTimestamps *FrameEventHistoryDelta, err error)

func IGBPDisconnect

func IGBPDisconnect(igbp vi.IGBP, api int, mode DisconnectMode) (status int, err error)

func IGBPSetPreallocatedBuffer

func IGBPSetPreallocatedBuffer(igbp vi.IGBP, slot int, gb *GraphicBuffer) error

func Init

func Init() (err error)

Types

type BqRect

type BqRect struct {
	Left   int32
	Top    int32
	Right  int32
	Bottom int32
}

type CompositorTiming

type CompositorTiming struct {
	DeadlineNanoseconds       int64
	InternalNanoseconds       int64
	PresentLatencyNanoseconds int64
}

CompositorTiming https://source.android.com/reference/hidl/android/hardware/graphics/bufferqueue/1.0/IGraphicBufferProducer#compositortiming

type DisconnectMode

type DisconnectMode int
const (
	DisconnectAPI      DisconnectMode = 0
	DisconnectAllLocal DisconnectMode = 1
)

type Fence

type Fence struct {
	IsValid uint32
	Sync    [4]gpu.Fence
}

func UnflattenFence

func UnflattenFence(p *vi.Parcel) (fence Fence, err error)

type Frame

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

func (*Frame) At

func (f *Frame) At(x, y int) color.Color

At returns the color of the pixel at (x, y). At(Bounds().Min.X, Bounds().Min.Y) returns the upper-left pixel of the grid. At(Bounds().Max.X-1, Bounds().Max.Y-1) returns the lower-right one.

func (*Frame) Bounds

func (f *Frame) Bounds() image.Rectangle

Bounds returns the domain for which At can return non-zero color. The bounds do not necessarily contain the point (0, 0).

func (*Frame) Clear

func (f *Frame) Clear(c color.RGBA)

func (*Frame) ColorModel

func (f *Frame) ColorModel() color.Model

ColorModel returns the Image's color model.

func (*Frame) Convert

func (f *Frame) Convert(c color.Color) color.Color

func (*Frame) Destroy

func (f *Frame) Destroy() error

func (*Frame) Display

func (f *Frame) Display() error

func (*Frame) DrawStringAt

func (f *Frame) DrawStringAt(x, y int, data string, c color.RGBA, font *font.Data)

func (*Frame) SetPixel

func (f *Frame) SetPixel(x, y int16, c color.RGBA)

func (*Frame) Size

func (f *Frame) Size() (x, y int16)

func (*Frame) WaitVSync

func (f *Frame) WaitVSync() error

type FrameEventHistoryDelta

type FrameEventHistoryDelta struct {
	CompositorTiming CompositorTiming
}

FrameEventHistoryDelta

Not fully implemented, just enough that it works. https://source.android.com/reference/hidl/android/hardware/graphics/bufferqueue/1.0/IGraphicBufferProducer#frameeventhistorydelta

type GraphicBuffer

type GraphicBuffer struct {
	Width             uint32
	Height            uint32
	Stride            uint32
	Format            graphics.PixelFormat
	Length            uint32
	Usage             uint32
	GPUBuffer         *gpu.Buffer
	Index             int32
	PixelBufferOffset uint32

	NativeHandle *nxtypes.NativeHandle
	GRBuff       *nv.GraphicBuffer
}

GraphicBuffer Graphics Buffer

func IGBPRequestBuffer

func IGBPRequestBuffer(igbp vi.IGBP, slot uint32) (status uint32, gb *GraphicBuffer, err error)

func (*GraphicBuffer) Flatten

func (gb *GraphicBuffer) Flatten(p *vi.Parcel) error

type NativeWindow

type NativeWindow struct {
	Magic uint32

	SlotsConfigured         uint64
	SlotsRequested          uint64
	CurSlot                 int32
	Width                   uint32
	Height                  uint32
	Format                  uint32
	Usage                   uint32
	Crop                    BqRect
	ScalingMode             uint32
	Transform               uint32
	StickyTransform         uint32
	DefaultWidth            uint32
	DefaultHeight           uint32
	SwapInterval            uint32
	IsConnected             bool
	ProducerControlledByApp bool
	ConsumerRunningBehind   bool
	// contains filtered or unexported fields
}

type QueueBufferInput

type QueueBufferInput struct {
	Size            uint32
	NumFds          uint32
	Timestamp       int64
	IsAutoTimestamp int32
	Crop            Rect
	ScalingMode     int32
	Transform       uint32
	StickyTransform uint32
	Unknown         [2]uint32
	Fence           Fence
}

QueueBufferInput Parameters passed to queueBuffer https://source.android.com/reference/hidl/android/hardware/graphics/bufferqueue/1.0/IGraphicBufferProducer#queuebufferinput

func (*QueueBufferInput) Flatten

func (qbi *QueueBufferInput) Flatten(p *vi.Parcel)

type QueueBufferOutput

type QueueBufferOutput struct {
	Width             uint32
	Height            uint32
	TransformHint     uint32
	NumPendingBuffers uint32
	NextFrameNumber   uint32
	BufferReplaced    bool
	FrameTimestamps   FrameEventHistoryDelta
}

QueueBufferOutput Values received back from queueBuffer https://source.android.com/reference/hidl/android/hardware/graphics/bufferqueue/1.0/IGraphicBufferProducer#queuebufferoutput

func IGBPConnect

func IGBPConnect(igbp vi.IGBP, api int, producerControlledByApp bool) (status int, qbo *QueueBufferOutput, err error)

func IGBPQueueBuffer

func IGBPQueueBuffer(igbp vi.IGBP, slot int, qbi *QueueBufferInput) (qbo *QueueBufferOutput, status int, err error)

func UnflattenQueueBufferOutput

func UnflattenQueueBufferOutput(p *vi.Parcel) (qbo *QueueBufferOutput, err error)

type Rect

type Rect struct {
	Left   uint32
	Top    uint32
	Right  uint32
	Bottom uint32
}

Rect A simple rectangle

type Surface

type Surface struct {
	LayerId         uint64
	IGBP            vi.IGBP
	IGBPIsConnected bool
	State           SurfaceState
	HasRequested    []bool
	CurrentSlot     uint32

	GpuBuffer            *gpu.Buffer
	GpuBufferMemory      []byte
	GpuBufferMemoryAlloc uintptr
	GraphicBuffers       []GraphicBuffer
	CurrentFence         Fence
	GRBuff               *nv.GraphicBuffer
	// contains filtered or unexported fields
}

func OpenLayer

func OpenLayer() (surface *Surface, err error)

func SurfaceCreate

func SurfaceCreate(layerId uint64, igbp vi.IGBP) (surface *Surface, status int, err error)

func (*Surface) CloseLayer

func (s *Surface) CloseLayer() error

func (*Surface) Connect

func (s *Surface) Connect() (int, error)

func (*Surface) DequeueBuffer

func (s *Surface) DequeueBuffer() ([]byte, error)

func (*Surface) Destroy

func (s *Surface) Destroy()

func (*Surface) Disconnect

func (s *Surface) Disconnect()

func (*Surface) GetFrame

func (s *Surface) GetFrame() (*Frame, error)

GetFrame returns a frame to be draw on screen

func (*Surface) QueueBuffer

func (s *Surface) QueueBuffer() error

type SurfaceState

type SurfaceState int

SurfaceState Keeps track of the internal state of a \ref surface_t

const (
	SURFACE_STATE_INVALID  SurfaceState = iota
	SURFACE_STATE_DEQUEUED SurfaceState = iota
	SURFACE_STATE_QUEUED   SurfaceState = iota
)

Jump to

Keyboard shortcuts

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