diff options
author | HyunKyung Kim <hk310.kim@samsung.com> | 2019-08-12 15:33:49 +0900 |
---|---|---|
committer | HyunKyung Kim <hk310.kim@samsung.com> | 2019-08-19 11:22:48 +0900 |
commit | 83672bdc77e49d421a050346a3d45d4dc5a27f21 (patch) | |
tree | c6afe6baaf606c1d8cba87ad963567a9cc801e20 /include | |
parent | 89ef144f8ea1dd8abc472a1c11bdf193c55ac316 (diff) |
Add initial source code
Change-Id: I2204df57ef88b5f4b6a07ce9d6fa0e3ee644c3e2
Signed-off-by: HyunKyung Kim <hk310.kim@samsung.com>
Diffstat (limited to 'include')
24 files changed, 3868 insertions, 0 deletions
diff --git a/include/ExynosBuffer.h b/include/ExynosBuffer.h new file mode 100644 index 0000000..e4c03dc --- /dev/null +++ b/include/ExynosBuffer.h @@ -0,0 +1,176 @@ +/* + * Copyright@ Samsung Electronics Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +/*! + * \file ExynosBuffer.h + * \brief header file for ExynosBuffer + * \author Sangwoo, Park(sw5771.park@samsung.com) + * \date 2011/06/02 + * + * <b>Revision History: </b> + * - 2010/06/03 : Sangwoo, Park(sw5771.park@samsung.com) \n + * Initial version + * + * - 2012/03/14 : sangwoo.park(sw5771.park@samsung.com) \n + * Change file, struct name to ExynosXXX. + * + * - 2012/10/08 : sangwoo.park(sw5771.park@samsung.com) \n + * Add BUFFER_PLANE_NUM_DEFAULT, and, Increase Buffer as 4. + * + */ + +#ifndef EXYNOS_BUFFER_H_ +#define EXYNOS_BUFFER_H_ + +#include <sys/types.h> + +//! Buffer information +/*! + * \ingroup Exynos + */ +struct ExynosBuffer +{ +public: + //! Buffer type + enum BUFFER_TYPE + { + BUFFER_TYPE_BASE = 0, + BUFFER_TYPE_VIRT = 1 << 0, //!< virtual address + BUFFER_TYPE_PHYS = 1 << 1, //!< physical address + BUFFER_TYPE_FD = 1 << 2, //!< fd address + BUFFER_TYPE_RESERVED = 1 << 3, //!< reserved type + BUFFER_TYPE_MAX, + }; + + //! Buffer plane number + enum BUFFER_PLANE_NUM + { + BUFFER_PLANE_NUM_DEFAULT = 4, + }; + + //! Buffer virtual address + union { + char *p; //! single address. + char *extP[BUFFER_PLANE_NUM_DEFAULT]; //! Y Cb Cr. + } virt; + + //! Buffer physical address + union { + unsigned int p; //! single address. + unsigned int extP[BUFFER_PLANE_NUM_DEFAULT]; //! Y Cb Cr. + } phys; + + //! Buffer file descriptors + union { + int fd; //! single address. + int extFd[BUFFER_PLANE_NUM_DEFAULT]; //! Y Cb Cr. + } fd; + + //! Buffer reserved id + union { + int p; //! \n + int extP[BUFFER_PLANE_NUM_DEFAULT]; //! \n + } reserved; + + //! Buffer size + union { + unsigned int s; + unsigned int extS[BUFFER_PLANE_NUM_DEFAULT]; + } size; + +#ifdef __cplusplus + //! Constructor + ExynosBuffer() + { + for (int i = 0; i < BUFFER_PLANE_NUM_DEFAULT; i++) { + virt. extP [i] = NULL; + phys. extP [i] = 0; + fd. extFd[i] = -1; + reserved.extP [i] = 0; + size. extS [i] = 0; + } + } + + //! Constructor + ExynosBuffer(const ExynosBuffer *other) + { + for (int i = 0; i < BUFFER_PLANE_NUM_DEFAULT; i++) { + virt. extP [i] = other->virt.extP[i]; + phys. extP [i] = other->phys.extP[i]; + fd. extFd[i] = other->fd.extFd[i]; + reserved.extP [i] = other->reserved.extP[i]; + size. extS [i] = other->size.extS[i]; + } + } + + //! Operator(=) override + ExynosBuffer& operator =(const ExynosBuffer &other) + { + for (int i = 0; i < BUFFER_PLANE_NUM_DEFAULT; i++) { + virt. extP [i] = other.virt.extP[i]; + phys. extP [i] = other.phys.extP[i]; + fd. extFd[i] = other.fd.extFd[i]; + reserved.extP [i] = other.reserved.extP[i]; + size. extS [i] = other.size.extS[i]; + } + return *this; + } + + //! Operator(==) override + bool operator ==(const ExynosBuffer &other) const + { + bool ret = true; + + for (int i = 0; i < BUFFER_PLANE_NUM_DEFAULT; i++) { + if ( virt. extP [i] != other.virt. extP[i] + || phys. extP [i] != other.phys. extP[i] + || fd. extFd[i] != other.fd. extFd[i] + || reserved.extP [i] != other.reserved.extP[i] + || size. extS [i] != other.size. extS[i]) { + ret = false; + break; + } + } + + return ret; + } + + //! Operator(!=) override + bool operator !=(const ExynosBuffer &other) const + { + // use operator(==) + return !(*this == other); + } + + //! Get Buffer type + static int BUFFER_TYPE(ExynosBuffer *buf) + { + int type = BUFFER_TYPE_BASE; + if (buf->virt.p) + type |= BUFFER_TYPE_VIRT; + if (buf->phys.p) + type |= BUFFER_TYPE_PHYS; + if (buf->fd.fd >= 0) + type |= BUFFER_TYPE_FD; + if (buf->reserved.p) + type |= BUFFER_TYPE_RESERVED; + + return type; + } +#endif +}; + +#endif //EXYNOS_BUFFER_H_ diff --git a/include/ExynosExif.h b/include/ExynosExif.h new file mode 100644 index 0000000..32efd71 --- /dev/null +++ b/include/ExynosExif.h @@ -0,0 +1,285 @@ +/* + * Copyright Samsung Electronics Co.,LTD. + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// To prevent build conflict with the previous libhwjpeg +#ifndef __HARDWARE_EXYNOS_EXYNOS_EXIF_H__ +#define __HARDWARE_EXYNOS_EXYNOS_EXIF_H__ + +#include <math.h> + +#include <sys/types.h> + +#define EXIF_LOG2(x) (log((double)(x)) / log(2.0)) +#define APEX_FNUM_TO_APERTURE(x) ((EXIF_LOG2((double)(x))) * 2.0) +#define APEX_EXPOSURE_TO_SHUTTER(x) ((x) >= 1 ? \ + (int)(-(EXIF_LOG2((double)(x)) + 0.5)) : \ + (int)(-(EXIF_LOG2((double)(x)) - 0.5))) +#define APEX_ISO_TO_FILMSENSITIVITY(x) ((int)(EXIF_LOG2((x) / 3.125) + 0.5)) + +#define NUM_SIZE 2 +#define IFD_SIZE 12 +#define OFFSET_SIZE 4 +#define EXIF_INFO_LIMIT_SIZE 12288 + +#define NUM_0TH_IFD_TIFF 10 +#define NUM_0TH_IFD_EXIF 29 +#define NUM_0TH_IFD_INTEROPERABILITY (2) +#define NUM_0TH_IFD_GPS 10 +#define NUM_1TH_IFD_TIFF 9 + +/* Type */ +#define EXIF_TYPE_BYTE 1 +#define EXIF_TYPE_ASCII 2 +#define EXIF_TYPE_SHORT 3 +#define EXIF_TYPE_LONG 4 +#define EXIF_TYPE_RATIONAL 5 +#define EXIF_TYPE_UNDEFINED 7 +#define EXIF_TYPE_SLONG 9 +#define EXIF_TYPE_SRATIONAL 10 + +#define EXIF_FILE_SIZE 28800 + +/* 0th IFD TIFF Tags */ +#define EXIF_TAG_IMAGE_WIDTH 0x0100 +#define EXIF_TAG_IMAGE_HEIGHT 0x0101 +#define EXIF_TAG_MAKE 0x010f +#define EXIF_TAG_MODEL 0x0110 +#define EXIF_TAG_ORIENTATION 0x0112 +#define EXIF_TAG_SOFTWARE 0x0131 +#define EXIF_TAG_DATE_TIME 0x0132 +#define EXIF_TAG_YCBCR_POSITIONING 0x0213 +#define EXIF_TAG_EXIF_IFD_POINTER 0x8769 +#define EXIF_TAG_GPS_IFD_POINTER 0x8825 + +/* 0th IFD Exif Private Tags */ +#define EXIF_TAG_EXPOSURE_TIME 0x829A +#define EXIF_TAG_FNUMBER 0x829D +#define EXIF_TAG_EXPOSURE_PROGRAM 0x8822 +#define EXIF_TAG_ISO_SPEED_RATING 0x8827 +#define EXIF_TAG_EXIF_VERSION 0x9000 +#define EXIF_TAG_DATE_TIME_ORG 0x9003 +#define EXIF_TAG_DATE_TIME_DIGITIZE 0x9004 +#define EXIF_TAG_COMPONENTS_CONFIGURATION 0x9101 +#define EXIF_TAG_SHUTTER_SPEED 0x9201 +#define EXIF_TAG_APERTURE 0x9202 +#define EXIF_TAG_BRIGHTNESS 0x9203 +#define EXIF_TAG_EXPOSURE_BIAS 0x9204 +#define EXIF_TAG_MAX_APERTURE 0x9205 +#define EXIF_TAG_METERING_MODE 0x9207 +#define EXIF_TAG_FLASH 0x9209 +#define EXIF_TAG_FOCAL_LENGTH 0x920A +#define EXIF_TAG_MAKER_NOTE 0x927C +#define EXIF_TAG_USER_COMMENT 0x9286 +#define EXIF_TAG_SUBSEC_TIME 0x9290 +#define EXIF_TAG_SUBSEC_TIME_ORIG 0x9291 +#define EXIF_TAG_SUBSEC_TIME_DIG 0x9292 +#define EXIF_TAG_FLASHPIX_VERSION 0xA000 +#define EXIF_TAG_COLOR_SPACE 0xA001 +#define EXIF_TAG_PIXEL_X_DIMENSION 0xA002 +#define EXIF_TAG_PIXEL_Y_DIMENSION 0xA003 +#define EXIF_TAG_RELATED_SOUND_FILE 0xA004 +#define EXIF_TAG_INTEROPERABILITY 0xA005 +#define EXIF_TAG_SCENE_TYPE 0xA301 +#define EXIF_TAG_CUSTOM_RENDERED 0xA401 +#define EXIF_TAG_EXPOSURE_MODE 0xA402 +#define EXIF_TAG_WHITE_BALANCE 0xA403 +#define EXIF_TAG_DIGITAL_ZOOM_RATIO 0xA404 +#define EXIF_TAG_FOCA_LENGTH_IN_35MM_FILM 0xA405 +#define EXIF_TAG_SCENCE_CAPTURE_TYPE 0xA406 +#define EXIF_TAG_CONTRAST 0xA408 +#define EXIF_TAG_SATURATION 0xA409 +#define EXIF_TAG_SHARPNESS 0xA40A +#define EXIF_TAG_IMAGE_UNIQUE_ID 0xA420 + +/* 0th IFD Interoperability Info Tags */ +#define EXIF_TAG_INTEROPERABILITY_INDEX 0x0001 +#define EXIF_TAG_INTEROPERABILITY_VERSION 0x0002 + +/* 0th IFD GPS Info Tags */ +#define EXIF_TAG_GPS_VERSION_ID 0x0000 +#define EXIF_TAG_GPS_LATITUDE_REF 0x0001 +#define EXIF_TAG_GPS_LATITUDE 0x0002 +#define EXIF_TAG_GPS_LONGITUDE_REF 0x0003 +#define EXIF_TAG_GPS_LONGITUDE 0x0004 +#define EXIF_TAG_GPS_ALTITUDE_REF 0x0005 +#define EXIF_TAG_GPS_ALTITUDE 0x0006 +#define EXIF_TAG_GPS_TIMESTAMP 0x0007 +#define EXIF_TAG_GPS_PROCESSING_METHOD 0x001B +#define EXIF_TAG_GPS_DATESTAMP 0x001D + +/* 1th IFD TIFF Tags */ +#define EXIF_TAG_COMPRESSION_SCHEME 0x0103 +#define EXIF_TAG_X_RESOLUTION 0x011A +#define EXIF_TAG_Y_RESOLUTION 0x011B +#define EXIF_TAG_RESOLUTION_UNIT 0x0128 +#define EXIF_TAG_JPEG_INTERCHANGE_FORMAT 0x0201 +#define EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LEN 0x0202 + +typedef enum { + EXIF_ORIENTATION_UP = 1, + EXIF_ORIENTATION_90 = 6, + EXIF_ORIENTATION_180 = 3, + EXIF_ORIENTATION_270 = 8, +} ExifOrientationType; + +typedef enum { + EXIF_SCENE_STANDARD, + EXIF_SCENE_LANDSCAPE, + EXIF_SCENE_PORTRAIT, + EXIF_SCENE_NIGHT, +} CamExifSceneCaptureType; + +typedef enum { + EXIF_METERING_UNKNOWN, + EXIF_METERING_AVERAGE, + EXIF_METERING_CENTER, + EXIF_METERING_SPOT, + EXIF_METERING_MULTISPOT, + EXIF_METERING_PATTERN, + EXIF_METERING_PARTIAL, + EXIF_METERING_OTHER = 255, +} CamExifMeteringModeType; + +typedef enum { + EXIF_EXPOSURE_AUTO, + EXIF_EXPOSURE_MANUAL, + EXIF_EXPOSURE_AUTO_BRACKET, +} CamExifExposureModeType; + +typedef enum { + EXIF_WB_AUTO, + EXIF_WB_MANUAL, + EXIF_WB_INCANDESCENT, + EXIF_WB_FLUORESCENT, + EXIF_WB_DAYLIGHT, + EXIF_WB_CLOUDY, +} CamExifWhiteBalanceType; + +/* Values */ +#define EXIF_DEF_MAKER "Samsung Electronics Co., Ltd." /* testJpegExif on the CTS test. This should match Build.MANUFACTURER */ +#define EXIF_DEF_MODEL "SAMSUNG" +#define EXIF_DEF_SOFTWARE "SAMSUNG" +#define EXIF_DEF_EXIF_VERSION "0220" +#define EXIF_DEF_USERCOMMENTS "User comments" + +#define EXIF_DEF_YCBCR_POSITIONING 1 /* centered */ +#define EXIF_DEF_EXPOSURE_MANUAL 1 /* manual program */ +#define EXIF_DEF_EXPOSURE_PROGRAM 2 /* normal program */ +#define EXIF_DEF_FLASH 0 /* O: off, 1: on*/ +#define EXIF_DEF_COLOR_SPACE 1 +#define EXIF_DEF_INTEROPERABILITY (0) +#define EXIF_DEF_EXPOSURE_MODE EXIF_EXPOSURE_AUTO +#define EXIF_DEF_APEX_DEN (100) + +#define EXIF_DEF_COMPRESSION 6 +#define EXIF_DEF_RESOLUTION_NUM 72 +#define EXIF_DEF_RESOLUTION_DEN 1 +#define EXIF_DEF_RESOLUTION_UNIT 2 /* inches */ + +#define APP_MARKER_4 4 +#define APP_MARKER_5 5 + +typedef struct { + uint32_t num; + uint32_t den; +} rational_t; + +typedef struct { + int32_t num; + int32_t den; +} srational_t; + +typedef struct { + bool enableGps; + bool enableThumb; + + char maker[32]; + char model[32]; + char software[32]; + char exif_version[4]; + char date_time[20]; + char sec_time[5]; + unsigned int maker_note_size; + unsigned char *maker_note; + unsigned int user_comment_size; + unsigned char *user_comment; + + uint32_t width; + uint32_t height; + uint32_t widthThumb; + uint32_t heightThumb; + + uint16_t orientation; + uint16_t ycbcr_positioning; + uint16_t exposure_program; + uint16_t iso_speed_rating; + uint16_t metering_mode; + uint16_t flash; + uint16_t color_space; + uint16_t interoperability_index; + uint16_t custom_rendered; + uint16_t contrast; + uint16_t saturation; + uint16_t sharpness; + + uint16_t exposure_mode; + uint16_t white_balance; + uint16_t focal_length_in_35mm_length; + uint16_t scene_capture_type; + char unique_id[30]; + + rational_t exposure_time; + rational_t fnumber; + rational_t aperture; + rational_t max_aperture; + rational_t focal_length; + rational_t digital_zoom_ratio; + + srational_t shutter_speed; + srational_t brightness; + srational_t exposure_bias; + + char gps_latitude_ref[2]; + char gps_longitude_ref[2]; + + uint8_t gps_version_id[4]; + uint8_t gps_altitude_ref; + + rational_t gps_latitude[3]; + rational_t gps_longitude[3]; + rational_t gps_altitude; + rational_t gps_timestamp[3]; + char gps_datestamp[11]; + char gps_processing_method[100]; + + rational_t x_resolution; + rational_t y_resolution; + uint16_t resolution_unit; + uint16_t compression_scheme; +} exif_attribute_t; + +typedef struct { + int num_of_appmarker; /* number of app marker */ + int idx[15][1]; /* idx[number_of_appmarker][appmarker_number] */ + char *debugData[15]; /* 0-base */ + unsigned int debugSize[15]; +} debug_attribute_t; + +bool UpdateDebugData(char *jpeg, size_t jpeglen, debug_attribute_t *debug); +bool UpdateExif(char *jpeg, size_t jpeglen, exif_attribute_t *exif); + +#endif //USES_UNIVERSAL_LIBHWJPEG diff --git a/include/GrallocWrapper.h b/include/GrallocWrapper.h new file mode 100644 index 0000000..a54160a --- /dev/null +++ b/include/GrallocWrapper.h @@ -0,0 +1,125 @@ +/* + * Copyright 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ANDROID_SLSI_GRALLOC2WRAPPER_H +#define ANDROID_SLSI_GRALLOC2WRAPPER_H + +#include <string> + +#include <android/hardware/graphics/allocator/2.0/IAllocator.h> +#include <android/hardware/graphics/mapper/2.0/IMapper.h> +#include <utils/StrongPointer.h> + +namespace android { + +namespace GrallocWrapper { + +using hardware::graphics::allocator::V2_0::IAllocator; +using hardware::graphics::common::V1_0::BufferUsage; +using hardware::graphics::common::V1_0::PixelFormat; +using hardware::graphics::mapper::V2_0::BufferDescriptor; +using hardware::graphics::mapper::V2_0::Error; +using hardware::graphics::mapper::V2_0::IMapper; +using hardware::graphics::mapper::V2_0::YCbCrLayout; + +// A wrapper to IMapper +class Mapper { +public: + Mapper(); + + Error createDescriptor( + const IMapper::BufferDescriptorInfo& descriptorInfo, + BufferDescriptor* outDescriptor) const; + + // Import a buffer that is from another HAL, another process, or is + // cloned. + // + // The returned handle must be freed with freeBuffer. + Error importBuffer(const hardware::hidl_handle& rawHandle, + buffer_handle_t* outBufferHandle) const; + + void freeBuffer(buffer_handle_t bufferHandle) const; + + // The ownership of acquireFence is always transferred to the callee, even + // on errors. + Error lock(buffer_handle_t bufferHandle, uint64_t usage, + const IMapper::Rect& accessRegion, + int acquireFence, void** outData) const; + + // The ownership of acquireFence is always transferred to the callee, even + // on errors. + Error lock(buffer_handle_t bufferHandle, uint64_t usage, + const IMapper::Rect& accessRegion, + int acquireFence, YCbCrLayout* outLayout) const; + + // unlock returns a fence sync object (or -1) and the fence sync object is + // owned by the caller + int unlock(buffer_handle_t bufferHandle) const; + +private: + sp<IMapper> mMapper; +}; + +// A wrapper to IAllocator +class Allocator { +public: + // An allocator relies on a mapper, and that mapper must be alive at all + // time. + Allocator(const Mapper& mapper); + + std::string dumpDebugInfo() const; + + /* + * The returned buffers are already imported and must not be imported + * again. outBufferHandles must point to a space that can contain at + * least "count" buffer_handle_t. + */ + Error allocate(BufferDescriptor descriptor, uint32_t count, + uint32_t* outStride, buffer_handle_t* outBufferHandles) const; + + Error allocate(BufferDescriptor descriptor, + uint32_t* outStride, buffer_handle_t* outBufferHandle) const + { + return allocate(descriptor, 1, outStride, outBufferHandle); + } + + Error allocate(const IMapper::BufferDescriptorInfo& descriptorInfo, uint32_t count, + uint32_t* outStride, buffer_handle_t* outBufferHandles) const + { + BufferDescriptor descriptor; + Error error = mMapper.createDescriptor(descriptorInfo, &descriptor); + if (error == Error::NONE) { + error = allocate(descriptor, count, outStride, outBufferHandles); + } + return error; + } + + Error allocate(const IMapper::BufferDescriptorInfo& descriptorInfo, + uint32_t* outStride, buffer_handle_t* outBufferHandle) const + { + return allocate(descriptorInfo, 1, outStride, outBufferHandle); + } + +private: + const Mapper& mMapper; + sp<IAllocator> mAllocator; +}; + +} // namespace GrallocWrapper + +} // namespace android + +#endif diff --git a/include/VendorVideoAPI.h b/include/VendorVideoAPI.h new file mode 100644 index 0000000..02135cf --- /dev/null +++ b/include/VendorVideoAPI.h @@ -0,0 +1,129 @@ +/* + * + * Copyright 2017 Samsung Electronics S.LSI Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @file VendorVideoAPI.h + * @author TaeHwan Kim (t_h_kim@samsung.com) + * ByungGwan Kang (bk0917.kang@samsung.com) + * @version 1.0 + * @history + * 2017.06.02 : Create + */ + +#ifndef VENDOR_VIDEO_API_H_ +#define VENDOR_VIDEO_API_H_ + +#include <stdio.h> + +typedef enum _ExynosVideoInfoType { + VIDEO_INFO_TYPE_INVALID = 0, + VIDEO_INFO_TYPE_HDR_STATIC = 0x1 << 0, + VIDEO_INFO_TYPE_COLOR_ASPECTS = 0x1 << 1, + VIDEO_INFO_TYPE_INTERLACED = 0x1 << 2, + VIDEO_INFO_TYPE_YSUM_DATA = 0x1 << 3, + VIDEO_INFO_TYPE_HDR_DYNAMIC = 0x1 << 4, +} ExynosVideoInfoType; + +typedef struct _ExynosVideoYSUMData { + unsigned int high; + unsigned int low; +} ExynosVideoYSUMData; + +typedef struct _ExynosColorAspects { + int mRange; + int mPrimaries; + int mTransfer; + int mMatrixCoeffs; +} ExynosColorAspects; + +typedef struct _ExynosPrimaries { + unsigned int x; + unsigned int y; +} ExynosPrimaries; + +typedef struct _ExynosType1 { + ExynosPrimaries mR; + ExynosPrimaries mG; + ExynosPrimaries mB; + ExynosPrimaries mW; + unsigned int mMaxDisplayLuminance; + unsigned int mMinDisplayLuminance; + unsigned int mMaxContentLightLevel; + unsigned int mMaxFrameAverageLightLevel; +} ExynosType1; + +typedef struct _ExynosHdrStaticInfo { + int mID; + union { + ExynosType1 sType1; + }; +} ExynosHdrStaticInfo; + +typedef struct _ExynosHdrDynamicInfo { + unsigned int valid; + + struct { + unsigned char country_code; + unsigned short provider_code; + unsigned short provider_oriented_code; + + unsigned char application_identifier; + unsigned short application_version; + + unsigned int display_maximum_luminance; + + unsigned int maxscl[3]; + + unsigned char num_maxrgb_percentiles; + unsigned char maxrgb_percentages[15]; + unsigned int maxrgb_percentiles[15]; + + struct { + unsigned short tone_mapping_flag; + unsigned short knee_point_x; + unsigned short knee_point_y; + unsigned short num_bezier_curve_anchors; + unsigned short bezier_curve_anchors[15]; + } tone_mapping; + } data; + + unsigned int reserved[42]; +} ExynosHdrDynamicInfo; + +typedef struct _ExynosVideoDecData { + int nInterlacedType; +} ExynosVideoDecData; + +typedef struct _ExynosVideoEncData { + ExynosVideoYSUMData sYsumData; +} ExynosVideoEncData; + +typedef struct _ExynosVideoMeta { + ExynosVideoInfoType eType; + + ExynosHdrStaticInfo sHdrStaticInfo; + ExynosColorAspects sColorAspects; + + union { + ExynosVideoDecData dec; + ExynosVideoEncData enc; + } data; + + ExynosHdrDynamicInfo sHdrDynamicInfo; +} ExynosVideoMeta; + +#endif /* VENDOR_VIDEO_API_H_ */ diff --git a/include/csc.h b/include/csc.h new file mode 100644 index 0000000..98b4652 --- /dev/null +++ b/include/csc.h @@ -0,0 +1,582 @@ +/* + * Copyright (C) 2012 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @file csc.h + * + * @brief color space convertion abstract header + * + * @author Pyoungjae Jung (pjet.jung@samsung.com) + * + * @version 1.0 + * + * @history + * 2011.12.27 : Create + */ + +#ifndef CSC_H +#define CSC_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define CSC_MAX_PLANES 3 + +typedef enum _CSC_ERRORCODE { + CSC_ErrorNone = 0, + CSC_Error, + CSC_ErrorNotInit, + CSC_ErrorInvalidAddress, + CSC_ErrorUnsupportFormat, + CSC_ErrorNotImplemented +} CSC_ERRORCODE; + +typedef enum _CSC_METHOD { + CSC_METHOD_SW = 0, + CSC_METHOD_HW +} CSC_METHOD; + +typedef enum _CSC_HW_PROPERTY_TYPE { + CSC_HW_PROPERTY_FIXED_NODE = 0, + CSC_HW_PROPERTY_MODE_DRM, +} CSC_HW_PROPERTY_TYPE; + +typedef enum _CSC_MEMTYPE { + CSC_MEMORY_MMAP = 1, + CSC_MEMORY_USERPTR, + CSC_MEMORY_OVERLAY, + CSC_MEMORY_DMABUF, + CSC_MEMORY_MFC, +} CSC_MEMTYPE; + +typedef enum _CSC_HW_ID { + CSC_HW_GSC0 = 0, + CSC_HW_GSC1, + CSC_HW_GSC2, + CSC_HW_GSC3, + CSC_HW_SC0, + CSC_HW_SC1, + CSC_HW_SC2, + CSC_HW_MAX, +} CSC_HW_ID; + +typedef enum _CSC_PLANE { + CSC_Y_PLANE = 0, + CSC_RGB_PLANE = 0, + CSC_U_PLANE = 1, + CSC_UV_PLANE = 1, + CSC_V_PLANE = 2 +} CSC_PLANE; + +typedef enum _CSC_HW_TYPE { + CSC_HW_TYPE_FIMC = 0, + CSC_HW_TYPE_GSCALER +} CSC_HW_TYPE; + +typedef enum _CSC_EQ_MODE { + CSC_EQ_MODE_USER = 0, + CSC_EQ_MODE_AUTO +} CSC_EQ_MODE; + +typedef enum _CSC_EQ_COLORSPACE { + CSC_EQ_COLORSPACE_SMPTE170M = 1, + CSC_EQ_COLORSPACE_SMPTE240M = 2, + CSC_EQ_COLORSPACE_REC709 = 3, + CSC_EQ_COLORSPACE_BT878 = 4, + CSC_EQ_COLORSPACE_470_SYSTEM_M = 5, + CSC_EQ_COLORSPACE_470_SYSTEM_BG = 6, + CSC_EQ_COLORSPACE_BT2020 = 10, +} CSC_EQ_COLORSPACE; + +typedef enum _CSC_EQ_RANGE { + CSC_EQ_RANGE_NARROW = 0, + CSC_EQ_RANGE_FULL +} CSC_EQ_RANGE; + +typedef enum _CSC_HW_FILTER { + CSC_FT_NONE = 0, + CSC_FT_BLUR, + CSC_FT_240, + CSC_FT_480, + CSC_FT_720, + CSC_FT_960, + CSC_FT_1080, + CSC_FT_MAX +} CSC_HW_FILTER; + +typedef struct _CSC_FORMAT { + unsigned int width; + unsigned int height; + unsigned int crop_left; + unsigned int crop_top; + unsigned int crop_width; + unsigned int crop_height; + unsigned int color_format; + unsigned int cacheable; + unsigned int mode_drm; +} CSC_FORMAT; + +typedef struct _CSC_BUFFER { + void *planes[CSC_MAX_PLANES]; + int mem_type; +} CSC_BUFFER; + +typedef struct _CSC_HW_PROPERTY { + int fixed_node; + int mode_drm; +} CSC_HW_PROPERTY; + +typedef struct _CSC_HANDLE { + CSC_FORMAT dst_format; + CSC_FORMAT src_format; + CSC_BUFFER dst_buffer; + CSC_BUFFER src_buffer; + CSC_METHOD csc_method; + CSC_HW_TYPE csc_hw_type; + void *csc_hw_handle; + CSC_HW_PROPERTY hw_property; + + /* CSC Equation */ + CSC_EQ_MODE csc_mode; + CSC_EQ_RANGE csc_range; + CSC_EQ_COLORSPACE colorspace; + + /* Denoising filter */ + CSC_HW_FILTER filter; + + unsigned int frame_rate; +} CSC_HANDLE; + +/* + * change hal pixel format to omx pixel format + * + * @param hal_format + * hal pixel format[in] + * + * @return + * omx pixel format + */ +unsigned int hal_2_omx_pixel_format( + unsigned int hal_format); + +/* + * change omx pixel format to hal pixel format + * + * @param hal_format + * omx pixel format[in] + * + * @return + * hal pixel format + */ +unsigned int omx_2_hal_pixel_format( + unsigned int omx_format); + +/* + * Init CSC handle + * + * @return + * csc handle + */ +void *csc_init( + CSC_METHOD method); + +/* + * Deinit CSC handle + * + * @param handle + * CSC handle[in] + * + * @return + * error code + */ +CSC_ERRORCODE csc_deinit( + void *handle); + +/* + * get color space converter method + * + * @param handle + * CSC handle[in] + * + * @param method + * CSC method[out] + * + * @return + * error code + */ +CSC_ERRORCODE csc_get_method( + void *handle, + CSC_METHOD *method); + +/* + * set color space converter method + * + * @param handle + * CSC handle[in] + * + * @param method + * CSC method[in] + * + * @return + * error code + */ +CSC_ERRORCODE csc_set_method( + void *handle, + CSC_METHOD method); + +/* + * Set hw property + * + * @param handle + * CSC handle[in] + * + * @param property + * csc hw property[in] + * + * @param value + * csc hw property value[in] + * + * @return + * csc handle + */ +CSC_ERRORCODE csc_set_hw_property( + void *handle, + CSC_HW_PROPERTY_TYPE property, + int value); + +/* + * Get csc equation property. + * + * @param handle + * CSC handle[in] + * + * @param mode + * csc equation mode[out] + * + * @param colorspace + * csc color space[out] + * + * @param range + * csc equation range[out] + * + * @return + * error code + */ +CSC_ERRORCODE csc_get_eq_property( + void *handle, + CSC_EQ_MODE *csc_mode, + CSC_EQ_RANGE *csc_range, + CSC_EQ_COLORSPACE *colorspace); + +/* + * Set csc equation property. + * + * @param handle + * CSC handle[in] + * + * @param mode + * csc equation mode[in] + * + * @param colorspace + * csc color space[in] + * + * @param range + * csc equation range[in] + * + * @return + * error code + */ +CSC_ERRORCODE csc_set_eq_property( + void *handle, + CSC_EQ_MODE csc_mode, + CSC_EQ_RANGE csc_range, + CSC_EQ_COLORSPACE colorspace); + +/* + * Set csc filter property. + * + * @param handle + * CSC handle[in] + * + * @param filter + * csc filter info[in] + * + * @return + * error code + */ +CSC_ERRORCODE csc_set_filter_property( + void *handle, + CSC_HW_FILTER filter); + +/* + * Set framerate. + * + * @param handle + * CSC handle[in] + * + * @param frame_rate + * frame rate[in] + * + * @return + * error code + */ +CSC_ERRORCODE csc_set_framerate( + void *handle, + unsigned int frame_rate); + +/* + * Get source format. + * + * @param handle + * CSC handle[in] + * + * @param width + * address of image width[out] + * + * @param height + * address of image height[out] + * + * @param crop_left + * address of image left crop size[out] + * + * @param crop_top + * address of image top crop size[out] + * + * @param crop_width + * address of cropped image width[out] + * + * @param crop_height + * address of cropped image height[out] + * + * @param color_format + * address of source color format(HAL format)[out] + * + * @return + * error code + */ +CSC_ERRORCODE csc_get_src_format( + void *handle, + unsigned int *width, + unsigned int *height, + unsigned int *crop_left, + unsigned int *crop_top, + unsigned int *crop_width, + unsigned int *crop_height, + unsigned int *color_format, + unsigned int *cacheable); + +/* + * Set source format. + * Don't call each converting time. + * Pls call this function as below. + * 1. first converting time + * 2. format is changed + * + * @param handle + * CSC handle[in] + * + * @param width + * image width[in] + * + * @param height + * image height[in] + * + * @param crop_left + * image left crop size[in] + * + * @param crop_top + * image top crop size[in] + * + * @param crop_width + * cropped image width[in] + * + * @param crop_height + * cropped image height[in] + * + * @param color_format + * source color format(HAL format)[in] + * + * @return + * error code + */ +CSC_ERRORCODE csc_set_src_format( + void *handle, + unsigned int width, + unsigned int height, + unsigned int crop_left, + unsigned int crop_top, + unsigned int crop_width, + unsigned int crop_height, + unsigned int color_format, + unsigned int cacheable); + +/* + * Get destination format. + * + * @param handle + * CSC handle[in] + * + * @param width + * address of image width[out] + * + * @param height + * address of image height[out] + * + * @param crop_left + * address of image left crop size[out] + * + * @param crop_top + * address of image top crop size[out] + * + * @param crop_width + * address of cropped image width[out] + * + * @param crop_height + * address of cropped image height[out] + * + * @param color_format + * address of color format(HAL format)[out] + * + * @return + * error code + */ +CSC_ERRORCODE csc_get_dst_format( + void *handle, + unsigned int *width, + unsigned int *height, + unsigned int *crop_left, + unsigned int *crop_top, + unsigned int *crop_width, + unsigned int *crop_height, + unsigned int *color_format, + unsigned int *cacheable); + +/* + * Set destination format + * Don't call each converting time. + * Pls call this function as below. + * 1. first converting time + * 2. format is changed + * + * @param handle + * CSC handle[in] + * + * @param width + * image width[in] + * + * @param height + * image height[in] + * + * @param crop_left + * image left crop size[in] + * + * @param crop_top + * image top crop size[in] + * + * @param crop_width + * cropped image width[in] + * + * @param crop_height + * cropped image height[in] + * + * @param color_format + * destination color format(HAL format)[in] + * + * @return + * error code + */ +CSC_ERRORCODE csc_set_dst_format( + void *handle, + unsigned int width, + unsigned int height, + unsigned int crop_left, + unsigned int crop_top, + unsigned int crop_width, + unsigned int crop_height, + unsigned int color_format, + unsigned int cacheable); + +/* + * Setup source buffer + * set_format func should be called before this this func. + * + * @param handle + * CSC handle[in] + * + * @param src_buffer + * source buffer pointer array[in] + * + * @param y + * y or RGB destination pointer[in] + * + * @param u + * u or uv destination pointer[in] + * + * @param v + * v or none destination pointer[in] + * + * @return + * error code + */ +CSC_ERRORCODE csc_set_src_buffer( + void *handle, + void *addr[CSC_MAX_PLANES], + int mem_type); + +/* + * Setup destination buffer + * + * @param handle + * CSC handle[in] + * + * @param y + * y or RGB destination pointer[in] + * + * @param u + * u or uv destination pointer[in] + * + * @param v + * v or none destination pointer[in] + * + * @return + * error code + */ +CSC_ERRORCODE csc_set_dst_buffer( + void *handle, + void *addr[CSC_MAX_PLANES], + int mem_type); + +/* + * Convert color space with presetup color format + * + * @param handle + * CSC handle[in] + * + * @return + * error code + */ +CSC_ERRORCODE csc_convert( + void *handle); + +CSC_ERRORCODE csc_convert_with_rotation( + void *handle, int rotation, int flip_horizontal, int flip_vertical); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/exynos_format.h b/include/exynos_format.h new file mode 100644 index 0000000..97500cf --- /dev/null +++ b/include/exynos_format.h @@ -0,0 +1,227 @@ +/* + * Copyright@ Samsung Electronics Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef _EXYNOS_FORMAT_H_ +#define _EXYNOS_FORMAT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + /* HAL_PIXEL_FORMAT_YCbCr_422_P = 0x100, */ + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P_M = 0x101, /* HAL_PIXEL_FORMAT_YCbCr_420_P */ + /* HAL_PIXEL_FORMAT_YCbCr_420_I = 0x102, */ + HAL_PIXEL_FORMAT_EXYNOS_CbYCrY_422_I = 0x103, /* HAL_PIXEL_FORMAT_CbYCrY_422_I */ + /* HAL_PIXEL_FORMAT_CbYCrY_420_I = 0x104, */ + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M = 0x105, /* HAL_PIXEL_FORMAT_YCbCr_420_SP */ + HAL_PIXEL_FORMAT_EXYNOS_YCrCb_422_SP = 0x106, /* HAL_PIXEL_FORMAT_YCrCb_422_SP */ + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_TILED= 0x107, /* HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED */ + HAL_PIXEL_FORMAT_EXYNOS_ARGB_8888 = 0x108, /* HAL_PIXEL_FORMAT_CUSTOM_ARGB_8888 */ + // support custom format for zero copy + /* HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP = 0x110 */ + /* HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP = 0x111, */ + /* HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED = 0x112, */ + /* HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP = 0x113, */ + /* HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP = 0x114, */ + /* HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I = 0x115, */ + HAL_PIXEL_FORMAT_EXYNOS_YCrCb_422_I = 0x116, /* HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I */ + /* HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I = 0x117, */ + HAL_PIXEL_FORMAT_EXYNOS_CrYCbY_422_I = 0x118, /* HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I */ + /* HAL_PIXEL_FORMAT_CUSTOM_CbYCr_422_I = 0x11B, */ + + HAL_PIXEL_FORMAT_EXYNOS_YV12_M = 0x11C, /* HAL_PIXEL_FORMAT_EXYNOS_YV12 */ + HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M = 0x11D, /* HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP */ + HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M_FULL = 0x11E, /* HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_FULL */ + + /* newly added formats */ + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_P = 0x11F, + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP = 0x120, + + /* EXYNOS_YCbCr_420_SP_M w/ private data buffer */ + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_PRIV = 0x121, + + /* contiguous(single fd) custom formats */ + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_PN = 0x122, + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN = 0x123, + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_TILED = 0x124, + + /* 10-bit format (8bit + separated 2bit) w/ private data buffer */ + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M_S10B = 0x125, + + /* 10-bit contiguous(single fd, 8bit + separated 2bit) custom formats */ + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SPN_S10B = 0x126, + + /* 10-bit format (2 fd, 10bit, 2x byte) custom formats */ + HAL_PIXEL_FORMAT_EXYNOS_YCbCr_P010_M = 0x127, + + HAL_PIXEL_FORMAT_EXYNOS_MAX +}; + +/* for backward compatibility */ +#define HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP HAL_PIXEL_FORMAT_EXYNOS_YCbCr_420_SP_M +#define HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP HAL_PIXEL_FORMAT_EXYNOS_YCrCb_420_SP_M + +// Gamut (colorspace range) +enum { + HAL_PIXEL_GAMUT_DEFAULT = 0, + // Values range 0-255 + HAL_PIXEL_GAMUT_WIDE_8, + // Values range 16-235 + HAL_PIXEL_GAMUT_NARROW_8 +}; + +// Chromaticities (colorspace parameters) +enum { + HAL_PIXEL_CHROMA_DEFAULT = 0, + // BT.601 "Standard Definition" color space + HAL_PIXEL_CHROMA_BT601_8, + // BT.709 "High Definition" color space + HAL_PIXEL_CHROMA_BT709_8 +}; + +struct ADDRS { + unsigned int addr_y; + unsigned int addr_cbcr; + unsigned int buf_idx; + unsigned int reserved; +}; + +/* 12 Y/CbCr 4:2:0 64x32 macroblocks */ +#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2') + +#define ALIGN_UP(x, a) (((x) + (a) - 1) & ~((a) - 1)) +#define ALIGN_DOWN(x, a) ((x) - (x % a)) +#ifndef ALIGN +#define ALIGN(x, a) ALIGN_UP(x, a) +#endif +#ifndef ALIGN_TO_32B +#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5) +#endif +#ifndef ALIGN_TO_128B +#define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7) +#endif +#ifndef ALIGN_TO_8KB +#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13) +#endif + +#define GET_32BPP_FRAME_SIZE(w, h) (((w) * (h)) << 2) +#define GET_24BPP_FRAME_SIZE(w, h) (((w) * (h)) * 3) +#define GET_16BPP_FRAME_SIZE(w, h) (((w) * (h)) << 1) + +/* + * Convert hal_pixel_format to v4l2_pixel_format. + * + * @param hal_pixel_format + * hal_pixel_format[in] + * + * @return + * v4l2_pixel_format + */ +int HAL_PIXEL_FORMAT_2_V4L2_PIX( + int hal_pixel_format); + +/* + * Convert v4l2_pixel_format to hal_pixel_format. + * + * @param v4l2_pixel_format + * v4l2_pixel_format[in] + * + * @return + * hal_pixel_format + */ +int V4L2_PIX_2_HAL_PIXEL_FORMAT( + int v4l2_pixel_format); + +/* + * Get frame_size of hal_pixel_format. + * + * @param hal_pixel_format + * hal_pixel_format[in] + * + * @param width + * width[in] + * + * @param height + * height[in] + * + * @return + * frame_size + */ +unsigned int FRAME_SIZE( + int hal_pixel_format, + int width, + int height); + +int PLANAR_FRAME_SIZE( + int hal_pixel_format, + int width, + int height, + unsigned int *luma_size, + unsigned int *chroma_size); + +int NUM_PLANES(int hal_pixel_format); + + +/* + * Get bpp and plane of v4l2_pixel_format. + * + * @param v4l2_pixel_format + * v4l2_pixel_format[in] + * + * @param bpp + * address of bpp[out] + * + * @param planes + * address of planes[out] + * + * @return + * error code + */ +int V4L2_PIX_2_YUV_INFO( + unsigned int v4l2_pixel_format, + unsigned int *bpp, + unsigned int *planes); + +/* + * Get bpp of v4l2_pixel_format. + * + * @param v4l2_pixel_format + * v4l2_pixel_format[in] + * + * @return + * bpp + */ +int get_yuv_bpp( + unsigned int v4l2_pixel_format); + +/* + * Get plane of v4l2_pixel_format. + * + * @param v4l2_pixel_format + * v4l2_pixel_format[in] + * + * @return + * num of plane + */ +int get_yuv_planes( + unsigned int v4l2_pixel_format); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/exynos_v4l2.h b/include/exynos_v4l2.h new file mode 100644 index 0000000..262cc1f --- /dev/null +++ b/include/exynos_v4l2.h @@ -0,0 +1,208 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/*! + * \file exynos_v4l2.h + * \brief header file for libv4l2 + * \author Jinsung Yang (jsgood.yang@samsung.com) + * \date 2011/12/15 + * + * <b>Revision History: </b> + * - 2011/12/15 : Jinsung Yang (jsgood.yang@samsung.com) \n + * Initial version + * + */ + +/*! + * \defgroup exynos_v4l2 + * \brief API for v4l2 + * \addtogroup Exynos + */ + +#ifndef __EXYNOS_LIB_V4L2_H__ +#define __EXYNOS_LIB_V4L2_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/* V4L2 */ +#include <stdbool.h> +#include "videodev2.h" /* vendor specific videodev2.h */ + +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_open(const char *filename, int oflag, ...); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_open_devname(const char *devname, int oflag, ...); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_close(int fd); +/*! \ingroup exynos_v4l2 */ +bool exynos_v4l2_enuminput(int fd, int index, char *input_name_buf); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_s_input(int fd, int index); +/*! \ingroup exynos_v4l2 */ +bool exynos_v4l2_querycap(int fd, unsigned int need_caps); +/*! \ingroup exynos_v4l2 */ +bool exynos_v4l2_enum_fmt(int fd, enum v4l2_buf_type type, unsigned int fmt); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_g_fmt(int fd, struct v4l2_format *fmt); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_s_fmt(int fd, struct v4l2_format *fmt); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_try_fmt(int fd, struct v4l2_format *fmt); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_reqbufs(int fd, struct v4l2_requestbuffers *req); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_querybuf(int fd, struct v4l2_buffer *buf); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_qbuf(int fd, struct v4l2_buffer *buf); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_dqbuf(int fd, struct v4l2_buffer *buf); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_streamon(int fd, enum v4l2_buf_type type); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_streamoff(int fd, enum v4l2_buf_type type); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_cropcap(int fd, struct v4l2_cropcap *crop); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_g_crop(int fd, struct v4l2_crop *crop); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_s_crop(int fd, struct v4l2_crop *crop); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_g_ctrl(int fd, unsigned int id, int *value); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_s_ctrl(int fd, unsigned int id, int value); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_prepare(int fd, struct v4l2_buffer *arg); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_g_parm(int fd, struct v4l2_streamparm *streamparm); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_s_parm(int fd, struct v4l2_streamparm *streamparm); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_g_ext_ctrl(int fd, struct v4l2_ext_controls *ctrl); +/*! \ingroup exynos_v4l2 */ +int exynos_v4l2_s_ext_ctrl(int fd, struct v4l2_ext_controls *ctrl); + +/* V4L2_SUBDEV */ +#include <v4l2-subdev.h> + +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_open(const char *filename, int oflag, ...); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_get_node_num(const char *devname, int oflag, ...); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_open_devname(const char *devname, int oflag, ...); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_close(int fd); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_enum_frame_size(int fd, struct v4l2_subdev_frame_size_enum *frame_size_enum); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_g_fmt(int fd, struct v4l2_subdev_format *fmt); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_s_fmt(int fd, struct v4l2_subdev_format *fmt); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_g_crop(int fd, struct v4l2_subdev_crop *crop); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_s_crop(int fd, struct v4l2_subdev_crop *crop); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_enum_frame_interval(int fd, struct v4l2_subdev_frame_interval_enum *frame_internval_enum); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_g_frame_interval(int fd, struct v4l2_subdev_frame_interval *frame_internval_enum); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_s_frame_interval(int fd, struct v4l2_subdev_frame_interval *frame_internval_enum); +/*! \ingroup exynos_v4l2 */ +int exynos_subdev_enum_mbus_code(int fd, struct v4l2_subdev_mbus_code_enum *mbus_code_enum); + +/* MEDIA CONTORLLER */ +#include <media.h> + +/*! media_link + * \ingroup exynos_v4l2 + */ +struct media_link { + struct media_pad *source; + struct media_pad *sink; + struct media_link *twin; + __u32 flags; + __u32 padding[3]; +}; + +/*! media_link + * \ingroup exynos_v4l2 + */ +struct media_pad { + struct media_entity *entity; + __u32 index; + __u32 flags; + __u32 padding[3]; +}; + +/*! media_link + * \ingroup exynos_v4l2 + */ +struct media_entity { + struct media_device *media; + struct media_entity_desc info; + struct media_pad *pads; + struct media_link *links; + unsigned int max_links; + unsigned int num_links; + + char devname[32]; + int fd; + __u32 padding[6]; +}; + +/*! media_link + * \ingroup exynos_v4l2 + */ +struct media_device { + int fd; + struct media_entity *entities; + unsigned int entities_count; + void (*debug_handler)(void *, ...); + void *debug_priv; + __u32 padding[6]; +}; + +/*! \ingroup exynos_v4l2 */ +struct media_device *exynos_media_open(const char *filename); +/*! \ingroup exynos_v4l2 */ +void exynos_media_close(struct media_device *media); +/*! \ingroup exynos_v4l2 */ +struct media_pad *exynos_media_entity_remote_source(struct media_pad *pad); +/*! \ingroup exynos_v4l2 */ +struct media_entity *exynos_media_get_entity_by_name(struct media_device *media, const char *name, size_t length); +/*! \ingroup exynos_v4l2 */ +struct media_entity *exynos_media_get_entity_by_id(struct media_device *media, __u32 id); +/*! \ingroup exynos_v4l2 */ +int exynos_media_setup_link(struct media_device *media, struct media_pad *source, struct media_pad *sink, __u32 flags); +/*! \ingroup exynos_v4l2 */ +int exynos_media_reset_links(struct media_device *media); +/*! \ingroup exynos_v4l2 */ +struct media_pad *exynos_media_parse_pad(struct media_device *media, const char *p, char **endp); +/*! \ingroup exynos_v4l2 */ +struct media_link *exynos_media_parse_link(struct media_device *media, const char *p, char **endp); +/*! \ingroup exynos_v4l2 */ +int exynos_media_parse_setup_link(struct media_device *media, const char *p, char **endp); +/*! \ingroup exynos_v4l2 */ +int exynos_media_parse_setup_links(struct media_device *media, const char *p); + +#ifdef __cplusplus +} +#endif + +#endif /* __EXYNOS_LIB_V4L2_H__ */ diff --git a/include/gralloc1_priv.h b/include/gralloc1_priv.h new file mode 100644 index 0000000..7b29e7f --- /dev/null +++ b/include/gralloc1_priv.h @@ -0,0 +1,231 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GRALLOC_PRIV_H_ +#define GRALLOC_PRIV_H_ + +#include <stdint.h> +#include <limits.h> +#include <sys/cdefs.h> +#include <hardware/gralloc1.h> +#include <hardware/hardware.h> +#include <pthread.h> +#include <errno.h> +#include <unistd.h> +#include <cutils/native_handle.h> +#include <log/log.h> +#include <linux/fb.h> +#include <linux/ion.h> + +/* SLSI specific usages */ +#define GRALLOC1_PRODUCER_USAGE_PROTECTED_DPB GRALLOC1_PRODUCER_USAGE_PRIVATE_0 +#define GRALLOC1_PRODUCER_USAGE_PRIVATE_NONSECURE GRALLOC1_PRODUCER_USAGE_PRIVATE_1 +#define GRALLOC1_PRODUCER_USAGE_CAMERA_RESERVED GRALLOC1_PRODUCER_USAGE_PRIVATE_2 +#define GRALLOC1_PRODUCER_USAGE_SECURE_CAMERA_RESERVED GRALLOC1_PRODUCER_USAGE_PRIVATE_3 +#define GRALLOC1_PRODUCER_USAGE_NOZEROED GRALLOC1_PRODUCER_USAGE_PRIVATE_19 + +#define GRALLOC1_CONSUMER_USAGE_YUV_RANGE_FULL GRALLOC1_CONSUMER_USAGE_PRIVATE_4 +#define GRALLOC1_CONSUMER_USAGE_DAYDREAM_SINGLE_BUFFER_MODE GRALLOC1_CONSUMER_USAGE_PRIVATE_5 +#define GRALLOC1_CONSUMER_USAGE_VIDEO_EXT GRALLOC1_CONSUMER_USAGE_PRIVATE_6 +#define GRALLOC1_CONSUMER_USAGE_VIDEO_PRIVATE_DATA GRALLOC1_CONSUMER_USAGE_PRIVATE_7 + +/* for legacy */ +#define GRALLOC_USAGE_PROTECTED_DPB GRALLOC1_PRODUCER_USAGE_PROTECTED_DPB +#define GRALLOC_USAGE_PRIVATE_NONSECURE GRALLOC1_PRODUCER_USAGE_PRIVATE_NONSECURE +#define GRALLOC_USAGE_CAMERA_RESERVED GRALLOC1_PRODUCER_USAGE_CAMERA_RESERVED +#define GRALLOC_USAGE_NOZEROED GRALLOC1_PRODUCER_USAGE_NOZEROED +#define GRALLOC_USAGE_VIDEO_EXT GRALLOC1_CONSUMER_USAGE_VIDEO_EXT +#define GRALLOC_USAGE_DAYDREAM_SINGLE_BUFFER_MODE GRALLOC1_CONSUMER_USAGE_DAYDREAM_SINGLE_BUFFER_MODE +#define GRALLOC_USAGE_YUV_RANGE_FULL GRALLOC1_CONSUMER_USAGE_YUV_RANGE_FULL +#define GRALLOC_USAGE_SECURE_CAMERA_RESERVED GRALLOC1_PRODUCER_USAGE_SECURE_CAMERA_RESERVED + +#define AFBC_INFO_SIZE (sizeof(int)) +#define AFBC_ENABLE (0xafbc) + +typedef struct gralloc1_module_t { + struct hw_module_t common; +} gralloc1_module_t; + +typedef enum{ + MALI_YUV_NO_INFO, + MALI_YUV_BT601_NARROW, + MALI_YUV_BT601_WIDE, + MALI_YUV_BT709_NARROW, + MALI_YUV_BT709_WIDE, + MALI_YUV_BT2020_NARROW, + MALI_YUV_BT2020_WIDE +} mali_gralloc_yuv_info; + +/*****************************************************************************/ + +struct private_module_t; +struct private_handle_t; + +struct private_module_t { + gralloc1_module_t base; + + private_handle_t* framebuffer; + uint32_t flags; + uint32_t numBuffers; + uint32_t bufferMask; + pthread_mutex_t lock; + buffer_handle_t currentBuffer; + int ionfd; + + struct fb_var_screeninfo info; + struct fb_fix_screeninfo finfo; + int xres; + int yres; + int line_length; + float xdpi; + float ydpi; + float fps; + void *queue; + pthread_mutex_t queue_lock; + +}; + +/*****************************************************************************/ + +#ifdef __cplusplus +struct private_handle_t : public native_handle { +#else +struct private_handle_t { + struct native_handle nativeHandle; +#endif + enum { + PRIV_FLAGS_FRAMEBUFFER = 1ULL << 0, + PRIV_FLAGS_USES_UMP = 1ULL << 1, + PRIV_FLAGS_USES_ION = 1ULL << 2, + /* 1ULL << 3, */ + PRIV_FLAGS_USES_2PRIVATE_DATA = 1ULL << 4, + PRIV_FLAGS_USES_3PRIVATE_DATA = 1ULL << 5, + }; + + // file-descriptors + int fd; + int fd1; + int fd2; + // ints + int magic; + int flags; + int size; + int size1; + int size2; + int offset; + int format; + uint64_t internal_format; + int frameworkFormat; + int width; + int height; + int stride; + int byte_stride; + int vstride; + uint64_t producer_usage; + uint64_t consumer_usage; + int allocating_pid; + int remote_pid; + int ref_count; + int writeOwner; + int is_compressible; + int compressed_out; + int prefer_compression; + + int lock_usage; + int lock_offset; + int lock_len; + + mali_gralloc_yuv_info yuv_info; + uint32_t layer_count; + int PRIVATE_1; + int PRIVATE_2; + int PRIVATE_3; + + ion_user_handle_t handle; + ion_user_handle_t handle1; + ion_user_handle_t handle2; + + uint64_t base __attribute__((aligned(8))); + uint64_t base1 __attribute__((aligned(8))); + uint64_t base2 __attribute__((aligned(8))); + +#ifdef __cplusplus + static inline int sNumInts() { + return (((sizeof(private_handle_t) - sizeof(native_handle_t))/sizeof(int)) - sNumFds); + } + static const int sNumFds = 3; + static const int sMagic = 0x3141592; + + private_handle_t(int _fd, int _size, int _flags, uint64_t _producer_usage, uint64_t _consumer_usage) : + fd(_fd), fd1(-1), fd2(-1), magic(sMagic), flags(_flags), size(_size), size1(0), size2(0), + offset(0), format(0), internal_format(0), frameworkFormat(0), + width(0), height(0), stride(0), byte_stride(0), vstride(0), + producer_usage(_producer_usage), consumer_usage(_consumer_usage), allocating_pid(getpid()), + remote_pid(-1), ref_count(1), writeOwner(0), is_compressible(0), compressed_out(0), prefer_compression(0), + lock_usage(0), lock_offset(0), lock_len(0), yuv_info(MALI_YUV_NO_INFO), layer_count(0), + PRIVATE_1(0), PRIVATE_2(0), PRIVATE_3(0), handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0) + { + version = sizeof(native_handle); + numInts = sNumInts() + 2; + numFds = sNumFds -2 ; + } + + private_handle_t(int _fd, int _fd1, int _fd2, int _size, int _size1, int _size2, + int _flags, uint64_t _producer_usage, uint64_t _consumer_usage, + int _w, int _h, int _format, uint64_t _internal_format, int _frameworkFormat, + int _stride, int _byte_stride, int _vstride, int _is_compressible, uint32_t _layer_count) : + fd(_fd), fd1(_fd1), fd2(_fd2), magic(sMagic), flags(_flags), size(_size), size1(_size1), size2(_size2), + offset(0), format(_format), internal_format(_internal_format), frameworkFormat(_frameworkFormat), + width(_w), height(_h), stride(_stride), byte_stride(_byte_stride), vstride(_vstride), + producer_usage(_producer_usage), consumer_usage(_consumer_usage), allocating_pid(getpid()), + remote_pid(-1), ref_count(1), writeOwner(0), is_compressible(_is_compressible), compressed_out(0), prefer_compression(0), + lock_usage(0), lock_offset(0), lock_len(0), yuv_info(MALI_YUV_NO_INFO), layer_count(_layer_count), + PRIVATE_1(0), PRIVATE_2(0), PRIVATE_3(0), handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0) + { + int FDNum = 0; + if(fd1 == -1 and fd2 == -1) FDNum = 2; + if(fd1 != -1 and fd2 == -1) FDNum = 1; + version = sizeof(native_handle); + numInts = sNumInts() + FDNum; + numFds = sNumFds - FDNum; + } + + ~private_handle_t() { + magic = 0; + } + + static int validate(const native_handle* h) { + const private_handle_t* hnd = static_cast<const private_handle_t*>(h); + if (!h || h->version != sizeof(native_handle) || + hnd->numInts + hnd->numFds != sNumInts() + sNumFds || + hnd->magic != sMagic) + { + ALOGE("invalid gralloc handle (at %p)", reinterpret_cast<void *>(const_cast<native_handle *>(h))); + return -EINVAL; + } + return 0; + } + + static private_handle_t* dynamicCast(const native_handle* in) + { + if (validate(in) == 0) + return const_cast<private_handle_t*>(static_cast<const private_handle_t*>(in)); + + return NULL; + } +#endif +}; +#endif /* GRALLOC_PRIV_H_ */ diff --git a/include/gralloc_priv.h b/include/gralloc_priv.h new file mode 100644 index 0000000..ecbbf2a --- /dev/null +++ b/include/gralloc_priv.h @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2013 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GRALLOC_PRIV_H_ +#define GRALLOC_PRIV_H_ + +#include <stdint.h> +#include <limits.h> +#include <sys/cdefs.h> +#include <hardware/gralloc.h> +#include <pthread.h> +#include <errno.h> +#include <unistd.h> +#include <cutils/native_handle.h> +#include <linux/fb.h> +#include <linux/ion.h> + +/* SLSI specific usages */ +#define GRALLOC_USAGE_PROTECTED_DPB 0x00800000U +#define GRALLOC_USAGE_PHYSICALLY_LINEAR 0x01000000U +#define GRALLOC_USAGE_PRIVATE_NONSECURE 0x02000000U +#define GRALLOC_USAGE_CAMERA_RESERVED 0x04000000U +#define GRALLOC_USAGE_NOZEROED 0x08000000U +#define GRALLOC_USAGE_VIDEO_EXT GRALLOC_USAGE_PRIVATE_0 +#define GRALLOC_USAGE_YUV_RANGE_FULL GRALLOC_USAGE_PRIVATE_1 +#define GRALLOC_USAGE_DAYDREAM_SINGLE_BUFFER_MODE GRALLOC_USAGE_PRIVATE_2 +#define GRALLOC_USAGE_SECURE_CAMERA_RESERVED GRALLOC_USAGE_PRIVATE_3 + +#define AFBC_INFO_SIZE (sizeof(int)) +#define AFBC_ENABLE (0xafbc) + +typedef enum{ + MALI_YUV_NO_INFO, + MALI_YUV_BT601_NARROW, + MALI_YUV_BT601_WIDE, + MALI_YUV_BT709_NARROW, + MALI_YUV_BT709_WIDE, + MALI_YUV_BT2020_NARROW, + MALI_YUV_BT2020_WIDE +} mali_gralloc_yuv_info; + +/*****************************************************************************/ + +struct private_module_t; +struct private_handle_t; + +struct private_module_t { + gralloc_module_t base; + + private_handle_t* framebuffer; + uint32_t flags; + uint32_t numBuffers; + uint32_t bufferMask; + pthread_mutex_t lock; + buffer_handle_t currentBuffer; + int ionfd; + + struct fb_var_screeninfo info; + struct fb_fix_screeninfo finfo; + int xres; + int yres; + int line_length; + float xdpi; + float ydpi; + float fps; + void *queue; + pthread_mutex_t queue_lock; + +}; + +/*****************************************************************************/ + +#ifdef __cplusplus +struct private_handle_t : public native_handle { +#else +struct private_handle_t { + struct native_handle nativeHandle; +#endif + enum { + PRIV_FLAGS_FRAMEBUFFER = 0x00000001, + PRIV_FLAGS_USES_UMP = 0x00000002, + PRIV_FLAGS_USES_ION = 0x00000020 + }; + + // file-descriptors + int fd; + int fd1; + int fd2; + // ints + int magic; + int flags; + int size; + int size1; + int size2; + int offset; + int format; + uint64_t internal_format; + int frameworkFormat; + int width; + int height; + int stride; + int vstride; + int is_compressible; + int compressed_out; + int prefer_compression; + + int lock_usage; + int lock_offset; + int lock_len; + + mali_gralloc_yuv_info yuv_info; + int PRIVATE_1; + int PRIVATE_2; + int PRIVATE_3; + int PRIVATE_4; + + ion_user_handle_t handle; + ion_user_handle_t handle1; + ion_user_handle_t handle2; + + uint64_t base __attribute__((aligned(8))); + uint64_t base1 __attribute__((aligned(8))); + uint64_t base2 __attribute__((aligned(8))); + +#ifdef __cplusplus + static inline int sNumInts() { + return (((sizeof(private_handle_t) - sizeof(native_handle_t))/sizeof(int)) - sNumFds); + } + static const int sNumFds = 3; + static const int sMagic = 0x3141592; + + private_handle_t(int _fd, int _size, int _flags) : + fd(_fd), fd1(-1), fd2(-1), magic(sMagic), flags(_flags), size(_size), size1(0), size2(0), + offset(0), format(0), internal_format(0), frameworkFormat(0), width(0), height(0), stride(0), + vstride(0), is_compressible(0), compressed_out(0), prefer_compression(0), + lock_usage(0), lock_offset(0), lock_len(0), yuv_info(MALI_YUV_NO_INFO), PRIVATE_1(0), PRIVATE_2(0), PRIVATE_3(0), PRIVATE_4(0), + handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0) + { + version = sizeof(native_handle); + numInts = sNumInts() + 2; + numFds = sNumFds -2 ; + } + + private_handle_t(int _fd, int _fd1, int _fd2, int _size, int _size1, int _size2, + int _flags, int _w, int _h, int _format, uint64_t _internal_format, int _frameworkFormat, + int _stride, int _vstride, int _is_compressible) : + fd(_fd), fd1(_fd1), fd2(_fd2), magic(sMagic), flags(_flags), size(_size), size1(_size1), size2(_size2), + offset(0), format(_format), internal_format(_internal_format), frameworkFormat(_frameworkFormat), + width(_w), height(_h), stride(_stride), vstride(_vstride), + is_compressible(_is_compressible), compressed_out(0), prefer_compression(0), + lock_usage(0), lock_offset(0), lock_len(0), yuv_info(MALI_YUV_NO_INFO), PRIVATE_1(0), PRIVATE_2(0), PRIVATE_3(0), PRIVATE_4(0), + handle(0), handle1(0), handle2(0), base(0), base1(0), base2(0) + { + int FDNum = 0; + if(fd1 == -1 and fd2 == -1) FDNum = 2; + if(fd1 != -1 and fd2 == -1) FDNum = 1; + version = sizeof(native_handle); + numInts = sNumInts() + FDNum; + numFds = sNumFds - FDNum; + } + + ~private_handle_t() { + magic = 0; + } + + static int validate(const native_handle* h) { + const private_handle_t* hnd = static_cast<const private_handle_t*>(h); + if (!h || h->version != sizeof(native_handle) || + hnd->numInts + hnd->numFds != sNumInts() + sNumFds || + hnd->magic != sMagic) + { + ALOGE("invalid gralloc handle (at %p)", reinterpret_cast<void *>(const_cast<native_handle *>(h))); + return -EINVAL; + } + return 0; + } + + static private_handle_t* dynamicCast(const native_handle* in) + { + if (validate(in) == 0) + return const_cast<private_handle_t*>(static_cast<const private_handle_t*>(in)); + + return NULL; + } +#endif +}; +#endif /* GRALLOC_PRIV_H_ */ diff --git a/include/libaudio/audiohal/audio_definition.h b/include/libaudio/audiohal/audio_definition.h new file mode 100644 index 0000000..b1d2c67 --- /dev/null +++ b/include/libaudio/audiohal/audio_definition.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __EXYNOS_AUDIOHAL_DEFINITION_H__ +#define __EXYNOS_AUDIOHAL_DEFINITION_H__ + +/* This header file has common definitions for AudioHAL and AudioProxy */ + +#define PREDEFINED_CAPTURE_DURATION 2 // 2ms +#define LOW_LATENCY_CAPTURE_SAMPLE_RATE 48000 + +#define MAX_MIXER_LENGTH 256 +#define DEFAULT_MIXER_PATH "/vendor/etc/" +#define DEFAULT_MIXER_FILE "mixer_paths.xml" +#define MIXER_PATH_INFO "/proc/device-tree/sound/mixer-paths" + +// Duration for Normal Capture +#define PREDEFINED_MEDIA_CAPTURE_DURATION 20 // 20ms +#define PREDEFINED_LOW_CAPTURE_DURATION 4 // 4ms + +// Duration for USB Playback and Capture +#define PREDEFINED_USB_PLAYBACK_DURATION 20 // 20ms +#define PREDEFINED_USB_CAPTURE_DURATION 10 // 10ms + + +#define DEFAULT_MEDIA_BIT_WIDTH 16 +#define DEFAULT_MEDIA_SAMPLING_RATE 48000 + +#define UHQA_MEDIA_BIT_WIDTH 24 +#define UHQA_MEDIA_SAMPLING_RATE 192000 + +#define SUHQA_MEDIA_BIT_WIDTH 32 +#define SUHQA_MEDIA_SAMPLING_RATE 384000 + + +/** + ** Customization + ** If these are defined at other header file, please disable this if block + **/ +#define AUDIO_PARAMETER_KEY_FMRADIO_MODE "fm_mode" +#define AUDIO_PARAMETER_KEY_FMRADIO_VOLUME "fm_radio_volume" + +// Factory Mode +#define AUDIO_PARAMETER_KEY_FACTORY_RMS_TEST "factory_test_mic_check" + +#define AUDIO_PARAMETER_FACTORY_TEST_LOOPBACK "factory_test_loopback" +#define AUDIO_PARAMETER_FACTORY_TEST_TYPE "factory_test_type" +#define AUDIO_PARAMETER_FACTORY_TEST_PATH "factory_test_path" +#define AUDIO_PARAMETER_FACTORY_TEST_ROUTE "factory_test_route" + +#define AUDIO_PARAMETER_SEAMLESS_VOICE "seamless_voice" + +#endif // __EXYNOS_AUDIOHAL_DEFINITION_H__ diff --git a/include/libaudio/audiohal/audio_devices.h b/include/libaudio/audiohal/audio_devices.h new file mode 100644 index 0000000..a9a0f92 --- /dev/null +++ b/include/libaudio/audiohal/audio_devices.h @@ -0,0 +1,87 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __EXYNOS_AUDIOHAL_DEVICE_H__ +#define __EXYNOS_AUDIOHAL_DEVICE_H__ + +/** + ** Audio Input/Output Device based on Target Device + **/ +typedef enum { + DEVICE_MIN = 0, + + // Playback Devices + DEVICE_EARPIECE = 0, // handset or receiver + DEVICE_SPEAKER, + DEVICE_HEADSET, // headphone + mic + DEVICE_HEADPHONE, // headphone or earphone + DEVICE_SPEAKER_AND_HEADSET, + DEVICE_SPEAKER_AND_HEADPHONE, + DEVICE_BT_HEADSET, + DEVICE_FM_EXTERNAL, + DEVICE_SPEAKER_AND_BT_HEADSET, + DEVICE_USB_HEADSET, + DEVICE_AUX_DIGITAL, + + // Special Playback Devices + DEVICE_CALL_FWD, + + // Capture Devices + DEVICE_MAIN_MIC, + DEVICE_HEADSET_MIC, + DEVICE_HEADSET_MAIN_MIC, + DEVICE_BT_HEADSET_MIC, + DEVICE_BT_NREC_HEADSET_MIC, + DEVICE_USB_HEADSET_MIC, + + DEVICE_HANDSET_MIC, + DEVICE_SPEAKER_MIC, + DEVICE_HEADPHONE_MIC, + + DEVICE_SUB_MIC, + DEVICE_FULL_MIC, + DEVICE_HCO_MIC, + DEVICE_VCO_MIC, + + DEVICE_FM_TUNER, + + DEVICE_NONE, + DEVICE_MAX, + DEVICE_CNT = DEVICE_MAX +} device_type; + + +/** + ** Audio Input/Output Sampling Rate Modifier + **/ +typedef enum { + MODIFIER_MIN = 0, + + /* RX modifier */ + MODIFIER_BT_SCO_RX_NB = 0, + MODIFIER_BT_SCO_RX_WB, + + /* TX modifier */ + MODIFIER_BT_SCO_TX_NB, + MODIFIER_BT_SCO_TX_WB, + + MODIFIER_NONE, + MODIFIER_MAX, + MODIFIER_CNT = MODIFIER_MAX +} modifier_type; + + +#endif // __EXYNOS_AUDIOHAL_DEVICE_H__ diff --git a/include/libaudio/audiohal/audio_log.h b/include/libaudio/audiohal/audio_log.h new file mode 100644 index 0000000..c950ba2 --- /dev/null +++ b/include/libaudio/audiohal/audio_log.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __EXYNOS_AUDIOHAL_LOG_H__ +#define __EXYNOS_AUDIOHAL_LOG_H__ + + +char * audiomode_table[AUDIO_MODE_CNT] = { + [AUDIO_MODE_NORMAL] = "normal mode", + [AUDIO_MODE_RINGTONE] = "ringtone mode", + [AUDIO_MODE_IN_CALL] = "in_call mode", + [AUDIO_MODE_IN_COMMUNICATION] = "in_comm mode", +}; + +char * callmode_table[CALL_MODE_CNT] = { + [CALL_OFF] = "Call Off", + [VOICE_CALL] = "Voice Call Mode", + [VOLTE_CALL] = "VoLTE Call Mode", + [VOWIFI_CALL] = "VoWiFi Call Mode", +}; + +#endif // __EXYNOS_AUDIOHAL_LOG_H__
\ No newline at end of file diff --git a/include/libaudio/audiohal/audio_mixers.h b/include/libaudio/audiohal/audio_mixers.h new file mode 100644 index 0000000..37801de --- /dev/null +++ b/include/libaudio/audiohal/audio_mixers.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AUDIO_MIXERS_H +#define AUDIO_MIXERS_H + +/* Mixer Values Definition */ +enum { + MIXER_VALUE_OFF = 0, + MIXER_VALUE_ON, +}; + +#define MIXER_CTL_VAL_INVALID -1 + +/* Specific Mixer Name */ +// To use Virtual PCM Device for APCall +#define ABOX_APCALLBUFFTYPE_CONTROL_NAME "ABOX PCM ext APCALL BUFFTYPE" + + +#endif /* AUDIO_MIXERS */ diff --git a/include/libaudio/audiohal/audio_offload.h b/include/libaudio/audiohal/audio_offload.h new file mode 100644 index 0000000..6b28cca --- /dev/null +++ b/include/libaudio/audiohal/audio_offload.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __EXYNOS_AUDIOHAL_OFFLOAD_H__ +#define __EXYNOS_AUDIOHAL_OFFLOAD_H__ + +#define OFFLOAD_EFFECT_LIBRARY_PATH "" + +/** + ** Compress Offload Message List + **/ +typedef enum { + OFFLOAD_MSG_INVALID = 0, + + OFFLOAD_MSG_WAIT_WRITE, + OFFLOAD_MSG_WAIT_DRAIN, + OFFLOAD_MSG_WAIT_PARTIAL_DRAIN, + OFFLOAD_MSG_EXIT, + + OFFLOAD_MSG_MAX, +} offload_msg_type; + +#endif // __EXYNOS_AUDIOHAL_OFFLOAD_H__ diff --git a/include/libaudio/audiohal/audio_proxy_interface.h b/include/libaudio/audiohal/audio_proxy_interface.h new file mode 100644 index 0000000..6393420 --- /dev/null +++ b/include/libaudio/audiohal/audio_proxy_interface.h @@ -0,0 +1,157 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef AUDIO_PROXY_INTERFACE_H +#define AUDIO_PROXY_INTERFACE_H + + +/* Volume Type */ +enum { + VOLUME_TYPE_OFFLOAD = 0, +}; + +/* Compress Function Type */ +enum { + COMPRESS_TYPE_WAIT = 0, + COMPRESS_TYPE_NEXTTRACK, + COMPRESS_TYPE_PARTIALDRAIN, + COMPRESS_TYPE_DRAIN, +}; + +/* Special Audio Device Type */ +enum { + BUILTIN_HANDSET = 0, + BUILTIN_SPEAKER, + BUILTIN_MIC, + PROXIMITY_SENSOR, +}; + +/* Audio Device Configuration Type */ +enum { + DEVICE_CONFIG_NONE = 0, + DEVICE_CONFIG_INTERNAL, + DEVICE_CONFIG_EXTERNAL, +}; + +enum { + DEVICE_BLUETOOTH = 0, + DEVICE_FMRADIO, +}; + +/* A-Box Configuration Type */ +enum { + NEED_VOICEPCM_REOPEN = 0, + SUPPORT_USB_BY_PRIMARY, + SUPPORT_A2DP_BY_PRIMARY, + +}; + + +// Audio Capability Check Utility Functions +int get_supported_device_number(void *proxy, int device_type); +int get_supported_config(void *proxy, int device_type); +bool is_needed_config(void *proxy, int config_type); + +// Audio Usage Check Utility Functions +bool is_active_usage_APCall(void *proxy); +bool is_usage_CPCall(audio_usage ausage); +bool is_active_usage_CPCall(void *proxy); +bool is_usage_APCall(audio_usage ausage); + +// Audio Stream Proxy Get/Set Fungtions +uint32_t proxy_get_actual_channel_count(void *proxy_stream); // Return Actual Channel Count +uint32_t proxy_get_actual_sampling_rate(void *proxy_stream); // Return Actual Samplung Rate +uint32_t proxy_get_actual_period_size(void *proxy_stream); +uint32_t proxy_get_actual_period_count(void *proxy_stream); +int32_t proxy_get_actual_format(void *proxy_stream); // Return Actual Android Audio Format, not PCM Format + +// Audio Stream Proxy Offload Functions +void proxy_offload_set_nonblock(void *proxy_stream); +int proxy_offload_compress_func(void *proxy_stream, int func_type); +int proxy_offload_pause(void *proxy_stream); +int proxy_offload_resume(void *proxy_stream); + +// Audio Stream Proxy Playback Stream Functions +void *proxy_create_playback_stream(void *proxy, int type, void *config, char *address); +void proxy_destroy_playback_stream(void *proxy_stream); +int proxy_close_playback_stream(void *proxy_stream); +int proxy_open_playback_stream(void *proxy_stream, int32_t min_size_frames, void *mmap_info); +int proxy_start_playback_stream(void *proxy_stream); +int proxy_write_playback_buffer(void *proxy_stream, void *buffer, int bytes); +int proxy_stop_playback_stream(void *proxy_stream); +int proxy_reconfig_playback_stream(void *proxy_stream, int type, void *config); +int proxy_get_render_position(void *proxy_stream, uint32_t *frames); +int proxy_get_presen_position(void *proxy_stream, uint64_t *frames, struct timespec *timestamp); +char *proxy_getparam_playback_stream(void *proxy_stream, const char *keys); +int proxy_setparam_playback_stream(void *proxy_stream, void *parameters); +uint32_t proxy_get_playback_latency(void *proxy_stream); +void proxy_dump_playback_stream(void *proxy_stream, int fd); + +// Audio Stream Proxy Capture Stream Functions +void *proxy_create_capture_stream(void *proxy, int type, int usage, void *config, char *address); +void proxy_destroy_capture_stream(void *proxy_stream); +int proxy_close_capture_stream(void *proxy_stream); +int proxy_open_capture_stream(void *proxy_stream, int32_t min_size_frames, void *mmap_info); +int proxy_start_capture_stream(void *proxy_stream); +int proxy_read_capture_buffer(void *proxy_stream, void *buffer, int bytes); +int proxy_stop_capture_stream(void *proxy_stream); +int proxy_reconfig_capture_stream(void *proxy_stream, int type, int usage); +int __proxy_get_capture_position(void *proxy_stream, int64_t *frames, int64_t *time); +char *proxy_getparam_capture_stream(void *proxy_stream, const char *keys); +int proxy_setparam_capture_stream(void *proxy_stream, void *parameters); +void proxy_dump_capture_stream(void *proxy_stream, int fd); + +int proxy_get_mmap_position(void *proxy_stream, void *pos); + +// Audio Device Proxy Path Route Functions +bool proxy_init_route(void *proxy, char *path); +void proxy_deinit_route(void *proxy); +bool proxy_update_route(void *proxy, int ausage, int device); +bool proxy_set_route(void *proxy, int ausage, int device, int modifier, bool set); + +// Audio Device Proxy Functions +void proxy_stop_voice_call(void *proxy); +void proxy_start_voice_call(void *proxy); +void proxy_stop_fm_radio(void *proxy); +void proxy_start_fm_radio(void *proxy); + +int proxy_get_mixer_value_int(void *proxy, const char *name); +int proxy_get_mixer_value_array(void *proxy, const char *name, void *value, int count); +void proxy_set_mixer_value_int(void *proxy, const char *name, int value); +void proxy_set_mixer_value_string(void *proxy, const char *name, const char *value); +void proxy_set_mixer_value_array(void *proxy, const char *name, const void *value, int count); + +void proxy_set_audiomode(void *proxy, int audiomode); +void proxy_set_volume(void *proxy, int volume_type, float left, float right); +void proxy_set_upscale(void *proxy, int sampling_rate, int pcm_format); +#ifdef SUPPORT_STHAL_INTERFACE +int proxy_check_sthalstate(void *proxy); +#endif +void proxy_call_status(void *proxy, int status); +int proxy_set_parameters(void *proxy, void *parameters); + +void proxy_init_offload_effect_lib(void *proxy); +void proxy_update_offload_effect(void *proxy_stream, int type); + +// Audio Device Proxy Dump Function +int proxy_fw_dump(int fd); + +// Audio Device Proxy Creation/Destruction +bool proxy_is_initialized(void); +void *proxy_init(void); +void proxy_deinit(void *proxy); + +#endif /* AUDIO_PROXY_INTERFACE_H */ diff --git a/include/libaudio/audiohal/audio_streams.h b/include/libaudio/audiohal/audio_streams.h new file mode 100644 index 0000000..6118aa5 --- /dev/null +++ b/include/libaudio/audiohal/audio_streams.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __EXYNOS_AUDIOHAL_STREAM_H__ +#define __EXYNOS_AUDIOHAL_STREAM_H__ + +/* + * Audio Streams based on Audio Profile in Audio Policy Configuration + */ +typedef enum { + ASTREAM_MIN = 0, + + ASTREAM_PLAYBACK_PRIMARY = 0, // For Primary Output Profile + ASTREAM_PLAYBACK_FAST, // For Fast Output Profile + ASTREAM_PLAYBACK_DEEP_BUFFER, // For Deep Buffer Output Profile + ASTREAM_PLAYBACK_LOW_LATENCY, // For Low Latency Output Profile + ASTREAM_PLAYBACK_COMPR_OFFLOAD, // For Compress Offload Profile + ASTREAM_PLAYBACK_MMAP, // For MMAP NoIRQ Output Profile + ASTREAM_PLAYBACK_USB_DEVICE, // For USB Output Profile + ASTREAM_PLAYBACK_AUX_DIGITAL, // For HDMI/DP Profile + + ASTREAM_CAPTURE_PRIMARY, // For Primary Input Profile + ASTREAM_CAPTURE_CALL, // For Call Recording + ASTREAM_CAPTURE_LOW_LATENCY, // For Low Latency Input Profile + ASTREAM_CAPTURE_MMAP, // For MMAP NoIRQ Input Profile + ASTREAM_CAPTURE_USB_DEVICE, // For USB Input Profile + ASTREAM_CAPTURE_FM, // For FM Radio Recording +#ifdef SUPPORT_STHAL_INTERFACE + ASTREAM_CAPTURE_HOTWORD, // For VTS seamless Input Profile +#endif + + ASTREAM_NONE, + ASTREAM_MAX, + ASTREAM_CNT = ASTREAM_MAX +} audio_stream_type; + +#endif // __EXYNOS_AUDIOHAL_STREAM_H__ diff --git a/include/libaudio/audiohal/audio_tables.h b/include/libaudio/audiohal/audio_tables.h new file mode 100644 index 0000000..0d9050a --- /dev/null +++ b/include/libaudio/audiohal/audio_tables.h @@ -0,0 +1,211 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __EXYNOS_AUDIOHAL_TABLE_H__ +#define __EXYNOS_AUDIOHAL_TABLE_H__ + +/* + * Audio Streams Table for readable log messages + */ +char * stream_table[ASTREAM_CNT] = { + [ASTREAM_PLAYBACK_PRIMARY] = "primary_out", + [ASTREAM_PLAYBACK_FAST] = "fast_out", + [ASTREAM_PLAYBACK_DEEP_BUFFER] = "deep_out", + [ASTREAM_PLAYBACK_LOW_LATENCY] = "low_out", + [ASTREAM_PLAYBACK_COMPR_OFFLOAD] = "offload_out", + [ASTREAM_PLAYBACK_MMAP] = "mmap_out", + [ASTREAM_PLAYBACK_USB_DEVICE] = "usb_out", + [ASTREAM_PLAYBACK_AUX_DIGITAL] = "aux_out", + + [ASTREAM_CAPTURE_PRIMARY] = "primary_in", + [ASTREAM_CAPTURE_CALL] = "callrec_in", + [ASTREAM_CAPTURE_LOW_LATENCY] = "low_in", + [ASTREAM_CAPTURE_MMAP] = "mmap_in", + [ASTREAM_CAPTURE_USB_DEVICE] = "usb_in", + [ASTREAM_CAPTURE_FM] = "fmrec_in", +#ifdef SUPPORT_STHAL_INTERFACE + [ASTREAM_CAPTURE_HOTWORD] = "hotword_in", +#endif + + [ASTREAM_NONE] = "none" +}; + +/** + ** Audio Usage Table for readable log messages + **/ +char * usage_table[AUSAGE_CNT] = { + [AUSAGE_MEDIA] = "media", + [AUSAGE_RECORDING] = "recording", + [AUSAGE_CAMCORDER] = "camcoder", + + [AUSAGE_VOICE_CALL_NB] = "voice_call_nb", + [AUSAGE_VOICE_CALL_WB] = "voice_call_wb", + [AUSAGE_VOLTE_CALL_NB] = "volte_call_nb", + [AUSAGE_VOLTE_CALL_WB] = "volte_call_wb", + [AUSAGE_VOLTE_CALL_SWB] = "volte_vt_call_swb", + [AUSAGE_VOLTE_VT_CALL_NB] = "volte_vt_call_nb", + [AUSAGE_VOLTE_VT_CALL_WB] = "volte_vt_call_wb", + [AUSAGE_VOLTE_VT_CALL_SWB] = "volte_call_swb", + [AUSAGE_TTY] = "tty_mode", + + [AUSAGE_WIFI_CALL_NB] = "vowifi_call_nb", + [AUSAGE_WIFI_CALL_WB] = "vowifi_call_wb", + [AUSAGE_WIFI_CALL_SWB] = "vowifi_call_swb", + [AUSAGE_VIDEO_CALL] = "video_call", + [AUSAGE_VOIP_CALL] = "voip_call", + [AUSAGE_COMMUNICATION] = "voip_call", + [AUSAGE_AP_TTY] = "ap_tty_mode", + + [AUSAGE_INCALL_UPLINK] = "callrecord_uplink", + [AUSAGE_INCALL_DOWNLINK] = "callrecord_downlink", + [AUSAGE_INCALL_UPLINK_DOWNLINK] = "callrecord", + + [AUSAGE_RECOGNITION] = "recognition", + + [AUSAGE_FM_RADIO] = "fm_radio", + +#ifdef SUPPORT_STHAL_INTERFACE + [AUSAGE_HOTWORD_SEAMLESS] = "hotword_seamless", + [AUSAGE_HOTWORD_RECORD] = "hotword_record", +#endif + + [AUSAGE_LOOPBACK] = "factory_loopback", + [AUSAGE_LOOPBACK_NODELAY] = "factory_loopback_nodelay", + [AUSAGE_LOOPBACK_REALTIME] = "factory_loopback_realtime", + [AUSAGE_LOOPBACK_CODEC] = "factory_loopback_codec", + [AUSAGE_RMS] = "factory_rms", + + [AUSAGE_NONE] = "none", +}; + +/** + ** Usage Path(AP/CP to Codec) Configuration based on Audio Usage + **/ +char * usage_path_table[AUSAGE_CNT] = { + [AUSAGE_MEDIA] = "media", + [AUSAGE_RECORDING] = "recording", + [AUSAGE_CAMCORDER] = "camcorder", + + [AUSAGE_VOICE_CALL_NB] = "incall_nb", + [AUSAGE_VOICE_CALL_WB] = "incall_wb", + [AUSAGE_VOLTE_CALL_NB] = "volte_cp_nb", + [AUSAGE_VOLTE_CALL_WB] = "volte_cp_wb", + [AUSAGE_VOLTE_CALL_SWB] = "volte_cp_evs", + [AUSAGE_VOLTE_VT_CALL_NB] = "volte_vt_cp_nb", + [AUSAGE_VOLTE_VT_CALL_WB] = "volte_vt_cp_wb", + [AUSAGE_VOLTE_VT_CALL_SWB] = "volte_vt_cp_evs", + [AUSAGE_TTY] = "tty_mode", + + [AUSAGE_WIFI_CALL_NB] = "wificall_nb", + [AUSAGE_WIFI_CALL_WB] = "wificall_wb", + [AUSAGE_WIFI_CALL_SWB] = "wificall_evs", + [AUSAGE_VIDEO_CALL] = "video_call", + [AUSAGE_VOIP_CALL] = "voip", + [AUSAGE_COMMUNICATION] = "communication", + [AUSAGE_AP_TTY] = "ap_tty_mode", + + [AUSAGE_INCALL_UPLINK] = "callrecord_uplink", + [AUSAGE_INCALL_DOWNLINK] = "callrecord_downlink", + [AUSAGE_INCALL_UPLINK_DOWNLINK] = "callrecord", + + [AUSAGE_RECOGNITION] = "recognition", + + [AUSAGE_FM_RADIO] = "fm_radio", + +#ifdef SUPPORT_STHAL_INTERFACE + [AUSAGE_HOTWORD_SEAMLESS] = "hotword_seamless", //dummy definition not used + [AUSAGE_HOTWORD_RECORD] = "hotword_record", //dummy definition not used +#endif + + [AUSAGE_LOOPBACK] = "loopback_packet", + [AUSAGE_LOOPBACK_NODELAY] = "loopback", + [AUSAGE_LOOPBACK_REALTIME] = "realtimeloopback", + [AUSAGE_LOOPBACK_CODEC] = "loopback_codec", + [AUSAGE_RMS] = "echo_test", + + [AUSAGE_NONE] = "none", +}; + +/** + ** Device Path(Codec to Device) Configuration based on Audio Input/Output Device + **/ +char * device_table[DEVICE_CNT] = { + // Playback Devices + [DEVICE_EARPIECE] = "handset", + [DEVICE_SPEAKER] = "speaker", + [DEVICE_HEADSET] = "headset", + [DEVICE_HEADPHONE] = "headphone", + [DEVICE_SPEAKER_AND_HEADSET] = "speaker-headset", + [DEVICE_SPEAKER_AND_HEADPHONE] = "speaker-headphone", + [DEVICE_BT_HEADSET] = "bt-sco-headset", + [DEVICE_FM_EXTERNAL] = "external", + [DEVICE_SPEAKER_AND_BT_HEADSET] = "speaker-bt-sco-headset", + [DEVICE_USB_HEADSET] = "usb-headset", + [DEVICE_AUX_DIGITAL] = "aux-digital", + + // Special Playback Devices + [DEVICE_CALL_FWD] = "", + + // Capture Devices + [DEVICE_MAIN_MIC] = "mic", + [DEVICE_HEADSET_MIC] = "headset-mic", + [DEVICE_HEADSET_MAIN_MIC] = "headset-main-mic", + [DEVICE_BT_HEADSET_MIC] = "bt-sco-headset-in", + [DEVICE_BT_NREC_HEADSET_MIC] = "bt-sco-nrec-headset-in", + [DEVICE_USB_HEADSET_MIC] = "usb-headset-mic", + + [DEVICE_HANDSET_MIC] = "handset-mic", + [DEVICE_SPEAKER_MIC] = "speaker-mic", + [DEVICE_HEADPHONE_MIC] = "headphone-mic", + + [DEVICE_SUB_MIC] = "2nd-mic", + [DEVICE_FULL_MIC] = "full-mic", + [DEVICE_HCO_MIC] = "hco-mic", + [DEVICE_VCO_MIC] = "vco-mic", + + [DEVICE_FM_TUNER] = "fm-tuner", + + [DEVICE_NONE] = "none", +}; + +/** + ** Sampling Rate Modifier Configuration based on Audio Input/Output Device + **/ +char * modifier_table[MODIFIER_MAX] = { + /* RX modifier */ + [MODIFIER_BT_SCO_RX_NB] = "set-bt-sco-rx-rate-nb", + [MODIFIER_BT_SCO_RX_WB] = "set-bt-sco-rx-rate-wb", + + /* TX modifier */ + [MODIFIER_BT_SCO_TX_NB] = "set-bt-sco-tx-rate-nb", + [MODIFIER_BT_SCO_TX_WB] = "set-bt-sco-tx-rate-wb", + + [MODIFIER_NONE] = "none", +}; + +/** + ** Offload Message Table for readable log messages + **/ +char * offload_msg_table[OFFLOAD_MSG_MAX] = { + [OFFLOAD_MSG_INVALID] = "Offload Message_Invalid", + [OFFLOAD_MSG_WAIT_WRITE] = "Offload Message_Wait to write", + [OFFLOAD_MSG_WAIT_DRAIN] = "Offload Message_Wait to drain", + [OFFLOAD_MSG_WAIT_PARTIAL_DRAIN] = "Offload Message_Wait to drain partially", + [OFFLOAD_MSG_EXIT] = "Offload Message_Wait to exit", +}; + + +#endif // __EXYNOS_AUDIOHAL_TABLE_H__ diff --git a/include/libaudio/audiohal/audio_usages.h b/include/libaudio/audiohal/audio_usages.h new file mode 100644 index 0000000..d3667a6 --- /dev/null +++ b/include/libaudio/audiohal/audio_usages.h @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __EXYNOS_AUDIOHAL_USAGE_H__ +#define __EXYNOS_AUDIOHAL_USAGE_H__ + +/** + ** Audio Usages Definition + **/ +typedef enum { + AUSAGE_PLAYBACK, + AUSAGE_CAPTURE, +} audio_usage_type; + +typedef enum { + AUSAGE_MIN = 0, + + // Media Playback/Recording Usages + // These audio usages are defined from stream own usage + AUSAGE_MEDIA = 0, + AUSAGE_RECORDING, + AUSAGE_CAMCORDER, + + // Call Usages + // These audio usages are defined from Audio Mode and Voice Status + AUSAGE_CPCALL_MIN, + AUSAGE_VOICE_CALL_NB = AUSAGE_CPCALL_MIN, + AUSAGE_VOICE_CALL_WB, + AUSAGE_VOLTE_CALL_NB, + AUSAGE_VOLTE_CALL_WB, + AUSAGE_VOLTE_CALL_SWB, + AUSAGE_VOLTE_VT_CALL_NB, + AUSAGE_VOLTE_VT_CALL_WB, + AUSAGE_VOLTE_VT_CALL_SWB, + AUSAGE_TTY, + AUSAGE_CPCALL_MAX = AUSAGE_TTY, + + AUSAGE_APCALL_MIN, + AUSAGE_WIFI_CALL_NB = AUSAGE_APCALL_MIN, + AUSAGE_WIFI_CALL_WB, + AUSAGE_WIFI_CALL_SWB, + AUSAGE_VIDEO_CALL, + AUSAGE_VOIP_CALL, + AUSAGE_COMMUNICATION, + AUSAGE_AP_TTY, + AUSAGE_APCALL_MAX = AUSAGE_AP_TTY, + + // Call Recording Usages + AUSAGE_INCALL_UPLINK, + AUSAGE_INCALL_DOWNLINK, + AUSAGE_INCALL_UPLINK_DOWNLINK, + + // Voice Recognition Usages + AUSAGE_RECOGNITION, + + // Other Audio Usages + AUSAGE_FM_RADIO, + + // Voice WakeUp Usages +#ifdef SUPPORT_STHAL_INTERFACE + AUSAGE_HOTWORD_SEAMLESS, + AUSAGE_HOTWORD_RECORD, +#endif + + // Factory Mode Test Usages + AUSAGE_LOOPBACK_MIN, + AUSAGE_LOOPBACK = AUSAGE_LOOPBACK_MIN, //packet + AUSAGE_LOOPBACK_NODELAY, //packet_nodelay + AUSAGE_LOOPBACK_REALTIME, + AUSAGE_LOOPBACK_CODEC, + AUSAGE_LOOPBACK_MAX = AUSAGE_LOOPBACK_CODEC, + + AUSAGE_RMS, //RMS Test + + AUSAGE_NONE, + AUSAGE_MAX, + AUSAGE_CNT = AUSAGE_MAX +} audio_usage; + +#endif // __EXYNOS_AUDIOHAL_USAGE_H__ diff --git a/include/libaudio/audiohal/voice_definition.h b/include/libaudio/audiohal/voice_definition.h new file mode 100644 index 0000000..c18947c --- /dev/null +++ b/include/libaudio/audiohal/voice_definition.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __AUDIOHAL_VOICE_DEFINITION_H__ +#define __AUDIOHAL_VOICE_DEFINITION_H__ + +/** + ** Custermization + ** If these are defined at other header file, please disable this if block + **/ + +#define CP1 0 // DualCP CP1, DualMode Sim1 +#define CP2 1 // DualCP CP2, DualMode Sim2 + +enum bt_nrec_status { + BT_NREC_INITIALIZED = -1, + BT_NREC_ON = 0, + BT_NREC_OFF = 1 +}; + +#define TTY_MODE_OFF 0x00000010 +#define TTY_MODE_FULL 0x00000020 +#define TTY_MODE_VCO 0x00000040 +#define TTY_MODE_HCO 0x00000080 +#define TTY_MODE_CLEAR 0xFFFFFF0F + +#define AUDIO_PARAMETER_KEY_EXTRA_VOLUME "extraVolume" +#define AUDIO_PARAMETER_KEY_CALL_FORWARDING "call_forwarding" + +#define AUDIO_PARAMETER_VOLTE_STATUS "VoLTEstate" + + +#define SWB 2 +#define WB 1 +#define NB 0 +#define SWB_SAMPLING_RATE 32000 +#define WB_SAMPLING_RATE 16000 +#define NB_SAMPLING_RATE 8000 + +#endif // __AUDIOHAL_VOICE_DEFINITION_H__ diff --git a/include/media.h b/include/media.h new file mode 100644 index 0000000..e13771d --- /dev/null +++ b/include/media.h @@ -0,0 +1,125 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef __LINUX_MEDIA_H +#define __LINUX_MEDIA_H +#include <linux/ioctl.h> +#include <linux/types.h> +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#include <linux/version.h> +#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0) +struct media_device_info { + char driver[16]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + char model[32]; + char serial[40]; + char bus_info[32]; + __u32 media_version; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 hw_revision; + __u32 driver_version; + __u32 reserved[31]; +}; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define MEDIA_ENT_ID_FLAG_NEXT (1 << 31) +#define MEDIA_ENT_TYPE_SHIFT 16 +#define MEDIA_ENT_TYPE_MASK 0x00ff0000 +#define MEDIA_ENT_SUBTYPE_MASK 0x0000ffff +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define MEDIA_ENT_T_DEVNODE (1 << MEDIA_ENT_TYPE_SHIFT) +#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1) +#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2) +#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4) +#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT) +#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1) +#define MEDIA_ENT_T_V4L2_SUBDEV_FLASH (MEDIA_ENT_T_V4L2_SUBDEV + 2) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define MEDIA_ENT_T_V4L2_SUBDEV_LENS (MEDIA_ENT_T_V4L2_SUBDEV + 3) +#define MEDIA_ENT_FL_DEFAULT (1 << 0) +struct media_entity_desc { + __u32 id; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + char name[32]; + __u32 type; + __u32 revision; + __u32 flags; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 group_id; + __u16 pads; + __u16 links; + __u32 reserved[4]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + union { + struct { + __u32 major; + __u32 minor; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + } v4l; + struct { + __u32 major; + __u32 minor; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + } fb; + struct { + __u32 card; + __u32 device; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 subdevice; + } alsa; + int dvb; + __u8 raw[184]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + }; +}; +#define MEDIA_PAD_FL_SINK (1 << 0) +#define MEDIA_PAD_FL_SOURCE (1 << 1) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +struct media_pad_desc { + __u32 entity; + __u16 index; + __u32 flags; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 reserved[2]; +}; +#define MEDIA_LNK_FL_ENABLED (1 << 0) +#define MEDIA_LNK_FL_IMMUTABLE (1 << 1) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define MEDIA_LNK_FL_DYNAMIC (1 << 2) +struct media_link_desc { + struct media_pad_desc source; + struct media_pad_desc sink; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 flags; + __u32 reserved[2]; +}; +struct media_links_enum { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 entity; + struct media_pad_desc __user *pads; + struct media_link_desc __user *links; + __u32 reserved[4]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct media_device_info) +#define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct media_entity_desc) +#define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) +#endif diff --git a/include/s5p_fimc_v4l2.h b/include/s5p_fimc_v4l2.h new file mode 100644 index 0000000..d0c5d5f --- /dev/null +++ b/include/s5p_fimc_v4l2.h @@ -0,0 +1,160 @@ +/* Copyright(c) 2011 Samsung Electronics Co, Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * Alternatively, Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef _S5P_FIMC_H_ +#define _S5P_FIMC_H_ + +#include "videodev2.h" +#include "videodev2_exynos_media.h" + +/* + * G E N E R A L S + * +*/ + +/* + * P I X E L F O R M A T G U I D E + * + * The 'x' means 'DO NOT CARE' + * The '*' means 'FIMC SPECIFIC' + * For some fimc formats, we couldn't find equivalent format in the V4L2 FOURCC. + * + * FIMC TYPE PLANES ORDER V4L2_PIX_FMT + * --------------------------------------------------------- + * RGB565 x x V4L2_PIX_FMT_RGB565 + * RGB888 x x V4L2_PIX_FMT_RGB24 + * YUV420 2 LSB_CBCR V4L2_PIX_FMT_NV12 + * YUV420 2 LSB_CRCB V4L2_PIX_FMT_NV21 + * YUV420 2 MSB_CBCR V4L2_PIX_FMT_NV21X* + * YUV420 2 MSB_CRCB V4L2_PIX_FMT_NV12X* + * YUV420 3 x V4L2_PIX_FMT_YUV420 + * YUV422 1 YCBYCR V4L2_PIX_FMT_YUYV + * YUV422 1 YCRYCB V4L2_PIX_FMT_YVYU + * YUV422 1 CBYCRY V4L2_PIX_FMT_UYVY + * YUV422 1 CRYCBY V4L2_PIX_FMT_VYUY* + * YUV422 2 LSB_CBCR V4L2_PIX_FMT_NV16* + * YUV422 2 LSB_CRCB V4L2_PIX_FMT_NV61* + * YUV422 2 MSB_CBCR V4L2_PIX_FMT_NV16X* + * YUV422 2 MSB_CRCB V4L2_PIX_FMT_NV61X* + * YUV422 3 x V4L2_PIX_FMT_YUV422P + * +*/ + +/* + * V 4 L 2 F I M C E X T E N S I O N S + * +*/ +#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') + +/* FOURCC for FIMC specific */ +#define V4L2_PIX_FMT_NV12X v4l2_fourcc('N', '1', '2', 'X') +#define V4L2_PIX_FMT_NV21X v4l2_fourcc('N', '2', '1', 'X') +#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') +#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') +#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') +#define V4L2_PIX_FMT_NV16X v4l2_fourcc('N', '1', '6', 'X') +#define V4L2_PIX_FMT_NV61X v4l2_fourcc('N', '6', '1', 'X') + +/* CID extensions */ +#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0) +#define V4L2_CID_OVLY_MODE (V4L2_CID_PRIVATE_BASE + 9) +#define V4L2_CID_GET_PHY_SRC_YADDR (V4L2_CID_PRIVATE_BASE + 12) +#define V4L2_CID_GET_PHY_SRC_CADDR (V4L2_CID_PRIVATE_BASE + 13) +#define V4L2_CID_RESERVED_MEM_BASE_ADDR (V4L2_CID_PRIVATE_BASE + 20) +#define V4L2_CID_FIMC_VERSION (V4L2_CID_PRIVATE_BASE + 21) + +/* + * U S E R D E F I N E D T Y P E S + * +*/ +#define FIMC1_RESERVED_SIZE 32768 + +enum fimc_overlay_mode { + FIMC_OVLY_NOT_FIXED = 0x0, /* Overlay mode isn't fixed. */ + FIMC_OVLY_FIFO = 0x1, /* Non-destructive Overlay with FIFO */ + FIMC_OVLY_DMA_AUTO = 0x2, /* Non-destructive Overlay with DMA */ + FIMC_OVLY_DMA_MANUAL = 0x3, /* Non-destructive Overlay with DMA */ + FIMC_OVLY_NONE_SINGLE_BUF = 0x4, /* Destructive Overlay with DMA single destination buffer */ + FIMC_OVLY_NONE_MULTI_BUF = 0x5, /* Destructive Overlay with DMA multiple dstination buffer */ +}; + +typedef unsigned int dma_addr_t; + +struct fimc_buf { + dma_addr_t base[3]; + size_t size[3]; + int planes; +}; + +struct fimc_buffer { + void *virt_addr; + void *phys_addr; + size_t length; +}; + +struct yuv_fmt_list { + const char *name; + const char *desc; + unsigned int fmt; + int bpp; + int planes; +}; + +struct img_offset { + int y_h; + int y_v; + int cb_h; + int cb_v; + int cr_h; + int cr_v; +}; + +//------------ STRUCT ---------------------------------------------------------// + +typedef struct +{ + unsigned int full_width; // Source Image Full Width (Virtual screen size) + unsigned int full_height; // Source Image Full Height (Virtual screen size) + unsigned int start_x; // Source Image Start width offset + unsigned int start_y; // Source Image Start height offset + unsigned int width; // Source Image Width + unsigned int height; // Source Image Height + unsigned int buf_addr_phy_rgb_y; // Base Address of the Source Image (RGB or Y): Physical Address + unsigned int buf_addr_phy_cb; // Base Address of the Source Image (CB Component) : Physical Address + unsigned int buf_addr_phy_cr; // Base Address of the Source Image (CR Component) : Physical Address + unsigned int color_space; // Color Space of the Source Image + unsigned int planes; // number of planes for the Image +} s5p_fimc_img_info; + +typedef struct +{ + s5p_fimc_img_info src; + s5p_fimc_img_info dst; +} s5p_fimc_params_t; + +typedef struct _s5p_fimc_t { + int dev_fd; + struct fimc_buffer out_buf; + + s5p_fimc_params_t params; + + int use_ext_out_mem; +} s5p_fimc_t; + +#endif diff --git a/include/swconverter.h b/include/swconverter.h new file mode 100644 index 0000000..877e4ba --- /dev/null +++ b/include/swconverter.h @@ -0,0 +1,405 @@ +/* + * + * Copyright 2012 Samsung Electronics S.LSI Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * @file swconverter.h + * @brief Exynos_OMX specific define. It support MFC's tiled format. + * NV12T(tiled) layout: + * Each element is not pixel. + * MFC 5.x : It is 64x32 pixel block. + * MFC 6.x : It is 16x16 pixel block. + * uv pixel block is interleaved as u v u v u v ... + * y1 y2 y7 y8 y9 y10 y15 y16 + * y3 y4 y5 y6 y11 y12 y13 y14 + * y17 y18 y23 y24 y25 y26 y31 y32 + * y19 y20 y21 y22 y27 y28 y29 y30 + * uv1 uv2 uv7 uv8 uv9 uv10 uv15 uv16 + * uv3 uv4 uv5 uv6 uv11 uv12 uv13 uv14 + * YUV420Planar(linear) layout: + * Each element is not pixel. It is 64x32 pixel block. + * y1 y2 y3 y4 y5 y6 y7 y8 + * y9 y10 y11 y12 y13 y14 y15 y16 + * y17 y18 y19 y20 y21 y22 y23 y24 + * y25 y26 y27 y28 y29 y30 y31 y32 + * u1 u2 u3 u4 u5 u6 u7 u8 + * v1 v2 v3 v4 v5 v6 v7 v8 + * YUV420Semiplanar(linear) layout: + * Each element is not pixel. It is 64x32 pixel block. + * uv pixel block is interleaved as u v u v u v ... + * y1 y2 y3 y4 y5 y6 y7 y8 + * y9 y10 y11 y12 y13 y14 y15 y16 + * y17 y18 y19 y20 y21 y22 y23 y24 + * y25 y26 y27 y28 y29 y30 y31 y32 + * uv1 uv2 uv3 uv4 uv5 uv6 uv7 uv8 + * uv9 uv10 uv11 uv12 uv13 uv14 uv15 uv16 + * @author ShinWon Lee (shinwon.lee@samsung.com) + * @version 1.0 + * @history + * 2012.02.01 : Create + */ + +#ifndef SW_CONVERTOR_H_ +#define SW_CONVERTOR_H_ + +/*--------------------------------------------------------------------------------*/ +/* Format Conversion API */ +/*--------------------------------------------------------------------------------*/ +/* + * C code only + * De-interleaves src to dest1, dest2 + * + * @param dest1 + * Address of de-interleaved data[out] + * + * @param dest2 + * Address of de-interleaved data[out] + * + * @param src + * Address of interleaved data[in] + * + * @param src_size + * Size of interleaved data[in] + */ +void csc_deinterleave_memcpy( + unsigned char *dest1, + unsigned char *dest2, + unsigned char *src, + unsigned int src_size); + +/* + * C code or Neon + * Interleaves src1, src2 to dest + * + * @param dest + * Address of interleaved data[out] + * + * @param src1 + * Address of de-interleaved data[in] + * + * @param src2 + * Address of de-interleaved data[in] + * + * @param src_size + * Size of de-interleaved data[in] + */ +void csc_interleave_memcpy( + unsigned char *dest, + unsigned char *src1, + unsigned char *src2, + unsigned int src_size); + +/* + * C code or Neon + * Converts tiled data to linear + * 1. y of nv12t to y of yuv420p + * 2. y of nv12t to y of yuv420s + * + * @param dst + * y address of yuv420[out] + * + * @param src + * y address of nv12t[in] + * + * @param yuv420_width + * real width of yuv420[in] + * it should be even + * + * @param yuv420_height + * real height of yuv420[in] + * it should be even. + * + */ +void csc_tiled_to_linear_y( + unsigned char *y_dst, + unsigned char *y_src, + unsigned int width, + unsigned int height); + +/* + * C code or Neon + * Converts tiled data to linear + * 1. uv of nv12t to y of yuv420s + * + * @param dst + * uv address of yuv420s[out] + * + * @param src + * uv address of nv12t[in] + * + * @param yuv420_width + * real width of yuv420s[in] + * + * @param yuv420_height + * real height of yuv420s[in] + * + */ +void csc_tiled_to_linear_uv( + unsigned char *uv_dst, + unsigned char *uv_src, + unsigned int width, + unsigned int height); + +/* + * C code or Neon + * Converts tiled data to linear + * 1. uv of nt12t to uv of yuv420p + * + * @param u_dst + * u address of yuv420p[out] + * + * @param v_dst + * v address of yuv420p[out] + * + * @param uv_src + * uv address of nt12t[in] + * + * @param yuv420_width + * real width of yuv420p[in] + * + * @param yuv420_height + * real height of yuv420p[in] + */ +void csc_tiled_to_linear_uv_deinterleave( + unsigned char *u_dst, + unsigned char *v_dst, + unsigned char *uv_src, + unsigned int width, + unsigned int height); + +/* + * Neon only + * Converts linear data to tiled + * 1. y of yuv420 to y of nv12t + * + * @param dst + * y address of nv12t[out] + * + * @param src + * y address of yuv420[in] + * + * @param yuv420_width + * real width of yuv420[in] + * it should be even + * + * @param yuv420_height + * real height of yuv420[in] + * it should be even. + * + */ +void csc_linear_to_tiled_y( + unsigned char *y_dst, + unsigned char *y_src, + unsigned int width, + unsigned int height); + +/* + * Neon only + * Converts and interleaves linear data to tiled + * 1. uv of nv12t to uv of yuv420 + * + * @param dst + * uv address of nv12t[out] + * + * @param src + * u address of yuv420[in] + * + * @param src + * v address of yuv420[in] + * + * @param yuv420_width + * real width of yuv420[in] + * + * @param yuv420_height + * real height of yuv420[in] + * + */ +void csc_linear_to_tiled_uv( + unsigned char *uv_dst, + unsigned char *u_src, + unsigned char *v_src, + unsigned int width, + unsigned int height); + +/* + * C code only + * Converts RGB565 to YUV420P + * + * @param y_dst + * Y plane address of YUV420P[out] + * + * @param u_dst + * U plane address of YUV420P[out] + * + * @param v_dst + * V plane address of YUV420P[out] + * + * @param rgb_src + * Address of RGB565[in] + * + * @param width + * Width of RGB565[in] + * + * @param height + * Height of RGB565[in] + */ +void csc_RGB565_to_YUV420P( + unsigned char *y_dst, + unsigned char *u_dst, + unsigned char *v_dst, + unsigned char *rgb_src, + int width, + int height); + +/* + * C code only + * Converts RGB565 to YUV420SP + * + * @param y_dst + * Y plane address of YUV420SP[out] + * + * @param uv_dst + * UV plane address of YUV420SP[out] + * + * @param rgb_src + * Address of RGB565[in] + * + * @param width + * Width of RGB565[in] + * + * @param height + * Height of RGB565[in] + */ +void csc_RGB565_to_YUV420SP( + unsigned char *y_dst, + unsigned char *uv_dst, + unsigned char *rgb_src, + int width, + int height); + +/* + * C code only + * Converts BGRA8888 to YUV420P + * + * @param y_dst + * Y plane address of YUV420P[out] + * + * @param u_dst + * U plane address of YUV420P[out] + * + * @param v_dst + * V plane address of YUV420P[out] + * + * @param rgb_src + * Address of BGRA8888[in] + * + * @param width + * Width of BGRA8888[in] + * + * @param height + * Height of BGRA8888[in] + */ +void csc_BGRA8888_to_YUV420P( + unsigned char *y_dst, + unsigned char *u_dst, + unsigned char *v_dst, + unsigned char *rgb_src, + unsigned int width, + unsigned int height); + +/* + * C code or Neon + * Converts BGRA8888 to YUV420SP + * + * @param y_dst + * Y plane address of YUV420SP[out] + * + * @param uv_dst + * UV plane address of YUV420SP[out] + * + * @param rgb_src + * Address of BGRA8888[in] + * + * @param width + * Width of BGRA8888[in] + * + * @param height + * Height of BGRA8888[in] + */ +void csc_BGRA8888_to_YUV420SP( + unsigned char *y_dst, + unsigned char *uv_dst, + unsigned char *rgb_src, + unsigned int width, + unsigned int height); + +/* + * C code only + * Converts RGBA8888 to YUV420P + * + * @param y_dst + * Y plane address of YUV420P[out] + * + * @param u_dst + * U plane address of YUV420P[out] + * + * @param v_dst + * V plane address of YUV420P[out] + * + * @param rgb_src + * Address of RGBA8888[in] + * + * @param width + * Width of RGBA8888[in] + * + * @param height + * Height of RGBA8888[in] + */ +void csc_RGBA8888_to_YUV420P( + unsigned char *y_dst, + unsigned char *u_dst, + unsigned char *v_dst, + unsigned char *rgb_src, + unsigned int width, + unsigned int height); + +/* + * C code or Neon + * Converts RGBA8888 to YUV420SP + * + * @param y_dst + * Y plane address of YUV420SP[out] + * + * @param uv_dst + * UV plane address of YUV420SP[out] + * + * @param rgb_src + * Address of RGBA8888[in] + * + * @param width + * Width of RGBA8888[in] + * + * @param height + * Height of RGBA8888[in] + */ +void csc_RGBA8888_to_YUV420SP( + unsigned char *y_dst, + unsigned char *uv_dst, + unsigned char *rgb_src, + unsigned int width, + unsigned int height); + +#endif /*COLOR_SPACE_CONVERTOR_H_*/ diff --git a/include/v4l2-mediabus.h b/include/v4l2-mediabus.h new file mode 100644 index 0000000..09447c2 --- /dev/null +++ b/include/v4l2-mediabus.h @@ -0,0 +1,100 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef __LINUX_V4L2_MEDIABUS_H +#define __LINUX_V4L2_MEDIABUS_H +#include <linux/types.h> +#include "videodev2.h" +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +enum v4l2_mbus_pixelcode { + V4L2_MBUS_FMT_FIXED = 0x0001, + V4L2_MBUS_FMT_RGB444_2X8_PADHI_BE = 0x1001, + V4L2_MBUS_FMT_RGB444_2X8_PADHI_LE = 0x1002, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_RGB555_2X8_PADHI_BE = 0x1003, + V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE = 0x1004, + V4L2_MBUS_FMT_BGR565_2X8_BE = 0x1005, + V4L2_MBUS_FMT_BGR565_2X8_LE = 0x1006, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_RGB565_2X8_BE = 0x1007, + V4L2_MBUS_FMT_RGB565_2X8_LE = 0x1008, + V4L2_MBUS_FMT_XRGB8888_4X8_LE = 0x1009, + V4L2_MBUS_FMT_Y8_1X8 = 0x2001, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_UYVY8_1_5X8 = 0x2002, + V4L2_MBUS_FMT_VYUY8_1_5X8 = 0x2003, + V4L2_MBUS_FMT_YUYV8_1_5X8 = 0x2004, + V4L2_MBUS_FMT_YVYU8_1_5X8 = 0x2005, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_UYVY8_2X8 = 0x2006, + V4L2_MBUS_FMT_VYUY8_2X8 = 0x2007, + V4L2_MBUS_FMT_YUYV8_2X8 = 0x2008, + V4L2_MBUS_FMT_YVYU8_2X8 = 0x2009, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_Y10_1X10 = 0x200a, + V4L2_MBUS_FMT_YUYV10_2X10 = 0x200b, + V4L2_MBUS_FMT_YVYU10_2X10 = 0x200c, + V4L2_MBUS_FMT_Y12_1X12 = 0x2013, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_UYVY8_1X16 = 0x200f, + V4L2_MBUS_FMT_VYUY8_1X16 = 0x2010, + V4L2_MBUS_FMT_YUYV8_1X16 = 0x2011, + V4L2_MBUS_FMT_YVYU8_1X16 = 0x2012, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_YUV8_1X24 = 0x2014, + V4L2_MBUS_FMT_YUYV10_1X20 = 0x200d, + V4L2_MBUS_FMT_YVYU10_1X20 = 0x200e, + V4L2_MBUS_FMT_SBGGR8_1X8 = 0x3001, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_SGBRG8_1X8 = 0x3013, + V4L2_MBUS_FMT_SGRBG8_1X8 = 0x3002, + V4L2_MBUS_FMT_SRGGB8_1X8 = 0x3014, + V4L2_MBUS_FMT_SBGGR10_DPCM8_1X8 = 0x300b, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_SGBRG10_DPCM8_1X8 = 0x300c, + V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8 = 0x3009, + V4L2_MBUS_FMT_SRGGB10_DPCM8_1X8 = 0x300d, + V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_BE = 0x3003, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_SBGGR10_2X8_PADHI_LE = 0x3004, + V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_BE = 0x3005, + V4L2_MBUS_FMT_SBGGR10_2X8_PADLO_LE = 0x3006, + V4L2_MBUS_FMT_SBGGR10_1X10 = 0x3007, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_SGBRG10_1X10 = 0x300e, + V4L2_MBUS_FMT_SGRBG10_1X10 = 0x300a, + V4L2_MBUS_FMT_SRGGB10_1X10 = 0x300f, + V4L2_MBUS_FMT_SBGGR12_1X12 = 0x3008, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + V4L2_MBUS_FMT_SGBRG12_1X12 = 0x3010, + V4L2_MBUS_FMT_SGRBG12_1X12 = 0x3011, + V4L2_MBUS_FMT_SRGGB12_1X12 = 0x3012, + V4L2_MBUS_FMT_JPEG_1X8 = 0x4001, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct v4l2_mbus_framefmt { + __u32 width; + __u32 height; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 code; + __u32 field; + __u32 colorspace; + __u32 reserved[7]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +#endif diff --git a/include/v4l2-subdev.h b/include/v4l2-subdev.h new file mode 100644 index 0000000..5708b8f --- /dev/null +++ b/include/v4l2-subdev.h @@ -0,0 +1,94 @@ +/**************************************************************************** + **************************************************************************** + *** + *** This header was automatically generated from a Linux kernel header + *** of the same name, to make information necessary for userspace to + *** call into the kernel available to libc. It contains only constants, + *** structures, and macros generated from the original header, and thus, + *** contains no copyrightable information. + *** + *** To edit the content of this header, modify the corresponding + *** source file (e.g. under external/kernel-headers/original/) then + *** run bionic/libc/kernel/tools/update_all.py + *** + *** Any manual change here will be lost the next time this script will + *** be run. You've been warned! + *** + **************************************************************************** + ****************************************************************************/ +#ifndef __LINUX_V4L2_SUBDEV_H +#define __LINUX_V4L2_SUBDEV_H +#include <linux/ioctl.h> +#include <linux/types.h> +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#include "v4l2-mediabus.h" +enum v4l2_subdev_format_whence { + V4L2_SUBDEV_FORMAT_TRY = 0, + V4L2_SUBDEV_FORMAT_ACTIVE = 1, +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct v4l2_subdev_format { + __u32 which; + __u32 pad; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + struct v4l2_mbus_framefmt format; + __u32 reserved[8]; +}; +struct v4l2_subdev_crop { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 which; + __u32 pad; + struct v4l2_rect rect; + __u32 reserved[8]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct v4l2_subdev_mbus_code_enum { + __u32 pad; + __u32 index; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 code; + __u32 reserved[9]; +}; +struct v4l2_subdev_frame_size_enum { +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 index; + __u32 pad; + __u32 code; + __u32 min_width; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 max_width; + __u32 min_height; + __u32 max_height; + __u32 reserved[9]; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +}; +struct v4l2_subdev_frame_interval { + __u32 pad; + struct v4l2_fract interval; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 reserved[9]; +}; +struct v4l2_subdev_frame_interval_enum { + __u32 index; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + __u32 pad; + __u32 code; + __u32 width; + __u32 height; +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ + struct v4l2_fract interval; + __u32 reserved[9]; +}; +#define VIDIOC_SUBDEV_G_FMT _IOWR('V', 4, struct v4l2_subdev_format) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define VIDIOC_SUBDEV_S_FMT _IOWR('V', 5, struct v4l2_subdev_format) +#define VIDIOC_SUBDEV_G_FRAME_INTERVAL _IOWR('V', 21, struct v4l2_subdev_frame_interval) +#define VIDIOC_SUBDEV_S_FRAME_INTERVAL _IOWR('V', 22, struct v4l2_subdev_frame_interval) +#define VIDIOC_SUBDEV_ENUM_MBUS_CODE _IOWR('V', 2, struct v4l2_subdev_mbus_code_enum) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#define VIDIOC_SUBDEV_ENUM_FRAME_SIZE _IOWR('V', 74, struct v4l2_subdev_frame_size_enum) +#define VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL _IOWR('V', 75, struct v4l2_subdev_frame_interval_enum) +#define VIDIOC_SUBDEV_G_CROP _IOWR('V', 59, struct v4l2_subdev_crop) +#define VIDIOC_SUBDEV_S_CROP _IOWR('V', 60, struct v4l2_subdev_crop) +/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ +#endif |