| // 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 ddk.protocol.isp; |
| |
| using zx; |
| using ddk.protocol.camera; |
| using ddk.protocol.camerahwaccel; |
| using zircon.device.sysmem; |
| |
| enum StreamType : uint8 { |
| INVALID = 0; |
| FULL_RESOLUTION = 1; |
| DOWNSCALED = 2; |
| SCALAR = 3; |
| }; |
| |
| [Layout = "ddk-callback"] |
| protocol IspStreamShutdownCallback { |
| // This is called by the ISP after completing all cleanup of a stream. |
| ShutdownComplete(zx.status status); |
| }; |
| |
| [Layout = "ddk-protocol"] |
| protocol OutputStream { |
| // Starts the streaming of frames. |
| Start() -> (zx.status s); |
| |
| // Stops the streaming of frames. |
| Stop() -> (zx.status s); |
| |
| // Unlocks the specified frame, allowing the driver to reuse the memory. |
| ReleaseFrame(uint32 buffer_id) -> (zx.status s); |
| |
| // Shutdown the stream and release all resources that are no longer needed. |
| // |shutdown_callback| : Informs the caller that all cleanup is complete. |
| Shutdown(IspStreamShutdownCallback shutdown_callback) -> (zx.status s); |
| }; |
| |
| [Layout = "ddk-protocol"] |
| 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. |
| CreateOutputStream(zircon.device.sysmem.BufferCollectionInfo_2 buffer_collection, |
| zircon.device.sysmem.ImageFormat_2 image_format, |
| ddk.protocol.camera.FrameRate rate, StreamType type, |
| ddk.protocol.camerahwaccel.HwAccelFrameCallback frame_callback) |
| -> (zx.status s, OutputStream st); |
| |
| // 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. |
| SetFrameRateRange(ddk.protocol.camera.FrameRate min_frame_rate, |
| ddk.protocol.camera.FrameRate max_frame_rate) |
| -> (zx.status s); |
| |
| /// 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|. |
| SetTestPattern(uint8 mode, vector<uint8> data) -> (zx.status s); |
| }; |