blob: 6b478e316684f91385488b040970a7de61557b74 [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.hardware.isp;
using zx;
using fuchsia.hardware.camera;
using fuchsia.hardware.camerahwaccel;
using fuchsia.sysmem;
type StreamType = strict enum : uint8 {
INVALID = 0;
FULL_RESOLUTION = 1;
DOWNSCALED = 2;
SCALAR = 3;
};
@transport("Banjo")
@banjo_layout("ddk-callback")
closed protocol IspStreamShutdownCallback {
// This is called by the ISP after completing all cleanup of a stream.
strict ShutdownComplete(struct {
status zx.Status;
});
};
@transport("Banjo")
@banjo_layout("ddk-protocol")
closed protocol OutputStream {
// Starts the streaming of frames.
strict Start() -> (struct {
s zx.Status;
});
// Stops the streaming of frames.
strict Stop() -> (struct {
s zx.Status;
});
// Unlocks the specified frame, allowing the driver to reuse the memory.
strict ReleaseFrame(struct {
buffer_id uint32;
}) -> (struct {
s zx.Status;
});
// Shutdown the stream and release all resources that are no longer needed.
// |shutdown_callback| : Informs the caller that all cleanup is complete.
strict Shutdown(resource struct {
shutdown_callback client_end:IspStreamShutdownCallback;
}) -> (struct {
s zx.Status;
});
};
@transport("Banjo")
@banjo_layout("ddk-protocol")
closed protocol Isp {
// The driver returns the Stream protocol for this particular stream.
// |buffer_collection| : Hold the format and pool of VMOs that the ISP will
// produce
// |image_format| : The format of the image data in the output stream
// |rate| : The desired frame rate for the stream
// |type| : The type of stream to produce
// |frame_callback| : The protocol which calls a function when the ISP is done
// writing to a buffer.
// @Returns: |status| : indicates if the stream was created.
// @Returns: |st| : Protocol over which the flow of frames is controlled.
strict CreateOutputStream(resource struct {
buffer_collection fuchsia.sysmem.BufferCollectionInfo_2;
image_format fuchsia.sysmem.ImageFormat_2;
rate fuchsia.hardware.camera.FrameRate;
type StreamType;
frame_callback client_end:fuchsia.hardware.camerahwaccel.HwAccelFrameCallback;
}) -> (resource struct {
s zx.Status;
st client_end:OutputStream;
});
// Configures the ISP to provide the streams with frame rate
// within the given range.
// |min_frame_rate| : Minimum allowed frame rate.
// |max_frame_rate| : Maximum allowed frame rate.
// Returns:
// ZX_ERR_NOT_SUPPORTED if sensor doesn't support a specific frame rate.
strict SetFrameRateRange(struct {
min_frame_rate fuchsia.hardware.camera.FrameRate;
max_frame_rate fuchsia.hardware.camera.FrameRate;
}) -> (struct {
s zx.Status;
});
/// Changes the vendor-defined test pattern mode and sets any associated data.
/// |mode| The test pattern to use. A value of 0 disables it.
/// |data| Data associated with the mode, if applicable.
/// Returns ZX_OK if the mode was successfully applied.
/// Returns ZX_ERR_INVALID_ARGS if |mode| is invalid
/// or if |data| is invalid for the given |mode|.
strict SetTestPattern(struct {
mode uint8;
data vector<uint8>:MAX;
}) -> (struct {
s zx.Status;
});
/// Sets the ISP driver's idea of default sensor mode.
strict SetDefaultSensorMode(struct {
mode uint32;
}) -> (struct {
status zx.Status;
});
};