diff options
author | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2019-05-17 17:41:27 +0200 |
---|---|---|
committer | Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org> | 2019-05-17 17:41:27 +0200 |
commit | dd21ba16231c6ba0f393e0cbd0255806e506a914 (patch) | |
tree | da32ca69e60633f7eebf5cde18ca2a679ffc6178 | |
parent | dc0140993d786134cbe12f52450b6190210816f6 (diff) | |
download | hardware_samsung-GNUtoo/lineage-16.0_i9300.tar.gz hardware_samsung-GNUtoo/lineage-16.0_i9300.tar.bz2 hardware_samsung-GNUtoo/lineage-16.0_i9300.zip |
TEST: Remove exynos4/hal/GNUtoo/lineage-16.0_i9300
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
88 files changed, 0 insertions, 26895 deletions
diff --git a/exynos4/hal/Android.mk b/exynos4/hal/Android.mk deleted file mode 100644 index 60ab8b9..0000000 --- a/exynos4/hal/Android.mk +++ /dev/null @@ -1,30 +0,0 @@ -# -# 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. -# - -ifeq ($(TARGET_SLSI_VARIANT),) - -ifeq ($(TARGET_BOARD_PLATFORM),exynos4) - -common_exynos4_dirs := libsecion libUMP - -ifeq ($(TARGET_SOC),exynos4210) - include $(call all-named-subdir-makefiles,$(exynos4210_dirs)) -else - include $(call all-named-subdir-makefiles,$(exynos4x12_dirs)) -endif -endif - -endif diff --git a/exynos4/hal/include/Exif.h b/exynos4/hal/include/Exif.h deleted file mode 100644 index 6bf3730..0000000 --- a/exynos4/hal/include/Exif.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright Samsung Electronics Co.,LTD. - * Copyright (C) 2010 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_HARDWARE_EXIF_H -#define ANDROID_HARDWARE_EXIF_H - -#include <math.h> - -#define EXIF_LOG2(x) (log((double)(x)) / log(2.0)) -#define APEX_FNUM_TO_APERTURE(x) ((int)(EXIF_LOG2((double)(x)) * 200.0 + 0.5)) -#define APEX_EXPOSURE_TO_SHUTTER(x) ((x) >= 1 ? \ - (int)(-(EXIF_LOG2((double)(x)) * 100.0 + 0.5)) : \ - (int)(-(EXIF_LOG2((double)(x)) * 100.0 - 0.5))) -#define APEX_ISO_TO_FILMSENSITIVITY(x) ((int)(EXIF_LOG2((x) / 3.125) * 100.0 + 0.5)) -#define APEX_SHUTTER_TO_EXPOSURE(x) ((int)((pow(2.0, (double)(x) / 100.0)) + 0.5)) - -#define NUM_SIZE 2 -#define IFD_SIZE 12 -#define OFFSET_SIZE 4 - -#define NUM_0TH_IFD_TIFF 10 -#define NUM_0TH_IFD_EXIF 22 -#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_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_USER_COMMENT 0x9286 -#define EXIF_TAG_COLOR_SPACE 0xA001 -#define EXIF_TAG_PIXEL_X_DIMENSION 0xA002 -#define EXIF_TAG_PIXEL_Y_DIMENSION 0xA003 -#define EXIF_TAG_EXPOSURE_MODE 0xA402 -#define EXIF_TAG_WHITE_BALANCE 0xA403 -#define EXIF_TAG_SCENCE_CAPTURE_TYPE 0xA406 - -/* 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, -} CamExifWhiteBalanceType; - -/* Values */ -#define EXIF_DEF_MAKER "SAMSUNG" -#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_FNUMBER_NUM 265 /* 2.65 */ -#define EXIF_DEF_FNUMBER_DEN 100 -#define EXIF_DEF_EXPOSURE_PROGRAM 3 /* aperture priority */ -#define EXIF_DEF_FOCAL_LEN_NUM 278 /* 2.78mm */ -#define EXIF_DEF_FOCAL_LEN_DEN 100 -#define EXIF_DEF_FLASH 0 /* O: off, 1: on*/ -#define EXIF_DEF_COLOR_SPACE 1 -#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 */ - -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; - - unsigned char maker[32]; - unsigned char model[32]; - unsigned char software[32]; - unsigned char exif_version[4]; - unsigned char date_time[20]; - unsigned char user_comment[150]; - - 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 exposure_mode; - uint16_t white_balance; - uint16_t scene_capture_type; - - rational_t exposure_time; - rational_t fnumber; - rational_t aperture; - rational_t max_aperture; - rational_t focal_length; - - srational_t shutter_speed; - srational_t brightness; - srational_t exposure_bias; - - unsigned char gps_latitude_ref[2]; - unsigned 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]; - unsigned char gps_datestamp[11]; - unsigned char gps_processing_method[100]; - - rational_t x_resolution; - rational_t y_resolution; - uint16_t resolution_unit; - uint16_t compression_scheme; -} exif_attribute_t; - -#endif /* ANDROID_HARDWARE_EXIF_H */ diff --git a/exynos4/hal/include/FimgApi.h b/exynos4/hal/include/FimgApi.h deleted file mode 100644 index 208da9d..0000000 --- a/exynos4/hal/include/FimgApi.h +++ /dev/null @@ -1,168 +0,0 @@ -/* -** -** Copyright 2009 Samsung Electronics Co, Ltd. -** Copyright 2008, 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. -** -** -*/ - -#pragma clang diagnostic ignored "-Wunused-parameter" -#pragma clang diagnostic ignored "-Wmismatched-tags" -#pragma clang diagnostic ignored "-Wunused-variable" - -#ifndef FIMG_API_H -#define FIMG_API_H - -#include <utils/Log.h> -#include <pthread.h> -#include "sec_g2d_4x.h" - -#undef REAL_DEBUG -#undef ANDROID_LOG - -#if defined(REAL_DEBUG) -#ifdef ANDROID_LOG -#define PRINT SLOGE -#define PRINTD SLOGD -#else -#define PRINT printf -#define PRINTD printf -#endif -#else -void VOID_FUNC(const char *format, ...); - -#define PRINT VOID_FUNC -#define PRINTD VOID_FUNC -#endif - -struct Fimg { - int srcX; - int srcY; - unsigned int srcW; - unsigned int srcH; - unsigned int srcFWStride; // this is not w, just stride (w * bpp) - unsigned int srcFH; - unsigned int srcBPP; - int srcColorFormat; - unsigned char *srcAddr; - - int dstX; - int dstY; - unsigned int dstW; - unsigned int dstH; - unsigned int dstFWStride; // this is not w, just stride (w * bpp) - unsigned int dstFH; - unsigned int dstBPP; - int dstColorFormat; - unsigned char *dstAddr; - - int clipT; - int clipB; - int clipL; - int clipR; - - int mskX; - int mskY; - unsigned int mskW; - unsigned int mskH; - unsigned int mskFWStride; // this is not w, just stride (w * bpp) - unsigned int mskFH; - unsigned int mskBPP; - int mskColorFormat; - unsigned char *mskAddr; - - unsigned long fillcolor; - int rotate; - unsigned int alpha; - int xfermode; - int isDither; - int isFilter; - int colorFilter; - int matrixType; - float matrixSx; - float matrixSy; -}; - -#ifdef __cplusplus - -struct blit_op_table { - int op; - const char *str; -}; - -extern struct blit_op_table optbl[]; - -class FimgApi -{ - public: -#endif - -#ifdef __cplusplus - private : - bool m_flagCreate; - - protected : - FimgApi(); - FimgApi(const FimgApi& rhs) {} - virtual ~FimgApi(); - - public: - bool Create(void); - bool Destroy(void); - inline bool FlagCreate(void) { return m_flagCreate; } - bool Stretch(struct fimg2d_blit *cmd); - bool Sync(void); - - protected: - virtual bool t_Create(void); - virtual bool t_Destroy(void); - virtual bool t_Stretch(struct fimg2d_blit *cmd); - virtual bool t_Sync(void); - virtual bool t_Lock(void); - virtual bool t_UnLock(void); - -}; -#endif - -#ifdef __cplusplus -extern "C" -#endif -struct FimgApi *createFimgApi(); - -#ifdef __cplusplus -extern "C" -#endif -void destroyFimgApi(FimgApi *ptrFimgApi); - -#ifdef __cplusplus -extern "C" -#endif -int stretchFimgApi(struct fimg2d_blit *cmd); -#ifdef __cplusplus -extern "C" -#endif -int SyncFimgApi(void); - -#ifdef __cplusplus -extern "C" -#endif -int FimgApiCheckBoostup(Fimg *curr, Fimg *prev); - -void printDataBlit(char *title, struct fimg2d_blit *cmd); -void printDataBlitRotate(int rotate); -void printDataBlitImage(char *title, struct fimg2d_image *image); -void printDataBlitRect(char *title, struct fimg2d_rect *rect); -void printDataBlitScale(struct fimg2d_scale *scaling); -#endif //FIMG_API_H diff --git a/exynos4/hal/include/SecBuffer.h b/exynos4/hal/include/SecBuffer.h deleted file mode 100644 index 74cceb7..0000000 --- a/exynos4/hal/include/SecBuffer.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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 SecBuffer.h - * \brief header file for SecBuffer - * \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 - * - */ - -/** - * @page SecBuffer - * - * @section Introduction - * SecBuffer is common struct for buffer - * - * @section Copyright - * Copyright (c) 2008-2011 Samsung Electronics Co., Ltd.All rights reserved. \n - * Proprietary and Confidential - * - * @image html samsung.png - */ - -#ifndef __SEC_BUFFER_H__ -#define __SEC_BUFFER_H__ - -#include <sys/types.h> - -//! Buffer information -struct SecBuffer -{ -#ifdef __cplusplus -public: -#endif - //! Buffer type - enum BUFFER_TYPE - { - BUFFER_TYPE_BASE = 0, - BUFFER_TYPE_VIRT = 1, //!< virtual address - BUFFER_TYPE_PHYS = 1 << 1, //!< physical address - BUFFER_TYPE_RESERVED = 1 << 2, //!< reserved type - BUFFER_TYPE_MAX, - }; - - //! Buffer virtual address - union { - char *p; //! single address. - char *extP[3]; //! Y Cb Cr. - } virt; - - //! Buffer physical address - union { - unsigned int p; //! single address. - unsigned int extP[3]; //! Y Cb Cr. - } phys; - - //! Buffer reserved id - union { - unsigned int p; //! \n - unsigned int extP[3]; //! \n - } reserved; - - //! Buffer size - union { - unsigned int s; - unsigned int extS[3]; - } size; - -#ifdef __cplusplus - //! Constructor - SecBuffer() - { - for (int i = 0; i < 3; i++) { - virt. extP[i] = NULL; - phys. extP[i] = 0; - reserved.extP[i] = 0; - size. extS[i] = 0; - } - } - - //! Constructor - SecBuffer(const SecBuffer *other) - { - for (int i = 0; i < 3; i++) { - virt. extP[i] = other->virt.extP[i]; - phys. extP[i] = other->phys.extP[i]; - reserved.extP[i] = other->reserved.extP[i]; - size. extS[i] = other->size.extS[i]; - } - } - - //! Operator(=) override - SecBuffer& operator =(const SecBuffer &other) - { - for (int i = 0; i < 3; i++) { - virt. extP[i] = other.virt.extP[i]; - phys. extP[i] = other.phys.extP[i]; - reserved.extP[i] = other.reserved.extP[i]; - size. extS[i] = other.size.extS[i]; - } - return *this; - } - - //! Operator(==) override - bool operator ==(const SecBuffer &other) const - { - return ( virt. extP[0] == other.virt.extP[0] - && virt. extP[1] == other.virt.extP[1] - && virt. extP[2] == other.virt.extP[2] - && phys. extP[0] == other.phys.extP[0] - && phys. extP[1] == other.phys.extP[1] - && phys. extP[2] == other.phys.extP[2] - && reserved.extP[0] == other.reserved.extP[0] - && reserved.extP[1] == other.reserved.extP[1] - && reserved.extP[2] == other.reserved.extP[2] - && size. extS[0] == other.size.extS[0] - && size. extS[1] == other.size.extS[1] - && size. extS[2] == other.size.extS[2]); - } - - //! Operator(!=) override - bool operator !=(const SecBuffer &other) const - { - // use operator(==) - return !(*this == other); - } - - //! Get Buffer type - static int BUFFER_TYPE(SecBuffer *buf) - { - int type = BUFFER_TYPE_BASE; - if (buf->virt.p) - type |= BUFFER_TYPE_VIRT; - if (buf->phys.p) - type |= BUFFER_TYPE_PHYS; - if (buf->reserved.p) - type |= BUFFER_TYPE_RESERVED; - - return type; - } -#endif -}; - -#endif //__SEC_BUFFER_H__ diff --git a/exynos4/hal/include/SecFimc.h b/exynos4/hal/include/SecFimc.h deleted file mode 100644 index 9201aaf..0000000 --- a/exynos4/hal/include/SecFimc.h +++ /dev/null @@ -1,149 +0,0 @@ -/* 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 __SAMSUNG_SYSLSI_APDEV_FIMCLIB_H__ -#define __SAMSUNG_SYSLSI_APDEV_FIMCLIB_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <linux/fb.h> - -#include <stdint.h> -#include <string.h> -#include <unistd.h> -#include <errno.h> -#include <fcntl.h> - -#include <sys/ioctl.h> -#include <sys/types.h> -#include <sys/poll.h> -#include <sys/mman.h> -#include <hardware/hardware.h> - -#include "utils/Timers.h" - -#include "s5p_fimc.h" -#include "sec_utils.h" -#include "sec_format.h" -#include "SecBuffer.h" -#include "SecRect.h" - - -#define PFX_NODE_FIMC "/dev/video" - -int fimc_switch_color_format(int color_space); - -#ifdef __cplusplus -} - -class SecFimc -{ -public: - enum FIMC_DEV - { - FIMC_DEV0 = 0, - FIMC_DEV1, - FIMC_DEV2, - FIMC_DEV3, - }; -private: - bool mFlagCreate; - FIMC_DEV mFimcDev; - fimc_overlay_mode mFimcOvlyMode; - struct v4l2_capability mFimcCap; - unsigned int mFimcRrvedPhysMemAddr; - unsigned int mBufNum; - unsigned int mBufIndex; - s5p_fimc_t mS5pFimc; - unsigned int mRotVal; - bool mFlagGlobalAlpha; - int mGlobalAlpha; - bool mFlagLocalAlpha; - bool mFlagColorKey; - int mColorKey; - bool mFlagSetSrcParam; - bool mFlagSetDstParam; - bool mFlagStreamOn; - -public: - SecFimc(); - virtual ~SecFimc(); - bool create(FIMC_DEV fimc_dev, fimc_overlay_mode fimc_mode, unsigned int buf_num); - bool destroy(void); - bool flagCreate(void); - - int getSecFimcFd(); -// bool createWithFd(int fd, FIMC_DEV fimc_dev); - int getFimcRsrvedPhysMemAddr(); - int getFimcVersion(); - - bool checkFimcSrcSize(unsigned int width, unsigned int height, - unsigned int cropX, unsigned int cropY, unsigned int* cropWidth, unsigned int* cropHeight, - int colorFormat, bool forceChange = false); - - bool checkFimcDstSize(unsigned int width, unsigned int height, - unsigned int cropX, unsigned int cropY, unsigned int* cropWidth, unsigned int* cropHeight, - int colorFormat, int rotVal, bool forceChange = false); - - bool setSrcParams(unsigned int width, unsigned int height, - unsigned int cropX, unsigned int cropY, unsigned int* cropWidth, unsigned int* cropHeight, - int colorFormat, bool forceChange = true); - - bool getSrcParams(unsigned int* width, unsigned int* height, - unsigned int* cropX, unsigned int* cropY, unsigned int* cropWidth, unsigned int* cropHeight, - int* colorFormat); - - bool setSrcPhyAddr(unsigned int physYAddr, unsigned int physCbAddr = 0, unsigned int physCrAddr = 0, int colorFormat = 0); - - bool setDstParams(unsigned int width, unsigned int height, - unsigned int cropX, unsigned int cropY, unsigned int* cropWidth, unsigned int* cropHeight, - int colorFormat, bool forceChange = true); - - bool getDstParams(unsigned int* width, unsigned int* height, - unsigned int* cropX, unsigned int* cropY, unsigned int* cropWidth, unsigned int* cropHeight, - int* colorFormat); - - bool setDstPhyAddr(unsigned int physYAddr, unsigned int physCbAddr = 0, unsigned int physCrAddr = 0); - - bool setRotVal(unsigned int rotVal); - bool setGlobalAlpha(bool enable = true, int alpha = 0xff); - bool setLocalAlpha(bool enable); - bool setColorKey(bool enable = true, int colorKey = 0xff); - bool streamOn(); - bool streamOff(); - bool queryBuffer(int index, struct v4l2_buffer *buf); - bool queueBuffer(int index); - int dequeueBuffer(int* index); - bool handleOneShot(); - -private: - int m_widthOfFimc(int fimc_color_format, int width); - int m_heightOfFimc(int fimc_color_format, int height); - unsigned int m_get_yuv_bpp(unsigned int fmt); - unsigned int m_get_yuv_planes(unsigned int fmt); -}; -#endif - -#endif //__SAMSUNG_SYSLSI_APDEV_FIMCLIB_H__
\ No newline at end of file diff --git a/exynos4/hal/include/SecHdmi.h b/exynos4/hal/include/SecHdmi.h deleted file mode 100644 index 08bee20..0000000 --- a/exynos4/hal/include/SecHdmi.h +++ /dev/null @@ -1,221 +0,0 @@ -/* - * 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. -** -** @author Sangwoo, Park(sw5771.park@samsung.com) -** @date 2010-09-10 -** -*/ - -#ifndef __SEC_HDMI_H__ -#define __SEC_HDMI_H__ - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/mman.h> -#include <fcntl.h> -#include <ctype.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> -#include <signal.h> -#include <pthread.h> - -#ifdef BOARD_USE_V4L2 -#include "s5p_tvout_v4l2.h" -#else -#include "s5p_tvout.h" -#endif -#if defined(BOARD_USES_FIMGAPI) -#include "sec_g2d.h" -#endif -#include "s3c_lcd.h" -#include "SecBuffer.h" -#include "SecFimc.h" - -#include "../libhdmi/libsForhdmi/libedid/libedid.h" -#include "../libhdmi/libsForhdmi/libcec/libcec.h" - -#include "../libhdmi/SecHdmi/SecHdmiCommon.h" -#include "../libhdmi/SecHdmi/SecHdmiV4L2Utils.h" - -#if defined(BOARD_USES_FIMGAPI) -#include "FimgApi.h" -#endif - -#include <linux/fb.h> - -#include <hardware/hardware.h> - -#include <utils/threads.h> - - -namespace android { - -class SecHdmi: virtual public RefBase -{ -public : - enum HDMI_LAYER { - HDMI_LAYER_BASE = 0, - HDMI_LAYER_VIDEO, - HDMI_LAYER_GRAPHIC_0, - HDMI_LAYER_GRAPHIC_1, - HDMI_LAYER_MAX, - }; - -private : - class CECThread: public Thread - { - public: - bool mFlagRunning; - - private: - sp<SecHdmi> mSecHdmi; - Mutex mThreadLoopLock; - Mutex mThreadControlLock; - virtual bool threadLoop(); - enum CECDeviceType mDevtype; - int mLaddr; - int mPaddr; - - public: - CECThread(sp<SecHdmi> secHdmi) - :Thread(false), - mFlagRunning(false), - mSecHdmi(secHdmi), - mDevtype(CEC_DEVICE_PLAYER), - mLaddr(0), - mPaddr(0){ - }; - virtual ~CECThread(); - - bool start(); - bool stop(); - - }; - - Mutex mLock; - - sp<CECThread> mCECThread; - - bool mFlagCreate; - bool mFlagConnected; - bool mFlagLayerEnable[HDMI_LAYER_MAX]; - bool mFlagHdmiStart[HDMI_LAYER_MAX]; - - int mSrcWidth[HDMI_LAYER_MAX]; - int mSrcHeight[HDMI_LAYER_MAX]; - int mSrcColorFormat[HDMI_LAYER_MAX]; - int mHdmiResolutionWidth[HDMI_LAYER_MAX]; - int mHdmiResolutionHeight[HDMI_LAYER_MAX]; - - int mHdmiDstWidth; - int mHdmiDstHeight; - - unsigned int mHdmiSrcYAddr; - unsigned int mHdmiSrcCbCrAddr; - - int mHdmiOutputMode; - unsigned int mHdmiResolutionValue; - - unsigned int mHdmiPresetId; - v4l2_std_id mHdmiStdId; - unsigned int mCompositeStd; - - bool mHdcpMode; - int mAudioMode; - unsigned int mUIRotVal; - unsigned int mG2DUIRotVal; - - int mCurrentHdmiOutputMode; - unsigned int mCurrentHdmiResolutionValue; - bool mCurrentHdcpMode; - int mCurrentAudioMode; - bool mHdmiInfoChange; - - int mFimcDstColorFormat; - - SecBuffer mFimcReservedMem[HDMI_FIMC_OUTPUT_BUF_NUM]; - unsigned int mFimcCurrentOutBufIndex; - SecFimc mSecFimc; - - unsigned int mHdmiResolutionValueList[14]; - int mHdmiSizeOfResolutionValueList; - - SecBuffer mMixerBuffer[HDMI_LAYER_MAX][MAX_BUFFERS_MIXER]; - - void *mFBaddr; - unsigned int mFBsize; - int mFBionfd; - unsigned int mFBIndex; - int mHdmiFd[HDMI_LAYER_MAX]; - - int mDstWidth[HDMI_LAYER_MAX]; - int mDstHeight[HDMI_LAYER_MAX]; - int mPrevDstWidth[HDMI_LAYER_MAX]; - int mPrevDstHeight[HDMI_LAYER_MAX]; - - int mDefaultFBFd; - int mDisplayWidth; - int mDisplayHeight; - - struct v4l2_rect mDstRect; - -public : - - SecHdmi(); - virtual ~SecHdmi(); - bool create(int width, int height); - bool destroy(void); - inline bool flagCreate(void) { return mFlagCreate; } - - bool connect(void); - bool disconnect(void); - - bool flagConnected(void); - - bool flush(int srcW, int srcH, int srcColorFormat, - unsigned int srcYAddr, unsigned int srcCbAddr, unsigned int srcCrAddr, - int dstX, int dstY, - int hdmiLayer, - int num_of_hwc_layer); - - bool clear(int hdmiLayer); - - bool setHdmiOutputMode(int hdmiOutputMode, bool forceRun = false); - bool setHdmiResolution(unsigned int hdmiResolutionValue, bool forceRun = false); - bool setHdcpMode(bool hdcpMode, bool forceRun = false); - bool setUIRotation(unsigned int rotVal, unsigned int hwcLayer); - bool setDisplaySize(int width, int height); - -private: - - bool m_reset(int w, int h, int colorFormat, int hdmiLayer, int hwcLayer); - bool m_startHdmi(int hdmiLayer, unsigned int num_of_plane); - bool m_startHdmi(int hdmiLayer); - bool m_stopHdmi(int hdmiLayer); - bool m_setHdmiOutputMode(int hdmiOutputMode); - bool m_setHdmiResolution(unsigned int hdmiResolutionValue); - bool m_setCompositeResolution(unsigned int compositeStdId); - bool m_setHdcpMode(bool hdcpMode); - bool m_setAudioMode(int audioMode); - - int m_resolutionValueIndex(unsigned int ResolutionValue); - bool m_flagHWConnected(void); -}; - -}; // namespace android - -#endif //__SEC_HDMI_H__ diff --git a/exynos4/hal/include/SecRect.h b/exynos4/hal/include/SecRect.h deleted file mode 100644 index 1160a0b..0000000 --- a/exynos4/hal/include/SecRect.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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 SecRect.h - * \brief header file for SecRect - * \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 - * - */ - -/** - * @page SecRect - * - * @section Introduction - * SetRect is common struct for rectangle - * - * @section Copyright - * Copyright (c) 2008-2011 Samsung Electronics Co., Ltd.All rights reserved. \n - * Proprietary and Confidential - * - * @image html samsung.png - */ - -#ifndef __SEC_RECT_H__ -#define __SEC_RECT_H__ - -//! Rectangle information -struct SecRect -{ - int x; //!< x pos - int y; //!< y pos - int w; //!< width - int h; //!< height - int fullW; //!< full width of image - int fullH; //!< full height of image - int colorFormat; //!< V4L2_PIX_FMT_XXX - - //! Constructor - SecRect(int _x_ = 0, - int _y_ = 0, - int _w_ = 0, - int _h_ = 0, - int _fullW_ = 0, - int _fullH_ = 0, - int _colorFormat_ = 0) - { - x = _x_; - y = _y_; - w = _w_; - h = _h_; - fullW = _fullW_; - fullH = _fullH_; - colorFormat = _colorFormat_; - } - - //! Constructor - SecRect(const SecRect *other) - { - x = other->x; - y = other->y; - w = other->w; - h = other->h; - fullW = other->fullW; - fullH = other->fullH; - colorFormat = other->colorFormat; - } - - //! Operator(=) override - SecRect& operator =(const SecRect &other) - { - x = other.x; - y = other.y; - w = other.w; - h = other.h; - fullW = other.fullW; - fullH = other.fullH; - colorFormat = other.colorFormat; - return *this; - } - - //! Operator(==) override - bool operator ==(const SecRect &other) const - { - return ( x == other.x - && y == other.y - && w == other.w - && h == other.h - && fullW == other.fullW - && fullH == other.fullH - && colorFormat == other.colorFormat); - } - - //! Operator(!=) override - bool operator !=(const SecRect &other) const - { - // use operator(==) - return !(*this == other); - } -}; - -//! Clip information -struct SecRect2 -{ - int x1; //!< Left (The x-coordinate value of upper-left corner) - int y1; //!< Top (The y-coordinate value of upper-left corner) - int x2; //!< Right (The x-coordinate value of lower-right corner) - int y2; //!< Bottom (The y-coordinate value of lower-right corner) - - //! Constructor - SecRect2(int _x1_ = 0, int _y1_ = 0, int _x2_ = 0, int _y2_ = 0) - { - x1 = _x1_; - y1 = _y1_; - x2 = _x2_; - y2 = _y2_; - } - - //! Constructor - SecRect2(const SecRect2 *other) - { - x1 = other->x1; - y1 = other->y1; - x2 = other->x2; - y2 = other->y2; - } - - //! Operator(=) override - SecRect2& operator =(const SecRect2 &other) - { - x1 = other.x1; - y1 = other.y1; - x2 = other.x2; - y2 = other.y2; - return *this; - } - - //! Operator(==) override - bool operator ==(const SecRect2 &other) const - { - return ( x1 == other.x1 - && y1 == other.y1 - && x2 == other.x2 - && y2 == other.y2); - } - - //! Operator(!=) override - bool operator !=(const SecRect2 &other) const - { - // use operator(==) - return !(*this == other); - } -}; - -#endif //__SEC_RECT_H__ diff --git a/exynos4/hal/include/audio.h b/exynos4/hal/include/audio.h deleted file mode 100644 index 1275db3..0000000 --- a/exynos4/hal/include/audio.h +++ /dev/null @@ -1,363 +0,0 @@ -/* - * 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 _AUDIO_H_ -#define _AUDIO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __HDMI_AUDIO_HDMIAUDIOPORT__ -#define __HDMI_AUDIO_HDMIAUDIOPORT__ -/** - * @enum HDMIAudioPort - * Available audio inputs on HDMI HW module. - */ -enum HDMIAudioPort { - /** I2S input port */ - I2S_PORT, - /** SPDIF input port */ - SPDIF_PORT, - /** DSD input port */ - DSD_PORT, -}; -#endif /* __HDMI_AUDIO_HDMIAUDIOPORT__ */ - -#ifndef __HDMI_AUDIO_AUDIOFORMAT__ -#define __HDMI_AUDIO_AUDIOFORMAT__ -/** - * @enum AudioFormat - * The encoding format of audio stream - */ -enum AudioFormat { - /** LPCM encoding format */ - LPCM_FORMAT = 1, - /** AC3 encoding format */ - AC3_FORMAT, - /** MPEG1 encoding format */ - MPEG1_FORMAT, - /** MP3 encoding format */ - MP3_FORMAT, - /** MPEG2 encoding format */ - MPEG2_FORMAT, - /** AAC encoding format */ - AAC_FORMAT, - /** DTS encoding format */ - DTS_FORMAT, - /** ATRAC encoding format */ - ATRAC_FORMAT, - /** DSD encoding format */ - DSD_FORMAT, - /** Dolby Digital+ encoding format */ - Dolby_Digital_Plus_FORMAT, - /** DTS HD encoding format */ - DTS_HD_FORMAT, - /** MAT encoding format */ - MAT_FORMAT, - /** DST encoding format */ - DST_FORMAT, - /** WAM_Pro encoding format */ - WAM_Pro_FORMAT -}; -#endif /* __HDMI_AUDIO_AUDIOFORMAT__ */ - -#ifndef __HDMI_AUDIO_LPCMWORDLENGTH__ -#define __HDMI_AUDIO_LPCMWORDLENGTH__ -/** - * @enum LPCM_WordLen - * Word length of LPCM audio stream. - */ -enum LPCM_WordLen { - /** 16bit word length */ - WORD_16 = 0, - /** 17bit word length */ - WORD_17, - /** 18bit word length */ - WORD_18, - /** 19bit word length */ - WORD_19, - /** 20bit word length */ - WORD_20, - /** 21bit word length */ - WORD_21, - /** 22bit word length */ - WORD_22, - /** 23bit word length */ - WORD_23, - /** 24bit word length */ - WORD_24 -}; -#endif /* __HDMI_AUDIO_LPCMWORDLENGTH__ */ - -#ifndef __HDMI_AUDIO_SAMPLINGFREQUENCY__ -#define __HDMI_AUDIO_SAMPLINGFREQUENCY__ -/** - * @enum SamplingFreq - * Sampling frequency of audio stream. - */ -enum SamplingFreq { - /** 32KHz sampling frequency */ - SF_32KHZ = 0, - /** 44.1KHz sampling frequency */ - SF_44KHZ, - /** 48KHz sampling frequency */ - SF_48KHZ, - /** 88.2KHz sampling frequency */ - SF_88KHZ, - /** 96KHz sampling frequency */ - SF_96KHZ, - /** 176.4KHz sampling frequency */ - SF_176KHZ, - /** 192KHz sampling frequency */ - SF_192KHZ -}; -#endif /* __HDMI_AUDIO_SAMPLINGFREQUENCY__ */ - -#ifndef __HDMI_AUDIO_CHANNELNUMBER__ -#define __HDMI_AUDIO_CHANNELNUMBER__ -/** - * @enum ChannelNum - * Channel number of audio stream. - */ -enum ChannelNum { - /** 2 channel audio stream */ - CH_2 = 2, - /** 3 channel audio stream */ - CH_3, - /** 4 channel audio stream */ - CH_4, - /** 5 channel audio stream */ - CH_5, - /** 6 channel audio stream */ - CH_6, - /** 7 channel audio stream */ - CH_7, - /** 8 channel audio stream */ - CH_8, -}; -#endif /* __HDMI_AUDIO_CHANNELNUMBER__ */ - -#ifndef __HDMI_AUDIO_AUDIOSAMPLEPACKETTYPE__ -#define __HDMI_AUDIO_AUDIOSAMPLEPACKETTYPE__ -/** - * @enum HDMIASPType - * Type of HDMI audio sample packet - */ -enum HDMIASPType { - /** Audio Sample Packet Type */ - HDMI_ASP, - /** One Bit Audio Packet Type */ - HDMI_DSD, - /** High Bit Rate Packet Type */ - HDMI_HBR, - /** DST Packet Type */ - HDMI_DST -}; -#endif /* __HDMI_AUDID_AUDIOSAMPLEPACKETTYPE__ */ - -#ifndef __HDMI_AUDIO_I2S_CUV_AUDIO_CODING_TYPE__ -#define __HDMI_AUDIO_I2S_CUV_AUDIO_CODING_TYPE__ -/** - * @enum CUVAudioCoding - * Audio coding type information for CUV fields. - */ -enum CUVAudioCoding { - /** Linear PCM coding type */ - CUV_LPCM, - /** Non-linear PCM coding type */ - CUV_NLPCM -}; -#endif /* __HDMI_AUDIO_I2S_CUV_AUDIO_CODING_TYPE__ */ - -#ifndef __HDMI_AUDIO_SPDIF_AUDIO_CODING_TYPE__ -#define __HDMI_AUDIO_SPDIF_AUDIO_CODING_TYPE__ -/** - * @enum SPDIFAudioCoding - * Audio coding type information for SPDIF input port. - */ -enum SPDIFAudioCoding { - /** Linear PCM coding type */ - SPDIF_LPCM, - /** Non-linear PCM coding type */ - SPDIF_NLPCM -}; -#endif /* __HDMI_AUDIO_SPDIF_AUDIO_CODING_TYPE__ */ - -#ifndef __HDMI_AUDIO_I2S_CUV_CHANNEL_NUMBER__ -#define __HDMI_AUDIO_I2S_CUV_CHANNEL_NUMBER__ -/** - * @enum CUVChannelNumber - * Channel number information for CUV fields. - */ -enum CUVChannelNumber { - /** Unknown channel audio stream */ - CUV_CH_UNDEFINED = 0, - /** 1 channel audio stream */ - CUV_CH_01, - /** 2 channel audio stream */ - CUV_CH_02, - /** 3 channel audio stream */ - CUV_CH_03, - /** 4 channel audio stream */ - CUV_CH_04, - /** 5 channel audio stream */ - CUV_CH_05, - /** 6 channel audio stream */ - CUV_CH_06, - /** 7 channel audio stream */ - CUV_CH_07, - /** 8 channel audio stream */ - CUV_CH_08, - /** 9 channel audio stream */ - CUV_CH_09, - /** 10 channel audio stream */ - CUV_CH_10, - /** 11 channel audio stream */ - CUV_CH_11, - /** 12 channel audio stream */ - CUV_CH_12, - /** 13 channel audio stream */ - CUV_CH_13, - /** 14 channel audio stream */ - CUV_CH_14, - /** 15 channel audio stream */ - CUV_CH_15, -}; -#endif /* __HDMI_AUDIO_I2S_CUV_CHANNEL_NUMBER__ */ - -#ifndef __HDMI_AUDIO_I2S_CUV_WORD_LENGTH__ -#define __HDMI_AUDIO_I2S_CUV_WORD_LENGTH__ -/** - * @enum CUVWordLength - * Word length information of LPCM audio stream for CUV fields. - */ -enum CUVWordLength { - /** Max word length is 20 bits, number of valid bits is not defined */ - CUV_WL_20_NOT_DEFINED, - /** Max word length is 20 bits, 16 bits are valid */ - CUV_WL_20_16, - /** Max word length is 20 bits, 18 bits are valid */ - CUV_WL_20_18, - /** Max word length is 20 bits, 19 bits are valid */ - CUV_WL_20_19, - /** Max word length is 20 bits, 20 bits are valid */ - CUV_WL_20_20, - /** Max word length is 20 bits, 17 bits are valid */ - CUV_WL_20_17, - /** Max word length is 24 bits, number of valid bits is not defined */ - CUV_WL_24_NOT_DEFINED, - /** Max word length is 24 bits, 20 bits are valid */ - CUV_WL_24_20, - /** Max word length is 24 bits, 22 bits are valid */ - CUV_WL_24_22, - /** Max word length is 24 bits, 23 bits are valid */ - CUV_WL_24_23, - /** Max word length is 24 bits, 24 bits are valid */ - CUV_WL_24_24, - /** Max word length is 24 bits, 21 bits are valid */ - CUV_WL_24_21, -}; -#endif /* __HDMI_AUDIO_I2S_CUV_WORD_LENGTH__ */ - -#ifndef __HDMI_AUDIO_I2S_BITS_PER_CHANNEL__ -#define __HDMI_AUDIO_I2S_BITS_PER_CHANNEL__ - -/** - * @enum I2SBitsPerChannel - * Serial data bit per channel in I2S audio stream. - */ -enum I2SBitsPerChannel { - /** 16 bits per channel */ - I2S_BPC_16, - /** 20 bits per channel */ - I2S_BPC_20, - /** 24 bits per channel */ - I2S_BPC_24 -}; - -#endif /* __HDMI_AUDIO_I2S_BITS_PER_CHANNEL__ */ - -#ifndef __HDMI_AUDIO_I2S_DATA_FORMAT__ -#define __HDMI_AUDIO_I2S_DATA_FORMAT__ - -/** - * @enum I2SDataFormat - * Foramt of data in I2S audio stream. - */ -enum I2SDataFormat { - /** Basic format */ - I2S_BASIC, - /** Left justified format */ - I2S_LEFT_JUSTIFIED, - /** Right justified format */ - I2S_RIGHT_JUSTIFIED -}; - -#endif /* __HDMI_AUDIO_I2S_DATA_FORMAT__ */ - -#ifndef __HDMI_AUDIO_I2S_CLOCK_PER_FRAME__ -#define __HDMI_AUDIO_I2S_CLOCK_PER_FRAME__ - -/** - * @enum I2SClockPerFrame - * Bit clock per Frame in I2S audio stream. - */ -enum I2SClockPerFrame { - /** 32 clock per Frame */ - I2S_32FS, - /** 48 clock per Frame */ - I2S_48FS, - /** 64 clock per Frame */ - I2S_64FS -}; - -#endif /* __HDMI_AUDIO_I2S_CLOCK_PER_FRAME__ */ - -#ifndef __HDMI_AUDIO_I2S_PARAMETER__ -#define __HDMI_AUDIO_I2S_PARAMETER__ - -//! Structure for I2S audio stream -struct I2SParameter { - enum I2SBitsPerChannel bpc; - enum I2SDataFormat format; - enum I2SClockPerFrame clk; -}; -#endif /* __HDMI_AUDIO_I2S_PARAMETER__ */ - -//! Structure for HDMI audio input -struct HDMIAudioParameter { - /** Input audio port to HDMI HW */ - enum HDMIAudioPort inputPort; - /** Output Packet type **/ - enum HDMIASPType outPacket; - /** Encoding format */ - enum AudioFormat formatCode; - /** Channel number */ - enum ChannelNum channelNum; - /** Sampling frequency */ - enum SamplingFreq sampleFreq; - /** Word length. This is avaliable only if LPCM encoding format */ - enum LPCM_WordLen wordLength; - /** structure for I2S audio stream */ - struct I2SParameter i2sParam; -}; - -#ifdef __cplusplus -} -#endif - -#endif // _AUDIO_H_ diff --git a/exynos4/hal/include/exynos_mem.h b/exynos4/hal/include/exynos_mem.h deleted file mode 100644 index 07dde55..0000000 --- a/exynos4/hal/include/exynos_mem.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2008 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 __INCLUDE_EXYNOS_MEM_H -#define __INCLUDE_EXYNOS_MEM_H __FILE__ - -/* IOCTL commands */ -#define EXYNOS_MEM_SET_CACHEABLE _IOW('M', 200, bool) -#define EXYNOS_MEM_PADDR_CACHE_FLUSH _IOW('M', 201, struct exynos_mem_flush_range) -#define EXYNOS_MEM_SET_PHYADDR _IOW('M', 202, unsigned int) -#define EXYNOS_MEM_PADDR_CACHE_CLEAN _IOW('M', 203, struct exynos_mem_flush_range) - -struct exynos_mem_flush_range { - dma_addr_t start; - size_t length; -}; - -#endif /* __INCLUDE_EXYNOS_MEM_H */ diff --git a/exynos4/hal/include/format.h b/exynos4/hal/include/format.h deleted file mode 100644 index bbf9cc8..0000000 --- a/exynos4/hal/include/format.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2005 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_PIXELFLINGER_FORMAT_H -#define ANDROID_PIXELFLINGER_FORMAT_H - -#include <stdint.h> -#include <sys/types.h> - -enum GGLPixelFormat { - // these constants need to match those - // in graphics/PixelFormat.java, ui/PixelFormat.h, BlitHardware.h - GGL_PIXEL_FORMAT_UNKNOWN = 0, - GGL_PIXEL_FORMAT_NONE = 0, - - GGL_PIXEL_FORMAT_RGBA_8888 = 1, // 4x8-bit ARGB - GGL_PIXEL_FORMAT_RGBX_8888 = 2, // 3x8-bit RGB stored in 32-bit chunks - GGL_PIXEL_FORMAT_RGB_888 = 3, // 3x8-bit RGB - GGL_PIXEL_FORMAT_RGB_565 = 4, // 16-bit RGB - GGL_PIXEL_FORMAT_BGRA_8888 = 5, // 4x8-bit BGRA - GGL_PIXEL_FORMAT_RGBA_5551 = 6, // 16-bit RGBA - GGL_PIXEL_FORMAT_RGBA_4444 = 7, // 16-bit RGBA - - GGL_PIXEL_FORMAT_A_8 = 8, // 8-bit A - GGL_PIXEL_FORMAT_L_8 = 9, // 8-bit L (R=G=B = L) - GGL_PIXEL_FORMAT_LA_88 = 0xA, // 16-bit LA - GGL_PIXEL_FORMAT_RGB_332 = 0xB, // 8-bit RGB (non paletted) - - // reserved range. don't use. - GGL_PIXEL_FORMAT_RESERVED_10 = 0x10, - GGL_PIXEL_FORMAT_RESERVED_11 = 0x11, - GGL_PIXEL_FORMAT_RESERVED_12 = 0x12, - GGL_PIXEL_FORMAT_RESERVED_13 = 0x13, - GGL_PIXEL_FORMAT_RESERVED_14 = 0x14, - GGL_PIXEL_FORMAT_RESERVED_15 = 0x15, - GGL_PIXEL_FORMAT_RESERVED_16 = 0x16, - GGL_PIXEL_FORMAT_RESERVED_17 = 0x17, - - // reserved/special formats - GGL_PIXEL_FORMAT_Z_16 = 0x18, - GGL_PIXEL_FORMAT_S_8 = 0x19, - GGL_PIXEL_FORMAT_SZ_24 = 0x1A, - GGL_PIXEL_FORMAT_SZ_8 = 0x1B, - - // reserved range. don't use. - GGL_PIXEL_FORMAT_RESERVED_20 = 0x20, - GGL_PIXEL_FORMAT_RESERVED_21 = 0x21, -}; - -enum GGLFormatComponents { - GGL_STENCIL_INDEX = 0x1901, - GGL_DEPTH_COMPONENT = 0x1902, - GGL_ALPHA = 0x1906, - GGL_RGB = 0x1907, - GGL_RGBA = 0x1908, - GGL_LUMINANCE = 0x1909, - GGL_LUMINANCE_ALPHA = 0x190A, -}; - -enum GGLFormatComponentIndex { - GGL_INDEX_ALPHA = 0, - GGL_INDEX_RED = 1, - GGL_INDEX_GREEN = 2, - GGL_INDEX_BLUE = 3, - GGL_INDEX_STENCIL = 0, - GGL_INDEX_DEPTH = 1, - GGL_INDEX_Y = 0, - GGL_INDEX_CB = 1, - GGL_INDEX_CR = 2, -}; - -typedef struct { -#ifdef __cplusplus - enum { - ALPHA = GGL_INDEX_ALPHA, - RED = GGL_INDEX_RED, - GREEN = GGL_INDEX_GREEN, - BLUE = GGL_INDEX_BLUE, - STENCIL = GGL_INDEX_STENCIL, - DEPTH = GGL_INDEX_DEPTH, - LUMA = GGL_INDEX_Y, - CHROMAB = GGL_INDEX_CB, - CHROMAR = GGL_INDEX_CR, - }; - inline uint32_t mask(int i) const { - return ((1<<(c[i].h-c[i].l))-1)<<c[i].l; - } - inline uint32_t bits(int i) const { - return c[i].h - c[i].l; - } -#endif - uint8_t size; // bytes per pixel - uint8_t bitsPerPixel; - union { - struct { - uint8_t ah; // alpha high bit position + 1 - uint8_t al; // alpha low bit position - uint8_t rh; // red high bit position + 1 - uint8_t rl; // red low bit position - uint8_t gh; // green high bit position + 1 - uint8_t gl; // green low bit position - uint8_t bh; // blue high bit position + 1 - uint8_t bl; // blue low bit position - }; - struct { - uint8_t h; - uint8_t l; - } __attribute__((__packed__)) c[4]; - } __attribute__((__packed__)); - uint16_t components; // GGLFormatComponents -} GGLFormat; - - -#ifdef __cplusplus -extern "C" const GGLFormat* gglGetPixelFormatTable(size_t* numEntries = 0); -#else -const GGLFormat* gglGetPixelFormatTable(size_t* numEntries); -#endif - - -// ---------------------------------------------------------------------------- - -#endif // LEGACY_ANDROID_PIXELFLINGER_FORMAT_H diff --git a/exynos4/hal/include/gralloc_priv.h b/exynos4/hal/include/gralloc_priv.h deleted file mode 100644 index 98fdac0..0000000 --- a/exynos4/hal/include/gralloc_priv.h +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (C) 2010 ARM Limited. All rights reserved. - * - * Portions of this code have been modified from the original. - * These modifications are: - * * includes - * * struct private_handle_t - * * usesPhysicallyContiguousMemory() - * * validate() - * * dynamicCast() - * - * Copyright (C) 2008 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. - */ - -//#define LOG_NDEBUG 0 -#ifndef GRALLOC_PRIV_H_ -#define GRALLOC_PRIV_H_ - -#include <stdint.h> -#include <pthread.h> -#include <errno.h> -#include <linux/fb.h> - -#include <hardware/gralloc.h> -#include <cutils/native_handle.h> - -/*#include <ump/ump.h>*/ -#include "ump.h" - -/* - * HWC_HWOVERLAY is flag for location of glReadPixels(). - * Enable this define if you want that glReadPixesl() is in HWComposer. - * If you disable this define, glReadPixesl() is called in threadloop(). - */ -#define HWC_HWOVERLAY 1 - -#define GRALLOC_ARM_UMP_MODULE 1 -#define debug_level 0 -#define debug_partial_flush 0 - -static int gMemfd = 0; - -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; - uint32_t bufferFreedMask; - - pthread_mutex_t lock; - buffer_handle_t currentBuffer; - int ion_client; - - struct fb_var_screeninfo info; - struct fb_fix_screeninfo finfo; - float xdpi; - float ydpi; - float fps; - int enableVSync; - - enum { - PRIV_USAGE_LOCKED_FOR_POST = 0x80000000 - }; -}; - -#ifdef USE_PARTIAL_FLUSH -struct private_handle_rect { - int handle; - int stride; - int l; - int t; - int w; - int h; - int locked; - struct private_handle_rect *next; -}; -#endif - -#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_PMEM = 0x00000004, - PRIV_FLAGS_USES_IOCTL = 0x00000008, - PRIV_FLAGS_USES_HDMI = 0x00000010, - PRIV_FLAGS_USES_ION = 0x00000020, - PRIV_FLAGS_NONE_CACHED = 0x00000040, - PRIV_FLAGS_GRAPHICBUFFER = 0x00000080 - }; - - enum { - LOCK_STATE_WRITE = 1<<31, - LOCK_STATE_MAPPED = 1<<30, - LOCK_STATE_READ_MASK = 0x3FFFFFFF - }; - - int fd; - - int magic; - int flags; - int size; - int base; - int lockState; - int writeOwner; - int pid; - - /* Following members are for UMP memory only */ - int ump_id; - int ump_mem_handle; - int offset; - int paddr; - - int format; - int usage; - int width; - int height; - int bpp; - int stride; - - /* Following members ard for YUV information */ - unsigned int yaddr; - unsigned int uoffset; - unsigned int voffset; - - /* Following members are for ION memory only */ - int ion_client; - void *ion_memory; - - uint64_t backing_store; - uint64_t producer_usage; - uint64_t consumer_usage; - -#ifdef __cplusplus - static const int sNumInts = 21; - static const int sNumFds = 1; - static const int sMagic = 0x3141592; - - private_handle_t(int flags, int size, int base, int lock_state, ump_secure_id secure_id, ump_handle handle,int fd_val, int offset_val, int paddr_val): - fd(fd_val), - magic(sMagic), - flags(flags), - size(size), - base(base), - lockState(lock_state), - writeOwner(0), - pid(getpid()), - ump_id((int)secure_id), - ump_mem_handle((int)handle), - offset(offset_val), - paddr(paddr_val), - format(0), - usage(0), - width(0), - height(0), - bpp(0), - stride(0), - ion_client(0), - yaddr(0), - uoffset(0), - voffset(0) - { - version = sizeof(native_handle); - numFds = sNumFds; - numInts = sNumInts; - ALOGV("%s: fd:%d magic:%d flags:%d size:%d base:%d", __func__, - fd, magic, flags, size, base); - } - - private_handle_t(int flags, int size, int base, int lock_state, int fb_file, int fb_offset): - fd(fb_file), - magic(sMagic), - flags(flags), - size(size), - base(base), - lockState(lock_state), - writeOwner(0), - pid(getpid()), - ump_id((int)UMP_INVALID_SECURE_ID), - ump_mem_handle((int)UMP_INVALID_MEMORY_HANDLE), - offset(fb_offset), - paddr(0), - format(0), - usage(0), - width(0), - height(0), - bpp(0), - stride(0), - ion_client(0), - yaddr(0), - uoffset(0), - voffset(0) - { - version = sizeof(native_handle); - numFds = sNumFds; - numInts = sNumInts; - ALOGV("%s: fd:%d magic:%d flags:%d size:%d base:%d", __func__, - fd, magic, flags, size, base); - } - - ~private_handle_t() - { - magic = 0; - } - - bool usesPhysicallyContiguousMemory() - { - return (flags & PRIV_FLAGS_FRAMEBUFFER) ? true : false; - } - - static int validate(const native_handle* h) - { - const private_handle_t* hnd = (const private_handle_t*)h; - if (!h || h->version != sizeof(native_handle) || - h->numInts != sNumInts || - h->numFds != sNumFds || - hnd->magic != sMagic) - return -EINVAL; - return 0; - } - - static private_handle_t* dynamicCast(const native_handle* in) - { - if (validate(in) == 0) - return (private_handle_t*) in; - return NULL; - } -#endif -}; - -#endif /* GRALLOC_PRIV_H_ */ diff --git a/exynos4/hal/include/graphics.h b/exynos4/hal/include/graphics.h deleted file mode 100644 index 8579bcb..0000000 --- a/exynos4/hal/include/graphics.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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. - */ - -#include <stdint.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * pixel format definitions - */ - -enum { - /* - * "linear" color pixel formats: - * - * The pixel formats below contain sRGB data but are otherwise treated - * as linear formats, i.e.: no special operation is performed when - * reading or writing into a buffer in one of these formats - */ - HAL_PIXEL_FORMAT_RGBA_5551 = 6, - HAL_PIXEL_FORMAT_RGBA_4444 = 7, -}; - -#ifdef __cplusplus -} -#endif - -/* LEGACY_SYSTEM_CORE_INCLUDE_ANDROID_GRAPHICS_H */ diff --git a/exynos4/hal/include/i2c-dev.h b/exynos4/hal/include/i2c-dev.h deleted file mode 100644 index a7a35a7..0000000 --- a/exynos4/hal/include/i2c-dev.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - i2c-dev.h - i2c-bus driver, char device interface - - Copyright (C) 1995-97 Simon G. Vogl - Copyright (C) 1998-99 Frodo Looijaard <frodol@dds.nl> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _LINUX_I2C_DEV_H -#define _LINUX_I2C_DEV_H - -#include <linux/types.h> -#include <linux/compiler.h> - -/* /dev/i2c-X ioctl commands. The ioctl's parameter is always an - * unsigned long, except for: - * - I2C_FUNCS, takes pointer to an unsigned long - * - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data - * - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data - */ -#define I2C_RETRIES 0x0701 /* number of times a device address should - be polled when not acknowledging */ -#define I2C_TIMEOUT 0x0702 /* set timeout in units of 10 ms */ - -/* NOTE: Slave address is 7 or 10 bits, but 10-bit addresses - * are NOT supported! (due to code brokenness) - */ -#define I2C_SLAVE 0x0703 /* Use this slave address */ -#define I2C_SLAVE_FORCE 0x0706 /* Use this slave address, even if it - is already in use by a driver! */ -#define I2C_TENBIT 0x0704 /* 0 for 7 bit addrs, != 0 for 10 bit */ - -#define I2C_FUNCS 0x0705 /* Get the adapter functionality mask */ - -#define I2C_RDWR 0x0707 /* Combined R/W transfer (one STOP only) */ - -#define I2C_PEC 0x0708 /* != 0 to use PEC with SMBus */ -#define I2C_SMBUS 0x0720 /* SMBus transfer */ - - -/* This is the structure as used in the I2C_SMBUS ioctl call */ -struct i2c_smbus_ioctl_data { - __u8 read_write; - __u8 command; - __u32 size; - union i2c_smbus_data __user *data; -}; - -/* This is the structure as used in the I2C_RDWR ioctl call */ -struct i2c_rdwr_ioctl_data { - struct i2c_msg __user *msgs; /* pointers to i2c_msgs */ - __u32 nmsgs; /* number of i2c_msgs */ -}; - -#define I2C_RDRW_IOCTL_MAX_MSGS 42 - -#ifdef __KERNEL__ -#define I2C_MAJOR 89 /* Device major number */ -#endif - -#endif /* _LINUX_I2C_DEV_H */ diff --git a/exynos4/hal/include/jpeg_api.h b/exynos4/hal/include/jpeg_api.h deleted file mode 100644 index f2685e1..0000000 --- a/exynos4/hal/include/jpeg_api.h +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef __JPEG_API_H__ -#define __JPEG_API_H__ - -#define JPEG_DRIVER_NAME "/dev/s5p-jpeg" - -#define MAX_JPEG_WIDTH 3264 -#define MAX_JPEG_HEIGHT 2448 - -#define MAX_JPEG_RES (MAX_JPEG_WIDTH * MAX_JPEG_HEIGHT) - -#define JPEG_STREAM_BUF_SIZE MAX_JPEG_RES -#define JPEG_FRAME_BUF_SIZE (MAX_JPEG_RES * 3) - -#define JPEG_TOTAL_BUF_SIZE (JPEG_STREAM_BUF_SIZE + JPEG_FRAME_BUF_SIZE) - -#define JPEG_IOCTL_MAGIC 'J' - -#define IOCTL_JPEG_DEC_EXE _IO(JPEG_IOCTL_MAGIC, 1) -#define IOCTL_JPEG_ENC_EXE _IO(JPEG_IOCTL_MAGIC, 2) -#define IOCTL_GET_DEC_IN_BUF _IO(JPEG_IOCTL_MAGIC, 3) -#define IOCTL_GET_DEC_OUT_BUF _IO(JPEG_IOCTL_MAGIC, 4) -#define IOCTL_GET_ENC_IN_BUF _IO(JPEG_IOCTL_MAGIC, 5) -#define IOCTL_GET_ENC_OUT_BUF _IO(JPEG_IOCTL_MAGIC, 6) -#define IOCTL_SET_DEC_PARAM _IO(JPEG_IOCTL_MAGIC, 7) -#define IOCTL_SET_ENC_PARAM _IO(JPEG_IOCTL_MAGIC, 8) - -enum jpeg_ret_type{ - JPEG_FAIL, - JPEG_OK, - JPEG_ENCODE_FAIL, - JPEG_ENCODE_OK, - JPEG_DECODE_FAIL, - JPEG_DECODE_OK, - JPEG_OUT_OF_MEMORY, - JPEG_UNKNOWN_ERROR -}; - -enum jpeg_img_quality_level { - QUALITY_LEVEL_1 = 0, /* high */ - QUALITY_LEVEL_2, - QUALITY_LEVEL_3, - QUALITY_LEVEL_4, /* low */ -}; - -/* raw data image format */ -enum jpeg_frame_format { - YUV_422, /* decode output, encode input */ - YUV_420, /* decode output, encode output */ - RGB_565, /* encode input */ -}; - -/* jpeg data format */ -enum jpeg_stream_format { - JPEG_422, /* decode input, encode output */ - JPEG_420, /* decode input, encode output */ - JPEG_444, /* decode input*/ - JPEG_GRAY, /* decode input*/ - JPEG_RESERVED, -}; - -enum jpeg_test_mode { - encode_mode, - decode_mode, -}; - -struct jpeg_dec_param { - unsigned int width; - unsigned int height; - unsigned int size; - enum jpeg_stream_format in_fmt; - enum jpeg_frame_format out_fmt; -}; - -struct jpeg_enc_param { - unsigned int width; - unsigned int height; - unsigned int size; - enum jpeg_frame_format in_fmt; - enum jpeg_stream_format out_fmt; - enum jpeg_img_quality_level quality; -}; - -struct jpeg_args{ - char *in_buf; - unsigned int in_cookie; - unsigned int in_buf_size; - char *out_buf; - unsigned int out_cookie; - unsigned int out_buf_size; - char *mmapped_addr; - struct jpeg_dec_param *dec_param; - struct jpeg_enc_param *enc_param; -}; - -struct jpeg_lib { - int jpeg_fd; - struct jpeg_args args; -}; - -#ifdef __cplusplus -extern "C" { -#endif -int api_jpeg_decode_init(); -int api_jpeg_encode_init(); -int api_jpeg_decode_deinit(int dev_fd); -int api_jpeg_encode_deinit(int dev_fd); -void *api_jpeg_get_decode_in_buf(int dev_fd, unsigned int size); -void *api_jpeg_get_encode_in_buf(int dev_fd, unsigned int size); -void *api_jpeg_get_decode_out_buf(int dev_fd); -void *api_jpeg_get_encode_out_buf(int dev_fd); -void api_jpeg_set_decode_param(struct jpeg_dec_param *param); -void api_jpeg_set_encode_param(struct jpeg_enc_param *param); -enum jpeg_ret_type api_jpeg_decode_exe(int dev_fd, - struct jpeg_dec_param *dec_param); -enum jpeg_ret_type api_jpeg_encode_exe(int dev_fd, - struct jpeg_enc_param *enc_param); -#ifdef __cplusplus -} -#endif - -#endif//__JPEG_API_H__ diff --git a/exynos4/hal/include/jpeg_hal.h b/exynos4/hal/include/jpeg_hal.h deleted file mode 100644 index 5c55592..0000000 --- a/exynos4/hal/include/jpeg_hal.h +++ /dev/null @@ -1,137 +0,0 @@ -/* - * 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. - */ - -#include "videodev2.h" - -#define JPEG_DEC_NODE "/dev/video11" -#define JPEG_ENC_NODE "/dev/video12" - -#define JPEG_MAX_PLANE_CNT 3 -#define JPEG_DEC_OUT_BYTE_ALIGN 8 - -//#define JPEG_PERF_MEAS - -#ifdef JPEG_PERF_MEAS -#define JPEG_PERF_DEFINE(n) \ - struct timeval time_start_##n, time_stop_##n; unsigned long log_time_##n = 0; - -#define JPEG_PERF_START(n) \ - gettimeofday(&time_start_##n, NULL); - -#define JPEG_PERF_END(n) \ - gettimeofday(&time_stop_##n, NULL); log_time_##n = measure_time(&time_start_##n, &time_stop_##n); - -#define JPEG_PERF(n) \ - log_time_##n -#else -#define JPEG_PERF_DEFINE(n) -#define JPEG_PERF_START(n) -#define JPEG_PERF_END(n) -#define JPEG_PERF(n) -#endif - -enum jpeg_ret_type { - JPEG_FAIL, - JPEG_OK, - JPEG_ENCODE_FAIL, - JPEG_ENCODE_OK, - JPEG_DECODE_FAIL, - JPEG_DECODE_OK, - JPEG_OUT_OF_MEMORY, - JPEG_UNKNOWN_ERROR -}; - -enum jpeg_quality_level { - QUALITY_LEVEL_1 = 0, /* high */ - QUALITY_LEVEL_2, - QUALITY_LEVEL_3, - QUALITY_LEVEL_4, /* low */ -}; - -enum jpeg_mode { - JPEG_ENCODE, - JPEG_DECODE -}; - -struct jpeg_buf { - int num_planes; - void *start[JPEG_MAX_PLANE_CNT]; - int length[JPEG_MAX_PLANE_CNT]; - enum v4l2_memory memory; - enum v4l2_buf_type buf_type; // Caller need not set this -}; - -struct jpeg_buf_info { - int num_planes; - enum v4l2_memory memory; - enum v4l2_buf_type buf_type; - int reserved[4]; -}; - -struct jpeg_pixfmt { - int in_fmt; - int out_fmt; - int reserved[4]; -}; - -struct jpeg_config { - enum jpeg_mode mode; - enum jpeg_quality_level enc_qual; // for encoding - - int width; - int height; - - int num_planes; - - int scaled_width; // 1/2, 1/4 scaling for decoding - int scaled_height; // 1/2, 1/4 scaling for decoding - - int sizeJpeg; - - union { - struct jpeg_pixfmt enc_fmt; - struct jpeg_pixfmt dec_fmt; - } pix; - - int reserved[8]; -}; - -#ifdef __cplusplus -extern "C" { -#endif -int jpeghal_dec_init(); -int jpeghal_enc_init(); - -int jpeghal_dec_setconfig(int fd, struct jpeg_config *config); -int jpeghal_enc_setconfig(int fd, struct jpeg_config *config); -int jpeghal_dec_getconfig(int fd, struct jpeg_config *config); -int jpeghal_enc_getconfig(int fd, struct jpeg_config *config); - -int jpeghal_set_inbuf(int fd, struct jpeg_buf *buf); -int jpeghal_set_outbuf(int fd, struct jpeg_buf *buf); - -int jpeghal_dec_exe(int fd, struct jpeg_buf *in_buf, struct jpeg_buf *out_buf); -int jpeghal_enc_exe(int fd, struct jpeg_buf *in_buf, struct jpeg_buf *out_buf); - -int jpeghal_deinit(int fd, struct jpeg_buf *in_buf, struct jpeg_buf *out_buf); - -int jpeghal_s_ctrl(int fd, int cid, int value); -int jpeghal_g_ctrl(int fd, int id); - -unsigned long measure_time(struct timeval *start, struct timeval *stop); -#ifdef __cplusplus -} -#endif diff --git a/exynos4/hal/include/s3c_lcd.h b/exynos4/hal/include/s3c_lcd.h deleted file mode 100644 index 1ad36eb..0000000 --- a/exynos4/hal/include/s3c_lcd.h +++ /dev/null @@ -1,172 +0,0 @@ -/* - * 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 _S3CFB_LCD_ -#define _S3CFB_LCD_ - -#define S3C_FB_MAX_WIN (5) - -/* - * S T R U C T U R E S F O R C U S T O M I O C T L S - * -*/ -struct s3cfb_user_window { - int x; - int y; -}; - -struct s3cfb_user_plane_alpha { - int channel; - unsigned char red; - unsigned char green; - unsigned char blue; -}; - -struct s3cfb_user_chroma { - int enabled; - unsigned char red; - unsigned char green; - unsigned char blue; -}; - -typedef struct { - unsigned int phy_start_addr; - unsigned int xres; /* visible resolution*/ - unsigned int yres; - unsigned int xres_virtual; /* virtual resolution*/ - unsigned int yres_virtual; - unsigned int xoffset; /* offset from virtual to visible */ - unsigned int yoffset; /* resolution */ - unsigned int lcd_offset_x; - unsigned int lcd_offset_y; -} s3c_fb_next_info_t; - -enum s3c_fb_pixel_format { - S3C_FB_PIXEL_FORMAT_RGBA_8888 = 0, - S3C_FB_PIXEL_FORMAT_RGB_888 = 1, - S3C_FB_PIXEL_FORMAT_BGRA_8888 = 2, - S3C_FB_PIXEL_FORMAT_RGB_565 = 3, - S3C_FB_PIXEL_FORMAT_RGBX_8888 = 4, - S3C_FB_PIXEL_FORMAT_RGBA_5551 = 5, - S3C_FB_PIXEL_FORMAT_RGBA_4444 = 6, - S3C_FB_PIXEL_FORMAT_MAX = 7, -}; - -enum s3c_fb_blending { - S3C_FB_BLENDING_NONE = 0, - S3C_FB_BLENDING_PREMULT = 1, - S3C_FB_BLENDING_COVERAGE = 2, - S3C_FB_BLENDING_MAX = 3, -}; - -struct s3c_fb_win_config { - enum { - S3C_FB_WIN_STATE_DISABLED = 0, - S3C_FB_WIN_STATE_COLOR, - S3C_FB_WIN_STATE_BUFFER, - } state; - - union { - __u32 color; - struct { - int fd; - __u32 phys_addr; - __u32 virt_addr; - __u32 offset; - __u32 stride; - enum s3c_fb_pixel_format format; - enum s3c_fb_blending blending; - int fence_fd; - int plane_alpha; - }; - }; - - int x; - int y; - __u32 w; - __u32 h; -}; - -struct s3c_fb_win_config_data { - int fence; - struct s3c_fb_win_config config[S3C_FB_MAX_WIN]; -}; - -#ifdef BOARD_USE_V4L2_ION -struct s3c_fb_user_ion_client { - int fd; - int offset; -}; -#endif - -/* - * C U S T O M I O C T L S - * -*/ - -#define S3CFB_WIN_POSITION _IOW ('F', 203, struct s3cfb_user_window) -#define S3CFB_WIN_SET_PLANE_ALPHA _IOW ('F', 204, struct s3cfb_user_plane_alpha) -#define S3CFB_WIN_SET_CHROMA _IOW ('F', 205, struct s3cfb_user_chroma) - -#define S3CFB_SET_VSYNC_INT _IOW ('F', 206, unsigned int) -#define S3CFB_GET_VSYNC_INT_STATUS _IOR ('F', 207, unsigned int) - -#define S3CFB_GET_ION_USER_HANDLE _IOWR('F', 208, struct s3c_fb_user_ion_client) -#define S3CFB_WIN_CONFIG _IOW ('F', 209, struct s3c_fb_win_config_data) - -#define S3CFB_SET_SUSPEND_FIFO _IOW ('F', 300, unsigned long) -#define S3CFB_SET_RESUME_FIFO _IOW ('F', 301, unsigned long) - -#define S3CFB_GET_LCD_WIDTH _IOR ('F', 302, int) -#define S3CFB_GET_LCD_HEIGHT _IOR ('F', 303, int) - -#define S3CFB_SET_WRITEBACK _IOW ('F', 304, unsigned int) -#define S3CFB_SET_WIN_ON _IOW ('F', 305, unsigned int) -#define S3CFB_SET_WIN_OFF _IOW ('F', 306, unsigned int) -#define S3CFB_SET_WIN_PATH _IOW ('F', 307, enum s3cfb_data_path_t) -#define S3CFB_SET_WIN_ADDR _IOW ('F', 308, unsigned long) -#define S3CFB_SET_WIN_MEM _IOW ('F', 309, enum s3cfb_mem_owner_t) - -#define S3CFB_GET_FB_PHY_ADDR _IOR ('F', 310, unsigned int) -#define S3CFB_GET_CUR_WIN_BUF_ADDR _IOR ('F', 311, unsigned int) -/*#if defined(CONFIG_CPU_EXYNOS4210) -#define S3CFB_SET_WIN_MEM_START _IOW('F', 312, u32) -#endif*/ - -#define S3CFB_SET_ALPHA_MODE _IOW ('F', 313, unsigned int) -#define S3CFB_SET_INITIAL_CONFIG _IO ('F', 314) -#define S3CFB_SUPPORT_FENCE _IOW ('F', 315, unsigned int) - - -/* IOCTL commands from drivers/video/samsung_extdisp/s3cfb_extdsp.h */ -struct s3cfb_extdsp_time_stamp { - unsigned int phys_addr; - struct timeval time_marker; -}; - -#define S3CFB_EXTDSP_SET_WIN_ADDR _IOW('F', 308, unsigned long) -#define S3CFB_EXTDSP_GET_LOCKED_BUFFER _IOW('F', 322, unsigned int) -#define S3CFB_EXTDSP_PUT_TIME_STAMP _IOW('F', 323, \ - struct s3cfb_extdsp_time_stamp) - -/***************** LCD frame buffer *****************/ -#define FB0_NAME "/dev/fb0" -#define FB1_NAME "/dev/fb1" -#define FB2_NAME "/dev/fb2" -#define FB3_NAME "/dev/fb3" -#define FB4_NAME "/dev/fb4" - -#endif diff --git a/exynos4/hal/include/s3c_mem.h b/exynos4/hal/include/s3c_mem.h deleted file mode 100644 index dd4cbdb..0000000 --- a/exynos4/hal/include/s3c_mem.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 _S3C_MEM_COMMON_H_ -#define _S3C_MEM_COMMON_H_ - -#define MEM_IOCTL_MAGIC 'M' - -#define S3C_MEM_ALLOC _IOWR(MEM_IOCTL_MAGIC, 310, struct s3c_mem_alloc) -#define S3C_MEM_FREE _IOWR(MEM_IOCTL_MAGIC, 311, struct s3c_mem_alloc) - -#define S3C_MEM_SHARE_ALLOC _IOWR(MEM_IOCTL_MAGIC, 314, struct s3c_mem_alloc) -#define S3C_MEM_SHARE_FREE _IOWR(MEM_IOCTL_MAGIC, 315, struct s3c_mem_alloc) - -#define S3C_MEM_CACHEABLE_ALLOC _IOWR(MEM_IOCTL_MAGIC, 316, struct s3c_mem_alloc) -#define S3C_MEM_CACHEABLE_SHARE_ALLOC _IOWR(MEM_IOCTL_MAGIC, 317, struct s3c_mem_alloc) - -#define S3C_MEM_CACHE_FLUSH _IOWR(MEM_IOCTL_MAGIC, 318, struct s3c_mem_alloc) -#define S3C_MEM_CACHE_INVAL _IOWR(MEM_IOCTL_MAGIC, 319, struct s3c_mem_alloc) -#define S3C_MEM_CACHE_CLEAN _IOWR(MEM_IOCTL_MAGIC, 320, struct s3c_mem_alloc) - -struct s3c_mem_alloc { - int size; - unsigned int vir_addr; - unsigned int phy_addr; -}; - -struct s3c_mem_dma_param { - int size; - unsigned int src_addr; - unsigned int dst_addr; - int cfg; -}; - -#endif // _S3C_MEM_COMMON_H_ diff --git a/exynos4/hal/include/s5p_fimc.h b/exynos4/hal/include/s5p_fimc.h deleted file mode 100644 index 92c9b08..0000000 --- a/exynos4/hal/include/s5p_fimc.h +++ /dev/null @@ -1,167 +0,0 @@ -/* 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 "SecBuffer.h" -/* - * G E N E R A L S - * -*/ -#define MIN(x, y) ((x < y) ? x : y) - -#define FIMC_ADDR_Y 0 -#define FIMC_ADDR_CB 1 -#define FIMC_ADDR_CR 2 - -/* - * 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') - -#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ - -/* CID extensions */ -#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0) -#define V4L2_CID_OVLY_MODE (V4L2_CID_PRIVATE_BASE + 9) -#define V4L2_CID_DST_INFO (V4L2_CID_PRIVATE_BASE + 10) -#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) -#define V4L2_CID_RESERVED_MEM_SIZE (V4L2_CID_PRIVATE_BASE + 63) - -/* - * 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 length[3]; -}; - -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 -} 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; - unsigned int hw_ver; -}s5p_fimc_t; - -#endif diff --git a/exynos4/hal/include/s5p_fimc_v4l2.h b/exynos4/hal/include/s5p_fimc_v4l2.h deleted file mode 100644 index 35b84a0..0000000 --- a/exynos4/hal/include/s5p_fimc_v4l2.h +++ /dev/null @@ -1,164 +0,0 @@ -/* 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 "SecBuffer.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') - -#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ - -/* CID extensions */ -#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0) -#define V4L2_CID_OVLY_MODE (V4L2_CID_PRIVATE_BASE + 9) -#define V4L2_CID_DST_INFO (V4L2_CID_PRIVATE_BASE + 10) -#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; - unsigned int hw_ver; -} s5p_fimc_t; - -#endif diff --git a/exynos4/hal/include/s5p_tvout.h b/exynos4/hal/include/s5p_tvout.h deleted file mode 100644 index 62295d2..0000000 --- a/exynos4/hal/include/s5p_tvout.h +++ /dev/null @@ -1,198 +0,0 @@ -/* - * 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 __S5P_TVOUT_H__ -#define __S5P_TVOUT_H__ - -#include <linux/fb.h> -#include "videodev2.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************* - * Define - *******************************************/ -/* TVOUT control */ -#ifdef SAMSUNG_EXYNOS4210 -#define TVOUT_DEV "/dev/video14" -#else -#define TVOUT_DEV "/dev/video16" -#endif -#define HPD_DEV "/dev/HPD" - -/* ------------- Output -----------------*/ -/* type */ -#define V4L2_OUTPUT_TYPE_MSDMA 4 -#define V4L2_OUTPUT_TYPE_COMPOSITE 5 -#define V4L2_OUTPUT_TYPE_SVIDEO 6 -#define V4L2_OUTPUT_TYPE_YPBPR_INERLACED 7 -#define V4L2_OUTPUT_TYPE_YPBPR_PROGRESSIVE 8 -#define V4L2_OUTPUT_TYPE_RGB_PROGRESSIVE 9 -#define V4L2_OUTPUT_TYPE_DIGITAL 10 -#define V4L2_OUTPUT_TYPE_HDMI V4L2_OUTPUT_TYPE_DIGITAL -#define V4L2_OUTPUT_TYPE_HDMI_RGB 11 -#define V4L2_OUTPUT_TYPE_DVI 12 - -/* ------------- STD -------------------*/ -#define V4L2_STD_PAL_BDGHI\ - (V4L2_STD_PAL_B|V4L2_STD_PAL_D|V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_PAL_I) - -#define V4L2_STD_480P_60_16_9 ((v4l2_std_id)0x04000000) -#define V4L2_STD_480P_60_4_3 ((v4l2_std_id)0x05000000) -#define V4L2_STD_576P_50_16_9 ((v4l2_std_id)0x06000000) -#define V4L2_STD_576P_50_4_3 ((v4l2_std_id)0x07000000) -#define V4L2_STD_720P_60 ((v4l2_std_id)0x08000000) -#define V4L2_STD_720P_50 ((v4l2_std_id)0x09000000) -#define V4L2_STD_1080P_60 ((v4l2_std_id)0x0a000000) -#define V4L2_STD_1080P_50 ((v4l2_std_id)0x0b000000) -#define V4L2_STD_1080I_60 ((v4l2_std_id)0x0c000000) -#define V4L2_STD_1080I_50 ((v4l2_std_id)0x0d000000) -#define V4L2_STD_480P_59 ((v4l2_std_id)0x0e000000) -#define V4L2_STD_720P_59 ((v4l2_std_id)0x0f000000) -#define V4L2_STD_1080I_59 ((v4l2_std_id)0x10000000) -#define V4L2_STD_1080P_59 ((v4l2_std_id)0x11000000) -#define V4L2_STD_1080P_30 ((v4l2_std_id)0x12000000) -#define V4L2_STD_TVOUT_720P_60_SBS_HALF ((v4l2_std_id)0x13000000) -#define V4L2_STD_TVOUT_720P_59_SBS_HALF ((v4l2_std_id)0x14000000) -#define V4L2_STD_TVOUT_720P_50_TB ((v4l2_std_id)0x15000000) -#define V4L2_STD_TVOUT_1080P_24_TB ((v4l2_std_id)0x16000000) -#define V4L2_STD_TVOUT_1080P_23_TB ((v4l2_std_id)0x17000000) - -/* TVOUT video */ -#ifdef SAMSUNG_EXYNOS4210 -#define TVOUT_DEV_V "/dev/video21" -#else -#define TVOUT_DEV_V "/dev/video20" -#endif - -/* ------------- Input ------------------*/ -/* type */ -#define V4L2_INPUT_TYPE_MSDMA 3 -#define V4L2_INPUT_TYPE_FIFO 4 - -/* TVOUT video */ -#define PFX_NODE_FB "/dev/graphics/fb" - -/******************************************* - * structures - *******************************************/ - -/* TVOUT */ -struct v4l2_vid_overlay_src { - void *base_y; - void *base_c; - struct v4l2_pix_format pix_fmt; -}; - -struct v4l2_window_s5p_tvout { - __u32 capability; - __u32 flags; - __u32 priority; - struct v4l2_window win; -}; - -struct v4l2_pix_format_s5p_tvout { - void *base_y; - void *base_c; - __u32 src_img_endian; - struct v4l2_pix_format pix_fmt; -}; - -struct vid_overlay_param { - struct v4l2_vid_overlay_src src; - struct v4l2_rect src_crop; - struct v4l2_framebuffer dst; - struct v4l2_window dst_win; -}; - -struct tvout_param { - struct v4l2_pix_format_s5p_tvout tvout_src; - struct v4l2_window_s5p_tvout tvout_rect; - struct v4l2_rect tvout_dst; -}; - -struct overlay_param { - struct v4l2_framebuffer overlay_frame; - struct v4l2_window_s5p_tvout overlay_rect; - struct v4l2_rect overlay_dst; -}; - -/* FB */ -struct s5ptvfb_user_window { - int x; - int y; -}; - -struct s5ptvfb_user_plane_alpha { - int channel; - unsigned char alpha; -}; - -struct s5ptvfb_user_chroma { - int enabled; - unsigned char red; - unsigned char green; - unsigned char blue; -}; - -enum s5ptvfb_ver_scaling_t { - VERTICAL_X1, - VERTICAL_X2, -}; - -enum s5ptvfb_hor_scaling_t { - HORIZONTAL_X1, - HORIZONTAL_X2, -}; - -struct s5ptvfb_user_scaling { - enum s5ptvfb_ver_scaling_t ver; - enum s5ptvfb_hor_scaling_t hor; -}; - -/******************************************* - * custom ioctls - *******************************************/ - -#define VIDIOC_S_BASEADDR _IOR('V', 83, int) - -#define VIDIOC_HDCP_ENABLE _IOWR('V', 100, unsigned int) -#define VIDIOC_HDCP_STATUS _IOR('V', 101, unsigned int) -#define VIDIOC_HDCP_PROT_STATUS _IOR('V', 102, unsigned int) - -#define VIDIOC_INIT_AUDIO _IOR('V', 103, unsigned int) -#define VIDIOC_AV_MUTE _IOR('V', 104, unsigned int) -#define VIDIOC_G_AVMUTE _IOR('V', 105, unsigned int) -#define HPD_GET_STATE _IOR('H', 100, unsigned int) - -#define S5PTVFB_WIN_POSITION _IOW('F', 213, struct s5ptvfb_user_window) -#define S5PTVFB_WIN_SET_PLANE_ALPHA _IOW('F', 214, struct s5ptvfb_user_plane_alpha) -#define S5PTVFB_WIN_SET_CHROMA _IOW('F', 215, struct s5ptvfb_user_chroma) - -#define S5PTVFB_SET_VSYNC_INT _IOW('F', 216, unsigned int) -#define S5PTVFB_WAITFORVSYNC _IO('F', 32) -#define S5PTVFB_WIN_SET_ADDR _IOW('F', 219, unsigned int) -#define S5PTVFB_SET_WIN_ON _IOW('F', 220, unsigned int) -#define S5PTVFB_SET_WIN_OFF _IOW('F', 221, unsigned int) -#define S5PTVFB_SCALING _IOW('F', 222, struct s5ptvfb_user_scaling) - -#ifdef __cplusplus -} -#endif - -#endif /* __S5P_TVOUT_H__ */ diff --git a/exynos4/hal/include/s5p_tvout_v4l2.h b/exynos4/hal/include/s5p_tvout_v4l2.h deleted file mode 100644 index 16f78b1..0000000 --- a/exynos4/hal/include/s5p_tvout_v4l2.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * 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 __S5P_TVOUT_H__ -#define __S5P_TVOUT_H__ - -#include <linux/fb.h> - -#include "videodev2.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/******************************************* - * Define - *******************************************/ -/* TVOUT control */ -#define PFX_NODE_FB "/dev/graphics/fb" - -#define TVOUT_DEV_V "/dev/video20" -#define TVOUT_DEV_G0 "/dev/video16" -#define TVOUT_DEV_G1 "/dev/video17" - -#define HPD_DEV "/dev/HPD" - -/* ------------- Output -----------------*/ -/* type */ -#define V4L2_OUTPUT_TYPE_MSDMA 4 -#define V4L2_OUTPUT_TYPE_COMPOSITE 5 -#define V4L2_OUTPUT_TYPE_SVIDEO 6 -#define V4L2_OUTPUT_TYPE_YPBPR_INERLACED 7 -#define V4L2_OUTPUT_TYPE_YPBPR_PROGRESSIVE 8 -#define V4L2_OUTPUT_TYPE_RGB_PROGRESSIVE 9 -#define V4L2_OUTPUT_TYPE_DIGITAL 10 -#define V4L2_OUTPUT_TYPE_HDMI V4L2_OUTPUT_TYPE_DIGITAL -#define V4L2_OUTPUT_TYPE_HDMI_RGB 11 -#define V4L2_OUTPUT_TYPE_DVI 12 - -/* ------------- STD -------------------*/ -#define V4L2_STD_PAL_BDGHI\ - (V4L2_STD_PAL_B|V4L2_STD_PAL_D|V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_PAL_I) - -#define V4L2_STD_480P_60_16_9 ((v4l2_std_id)0x04000000) -#define V4L2_STD_480P_60_4_3 ((v4l2_std_id)0x05000000) -#define V4L2_STD_576P_50_16_9 ((v4l2_std_id)0x06000000) -#define V4L2_STD_576P_50_4_3 ((v4l2_std_id)0x07000000) -#define V4L2_STD_720P_60 ((v4l2_std_id)0x08000000) -#define V4L2_STD_720P_50 ((v4l2_std_id)0x09000000) -#define V4L2_STD_1080P_60 ((v4l2_std_id)0x0a000000) -#define V4L2_STD_1080P_50 ((v4l2_std_id)0x0b000000) -#define V4L2_STD_1080I_60 ((v4l2_std_id)0x0c000000) -#define V4L2_STD_1080I_50 ((v4l2_std_id)0x0d000000) -#define V4L2_STD_480P_59 ((v4l2_std_id)0x0e000000) -#define V4L2_STD_720P_59 ((v4l2_std_id)0x0f000000) -#define V4L2_STD_1080I_59 ((v4l2_std_id)0x10000000) -#define V4L2_STD_1080P_59 ((v4l2_std_id)0x11000000) -#define V4L2_STD_1080P_30 ((v4l2_std_id)0x12000000) -#define V4L2_STD_TVOUT_720P_60_SBS_HALF ((v4l2_std_id)0x13000000) -#define V4L2_STD_TVOUT_720P_59_SBS_HALF ((v4l2_std_id)0x14000000) -#define V4L2_STD_TVOUT_720P_50_TB ((v4l2_std_id)0x15000000) -#define V4L2_STD_TVOUT_1080P_24_TB ((v4l2_std_id)0x16000000) -#define V4L2_STD_TVOUT_1080P_23_TB ((v4l2_std_id)0x17000000) - -/* ------------- Input ------------------*/ -/* type */ -#define V4L2_INPUT_TYPE_MSDMA 3 -#define V4L2_INPUT_TYPE_FIFO 4 - -/******************************************* - * structures - *******************************************/ - -/* TVOUT */ -struct v4l2_vid_overlay_src { - void *base_y; - void *base_c; - struct v4l2_pix_format pix_fmt; -}; - -struct v4l2_window_s5p_tvout { - __u32 capability; - __u32 flags; - __u32 priority; - struct v4l2_window win; -}; - -struct v4l2_pix_format_s5p_tvout { - void *base_y; - void *base_c; - __u32 src_img_endian; - struct v4l2_pix_format pix_fmt; -}; - -struct vid_overlay_param { - struct v4l2_vid_overlay_src src; - struct v4l2_rect src_crop; - struct v4l2_framebuffer dst; - struct v4l2_window dst_win; -}; - -struct tvout_param { - struct v4l2_pix_format_s5p_tvout tvout_src; - struct v4l2_window_s5p_tvout tvout_rect; - struct v4l2_rect tvout_dst; -}; - -struct overlay_param { - struct v4l2_framebuffer overlay_frame; - struct v4l2_window_s5p_tvout overlay_rect; - struct v4l2_rect overlay_dst; -}; - -/* FB */ -struct s5ptvfb_user_window { - int x; - int y; -}; - -struct s5ptvfb_user_plane_alpha { - int channel; - unsigned char alpha; -}; - -struct s5ptvfb_user_chroma { - int enabled; - unsigned char red; - unsigned char green; - unsigned char blue; -}; - -enum s5ptvfb_ver_scaling_t { - VERTICAL_X1, - VERTICAL_X2, -}; - -enum s5ptvfb_hor_scaling_t { - HORIZONTAL_X1, - HORIZONTAL_X2, -}; - -struct s5ptvfb_user_scaling { - enum s5ptvfb_ver_scaling_t ver; - enum s5ptvfb_hor_scaling_t hor; -}; - -/******************************************* - * custom ioctls - *******************************************/ - -#define VIDIOC_S_BASEADDR _IOR('V', 83, int) - -#define VIDIOC_HDCP_ENABLE _IOWR('V', 100, unsigned int) -#define VIDIOC_HDCP_STATUS _IOR('V', 101, unsigned int) -#define VIDIOC_HDCP_PROT_STATUS _IOR('V', 102, unsigned int) - -#define VIDIOC_INIT_AUDIO _IOR('V', 103, unsigned int) -#define VIDIOC_AV_MUTE _IOR('V', 104, unsigned int) -#define VIDIOC_G_AVMUTE _IOR('V', 105, unsigned int) -#define HPD_GET_STATE _IOR('H', 100, unsigned int) - -#define S5PTVFB_WIN_POSITION _IOW('F', 213, struct s5ptvfb_user_window) -#define S5PTVFB_WIN_SET_PLANE_ALPHA _IOW('F', 214, struct s5ptvfb_user_plane_alpha) -#define S5PTVFB_WIN_SET_CHROMA _IOW('F', 215, struct s5ptvfb_user_chroma) - -#define S5PTVFB_SET_VSYNC_INT _IOW('F', 216, unsigned int) -#define S5PTVFB_WAITFORVSYNC _IO('F', 32) -#define S5PTVFB_WIN_SET_ADDR _IOW('F', 219, unsigned int) -#define S5PTVFB_SET_WIN_ON _IOW('F', 220, unsigned int) -#define S5PTVFB_SET_WIN_OFF _IOW('F', 221, unsigned int) -#define S5PTVFB_SCALING _IOW('F', 222, struct s5ptvfb_user_scaling) - -#ifdef __cplusplus -} -#endif - -#endif /* __S5P_TVOUT_H__ */ diff --git a/exynos4/hal/include/sec_format.h b/exynos4/hal/include/sec_format.h deleted file mode 100644 index 4a790ef..0000000 --- a/exynos4/hal/include/sec_format.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 _SEC_FORMAT_H_ -#define _SEC_FORMAT_H_ - -/* enum related to pixel format */ - -enum { - HAL_PIXEL_FORMAT_YCbCr_422_P = 0x100, - HAL_PIXEL_FORMAT_YCbCr_420_P = 0x101, - HAL_PIXEL_FORMAT_YCbCr_420_I = 0x102, - HAL_PIXEL_FORMAT_CbYCrY_422_I = 0x103, - HAL_PIXEL_FORMAT_CbYCrY_420_I = 0x104, - HAL_PIXEL_FORMAT_YCbCr_420_SP = 0x105, - HAL_PIXEL_FORMAT_YCrCb_422_SP = 0x106, - HAL_PIXEL_FORMAT_YCbCr_420_SP_TILED = 0x107, - HAL_PIXEL_FORMAT_ARGB888 = 0x108, - // 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_CUSTOM_YCrCb_422_I = 0x116, - HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I = 0x117, - HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I = 0x118, - 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 */ - HAL_PIXEL_FORMAT_CUSTOM_MAX -}; - -#endif diff --git a/exynos4/hal/include/sec_g2d.h b/exynos4/hal/include/sec_g2d.h deleted file mode 100644 index 772cbf8..0000000 --- a/exynos4/hal/include/sec_g2d.h +++ /dev/null @@ -1,251 +0,0 @@ -/* - * 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 _SEC_G2D_DRIVER_H_ -#define _SEC_G2D_DRIVER_H_ -typedef unsigned char u8; -typedef unsigned short u16; -typedef unsigned long u32; - -#define SEC_G2D_DEV_NAME "/dev/fimg2d" - -#define G2D_IOCTL_MAGIC 'G' - -#define G2D_BLIT _IO(G2D_IOCTL_MAGIC,0) -#define G2D_GET_VERSION _IO(G2D_IOCTL_MAGIC,1) -#define G2D_GET_MEMORY _IOR(G2D_IOCTL_MAGIC,2, unsigned int) -#define G2D_GET_MEMORY_SIZE _IOR(G2D_IOCTL_MAGIC,3, unsigned int) -#define G2D_DMA_CACHE_CLEAN _IOWR(G2D_IOCTL_MAGIC,4, struct g2d_dma_info) -#define G2D_DMA_CACHE_FLUSH _IOWR(G2D_IOCTL_MAGIC,5, struct g2d_dma_info) -#define G2D_SYNC _IO(G2D_IOCTL_MAGIC,6) -#define G2D_RESET _IO(G2D_IOCTL_MAGIC,7) - -#define G2D_MAX_WIDTH (2048) -#define G2D_MAX_HEIGHT (2048) - -#define G2D_ALPHA_VALUE_MAX (255) - -#define G2D_POLLING (1<<0) -#define G2D_INTERRUPT (0<<0) -#define G2D_CACHE_OP (1<<1) -#define G2D_NONE_INVALIDATE (0<<1) -#define G2D_HYBRID_MODE (1<<2) - -typedef enum { - G2D_ROT_0 = 0, - G2D_ROT_90, - G2D_ROT_180, - G2D_ROT_270, - G2D_ROT_X_FLIP, - G2D_ROT_Y_FLIP -} G2D_ROT_DEG; - -typedef enum { - G2D_ALPHA_BLENDING_MIN = 0, // wholly transparent - G2D_ALPHA_BLENDING_MAX = 255, // 255 - G2D_ALPHA_BLENDING_OPAQUE = 256, // opaque -} G2D_ALPHA_BLENDING_MODE; - -typedef enum { - G2D_COLORKEY_NONE = 0, - G2D_COLORKEY_SRC_ON, - G2D_COLORKEY_DST_ON, - G2D_COLORKEY_SRC_DST_ON, -} G2D_COLORKEY_MODE; - -typedef enum { - G2D_BLUE_SCREEN_NONE = 0, - G2D_BLUE_SCREEN_TRANSPARENT, - G2D_BLUE_SCREEN_WITH_COLOR, -} G2D_BLUE_SCREEN_MODE; - -typedef enum { - G2D_ROP_SRC = 0, - G2D_ROP_DST, - G2D_ROP_SRC_AND_DST, - G2D_ROP_SRC_OR_DST, - G2D_ROP_3RD_OPRND, - G2D_ROP_SRC_AND_3RD_OPRND, - G2D_ROP_SRC_OR_3RD_OPRND, - G2D_ROP_SRC_XOR_3RD_OPRND, - G2D_ROP_DST_OR_3RD, -} G2D_ROP_TYPE; - -typedef enum { - G2D_THIRD_OP_NONE = 0, - G2D_THIRD_OP_PATTERN, - G2D_THIRD_OP_FG, - G2D_THIRD_OP_BG -} G2D_THIRD_OP_MODE; - -typedef enum { - G2D_BLACK = 0, - G2D_RED, - G2D_GREEN, - G2D_BLUE, - G2D_WHITE, - G2D_YELLOW, - G2D_CYAN, - G2D_MAGENTA -} G2D_COLOR; - -typedef enum { - G2D_RGB_565 = ((0<<4)|2), - - G2D_ABGR_8888 = ((2<<4)|1), - G2D_BGRA_8888 = ((3<<4)|1), - G2D_ARGB_8888 = ((0<<4)|1), - G2D_RGBA_8888 = ((1<<4)|1), - - G2D_XBGR_8888 = ((2<<4)|0), - G2D_BGRX_8888 = ((3<<4)|0), - G2D_XRGB_8888 = ((0<<4)|0), - G2D_RGBX_8888 = ((1<<4)|0), - - G2D_ABGR_1555 = ((2<<4)|4), - G2D_BGRA_5551 = ((3<<4)|4), - G2D_ARGB_1555 = ((0<<4)|4), - G2D_RGBA_5551 = ((1<<4)|4), - - G2D_XBGR_1555 = ((2<<4)|3), - G2D_BGRX_5551 = ((3<<4)|3), - G2D_XRGB_1555 = ((0<<4)|3), - G2D_RGBX_5551 = ((1<<4)|3), - - G2D_ABGR_4444 = ((2<<4)|6), - G2D_BGRA_4444 = ((3<<4)|6), - G2D_ARGB_4444 = ((0<<4)|6), - G2D_RGBA_4444 = ((1<<4)|6), - - G2D_XBGR_4444 = ((2<<4)|5), - G2D_BGRX_4444 = ((3<<4)|5), - G2D_XRGB_4444 = ((0<<4)|5), - G2D_RGBX_4444 = ((1<<4)|5), - - G2D_PACKED_BGR_888 = ((2<<4)|7), - G2D_PACKED_RGB_888 = ((0<<4)|7), - - G2D_MAX_COLOR_SPACE -} G2D_COLOR_SPACE; - -typedef enum { - G2D_Clear_Mode, //!< [0, 0] - G2D_Src_Mode, //!< [Sa, Sc] - G2D_Dst_Mode, //!< [Da, Dc] - G2D_SrcOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Sc + (1 - Sa)*Dc] - G2D_DstOver_Mode, //!< [Sa + Da - Sa*Da, Rc = Dc + (1 - Da)*Sc] - G2D_SrcIn_Mode, //!< [Sa * Da, Sc * Da] - G2D_DstIn_Mode, //!< [Sa * Da, Sa * Dc] - G2D_SrcOut_Mode, //!< [Sa * (1 - Da), Sc * (1 - Da)] - G2D_DstOut_Mode, //!< [Da * (1 - Sa), Dc * (1 - Sa)] - G2D_SrcATop_Mode, //!< [Da, Sc * Da + (1 - Sa) * Dc] - G2D_DstATop_Mode, //!< [Sa, Sa * Dc + Sc * (1 - Da)] - G2D_Xor_Mode, //!< [Sa + Da - 2 * Sa * Da, Sc * (1 - Da) + (1 - Sa) * Dc] - - // these modes are defined in the SVG Compositing standard - // http://www.w3.org/TR/2009/WD-SVGCompositing-20090430/ - G2D_Plus_Mode, - G2D_Multiply_Mode, - G2D_Screen_Mode, - G2D_Overlay_Mode, - G2D_Darken_Mode, - G2D_Lighten_Mode, - G2D_ColorDodge_Mode, - G2D_ColorBurn_Mode, - G2D_HardLight_Mode, - G2D_SoftLight_Mode, - G2D_Difference_Mode, - G2D_Exclusion_Mode, - - kLastMode = G2D_Exclusion_Mode -} G2D_PORTTERDUFF_MODE; - -typedef enum { - G2D_MEMORY_KERNEL, - G2D_MEMORY_USER -} G2D_MEMORY_TYPE; - -typedef struct { - int x; - int y; - unsigned int w; - unsigned int h; - unsigned int full_w; - unsigned int full_h; - int color_format; - unsigned int bytes_per_pixel; - unsigned char * addr; -} g2d_rect; - -typedef struct { - unsigned int rotate_val; - unsigned int alpha_val; - - unsigned int blue_screen_mode; //true : enable, false : disable - unsigned int color_key_val; //screen color value - unsigned int color_switch_val; //one color - - unsigned int src_color; // when set one color on SRC - - unsigned int third_op_mode; - unsigned int rop_mode; - unsigned int mask_mode; - unsigned int render_mode; - unsigned int potterduff_mode; - unsigned int memory_type; -} g2d_flag; - -typedef struct { - unsigned int t; - unsigned int b; - unsigned int l; - unsigned int r; -} g2d_clip; - -typedef struct { - g2d_rect src_rect; - g2d_rect dst_rect; - g2d_clip clip; - g2d_flag flag; -} g2d_params; - -struct g2d_dma_info { - unsigned long addr; - unsigned int size; -}; - -typedef struct _sec_g2d_t { - int dev_fd; - g2d_params params; -}sec_g2d_t; - -typedef struct __s5p_rect { - uint32_t x; - uint32_t y; - uint32_t w; - uint32_t h; -} __s5p_rect; - -typedef struct __s5p_img { - uint32_t width; - uint32_t height; - uint32_t format; - uint32_t offset; - uint32_t base; - int memory_id; -} __s5p_img; - -#endif /*_SEC_G2D_DRIVER_H_*/ diff --git a/exynos4/hal/include/sec_g2d_4x.h b/exynos4/hal/include/sec_g2d_4x.h deleted file mode 100644 index 8b8719a..0000000 --- a/exynos4/hal/include/sec_g2d_4x.h +++ /dev/null @@ -1,347 +0,0 @@ -/* - * Copyright 2011, 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 _SEC_G2D_DRIVER_H_ -#define _SEC_G2D_DRIVER_H_ - -#define SEC_G2D_DEV_NAME "/dev/fimg2d" -#define G2D_ALPHA_VALUE_MAX (255) - -/* ioctl commands */ -#define FIMG2D_IOCTL_MAGIC 'F' -#define FIMG2D_BITBLT_BLIT _IOWR(FIMG2D_IOCTL_MAGIC, 0, \ - struct fimg2d_blit) -#define FIMG2D_BITBLT_SYNC _IOW(FIMG2D_IOCTL_MAGIC, 1, int) -#define FIMG2D_BITBLT_VERSION _IOR(FIMG2D_IOCTL_MAGIC, 2, \ - struct fimg2d_version) -#define FIMG2D_BITBLT_SECURE _IOW(FIMG2D_IOCTL_MAGIC, 3, unsigned int) -#define FIMG2D_BITBLT_DBUFFER _IOW(FIMG2D_IOCTL_MAGIC, 4, unsigned long) - -#define SEQ_NO_BLT_SKIA 0x00000001 -#define SEQ_NO_BLT_HWC_SEC 0x00000012 -#define SEQ_NO_BLT_HWC_NOSEC 0x00000002 -#define SEQ_NO_BLT_HDMI 0x00000003 -#define SEQ_NO_CMD_SECURE_ON 0x10000001 -#define SEQ_NO_CMD_SECURE_OFF 0x10000002 -#define SEQ_NO_CMD_SET_DBUFFER 0x10000003 - -/** - * @BLIT_SYNC: sync mode, to wait for blit done irq - * @BLIT_ASYNC: async mode, not to wait for blit done irq - * - */ -enum blit_sync { - BLIT_SYNC, - BLIT_ASYNC, -}; - -/** - * @ADDR_PHYS: physical address - * @ADDR_USER: user virtual address (physically Non-contiguous) - * @ADDR_USER_RSVD: user virtual address (physically Contiguous) - * @ADDR_DEVICE: specific device virtual address - */ -enum addr_space { - ADDR_NONE, - ADDR_PHYS, - ADDR_KERN, - ADDR_USER, - ADDR_USER_RSVD, - ADDR_DEVICE, -}; - -/** - * Pixel order complies with little-endian style - * - * DO NOT CHANGE THIS ORDER - */ -enum pixel_order { - AX_RGB = 0, - RGB_AX, - AX_BGR, - BGR_AX, - ARGB_ORDER_END, - - P1_CRY1CBY0, - P1_CBY1CRY0, - P1_Y1CRY0CB, - P1_Y1CBY0CR, - P1_ORDER_END, - - P2_CRCB, - P2_CBCR, - P2_ORDER_END, -}; - -/** - * DO NOT CHANGE THIS ORDER - */ -enum color_format { - CF_XRGB_8888 = 0, - CF_ARGB_8888, - CF_RGB_565, - CF_XRGB_1555, - CF_ARGB_1555, - CF_XRGB_4444, - CF_ARGB_4444, - CF_RGB_888, - CF_YCBCR_444, - CF_YCBCR_422, - CF_YCBCR_420, - CF_A8, - CF_L8, - SRC_DST_FORMAT_END, - - CF_MSK_1BIT, - CF_MSK_4BIT, - CF_MSK_8BIT, - CF_MSK_16BIT_565, - CF_MSK_16BIT_1555, - CF_MSK_16BIT_4444, - CF_MSK_32BIT_8888, - MSK_FORMAT_END, -}; - -enum rotation { - ORIGIN, - ROT_90, /* clockwise */ - ROT_180, - ROT_270, - XFLIP, /* x-axis flip */ - YFLIP, /* y-axis flip */ -}; - -/** - * @NO_REPEAT: no effect - * @REPEAT_NORMAL: repeat horizontally and vertically - * @REPEAT_PAD: pad with pad color - * @REPEAT_REFLECT: reflect horizontally and vertically - * @REPEAT_CLAMP: pad with edge color of original image - * - * DO NOT CHANGE THIS ORDER - */ -enum repeat { - NO_REPEAT = 0, - REPEAT_NORMAL, /* default setting */ - REPEAT_PAD, - REPEAT_REFLECT, REPEAT_MIRROR = REPEAT_REFLECT, - REPEAT_CLAMP, -}; - -enum scaling { - NO_SCALING, - SCALING_NEAREST, - SCALING_BILINEAR, -}; - -/** - * @SCALING_PIXELS: ratio in pixels - * @SCALING_RATIO: ratio in fixed point 16 - */ -enum scaling_factor { - SCALING_PIXELS, - SCALING_RATIO, -}; - -/** - * premultiplied alpha - */ -enum premultiplied { - PREMULTIPLIED, - NON_PREMULTIPLIED, -}; - -/** - * @TRANSP: discard bluescreen color - * @BLUSCR: replace bluescreen color with background color - */ -enum bluescreen { - OPAQUE, - TRANSP, - BLUSCR, -}; - -/** - * DO NOT CHANGE THIS ORDER - */ -enum blit_op { - BLIT_OP_SOLID_FILL = 0, - - BLIT_OP_CLR, - BLIT_OP_SRC, BLIT_OP_SRC_COPY = BLIT_OP_SRC, - BLIT_OP_DST, - BLIT_OP_SRC_OVER, - BLIT_OP_DST_OVER, BLIT_OP_OVER_REV = BLIT_OP_DST_OVER, - BLIT_OP_SRC_IN, - BLIT_OP_DST_IN, BLIT_OP_IN_REV = BLIT_OP_DST_IN, - BLIT_OP_SRC_OUT, - BLIT_OP_DST_OUT, BLIT_OP_OUT_REV = BLIT_OP_DST_OUT, - BLIT_OP_SRC_ATOP, - BLIT_OP_DST_ATOP, BLIT_OP_ATOP_REV = BLIT_OP_DST_ATOP, - BLIT_OP_XOR, - - BLIT_OP_ADD, - BLIT_OP_MULTIPLY, - BLIT_OP_SCREEN, - BLIT_OP_DARKEN, - BLIT_OP_LIGHTEN, - - BLIT_OP_DISJ_SRC_OVER, - BLIT_OP_DISJ_DST_OVER, BLIT_OP_SATURATE = BLIT_OP_DISJ_DST_OVER, - BLIT_OP_DISJ_SRC_IN, - BLIT_OP_DISJ_DST_IN, BLIT_OP_DISJ_IN_REV = BLIT_OP_DISJ_DST_IN, - BLIT_OP_DISJ_SRC_OUT, - BLIT_OP_DISJ_DST_OUT, BLIT_OP_DISJ_OUT_REV = BLIT_OP_DISJ_DST_OUT, - BLIT_OP_DISJ_SRC_ATOP, - BLIT_OP_DISJ_DST_ATOP, BLIT_OP_DISJ_ATOP_REV = BLIT_OP_DISJ_DST_ATOP, - BLIT_OP_DISJ_XOR, - - BLIT_OP_CONJ_SRC_OVER, - BLIT_OP_CONJ_DST_OVER, BLIT_OP_CONJ_OVER_REV = BLIT_OP_CONJ_DST_OVER, - BLIT_OP_CONJ_SRC_IN, - BLIT_OP_CONJ_DST_IN, BLIT_OP_CONJ_IN_REV = BLIT_OP_CONJ_DST_IN, - BLIT_OP_CONJ_SRC_OUT, - BLIT_OP_CONJ_DST_OUT, BLIT_OP_CONJ_OUT_REV = BLIT_OP_CONJ_DST_OUT, - BLIT_OP_CONJ_SRC_ATOP, - BLIT_OP_CONJ_DST_ATOP, BLIT_OP_CONJ_ATOP_REV = BLIT_OP_CONJ_DST_ATOP, - BLIT_OP_CONJ_XOR, - - /* user select coefficient manually */ - BLIT_OP_USER_COEFF, - - BLIT_OP_USER_SRC_GA, - - /* Add new operation type here */ - - /* end of blit operation */ - BLIT_OP_END, - - /* driver not supporting format */ - BLIT_OP_NOT_SUPPORTED -}; - -/** - * @start: start address or unique id of image - */ -struct fimg2d_addr { - enum addr_space type; - unsigned long start; -}; - -struct fimg2d_rect { - int x1; - int y1; - int x2; /* x1 + width */ - int y2; /* y1 + height */ -}; - -/** - * pixels can be different from src, dst or clip rect - */ -struct fimg2d_scale { - enum scaling mode; - - /* ratio in pixels */ - int src_w, src_h; - int dst_w, dst_h; -}; - -struct fimg2d_clip { - bool enable; - int x1; - int y1; - int x2; /* x1 + width */ - int y2; /* y1 + height */ -}; - -struct fimg2d_repeat { - enum repeat mode; - unsigned long pad_color; -}; - -/** - * @bg_color: bg_color is valid only if bluescreen mode is BLUSCR. - */ -struct fimg2d_bluscr { - enum bluescreen mode; - unsigned long bs_color; - unsigned long bg_color; -}; - -/** - * @plane2: address info for CbCr in YCbCr 2plane mode - * @rect: crop/clip rect - * @need_cacheopr: true if cache coherency is required - */ -struct fimg2d_image { - int width; - int height; - int stride; - enum pixel_order order; - enum color_format fmt; - struct fimg2d_addr addr; - struct fimg2d_addr plane2; - struct fimg2d_rect rect; - bool need_cacheopr; -}; - -/** - * @solid_color: - * src color instead of src image / dst color instead of dst read image. - * color format and order must be ARGB8888(A is MSB). - * premultiplied format must be same to 'premult' of this struct. - * @g_alpha: global(constant) alpha. 0xff is opaque, 0 is transparnet - * @dither: dithering - * @rotate: rotation degree in clockwise - * @premult: alpha premultiplied mode for read & write - * @scaling: common scaling info for src and mask image. - * @repeat: repeat type (tile mode) - * @bluscr: blue screen and transparent mode - */ -struct fimg2d_param { - unsigned long solid_color; - unsigned char g_alpha; - bool dither; - enum rotation rotate; - enum premultiplied premult; - struct fimg2d_scale scaling; - struct fimg2d_repeat repeat; - struct fimg2d_bluscr bluscr; - struct fimg2d_clip clipping; -}; - -/** - * @op: blit operation mode - * @src: set when using src image - * @msk: set when using mask image - * @tmp: set when using 2-step blit at a single command - * @dst: dst must not be null - * * tmp image must be the same to dst except memory address - * @seq_no: user debugging info. - * for example, user can set sequence number or pid. - */ -struct fimg2d_blit { - enum blit_op op; - struct fimg2d_param param; - struct fimg2d_image *src; - struct fimg2d_image *msk; - struct fimg2d_image *tmp; - struct fimg2d_image *dst; - enum blit_sync sync; - unsigned int seq_no; -}; - -#endif /*_SEC_G2D_DRIVER_H_*/ diff --git a/exynos4/hal/include/sec_utils.h b/exynos4/hal/include/sec_utils.h deleted file mode 100644 index c139e8e..0000000 --- a/exynos4/hal/include/sec_utils.h +++ /dev/null @@ -1,300 +0,0 @@ -/* - * 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 __SAMSUNG_SYSLSI_SEC_COMMON_H__ -#define __SAMSUNG_SYSLSI_SEC_COMMON_H__ - -//---------------------------------------------------------// -// Include -//---------------------------------------------------------// - -#include <hardware/hardware.h> -#include "graphics.h" -#include "sec_format.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#include "videodev2.h" -#include "videodev2_exynos_camera.h" -//#include "videodev2_exynos_media.h" - -#ifdef __cplusplus -} -#endif - -//---------------------------------------------------------// -// Common structure // -//---------------------------------------------------------// -struct ADDRS { - unsigned int addr_y; - unsigned int addr_cbcr; - unsigned int buf_idx; - unsigned int reserved; -}; - -//---------------------------------------------------------// -// Common function // -//---------------------------------------------------------// -inline int HAL_PIXEL_FORMAT_2_V4L2_PIX(int HAL_PIXEL_FORMAT) -{ - int V4L2_PIX = -1; - - switch (HAL_PIXEL_FORMAT) { - case HAL_PIXEL_FORMAT_RGBA_8888: - case HAL_PIXEL_FORMAT_RGBX_8888: - V4L2_PIX = V4L2_PIX_FMT_RGB32; - break; - - case HAL_PIXEL_FORMAT_RGB_888: - V4L2_PIX = V4L2_PIX_FMT_RGB24; - break; - - case HAL_PIXEL_FORMAT_RGB_565: - V4L2_PIX = V4L2_PIX_FMT_RGB565; - break; - - case HAL_PIXEL_FORMAT_BGRA_8888: - V4L2_PIX = V4L2_PIX_FMT_RGB32; - break; - - case HAL_PIXEL_FORMAT_RGBA_5551: - V4L2_PIX = V4L2_PIX_FMT_RGB555X; - break; - - case HAL_PIXEL_FORMAT_RGBA_4444: - V4L2_PIX = V4L2_PIX_FMT_RGB444; - break; - - case HAL_PIXEL_FORMAT_YV12: - case HAL_PIXEL_FORMAT_YCbCr_420_P: - V4L2_PIX = V4L2_PIX_FMT_YUV420; - break; - - case HAL_PIXEL_FORMAT_YCbCr_422_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP: - V4L2_PIX = V4L2_PIX_FMT_NV61; - break; - - case HAL_PIXEL_FORMAT_YCbCr_420_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP: - V4L2_PIX = V4L2_PIX_FMT_NV12; - break; - - case HAL_PIXEL_FORMAT_YCbCr_422_I: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I: - V4L2_PIX = V4L2_PIX_FMT_YUYV; - break; - - case HAL_PIXEL_FORMAT_YCbCr_422_P: - V4L2_PIX = V4L2_PIX_FMT_YUV422P; - break; - - case HAL_PIXEL_FORMAT_CbYCrY_422_I: - case HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I: - V4L2_PIX = V4L2_PIX_FMT_UYVY; - break; - - case HAL_PIXEL_FORMAT_YCrCb_422_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP: - V4L2_PIX = V4L2_PIX_FMT_NV16; - break; - - case HAL_PIXEL_FORMAT_YCrCb_420_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP: - V4L2_PIX = V4L2_PIX_FMT_NV21; - break; - - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED: - V4L2_PIX = V4L2_PIX_FMT_NV12T; - break; - - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I: - V4L2_PIX = V4L2_PIX_FMT_YVYU; - break; - - case HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I: - V4L2_PIX = V4L2_PIX_FMT_VYUY; - break; - - default: - ALOGE("%s::unmatched HAL_PIXEL_FORMAT color_space(0x%x)\n", - __func__, HAL_PIXEL_FORMAT); - break; - } - - return V4L2_PIX; -} - -inline int V4L2_PIX_2_HAL_PIXEL_FORMAT(int V4L2_PIX) -{ - int HAL_PIXEL_FORMAT = -1; - - switch (V4L2_PIX) { - case V4L2_PIX_FMT_RGB32: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGBA_8888; - break; - - case V4L2_PIX_FMT_RGB24: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGB_888; - break; - - case V4L2_PIX_FMT_RGB565: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGB_565; - break; - - case V4L2_PIX_FMT_BGR32: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_BGRA_8888; - break; - - case V4L2_PIX_FMT_RGB555X: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGBA_5551; - break; - - case V4L2_PIX_FMT_RGB444: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGBA_4444; - break; - - case V4L2_PIX_FMT_YUV420: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YCbCr_420_P; - break; - - case V4L2_PIX_FMT_NV16: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP; - break; - - case V4L2_PIX_FMT_NV12: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP; - break; - - case V4L2_PIX_FMT_YUYV: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I; - break; - - case V4L2_PIX_FMT_YUV422P: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YCbCr_422_P; - break; - - case V4L2_PIX_FMT_UYVY: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I; - break; - - case V4L2_PIX_FMT_NV21: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP; - break; - - case V4L2_PIX_FMT_NV12T: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED; - break; - - case V4L2_PIX_FMT_NV61: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP; - break; - - case V4L2_PIX_FMT_YVYU: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I; - break; - - case V4L2_PIX_FMT_VYUY: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I; - break; - - default: - ALOGE("%s::unmatched V4L2_PIX color_space(%d)\n", - __func__, V4L2_PIX); - break; - } - - return HAL_PIXEL_FORMAT; -} - -#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5) -#define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7) -#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13) - -#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) - -inline unsigned int FRAME_SIZE(int HAL_PIXEL_FORMAT, int w, int h) -{ - unsigned int frame_size = 0; - unsigned int size = 0; - - switch (HAL_PIXEL_FORMAT) { - // 16bpp - case HAL_PIXEL_FORMAT_RGB_565: - case HAL_PIXEL_FORMAT_RGBA_5551: - case HAL_PIXEL_FORMAT_RGBA_4444: - frame_size = GET_16BPP_FRAME_SIZE(w, h); - break; - - // 24bpp - case HAL_PIXEL_FORMAT_RGB_888: - frame_size = GET_24BPP_FRAME_SIZE(w, h); - break; - - // 32bpp - case HAL_PIXEL_FORMAT_RGBA_8888: - case HAL_PIXEL_FORMAT_BGRA_8888: - case HAL_PIXEL_FORMAT_RGBX_8888: - frame_size = GET_32BPP_FRAME_SIZE(w, h); - break; - - // 12bpp - case HAL_PIXEL_FORMAT_YV12: - case HAL_PIXEL_FORMAT_YCrCb_420_SP: - case HAL_PIXEL_FORMAT_YCbCr_420_P: - case HAL_PIXEL_FORMAT_YCbCr_420_I: - case HAL_PIXEL_FORMAT_CbYCrY_420_I: - case HAL_PIXEL_FORMAT_YCbCr_420_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP: - size = w * h; - frame_size = size + ((size >> 2) << 1); - break; - - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED: - frame_size = ALIGN_TO_8KB(ALIGN_TO_128B(w) * ALIGN_TO_32B(h)) - + ALIGN_TO_8KB(ALIGN_TO_128B(w) * ALIGN_TO_32B(h >> 1)); - break; - - // 16bpp - case HAL_PIXEL_FORMAT_YCbCr_422_SP: - case HAL_PIXEL_FORMAT_YCbCr_422_I: - case HAL_PIXEL_FORMAT_YCbCr_422_P: - case HAL_PIXEL_FORMAT_CbYCrY_422_I: - case HAL_PIXEL_FORMAT_YCrCb_422_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I: - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I: - case HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I: - case HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I: - frame_size = GET_16BPP_FRAME_SIZE(w, h); - break; - - default: - ALOGD("%s::no matching source colorformat(0x%x), w(%d), h(%d) fail\n", - __func__, HAL_PIXEL_FORMAT, w, h); - break; - } - - return frame_size; -} - -#endif //__SAMSUNG_SYSLSI_SEC_COMMON_H__ diff --git a/exynos4/hal/include/sec_utils_v4l2.h b/exynos4/hal/include/sec_utils_v4l2.h deleted file mode 100644 index 2c250b9..0000000 --- a/exynos4/hal/include/sec_utils_v4l2.h +++ /dev/null @@ -1,327 +0,0 @@ -/* - * 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 sec_utils_v4l2.h - * brief header file for sec_utils_v4l2.h - * author Sangwoo, Park(sw5771.park@samsung.com) - * date 2011/06/02 - * - * Revision History: - * - 2010/06/03 : Sangwoo, Park(sw5771.park@samsung.com) - * Initial version - * - * - 2011/12/07 : Jeonghee, Kim(jhhhh.kim@samsung.com) - * use V4L2_PIX_FMT_NV12M as HAL_PIXEL_FORMAT_YCbCr_420_SP, HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP - * - * - 2011/12/07 : Hyeonmyeong Choi( hyeon.choi@samsung.com) - * Add V4L2_PIX_FMT_YVU420M - * - */ - - -#ifndef __SAMSUNG_SYSLSI_SEC_COMMON_H__ -#define __SAMSUNG_SYSLSI_SEC_COMMON_H__ - -//---------------------------------------------------------// -// Include -//---------------------------------------------------------// - -#include <hardware/hardware.h> -#include "sec_format.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#include "videodev2.h" - -#ifdef __cplusplus -} -#endif - -//---------------------------------------------------------// -// Common structure // -//---------------------------------------------------------// -struct ADDRS { - unsigned int addr_y; - unsigned int addr_cbcr; - unsigned int buf_idx; - unsigned int reserved; -}; - -//---------------------------------------------------------// -// Common function // -//---------------------------------------------------------// -inline int HAL_PIXEL_FORMAT_2_V4L2_PIX(int HAL_PIXEL_FORMAT) -{ - int V4L2_PIX = -1; - - switch (HAL_PIXEL_FORMAT) { - case HAL_PIXEL_FORMAT_RGBA_8888: - case HAL_PIXEL_FORMAT_RGBX_8888: - V4L2_PIX = V4L2_PIX_FMT_RGB32; - break; - - case HAL_PIXEL_FORMAT_RGB_888: - V4L2_PIX = V4L2_PIX_FMT_RGB24; - break; - - case HAL_PIXEL_FORMAT_RGB_565: - V4L2_PIX = V4L2_PIX_FMT_RGB565; - break; - - case HAL_PIXEL_FORMAT_BGRA_8888: -#if defined(BOARD_USE_V4L2) - V4L2_PIX = V4L2_PIX_FMT_BGR32; -#else - V4L2_PIX = V4L2_PIX_FMT_RGB32; -#endif - break; - - case HAL_PIXEL_FORMAT_RGBA_5551: - V4L2_PIX = V4L2_PIX_FMT_RGB555X; - break; - - case HAL_PIXEL_FORMAT_RGBA_4444: - V4L2_PIX = V4L2_PIX_FMT_RGB444; - break; - - case HAL_PIXEL_FORMAT_YV12: - case HAL_PIXEL_FORMAT_YCbCr_420_P: - V4L2_PIX = V4L2_PIX_FMT_YUV420M; - break; - - case HAL_PIXEL_FORMAT_YCbCr_422_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP: - V4L2_PIX = V4L2_PIX_FMT_NV61; - break; - - case HAL_PIXEL_FORMAT_YCbCr_420_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP: - V4L2_PIX = V4L2_PIX_FMT_NV12M; - break; - - case HAL_PIXEL_FORMAT_YCbCr_422_I: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I: - V4L2_PIX = V4L2_PIX_FMT_YUYV; - break; - - case HAL_PIXEL_FORMAT_YCbCr_422_P: - V4L2_PIX = V4L2_PIX_FMT_YUV422P; - break; - - case HAL_PIXEL_FORMAT_CbYCrY_422_I: - case HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I: - V4L2_PIX = V4L2_PIX_FMT_UYVY; - break; - - case HAL_PIXEL_FORMAT_YCrCb_422_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP: - V4L2_PIX = V4L2_PIX_FMT_NV16; - break; - - case HAL_PIXEL_FORMAT_YCrCb_420_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP: - V4L2_PIX = V4L2_PIX_FMT_NV21; - break; - - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED: - V4L2_PIX = V4L2_PIX_FMT_NV12MT; - break; - - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I: - V4L2_PIX = V4L2_PIX_FMT_YVYU; - break; - - case HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I: - V4L2_PIX = V4L2_PIX_FMT_VYUY; - break; - - default: - ALOGE("%s::unmatched HAL_PIXEL_FORMAT color_space(0x%x)\n", - __func__, HAL_PIXEL_FORMAT); - break; - } - - return V4L2_PIX; -} - -inline int V4L2_PIX_2_HAL_PIXEL_FORMAT(int V4L2_PIX) -{ - int HAL_PIXEL_FORMAT = -1; - - switch (V4L2_PIX) { - case V4L2_PIX_FMT_RGB32: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGBA_8888; - break; - - case V4L2_PIX_FMT_RGB24: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGB_888; - break; - - case V4L2_PIX_FMT_RGB565: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGB_565; - break; - - case V4L2_PIX_FMT_BGR32: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_BGRA_8888; - break; - - case V4L2_PIX_FMT_RGB555X: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGBA_5551; - break; - - case V4L2_PIX_FMT_RGB444: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_RGBA_4444; - break; - - case V4L2_PIX_FMT_YUV420: - case V4L2_PIX_FMT_YUV420M: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YCbCr_420_P; - break; - - case V4L2_PIX_FMT_YVU420: - case V4L2_PIX_FMT_YVU420M: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YV12; - break; - - case V4L2_PIX_FMT_NV16: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP; - break; - - case V4L2_PIX_FMT_NV12: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP; - break; - - case V4L2_PIX_FMT_YUYV: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I; - break; - - case V4L2_PIX_FMT_YUV422P: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_YCbCr_422_P; - break; - - case V4L2_PIX_FMT_UYVY: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I; - break; - - case V4L2_PIX_FMT_NV21: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP; - break; - case V4L2_PIX_FMT_NV12MT: - - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED; - break; - - case V4L2_PIX_FMT_NV61: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP; - break; - - case V4L2_PIX_FMT_YVYU: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I; - break; - - case V4L2_PIX_FMT_VYUY: - HAL_PIXEL_FORMAT = HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I; - break; - - default: - ALOGE("%s::unmatched V4L2_PIX color_space(%d)\n", - __func__, V4L2_PIX); - break; - } - - return HAL_PIXEL_FORMAT; -} - -#define ALIGN_TO_32B(x) ((((x) + (1 << 5) - 1) >> 5) << 5) -#define ALIGN_TO_128B(x) ((((x) + (1 << 7) - 1) >> 7) << 7) -#define ALIGN_TO_8KB(x) ((((x) + (1 << 13) - 1) >> 13) << 13) -#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) - -#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) - -inline unsigned int FRAME_SIZE(int HAL_PIXEL_FORMAT, int w, int h) -{ - unsigned int frame_size = 0; - unsigned int size = 0; - - switch (HAL_PIXEL_FORMAT) { - // 16bpp - case HAL_PIXEL_FORMAT_RGB_565: - case HAL_PIXEL_FORMAT_RGBA_5551: - case HAL_PIXEL_FORMAT_RGBA_4444: - frame_size = GET_16BPP_FRAME_SIZE(w, h); - break; - - // 24bpp - case HAL_PIXEL_FORMAT_RGB_888: - frame_size = GET_24BPP_FRAME_SIZE(w, h); - break; - - // 32bpp - case HAL_PIXEL_FORMAT_RGBA_8888: - case HAL_PIXEL_FORMAT_BGRA_8888: - case HAL_PIXEL_FORMAT_RGBX_8888: - frame_size = GET_32BPP_FRAME_SIZE(w, h); - break; - - // 12bpp - case HAL_PIXEL_FORMAT_YV12: - case HAL_PIXEL_FORMAT_YCrCb_420_SP: - case HAL_PIXEL_FORMAT_YCbCr_420_P: - case HAL_PIXEL_FORMAT_YCbCr_420_I: - case HAL_PIXEL_FORMAT_CbYCrY_420_I: - case HAL_PIXEL_FORMAT_YCbCr_420_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP: - size = w * h; - frame_size = size + ((size >> 2) << 1); - break; - - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED: - frame_size = ALIGN_TO_8KB(ALIGN_TO_128B(w) * ALIGN_TO_32B(h)) - + ALIGN_TO_8KB(ALIGN_TO_128B(w) * ALIGN_TO_32B(h >> 1)); - break; - - // 16bpp - case HAL_PIXEL_FORMAT_YCbCr_422_SP: - case HAL_PIXEL_FORMAT_YCbCr_422_I: - case HAL_PIXEL_FORMAT_YCbCr_422_P: - case HAL_PIXEL_FORMAT_CbYCrY_422_I: - case HAL_PIXEL_FORMAT_YCrCb_422_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_SP: - case HAL_PIXEL_FORMAT_CUSTOM_YCbCr_422_I: - case HAL_PIXEL_FORMAT_CUSTOM_YCrCb_422_I: - case HAL_PIXEL_FORMAT_CUSTOM_CbYCrY_422_I: - case HAL_PIXEL_FORMAT_CUSTOM_CrYCbY_422_I: - frame_size = GET_16BPP_FRAME_SIZE(w, h); - break; - - default: - ALOGD("%s::no matching source colorformat(0x%x), w(%d), h(%d) fail\n", - __func__, HAL_PIXEL_FORMAT, w, h); - break; - } - - return frame_size; -} - -#endif //__SAMSUNG_SYSLSI_SEC_COMMON_H__ diff --git a/exynos4/hal/include/secion.h b/exynos4/hal/include/secion.h deleted file mode 100644 index fd7404d..0000000 --- a/exynos4/hal/include/secion.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright (C) 2012 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 _LIB_SECION_H_ -#define _LIB_SECION_H_ - -#include <unistd.h> /* size_t */ - - -/* ion_client - * An ION client is an object or an entity that needs to use the service of - * ION and has unique address space. ion_client is an identifier of an ION - * client and it represents the ION client. - * All operations on ION needs a valid ion_client value and it can be obtained - * by ion_client_create(). - */ -typedef int ion_client; - -/* ion_buffer - * An identifier of a buffer allocated from ION. You must obtain to access - * a buffer allocated from ION. If you have an effective ion_buffer, you have - * three options to work with it. - * - To access the buffer, you can request an address (user virtual address) - * of the buffer with ion_map(). - * - To pass the buffer to the kernel, you can pass the ion_buffer to the - * kernel driver directly, if the kernel driver can work with ION. - * - To pass the buffer to other processes, you can pass the ion_buffer to - * other processes through RPC machanism such as socket communication or - * Android Binder because ion_buffer is actually an open file descripotor - * of the current process. - */ -typedef int ion_buffer; - -typedef unsigned long ion_phys_addr_t; - - -#define ION_HEAP_SYSTEM_MASK (1 << 0) -#define ION_HEAP_SYSTEM_CONTIG_MASK (1 << 1) -#define ION_HEAP_EXYNOS_CONTIG_MASK (1 << 4) -#define ION_HEAP_EXYNOS_MASK (1 << 5) -#define ION_HEAP_EXYNOS_USER_MASK (1 << 6) -#define ION_EXYNOS_NONCACHE_MASK (1 << (32 - 2)) /* it was BITS_PER_LONG */ -#define ION_EXYNOS_WRITE_MASK (1 << (32 - 1)) /* it was BITS_PER_LONG */ - -/* ION_MSYNC_FLAGS - * values of @flags parameter to ion_msync() - * - * IMSYNC_DEV_TO_READ: Device only reads the buffer - * IMSYNC_DEV_TO_WRITE: Device may writes to the buffer - * IMSYNC_DEV_TO_RW: Device reads and writes to the buffer - * - * IMSYNC_SYNC_FOR_DEV: ion_msync() for device to access the buffer - * IMSYNC_SYNC_FOR_CPU: ion_msync() for CPU to access the buffer after device - * has accessed it. - * - * The values must be ORed with one of IMSYNC_DEV_* and one of IMSYNC_SYNC_*. - * Otherwise, ion_msync() will not effect. - */ -enum ION_MSYNC_FLAGS { - IMSYNC_DEV_TO_READ = 0, - IMSYNC_DEV_TO_WRITE = 1, - IMSYNC_DEV_TO_RW = 2, - IMSYNC_SYNC_FOR_DEV = 0x10000, - IMSYNC_SYNC_FOR_CPU = 0x20000, -}; - -struct secion_param { - ion_client client; - ion_buffer buffer; - size_t size; - void *memory; - ion_phys_addr_t physaddr; -}; - -#ifdef __cplusplus -extern "C" { -#endif - -/* ion_client_create() - * @RETURN: new ion_client. - * netative value if creating new ion_client is failed. - * - * A call to ion_client_create() must be paired with ion_client_destroy(), - * symmetrically. ion_client_destroy() needs a valid ion_client that - * is returned by ion_client_create(). - */ -ion_client ion_client_create(void); - -/* ion_client_destroy() - * @client: An ion_client value to remove. - */ -void ion_client_destroy(ion_client client); - -/* ion_alloc() - Allocates new buffer from ION. - * @client: A valid ion_client value returned by ion_client_create(). - * @len: Size of a buffer required in bytes. - * @align: Alignment requirements of @len and the start address of the allocated - * buffer. If the @len is not aligned by @align, ION allocates a buffer - * that is aligned by @align and the size of the buffer will be larger - * than @len. - * @flags: Additional requirements about buffer. ION_HEAP_SYSTEM_CONTIG_MASK - * for allocating physically contiguous buffer and ION_HEAP_SYSTEM_MASK - * for virtually contiguous buffer. You can combine those flags or - * simply give -1(0xFFFFFFFF) if you do not care about the contiguouty - * of the buffer. - * @RETURN: An ion_buffer that represents the buffer allocated. It is only - * unique in the context of the given client, @client. - * -error if the allocation failed. - * See the description of ion_buffer above for detailed information. - */ -ion_buffer ion_alloc(ion_client client, size_t len, size_t align, unsigned int flags); - -/* ion_free() - Frees an existing buffer that is allocated by ION - * @buffer: An ion_buffer of the buffer to be released. - */ -void ion_free(ion_buffer buffer); - -/* ion_map() - Obtains a virtual address of the buffer identied by @buffer - * @buffer: The buffer to map. The virtual address returned is allocated by the - * kernel. - * @len: The size of the buffer to map. This must not exceed the size of the - * buffer represented by @fd_buf. Thus you need to know the size of it - * before calling this function. If @len is less than the size of the - * buffer, this function just map just the size requested (@len) not the - * entire buffer. - * @offset: How many pages will be ignored while mapping.@offset number of - * pages from the start of the buffer will not be mapped. - * @RETURN: The start virtual addres mapped. - * MAP_FAILED if mapping fails. - * - * Note that @len + (@offset * PAGE_SIZE) must not exceed the size of the - * buffer. - */ -void *ion_map(ion_buffer buffer, size_t len, off_t offset); - -/* ion_unmap() - Frees the buffer mapped by ion_map() - * @addr: The address returned by ion_map(). - * @len: The size of the buffer mapped by ion_map(). - * @RETURN: 0 on success, and -1 on failure. - * errno is also set on failure. - */ -int ion_unmap(void *addr, size_t len); - -/* ion_msync() - Makes sure that data in the buffer are visible to H/W peri. - * @client: A valid ion_client value returned by ion_client_create(). - * @buffer: The buffer to perform ion_msync(). - * @flags: Direction of access of H/W peri and CPU. See the description of - * ION_MSYNC_FLAGS. - * @size: Size to ion_msync() in bytes. - * @offset: Where ion_msync() start in @buffer, size in bytes. - * @RETURN: 0 if successful. -error, otherwise. - * - * Note that @offset + @size must not exceed the size of @buffer. - */ -int ion_msync(ion_client client, ion_buffer buffer, long flags, size_t size, off_t offset); - - - - -ion_phys_addr_t ion_getphys(ion_client client, ion_buffer buffer); -int createIONMem(struct secion_param *param, size_t size, unsigned int flags); -int destroyIONMem(struct secion_param *param); - -#ifdef __cplusplus -} -#endif -#endif /* _LIB_SECION_H_ */ diff --git a/exynos4/hal/include/ump.h b/exynos4/hal/include/ump.h deleted file mode 100644 index 12a5c8c..0000000 --- a/exynos4/hal/include/ump.h +++ /dev/null @@ -1,268 +0,0 @@ -/* - * Copyright (C) 2010-2013 ARM Limited. All rights reserved. - * - * 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 ump.h - * - * This file contains the user space part of the UMP API. - */ - -#ifndef _UNIFIED_MEMORY_PROVIDER_H_ -#define _UNIFIED_MEMORY_PROVIDER_H_ - - -/** @defgroup ump_user_space_api UMP User Space API - * @{ */ - - -#include "ump_platform.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * External representation of a UMP handle in user space. - */ -typedef void * ump_handle; - -/** - * Typedef for a secure ID, a system wide identificator for UMP memory buffers. - */ -typedef unsigned int ump_secure_id; - -/** - * Value to indicate an invalid UMP memory handle. - */ -#define UMP_INVALID_MEMORY_HANDLE ((ump_handle)0) - -/** - * Value to indicate an invalid secure Id. - */ -#define UMP_INVALID_SECURE_ID ((ump_secure_id)-1) - -/** - * UMP error codes for user space. - */ -typedef enum -{ - UMP_OK = 0, /**< indicates success */ - UMP_ERROR, /**< indicates failure */ -} ump_result; - - -/** - * Opens and initializes the UMP library. - * - * This function must be called at least once before calling any other UMP API functions. - * Each open is reference counted and must be matched with a call to @ref ump_close "ump_close". - * - * @see ump_close - * - * @return UMP_OK indicates success, UMP_ERROR indicates failure. - */ -UMP_API_EXPORT ump_result ump_open(void); - - -/** - * Terminate the UMP library. - * - * This must be called once for every successful @ref ump_open "ump_open". The UMP library is - * terminated when, and only when, the last open reference to the UMP interface is closed. - * - * @see ump_open - */ -UMP_API_EXPORT void ump_close(void); - - -/** - * Retrieves the secure ID for the specified UMP memory. - * - * This identificator is unique across the entire system, and uniquely identifies - * the specified UMP memory. This identificator can later be used through the - * @ref ump_handle_create_from_secure_id "ump_handle_create_from_secure_id" or - * @ref ump_dd_handle_create_from_secure_id "ump_dd_handle_create_from_secure_id" - * functions in order to access this UMP memory, for instance from another process. - * - * @note There is a kernel space equivalent function called @ref ump_dd_secure_id_get "ump_dd_secure_id_get" - * - * @see ump_handle_create_from_secure_id - * @see ump_dd_handle_create_from_secure_id - * @see ump_dd_secure_id_get - * - * @param mem Handle to UMP memory. - * - * @return Returns the secure ID for the specified UMP memory. - */ -UMP_API_EXPORT ump_secure_id ump_secure_id_get(ump_handle mem); - - -/** - * Retrieves a handle to allocated UMP memory. - * - * The usage of UMP memory is reference counted, so this will increment the reference - * count by one for the specified UMP memory. - * Use @ref ump_reference_release "ump_reference_release" when there is no longer any - * use for the retrieved handle. - * - * @note There is a kernel space equivalent function called @ref ump_dd_handle_create_from_secure_id "ump_dd_handle_create_from_secure_id" - * - * @see ump_reference_release - * @see ump_dd_handle_create_from_secure_id - * - * @param secure_id The secure ID of the UMP memory to open, that can be retrieved using the @ref ump_secure_id_get "ump_secure_id_get " function. - * - * @return UMP_INVALID_MEMORY_HANDLE indicates failure, otherwise a valid handle is returned. - */ -UMP_API_EXPORT ump_handle ump_handle_create_from_secure_id(ump_secure_id secure_id); - - -/** - * Retrieves the actual size of the specified UMP memory. - * - * The size is reported in bytes, and is typically page aligned. - * - * @note There is a kernel space equivalent function called @ref ump_dd_size_get "ump_dd_size_get" - * - * @see ump_dd_size_get - * - * @param mem Handle to UMP memory. - * - * @return Returns the allocated size of the specified UMP memory, in bytes. - */ -UMP_API_EXPORT unsigned long ump_size_get(ump_handle mem); - - -/** - * Read from specified UMP memory. - * - * Another way of reading from (and writing to) UMP memory is to use the - * @ref ump_mapped_pointer_get "ump_mapped_pointer_get" to retrieve - * a CPU mapped pointer to the memory. - * - * @see ump_mapped_pointer_get - * - * @param dst Destination buffer. - * @param src Handle to UMP memory to read from. - * @param offset Where to start reading, given in bytes. - * @param length How much to read, given in bytes. - */ -UMP_API_EXPORT void ump_read(void * dst, ump_handle src, unsigned long offset, unsigned long length); - - -/** - * Write to specified UMP memory. - * - * Another way of writing to (and reading from) UMP memory is to use the - * @ref ump_mapped_pointer_get "ump_mapped_pointer_get" to retrieve - * a CPU mapped pointer to the memory. - * - * @see ump_mapped_pointer_get - * - * @param dst Handle to UMP memory to write to. - * @param offset Where to start writing, given in bytes. - * @param src Buffer to read from. - * @param length How much to write, given in bytes. - */ -UMP_API_EXPORT void ump_write(ump_handle dst, unsigned long offset, const void * src, unsigned long length); - - -/** - * Retrieves a memory mapped pointer to the specified UMP memory. - * - * This function retrieves a memory mapped pointer to the specified UMP memory, - * that can be used by the CPU. Every successful call to - * @ref ump_mapped_pointer_get "ump_mapped_pointer_get" is reference counted, - * and must therefore be followed by a call to - * @ref ump_mapped_pointer_release "ump_mapped_pointer_release " when the - * memory mapping is no longer needed. - * - * @note Systems without a MMU for the CPU only return the physical address, because no mapping is required. - * - * @see ump_mapped_pointer_release - * - * @param mem Handle to UMP memory. - * - * @return NULL indicates failure, otherwise a CPU mapped pointer is returned. - */ -UMP_API_EXPORT void * ump_mapped_pointer_get(ump_handle mem); - - -/** - * Releases a previously mapped pointer to the specified UMP memory. - * - * The CPU mapping of the specified UMP memory memory is reference counted, - * so every call to @ref ump_mapped_pointer_get "ump_mapped_pointer_get" must - * be matched with a call to this function when the mapping is no longer needed. - * - * The CPU mapping is not removed before all references to the mapping is released. - * - * @note Systems without a MMU must still implement this function, even though no unmapping should be needed. - * - * @param mem Handle to UMP memory. - */ -UMP_API_EXPORT void ump_mapped_pointer_release(ump_handle mem); - - -/** - * Adds an extra reference to the specified UMP memory. - * - * This function adds an extra reference to the specified UMP memory. This function should - * be used every time a UMP memory handle is duplicated, that is, assigned to another ump_handle - * variable. The function @ref ump_reference_release "ump_reference_release" must then be used - * to release each copy of the UMP memory handle. - * - * @note You are not required to call @ref ump_reference_add "ump_reference_add" - * for UMP handles returned from - * @ref ump_handle_create_from_secure_id "ump_handle_create_from_secure_id", - * because these handles are already reference counted by this function. - * - * @note There is a kernel space equivalent function called @ref ump_dd_reference_add "ump_dd_reference_add" - * - * @see ump_dd_reference_add - * - * @param mem Handle to UMP memory. - */ -UMP_API_EXPORT void ump_reference_add(ump_handle mem); - - -/** - * Releases a reference from the specified UMP memory. - * - * This function should be called once for every reference to the UMP memory handle. - * When the last reference is released, all resources associated with this UMP memory - * handle are freed. - * - * @note There is a kernel space equivalent function called @ref ump_dd_reference_release "ump_dd_reference_release" - * - * @see ump_dd_reference_release - * - * @param mem Handle to UMP memory. - */ -UMP_API_EXPORT void ump_reference_release(ump_handle mem); - - -#ifdef __cplusplus -} -#endif - - -/** @} */ /* end group ump_user_space_api */ - - -#endif /*_UNIFIED_MEMORY_PROVIDER_H_ */ diff --git a/exynos4/hal/include/ump_platform.h b/exynos4/hal/include/ump_platform.h deleted file mode 100644 index 3c6e4ff..0000000 --- a/exynos4/hal/include/ump_platform.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2010-2011, 2013 ARM Limited. All rights reserved. - * - * 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 ump_platform.h - * - * This file should define UMP_API_EXPORT, - * which dictates how the UMP user space API should be exported/imported. - * Modify this file, if needed, to match your platform setup. - */ - -#ifndef __UMP_PLATFORM_H__ -#define __UMP_PLATFORM_H__ - -/** @addtogroup ump_user_space_api - * @{ */ - -/** - * A define which controls how UMP user space API functions are imported and exported. - * This define should be set by the implementor of the UMP API. - */ -#if defined(_WIN32) - -#define UMP_API_EXPORT - -#elif defined(__SYMBIAN32__) - -#define UMP_API_EXPORT IMPORT_C - -#else - -#if defined(__GNUC__) -#if __GNUC__ >= 4 -# define MALI_VISIBLE __attribute__ ((visibility ("default"))) /**< Function should be visible from outside the dll */ -#else -# define MALI_VISIBLE -#endif - -#elif defined(__ARMCC_VERSION) -/* ARMCC specific */ -# define MALI_VISIBLE __declspec(dllexport) - -#else -# define MALI_VISIBLE - -#endif - -#define UMP_API_EXPORT MALI_VISIBLE - -#endif - -/** @} */ /* end group ump_user_space_api */ - - -#endif /* __UMP_PLATFORM_H__ */ diff --git a/exynos4/hal/include/ump_ref_drv.h b/exynos4/hal/include/ump_ref_drv.h deleted file mode 100644 index 76095d2..0000000 --- a/exynos4/hal/include/ump_ref_drv.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2010, 2012-2013 ARM Limited. All rights reserved. - * - * 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 ump_ref_drv.h - * - * Reference driver extensions to the UMP user space API for allocating UMP memory - */ - -#ifndef _UNIFIED_MEMORY_PROVIDER_REF_DRV_H_ -#define _UNIFIED_MEMORY_PROVIDER_REF_DRV_H_ - -#include "ump.h" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum -{ - /* This enum must match with the enum found in - * <kernel_directory>/drivers/gpu/mali400/<ver>/ump/include/ump_ref_drv.h */ - UMP_REF_DRV_CONSTRAINT_NONE = 0, - UMP_REF_DRV_CONSTRAINT_PHYSICALLY_LINEAR = 1, - UMP_REF_DRV_CONSTRAINT_USE_CACHE = 128, -} ump_alloc_constraints; - -/** Allocate an UMP handle containing a memory buffer. - * Input: Size: The minimum size for the allocation. - * Usage: If this is UMP_REF_DRV_CONSTRAINT_USE_CACHE, the allocation is mapped as cached by the cpu. - * If it is UMP_REF_DRV_CONSTRAINT_NONE it is mapped as noncached. - * The flag UMP_REF_DRV_CONSTRAINT_PHYSICALLY_LINEAR is not supported.*/ -UMP_API_EXPORT ump_handle ump_ref_drv_allocate(unsigned long size, ump_alloc_constraints usage); - -UMP_API_EXPORT ump_handle ump_ref_drv_ion_import(int ion_fd, ump_alloc_constraints constraints); - -typedef enum -{ - UMP_MSYNC_CLEAN = 0 , - UMP_MSYNC_CLEAN_AND_INVALIDATE = 1, - UMP_MSYNC_INVALIDATE = 2, - UMP_MSYNC_READOUT_CACHE_ENABLED = 128, -} ump_cpu_msync_op; - -typedef enum -{ - UMP_READ = 1, - UMP_READ_WRITE = 3, -} ump_lock_usage; - -/** Flushing cache for an ump_handle. - * The function will always CLEAN_AND_INVALIDATE as long as the \a op is not UMP_MSYNC_READOUT_CACHE_ENABLED. - * If so it will only report back if the given ump_handle is cacheable. - * At the momement the implementation does not use \a address or \a size. - * Return value is 1 if cache is enabled, and 0 if it is disabled for the given allocation.*/ -UMP_API_EXPORT int ump_cpu_msync_now(ump_handle mem, ump_cpu_msync_op op, void* address, int size); - - -typedef enum -{ - UMP_USED_BY_CPU = 0, - UMP_USED_BY_MALI = 1, - UMP_USED_BY_UNKNOWN_DEVICE = 100, -} ump_hw_usage; - -typedef enum -{ - UMP_CACHE_OP_START = 0, - UMP_CACHE_OP_FINISH = 1, -} ump_cache_op_control; - -/** Cache operation control. Tell when cache maintenance operations start and end. -This will allow the kernel to merge cache operations togheter, thus making them faster */ -UMP_API_EXPORT int ump_cache_operations_control(ump_cache_op_control op); - -/** Memory synchronization - cache flushing if previous user was different hardware */ -UMP_API_EXPORT int ump_switch_hw_usage( ump_handle mem, ump_hw_usage new_user ); - -/** Memory synchronization - cache flushing if previous user was different hardware */ -UMP_API_EXPORT int ump_switch_hw_usage_secure_id( ump_secure_id ump_id, ump_hw_usage new_user ); - -/** Locking buffer. Blocking call if the buffer is already locked. */ -UMP_API_EXPORT int ump_lock( ump_handle mem, ump_lock_usage lock_usage ); - -/** Locking buffer. Blocking call if the buffer is already locked. */ -UMP_API_EXPORT int ump_lock_secure_id( ump_secure_id ump_id, ump_lock_usage lock_usage ); - -/** Unlocking buffer. Let other users lock the buffer for their usage */ -UMP_API_EXPORT int ump_unlock( ump_handle mem ); - -/** Unlocking buffer. Let other users lock the buffer for their usage */ -UMP_API_EXPORT int ump_unlock_secure_id( ump_secure_id ump_id ); - - -#ifdef __cplusplus -} -#endif - -#endif /*_UNIFIED_MEMORY_PROVIDER_REF_DRV_H_ */ diff --git a/exynos4/hal/include/video.h b/exynos4/hal/include/video.h deleted file mode 100644 index 0565b85..0000000 --- a/exynos4/hal/include/video.h +++ /dev/null @@ -1,363 +0,0 @@ -#ifndef _VIDEO_H_ -#define _VIDEO_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef __HDMI_VIDEO_VIDEOFORMAT__ -#define __HDMI_VIDEO_VIDEOFORMAT__ -/** - * @enum VideoFormat - * Video format - */ -enum VideoFormat { - /** 640x480p\@60Hz */ - v640x480p_60Hz = 0, - /** 720x480p\@60Hz */ - v720x480p_60Hz, - /** 1280x700p\@60Hz */ - v1280x720p_60Hz, - /** 1920x1080i\@60Hz */ - v1920x1080i_60Hz, - /** 720x480i\@60Hz */ - v720x480i_60Hz, - /** 720x240p\@60Hz */ - v720x240p_60Hz, - /** 2880x480i\@60Hz */ - v2880x480i_60Hz, - /** 2880x240p\@60Hz */ - v2880x240p_60Hz, - /** 1440x480p\@60Hz */ - v1440x480p_60Hz, - /** 1920x1080p\@60Hz */ - v1920x1080p_60Hz, - /** 720x576p\@60Hz */ - v720x576p_50Hz, - /** 1280x720p\@50Hz */ - v1280x720p_50Hz, - /** 1920x1080i\@50Hz (V total = 1125) */ - v1920x1080i_50Hz, - /** 720x576i\@50Hz */ - v720x576i_50Hz, - /** 720x288p\@50Hz */ - v720x288p_50Hz, - /** 2880x576i\@50Hz */ - v2880x576i_50Hz, - /** 2880x288p\@50Hz */ - v2880x288p_50Hz, - /** 1440x576p\@50Hz */ - v1440x576p_50Hz, - /** 1920x1080p\@50Hz */ - v1920x1080p_50Hz, - /** 1920x1080p\@24Hz */ - v1920x1080p_24Hz, - /** 1920x1080p\@25Hz */ - v1920x1080p_25Hz, - /** 1920x1080p\@30Hz */ - v1920x1080p_30Hz, - /** 2880x480p\@60Hz */ - v2880x480p_60Hz, - /** 2880x576p\@60Hz */ - v2880x576p_50Hz, - /** 1920x1080i\@50Hz (V total = 1250) */ - v1920x1080i_50Hz_1250, - /** 1920x1080i\@100Hz */ - v1920x1080i_100Hz, - /** 1280x720p\@100Hz */ - v1280x720p_100Hz, - /** 720x576p\@100Hz */ - v720x576p_100Hz, - /** 720x576i\@100Hz */ - v720x576i_100Hz, - /** 1920x1080i\@120Hz */ - v1920x1080i_120Hz, - /** 1280x720p\@120Hz */ - v1280x720p_120Hz, - /** 720x480p\@120Hz */ - v720x480p_120Hz, - /** 720x480i\@120Hz */ - v720x480i_120Hz, - /** 720x576p\@200Hz */ - v720x576p_200Hz, - /** 720x576i\@200Hz */ - v720x576i_200Hz, - /** 720x480p\@240Hz */ - v720x480p_240Hz, - /** 720x480i\@240Hz */ - v720x480i_240Hz, - /** 1280x720p\@24Hz */ - v1280x720p_24Hz, - /** 1280x720p\@25Hz */ - v1280x720p_25Hz, - /** 1280x720p\@30Hz */ - v1280x720p_30Hz, - /** 1920x1080p\@120Hz */ - v1920x1080p_120Hz, - /** 1920x1080p\@100Hz */ - v1920x1080p_100Hz, - /** 4Kx2K\@30Hz */ - v4Kx2K_30Hz, -}; -#endif /* __HDMI_VIDEO_VIDEOFORMAT__ */ -#ifndef __HDMI_VIDEO_COLORSPACE__ -#define __HDMI_VIDEO_COLORSPACE__ -/** - * @enum ColorSpace - * Color space of video stream. - */ -enum ColorSpace { - /** RGB color space */ - HDMI_CS_RGB, - /** YCbCr 4:4:4 color space */ - HDMI_CS_YCBCR444, - /** YCbCr 4:2:2 color space */ - HDMI_CS_YCBCR422 -}; -#endif /* __HDMI_VIDEO_COLORSPACE__ */ - -#ifndef __HDMI_VIDEO_COLORDEPTH__ -#define __HDMI_VIDEO_COLORDEPTH__ -/** - * @enum ColorDepth - * Color depth per pixel of video stream - */ -enum ColorDepth { - /** 36 bit color depth per pixel */ - HDMI_CD_36, - /** 30 bit color depth per pixel */ - HDMI_CD_30, - /** 24 bit color depth per pixel */ - HDMI_CD_24 -}; -#endif /* __HDMI_VIDEO_COLORDEPTH__ */ - -#ifndef __HDMI_VIDEO_HDMIMODE__ -#define __HDMI_VIDEO_HDMIMODE__ -/** - * @enum HDMIMode - * System mode - */ -enum HDMIMode { - /** DVI mode */ - DVI = 0, - /** HDMI mode */ - HDMI -}; -#endif /* __HDMI_VIDEO_HDMIMODE__ */ - -#ifndef __HDMI_VIDEO_PIXELLIMIT__ -#define __HDMI_VIDEO_PIXELLIMIT__ -/** - * @enum PixelLimit - * Pixel limitation of video stream - */ -enum PixelLimit { - /** Full range */ - HDMI_FULL_RANGE, - /** Limit range for RGB color space */ - HDMI_RGB_LIMIT_RANGE, - /** Limit range for YCbCr color space */ - HDMI_YCBCR_LIMIT_RANGE -}; -#endif /* __HDMI_VIDEO_PIXELLIMIT__ */ - -#ifndef __HDMI_VIDEO_COLORIMETRY__ -#define __HDMI_VIDEO_COLORIMETRY__ -/** - * @enum HDMIColorimetry - * Colorimetry of video stream - */ -enum HDMIColorimetry { - /** Colorimetry is not defined */ - HDMI_COLORIMETRY_NO_DATA, - /** ITU601 colorimetry */ - HDMI_COLORIMETRY_ITU601, - /** ITU709 colorimetry */ - HDMI_COLORIMETRY_ITU709, - /** Extended ITU601 colorimetry */ - HDMI_COLORIMETRY_EXTENDED_xvYCC601, - /** Extended ITU709 colorimetry */ - HDMI_COLORIMETRY_EXTENDED_xvYCC709 -}; -#endif /* __HDMI_VIDEO_COLORIMETRY__ */ - -#ifndef __HDMI_VIDEO_PIXELASPECTRATIO__ -#define __HDMI_VIDEO_PIXELASPECTRATIO__ -/** - * @enum PixelAspectRatio - * Pixel aspect ratio of video stream - */ -enum PixelAspectRatio { - /** as picutre pixel ratio */ - HDMI_PIXEL_RATIO_AS_PICTURE, - /** 4:3 pixel ratio */ - HDMI_PIXEL_RATIO_4_3, - /** 16:9 pixel ratio */ - HDMI_PIXEL_RATIO_16_9 -}; -#endif /* __HDMI_VIDEO_PIXELASPECTRATIO__ */ - -#ifndef __HDMI_VIDEO_PIXELFREQUENCY__ -#define __HDMI_VIDEO_PIXELFREQUENCY__ -/** - * @enum PixelFreq - * Pixel Frequency - */ -enum PixelFreq { - /** 25.2 MHz pixel frequency */ - PIXEL_FREQ_25_200 = 2520, - /** 25.175 MHz pixel frequency */ - PIXEL_FREQ_25_175 = 2517, - /** 27 MHz pixel frequency */ - PIXEL_FREQ_27 = 2700, - /** 27.027 MHz pixel frequency */ - PIXEL_FREQ_27_027 = 2702, - /** 54 MHz pixel frequency */ - PIXEL_FREQ_54 = 5400, - /** 54.054 MHz pixel frequency */ - PIXEL_FREQ_54_054 = 5405, - /** 74.25 MHz pixel frequency */ - PIXEL_FREQ_74_250 = 7425, - /** 74.176 MHz pixel frequency */ - PIXEL_FREQ_74_176 = 7417, - /** 148.5 MHz pixel frequency */ - PIXEL_FREQ_148_500 = 14850, - /** 148.352 MHz pixel frequency */ - PIXEL_FREQ_148_352 = 14835, - /** 108.108 MHz pixel frequency */ - PIXEL_FREQ_108_108 = 10810, - /** 72 MHz pixel frequency */ - PIXEL_FREQ_72 = 7200, - /** 25 MHz pixel frequency */ - PIXEL_FREQ_25 = 2500, - /** 65 MHz pixel frequency */ - PIXEL_FREQ_65 = 6500, - /** 108 MHz pixel frequency */ - PIXEL_FREQ_108 = 10800, - /** 162 MHz pixel frequency */ - PIXEL_FREQ_162 = 16200, - /** 59.4 MHz pixel frequency */ - PIXEL_FREQ_59_400 = 5940, -}; -#endif /* __HDMI_VIDEO_PIXELFREQUENCY__ */ - -#ifndef __HDMI_PHY_PIXELFREQUENCY__ -#define __HDMI_PHY_PIXELFREQUENCY__ - -/** - * @enum PHYFreq - * PHY Frequency - */ -enum PHYFreq { - /** Not supported */ - PHY_FREQ_NOT_SUPPORTED = -1, - /** 25.2 MHz pixel frequency */ - PHY_FREQ_25_200 = 0, - /** 25.175 MHz pixel frequency */ - PHY_FREQ_25_175, - /** 27 MHz pixel frequency */ - PHY_FREQ_27, - /** 27.027 MHz pixel frequency */ - PHY_FREQ_27_027, - /** 54 MHz pixel frequency */ - PHY_FREQ_54, - /** 54.054 MHz pixel frequency */ - PHY_FREQ_54_054, - /** 74.25 MHz pixel frequency */ - PHY_FREQ_74_250, - /** 74.176 MHz pixel frequency */ - PHY_FREQ_74_176, - /** 148.5 MHz pixel frequency */ - PHY_FREQ_148_500, - /** 148.352 MHz pixel frequency */ - PHY_FREQ_148_352, - /** 108.108 MHz pixel frequency */ - PHY_FREQ_108_108, - /** 72 MHz pixel frequency */ - PHY_FREQ_72, - /** 25 MHz pixel frequency */ - PHY_FREQ_25, - /** 65 MHz pixel frequency */ - PHY_FREQ_65, - /** 108 MHz pixel frequency */ - PHY_FREQ_108, - /** 162 MHz pixel frequency */ - PHY_FREQ_162, - /** 59.4 MHz pixel frequency */ - PHY_FREQ_59_400, -}; - -#endif /* __HDMI_PHY_PIXELFREQUENCY__ */ - -#ifndef __HDMI_VIDEO_SOURCE__ -#define __HDMI_VIDEO_SOURCE__ -/** - * @enum HDMIVideoSource - * Type of video source. - */ -enum HDMIVideoSource { - /** Internal Video Source */ - HDMI_SOURCE_INTERNAL, - /** External Video Source */ - HDMI_SOURCE_EXTERNAL, -}; -#endif /* __HDMI_VIDEO_SOURCE__ */ - -#ifndef __HDMI_3D_VIDEO_STRUCTURE__ -#define __HDMI_3D_VIDEO_STRUCTURE__ -/** - * @enum HDMI3DVideoStructure - * Type of 3D Video Structure - */ -enum HDMI3DVideoStructure { - /** 2D Video Format */ - HDMI_2D_VIDEO_FORMAT = -1, - /** 3D Frame Packing Structure */ - HDMI_3D_FP_FORMAT = 0, - /** 3D Field Alternative Structure */ - HDMI_3D_FA_FORMAT, - /** 3D Line Alternative Structure */ - HDMI_3D_LA_FORMAT, - /** Side-by-Side(Full)Structure */ - HDMI_3D_SSF_FORMAT, - /** 3D L+Depth Structure */ - HDMI_3D_LD_FORMAT, - /** 3D L+Depth+Graphics Structure */ - HDMI_3D_LDGFX_FORMAT, - /** 3D Top-and-Bottom Structure */ - HDMI_3D_TB_FORMAT, - /** HDMI VIC Structure (ex. 4Kx2K) */ - HDMI_VIC_FORMAT, - /** Side-by-Side(Half)Structure */ - HDMI_3D_SSH_FORMAT, -}; -#endif /* __HDMI_3D_VIDEO_STRUCTURE__ */ - -#ifndef __HDMI_VIDEO_PARAMETER__ -#define __HDMI_VIDEO_PARAMETER__ -//! Structure for HDMI video -struct HDMIVideoParameter { - /** Video interface */ - enum HDMIMode mode; - /** Video format */ - enum VideoFormat resolution; - /** Color space */ - enum ColorSpace colorSpace; - /** Color depth */ - enum ColorDepth colorDepth; - /** Colorimetry */ - enum HDMIColorimetry colorimetry; - /** Pixel aspect ratio */ - enum PixelAspectRatio pixelAspectRatio; - /** Video Source */ - enum HDMIVideoSource videoSrc; - /** 3D Video Structure */ - enum HDMI3DVideoStructure hdmi_3d_format; -}; -#endif /* __HDMI_VIDEO_PARAMETER__*/ - -#ifdef __cplusplus -} -#endif -#endif /* _VIDEO_H_ */ diff --git a/exynos4/hal/include/videodev2.h b/exynos4/hal/include/videodev2.h deleted file mode 100644 index a464469..0000000 --- a/exynos4/hal/include/videodev2.h +++ /dev/null @@ -1,2364 +0,0 @@ -/* - * Video for Linux Two header file - * - * Copyright (C) 1999-2007 the contributors - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * Alternatively you can redistribute this file under the terms of the - * BSD license as stated below: - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. The names of its contributors may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * Header file for v4l or V4L2 drivers and applications - * with public API. - * All kernel-specific stuff were moved to media/v4l2-dev.h, so - * no #if __KERNEL tests are allowed here - * - * See http://linuxtv.org for more info - * - * Author: Bill Dirks <bill@thedirks.org> - * Justin Schoeman - * Hans Verkuil <hverkuil@xs4all.nl> - * et al. - */ -#ifndef __LINUX_VIDEODEV2_H -#define __LINUX_VIDEODEV2_H - -#ifdef __KERNEL__ -#include <linux/time.h> /* need struct timeval */ -#else -#include <sys/time.h> -#endif -#include <linux/compiler.h> -#include <linux/ioctl.h> -#include <linux/types.h> - -/* - * Common stuff for both V4L1 and V4L2 - * Moved from videodev.h - */ -#define VIDEO_MAX_FRAME 32 -#define VIDEO_MAX_PLANES 8 - -#ifndef __KERNEL__ - -/* These defines are V4L1 specific and should not be used with the V4L2 API! - They will be removed from this header in the future. */ - -#define VID_TYPE_CAPTURE 1 /* Can capture */ -#define VID_TYPE_TUNER 2 /* Can tune */ -#define VID_TYPE_TELETEXT 4 /* Does teletext */ -#define VID_TYPE_OVERLAY 8 /* Overlay onto frame buffer */ -#define VID_TYPE_CHROMAKEY 16 /* Overlay by chromakey */ -#define VID_TYPE_CLIPPING 32 /* Can clip */ -#define VID_TYPE_FRAMERAM 64 /* Uses the frame buffer memory */ -#define VID_TYPE_SCALES 128 /* Scalable */ -#define VID_TYPE_MONOCHROME 256 /* Monochrome only */ -#define VID_TYPE_SUBCAPTURE 512 /* Can capture subareas of the image */ -#define VID_TYPE_MPEG_DECODER 1024 /* Can decode MPEG streams */ -#define VID_TYPE_MPEG_ENCODER 2048 /* Can encode MPEG streams */ -#define VID_TYPE_MJPEG_DECODER 4096 /* Can decode MJPEG streams */ -#define VID_TYPE_MJPEG_ENCODER 8192 /* Can encode MJPEG streams */ -#endif - -/* - * M I S C E L L A N E O U S - */ - -/* Four-character-code (FOURCC) */ -#define v4l2_fourcc(a, b, c, d)\ - ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) - -/* - * E N U M S - */ -enum v4l2_field { - V4L2_FIELD_ANY = 0, /* driver can choose from none, - top, bottom, interlaced - depending on whatever it thinks - is approximate ... */ - V4L2_FIELD_NONE = 1, /* this device has no fields ... */ - V4L2_FIELD_TOP = 2, /* top field only */ - V4L2_FIELD_BOTTOM = 3, /* bottom field only */ - V4L2_FIELD_INTERLACED = 4, /* both fields interlaced */ - V4L2_FIELD_SEQ_TB = 5, /* both fields sequential into one - buffer, top-bottom order */ - V4L2_FIELD_SEQ_BT = 6, /* same as above + bottom-top order */ - V4L2_FIELD_ALTERNATE = 7, /* both fields alternating into - separate buffers */ - V4L2_FIELD_INTERLACED_TB = 8, /* both fields interlaced, top field - first and the top field is - transmitted first */ - V4L2_FIELD_INTERLACED_BT = 9, /* both fields interlaced, top field - first and the bottom field is - transmitted first */ -}; -#define V4L2_FIELD_HAS_TOP(field) \ - ((field) == V4L2_FIELD_TOP ||\ - (field) == V4L2_FIELD_INTERLACED ||\ - (field) == V4L2_FIELD_INTERLACED_TB ||\ - (field) == V4L2_FIELD_INTERLACED_BT ||\ - (field) == V4L2_FIELD_SEQ_TB ||\ - (field) == V4L2_FIELD_SEQ_BT) -#define V4L2_FIELD_HAS_BOTTOM(field) \ - ((field) == V4L2_FIELD_BOTTOM ||\ - (field) == V4L2_FIELD_INTERLACED ||\ - (field) == V4L2_FIELD_INTERLACED_TB ||\ - (field) == V4L2_FIELD_INTERLACED_BT ||\ - (field) == V4L2_FIELD_SEQ_TB ||\ - (field) == V4L2_FIELD_SEQ_BT) -#define V4L2_FIELD_HAS_BOTH(field) \ - ((field) == V4L2_FIELD_INTERLACED ||\ - (field) == V4L2_FIELD_INTERLACED_TB ||\ - (field) == V4L2_FIELD_INTERLACED_BT ||\ - (field) == V4L2_FIELD_SEQ_TB ||\ - (field) == V4L2_FIELD_SEQ_BT) - -enum v4l2_buf_type { - V4L2_BUF_TYPE_VIDEO_CAPTURE = 1, - V4L2_BUF_TYPE_VIDEO_OUTPUT = 2, - V4L2_BUF_TYPE_VIDEO_OVERLAY = 3, - V4L2_BUF_TYPE_VBI_CAPTURE = 4, - V4L2_BUF_TYPE_VBI_OUTPUT = 5, - V4L2_BUF_TYPE_SLICED_VBI_CAPTURE = 6, - V4L2_BUF_TYPE_SLICED_VBI_OUTPUT = 7, -#if 1 - /* Experimental */ - V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY = 8, -#endif - V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9, - V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, - V4L2_BUF_TYPE_PRIVATE = 0x80, -}; - -#define V4L2_TYPE_IS_MULTIPLANAR(type) \ - ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \ - || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) - -#define V4L2_TYPE_IS_OUTPUT(type) \ - ((type) == V4L2_BUF_TYPE_VIDEO_OUTPUT \ - || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE \ - || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \ - || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \ - || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \ - || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) - -enum v4l2_tuner_type { - V4L2_TUNER_RADIO = 1, - V4L2_TUNER_ANALOG_TV = 2, - V4L2_TUNER_DIGITAL_TV = 3, -}; - -enum v4l2_memory { - V4L2_MEMORY_MMAP = 1, - V4L2_MEMORY_USERPTR = 2, - V4L2_MEMORY_OVERLAY = 3, - V4L2_MEMORY_DMABUF = 4, -}; - -/* see also http://vektor.theorem.ca/graphics/ycbcr/ */ -enum v4l2_colorspace { - /* ITU-R 601 -- broadcast NTSC/PAL */ - V4L2_COLORSPACE_SMPTE170M = 1, - - /* 1125-Line (US) HDTV */ - V4L2_COLORSPACE_SMPTE240M = 2, - - /* HD and modern captures. */ - V4L2_COLORSPACE_REC709 = 3, - - /* broken BT878 extents (601, luma range 16-253 instead of 16-235) */ - V4L2_COLORSPACE_BT878 = 4, - - /* These should be useful. Assume 601 extents. */ - V4L2_COLORSPACE_470_SYSTEM_M = 5, - V4L2_COLORSPACE_470_SYSTEM_BG = 6, - - /* I know there will be cameras that send this. So, this is - * unspecified chromaticities and full 0-255 on each of the - * Y'CbCr components - */ - V4L2_COLORSPACE_JPEG = 7, - - /* For RGB colourspaces, this is probably a good start. */ - V4L2_COLORSPACE_SRGB = 8, -}; - -enum v4l2_priority { - V4L2_PRIORITY_UNSET = 0, /* not initialized */ - V4L2_PRIORITY_BACKGROUND = 1, - V4L2_PRIORITY_INTERACTIVE = 2, - V4L2_PRIORITY_RECORD = 3, - V4L2_PRIORITY_DEFAULT = V4L2_PRIORITY_INTERACTIVE, -}; - -struct v4l2_rect { - __s32 left; - __s32 top; - __s32 width; - __s32 height; -}; - -struct v4l2_fract { - __u32 numerator; - __u32 denominator; -}; - -/* - * D R I V E R C A P A B I L I T I E S - */ -struct v4l2_capability { - __u8 driver[16]; /* i.e. "bttv" */ - __u8 card[32]; /* i.e. "Hauppauge WinTV" */ - __u8 bus_info[32]; /* "PCI:" + pci_name(pci_dev) */ - __u32 version; /* should use KERNEL_VERSION() */ - __u32 capabilities; /* Device capabilities */ - __u32 reserved[4]; -}; - -/* Values for 'capabilities' field */ -#define V4L2_CAP_VIDEO_CAPTURE 0x00000001 /* Is a video capture device */ -#define V4L2_CAP_VIDEO_OUTPUT 0x00000002 /* Is a video output device */ -#define V4L2_CAP_VIDEO_OVERLAY 0x00000004 /* Can do video overlay */ -#define V4L2_CAP_VBI_CAPTURE 0x00000010 /* Is a raw VBI capture device */ -#define V4L2_CAP_VBI_OUTPUT 0x00000020 /* Is a raw VBI output device */ -#define V4L2_CAP_SLICED_VBI_CAPTURE 0x00000040 /* Is a sliced VBI capture device */ -#define V4L2_CAP_SLICED_VBI_OUTPUT 0x00000080 /* Is a sliced VBI output device */ -#define V4L2_CAP_RDS_CAPTURE 0x00000100 /* RDS data capture */ -#define V4L2_CAP_VIDEO_OUTPUT_OVERLAY 0x00000200 /* Can do video output overlay */ -#define V4L2_CAP_HW_FREQ_SEEK 0x00000400 /* Can do hardware frequency seek */ -#define V4L2_CAP_RDS_OUTPUT 0x00000800 /* Is an RDS encoder */ - -/* Is a video capture device that supports multiplanar formats */ -#define V4L2_CAP_VIDEO_CAPTURE_MPLANE 0x00001000 -/* Is a video output device that supports multiplanar formats */ -#define V4L2_CAP_VIDEO_OUTPUT_MPLANE 0x00002000 - -#define V4L2_CAP_TUNER 0x00010000 /* has a tuner */ -#define V4L2_CAP_AUDIO 0x00020000 /* has audio support */ -#define V4L2_CAP_RADIO 0x00040000 /* is a radio device */ -#define V4L2_CAP_MODULATOR 0x00080000 /* has a modulator */ - -#define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ -#define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ -#define V4L2_CAP_STREAMING 0x04000000 /* streaming I/O ioctls */ - -/* - * V I D E O I M A G E F O R M A T - */ -struct v4l2_pix_format { - __u32 width; - __u32 height; - __u32 pixelformat; - enum v4l2_field field; - __u32 bytesperline; /* for padding, zero if unused */ - __u32 sizeimage; - enum v4l2_colorspace colorspace; - __u32 priv; /* private data, depends on pixelformat */ -}; - -/* Pixel format FOURCC depth Description */ - -/* RGB formats */ -#define V4L2_PIX_FMT_RGB332 v4l2_fourcc('R', 'G', 'B', '1') /* 8 RGB-3-3-2 */ -#define V4L2_PIX_FMT_RGB444 v4l2_fourcc('R', '4', '4', '4') /* 16 xxxxrrrr ggggbbbb */ -#define V4L2_PIX_FMT_RGB555 v4l2_fourcc('R', 'G', 'B', 'O') /* 16 RGB-5-5-5 */ -#define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ -#define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ -#define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ -#define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */ -#define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ -#define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ -#define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ -#define V4L2_PIX_FMT_RGB32 v4l2_fourcc('R', 'G', 'B', '4') /* 32 RGB-8-8-8-8 */ - -/* Grey formats */ -#define V4L2_PIX_FMT_GREY v4l2_fourcc('G', 'R', 'E', 'Y') /* 8 Greyscale */ -#define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ -#define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ -#define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ -#define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 Greyscale */ -#define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ - -/* Grey bit-packed formats */ -#define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */ - -/* Palette formats */ -#define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8') /* 8 8-bit palette */ - -/* Luminance+Chrominance formats */ -#define V4L2_PIX_FMT_YVU410 v4l2_fourcc('Y', 'V', 'U', '9') /* 9 YVU 4:1:0 */ -#define V4L2_PIX_FMT_YVU420 v4l2_fourcc('Y', 'V', '1', '2') /* 12 YVU 4:2:0 */ -#define V4L2_PIX_FMT_YUYV v4l2_fourcc('Y', 'U', 'Y', 'V') /* 16 YUV 4:2:2 */ -#define V4L2_PIX_FMT_YYUV v4l2_fourcc('Y', 'Y', 'U', 'V') /* 16 YUV 4:2:2 */ -#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') /* 16 YVU 4:2:2 */ -#define V4L2_PIX_FMT_UYVY v4l2_fourcc('U', 'Y', 'V', 'Y') /* 16 YUV 4:2:2 */ -#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') /* 16 YUV 4:2:2 */ -#define V4L2_PIX_FMT_YUV422P v4l2_fourcc('4', '2', '2', 'P') /* 16 YVU422 planar */ -#define V4L2_PIX_FMT_YUV411P v4l2_fourcc('4', '1', '1', 'P') /* 16 YVU411 planar */ -#define V4L2_PIX_FMT_Y41P v4l2_fourcc('Y', '4', '1', 'P') /* 12 YUV 4:1:1 */ -#define V4L2_PIX_FMT_YUV444 v4l2_fourcc('Y', '4', '4', '4') /* 16 xxxxyyyy uuuuvvvv */ -#define V4L2_PIX_FMT_YUV555 v4l2_fourcc('Y', 'U', 'V', 'O') /* 16 YUV-5-5-5 */ -#define V4L2_PIX_FMT_YUV565 v4l2_fourcc('Y', 'U', 'V', 'P') /* 16 YUV-5-6-5 */ -#define V4L2_PIX_FMT_YUV32 v4l2_fourcc('Y', 'U', 'V', '4') /* 32 YUV-8-8-8-8 */ -#define V4L2_PIX_FMT_YUV410 v4l2_fourcc('Y', 'U', 'V', '9') /* 9 YUV 4:1:0 */ -#define V4L2_PIX_FMT_YUV420 v4l2_fourcc('Y', 'U', '1', '2') /* 12 YUV 4:2:0 */ -#define V4L2_PIX_FMT_HI240 v4l2_fourcc('H', 'I', '2', '4') /* 8 8-bit color */ -#define V4L2_PIX_FMT_HM12 v4l2_fourcc('H', 'M', '1', '2') /* 8 YUV 4:2:0 16x16 macroblocks */ -#define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ - -/* two planes -- one Y, one Cr + Cb interleaved */ -#define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ -#define V4L2_PIX_FMT_NV21 v4l2_fourcc('N', 'V', '2', '1') /* 12 Y/CrCb 4:2:0 */ -#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') /* 16 Y/CbCr 4:2:2 */ -#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') /* 16 Y/CrCb 4:2:2 */ -#define V4L2_PIX_FMT_NV24 v4l2_fourcc('N', 'V', '2', '4') /* 24 Y/CbCr 4:4:4 */ -#define V4L2_PIX_FMT_NV42 v4l2_fourcc('N', 'V', '4', '2') /* 24 Y/CrCb 4:4:4 */ - -/* two non contiguous planes - one Y, one Cr + Cb interleaved */ -#define V4L2_PIX_FMT_NV12M v4l2_fourcc('N', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 */ -#define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ - -/* three non contiguous planes - Y, Cb, Cr */ -#define V4L2_PIX_FMT_YUV420M v4l2_fourcc('Y', 'M', '1', '2') /* 12 YUV420 planar */ - -/* Bayer formats - see http://www.siliconimaging.com/RGB%20Bayer.htm */ -#define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ -#define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ -#define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ -#define V4L2_PIX_FMT_SRGGB8 v4l2_fourcc('R', 'G', 'G', 'B') /* 8 RGRG.. GBGB.. */ -#define V4L2_PIX_FMT_SBGGR10 v4l2_fourcc('B', 'G', '1', '0') /* 10 BGBG.. GRGR.. */ -#define V4L2_PIX_FMT_SGBRG10 v4l2_fourcc('G', 'B', '1', '0') /* 10 GBGB.. RGRG.. */ -#define V4L2_PIX_FMT_SGRBG10 v4l2_fourcc('B', 'A', '1', '0') /* 10 GRGR.. BGBG.. */ -#define V4L2_PIX_FMT_SRGGB10 v4l2_fourcc('R', 'G', '1', '0') /* 10 RGRG.. GBGB.. */ -#define V4L2_PIX_FMT_SBGGR12 v4l2_fourcc('B', 'G', '1', '2') /* 12 BGBG.. GRGR.. */ -#define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12 GBGB.. RGRG.. */ -#define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12 GRGR.. BGBG.. */ -#define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12 RGRG.. GBGB.. */ - /* 10bit raw bayer DPCM compressed to 8 bits */ -#define V4L2_PIX_FMT_SGRBG10DPCM8 v4l2_fourcc('B', 'D', '1', '0') - /* - * 10bit raw bayer, expanded to 16 bits - * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... - */ -#define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16 BGBG.. GRGR.. */ - -/* compressed formats */ -#define V4L2_PIX_FMT_MJPEG v4l2_fourcc('M', 'J', 'P', 'G') /* Motion-JPEG */ -#define V4L2_PIX_FMT_JPEG v4l2_fourcc('J', 'P', 'E', 'G') /* JFIF JPEG */ -#define V4L2_PIX_FMT_DV v4l2_fourcc('d', 'v', 's', 'd') /* 1394 */ -#define V4L2_PIX_FMT_MPEG v4l2_fourcc('M', 'P', 'E', 'G') /* MPEG-1/2/4 Multiplexed */ -#define V4L2_PIX_FMT_H264 v4l2_fourcc('H', '2', '6', '4') /* H264 with start codes */ -#define V4L2_PIX_FMT_H264_NO_SC v4l2_fourcc('A', 'V', 'C', '1') /* H264 without start codes */ -#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */ -#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */ -#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */ -#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 ES */ -#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */ -#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */ -#define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */ - -/* Vendor-specific formats */ -#define V4L2_PIX_FMT_CPIA1 v4l2_fourcc('C', 'P', 'I', 'A') /* cpia1 YUV */ -#define V4L2_PIX_FMT_WNVA v4l2_fourcc('W', 'N', 'V', 'A') /* Winnov hw compress */ -#define V4L2_PIX_FMT_SN9C10X v4l2_fourcc('S', '9', '1', '0') /* SN9C10x compression */ -#define V4L2_PIX_FMT_SN9C20X_I420 v4l2_fourcc('S', '9', '2', '0') /* SN9C20x YUV 4:2:0 */ -#define V4L2_PIX_FMT_PWC1 v4l2_fourcc('P', 'W', 'C', '1') /* pwc older webcam */ -#define V4L2_PIX_FMT_PWC2 v4l2_fourcc('P', 'W', 'C', '2') /* pwc newer webcam */ -#define V4L2_PIX_FMT_ET61X251 v4l2_fourcc('E', '6', '2', '5') /* ET61X251 compression */ -#define V4L2_PIX_FMT_SPCA501 v4l2_fourcc('S', '5', '0', '1') /* YUYV per line */ -#define V4L2_PIX_FMT_SPCA505 v4l2_fourcc('S', '5', '0', '5') /* YYUV per line */ -#define V4L2_PIX_FMT_SPCA508 v4l2_fourcc('S', '5', '0', '8') /* YUVY per line */ -#define V4L2_PIX_FMT_SPCA561 v4l2_fourcc('S', '5', '6', '1') /* compressed GBRG bayer */ -#define V4L2_PIX_FMT_PAC207 v4l2_fourcc('P', '2', '0', '7') /* compressed BGGR bayer */ -#define V4L2_PIX_FMT_MR97310A v4l2_fourcc('M', '3', '1', '0') /* compressed BGGR bayer */ -#define V4L2_PIX_FMT_JL2005BCD v4l2_fourcc('J', 'L', '2', '0') /* compressed RGGB bayer */ -#define V4L2_PIX_FMT_SN9C2028 v4l2_fourcc('S', 'O', 'N', 'X') /* compressed GBRG bayer */ -#define V4L2_PIX_FMT_SQ905C v4l2_fourcc('9', '0', '5', 'C') /* compressed RGGB bayer */ -#define V4L2_PIX_FMT_PJPG v4l2_fourcc('P', 'J', 'P', 'G') /* Pixart 73xx JPEG */ -#define V4L2_PIX_FMT_OV511 v4l2_fourcc('O', '5', '1', '1') /* ov511 JPEG */ -#define V4L2_PIX_FMT_OV518 v4l2_fourcc('O', '5', '1', '8') /* ov518 JPEG */ -#define V4L2_PIX_FMT_STV0680 v4l2_fourcc('S', '6', '8', '0') /* stv0680 bayer */ -#define V4L2_PIX_FMT_TM6000 v4l2_fourcc('T', 'M', '6', '0') /* tm5600/tm60x0 */ -#define V4L2_PIX_FMT_CIT_YYVYUY v4l2_fourcc('C', 'I', 'T', 'V') /* one line of Y then 1 line of VYUY */ -#define V4L2_PIX_FMT_KONICA420 v4l2_fourcc('K', 'O', 'N', 'I') /* YUV420 planar in blocks of 256 pixels */ -#define V4L2_PIX_FMT_JPGL v4l2_fourcc('J', 'P', 'G', 'L') /* JPEG-Lite */ -/* RGB x:10:10:10 */ -#define V4L2_PIX_FMT_INTC_RGB30 v4l2_fourcc('R', 'G', 'B', '0') -#define V4L2_PIX_FMT_SE401 v4l2_fourcc('S', '4', '0', '1') /* se401 janggu compressed rgb */ - -/* - * F O R M A T E N U M E R A T I O N - */ -struct v4l2_fmtdesc { - __u32 index; /* Format number */ - enum v4l2_buf_type type; /* buffer type */ - __u32 flags; - __u8 description[32]; /* Description string */ - __u32 pixelformat; /* Format fourcc */ - __u32 reserved[4]; -}; - -#define V4L2_FMT_FLAG_COMPRESSED 0x0001 -#define V4L2_FMT_FLAG_EMULATED 0x0002 - -#if 1 - /* Experimental Frame Size and frame rate enumeration */ -/* - * F R A M E S I Z E E N U M E R A T I O N - */ -enum v4l2_frmsizetypes { - V4L2_FRMSIZE_TYPE_DISCRETE = 1, - V4L2_FRMSIZE_TYPE_CONTINUOUS = 2, - V4L2_FRMSIZE_TYPE_STEPWISE = 3, -}; - -struct v4l2_frmsize_discrete { - __u32 width; /* Frame width [pixel] */ - __u32 height; /* Frame height [pixel] */ -}; - -struct v4l2_frmsize_stepwise { - __u32 min_width; /* Minimum frame width [pixel] */ - __u32 max_width; /* Maximum frame width [pixel] */ - __u32 step_width; /* Frame width step size [pixel] */ - __u32 min_height; /* Minimum frame height [pixel] */ - __u32 max_height; /* Maximum frame height [pixel] */ - __u32 step_height; /* Frame height step size [pixel] */ -}; - -struct v4l2_frmsizeenum { - __u32 index; /* Frame size number */ - __u32 pixel_format; /* Pixel format */ - __u32 type; /* Frame size type the device supports. */ - - union { /* Frame size */ - struct v4l2_frmsize_discrete discrete; - struct v4l2_frmsize_stepwise stepwise; - }; - - __u32 reserved[2]; /* Reserved space for future use */ -}; - -/* - * F R A M E R A T E E N U M E R A T I O N - */ -enum v4l2_frmivaltypes { - V4L2_FRMIVAL_TYPE_DISCRETE = 1, - V4L2_FRMIVAL_TYPE_CONTINUOUS = 2, - V4L2_FRMIVAL_TYPE_STEPWISE = 3, -}; - -struct v4l2_frmival_stepwise { - struct v4l2_fract min; /* Minimum frame interval [s] */ - struct v4l2_fract max; /* Maximum frame interval [s] */ - struct v4l2_fract step; /* Frame interval step size [s] */ -}; - -struct v4l2_frmivalenum { - __u32 index; /* Frame format index */ - __u32 pixel_format; /* Pixel format */ - __u32 width; /* Frame width */ - __u32 height; /* Frame height */ - __u32 type; /* Frame interval type the device supports. */ - - union { /* Frame interval */ - struct v4l2_fract discrete; - struct v4l2_frmival_stepwise stepwise; - }; - - __u32 reserved[2]; /* Reserved space for future use */ -}; -#endif - -/* - * T I M E C O D E - */ -struct v4l2_timecode { - __u32 type; - __u32 flags; - __u8 frames; - __u8 seconds; - __u8 minutes; - __u8 hours; - __u8 userbits[4]; -}; - -/* Type */ -#define V4L2_TC_TYPE_24FPS 1 -#define V4L2_TC_TYPE_25FPS 2 -#define V4L2_TC_TYPE_30FPS 3 -#define V4L2_TC_TYPE_50FPS 4 -#define V4L2_TC_TYPE_60FPS 5 - -/* Flags */ -#define V4L2_TC_FLAG_DROPFRAME 0x0001 /* "drop-frame" mode */ -#define V4L2_TC_FLAG_COLORFRAME 0x0002 -#define V4L2_TC_USERBITS_field 0x000C -#define V4L2_TC_USERBITS_USERDEFINED 0x0000 -#define V4L2_TC_USERBITS_8BITCHARS 0x0008 -/* The above is based on SMPTE timecodes */ - -struct v4l2_jpegcompression { - int quality; - - int APPn; /* Number of APP segment to be written, - * must be 0..15 */ - int APP_len; /* Length of data in JPEG APPn segment */ - char APP_data[60]; /* Data in the JPEG APPn segment. */ - - int COM_len; /* Length of data in JPEG COM segment */ - char COM_data[60]; /* Data in JPEG COM segment */ - - __u32 jpeg_markers; /* Which markers should go into the JPEG - * output. Unless you exactly know what - * you do, leave them untouched. - * Inluding less markers will make the - * resulting code smaller, but there will - * be fewer applications which can read it. - * The presence of the APP and COM marker - * is influenced by APP_len and COM_len - * ONLY, not by this property! */ - -#define V4L2_JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ -#define V4L2_JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ -#define V4L2_JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ -#define V4L2_JPEG_MARKER_COM (1<<6) /* Comment segment */ -#define V4L2_JPEG_MARKER_APP (1<<7) /* App segment, driver will - * allways use APP0 */ -}; - -/* - * M E M O R Y - M A P P I N G B U F F E R S - */ -struct v4l2_requestbuffers { - __u32 count; - enum v4l2_buf_type type; - enum v4l2_memory memory; - __u32 reserved[2]; -}; - -/** - * struct v4l2_plane - plane info for multi-planar buffers - * @bytesused: number of bytes occupied by data in the plane (payload) - * @length: size of this plane (NOT the payload) in bytes - * @mem_offset: when memory in the associated struct v4l2_buffer is - * V4L2_MEMORY_MMAP, equals the offset from the start of - * the device memory for this plane (or is a "cookie" that - * should be passed to mmap() called on the video node) - * @userptr: when memory is V4L2_MEMORY_USERPTR, a userspace pointer - * pointing to this plane - * @fd: when memory is V4L2_MEMORY_DMABUF, a userspace file - * descriptor associated with this plane - * @data_offset: offset in the plane to the start of data; usually 0, - * unless there is a header in front of the data - * - * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer - * with two planes can have one plane for Y, and another for interleaved CbCr - * components. Each plane can reside in a separate memory buffer, or even in - * a completely separate memory node (e.g. in embedded devices). - */ -struct v4l2_plane { - __u32 bytesused; - __u32 length; - union { - __u32 mem_offset; - unsigned long userptr; - int fd; - } m; - __u32 data_offset; - __u32 reserved[11]; -}; - -/** - * struct v4l2_buffer - video buffer info - * @index: id number of the buffer - * @type: buffer type (type == *_MPLANE for multiplanar buffers) - * @bytesused: number of bytes occupied by data in the buffer (payload); - * unused (set to 0) for multiplanar buffers - * @flags: buffer informational flags - * @field: field order of the image in the buffer - * @timestamp: frame timestamp - * @timecode: frame timecode - * @sequence: sequence count of this frame - * @memory: the method, in which the actual video data is passed - * @offset: for non-multiplanar buffers with memory == V4L2_MEMORY_MMAP; - * offset from the start of the device memory for this plane, - * (or a "cookie" that should be passed to mmap() as offset) - * @userptr: for non-multiplanar buffers with memory == V4L2_MEMORY_USERPTR; - * a userspace pointer pointing to this buffer - * @fd: for non-multiplanar buffers with - * memory == V4L2_MEMORY_DMABUF; a userspace file descriptor - * associated with this buffer - * @planes: for multiplanar buffers; userspace pointer to the array of plane - * info structs for this buffer - * @length: size in bytes of the buffer (NOT its payload) for single-plane - * buffers (when type != *_MPLANE); number of elements in the - * planes array for multi-plane buffers - * @input: input number from which the video data has has been captured - * - * Contains data exchanged by application and driver using one of the Streaming - * I/O methods. - */ -struct v4l2_buffer { - __u32 index; - enum v4l2_buf_type type; - __u32 bytesused; - __u32 flags; - enum v4l2_field field; - struct timeval timestamp; - struct v4l2_timecode timecode; - __u32 sequence; - - /* memory location */ - enum v4l2_memory memory; - union { - __u32 offset; - unsigned long userptr; - struct v4l2_plane *planes; - int fd; - } m; - __u32 length; - __u32 input; - __u32 reserved; -}; - -/* Flags for 'flags' field */ -#define V4L2_BUF_FLAG_MAPPED 0x0001 /* Buffer is mapped (flag) */ -#define V4L2_BUF_FLAG_QUEUED 0x0002 /* Buffer is queued for processing */ -#define V4L2_BUF_FLAG_DONE 0x0004 /* Buffer is ready */ -#define V4L2_BUF_FLAG_KEYFRAME 0x0008 /* Image is a keyframe (I-frame) */ -#define V4L2_BUF_FLAG_PFRAME 0x0010 /* Image is a P-frame */ -#define V4L2_BUF_FLAG_BFRAME 0x0020 /* Image is a B-frame */ -/* Buffer is ready, but the data contained within is corrupted. */ -#define V4L2_BUF_FLAG_ERROR 0x0040 -#define V4L2_BUF_FLAG_TIMECODE 0x0100 /* timecode field is valid */ -#define V4L2_BUF_FLAG_INPUT 0x0200 /* input field is valid */ -#define V4L2_BUF_FLAG_PREPARED 0x0400 /* Buffer is prepared for queuing */ -/* Cache handling flags */ -#define V4L2_BUF_FLAG_NO_CACHE_INVALIDATE 0x0800 -#define V4L2_BUF_FLAG_NO_CACHE_CLEAN 0x1000 - -/* - * O V E R L A Y P R E V I E W - */ -struct v4l2_framebuffer { - __u32 capability; - __u32 flags; -/* FIXME: in theory we should pass something like PCI device + memory - * region + offset instead of some physical address */ - void *base; - struct v4l2_pix_format fmt; -}; -/* Flags for the 'capability' field. Read only */ -#define V4L2_FBUF_CAP_EXTERNOVERLAY 0x0001 -#define V4L2_FBUF_CAP_CHROMAKEY 0x0002 -#define V4L2_FBUF_CAP_LIST_CLIPPING 0x0004 -#define V4L2_FBUF_CAP_BITMAP_CLIPPING 0x0008 -#define V4L2_FBUF_CAP_LOCAL_ALPHA 0x0010 -#define V4L2_FBUF_CAP_GLOBAL_ALPHA 0x0020 -#define V4L2_FBUF_CAP_LOCAL_INV_ALPHA 0x0040 -#define V4L2_FBUF_CAP_SRC_CHROMAKEY 0x0080 -/* Flags for the 'flags' field. */ -#define V4L2_FBUF_FLAG_PRIMARY 0x0001 -#define V4L2_FBUF_FLAG_OVERLAY 0x0002 -#define V4L2_FBUF_FLAG_CHROMAKEY 0x0004 -#define V4L2_FBUF_FLAG_LOCAL_ALPHA 0x0008 -#define V4L2_FBUF_FLAG_GLOBAL_ALPHA 0x0010 -#define V4L2_FBUF_FLAG_LOCAL_INV_ALPHA 0x0020 -#define V4L2_FBUF_FLAG_SRC_CHROMAKEY 0x0040 - -struct v4l2_clip { - struct v4l2_rect c; - struct v4l2_clip __user *next; -}; - -struct v4l2_window { - struct v4l2_rect w; - enum v4l2_field field; - __u32 chromakey; - struct v4l2_clip __user *clips; - __u32 clipcount; - void __user *bitmap; - __u8 global_alpha; -}; - -/* - * C A P T U R E P A R A M E T E R S - */ -struct v4l2_captureparm { - __u32 capability; /* Supported modes */ - __u32 capturemode; /* Current mode */ - struct v4l2_fract timeperframe; /* Time per frame in .1us units */ - __u32 extendedmode; /* Driver-specific extensions */ - __u32 readbuffers; /* # of buffers for read */ - __u32 reserved[4]; -}; - -/* Flags for 'capability' and 'capturemode' fields */ -#define V4L2_MODE_HIGHQUALITY 0x0001 /* High quality imaging mode */ -#define V4L2_CAP_TIMEPERFRAME 0x1000 /* timeperframe field is supported */ - -struct v4l2_outputparm { - __u32 capability; /* Supported modes */ - __u32 outputmode; /* Current mode */ - struct v4l2_fract timeperframe; /* Time per frame in seconds */ - __u32 extendedmode; /* Driver-specific extensions */ - __u32 writebuffers; /* # of buffers for write */ - __u32 reserved[4]; -}; - -/* - * I N P U T I M A G E C R O P P I N G - */ -struct v4l2_cropcap { - enum v4l2_buf_type type; - struct v4l2_rect bounds; - struct v4l2_rect defrect; - struct v4l2_fract pixelaspect; -}; - -struct v4l2_crop { - enum v4l2_buf_type type; - struct v4l2_rect c; -}; - -/* Hints for adjustments of selection rectangle */ -#define V4L2_SEL_FLAG_GE 0x00000001 -#define V4L2_SEL_FLAG_LE 0x00000002 - -/* Selection targets */ - -/* current cropping area */ -#define V4L2_SEL_TGT_CROP_ACTIVE 0 -/* default cropping area */ -#define V4L2_SEL_TGT_CROP_DEFAULT 1 -/* cropping bounds */ -#define V4L2_SEL_TGT_CROP_BOUNDS 2 -/* current composing area */ -#define V4L2_SEL_TGT_COMPOSE_ACTIVE 256 -/* default composing area */ -#define V4L2_SEL_TGT_COMPOSE_DEFAULT 257 -/* composing bounds */ -#define V4L2_SEL_TGT_COMPOSE_BOUNDS 258 -/* current composing area plus all padding pixels */ -#define V4L2_SEL_TGT_COMPOSE_PADDED 259 - -/** - * struct v4l2_selection - selection info - * @type: buffer type (do not use *_MPLANE types) - * @target: selection target, used to choose one of possible rectangles - * @flags: constraints flags - * @r: coordinates of selection window - * @reserved: for future use, rounds structure size to 64 bytes, set to zero - * - * Hardware may use multiple helper window to process a video stream. - * The structure is used to exchange this selection areas between - * an application and a driver. - */ -struct v4l2_selection { - __u32 type; - __u32 target; - __u32 flags; - struct v4l2_rect r; - __u32 reserved[9]; -}; - - -/* - * A N A L O G V I D E O S T A N D A R D - */ - -typedef __u64 v4l2_std_id; - -/* one bit for each */ -#define V4L2_STD_PAL_B ((v4l2_std_id)0x00000001) -#define V4L2_STD_PAL_B1 ((v4l2_std_id)0x00000002) -#define V4L2_STD_PAL_G ((v4l2_std_id)0x00000004) -#define V4L2_STD_PAL_H ((v4l2_std_id)0x00000008) -#define V4L2_STD_PAL_I ((v4l2_std_id)0x00000010) -#define V4L2_STD_PAL_D ((v4l2_std_id)0x00000020) -#define V4L2_STD_PAL_D1 ((v4l2_std_id)0x00000040) -#define V4L2_STD_PAL_K ((v4l2_std_id)0x00000080) - -#define V4L2_STD_PAL_M ((v4l2_std_id)0x00000100) -#define V4L2_STD_PAL_N ((v4l2_std_id)0x00000200) -#define V4L2_STD_PAL_Nc ((v4l2_std_id)0x00000400) -#define V4L2_STD_PAL_60 ((v4l2_std_id)0x00000800) - -#define V4L2_STD_NTSC_M ((v4l2_std_id)0x00001000) /* BTSC */ -#define V4L2_STD_NTSC_M_JP ((v4l2_std_id)0x00002000) /* EIA-J */ -#define V4L2_STD_NTSC_443 ((v4l2_std_id)0x00004000) -#define V4L2_STD_NTSC_M_KR ((v4l2_std_id)0x00008000) /* FM A2 */ - -#define V4L2_STD_SECAM_B ((v4l2_std_id)0x00010000) -#define V4L2_STD_SECAM_D ((v4l2_std_id)0x00020000) -#define V4L2_STD_SECAM_G ((v4l2_std_id)0x00040000) -#define V4L2_STD_SECAM_H ((v4l2_std_id)0x00080000) -#define V4L2_STD_SECAM_K ((v4l2_std_id)0x00100000) -#define V4L2_STD_SECAM_K1 ((v4l2_std_id)0x00200000) -#define V4L2_STD_SECAM_L ((v4l2_std_id)0x00400000) -#define V4L2_STD_SECAM_LC ((v4l2_std_id)0x00800000) - -/* ATSC/HDTV */ -#define V4L2_STD_ATSC_8_VSB ((v4l2_std_id)0x01000000) -#define V4L2_STD_ATSC_16_VSB ((v4l2_std_id)0x02000000) - -/* FIXME: - Although std_id is 64 bits, there is an issue on PPC32 architecture that - makes switch(__u64) to break. So, there's a hack on v4l2-common.c rounding - this value to 32 bits. - As, currently, the max value is for V4L2_STD_ATSC_16_VSB (30 bits wide), - it should work fine. However, if needed to add more than two standards, - v4l2-common.c should be fixed. - */ - -/* - * Some macros to merge video standards in order to make live easier for the - * drivers and V4L2 applications - */ - -/* - * "Common" NTSC/M - It should be noticed that V4L2_STD_NTSC_443 is - * Missing here. - */ -#define V4L2_STD_NTSC (V4L2_STD_NTSC_M |\ - V4L2_STD_NTSC_M_JP |\ - V4L2_STD_NTSC_M_KR) -/* Secam macros */ -#define V4L2_STD_SECAM_DK (V4L2_STD_SECAM_D |\ - V4L2_STD_SECAM_K |\ - V4L2_STD_SECAM_K1) -/* All Secam Standards */ -#define V4L2_STD_SECAM (V4L2_STD_SECAM_B |\ - V4L2_STD_SECAM_G |\ - V4L2_STD_SECAM_H |\ - V4L2_STD_SECAM_DK |\ - V4L2_STD_SECAM_L |\ - V4L2_STD_SECAM_LC) -/* PAL macros */ -#define V4L2_STD_PAL_BG (V4L2_STD_PAL_B |\ - V4L2_STD_PAL_B1 |\ - V4L2_STD_PAL_G) -#define V4L2_STD_PAL_DK (V4L2_STD_PAL_D |\ - V4L2_STD_PAL_D1 |\ - V4L2_STD_PAL_K) -/* - * "Common" PAL - This macro is there to be compatible with the old - * V4L1 concept of "PAL": /BGDKHI. - * Several PAL standards are mising here: /M, /N and /Nc - */ -#define V4L2_STD_PAL (V4L2_STD_PAL_BG |\ - V4L2_STD_PAL_DK |\ - V4L2_STD_PAL_H |\ - V4L2_STD_PAL_I) -/* Chroma "agnostic" standards */ -#define V4L2_STD_B (V4L2_STD_PAL_B |\ - V4L2_STD_PAL_B1 |\ - V4L2_STD_SECAM_B) -#define V4L2_STD_G (V4L2_STD_PAL_G |\ - V4L2_STD_SECAM_G) -#define V4L2_STD_H (V4L2_STD_PAL_H |\ - V4L2_STD_SECAM_H) -#define V4L2_STD_L (V4L2_STD_SECAM_L |\ - V4L2_STD_SECAM_LC) -#define V4L2_STD_GH (V4L2_STD_G |\ - V4L2_STD_H) -#define V4L2_STD_DK (V4L2_STD_PAL_DK |\ - V4L2_STD_SECAM_DK) -#define V4L2_STD_BG (V4L2_STD_B |\ - V4L2_STD_G) -#define V4L2_STD_MN (V4L2_STD_PAL_M |\ - V4L2_STD_PAL_N |\ - V4L2_STD_PAL_Nc |\ - V4L2_STD_NTSC) - -/* Standards where MTS/BTSC stereo could be found */ -#define V4L2_STD_MTS (V4L2_STD_NTSC_M |\ - V4L2_STD_PAL_M |\ - V4L2_STD_PAL_N |\ - V4L2_STD_PAL_Nc) - -/* Standards for Countries with 60Hz Line frequency */ -#define V4L2_STD_525_60 (V4L2_STD_PAL_M |\ - V4L2_STD_PAL_60 |\ - V4L2_STD_NTSC |\ - V4L2_STD_NTSC_443) -/* Standards for Countries with 50Hz Line frequency */ -#define V4L2_STD_625_50 (V4L2_STD_PAL |\ - V4L2_STD_PAL_N |\ - V4L2_STD_PAL_Nc |\ - V4L2_STD_SECAM) - -#define V4L2_STD_ATSC (V4L2_STD_ATSC_8_VSB |\ - V4L2_STD_ATSC_16_VSB) -/* Macros with none and all analog standards */ -#define V4L2_STD_UNKNOWN 0 -#define V4L2_STD_ALL (V4L2_STD_525_60 |\ - V4L2_STD_625_50) - -struct v4l2_standard { - __u32 index; - v4l2_std_id id; - __u8 name[24]; - struct v4l2_fract frameperiod; /* Frames, not fields */ - __u32 framelines; - __u32 reserved[4]; -}; - -/* - * V I D E O T I M I N G S D V P R E S E T - */ -struct v4l2_dv_preset { - __u32 preset; - __u32 reserved[4]; -}; - -/* - * D V P R E S E T S E N U M E R A T I O N - */ -struct v4l2_dv_enum_preset { - __u32 index; - __u32 preset; - __u8 name[32]; /* Name of the preset timing */ - __u32 width; - __u32 height; - __u32 reserved[4]; -}; - -/* - * D V P R E S E T V A L U E S - */ -#define V4L2_DV_INVALID 0 -#define V4L2_DV_480P59_94 1 /* BT.1362 */ -#define V4L2_DV_576P50 2 /* BT.1362 */ -#define V4L2_DV_720P24 3 /* SMPTE 296M */ -#define V4L2_DV_720P25 4 /* SMPTE 296M */ -#define V4L2_DV_720P30 5 /* SMPTE 296M */ -#define V4L2_DV_720P50 6 /* SMPTE 296M */ -#define V4L2_DV_720P59_94 7 /* SMPTE 274M */ -#define V4L2_DV_720P60 8 /* SMPTE 274M/296M */ -#define V4L2_DV_1080I29_97 9 /* BT.1120/ SMPTE 274M */ -#define V4L2_DV_1080I30 10 /* BT.1120/ SMPTE 274M */ -#define V4L2_DV_1080I25 11 /* BT.1120 */ -#define V4L2_DV_1080I50 12 /* SMPTE 296M */ -#define V4L2_DV_1080I60 13 /* SMPTE 296M */ -#define V4L2_DV_1080P24 14 /* SMPTE 296M */ -#define V4L2_DV_1080P25 15 /* SMPTE 296M */ -#define V4L2_DV_1080P30 16 /* SMPTE 296M */ -#define V4L2_DV_1080P50 17 /* BT.1120 */ -#define V4L2_DV_1080P60 18 /* BT.1120 */ - -#define V4L2_DV_480P60 19 -#define V4L2_DV_1080I59_94 20 -#define V4L2_DV_1080P59_94 21 - -#define V4L2_DV_720P60_FP 22 -#define V4L2_DV_720P60_SB_HALF 23 -#define V4L2_DV_720P60_TB 24 -#define V4L2_DV_720P59_94_FP 25 -#define V4L2_DV_720P59_94_SB_HALF 26 -#define V4L2_DV_720P59_94_TB 27 -#define V4L2_DV_720P50_FP 28 -#define V4L2_DV_720P50_SB_HALF 29 -#define V4L2_DV_720P50_TB 30 -#define V4L2_DV_1080P24_FP 31 -#define V4L2_DV_1080P24_SB_HALF 32 -#define V4L2_DV_1080P24_TB 33 -#define V4L2_DV_1080P23_98_FP 34 -#define V4L2_DV_1080P23_98_SB_HALF 35 -#define V4L2_DV_1080P23_98_TB 36 -#define V4L2_DV_1080I60_SB_HALF 37 -#define V4L2_DV_1080I59_94_SB_HALF 38 -#define V4L2_DV_1080I50_SB_HALF 39 -#define V4L2_DV_1080P60_SB_HALF 40 -#define V4L2_DV_1080P60_TB 41 -#define V4L2_DV_1080P30_FP 42 -#define V4L2_DV_1080P30_SB_HALF 43 -#define V4L2_DV_1080P30_TB 44 - -/* - * D V B T T I M I N G S - */ - -/* BT.656/BT.1120 timing data */ -struct v4l2_bt_timings { - __u32 width; /* width in pixels */ - __u32 height; /* height in lines */ - __u32 interlaced; /* Interlaced or progressive */ - __u32 polarities; /* Positive or negative polarity */ - __u64 pixelclock; /* Pixel clock in HZ. Ex. 74.25MHz->74250000 */ - __u32 hfrontporch; /* Horizpontal front porch in pixels */ - __u32 hsync; /* Horizontal Sync length in pixels */ - __u32 hbackporch; /* Horizontal back porch in pixels */ - __u32 vfrontporch; /* Vertical front porch in pixels */ - __u32 vsync; /* Vertical Sync length in lines */ - __u32 vbackporch; /* Vertical back porch in lines */ - __u32 il_vfrontporch; /* Vertical front porch for bottom field of - * interlaced field formats - */ - __u32 il_vsync; /* Vertical sync length for bottom field of - * interlaced field formats - */ - __u32 il_vbackporch; /* Vertical back porch for bottom field of - * interlaced field formats - */ - __u32 reserved[16]; -} __attribute__ ((packed)); - -/* Interlaced or progressive format */ -#define V4L2_DV_PROGRESSIVE 0 -#define V4L2_DV_INTERLACED 1 - -/* Polarities. If bit is not set, it is assumed to be negative polarity */ -#define V4L2_DV_VSYNC_POS_POL 0x00000001 -#define V4L2_DV_HSYNC_POS_POL 0x00000002 - - -/* DV timings */ -struct v4l2_dv_timings { - __u32 type; - union { - struct v4l2_bt_timings bt; - __u32 reserved[32]; - }; -} __attribute__ ((packed)); - -/* Values for the type field */ -#define V4L2_DV_BT_656_1120 0 /* BT.656/1120 timing type */ - -/* - * V I D E O I N P U T S - */ -struct v4l2_input { - __u32 index; /* Which input */ - __u8 name[32]; /* Label */ - __u32 type; /* Type of input */ - __u32 audioset; /* Associated audios (bitfield) */ - __u32 tuner; /* Associated tuner */ - v4l2_std_id std; - __u32 status; - __u32 capabilities; - __u32 reserved[3]; -}; - -/* Values for the 'type' field */ -#define V4L2_INPUT_TYPE_TUNER 1 -#define V4L2_INPUT_TYPE_CAMERA 2 - -/* field 'status' - general */ -#define V4L2_IN_ST_NO_POWER 0x00000001 /* Attached device is off */ -#define V4L2_IN_ST_NO_SIGNAL 0x00000002 -#define V4L2_IN_ST_NO_COLOR 0x00000004 - -/* field 'status' - sensor orientation */ -/* If sensor is mounted upside down set both bits */ -#define V4L2_IN_ST_HFLIP 0x00000010 /* Frames are flipped horizontally */ -#define V4L2_IN_ST_VFLIP 0x00000020 /* Frames are flipped vertically */ - -/* field 'status' - analog */ -#define V4L2_IN_ST_NO_H_LOCK 0x00000100 /* No horizontal sync lock */ -#define V4L2_IN_ST_COLOR_KILL 0x00000200 /* Color killer is active */ - -/* field 'status' - digital */ -#define V4L2_IN_ST_NO_SYNC 0x00010000 /* No synchronization lock */ -#define V4L2_IN_ST_NO_EQU 0x00020000 /* No equalizer lock */ -#define V4L2_IN_ST_NO_CARRIER 0x00040000 /* Carrier recovery failed */ - -/* field 'status' - VCR and set-top box */ -#define V4L2_IN_ST_MACROVISION 0x01000000 /* Macrovision detected */ -#define V4L2_IN_ST_NO_ACCESS 0x02000000 /* Conditional access denied */ -#define V4L2_IN_ST_VTR 0x04000000 /* VTR time constant */ - -/* capabilities flags */ -#define V4L2_IN_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ -#define V4L2_IN_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ -#define V4L2_IN_CAP_STD 0x00000004 /* Supports S_STD */ - -/* - * V I D E O O U T P U T S - */ -struct v4l2_output { - __u32 index; /* Which output */ - __u8 name[32]; /* Label */ - __u32 type; /* Type of output */ - __u32 audioset; /* Associated audios (bitfield) */ - __u32 modulator; /* Associated modulator */ - v4l2_std_id std; - __u32 capabilities; - __u32 reserved[3]; -}; -/* Values for the 'type' field */ -#define V4L2_OUTPUT_TYPE_MODULATOR 1 -#define V4L2_OUTPUT_TYPE_ANALOG 2 -#define V4L2_OUTPUT_TYPE_ANALOGVGAOVERLAY 3 - -/* capabilities flags */ -#define V4L2_OUT_CAP_PRESETS 0x00000001 /* Supports S_DV_PRESET */ -#define V4L2_OUT_CAP_CUSTOM_TIMINGS 0x00000002 /* Supports S_DV_TIMINGS */ -#define V4L2_OUT_CAP_STD 0x00000004 /* Supports S_STD */ - -/* - * C O N T R O L S - */ -struct v4l2_control { - __u32 id; - __s32 value; -}; - -struct v4l2_ext_control { - __u32 id; - __u32 size; - __u32 reserved2[1]; - union { - __s32 value; - __s64 value64; - char *string; - }; -} __attribute__ ((packed)); - -struct v4l2_ext_controls { - __u32 ctrl_class; - __u32 count; - __u32 error_idx; - __u32 reserved[2]; - struct v4l2_ext_control *controls; -}; - -/* Values for ctrl_class field */ -#define V4L2_CTRL_CLASS_USER 0x00980000 /* Old-style 'user' controls */ -#define V4L2_CTRL_CLASS_MPEG 0x00990000 /* MPEG-compression controls */ -#define V4L2_CTRL_CLASS_CAMERA 0x009a0000 /* Camera class controls */ -#define V4L2_CTRL_CLASS_FM_TX 0x009b0000 /* FM Modulator control class */ -#define V4L2_CTRL_CLASS_FLASH 0x009c0000 /* Camera flash controls */ -#define V4L2_CTRL_CLASS_FM_RX 0x009d0000 /* FM Tuner control class */ - -#define V4L2_CTRL_ID_MASK (0x0fffffff) -#define V4L2_CTRL_ID2CLASS(id) ((id) & 0x0fff0000UL) -#define V4L2_CTRL_DRIVER_PRIV(id) (((id) & 0xffff) >= 0x1000) - -enum v4l2_ctrl_type { - V4L2_CTRL_TYPE_INTEGER = 1, - V4L2_CTRL_TYPE_BOOLEAN = 2, - V4L2_CTRL_TYPE_MENU = 3, - V4L2_CTRL_TYPE_BUTTON = 4, - V4L2_CTRL_TYPE_INTEGER64 = 5, - V4L2_CTRL_TYPE_CTRL_CLASS = 6, - V4L2_CTRL_TYPE_STRING = 7, - V4L2_CTRL_TYPE_BITMASK = 8, -}; - -/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ -struct v4l2_queryctrl { - __u32 id; - enum v4l2_ctrl_type type; - __u8 name[32]; /* Whatever */ - __s32 minimum; /* Note signedness */ - __s32 maximum; - __s32 step; - __s32 default_value; - __u32 flags; - __u32 reserved[2]; -}; - -/* Used in the VIDIOC_QUERYMENU ioctl for querying menu items */ -struct v4l2_querymenu { - __u32 id; - __u32 index; - __u8 name[32]; /* Whatever */ - __u32 reserved; -}; - -/* Control flags */ -#define V4L2_CTRL_FLAG_DISABLED 0x0001 -#define V4L2_CTRL_FLAG_GRABBED 0x0002 -#define V4L2_CTRL_FLAG_READ_ONLY 0x0004 -#define V4L2_CTRL_FLAG_UPDATE 0x0008 -#define V4L2_CTRL_FLAG_INACTIVE 0x0010 -#define V4L2_CTRL_FLAG_SLIDER 0x0020 -#define V4L2_CTRL_FLAG_WRITE_ONLY 0x0040 -#define V4L2_CTRL_FLAG_VOLATILE 0x0080 - -/* Query flag, to be ORed with the control ID */ -#define V4L2_CTRL_FLAG_NEXT_CTRL 0x80000000 - -/* User-class control IDs defined by V4L2 */ -#define V4L2_CID_MAX_CTRLS 1024 -#define V4L2_CID_BASE (V4L2_CTRL_CLASS_USER | 0x900) -#define V4L2_CID_USER_BASE V4L2_CID_BASE -/* IDs reserved for driver specific controls */ -#define V4L2_CID_PRIVATE_BASE 0x08000000 - -#define V4L2_CID_USER_CLASS (V4L2_CTRL_CLASS_USER | 1) -#define V4L2_CID_BRIGHTNESS (V4L2_CID_BASE+0) -#define V4L2_CID_CONTRAST (V4L2_CID_BASE+1) -#define V4L2_CID_SATURATION (V4L2_CID_BASE+2) -#define V4L2_CID_HUE (V4L2_CID_BASE+3) -#define V4L2_CID_AUDIO_VOLUME (V4L2_CID_BASE+5) -#define V4L2_CID_AUDIO_BALANCE (V4L2_CID_BASE+6) -#define V4L2_CID_AUDIO_BASS (V4L2_CID_BASE+7) -#define V4L2_CID_AUDIO_TREBLE (V4L2_CID_BASE+8) -#define V4L2_CID_AUDIO_MUTE (V4L2_CID_BASE+9) -#define V4L2_CID_AUDIO_LOUDNESS (V4L2_CID_BASE+10) -#define V4L2_CID_BLACK_LEVEL (V4L2_CID_BASE+11) /* Deprecated */ -#define V4L2_CID_AUTO_WHITE_BALANCE (V4L2_CID_BASE+12) -#define V4L2_CID_DO_WHITE_BALANCE (V4L2_CID_BASE+13) -#define V4L2_CID_RED_BALANCE (V4L2_CID_BASE+14) -#define V4L2_CID_BLUE_BALANCE (V4L2_CID_BASE+15) -#define V4L2_CID_GAMMA (V4L2_CID_BASE+16) -#define V4L2_CID_WHITENESS (V4L2_CID_GAMMA) /* Deprecated */ -#define V4L2_CID_EXPOSURE (V4L2_CID_BASE+17) -#define V4L2_CID_AUTOGAIN (V4L2_CID_BASE+18) -#define V4L2_CID_GAIN (V4L2_CID_BASE+19) -#define V4L2_CID_HFLIP (V4L2_CID_BASE+20) -#define V4L2_CID_VFLIP (V4L2_CID_BASE+21) - -/* Deprecated; use V4L2_CID_PAN_RESET and V4L2_CID_TILT_RESET */ -#define V4L2_CID_HCENTER (V4L2_CID_BASE+22) -#define V4L2_CID_VCENTER (V4L2_CID_BASE+23) - -#define V4L2_CID_POWER_LINE_FREQUENCY (V4L2_CID_BASE+24) -enum v4l2_power_line_frequency { - V4L2_CID_POWER_LINE_FREQUENCY_DISABLED = 0, - V4L2_CID_POWER_LINE_FREQUENCY_50HZ = 1, - V4L2_CID_POWER_LINE_FREQUENCY_60HZ = 2, - V4L2_CID_POWER_LINE_FREQUENCY_AUTO = 3, -}; -#define V4L2_CID_HUE_AUTO (V4L2_CID_BASE+25) -#define V4L2_CID_WHITE_BALANCE_TEMPERATURE (V4L2_CID_BASE+26) -#define V4L2_CID_SHARPNESS (V4L2_CID_BASE+27) -#define V4L2_CID_BACKLIGHT_COMPENSATION (V4L2_CID_BASE+28) -#define V4L2_CID_CHROMA_AGC (V4L2_CID_BASE+29) -#define V4L2_CID_COLOR_KILLER (V4L2_CID_BASE+30) -#define V4L2_CID_COLORFX (V4L2_CID_BASE+31) -enum v4l2_colorfx { - V4L2_COLORFX_NONE = 0, - V4L2_COLORFX_BW = 1, - V4L2_COLORFX_SEPIA = 2, - V4L2_COLORFX_NEGATIVE = 3, - V4L2_COLORFX_EMBOSS = 4, - V4L2_COLORFX_SKETCH = 5, - V4L2_COLORFX_SKY_BLUE = 6, - V4L2_COLORFX_GRASS_GREEN = 7, - V4L2_COLORFX_SKIN_WHITEN = 8, - V4L2_COLORFX_VIVID = 9, -}; -#define V4L2_CID_AUTOBRIGHTNESS (V4L2_CID_BASE+32) -#define V4L2_CID_BAND_STOP_FILTER (V4L2_CID_BASE+33) - -#define V4L2_CID_ROTATE (V4L2_CID_BASE+34) -#define V4L2_CID_BG_COLOR (V4L2_CID_BASE+35) - -#define V4L2_CID_CHROMA_GAIN (V4L2_CID_BASE+36) - -#define V4L2_CID_ILLUMINATORS_1 (V4L2_CID_BASE+37) -#define V4L2_CID_ILLUMINATORS_2 (V4L2_CID_BASE+38) - -#define V4L2_CID_MIN_BUFFERS_FOR_CAPTURE (V4L2_CID_BASE+39) -#define V4L2_CID_MIN_BUFFERS_FOR_OUTPUT (V4L2_CID_BASE+40) - -#define V4L2_CID_ALPHA_COMPONENT (V4L2_CID_BASE+41) - -/* last CID + 1 */ -#define V4L2_CID_LASTP1 (V4L2_CID_BASE+42) - -/* MPEG-class control IDs defined by V4L2 */ -#define V4L2_CID_MPEG_BASE (V4L2_CTRL_CLASS_MPEG | 0x900) -#define V4L2_CID_MPEG_CLASS (V4L2_CTRL_CLASS_MPEG | 1) - -/* MPEG streams, specific to multiplexed streams */ -#define V4L2_CID_MPEG_STREAM_TYPE (V4L2_CID_MPEG_BASE+0) -enum v4l2_mpeg_stream_type { - V4L2_MPEG_STREAM_TYPE_MPEG2_PS = 0, /* MPEG-2 program stream */ - V4L2_MPEG_STREAM_TYPE_MPEG2_TS = 1, /* MPEG-2 transport stream */ - V4L2_MPEG_STREAM_TYPE_MPEG1_SS = 2, /* MPEG-1 system stream */ - V4L2_MPEG_STREAM_TYPE_MPEG2_DVD = 3, /* MPEG-2 DVD-compatible stream */ - V4L2_MPEG_STREAM_TYPE_MPEG1_VCD = 4, /* MPEG-1 VCD-compatible stream */ - V4L2_MPEG_STREAM_TYPE_MPEG2_SVCD = 5, /* MPEG-2 SVCD-compatible stream */ -}; -#define V4L2_CID_MPEG_STREAM_PID_PMT (V4L2_CID_MPEG_BASE+1) -#define V4L2_CID_MPEG_STREAM_PID_AUDIO (V4L2_CID_MPEG_BASE+2) -#define V4L2_CID_MPEG_STREAM_PID_VIDEO (V4L2_CID_MPEG_BASE+3) -#define V4L2_CID_MPEG_STREAM_PID_PCR (V4L2_CID_MPEG_BASE+4) -#define V4L2_CID_MPEG_STREAM_PES_ID_AUDIO (V4L2_CID_MPEG_BASE+5) -#define V4L2_CID_MPEG_STREAM_PES_ID_VIDEO (V4L2_CID_MPEG_BASE+6) -#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7) -enum v4l2_mpeg_stream_vbi_fmt { - V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream */ - V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets, IVTV format */ -}; - -/* MPEG audio controls specific to multiplexed streams */ -#define V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ (V4L2_CID_MPEG_BASE+100) -enum v4l2_mpeg_audio_sampling_freq { - V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100 = 0, - V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000 = 1, - V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000 = 2, -}; -#define V4L2_CID_MPEG_AUDIO_ENCODING (V4L2_CID_MPEG_BASE+101) -enum v4l2_mpeg_audio_encoding { - V4L2_MPEG_AUDIO_ENCODING_LAYER_1 = 0, - V4L2_MPEG_AUDIO_ENCODING_LAYER_2 = 1, - V4L2_MPEG_AUDIO_ENCODING_LAYER_3 = 2, - V4L2_MPEG_AUDIO_ENCODING_AAC = 3, - V4L2_MPEG_AUDIO_ENCODING_AC3 = 4, -}; -#define V4L2_CID_MPEG_AUDIO_L1_BITRATE (V4L2_CID_MPEG_BASE+102) -enum v4l2_mpeg_audio_l1_bitrate { - V4L2_MPEG_AUDIO_L1_BITRATE_32K = 0, - V4L2_MPEG_AUDIO_L1_BITRATE_64K = 1, - V4L2_MPEG_AUDIO_L1_BITRATE_96K = 2, - V4L2_MPEG_AUDIO_L1_BITRATE_128K = 3, - V4L2_MPEG_AUDIO_L1_BITRATE_160K = 4, - V4L2_MPEG_AUDIO_L1_BITRATE_192K = 5, - V4L2_MPEG_AUDIO_L1_BITRATE_224K = 6, - V4L2_MPEG_AUDIO_L1_BITRATE_256K = 7, - V4L2_MPEG_AUDIO_L1_BITRATE_288K = 8, - V4L2_MPEG_AUDIO_L1_BITRATE_320K = 9, - V4L2_MPEG_AUDIO_L1_BITRATE_352K = 10, - V4L2_MPEG_AUDIO_L1_BITRATE_384K = 11, - V4L2_MPEG_AUDIO_L1_BITRATE_416K = 12, - V4L2_MPEG_AUDIO_L1_BITRATE_448K = 13, -}; -#define V4L2_CID_MPEG_AUDIO_L2_BITRATE (V4L2_CID_MPEG_BASE+103) -enum v4l2_mpeg_audio_l2_bitrate { - V4L2_MPEG_AUDIO_L2_BITRATE_32K = 0, - V4L2_MPEG_AUDIO_L2_BITRATE_48K = 1, - V4L2_MPEG_AUDIO_L2_BITRATE_56K = 2, - V4L2_MPEG_AUDIO_L2_BITRATE_64K = 3, - V4L2_MPEG_AUDIO_L2_BITRATE_80K = 4, - V4L2_MPEG_AUDIO_L2_BITRATE_96K = 5, - V4L2_MPEG_AUDIO_L2_BITRATE_112K = 6, - V4L2_MPEG_AUDIO_L2_BITRATE_128K = 7, - V4L2_MPEG_AUDIO_L2_BITRATE_160K = 8, - V4L2_MPEG_AUDIO_L2_BITRATE_192K = 9, - V4L2_MPEG_AUDIO_L2_BITRATE_224K = 10, - V4L2_MPEG_AUDIO_L2_BITRATE_256K = 11, - V4L2_MPEG_AUDIO_L2_BITRATE_320K = 12, - V4L2_MPEG_AUDIO_L2_BITRATE_384K = 13, -}; -#define V4L2_CID_MPEG_AUDIO_L3_BITRATE (V4L2_CID_MPEG_BASE+104) -enum v4l2_mpeg_audio_l3_bitrate { - V4L2_MPEG_AUDIO_L3_BITRATE_32K = 0, - V4L2_MPEG_AUDIO_L3_BITRATE_40K = 1, - V4L2_MPEG_AUDIO_L3_BITRATE_48K = 2, - V4L2_MPEG_AUDIO_L3_BITRATE_56K = 3, - V4L2_MPEG_AUDIO_L3_BITRATE_64K = 4, - V4L2_MPEG_AUDIO_L3_BITRATE_80K = 5, - V4L2_MPEG_AUDIO_L3_BITRATE_96K = 6, - V4L2_MPEG_AUDIO_L3_BITRATE_112K = 7, - V4L2_MPEG_AUDIO_L3_BITRATE_128K = 8, - V4L2_MPEG_AUDIO_L3_BITRATE_160K = 9, - V4L2_MPEG_AUDIO_L3_BITRATE_192K = 10, - V4L2_MPEG_AUDIO_L3_BITRATE_224K = 11, - V4L2_MPEG_AUDIO_L3_BITRATE_256K = 12, - V4L2_MPEG_AUDIO_L3_BITRATE_320K = 13, -}; -#define V4L2_CID_MPEG_AUDIO_MODE (V4L2_CID_MPEG_BASE+105) -enum v4l2_mpeg_audio_mode { - V4L2_MPEG_AUDIO_MODE_STEREO = 0, - V4L2_MPEG_AUDIO_MODE_JOINT_STEREO = 1, - V4L2_MPEG_AUDIO_MODE_DUAL = 2, - V4L2_MPEG_AUDIO_MODE_MONO = 3, -}; -#define V4L2_CID_MPEG_AUDIO_MODE_EXTENSION (V4L2_CID_MPEG_BASE+106) -enum v4l2_mpeg_audio_mode_extension { - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_4 = 0, - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_8 = 1, - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_12 = 2, - V4L2_MPEG_AUDIO_MODE_EXTENSION_BOUND_16 = 3, -}; -#define V4L2_CID_MPEG_AUDIO_EMPHASIS (V4L2_CID_MPEG_BASE+107) -enum v4l2_mpeg_audio_emphasis { - V4L2_MPEG_AUDIO_EMPHASIS_NONE = 0, - V4L2_MPEG_AUDIO_EMPHASIS_50_DIV_15_uS = 1, - V4L2_MPEG_AUDIO_EMPHASIS_CCITT_J17 = 2, -}; -#define V4L2_CID_MPEG_AUDIO_CRC (V4L2_CID_MPEG_BASE+108) -enum v4l2_mpeg_audio_crc { - V4L2_MPEG_AUDIO_CRC_NONE = 0, - V4L2_MPEG_AUDIO_CRC_CRC16 = 1, -}; -#define V4L2_CID_MPEG_AUDIO_MUTE (V4L2_CID_MPEG_BASE+109) -#define V4L2_CID_MPEG_AUDIO_AAC_BITRATE (V4L2_CID_MPEG_BASE+110) -#define V4L2_CID_MPEG_AUDIO_AC3_BITRATE (V4L2_CID_MPEG_BASE+111) -enum v4l2_mpeg_audio_ac3_bitrate { - V4L2_MPEG_AUDIO_AC3_BITRATE_32K = 0, - V4L2_MPEG_AUDIO_AC3_BITRATE_40K = 1, - V4L2_MPEG_AUDIO_AC3_BITRATE_48K = 2, - V4L2_MPEG_AUDIO_AC3_BITRATE_56K = 3, - V4L2_MPEG_AUDIO_AC3_BITRATE_64K = 4, - V4L2_MPEG_AUDIO_AC3_BITRATE_80K = 5, - V4L2_MPEG_AUDIO_AC3_BITRATE_96K = 6, - V4L2_MPEG_AUDIO_AC3_BITRATE_112K = 7, - V4L2_MPEG_AUDIO_AC3_BITRATE_128K = 8, - V4L2_MPEG_AUDIO_AC3_BITRATE_160K = 9, - V4L2_MPEG_AUDIO_AC3_BITRATE_192K = 10, - V4L2_MPEG_AUDIO_AC3_BITRATE_224K = 11, - V4L2_MPEG_AUDIO_AC3_BITRATE_256K = 12, - V4L2_MPEG_AUDIO_AC3_BITRATE_320K = 13, - V4L2_MPEG_AUDIO_AC3_BITRATE_384K = 14, - V4L2_MPEG_AUDIO_AC3_BITRATE_448K = 15, - V4L2_MPEG_AUDIO_AC3_BITRATE_512K = 16, - V4L2_MPEG_AUDIO_AC3_BITRATE_576K = 17, - V4L2_MPEG_AUDIO_AC3_BITRATE_640K = 18, -}; - -/* MPEG video controls specific to multiplexed streams */ -#define V4L2_CID_MPEG_VIDEO_ENCODING (V4L2_CID_MPEG_BASE+200) -enum v4l2_mpeg_video_encoding { - V4L2_MPEG_VIDEO_ENCODING_MPEG_1 = 0, - V4L2_MPEG_VIDEO_ENCODING_MPEG_2 = 1, - V4L2_MPEG_VIDEO_ENCODING_MPEG_4_AVC = 2, -}; -#define V4L2_CID_MPEG_VIDEO_ASPECT (V4L2_CID_MPEG_BASE+201) -enum v4l2_mpeg_video_aspect { - V4L2_MPEG_VIDEO_ASPECT_1x1 = 0, - V4L2_MPEG_VIDEO_ASPECT_4x3 = 1, - V4L2_MPEG_VIDEO_ASPECT_16x9 = 2, - V4L2_MPEG_VIDEO_ASPECT_221x100 = 3, -}; -#define V4L2_CID_MPEG_VIDEO_B_FRAMES (V4L2_CID_MPEG_BASE+202) -#define V4L2_CID_MPEG_VIDEO_GOP_SIZE (V4L2_CID_MPEG_BASE+203) -#define V4L2_CID_MPEG_VIDEO_GOP_CLOSURE (V4L2_CID_MPEG_BASE+204) -#define V4L2_CID_MPEG_VIDEO_PULLDOWN (V4L2_CID_MPEG_BASE+205) -#define V4L2_CID_MPEG_VIDEO_BITRATE_MODE (V4L2_CID_MPEG_BASE+206) -enum v4l2_mpeg_video_bitrate_mode { - V4L2_MPEG_VIDEO_BITRATE_MODE_VBR = 0, - V4L2_MPEG_VIDEO_BITRATE_MODE_CBR = 1, -}; -#define V4L2_CID_MPEG_VIDEO_BITRATE (V4L2_CID_MPEG_BASE+207) -#define V4L2_CID_MPEG_VIDEO_BITRATE_PEAK (V4L2_CID_MPEG_BASE+208) -#define V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION (V4L2_CID_MPEG_BASE+209) -#define V4L2_CID_MPEG_VIDEO_MUTE (V4L2_CID_MPEG_BASE+210) -#define V4L2_CID_MPEG_VIDEO_MUTE_YUV (V4L2_CID_MPEG_BASE+211) -#define V4L2_CID_MPEG_VIDEO_DECODER_SLICE_INTERFACE (V4L2_CID_MPEG_BASE+212) -#define V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER (V4L2_CID_MPEG_BASE+213) -#define V4L2_CID_MPEG_VIDEO_CYCLIC_INTRA_REFRESH_MB (V4L2_CID_MPEG_BASE+214) -#define V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE (V4L2_CID_MPEG_BASE+215) -#define V4L2_CID_MPEG_VIDEO_HEADER_MODE (V4L2_CID_MPEG_BASE+216) -enum v4l2_mpeg_video_header_mode { - V4L2_MPEG_VIDEO_HEADER_MODE_SEPARATE = 0, - V4L2_MPEG_VIDEO_HEADER_MODE_JOINED_WITH_1ST_FRAME = 1, - -}; -#define V4L2_CID_MPEG_VIDEO_MAX_REF_PIC (V4L2_CID_MPEG_BASE+217) -#define V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE (V4L2_CID_MPEG_BASE+218) -#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_BYTES (V4L2_CID_MPEG_BASE+219) -#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MAX_MB (V4L2_CID_MPEG_BASE+220) -#define V4L2_CID_MPEG_VIDEO_MULTI_SLICE_MODE (V4L2_CID_MPEG_BASE+221) -enum v4l2_mpeg_video_multi_slice_mode { - V4L2_MPEG_VIDEO_MULTI_SLICE_MODE_SINGLE = 0, - V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_MB = 1, - V4L2_MPEG_VIDEO_MULTI_SICE_MODE_MAX_BYTES = 2, -}; -#define V4L2_CID_MPEG_VIDEO_VBV_SIZE (V4L2_CID_MPEG_BASE+222) -#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) -#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) -#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) -#define V4L2_CID_MPEG_VIDEO_H263_MIN_QP (V4L2_CID_MPEG_BASE+303) -#define V4L2_CID_MPEG_VIDEO_H263_MAX_QP (V4L2_CID_MPEG_BASE+304) -#define V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP (V4L2_CID_MPEG_BASE+350) -#define V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP (V4L2_CID_MPEG_BASE+351) -#define V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP (V4L2_CID_MPEG_BASE+352) -#define V4L2_CID_MPEG_VIDEO_H264_MIN_QP (V4L2_CID_MPEG_BASE+353) -#define V4L2_CID_MPEG_VIDEO_H264_MAX_QP (V4L2_CID_MPEG_BASE+354) -#define V4L2_CID_MPEG_VIDEO_H264_8X8_TRANSFORM (V4L2_CID_MPEG_BASE+355) -#define V4L2_CID_MPEG_VIDEO_H264_CPB_SIZE (V4L2_CID_MPEG_BASE+356) -#define V4L2_CID_MPEG_VIDEO_H264_ENTROPY_MODE (V4L2_CID_MPEG_BASE+357) -enum v4l2_mpeg_video_h264_entropy_mode { - V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CAVLC = 0, - V4L2_MPEG_VIDEO_H264_ENTROPY_MODE_CABAC = 1, -}; -#define V4L2_CID_MPEG_VIDEO_H264_I_PERIOD (V4L2_CID_MPEG_BASE+358) -#define V4L2_CID_MPEG_VIDEO_H264_LEVEL (V4L2_CID_MPEG_BASE+359) -enum v4l2_mpeg_video_h264_level { - V4L2_MPEG_VIDEO_H264_LEVEL_1_0 = 0, - V4L2_MPEG_VIDEO_H264_LEVEL_1B = 1, - V4L2_MPEG_VIDEO_H264_LEVEL_1_1 = 2, - V4L2_MPEG_VIDEO_H264_LEVEL_1_2 = 3, - V4L2_MPEG_VIDEO_H264_LEVEL_1_3 = 4, - V4L2_MPEG_VIDEO_H264_LEVEL_2_0 = 5, - V4L2_MPEG_VIDEO_H264_LEVEL_2_1 = 6, - V4L2_MPEG_VIDEO_H264_LEVEL_2_2 = 7, - V4L2_MPEG_VIDEO_H264_LEVEL_3_0 = 8, - V4L2_MPEG_VIDEO_H264_LEVEL_3_1 = 9, - V4L2_MPEG_VIDEO_H264_LEVEL_3_2 = 10, - V4L2_MPEG_VIDEO_H264_LEVEL_4_0 = 11, - V4L2_MPEG_VIDEO_H264_LEVEL_4_1 = 12, - V4L2_MPEG_VIDEO_H264_LEVEL_4_2 = 13, - V4L2_MPEG_VIDEO_H264_LEVEL_5_0 = 14, - V4L2_MPEG_VIDEO_H264_LEVEL_5_1 = 15, -}; -#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_ALPHA (V4L2_CID_MPEG_BASE+360) -#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_BETA (V4L2_CID_MPEG_BASE+361) -#define V4L2_CID_MPEG_VIDEO_H264_LOOP_FILTER_MODE (V4L2_CID_MPEG_BASE+362) -enum v4l2_mpeg_video_h264_loop_filter_mode { - V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_ENABLED = 0, - V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED = 1, - V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY = 2, -}; -#define V4L2_CID_MPEG_VIDEO_H264_PROFILE (V4L2_CID_MPEG_BASE+363) -enum v4l2_mpeg_video_h264_profile { - V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE = 0, - V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE = 1, - V4L2_MPEG_VIDEO_H264_PROFILE_MAIN = 2, - V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED = 3, - V4L2_MPEG_VIDEO_H264_PROFILE_HIGH = 4, - V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10 = 5, - V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422 = 6, - V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE = 7, - V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA = 8, - V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA = 9, - V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA = 10, - V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA = 11, - V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12, - V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13, - V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14, - V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH = 15, - V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16, -}; -#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_HEIGHT (V4L2_CID_MPEG_BASE+364) -#define V4L2_CID_MPEG_VIDEO_H264_VUI_EXT_SAR_WIDTH (V4L2_CID_MPEG_BASE+365) -#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_ENABLE (V4L2_CID_MPEG_BASE+366) -#define V4L2_CID_MPEG_VIDEO_H264_VUI_SAR_IDC (V4L2_CID_MPEG_BASE+367) -enum v4l2_mpeg_video_h264_vui_sar_idc { - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_UNSPECIFIED = 0, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_1x1 = 1, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_12x11 = 2, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_10x11 = 3, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_16x11 = 4, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_40x33 = 5, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_24x11 = 6, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_20x11 = 7, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_32x11 = 8, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_80x33 = 9, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_18x11 = 10, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_15x11 = 11, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_64x33 = 12, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_160x99 = 13, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_4x3 = 14, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_3x2 = 15, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_2x1 = 16, - V4L2_MPEG_VIDEO_H264_VUI_SAR_IDC_EXTENDED = 17, -}; -#define V4L2_CID_MPEG_VIDEO_MPEG4_I_FRAME_QP (V4L2_CID_MPEG_BASE+400) -#define V4L2_CID_MPEG_VIDEO_MPEG4_P_FRAME_QP (V4L2_CID_MPEG_BASE+401) -#define V4L2_CID_MPEG_VIDEO_MPEG4_B_FRAME_QP (V4L2_CID_MPEG_BASE+402) -#define V4L2_CID_MPEG_VIDEO_MPEG4_MIN_QP (V4L2_CID_MPEG_BASE+403) -#define V4L2_CID_MPEG_VIDEO_MPEG4_MAX_QP (V4L2_CID_MPEG_BASE+404) -#define V4L2_CID_MPEG_VIDEO_MPEG4_LEVEL (V4L2_CID_MPEG_BASE+405) -enum v4l2_mpeg_video_mpeg4_level { - V4L2_MPEG_VIDEO_MPEG4_LEVEL_0 = 0, - V4L2_MPEG_VIDEO_MPEG4_LEVEL_0B = 1, - V4L2_MPEG_VIDEO_MPEG4_LEVEL_1 = 2, - V4L2_MPEG_VIDEO_MPEG4_LEVEL_2 = 3, - V4L2_MPEG_VIDEO_MPEG4_LEVEL_3 = 4, - V4L2_MPEG_VIDEO_MPEG4_LEVEL_3B = 5, - V4L2_MPEG_VIDEO_MPEG4_LEVEL_4 = 6, - V4L2_MPEG_VIDEO_MPEG4_LEVEL_5 = 7, -}; -#define V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE (V4L2_CID_MPEG_BASE+406) -enum v4l2_mpeg_video_mpeg4_profile { - V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE = 0, - V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_SIMPLE = 1, - V4L2_MPEG_VIDEO_MPEG4_PROFILE_CORE = 2, - V4L2_MPEG_VIDEO_MPEG4_PROFILE_SIMPLE_SCALABLE = 3, - V4L2_MPEG_VIDEO_MPEG4_PROFILE_ADVANCED_CODING_EFFICIENCY = 4, -}; -#define V4L2_CID_MPEG_VIDEO_MPEG4_QPEL (V4L2_CID_MPEG_BASE+407) - -/* MPEG-class control IDs specific to the CX2341x driver as defined by V4L2 */ -#define V4L2_CID_MPEG_CX2341X_BASE (V4L2_CTRL_CLASS_MPEG | 0x1000) -#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+0) -enum v4l2_mpeg_cx2341x_video_spatial_filter_mode { - V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_MANUAL = 0, - V4L2_MPEG_CX2341X_VIDEO_SPATIAL_FILTER_MODE_AUTO = 1, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_SPATIAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+1) -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+2) -enum v4l2_mpeg_cx2341x_video_luma_spatial_filter_type { - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_OFF = 0, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_VERT = 2, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_HV_SEPARABLE = 3, - V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_2D_SYM_NON_SEPARABLE = 4, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+3) -enum v4l2_mpeg_cx2341x_video_chroma_spatial_filter_type { - V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_OFF = 0, - V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR = 1, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE (V4L2_CID_MPEG_CX2341X_BASE+4) -enum v4l2_mpeg_cx2341x_video_temporal_filter_mode { - V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL = 0, - V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_AUTO = 1, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER (V4L2_CID_MPEG_CX2341X_BASE+5) -#define V4L2_CID_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE (V4L2_CID_MPEG_CX2341X_BASE+6) -enum v4l2_mpeg_cx2341x_video_median_filter_type { - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF = 0, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR = 1, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_VERT = 2, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_HOR_VERT = 3, - V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_DIAG = 4, -}; -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+7) -#define V4L2_CID_MPEG_CX2341X_VIDEO_LUMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+8) -#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_BOTTOM (V4L2_CID_MPEG_CX2341X_BASE+9) -#define V4L2_CID_MPEG_CX2341X_VIDEO_CHROMA_MEDIAN_FILTER_TOP (V4L2_CID_MPEG_CX2341X_BASE+10) -#define V4L2_CID_MPEG_CX2341X_STREAM_INSERT_NAV_PACKETS (V4L2_CID_MPEG_CX2341X_BASE+11) - -/* MPEG-class control IDs specific to the Samsung MFC 5.1 driver as defined by V4L2 */ -#define V4L2_CID_MPEG_MFC51_BASE (V4L2_CTRL_CLASS_MPEG | 0x1100) - -#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY (V4L2_CID_MPEG_MFC51_BASE+0) -#define V4L2_CID_MPEG_MFC51_VIDEO_DECODER_H264_DISPLAY_DELAY_ENABLE (V4L2_CID_MPEG_MFC51_BASE+1) -#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE (V4L2_CID_MPEG_MFC51_BASE+2) -enum v4l2_mpeg_mfc51_video_frame_skip_mode { - V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_DISABLED = 0, - V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_LEVEL_LIMIT = 1, - V4L2_MPEG_MFC51_VIDEO_FRAME_SKIP_MODE_BUF_LIMIT = 2, -}; -#define V4L2_CID_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE (V4L2_CID_MPEG_MFC51_BASE+3) -enum v4l2_mpeg_mfc51_video_force_frame_type { - V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_DISABLED = 0, - V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_I_FRAME = 1, - V4L2_MPEG_MFC51_VIDEO_FORCE_FRAME_TYPE_NOT_CODED = 2, -}; -#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING (V4L2_CID_MPEG_MFC51_BASE+4) -#define V4L2_CID_MPEG_MFC51_VIDEO_PADDING_YUV (V4L2_CID_MPEG_MFC51_BASE+5) -#define V4L2_CID_MPEG_MFC51_VIDEO_RC_FIXED_TARGET_BIT (V4L2_CID_MPEG_MFC51_BASE+6) -#define V4L2_CID_MPEG_MFC51_VIDEO_RC_REACTION_COEFF (V4L2_CID_MPEG_MFC51_BASE+7) -#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_ACTIVITY (V4L2_CID_MPEG_MFC51_BASE+50) -#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_DARK (V4L2_CID_MPEG_MFC51_BASE+51) -#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_SMOOTH (V4L2_CID_MPEG_MFC51_BASE+52) -#define V4L2_CID_MPEG_MFC51_VIDEO_H264_ADAPTIVE_RC_STATIC (V4L2_CID_MPEG_MFC51_BASE+53) -#define V4L2_CID_MPEG_MFC51_VIDEO_H264_NUM_REF_PIC_FOR_P (V4L2_CID_MPEG_MFC51_BASE+54) - -/* Camera class control IDs */ -#define V4L2_CID_CAMERA_CLASS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x900) -#define V4L2_CID_CAMERA_CLASS (V4L2_CTRL_CLASS_CAMERA | 1) - -#define V4L2_CID_EXPOSURE_AUTO (V4L2_CID_CAMERA_CLASS_BASE+1) -enum v4l2_exposure_auto_type { - V4L2_EXPOSURE_AUTO = 0, - V4L2_EXPOSURE_MANUAL = 1, - V4L2_EXPOSURE_SHUTTER_PRIORITY = 2, - V4L2_EXPOSURE_APERTURE_PRIORITY = 3 -}; -#define V4L2_CID_EXPOSURE_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+2) -#define V4L2_CID_EXPOSURE_AUTO_PRIORITY (V4L2_CID_CAMERA_CLASS_BASE+3) - -#define V4L2_CID_PAN_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+4) -#define V4L2_CID_TILT_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+5) -#define V4L2_CID_PAN_RESET (V4L2_CID_CAMERA_CLASS_BASE+6) -#define V4L2_CID_TILT_RESET (V4L2_CID_CAMERA_CLASS_BASE+7) - -#define V4L2_CID_PAN_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+8) -#define V4L2_CID_TILT_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+9) - -#define V4L2_CID_FOCUS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+10) -#define V4L2_CID_FOCUS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+11) -#define V4L2_CID_FOCUS_AUTO (V4L2_CID_CAMERA_CLASS_BASE+12) - -#define V4L2_CID_ZOOM_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+13) -#define V4L2_CID_ZOOM_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+14) -#define V4L2_CID_ZOOM_CONTINUOUS (V4L2_CID_CAMERA_CLASS_BASE+15) - -#define V4L2_CID_PRIVACY (V4L2_CID_CAMERA_CLASS_BASE+16) - -#define V4L2_CID_IRIS_ABSOLUTE (V4L2_CID_CAMERA_CLASS_BASE+17) -#define V4L2_CID_IRIS_RELATIVE (V4L2_CID_CAMERA_CLASS_BASE+18) - -/* FM Modulator class control IDs */ -#define V4L2_CID_FM_TX_CLASS_BASE (V4L2_CTRL_CLASS_FM_TX | 0x900) -#define V4L2_CID_FM_TX_CLASS (V4L2_CTRL_CLASS_FM_TX | 1) - -#define V4L2_CID_RDS_TX_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 1) -#define V4L2_CID_RDS_TX_PI (V4L2_CID_FM_TX_CLASS_BASE + 2) -#define V4L2_CID_RDS_TX_PTY (V4L2_CID_FM_TX_CLASS_BASE + 3) -#define V4L2_CID_RDS_TX_PS_NAME (V4L2_CID_FM_TX_CLASS_BASE + 5) -#define V4L2_CID_RDS_TX_RADIO_TEXT (V4L2_CID_FM_TX_CLASS_BASE + 6) - -#define V4L2_CID_AUDIO_LIMITER_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 64) -#define V4L2_CID_AUDIO_LIMITER_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 65) -#define V4L2_CID_AUDIO_LIMITER_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 66) - -#define V4L2_CID_AUDIO_COMPRESSION_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 80) -#define V4L2_CID_AUDIO_COMPRESSION_GAIN (V4L2_CID_FM_TX_CLASS_BASE + 81) -#define V4L2_CID_AUDIO_COMPRESSION_THRESHOLD (V4L2_CID_FM_TX_CLASS_BASE + 82) -#define V4L2_CID_AUDIO_COMPRESSION_ATTACK_TIME (V4L2_CID_FM_TX_CLASS_BASE + 83) -#define V4L2_CID_AUDIO_COMPRESSION_RELEASE_TIME (V4L2_CID_FM_TX_CLASS_BASE + 84) - -#define V4L2_CID_PILOT_TONE_ENABLED (V4L2_CID_FM_TX_CLASS_BASE + 96) -#define V4L2_CID_PILOT_TONE_DEVIATION (V4L2_CID_FM_TX_CLASS_BASE + 97) -#define V4L2_CID_PILOT_TONE_FREQUENCY (V4L2_CID_FM_TX_CLASS_BASE + 98) - -#define V4L2_CID_TUNE_PREEMPHASIS (V4L2_CID_FM_TX_CLASS_BASE + 112) -enum v4l2_preemphasis { - V4L2_PREEMPHASIS_DISABLED = 0, - V4L2_PREEMPHASIS_50_uS = 1, - V4L2_PREEMPHASIS_75_uS = 2, -}; -#define V4L2_CID_TUNE_POWER_LEVEL (V4L2_CID_FM_TX_CLASS_BASE + 113) -#define V4L2_CID_TUNE_ANTENNA_CAPACITOR (V4L2_CID_FM_TX_CLASS_BASE + 114) -/* FM Tuner class control IDs */ -#define V4L2_CID_FM_RX_CLASS_BASE (V4L2_CTRL_CLASS_FM_RX | 0x900) -#define V4L2_CID_FM_RX_CLASS (V4L2_CTRL_CLASS_FM_RX | 1) - -#define V4L2_CID_TUNE_DEEMPHASIS (V4L2_CID_FM_RX_CLASS_BASE + 1) -enum v4l2_deemphasis { - V4L2_DEEMPHASIS_DISABLED = 0, - V4L2_DEEMPHASIS_50_uS = 1, - V4L2_DEEMPHASIS_75_uS = 2, -}; - -/* Flash and privacy (indicator) light controls */ -#define V4L2_CID_FLASH_CLASS_BASE (V4L2_CTRL_CLASS_FLASH | 0x900) -#define V4L2_CID_FLASH_CLASS (V4L2_CTRL_CLASS_FLASH | 1) - -#define V4L2_CID_FLASH_LED_MODE (V4L2_CID_FLASH_CLASS_BASE + 1) -enum v4l2_flash_led_mode { - V4L2_FLASH_LED_MODE_NONE, - V4L2_FLASH_LED_MODE_FLASH, - V4L2_FLASH_LED_MODE_TORCH, -}; - -#define V4L2_CID_FLASH_STROBE_SOURCE (V4L2_CID_FLASH_CLASS_BASE + 2) -enum v4l2_flash_strobe_source { - V4L2_FLASH_STROBE_SOURCE_SOFTWARE, - V4L2_FLASH_STROBE_SOURCE_EXTERNAL, -}; - -#define V4L2_CID_FLASH_STROBE (V4L2_CID_FLASH_CLASS_BASE + 3) -#define V4L2_CID_FLASH_STROBE_STOP (V4L2_CID_FLASH_CLASS_BASE + 4) -#define V4L2_CID_FLASH_STROBE_STATUS (V4L2_CID_FLASH_CLASS_BASE + 5) - -#define V4L2_CID_FLASH_TIMEOUT (V4L2_CID_FLASH_CLASS_BASE + 6) -#define V4L2_CID_FLASH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 7) -#define V4L2_CID_FLASH_TORCH_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 8) -#define V4L2_CID_FLASH_INDICATOR_INTENSITY (V4L2_CID_FLASH_CLASS_BASE + 9) - -#define V4L2_CID_FLASH_FAULT (V4L2_CID_FLASH_CLASS_BASE + 10) -#define V4L2_FLASH_FAULT_OVER_VOLTAGE (1 << 0) -#define V4L2_FLASH_FAULT_TIMEOUT (1 << 1) -#define V4L2_FLASH_FAULT_OVER_TEMPERATURE (1 << 2) -#define V4L2_FLASH_FAULT_SHORT_CIRCUIT (1 << 3) -#define V4L2_FLASH_FAULT_OVER_CURRENT (1 << 4) -#define V4L2_FLASH_FAULT_INDICATOR (1 << 5) - -#define V4L2_CID_FLASH_CHARGE (V4L2_CID_FLASH_CLASS_BASE + 11) -#define V4L2_CID_FLASH_READY (V4L2_CID_FLASH_CLASS_BASE + 12) - -/* - * T U N I N G - */ -struct v4l2_tuner { - __u32 index; - __u8 name[32]; - enum v4l2_tuner_type type; - __u32 capability; - __u32 rangelow; - __u32 rangehigh; - __u32 rxsubchans; - __u32 audmode; - __s32 signal; - __s32 afc; - __u32 reserved[4]; -}; - -struct v4l2_modulator { - __u32 index; - __u8 name[32]; - __u32 capability; - __u32 rangelow; - __u32 rangehigh; - __u32 txsubchans; - __u32 reserved[4]; -}; - -/* Flags for the 'capability' field */ -#define V4L2_TUNER_CAP_LOW 0x0001 -#define V4L2_TUNER_CAP_NORM 0x0002 -#define V4L2_TUNER_CAP_STEREO 0x0010 -#define V4L2_TUNER_CAP_LANG2 0x0020 -#define V4L2_TUNER_CAP_SAP 0x0020 -#define V4L2_TUNER_CAP_LANG1 0x0040 -#define V4L2_TUNER_CAP_RDS 0x0080 -#define V4L2_TUNER_CAP_RDS_BLOCK_IO 0x0100 -#define V4L2_TUNER_CAP_RDS_CONTROLS 0x0200 - -/* Flags for the 'rxsubchans' field */ -#define V4L2_TUNER_SUB_MONO 0x0001 -#define V4L2_TUNER_SUB_STEREO 0x0002 -#define V4L2_TUNER_SUB_LANG2 0x0004 -#define V4L2_TUNER_SUB_SAP 0x0004 -#define V4L2_TUNER_SUB_LANG1 0x0008 -#define V4L2_TUNER_SUB_RDS 0x0010 - -/* Values for the 'audmode' field */ -#define V4L2_TUNER_MODE_MONO 0x0000 -#define V4L2_TUNER_MODE_STEREO 0x0001 -#define V4L2_TUNER_MODE_LANG2 0x0002 -#define V4L2_TUNER_MODE_SAP 0x0002 -#define V4L2_TUNER_MODE_LANG1 0x0003 -#define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 - -struct v4l2_frequency { - __u32 tuner; - enum v4l2_tuner_type type; - __u32 frequency; - __u32 reserved[8]; -}; - -struct v4l2_hw_freq_seek { - __u32 tuner; - enum v4l2_tuner_type type; - __u32 seek_upward; - __u32 wrap_around; - __u32 spacing; - __u32 reserved[7]; -}; - -/* - * R D S - */ - -struct v4l2_rds_data { - __u8 lsb; - __u8 msb; - __u8 block; -} __attribute__ ((packed)); - -#define V4L2_RDS_BLOCK_MSK 0x7 -#define V4L2_RDS_BLOCK_A 0 -#define V4L2_RDS_BLOCK_B 1 -#define V4L2_RDS_BLOCK_C 2 -#define V4L2_RDS_BLOCK_D 3 -#define V4L2_RDS_BLOCK_C_ALT 4 -#define V4L2_RDS_BLOCK_INVALID 7 - -#define V4L2_RDS_BLOCK_CORRECTED 0x40 -#define V4L2_RDS_BLOCK_ERROR 0x80 - -/* - * A U D I O - */ -struct v4l2_audio { - __u32 index; - __u8 name[32]; - __u32 capability; - __u32 mode; - __u32 reserved[2]; -}; - -/* Flags for the 'capability' field */ -#define V4L2_AUDCAP_STEREO 0x00001 -#define V4L2_AUDCAP_AVL 0x00002 - -/* Flags for the 'mode' field */ -#define V4L2_AUDMODE_AVL 0x00001 - -struct v4l2_audioout { - __u32 index; - __u8 name[32]; - __u32 capability; - __u32 mode; - __u32 reserved[2]; -}; - -/* - * M P E G S E R V I C E S - * - * NOTE: EXPERIMENTAL API - */ -#if 1 -#define V4L2_ENC_IDX_FRAME_I (0) -#define V4L2_ENC_IDX_FRAME_P (1) -#define V4L2_ENC_IDX_FRAME_B (2) -#define V4L2_ENC_IDX_FRAME_MASK (0xf) - -struct v4l2_enc_idx_entry { - __u64 offset; - __u64 pts; - __u32 length; - __u32 flags; - __u32 reserved[2]; -}; - -#define V4L2_ENC_IDX_ENTRIES (64) -struct v4l2_enc_idx { - __u32 entries; - __u32 entries_cap; - __u32 reserved[4]; - struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; -}; - - -#define V4L2_ENC_CMD_START (0) -#define V4L2_ENC_CMD_STOP (1) -#define V4L2_ENC_CMD_PAUSE (2) -#define V4L2_ENC_CMD_RESUME (3) - -/* Flags for V4L2_ENC_CMD_STOP */ -#define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0) - -struct v4l2_encoder_cmd { - __u32 cmd; - __u32 flags; - union { - struct { - __u32 data[8]; - } raw; - }; -}; - -#endif - - -/* - * D A T A S E R V I C E S ( V B I ) - * - * Data services API by Michael Schimek - */ - -/* Raw VBI */ -struct v4l2_vbi_format { - __u32 sampling_rate; /* in 1 Hz */ - __u32 offset; - __u32 samples_per_line; - __u32 sample_format; /* V4L2_PIX_FMT_* */ - __s32 start[2]; - __u32 count[2]; - __u32 flags; /* V4L2_VBI_* */ - __u32 reserved[2]; /* must be zero */ -}; - -/* VBI flags */ -#define V4L2_VBI_UNSYNC (1 << 0) -#define V4L2_VBI_INTERLACED (1 << 1) - -/* Sliced VBI - * - * This implements is a proposal V4L2 API to allow SLICED VBI - * required for some hardware encoders. It should change without - * notice in the definitive implementation. - */ - -struct v4l2_sliced_vbi_format { - __u16 service_set; - /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field - service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ - __u16 service_lines[2][24]; - __u32 io_size; - __u32 reserved[2]; /* must be zero */ -}; - -/* Teletext World System Teletext - (WST), defined on ITU-R BT.653-2 */ -#define V4L2_SLICED_TELETEXT_B (0x0001) -/* Video Program System, defined on ETS 300 231*/ -#define V4L2_SLICED_VPS (0x0400) -/* Closed Caption, defined on EIA-608 */ -#define V4L2_SLICED_CAPTION_525 (0x1000) -/* Wide Screen System, defined on ITU-R BT1119.1 */ -#define V4L2_SLICED_WSS_625 (0x4000) - -#define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) -#define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) - -struct v4l2_sliced_vbi_cap { - __u16 service_set; - /* service_lines[0][...] specifies lines 0-23 (1-23 used) of the first field - service_lines[1][...] specifies lines 0-23 (1-23 used) of the second field - (equals frame lines 313-336 for 625 line video - standards, 263-286 for 525 line standards) */ - __u16 service_lines[2][24]; - enum v4l2_buf_type type; - __u32 reserved[3]; /* must be 0 */ -}; - -struct v4l2_sliced_vbi_data { - __u32 id; - __u32 field; /* 0: first field, 1: second field */ - __u32 line; /* 1-23 */ - __u32 reserved; /* must be 0 */ - __u8 data[48]; -}; - -/* - * Sliced VBI data inserted into MPEG Streams - */ - -/* - * V4L2_MPEG_STREAM_VBI_FMT_IVTV: - * - * Structure of payload contained in an MPEG 2 Private Stream 1 PES Packet in an - * MPEG-2 Program Pack that contains V4L2_MPEG_STREAM_VBI_FMT_IVTV Sliced VBI - * data - * - * Note, the MPEG-2 Program Pack and Private Stream 1 PES packet header - * definitions are not included here. See the MPEG-2 specifications for details - * on these headers. - */ - -/* Line type IDs */ -#define V4L2_MPEG_VBI_IVTV_TELETEXT_B (1) -#define V4L2_MPEG_VBI_IVTV_CAPTION_525 (4) -#define V4L2_MPEG_VBI_IVTV_WSS_625 (5) -#define V4L2_MPEG_VBI_IVTV_VPS (7) - -struct v4l2_mpeg_vbi_itv0_line { - __u8 id; /* One of V4L2_MPEG_VBI_IVTV_* above */ - __u8 data[42]; /* Sliced VBI data for the line */ -} __attribute__ ((packed)); - -struct v4l2_mpeg_vbi_itv0 { - __le32 linemask[2]; /* Bitmasks of VBI service lines present */ - struct v4l2_mpeg_vbi_itv0_line line[35]; -} __attribute__ ((packed)); - -struct v4l2_mpeg_vbi_ITV0 { - struct v4l2_mpeg_vbi_itv0_line line[36]; -} __attribute__ ((packed)); - -#define V4L2_MPEG_VBI_IVTV_MAGIC0 "itv0" -#define V4L2_MPEG_VBI_IVTV_MAGIC1 "ITV0" - -struct v4l2_mpeg_vbi_fmt_ivtv { - __u8 magic[4]; - union { - struct v4l2_mpeg_vbi_itv0 itv0; - struct v4l2_mpeg_vbi_ITV0 ITV0; - }; -} __attribute__ ((packed)); - -/* - * A G G R E G A T E S T R U C T U R E S - */ - -/** - * struct v4l2_plane_pix_format - additional, per-plane format definition - * @sizeimage: maximum size in bytes required for data, for which - * this plane will be used - * @bytesperline: distance in bytes between the leftmost pixels in two - * adjacent lines - */ -struct v4l2_plane_pix_format { - __u32 sizeimage; - __u16 bytesperline; - __u16 reserved[7]; -} __attribute__ ((packed)); - -/** - * struct v4l2_pix_format_mplane - multiplanar format definition - * @width: image width in pixels - * @height: image height in pixels - * @pixelformat: little endian four character code (fourcc) - * @field: field order (for interlaced video) - * @colorspace: supplemental to pixelformat - * @plane_fmt: per-plane information - * @num_planes: number of planes for this format - */ -struct v4l2_pix_format_mplane { - __u32 width; - __u32 height; - __u32 pixelformat; - enum v4l2_field field; - enum v4l2_colorspace colorspace; - - struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; - __u8 num_planes; - __u8 reserved[11]; -} __attribute__ ((packed)); - -/** - * struct v4l2_format - stream data format - * @type: type of the data stream - * @pix: definition of an image format - * @pix_mp: definition of a multiplanar image format - * @win: definition of an overlaid image - * @vbi: raw VBI capture or output parameters - * @sliced: sliced VBI capture or output parameters - * @raw_data: placeholder for future extensions and custom formats - */ -struct v4l2_format { - enum v4l2_buf_type type; - union { - struct v4l2_pix_format pix; /* V4L2_BUF_TYPE_VIDEO_CAPTURE */ - struct v4l2_pix_format_mplane pix_mp; /* V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE */ - struct v4l2_window win; /* V4L2_BUF_TYPE_VIDEO_OVERLAY */ - struct v4l2_vbi_format vbi; /* V4L2_BUF_TYPE_VBI_CAPTURE */ - struct v4l2_sliced_vbi_format sliced; /* V4L2_BUF_TYPE_SLICED_VBI_CAPTURE */ - __u8 raw_data[200]; /* user-defined */ - } fmt; -}; - -/* Stream type-dependent parameters - */ -struct v4l2_streamparm { - enum v4l2_buf_type type; - union { - struct v4l2_captureparm capture; - struct v4l2_outputparm output; - __u8 raw_data[200]; /* user-defined */ - } parm; -}; - -/* - * E V E N T S - */ - -#define V4L2_EVENT_ALL 0 -#define V4L2_EVENT_VSYNC 1 -#define V4L2_EVENT_EOS 2 -#define V4L2_EVENT_CTRL 3 -#define V4L2_EVENT_FRAME_SYNC 4 -#define V4L2_EVENT_PRIVATE_START 0x08000000 - -/* Payload for V4L2_EVENT_VSYNC */ -struct v4l2_event_vsync { - /* Can be V4L2_FIELD_ANY, _NONE, _TOP or _BOTTOM */ - __u8 field; -} __attribute__ ((packed)); - -/* Payload for V4L2_EVENT_CTRL */ -#define V4L2_EVENT_CTRL_CH_VALUE (1 << 0) -#define V4L2_EVENT_CTRL_CH_FLAGS (1 << 1) - -struct v4l2_event_ctrl { - __u32 changes; - __u32 type; - union { - __s32 value; - __s64 value64; - }; - __u32 flags; - __s32 minimum; - __s32 maximum; - __s32 step; - __s32 default_value; -}; - -struct v4l2_event_frame_sync { - __u32 frame_sequence; -}; - -struct v4l2_event { - __u32 type; - union { - struct v4l2_event_vsync vsync; - struct v4l2_event_ctrl ctrl; - struct v4l2_event_frame_sync frame_sync; - __u8 data[64]; - } u; - __u32 pending; - __u32 sequence; - struct timespec timestamp; - __u32 id; - __u32 reserved[8]; -}; - -#define V4L2_EVENT_SUB_FL_SEND_INITIAL (1 << 0) -#define V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK (1 << 1) - -struct v4l2_event_subscription { - __u32 type; - __u32 id; - __u32 flags; - __u32 reserved[5]; -}; - -/* - * A D V A N C E D D E B U G G I N G - * - * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! - * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY! - */ - -/* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ - -#define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ -#define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */ -#define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ -#define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */ - -struct v4l2_dbg_match { - __u32 type; /* Match type */ - union { /* Match this chip, meaning determined by type */ - __u32 addr; - char name[32]; - }; -} __attribute__ ((packed)); - -struct v4l2_dbg_register { - struct v4l2_dbg_match match; - __u32 size; /* register size in bytes */ - __u64 reg; - __u64 val; -} __attribute__ ((packed)); - -/* VIDIOC_DBG_G_CHIP_IDENT */ -struct v4l2_dbg_chip_ident { - struct v4l2_dbg_match match; - __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */ - __u32 revision; /* chip revision, chip specific */ -} __attribute__ ((packed)); - -/** - * struct v4l2_create_buffers - VIDIOC_CREATE_BUFS argument - * @index: on return, index of the first created buffer - * @count: entry: number of requested buffers, - * return: number of created buffers - * @memory: buffer memory type - * @format: frame format, for which buffers are requested - * @reserved: future extensions - */ -struct v4l2_create_buffers { - __u32 index; - __u32 count; - enum v4l2_memory memory; - struct v4l2_format format; - __u32 reserved[8]; -}; - -/* - * I O C T L C O D E S F O R V I D E O D E V I C E S - * - */ -#define VIDIOC_QUERYCAP _IOR('V', 0, struct v4l2_capability) -#define VIDIOC_RESERVED _IO('V', 1) -#define VIDIOC_ENUM_FMT _IOWR('V', 2, struct v4l2_fmtdesc) -#define VIDIOC_G_FMT _IOWR('V', 4, struct v4l2_format) -#define VIDIOC_S_FMT _IOWR('V', 5, struct v4l2_format) -#define VIDIOC_REQBUFS _IOWR('V', 8, struct v4l2_requestbuffers) -#define VIDIOC_QUERYBUF _IOWR('V', 9, struct v4l2_buffer) -#define VIDIOC_G_FBUF _IOR('V', 10, struct v4l2_framebuffer) -#define VIDIOC_S_FBUF _IOW('V', 11, struct v4l2_framebuffer) -#define VIDIOC_OVERLAY _IOW('V', 14, int) -#define VIDIOC_QBUF _IOWR('V', 15, struct v4l2_buffer) -#define VIDIOC_DQBUF _IOWR('V', 17, struct v4l2_buffer) -#define VIDIOC_STREAMON _IOW('V', 18, int) -#define VIDIOC_STREAMOFF _IOW('V', 19, int) -#define VIDIOC_G_PARM _IOWR('V', 21, struct v4l2_streamparm) -#define VIDIOC_S_PARM _IOWR('V', 22, struct v4l2_streamparm) -#define VIDIOC_G_STD _IOR('V', 23, v4l2_std_id) -#define VIDIOC_S_STD _IOW('V', 24, v4l2_std_id) -#define VIDIOC_ENUMSTD _IOWR('V', 25, struct v4l2_standard) -#define VIDIOC_ENUMINPUT _IOWR('V', 26, struct v4l2_input) -#define VIDIOC_G_CTRL _IOWR('V', 27, struct v4l2_control) -#define VIDIOC_S_CTRL _IOWR('V', 28, struct v4l2_control) -#define VIDIOC_G_TUNER _IOWR('V', 29, struct v4l2_tuner) -#define VIDIOC_S_TUNER _IOW('V', 30, struct v4l2_tuner) -#define VIDIOC_G_AUDIO _IOR('V', 33, struct v4l2_audio) -#define VIDIOC_S_AUDIO _IOW('V', 34, struct v4l2_audio) -#define VIDIOC_QUERYCTRL _IOWR('V', 36, struct v4l2_queryctrl) -#define VIDIOC_QUERYMENU _IOWR('V', 37, struct v4l2_querymenu) -#define VIDIOC_G_INPUT _IOR('V', 38, int) -#define VIDIOC_S_INPUT _IOWR('V', 39, int) -#define VIDIOC_G_OUTPUT _IOR('V', 46, int) -#define VIDIOC_S_OUTPUT _IOWR('V', 47, int) -#define VIDIOC_ENUMOUTPUT _IOWR('V', 48, struct v4l2_output) -#define VIDIOC_G_AUDOUT _IOR('V', 49, struct v4l2_audioout) -#define VIDIOC_S_AUDOUT _IOW('V', 50, struct v4l2_audioout) -#define VIDIOC_G_MODULATOR _IOWR('V', 54, struct v4l2_modulator) -#define VIDIOC_S_MODULATOR _IOW('V', 55, struct v4l2_modulator) -#define VIDIOC_G_FREQUENCY _IOWR('V', 56, struct v4l2_frequency) -#define VIDIOC_S_FREQUENCY _IOW('V', 57, struct v4l2_frequency) -#define VIDIOC_CROPCAP _IOWR('V', 58, struct v4l2_cropcap) -#define VIDIOC_G_CROP _IOWR('V', 59, struct v4l2_crop) -#define VIDIOC_S_CROP _IOW('V', 60, struct v4l2_crop) -#define VIDIOC_G_JPEGCOMP _IOR('V', 61, struct v4l2_jpegcompression) -#define VIDIOC_S_JPEGCOMP _IOW('V', 62, struct v4l2_jpegcompression) -#define VIDIOC_QUERYSTD _IOR('V', 63, v4l2_std_id) -#define VIDIOC_TRY_FMT _IOWR('V', 64, struct v4l2_format) -#define VIDIOC_ENUMAUDIO _IOWR('V', 65, struct v4l2_audio) -#define VIDIOC_ENUMAUDOUT _IOWR('V', 66, struct v4l2_audioout) -#define VIDIOC_G_PRIORITY _IOR('V', 67, enum v4l2_priority) -#define VIDIOC_S_PRIORITY _IOW('V', 68, enum v4l2_priority) -#define VIDIOC_G_SLICED_VBI_CAP _IOWR('V', 69, struct v4l2_sliced_vbi_cap) -#define VIDIOC_LOG_STATUS _IO('V', 70) -#define VIDIOC_G_EXT_CTRLS _IOWR('V', 71, struct v4l2_ext_controls) -#define VIDIOC_S_EXT_CTRLS _IOWR('V', 72, struct v4l2_ext_controls) -#define VIDIOC_TRY_EXT_CTRLS _IOWR('V', 73, struct v4l2_ext_controls) -#if 1 -#define VIDIOC_ENUM_FRAMESIZES _IOWR('V', 74, struct v4l2_frmsizeenum) -#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR('V', 75, struct v4l2_frmivalenum) -#define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) -#define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) -#define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) -#endif - -#if 1 -/* Experimental, meant for debugging, testing and internal use. - Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined. - You must be root to use these ioctls. Never use these in applications! */ -#define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) -#define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) - -/* Experimental, meant for debugging, testing and internal use. - Never use this ioctl in applications! */ -#define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) -#endif - -#define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) -#define VIDIOC_ENUM_DV_PRESETS _IOWR('V', 83, struct v4l2_dv_enum_preset) -#define VIDIOC_S_DV_PRESET _IOWR('V', 84, struct v4l2_dv_preset) -#define VIDIOC_G_DV_PRESET _IOWR('V', 85, struct v4l2_dv_preset) -#define VIDIOC_QUERY_DV_PRESET _IOR('V', 86, struct v4l2_dv_preset) -#define VIDIOC_S_DV_TIMINGS _IOWR('V', 87, struct v4l2_dv_timings) -#define VIDIOC_G_DV_TIMINGS _IOWR('V', 88, struct v4l2_dv_timings) -#define VIDIOC_DQEVENT _IOR('V', 89, struct v4l2_event) -#define VIDIOC_SUBSCRIBE_EVENT _IOW('V', 90, struct v4l2_event_subscription) -#define VIDIOC_UNSUBSCRIBE_EVENT _IOW('V', 91, struct v4l2_event_subscription) - -/* Experimental, the below two ioctls may change over the next couple of kernel - versions */ -#define VIDIOC_CREATE_BUFS _IOWR('V', 92, struct v4l2_create_buffers) -#define VIDIOC_PREPARE_BUF _IOWR('V', 93, struct v4l2_buffer) - -/* Experimental selection API */ -#define VIDIOC_G_SELECTION _IOWR('V', 94, struct v4l2_selection) -#define VIDIOC_S_SELECTION _IOWR('V', 95, struct v4l2_selection) - -/* Reminder: when adding new ioctls please add support for them to - drivers/media/video/v4l2-compat-ioctl32.c as well! */ - -#define BASE_VIDIOC_PRIVATE 192 /* 192-255 are private */ - -#endif /* __LINUX_VIDEODEV2_H */ diff --git a/exynos4/hal/include/videodev2_exynos_camera.h b/exynos4/hal/include/videodev2_exynos_camera.h deleted file mode 100644 index 3001eee..0000000 --- a/exynos4/hal/include/videodev2_exynos_camera.h +++ /dev/null @@ -1,2076 +0,0 @@ -/* - * Video for Linux Two header file for samsung - * - * Copyright (C) 2009, Dongsoo Nathaniel Kim<dongsoo45.kim@samsung.com> - * - * This header file contains several v4l2 APIs to be proposed to v4l2 - * community and until bein accepted, will be used restrictly in Samsung's - * camera interface driver FIMC. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - */ - -#ifndef __LINUX_VIDEODEV2_SAMSUNG_H -#define __LINUX_VIDEODEV2_SAMSUNG_H - -/* Values for 'capabilities' field */ -/* Object detection device */ -#define V4L2_CAP_OBJ_RECOGNITION 0x10000000 -/* strobe control */ -#define V4L2_CAP_STROBE 0x20000000 - -#define V4L2_CID_FOCUS_MODE (V4L2_CID_CAMERA_CLASS_BASE+17) -/* Focus Methods */ -enum v4l2_focus_mode { - V4L2_FOCUS_MODE_AUTO = 0, - V4L2_FOCUS_MODE_MACRO = 1, - V4L2_FOCUS_MODE_MANUAL = 2, - V4L2_FOCUS_MODE_LASTP = 2, -}; - -#define V4L2_CID_ZOOM_MODE (V4L2_CID_CAMERA_CLASS_BASE+18) -/* Zoom Methods */ -enum v4l2_zoom_mode { - V4L2_ZOOM_MODE_CONTINUOUS = 0, - V4L2_ZOOM_MODE_OPTICAL = 1, - V4L2_ZOOM_MODE_DIGITAL = 2, - V4L2_ZOOM_MODE_LASTP = 2, -}; - -/* Exposure Methods */ -#define V4L2_CID_PHOTOMETRY (V4L2_CID_CAMERA_CLASS_BASE+19) -enum v4l2_photometry_mode { - V4L2_PHOTOMETRY_MULTISEG = 0, /*Multi Segment*/ - V4L2_PHOTOMETRY_CWA = 1, /*Centre Weighted Average*/ - V4L2_PHOTOMETRY_SPOT = 2, - V4L2_PHOTOMETRY_AFSPOT = 3, /*Spot metering on focused point*/ - V4L2_PHOTOMETRY_LASTP = V4L2_PHOTOMETRY_AFSPOT, -}; - -/* Manual exposure control items menu type: iris, shutter, iso */ -#define V4L2_CID_CAM_APERTURE (V4L2_CID_CAMERA_CLASS_BASE+20) -enum v4l2_aperture_mode { - APERTURE_F_AUTO = 0, - APERTURE_F_2_8, - APERTURE_F_3_2, - APERTURE_F_3_6, - APERTURE_F_4_0, - APERTURE_F_4_5, - APERTURE_F_5_1, - APERTURE_F_5_7, - APERTURE_F_6_4, - APERTURE_F_7_2, - APERTURE_MAX, -}; -#define V4L2_CID_CAM_SHUTTER (V4L2_CID_CAMERA_CLASS_BASE+21) -#define V4L2_CID_CAM_ISO (V4L2_CID_CAMERA_CLASS_BASE+22) - -/* Following CIDs are menu type */ -#define V4L2_CID_SCENEMODE (V4L2_CID_CAMERA_CLASS_BASE+23) -#define V4L2_CID_CAM_STABILIZE (V4L2_CID_CAMERA_CLASS_BASE+24) -#define V4L2_CID_CAM_MULTISHOT (V4L2_CID_CAMERA_CLASS_BASE+25) - -/* Control dynamic range */ -#define V4L2_CID_CAM_DR (V4L2_CID_CAMERA_CLASS_BASE+26) - -/* White balance preset control */ -#define V4L2_CID_WHITE_BALANCE_PRESET (V4L2_CID_CAMERA_CLASS_BASE+27) -#define V4L2_CID_CAM_SENSOR_FW_VER (V4L2_CID_CAMERA_CLASS_BASE + 28) -#define V4L2_CID_CAM_PHONE_FW_VER (V4L2_CID_CAMERA_CLASS_BASE + 29) - -/* CID extensions */ -#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0) -#define V4L2_CID_PADDR_Y (V4L2_CID_PRIVATE_BASE + 1) -#define V4L2_CID_PADDR_CB (V4L2_CID_PRIVATE_BASE + 2) -#define V4L2_CID_PADDR_CR (V4L2_CID_PRIVATE_BASE + 3) -#define V4L2_CID_PADDR_CBCR (V4L2_CID_PRIVATE_BASE + 4) -#define V4L2_CID_OVERLAY_AUTO (V4L2_CID_PRIVATE_BASE + 5) -#define V4L2_CID_OVERLAY_VADDR0 (V4L2_CID_PRIVATE_BASE + 6) -#define V4L2_CID_OVERLAY_VADDR1 (V4L2_CID_PRIVATE_BASE + 7) -#define V4L2_CID_OVERLAY_VADDR2 (V4L2_CID_PRIVATE_BASE + 8) -#define V4L2_CID_OVLY_MODE (V4L2_CID_PRIVATE_BASE + 9) -#define V4L2_CID_DST_INFO (V4L2_CID_PRIVATE_BASE + 10) -/* UMP secure id control */ -#define V4L2_CID_GET_UMP_SECURE_ID (V4L2_CID_PRIVATE_BASE + 11) -#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_IMAGE_EFFECT_FN (V4L2_CID_PRIVATE_BASE + 16) -#define V4L2_CID_IMAGE_EFFECT_APPLY (V4L2_CID_PRIVATE_BASE + 17) -#define V4L2_CID_IMAGE_EFFECT_CB (V4L2_CID_PRIVATE_BASE + 18) -#define V4L2_CID_IMAGE_EFFECT_CR (V4L2_CID_PRIVATE_BASE + 19) -#define V4L2_CID_RESERVED_MEM_BASE_ADDR (V4L2_CID_PRIVATE_BASE + 20) -#define V4L2_CID_FIMC_VERSION (V4L2_CID_PRIVATE_BASE + 21) - -#define V4L2_CID_CACHE_FLUSH (V4L2_CID_PRIVATE_BASE + 61) -#define V4L2_CID_RESERVED_MEM_SIZE (V4L2_CID_PRIVATE_BASE + 63) -#define V4L2_CID_STREAM_PAUSE (V4L2_CID_PRIVATE_BASE + 53) -#define V4L2_CID_CACHE_FLUSH (V4L2_CID_PRIVATE_BASE + 61) -#define V4L2_CID_RESERVED_MEM_SIZE (V4L2_CID_PRIVATE_BASE + 63) - -/* CID Extensions for camera sensor operations */ -#define V4L2_CID_CAM_PREVIEW_ONOFF (V4L2_CID_PRIVATE_BASE + 64) -#define V4L2_CID_CAM_CAPTURE (V4L2_CID_PRIVATE_BASE + 65) -/* #define V4L2_CID_CAM_JPEG_MEMSIZE (V4L2_CID_PRIVATE_BASE + 66) */ - -#define V4L2_CID_CAM_DATE_INFO_YEAR (V4L2_CID_PRIVATE_BASE + 14) -#define V4L2_CID_CAM_DATE_INFO_MONTH (V4L2_CID_PRIVATE_BASE + 15) -#define V4L2_CID_CAM_DATE_INFO_DATE (V4L2_CID_PRIVATE_BASE + 22) -#define V4L2_CID_CAM_SENSOR_VER (V4L2_CID_PRIVATE_BASE + 23) -#define V4L2_CID_CAM_FW_MINOR_VER (V4L2_CID_PRIVATE_BASE + 24) -#define V4L2_CID_CAM_FW_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 25) -#define V4L2_CID_CAM_PRM_MINOR_VER (V4L2_CID_PRIVATE_BASE + 26) -#define V4L2_CID_CAM_PRM_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 27) -#define V4L2_CID_CAM_FW_VER (V4L2_CID_PRIVATE_BASE + 28) -#define V4L2_CID_CAM_SET_FW_ADDR (V4L2_CID_PRIVATE_BASE + 29) -#define V4L2_CID_CAM_SET_FW_SIZE (V4L2_CID_PRIVATE_BASE + 30) -#define V4L2_CID_CAM_UPDATE_FW (V4L2_CID_PRIVATE_BASE + 31) -enum v4l2_firmware_mode { - FW_MODE_NONE, - FW_MODE_VERSION, - FW_MODE_UPDATE, - FW_MODE_DUMP, -}; - -#define V4L2_CID_CAM_JPEG_MAIN_SIZE (V4L2_CID_PRIVATE_BASE + 32) -#define V4L2_CID_CAM_JPEG_MAIN_OFFSET (V4L2_CID_PRIVATE_BASE + 33) -#define V4L2_CID_CAM_JPEG_THUMB_SIZE (V4L2_CID_PRIVATE_BASE + 34) -#define V4L2_CID_CAM_JPEG_THUMB_OFFSET (V4L2_CID_PRIVATE_BASE + 35) -#define V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET (V4L2_CID_PRIVATE_BASE + 36) -#define V4L2_CID_CAM_JPEG_QUALITY (V4L2_CID_PRIVATE_BASE + 37) -#define V4L2_CID_CAM_SENSOR_MAKER (V4L2_CID_PRIVATE_BASE + 38) -#define V4L2_CID_CAM_SENSOR_OPTICAL (V4L2_CID_PRIVATE_BASE + 39) -#define V4L2_CID_CAM_AF_VER_LOW (V4L2_CID_PRIVATE_BASE + 40) -#define V4L2_CID_CAM_AF_VER_HIGH (V4L2_CID_PRIVATE_BASE + 41) -#define V4L2_CID_CAM_GAMMA_RG_LOW (V4L2_CID_PRIVATE_BASE + 42) -#define V4L2_CID_CAM_GAMMA_RG_HIGH (V4L2_CID_PRIVATE_BASE + 43) -#define V4L2_CID_CAM_GAMMA_BG_LOW (V4L2_CID_PRIVATE_BASE + 44) -#define V4L2_CID_CAM_GAMMA_BG_HIGH (V4L2_CID_PRIVATE_BASE + 45) -#define V4L2_CID_CAM_DUMP_FW (V4L2_CID_PRIVATE_BASE + 46) -#define V4L2_CID_CAM_GET_DUMP_SIZE (V4L2_CID_PRIVATE_BASE + 47) -#define V4L2_CID_CAMERA_VT_MODE (V4L2_CID_PRIVATE_BASE + 48) -enum cam_vt_mode { - CAM_VT_MODE_NONE , - CAM_VT_MODE_3G , - CAM_VT_MODE_VOIP , -}; - -#define V4L2_CID_CAMERA_VGA_BLUR (V4L2_CID_PRIVATE_BASE + 49) -#define V4L2_CID_CAMERA_CAPTURE (V4L2_CID_PRIVATE_BASE + 50) -#define V4L2_CID_CAMERA_HDR (V4L2_CID_PRIVATE_BASE + 51) -#define V4L2_CID_CAMERA_HYBRID (V4L2_CID_PRIVATE_BASE + 52) - -#define V4L2_CID_MAIN_SW_DATE_INFO_YEAR (V4L2_CID_PRIVATE_BASE + 54) -#define V4L2_CID_MAIN_SW_DATE_INFO_MONTH (V4L2_CID_PRIVATE_BASE + 55) -#define V4L2_CID_MAIN_SW_DATE_INFO_DATE (V4L2_CID_PRIVATE_BASE + 56) -#define V4L2_CID_MAIN_SW_FW_MINOR_VER (V4L2_CID_PRIVATE_BASE + 57) -#define V4L2_CID_MAIN_SW_FW_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 58) -#define V4L2_CID_MAIN_SW_PRM_MINOR_VER (V4L2_CID_PRIVATE_BASE + 59) -#define V4L2_CID_MAIN_SW_PRM_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 60) -#define V4L2_CID_CAMERA_HYBRID_CAPTURE (V4L2_CID_PRIVATE_BASE + 62) -#define V4L2_CID_CAMERA_FAST_MODE (V4L2_CID_PRIVATE_BASE + 66) -enum cam_fast_mode { - FAST_MODE_SUBSAMPLING_NONE , - FAST_MODE_SUBSAMPLING_HALF , - FAST_MODE_SUBSAMPLING_QUARTER , -}; -#define V4L2_CID_CAMERA_POSTVIEW_CAPTURE (V4L2_CID_PRIVATE_BASE + 67) -#define V4L2_CID_CAMERA_CAPTURE_MODE (V4L2_CID_PRIVATE_BASE + 68) -#define V4L2_CID_CAMERA_YUV_CAPTURE (V4L2_CID_PRIVATE_BASE + 69) - -#define V4L2_CID_FIMC_IS_BASE (V4L2_CTRL_CLASS_CAMERA | 0x1000) -#define V4L2_CID_FIMC_IS_TUNE_BASE (V4L2_CTRL_CLASS_CAMERA | 0x2000) -#define V4L2_CID_FIMC_IS_ISP_DBG_BASE (V4L2_CTRL_CLASS_CAMERA | 0x3000) - -#define V4L2_CID_IS_LOAD_FW (V4L2_CID_FIMC_IS_BASE + 10) -#define V4L2_CID_IS_INIT_PARAM (V4L2_CID_FIMC_IS_BASE + 11) -#define V4L2_CID_IS_RESET (V4L2_CID_FIMC_IS_BASE + 12) -#define V4L2_CID_IS_S_POWER (V4L2_CID_FIMC_IS_BASE + 13) -enum is_set_power { - IS_POWER_OFF, - IS_POWER_ON -}; - -#define V4L2_CID_IS_S_STREAM (V4L2_CID_FIMC_IS_BASE + 14) -enum is_set_stream { - IS_DISABLE_STREAM, - IS_ENABLE_STREAM -}; - -#define V4L2_CID_IS_S_SCENARIO_MODE (V4L2_CID_FIMC_IS_BASE + 15) -#define V4L2_CID_IS_S_FORMAT_SCENARIO (V4L2_CID_FIMC_IS_BASE + 16) -enum scenario_mode { - IS_MODE_PREVIEW_STILL, - IS_MODE_PREVIEW_VIDEO, - IS_MODE_CAPTURE_STILL, - IS_MODE_CAPTURE_VIDEO, - IS_MODE_MAX -}; - -/* global */ -#define V4L2_CID_IS_CAMERA_SHOT_MODE_NORMAL (V4L2_CID_FIMC_IS_BASE + 400) -/* value : 1 : single shot , >=2 : continuous shot */ - -#define V4L2_CID_IS_CAMERA_SENSOR_NUM (V4L2_CID_FIMC_IS_BASE + 201) - -#define V4L2_CID_IS_CAMERA_FOCUS_MODE (V4L2_CID_FIMC_IS_BASE + 401) -enum is_focus_mode { - IS_FOCUS_MODE_AUTO, - IS_FOCUS_MODE_MACRO, - IS_FOCUS_MODE_INFINITY, - IS_FOCUS_MODE_CONTINUOUS, - IS_FOCUS_MODE_TOUCH, - IS_FOCUS_MODE_FACEDETECT, - IS_FOCUS_MODE_IDLE, - IS_FOCUS_MODE_MAX, -}; - -#define V4L2_CID_IS_CAMERA_FLASH_MODE (V4L2_CID_FIMC_IS_BASE + 402) -enum is_flash_mode { - IS_FLASH_MODE_OFF, - IS_FLASH_MODE_AUTO, - IS_FLASH_MODE_AUTO_REDEYE, - IS_FLASH_MODE_ON, - IS_FLASH_MODE_TORCH, - IS_FLASH_MODE_MAX -}; - -#define V4L2_CID_IS_CAMERA_AWB_MODE (V4L2_CID_FIMC_IS_BASE + 403) -enum is_awb_mode { - IS_AWB_AUTO, - IS_AWB_DAYLIGHT, - IS_AWB_CLOUDY, - IS_AWB_TUNGSTEN, - IS_AWB_FLUORESCENT, - IS_AWB_MAX -}; - -#define V4L2_CID_IS_CAMERA_IMAGE_EFFECT (V4L2_CID_FIMC_IS_BASE + 404) -enum is_image_effect { - IS_IMAGE_EFFECT_DISABLE, - IS_IMAGE_EFFECT_MONOCHROME, - IS_IMAGE_EFFECT_NEGATIVE_MONO, - IS_IMAGE_EFFECT_NEGATIVE_COLOR, - IS_IMAGE_EFFECT_SEPIA, - IS_IMAGE_EFFECT_SEPIA_CB, - IS_IMAGE_EFFECT_SEPIA_CR, - IS_IMAGE_EFFECT_NEGATIVE, - IS_IMAGE_EFFECT_ARTFREEZE, - IS_IMAGE_EFFECT_EMBOSSING, - IS_IMAGE_EFFECT_SILHOUETTE, - IS_IMAGE_EFFECT_MAX -}; - -#define V4L2_CID_IS_CAMERA_ISO (V4L2_CID_FIMC_IS_BASE + 405) -enum is_iso { - IS_ISO_AUTO, - IS_ISO_50, - IS_ISO_100, - IS_ISO_200, - IS_ISO_400, - IS_ISO_800, - IS_ISO_1600, - IS_ISO_MAX -}; - -#define V4L2_CID_IS_CAMERA_CONTRAST (V4L2_CID_FIMC_IS_BASE + 406) -enum is_contrast { - IS_CONTRAST_AUTO, - IS_CONTRAST_MINUS_2, - IS_CONTRAST_MINUS_1, - IS_CONTRAST_DEFAULT, - IS_CONTRAST_PLUS_1, - IS_CONTRAST_PLUS_2, - IS_CONTRAST_MAX -}; - -#define V4L2_CID_IS_CAMERA_SATURATION (V4L2_CID_FIMC_IS_BASE + 407) -enum is_saturation { - IS_SATURATION_MINUS_2, - IS_SATURATION_MINUS_1, - IS_SATURATION_DEFAULT, - IS_SATURATION_PLUS_1, - IS_SATURATION_PLUS_2, - IS_SATURATION_MAX -}; - -#define V4L2_CID_IS_CAMERA_SHARPNESS (V4L2_CID_FIMC_IS_BASE + 408) -enum is_sharpness { - IS_SHARPNESS_MINUS_2, - IS_SHARPNESS_MINUS_1, - IS_SHARPNESS_DEFAULT, - IS_SHARPNESS_PLUS_1, - IS_SHARPNESS_PLUS_2, - IS_SHARPNESS_MAX -}; - -#define V4L2_CID_IS_CAMERA_EXPOSURE (V4L2_CID_FIMC_IS_BASE + 409) -enum is_exposure { - IS_EXPOSURE_MINUS_4, - IS_EXPOSURE_MINUS_3, - IS_EXPOSURE_MINUS_2, - IS_EXPOSURE_MINUS_1, - IS_EXPOSURE_DEFAULT, - IS_EXPOSURE_PLUS_1, - IS_EXPOSURE_PLUS_2, - IS_EXPOSURE_PLUS_3, - IS_EXPOSURE_PLUS_4, - IS_EXPOSURE_MAX -}; - -#define V4L2_CID_IS_CAMERA_BRIGHTNESS (V4L2_CID_FIMC_IS_BASE + 410) -enum is_brightness { - IS_BRIGHTNESS_MINUS_2, - IS_BRIGHTNESS_MINUS_1, - IS_BRIGHTNESS_DEFAULT, - IS_BRIGHTNESS_PLUS_1, - IS_BRIGHTNESS_PLUS_2, - IS_BRIGHTNESS_MAX -}; - -#define V4L2_CID_IS_CAMERA_HUE (V4L2_CID_FIMC_IS_BASE + 411) -enum is_hue { - IS_HUE_MINUS_2, - IS_HUE_MINUS_1, - IS_HUE_DEFAULT, - IS_HUE_PLUS_1, - IS_HUE_PLUS_2, - IS_HUE_MAX -}; - -#define V4L2_CID_IS_CAMERA_METERING (V4L2_CID_FIMC_IS_BASE + 412) -enum is_metering { - IS_METERING_AVERAGE, - IS_METERING_SPOT, - IS_METERING_MATRIX, - IS_METERING_CENTER, - IS_METERING_MAX -}; -#define V4L2_CID_IS_CAMERA_METERING_POSITION_X (V4L2_CID_FIMC_IS_BASE + 500) -#define V4L2_CID_IS_CAMERA_METERING_POSITION_Y (V4L2_CID_FIMC_IS_BASE + 501) -#define V4L2_CID_IS_CAMERA_METERING_WINDOW_X (V4L2_CID_FIMC_IS_BASE + 502) -#define V4L2_CID_IS_CAMERA_METERING_WINDOW_Y (V4L2_CID_FIMC_IS_BASE + 503) - -#define V4L2_CID_IS_CAMERA_AFC_MODE (V4L2_CID_FIMC_IS_BASE + 413) -enum is_afc_mode { - IS_AFC_DISABLE, - IS_AFC_AUTO, - IS_AFC_MANUAL_50HZ, - IS_AFC_MANUAL_60HZ, - IS_AFC_MAX -}; - -#define V4L2_CID_IS_AWB_LOCK_UNLOCK (V4L2_CID_FIMC_IS_BASE + 496) -enum is_awb_lock_unlock { - IS_AWB_LOCK, - IS_AWB_UNLOCK, - IS_AWB_LOCK_UNLOCK_MAX -}; - -#define V4L2_CID_IS_AE_LOCK_UNLOCK (V4L2_CID_FIMC_IS_BASE + 497) -enum is_ae_lock_unlock { - IS_AE_LOCK, - IS_AE_UNLOCK, - IS_AE_LOCK_UNLOCK_MAX -}; - -#define V4L2_CID_IS_FD_GET_FACE_COUNT (V4L2_CID_FIMC_IS_BASE + 600) -#define V4L2_CID_IS_FD_GET_FACE_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 601) -#define V4L2_CID_IS_FD_GET_FACE_CONFIDENCE (V4L2_CID_FIMC_IS_BASE + 602) -#define V4L2_CID_IS_FD_GET_FACE_SMILE_LEVEL (V4L2_CID_FIMC_IS_BASE + 603) -#define V4L2_CID_IS_FD_GET_FACE_BLINK_LEVEL (V4L2_CID_FIMC_IS_BASE + 604) -#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 605) -#define V4L2_CID_IS_FD_GET_FACE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 606) -#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 607) -#define V4L2_CID_IS_FD_GET_FACE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 608) -#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 609) -#define V4L2_CID_IS_FD_GET_LEFT_EYE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 610) -#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 611) -#define V4L2_CID_IS_FD_GET_LEFT_EYE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 612) -#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 613) -#define V4L2_CID_IS_FD_GET_RIGHT_EYE_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 614) -#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 615) -#define V4L2_CID_IS_FD_GET_RIGHT_EYE_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 616) -#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_X (V4L2_CID_FIMC_IS_BASE + 617) -#define V4L2_CID_IS_FD_GET_MOUTH_TOPLEFT_Y (V4L2_CID_FIMC_IS_BASE + 618) -#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_X (V4L2_CID_FIMC_IS_BASE + 619) -#define V4L2_CID_IS_FD_GET_MOUTH_BOTTOMRIGHT_Y (V4L2_CID_FIMC_IS_BASE + 620) -#define V4L2_CID_IS_FD_GET_ANGLE (V4L2_CID_FIMC_IS_BASE + 621) -#define V4L2_CID_IS_FD_GET_YAW_ANGLE (V4L2_CID_FIMC_IS_BASE + 622) -#define V4L2_CID_IS_FD_GET_NEXT (V4L2_CID_FIMC_IS_BASE + 623) -#define V4L2_CID_IS_FD_GET_DATA (V4L2_CID_FIMC_IS_BASE + 624) - -#define V4L2_CID_IS_FD_SET_MAX_FACE_NUMBER (V4L2_CID_FIMC_IS_BASE + 650) -#define V4L2_CID_IS_FD_SET_ROLL_ANGLE (V4L2_CID_FIMC_IS_BASE + 651) - -enum is_fd_roll_angle { - /* 0, 45, 0, -45 */ - IS_FD_ROLL_ANGLE_BASIC = 0, - /* 0, 30, 0, -30, 0, 45, 0, -45 */ - IS_FD_ROLL_ANGLE_PRECISE_BASIC = 1, - /* 0, 90, 0, -90 */ - IS_FD_ROLL_ANGLE_SIDES = 2, - /* 0, 90, 0, -90 0, 45, 0, -45 */ - IS_FD_ROLL_ANGLE_PRECISE_SIDES = 3, - /* 0, 90, 0, -90, 0, 180 */ - IS_FD_ROLL_ANGLE_FULL = 4, - /* 0, 90, 0, -90, 0, 180, 0, 135, 0, -135 */ - IS_FD_ROLL_ANGLE_PRECISE_FULL = 5, -}; - -#define V4L2_CID_IS_FD_SET_YAW_ANGLE (V4L2_CID_FIMC_IS_BASE + 652) -enum is_fd_yaw_angle { - IS_FD_YAW_ANGLE_0 = 0, - IS_FD_YAW_ANGLE_45 = 1, - IS_FD_YAW_ANGLE_90 = 2, - IS_FD_YAW_ANGLE_45_90 = 3, -}; - -#define V4L2_CID_IS_FD_SET_SMILE_MODE (V4L2_CID_FIMC_IS_BASE + 653) -enum is_fd_smile_mode { - IS_FD_SMILE_MODE_DISABLE = 0, - IS_FD_SMILE_MODE_ENABLE = 1, -}; - -#define V4L2_CID_IS_FD_SET_BLINK_MODE (V4L2_CID_FIMC_IS_BASE + 654) -enum is_fd_blink_mode { - IS_FD_BLINK_MODE_DISABLE = 0, - IS_FD_BLINK_MODE_ENABLE = 1, -}; - -#define V4L2_CID_IS_FD_SET_EYE_DETECT_MODE (V4L2_CID_FIMC_IS_BASE + 655) -enum is_fd_eye_detect_mode { - IS_FD_EYE_DETECT_DISABLE = 0, - IS_FD_EYE_DETECT_ENABLE = 1, -}; - -#define V4L2_CID_IS_FD_SET_MOUTH_DETECT_MODE (V4L2_CID_FIMC_IS_BASE + 656) -enum is_fd_mouth_detect_mode { - IS_FD_MOUTH_DETECT_DISABLE = 0, - IS_FD_MOUTH_DETECT_ENABLE = 1, -}; - -#define V4L2_CID_IS_FD_SET_ORIENTATION_MODE (V4L2_CID_FIMC_IS_BASE + 657) -enum is_fd_orientation_mode { - IS_FD_ORIENTATION_DISABLE = 0, - IS_FD_ORIENTATION_ENABLE = 1, -}; - -#define V4L2_CID_IS_FD_SET_ORIENTATION (V4L2_CID_FIMC_IS_BASE + 658) -#define V4L2_CID_IS_FD_SET_DATA_ADDRESS (V4L2_CID_FIMC_IS_BASE + 659) - -#define V4L2_CID_IS_SET_ISP (V4L2_CID_FIMC_IS_BASE + 440) -enum is_isp_bypass_mode { - IS_ISP_BYPASS_DISABLE, - IS_ISP_BYPASS_ENABLE, - IS_ISP_BYPASS_MAX -}; - -#define V4L2_CID_IS_SET_DRC (V4L2_CID_FIMC_IS_BASE + 441) -enum is_drc_bypass_mode { - IS_DRC_BYPASS_DISABLE, - IS_DRC_BYPASS_ENABLE, - IS_DRC_BYPASS_MAX -}; - -#define V4L2_CID_IS_SET_FD (V4L2_CID_FIMC_IS_BASE + 442) -enum is_fd_bypass_mode { - IS_FD_BYPASS_DISABLE, - IS_FD_BYPASS_ENABLE, - IS_FD_BYPASS_MAX -}; - -#define V4L2_CID_IS_SET_ODC (V4L2_CID_FIMC_IS_BASE + 443) -enum is_odc_bypass_mode { - IS_ODC_BYPASS_DISABLE, - IS_ODC_BYPASS_ENABLE, - IS_ODC_BYPASS_MAX -}; - -#define V4L2_CID_IS_SET_DIS (V4L2_CID_FIMC_IS_BASE + 444) -enum is_dis_bypass_mode { - IS_DIS_BYPASS_DISABLE, - IS_DIS_BYPASS_ENABLE, - IS_DIS_BYPASS_MAX -}; - -#define V4L2_CID_IS_SET_3DNR (V4L2_CID_FIMC_IS_BASE + 445) -enum is_tdnr_bypass_mode { - IS_TDNR_BYPASS_DISABLE, - IS_TDNR_BYPASS_ENABLE, - IS_TDNR_BYPASS_MAX -}; - -#define V4L2_CID_IS_SET_SCALERC (V4L2_CID_FIMC_IS_BASE + 446) -enum is_scalerc_bypass_mode { - IS_SCALERC_BYPASS_DISABLE, - IS_SCALERC_BYPASS_ENABLE, - IS_SCALERC_BYPASS_MAX -}; - -#define V4L2_CID_IS_SET_SCALERP (V4L2_CID_FIMC_IS_BASE + 446) -enum is_scalerp_bypass_mode { - IS_SCALERP_BYPASS_DISABLE, - IS_SCALERP_BYPASS_ENABLE, - IS_SCALERP_BYPASS_MAX -}; - -#define V4L2_CID_IS_ROTATION_MODE (V4L2_CID_FIMC_IS_BASE + 450) -enum is_rotation_mode { - IS_ROTATION_0, - IS_ROTATION_90, - IS_ROTATION_180, - IS_ROTATION_270, - IS_ROTATION_MAX -}; - -#define V4L2_CID_IS_3DNR_1ST_FRAME_MODE (V4L2_CID_FIMC_IS_BASE + 451) -enum is_tdnr_1st_frame_mode { - IS_TDNR_1ST_FRAME_NOPROCESSING, - IS_TDNR_1ST_FRAME_2DNR, - IS_TDNR_MAX -}; - -#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_X (V4L2_CID_FIMC_IS_BASE + 452) -#define V4L2_CID_IS_CAMERA_OBJECT_POSITION_Y (V4L2_CID_FIMC_IS_BASE + 453) -#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_X (V4L2_CID_FIMC_IS_BASE + 454) -#define V4L2_CID_IS_CAMERA_WINDOW_SIZE_Y (V4L2_CID_FIMC_IS_BASE + 455) - -#define V4L2_CID_IS_CAMERA_EXIF_EXPTIME (V4L2_CID_FIMC_IS_BASE + 456) -#define V4L2_CID_IS_CAMERA_EXIF_FLASH (V4L2_CID_FIMC_IS_BASE + 457) -#define V4L2_CID_IS_CAMERA_EXIF_ISO (V4L2_CID_FIMC_IS_BASE + 458) -#define V4L2_CID_IS_CAMERA_EXIF_SHUTTERSPEED (V4L2_CID_FIMC_IS_BASE + 459) -#define V4L2_CID_IS_CAMERA_EXIF_BRIGHTNESS (V4L2_CID_FIMC_IS_BASE + 460) - -#define V4L2_CID_IS_CAMERA_ISP_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 461) -enum is_isp_sel_input { - IS_ISP_INPUT_OTF, - IS_ISP_INPUT_DMA1, - IS_ISP_INPUT_DMA2, - IS_ISP_INPUT_DMA12, - IS_ISP_INPUT_MAX -}; - -#define V4L2_CID_IS_CAMERA_ISP_SEL_OUTPUT (V4L2_CID_FIMC_IS_BASE + 462) -enum is_isp_sel_output { - IS_ISP_OUTPUT_OTF, - IS_ISP_OUTPUT_DMA1, - IS_ISP_OUTPUT_DMA2, - IS_ISP_OUTPUT_DMA12, - IS_ISP_OUTPUT_OTF_DMA1, - IS_ISP_OUTPUT_OTF_DMA2, - IS_ISP_OUTPUT_OTF_DMA12, - IS_ISP_OUTPUT_MAX -}; - -#define V4L2_CID_IS_CAMERA_DRC_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 463) -enum is_drc_sel_input { - IS_DRC_INPUT_OTF, - IS_DRC_INPUT_DMA, - IS_DRC_INPUT_MAX -}; - -#define V4L2_CID_IS_CAMERA_FD_SEL_INPUT (V4L2_CID_FIMC_IS_BASE + 464) -enum is_fd_sel_input { - IS_FD_INPUT_OTF, - IS_FD_INPUT_DMA, - IS_FD_INPUT_MAX -}; - -#define V4L2_CID_IS_CAMERA_INIT_WIDTH (V4L2_CID_FIMC_IS_BASE + 465) -#define V4L2_CID_IS_CAMERA_INIT_HEIGHT (V4L2_CID_FIMC_IS_BASE + 466) - -#define V4L2_CID_IS_CMD_ISP (V4L2_CID_FIMC_IS_BASE + 467) -enum is_isp_cmd_mode { - IS_ISP_COMMAND_STOP, - IS_ISP_COMMAND_START, - IS_ISP_COMMAND_MAX -}; - -#define V4L2_CID_IS_CMD_DRC (V4L2_CID_FIMC_IS_BASE + 468) -enum is_drc_cmd_mode { - IS_DRC_COMMAND_STOP, - IS_DRC_COMMAND_START, - IS_DRC_COMMAND_MAX -}; - -#define V4L2_CID_IS_CMD_FD (V4L2_CID_FIMC_IS_BASE + 469) -enum is_fd_cmd_mode { - IS_FD_COMMAND_STOP, - IS_FD_COMMAND_START, - IS_FD_COMMAND_MAX -}; - -#define V4L2_CID_IS_CMD_ODC (V4L2_CID_FIMC_IS_BASE + 470) -enum is_odc_cmd_mode { - IS_ODC_COMMAND_STOP, - IS_ODC_COMMAND_START, - IS_ODC_COMMAND_MAX -}; - -#define V4L2_CID_IS_CMD_DIS (V4L2_CID_FIMC_IS_BASE + 471) -enum is_dis_cmd_mode { - IS_DIS_COMMAND_STOP, - IS_DIS_COMMAND_START, - IS_DIS_COMMAND_MAX -}; - -#define V4L2_CID_IS_CMD_TDNR (V4L2_CID_FIMC_IS_BASE + 472) -enum is_tdnr_cmd_mode { - IS_TDNR_COMMAND_STOP, - IS_TDNR_COMMAND_START, - IS_TDNR_COMMAND_MAX -}; - -#define V4L2_CID_IS_CMD_SCALERC (V4L2_CID_FIMC_IS_BASE + 473) -enum is_scalerc_cmd_mode { - IS_SCALERC_COMMAND_STOP, - IS_SCALERC_COMMAND_START, - IS_SCALERC_COMMAND_MAX -}; - -#define V4L2_CID_IS_CMD_SCALERP (V4L2_CID_FIMC_IS_BASE + 474) -enum is_scalerp_cmd_mode { - IS_SCALERP_COMMAND_STOP, - IS_SCALERP_COMMAND_START, - IS_SCALERP_COMMAND_MAX -}; - -#define V4L2_CID_IS_GET_SENSOR_OFFSET_X (V4L2_CID_FIMC_IS_BASE + 480) -#define V4L2_CID_IS_GET_SENSOR_OFFSET_Y (V4L2_CID_FIMC_IS_BASE + 481) -#define V4L2_CID_IS_GET_SENSOR_WIDTH (V4L2_CID_FIMC_IS_BASE + 482) -#define V4L2_CID_IS_GET_SENSOR_HEIGHT (V4L2_CID_FIMC_IS_BASE + 483) - -#define V4L2_CID_IS_GET_FRAME_VALID (V4L2_CID_FIMC_IS_BASE + 484) -#define V4L2_CID_IS_SET_FRAME_VALID (V4L2_CID_FIMC_IS_BASE + 485) -#define V4L2_CID_IS_GET_FRAME_BADMARK (V4L2_CID_FIMC_IS_BASE + 486) -#define V4L2_CID_IS_SET_FRAME_BADMARK (V4L2_CID_FIMC_IS_BASE + 487) -#define V4L2_CID_IS_GET_FRAME_CAPTURED (V4L2_CID_FIMC_IS_BASE + 488) -#define V4L2_CID_IS_SET_FRAME_CAPTURED (V4L2_CID_FIMC_IS_BASE + 489) -#define V4L2_CID_IS_SET_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 490) -#define V4L2_CID_IS_GET_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 491) -#define V4L2_CID_IS_CLEAR_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 492) -#define V4L2_CID_IS_GET_LOSTED_FRAME_NUMBER (V4L2_CID_FIMC_IS_BASE + 493) -#define V4L2_CID_IS_ISP_DMA_BUFFER_NUM (V4L2_CID_FIMC_IS_BASE + 494) -#define V4L2_CID_IS_ISP_DMA_BUFFER_ADDRESS (V4L2_CID_FIMC_IS_BASE + 495) - -#define V4L2_CID_IS_ZOOM_STATE (V4L2_CID_FIMC_IS_BASE + 660) -#define V4L2_CID_IS_ZOOM_MAX_LEVEL (V4L2_CID_FIMC_IS_BASE + 661) -#define V4L2_CID_IS_ZOOM (V4L2_CID_FIMC_IS_BASE + 662) -#define V4L2_CID_IS_FW_DEBUG_REGION_ADDR (V4L2_CID_FIMC_IS_BASE + 663) - -#define V4L2_CID_IS_TUNE_SEL_ENTRY (V4L2_CID_FIMC_IS_TUNE_BASE) -#define V4L2_CID_IS_TUNE_SENSOR_EXPOSURE (V4L2_CID_FIMC_IS_TUNE_BASE + 1) -#define V4L2_CID_IS_TUNE_SENSOR_ANALOG_GAIN (V4L2_CID_FIMC_IS_TUNE_BASE + 2) -#define V4L2_CID_IS_TUNE_SENSOR_FRAME_RATE (V4L2_CID_FIMC_IS_TUNE_BASE + 3) -#define V4L2_CID_IS_TUNE_SENSOR_ACTUATOR_POS (V4L2_CID_FIMC_IS_TUNE_BASE + 4) - -enum v4l2_blur { - BLUR_LEVEL_0 = 0, - BLUR_LEVEL_1, - BLUR_LEVEL_2, - BLUR_LEVEL_3, - BLUR_LEVEL_MAX, -}; - -#if 1 -#define V4L2_CID_CAMERA_SCENE_MODE (V4L2_CID_PRIVATE_BASE+70) -enum v4l2_scene_mode { - SCENE_MODE_BASE, - SCENE_MODE_NONE, - SCENE_MODE_PORTRAIT, - SCENE_MODE_NIGHTSHOT, - SCENE_MODE_BACK_LIGHT, - SCENE_MODE_LANDSCAPE, - SCENE_MODE_SPORTS, - SCENE_MODE_PARTY_INDOOR, - SCENE_MODE_BEACH_SNOW, - SCENE_MODE_SUNSET, - SCENE_MODE_DUSK_DAWN, - SCENE_MODE_FALL_COLOR, - SCENE_MODE_FIREWORKS, - SCENE_MODE_TEXT, - SCENE_MODE_CANDLE_LIGHT, - SCENE_MODE_LOW_LIGHT, - SCENE_MODE_MAX, -}; - -#define V4L2_CID_CAMERA_FLASH_MODE (V4L2_CID_PRIVATE_BASE+71) -enum v4l2_flash_mode { - FLASH_MODE_BASE, - FLASH_MODE_OFF, - FLASH_MODE_AUTO, - FLASH_MODE_ON, - FLASH_MODE_TORCH, - FLASH_MODE_RED_EYE, - FLASH_MODE_FILL_IN, - FLASH_MODE_SLOW_SYNC, - FLASH_MODE_RED_EYE_FIX, - FLASH_MODE_MAX, -}; - -#define V4L2_CID_CAMERA_BRIGHTNESS (V4L2_CID_PRIVATE_BASE+72) -enum v4l2_ev_mode { - EV_MINUS_4 = -4, - EV_MINUS_3 = -3, - EV_MINUS_2 = -2, - EV_MINUS_1 = -1, - EV_DEFAULT = 0, - EV_PLUS_1 = 1, - EV_PLUS_2 = 2, - EV_PLUS_3 = 3, - EV_PLUS_4 = 4, - EV_MAX, - EV_MAX_V4L2 = EV_MAX, -}; - -enum v4l2_exposure { - EXPOSURE_MINUS_6 = -6, - EXPOSURE_MINUS_5 = -5, - EXPOSURE_MINUS_4 = -4, - EXPOSURE_MINUS_3 = -3, - EXPOSURE_MINUS_2 = -2, - EXPOSURE_MINUS_1 = -1, - EXPOSURE_DEFAULT = 0, - EXPOSURE_PLUS_1 = 1, - EXPOSURE_PLUS_2 = 2, - EXPOSURE_PLUS_3 = 3, - EXPOSURE_PLUS_4 = 4, - EXPOSURE_PLUS_5 = 5, - EXPOSURE_PLUS_6 = 6, - EXPOSURE_MAX, -}; - -#define V4L2_CID_CAMERA_WHITE_BALANCE (V4L2_CID_PRIVATE_BASE+73) -enum v4l2_wb_mode { - WHITE_BALANCE_BASE = 0, - WHITE_BALANCE_AUTO, - WHITE_BALANCE_SUNNY, - WHITE_BALANCE_CLOUDY, - WHITE_BALANCE_TUNGSTEN, - WHITE_BALANCE_FLUORESCENT, - WHITE_BALANCE_FLUORESCENT_H, - WHITE_BALANCE_FLUORESCENT_L, - WHITE_BALANCE_CUSTOM, - WHITE_BALANCE_K, - WHITE_BALANCE_INCANDESCENT, - WHITE_BALANCE_PROHIBITION, - WHITE_BALANCE_HORIZON, - WHITE_BALANCE_LEDLIGHT, - WHITE_BALANCE_MAX, -}; - -#define V4L2_CID_CAMERA_EFFECT (V4L2_CID_PRIVATE_BASE+74) -enum v4l2_effect_mode { - IMAGE_EFFECT_BASE = 0, - IMAGE_EFFECT_NONE, - IMAGE_EFFECT_BNW, - IMAGE_EFFECT_SEPIA, - IMAGE_EFFECT_AQUA, - IMAGE_EFFECT_ANTIQUE, - IMAGE_EFFECT_NEGATIVE, - IMAGE_EFFECT_SHARPEN, - IMAGE_EFFECT_SKETCH, - IMAGE_EFFECT_WASHED, - IMAGE_EFFECT_VINTAGE_WARM, - IMAGE_EFFECT_VINTAGE_COLD, - IMAGE_EFFECT_SOLARIZE, - IMAGE_EFFECT_POSTERIZE, - IMAGE_EFFECT_POINT_BLUE, - IMAGE_EFFECT_POINT_RED_YELLOW, - IMAGE_EFFECT_POINT_COLOR_3, - IMAGE_EFFECT_POINT_GREEN, - IMAGE_EFFECT_POINT_RED, - IMAGE_EFFECT_POINT_YELLOW, - IMAGE_EFFECT_CARTOONIZE, - IMAGE_EFFECT_MAX, -}; - -#define V4L2_CID_CAMERA_ISO (V4L2_CID_PRIVATE_BASE+75) -enum v4l2_iso_mode { - ISO_AUTO = 0, - ISO_50, - ISO_100, - ISO_200, - ISO_400, - ISO_800, - ISO_1600, - ISO_3200, - ISO_SPORTS, - ISO_NIGHT, - ISO_MOVIE, - ISO_MAX, -}; - -#define V4L2_CID_CAMERA_METERING (V4L2_CID_PRIVATE_BASE+76) -enum v4l2_metering_mode { - METERING_BASE = 0, - METERING_MATRIX, - METERING_CENTER, - METERING_SPOT, - METERING_MAX, -}; - -#define V4L2_CID_CAMERA_CONTRAST (V4L2_CID_PRIVATE_BASE+77) -enum v4l2_contrast_mode { - CONTRAST_MINUS_2 = 0, - CONTRAST_MINUS_1, - CONTRAST_DEFAULT, - CONTRAST_PLUS_1, - CONTRAST_PLUS_2, - CONTRAST_MAX, -}; - -#define V4L2_CID_CAMERA_SATURATION (V4L2_CID_PRIVATE_BASE+78) -enum v4l2_saturation_mode { - SATURATION_MINUS_2 = 0, - SATURATION_MINUS_1, - SATURATION_DEFAULT, - SATURATION_PLUS_1, - SATURATION_PLUS_2, - SATURATION_MAX, -}; - -#define V4L2_CID_CAMERA_SHARPNESS (V4L2_CID_PRIVATE_BASE+79) -enum v4l2_sharpness_mode { - SHARPNESS_MINUS_2 = 0, - SHARPNESS_MINUS_1, - SHARPNESS_DEFAULT, - SHARPNESS_PLUS_1, - SHARPNESS_PLUS_2, - SHARPNESS_MAX, -}; - -#define V4L2_CID_CAMERA_WDR (V4L2_CID_PRIVATE_BASE+80) -enum v4l2_wdr_mode { - WDR_OFF, - WDR_ON, - WDR_MAX, -}; - -#define V4L2_CID_CAMERA_ANTI_SHAKE (V4L2_CID_PRIVATE_BASE+81) -enum v4l2_anti_shake_mode { - ANTI_SHAKE_OFF, - ANTI_SHAKE_STILL_ON, - ANTI_SHAKE_MOVIE_ON, - ANTI_SHAKE_MAX, -}; - -#define V4L2_CID_CAMERA_TOUCH_AF_START_STOP (V4L2_CID_PRIVATE_BASE+82) -enum v4l2_touch_af { - TOUCH_AF_STOP = 0, - TOUCH_AF_START, - TOUCH_AF_MAX, -}; - -#define V4L2_CID_CAMERA_SMART_AUTO (V4L2_CID_PRIVATE_BASE+83) -enum v4l2_smart_auto { - SMART_AUTO_OFF = 0, - SMART_AUTO_ON, - SMART_AUTO_MAX, -}; - -#define V4L2_CID_CAMERA_VINTAGE_MODE (V4L2_CID_PRIVATE_BASE+84) -enum v4l2_vintage_mode { - VINTAGE_MODE_BASE, - VINTAGE_MODE_OFF, - VINTAGE_MODE_NORMAL, - VINTAGE_MODE_WARM, - VINTAGE_MODE_COOL, - VINTAGE_MODE_BNW, - VINTAGE_MODE_MAX, -}; - -#define V4L2_CID_CAMERA_JPEG_QUALITY (V4L2_CID_PRIVATE_BASE+85) -#define V4L2_CID_CAMERA_CAPTURE_THUMB (V4L2_CID_PRIVATE_BASE + 86) -#define V4L2_CID_CAMERA_YUV_SNAPSHOT (V4L2_CID_PRIVATE_BASE + 87) -#define V4L2_CID_CAMERA_LOW_LIGHT_MODE (V4L2_CID_PRIVATE_BASE + 88) -#define V4L2_CID_CAMERA_GPS_LATITUDE (V4L2_CID_CAMERA_CLASS_BASE+30) -/* (V4L2_CID_PRIVATE_BASE+87) */ -#define V4L2_CID_CAMERA_GPS_LONGITUDE (V4L2_CID_CAMERA_CLASS_BASE + 31) -/* (V4L2_CID_PRIVATE_BASE+88) */ -#define V4L2_CID_CAMERA_GPS_TIMESTAMP (V4L2_CID_CAMERA_CLASS_BASE + 32) -/* (V4L2_CID_PRIVATE_BASE+89)*/ -#define V4L2_CID_CAMERA_GPS_ALTITUDE (V4L2_CID_CAMERA_CLASS_BASE + 33) -#define V4L2_CID_CAMERA_EXIF_TIME_INFO (V4L2_CID_CAMERA_CLASS_BASE + 34) -#define V4L2_CID_CAMERA_GPS_PROCESSINGMETHOD (V4L2_CID_CAMERA_CLASS_BASE+35) - -#define V4L2_CID_FOCUS_AUTO_MODE (V4L2_CID_CAMERA_CLASS_BASE+36) -enum v4l2_focus_mode_type { - V4L2_FOCUS_AUTO_NORMAL = 0, - V4L2_FOCUS_AUTO_MACRO, - V4L2_FOCUS_AUTO_CONTINUOUS, - V4L2_FOCUS_AUTO_FACE_DETECTION, - V4L2_FOCUS_AUTO_RECTANGLE, - V4L2_FOCUS_AUTO_MAX, -}; -#define V4L2_CID_FOCUS_AUTO_RECTANGLE_LEFT (V4L2_CID_CAMERA_CLASS_BASE+37) -#define V4L2_CID_FOCUS_AUTO_RECTANGLE_TOP (V4L2_CID_CAMERA_CLASS_BASE+38) -#define V4L2_CID_FOCUS_AUTO_RECTANGLE_WIDTH (V4L2_CID_CAMERA_CLASS_BASE+39) -#define V4L2_CID_FOCUS_AUTO_RECTANGLE_HEIGHT (V4L2_CID_CAMERA_CLASS_BASE+40) - -#define V4L2_CID_CAMERA_ZOOM (V4L2_CID_PRIVATE_BASE+90) -enum v4l2_zoom_level { - ZOOM_LEVEL_0 = 0, - ZOOM_LEVEL_1, - ZOOM_LEVEL_2, - ZOOM_LEVEL_3, - ZOOM_LEVEL_4, - ZOOM_LEVEL_5, - ZOOM_LEVEL_6, - ZOOM_LEVEL_7, - ZOOM_LEVEL_8, - ZOOM_LEVEL_9, - ZOOM_LEVEL_10, - ZOOM_LEVEL_11, - ZOOM_LEVEL_12, - ZOOM_LEVEL_MAX = 31, -}; - -#define V4L2_CID_CAMERA_FACE_DETECTION (V4L2_CID_PRIVATE_BASE+91) -enum v4l2_face_detection { - FACE_DETECTION_OFF = 0, - FACE_DETECTION_ON, - FACE_DETECTION_NOLINE, - FACE_DETECTION_ON_BEAUTY, - FACE_DETECTION_NORMAL, - FACE_DETECTION_SMILE_SHOT, - FACE_DETECTION_BLINK, - FACE_DETECTION_MAX, -}; - -#define V4L2_CID_CAMERA_SMART_AUTO_STATUS (V4L2_CID_PRIVATE_BASE+92) -enum v4l2_smart_auto_status { - SMART_AUTO_STATUS_AUTO = 0, - SMART_AUTO_STATUS_LANDSCAPE, - SMART_AUTO_STATUS_PORTRAIT, - SMART_AUTO_STATUS_MACRO, - SMART_AUTO_STATUS_NIGHT, - SMART_AUTO_STATUS_PORTRAIT_NIGHT, - SMART_AUTO_STATUS_BACKLIT, - SMART_AUTO_STATUS_PORTRAIT_BACKLIT, - SMART_AUTO_STATUS_ANTISHAKE, - SMART_AUTO_STATUS_PORTRAIT_ANTISHAKE, - SMART_AUTO_STATUS_MAX, -}; - -#define V4L2_CID_CAMERA_SET_AUTO_FOCUS (V4L2_CID_PRIVATE_BASE+93) -enum v4l2_auto_focus { - AUTO_FOCUS_OFF = 0, - AUTO_FOCUS_ON, - AUTO_FOCUS_MAX, -}; - -#define V4L2_CID_CAMERA_BEAUTY_SHOT (V4L2_CID_PRIVATE_BASE+94) -enum v4l2_beauty_shot { - BEAUTY_SHOT_OFF = 0, - BEAUTY_SHOT_ON, - BEAUTY_SHOT_MAX, -}; - -#define V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE+95) -enum v4l2_ae_awb_lockunlock { - AE_UNLOCK_AWB_UNLOCK = 0, - AE_LOCK_AWB_UNLOCK, - AE_UNLOCK_AWB_LOCK, - AE_LOCK_AWB_LOCK, - AE_AWB_MAX -}; - -#define V4L2_CID_CAMERA_FACEDETECT_LOCKUNLOCK (V4L2_CID_PRIVATE_BASE+96) -enum v4l2_face_lock { - FACE_LOCK_OFF = 0, - FACE_LOCK_ON, - FIRST_FACE_TRACKING, - FACE_LOCK_MAX, -}; - -#define V4L2_CID_CAMERA_OBJECT_POSITION_X (V4L2_CID_PRIVATE_BASE+97) -#define V4L2_CID_CAMERA_OBJECT_POSITION_Y (V4L2_CID_PRIVATE_BASE+98) -#define V4L2_CID_CAMERA_FOCUS_MODE (V4L2_CID_PRIVATE_BASE+99) -enum v4l2_focusmode { - FOCUS_MODE_AUTO = 0, - FOCUS_MODE_MACRO, - FOCUS_MODE_FACEDETECT, - FOCUS_MODE_AUTO_DEFAULT, - FOCUS_MODE_MACRO_DEFAULT, - FOCUS_MODE_FACEDETECT_DEFAULT, - FOCUS_MODE_INFINITY, - FOCUS_MODE_FIXED, - FOCUS_MODE_CONTINOUS, - FOCUS_MODE_CONTINOUS_PICTURE, - FOCUS_MODE_CONTINOUS_PICTURE_MACRO, - FOCUS_MODE_CONTINOUS_VIDEO, - FOCUS_MODE_TOUCH, - FOCUS_MODE_MANUAL, - FOCUS_MODE_MULTI, - FOCUS_MODE_OBJECT_TRACKING, - FOCUS_MODE_MAX, - FOCUS_MODE_DEFAULT = (1 << 8), -}; - -#define V4L2_CID_CAMERA_OBJ_TRACKING_STATUS (V4L2_CID_PRIVATE_BASE+100) -enum v4l2_obj_tracking_status { - OBJECT_TRACKING_STATUS_BASE = 0, - OBJECT_TRACKING_STATUS_SUCCESS = 1, - OBJECT_TRACKING_STATUS_MISSING = 2, - OBJECT_TRACKING_STATUS_FAIL = 3, - OBJECT_TRACKING_STATUS_MAX, -}; - -#define V4L2_CID_CAMERA_OBJ_TRACKING_START_STOP (V4L2_CID_PRIVATE_BASE+101) -enum v4l2_ot_start_stop { - OT_STOP = 0, - OT_START, - OT_MAX, -}; - -#define V4L2_CID_CAMERA_CAF_START_STOP (V4L2_CID_PRIVATE_BASE+102) -enum v4l2_caf_start_stop { - CAF_STOP = 0, - CAF_START, - CAF_MAX, -}; - -#define V4L2_CID_CAMERA_AUTO_FOCUS_RESULT (V4L2_CID_PRIVATE_BASE+103) -enum v4l2_af_status { - CAMERA_AF_STATUS_IN_PROGRESS = 0, - CAMERA_AF_STATUS_SUCCESS, - CAMERA_AF_STATUS_FAIL, - CAMERA_AF_STATUS_1ST_SUCCESS, - CAMERA_AF_STATUS_RESTART, - CAMERA_AF_STATUS_MAX, -}; - -#define V4L2_CID_CAMERA_FRAME_RATE (V4L2_CID_PRIVATE_BASE+104) -enum v4l2_frame_rate { - FRAME_RATE_AUTO = 0, - FRAME_RATE_7 = 7, - FRAME_RATE_15 = 15, - FRAME_RATE_20 = 20, - FRAME_RATE_25 = 25, - FRAME_RATE_30 = 30, - FRAME_RATE_60 = 60, - FRAME_RATE_120 = 120, - FRAME_RATE_MAX -}; - -#define V4L2_CID_CAMERA_ANTI_BANDING (V4L2_CID_PRIVATE_BASE+105) -enum v4l2_anti_banding { - ANTI_BANDING_AUTO = 0, - ANTI_BANDING_50HZ = 1, - ANTI_BANDING_60HZ = 2, - ANTI_BANDING_50_60Hz = 3, - ANTI_BANDING_OFF = 4, -}; - -#define V4L2_CID_CAMERA_SET_GAMMA (V4L2_CID_PRIVATE_BASE+106) -enum v4l2_gamma_mode { - GAMMA_OFF = 0, - GAMMA_ON = 1, - GAMMA_MAX, -}; - -#define V4L2_CID_CAMERA_SET_SLOW_AE (V4L2_CID_PRIVATE_BASE+107) -enum v4l2_slow_ae_mode { - SLOW_AE_OFF, - SLOW_AE_ON, - SLOW_AE_MAX, -}; - -#define V4L2_CID_CAMERA_BATCH_REFLECTION (V4L2_CID_PRIVATE_BASE+108) -#define V4L2_CID_CAMERA_EXIF_ORIENTATION (V4L2_CID_PRIVATE_BASE+109) -#define V4L2_CID_CAMERA_GET_LUX (V4L2_CID_PRIVATE_BASE+110) - -/* s1_camera [ Defense process by ESD input ] */ -#define V4L2_CID_CAMERA_RESET (V4L2_CID_PRIVATE_BASE+111) -#define V4L2_CID_CAMERA_CHECK_DATALINE (V4L2_CID_PRIVATE_BASE+112) -#define V4L2_CID_CAMERA_CHECK_DATALINE_STOP (V4L2_CID_PRIVATE_BASE+113) - -#endif - -/* Modify NTTS1 */ -#if defined(CONFIG_ARIES_NTT) -#define V4L2_CID_CAMERA_AE_AWB_DISABLE_LOCK (V4L2_CID_PRIVATE_BASE+114) -#endif -#define V4L2_CID_CAMERA_THUMBNAIL_NULL (V4L2_CID_PRIVATE_BASE+115) -#define V4L2_CID_CAMERA_SENSOR_MODE (V4L2_CID_PRIVATE_BASE+116) -enum v4l2_sensor_mode { - SENSOR_CAMERA, - SENSOR_MOVIE, -}; - -enum stream_mode_t { - STREAM_MODE_CAM_OFF, - STREAM_MODE_CAM_ON, - STREAM_MODE_MOVIE_OFF, - STREAM_MODE_MOVIE_ON, - STREAM_MODE_WAIT_OFF -}; - -#define V4L2_CID_CAMERA_EXIF_EXPTIME (V4L2_CID_PRIVATE_BASE+117) -#define V4L2_CID_CAMERA_EXIF_FLASH (V4L2_CID_PRIVATE_BASE+118) -#define V4L2_CID_CAMERA_EXIF_ISO (V4L2_CID_PRIVATE_BASE+119) -#define V4L2_CID_CAMERA_EXIF_TV (V4L2_CID_PRIVATE_BASE+120) -#define V4L2_CID_CAMERA_EXIF_BV (V4L2_CID_PRIVATE_BASE+121) -#define V4L2_CID_CAMERA_EXIF_EBV (V4L2_CID_PRIVATE_BASE+122) -#define V4L2_CID_CAMERA_CHECK_ESD (V4L2_CID_PRIVATE_BASE+123) -#define V4L2_CID_CAMERA_APP_CHECK (V4L2_CID_PRIVATE_BASE+124) -#define V4L2_CID_CAMERA_CHECK_SENSOR_STATUS (V4L2_CID_PRIVATE_BASE+150) -#define V4L2_CID_CAMERA_DEFAULT_FOCUS_POSITION (V4L2_CID_PRIVATE_BASE+151) -#define V4L2_CID_CAMERA_BUSFREQ_LOCK (V4L2_CID_PRIVATE_BASE+125) -#define V4L2_CID_CAMERA_BUSFREQ_UNLOCK (V4L2_CID_PRIVATE_BASE+126) - -/* If you would like to control AE and AWB lock with signle command, - * use V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK above. - */ -#define V4L2_CID_CAMERA_AE_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE + 127) -enum v4l2_ae_lockunlock { - AE_UNLOCK = 0, - AE_LOCK, - AE_LOCK_MAX -}; - -#define V4L2_CID_CAMERA_AWB_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE + 128) -enum v4l2_awb_lockunlock { - AWB_UNLOCK = 0, - AWB_LOCK, - AWB_LOCK_MAX -}; - -#define V4L2_CID_CAMERA_SENSOR_OUTPUT_SIZE (V4L2_CID_PRIVATE_BASE + 129) -#define V4L2_CID_EMBEDDEDDATA_ENABLE (V4L2_CID_PRIVATE_BASE + 130) -#define V4L2_CID_CAMERA_JPEG_RESOLUTION (V4L2_CID_PRIVATE_BASE + 131) -#define V4L2_CID_CAMERA_FACE_ZOOM (V4L2_CID_PRIVATE_BASE + 132) -enum v4l2_face_zoom { - FACE_ZOOM_STOP = 0, - FACE_ZOOM_START -}; - -/* control for post processing block in ISP */ -#define V4L2_CID_CAMERA_SET_ODC (V4L2_CID_PRIVATE_BASE+127) -enum set_odc_mode { - CAMERA_ODC_ON, - CAMERA_ODC_OFF -}; - -#define V4L2_CID_CAMERA_SET_DIS (V4L2_CID_PRIVATE_BASE+128) -enum set_dis_mode { - CAMERA_DIS_ON, - CAMERA_DIS_OFF -}; - -#define V4L2_CID_CAMERA_SET_3DNR (V4L2_CID_PRIVATE_BASE+129) -enum set_3dnr_mode { - CAMERA_3DNR_ON, - CAMERA_3DNR_OFF -}; - -#define V4L2_CID_CAMERA_BRACKET (V4L2_CID_PRIVATE_BASE+134) -enum v4l2_face_bracket_mode { - BRACKET_MODE_OFF = 0, - BRACKET_MODE_AEB, - BRACKET_MODE_WBB, - BRACKET_MODE_MAX, -}; - -#define V4L2_CID_CAMERA_BRACKET_AEB (V4L2_CID_PRIVATE_BASE+135) -enum v4l2_face_bracket_aeb_value { - BRACKET_AEB_VALUE0 = 0, - BRACKET_AEB_VALUE1, - BRACKET_AEB_VALUE2, - BRACKET_AEB_VALUE3, - BRACKET_AEB_VALUE4, - BRACKET_AEB_VALUE5, - BRACKET_AEB_VALUE6, -}; - -#define V4L2_CID_CAMERA_BRACKET_WBB (V4L2_CID_PRIVATE_BASE+136) -enum v4l2_face_bracket_wbb_value { - BRACKET_WBB_OFF = 0, - BRACKET_WBB_VALUE1 = 1, - BRACKET_WBB_VALUE2, - BRACKET_WBB_VALUE3, - BRACKET_WBB_VALUE4, - BRACKET_WBB_VALUE5, - BRACKET_WBB_VALUE6, -}; - -#define V4L2_CID_CAMERA_DRIVE_DIAL (V4L2_CID_PRIVATE_BASE+137) -enum v4l2_drive_dial { - DRIVEDIAL_SINGLE = 1, - DRIVEDIAL_BKT = 2, - DRIVEDIAL_CONTI_3 = 3, - DRIVEDIAL_CONTI_5 = 5, - DRIVEDIAL_CONTI_10 = 10, -}; - -enum v4l2_running_cap_mode { - RUNNING_MODE_SINGLE = 0, - RUNNING_MODE_CONTINUOUS, - RUNNING_MODE_BEST, - RUNNING_MODE_LOWLIGHT, - RUNNING_MODE_AE_BRACKET, - RUNNING_MODE_WB_BRACKET, - RUNNING_MODE_HDR, - RUNNING_MODE_BLINK, - RUNNING_MODE_RAW, - RUNNING_MODE_BURST, - RUNNING_MODE_MAX -}; - -enum v4l2_continuous_mode { - CONTINUOUS_MODE_OFF = 0, - CONTINUOUS_MODE_ON, - CONTINUOUS_MODE_MAX, -}; - -enum v4l2_continuous_fps { - MULTI_CAPTURE_FPS_1 = 0, - MULTI_CAPTURE_FPS_10, - MULTI_CAPTURE_FPS_5, - MULTI_CAPTURE_FPS_3, - MULTI_CAPTURE_FPS_MAX, -}; - -enum v4l2_burst_mode { - BURST_MODE_OFF = 0, - BURST_MODE_ON, -}; - -enum v4l2_best_mode { - BEST_MODE_OFF = 0, - BEST_MODE_ON, - BEST_MODE_MAX,}; - -enum v4l2_lowlight_mode { - LOWLIGHT_MODE_OFF = 0, - LOWLIGHT_MODE_ON, - LOWLIGHT_MODE_MAX,}; - -#define V4L2_CID_CAMERA_FD_EYE_BLINK_RESULT (V4L2_CID_PRIVATE_BASE+138) - -#define V4L2_CID_CAMERA_OPTICAL_ZOOM_STEP (V4L2_CID_PRIVATE_BASE + 139) -#define V4L2_CID_CAMERA_OPTICAL_ZOOM_CTRL (V4L2_CID_PRIVATE_BASE + 140) -enum v4l2_optical_zoom_ctrl { - V4L2_OPTICAL_ZOOM_STOP, - V4L2_OPTICAL_ZOOM_TELE_START, - V4L2_OPTICAL_ZOOM_WIDE_START, - V4L2_OPTICAL_ZOOM_SLOW_TELE_START, - V4L2_OPTICAL_ZOOM_SLOW_WIDE_START, -}; - -#define V4L2_CID_CAMERA_LDC (V4L2_CID_PRIVATE_BASE+142) -enum set_LDC_mode { - LDC_SET_OFF = 0, - LDC_SET_ON = 1, -}; - -#define V4L2_CID_CAMERA_LSC (V4L2_CID_PRIVATE_BASE+143) -enum set_LSC_mode { - LSC_SET_OFF = 0, - LSC_SET_ON = 1, -}; - -#define V4L2_CID_CAMERA_FACTORY_OIS (V4L2_CID_PRIVATE_BASE+147) -enum set_Factory_OIS { - FACTORY_OIS_RETURN_TO_CENTER = 0, - FACTORY_OIS_RUN = 1, - FACTORY_OIS_START = 2, - FACTORY_OIS_STOP = 3, - FACTORY_OIS_MODE_ON = 4, - FACTORY_OIS_MODE_OFF = 5, - FACTORY_OIS_LOG = 6, - FACTORY_OIS_ON = 7, - FACTORY_OIS_DECENTER_LOG = 8, -}; - -#define V4L2_CID_CAMERA_FACTORY_ZOOM_RANGE_CHECK_DATA_MIN \ - (V4L2_CID_PRIVATE_BASE+148) -#define V4L2_CID_CAMERA_FACTORY_ZOOM_RANGE_CHECK_DATA_MAX \ - (V4L2_CID_PRIVATE_BASE+149) -#define V4L2_CID_CAMERA_FACTORY_ZOOM_SLOPE_CHECK_DATA_MIN \ - (V4L2_CID_PRIVATE_BASE+152) -#define V4L2_CID_CAMERA_FACTORY_ZOOM_SLOPE_CHECK_DATA_MAX \ - (V4L2_CID_PRIVATE_BASE+153) -#define V4L2_CID_CAMERA_FACTORY_ZOOM_STEP (V4L2_CID_PRIVATE_BASE+154) -#define V4L2_CID_CAMERA_FACTORY_ZOOM (V4L2_CID_PRIVATE_BASE+155) -enum set_Factory_Zoom { - FACTORY_ZOOM_MOVE_STEP = 0, - FACTORY_ZOOM_RANGE_CHECK_START = 1, - FACTORY_ZOOM_RANGE_CHECK_STOP = 2, - FACTORY_ZOOM_SLOPE_CHECK_START = 3, - FACTORY_ZOOM_SLOPE_CHECK_STOP = 4, - FACTORY_ZOOM_SET_RANGE_CHECK_DATA = 5, - FACTORY_ZOOM_SET_SLOPE_CHECK_DATA = 6, - FACTORY_ZOOM_STEP_TELE = 7, - FACTORY_ZOOM_STEP_WIDE = 8, - FACTORY_ZOOM_MOVE_END_CHECK = 9, -}; - -#define V4L2_CID_CAMERA_FACTORY_PUNT_RANGE_DATA_MIN \ - (V4L2_CID_PRIVATE_BASE+156) -#define V4L2_CID_CAMERA_FACTORY_PUNT_RANGE_DATA_MAX \ - (V4L2_CID_PRIVATE_BASE+157) -#define V4L2_CID_CAMERA_FACTORY_PUNT_RANGE_DATA_NUM \ - (V4L2_CID_PRIVATE_BASE+158) -#define V4L2_CID_CAMERA_FACTORY_PUNT (V4L2_CID_PRIVATE_BASE+159) -enum set_Factory_Punt { - FACTORY_PUNT_RANGE_START = 0, - FACTORY_PUNT_RANGE_STOP = 1, - FACTORY_PUNT_SHORT_SCAN_DATA = 2, - FACTORY_PUNT_SHORT_SCAN_START = 3, - FACTORY_PUNT_SHORT_SCAN_STOP = 4, - FACTORY_PUNT_LONG_SCAN_DATA = 5, - FACTORY_PUNT_LONG_SCAN_START = 6, - FACTORY_PUNT_LONG_SCAN_STOP = 7, - FACTORY_PUNT_LOG = 8, - FACTORY_PUNT_SET_RANGE_DATA = 9, - FACTORY_PUNT_EEP_WRITE = 10, -}; - -#define V4L2_CID_CAMERA_FACTORY_FAIL_STOP (V4L2_CID_PRIVATE_BASE+160) -enum set_Factory_Fail_Stop { - FACTORY_FAIL_STOP_ON = 0, - FACTORY_FAIL_STOP_OFF = 1, - FACTORY_FAIL_STOP_RUN = 2, - FACTORY_FAIL_STOP_STOP = 3, -}; - -#define V4L2_CID_CAMERA_FACTORY_NODEFOCUS (V4L2_CID_PRIVATE_BASE+161) -enum set_Factory_NoDeFocus { - FACTORY_NODEFOCUSYES_ON = 0, - FACTORY_NODEFOCUSYES_OFF = 1, - FACTORY_NODEFOCUSYES_RUN = 2, - FACTORY_NODEFOCUSYES_STOP = 3, -}; - -#define V4L2_CID_CAMERA_FACTORY_INTERPOLATION (V4L2_CID_PRIVATE_BASE+162) -enum set_Factory_Interpolation { - FACTORY_INTERPOLATION_USE = 0, - FACTORY_INTERPOLATION_RELEASE = 1, -}; - -#define V4L2_CID_CAMERA_FACTORY_DOWN_RESULT (V4L2_CID_PRIVATE_BASE+163) -#define V4L2_CID_CAMERA_FACTORY_END_RESULT (V4L2_CID_PRIVATE_BASE+164) -#define V4L2_CID_CAMERA_FACTORY_COMMON (V4L2_CID_PRIVATE_BASE+165) -enum set_Factory_Common { - FACTORY_FIRMWARE_DOWNLOAD = 0, - FACTORY_DOWNLOAD_CHECK = 1, - FACTORY_END_CHECK = 2, - FACTORY_COMMON_SET_FOCUS_ZONE_MACRO = 3, - FACTORY_FPS30_ON = 4, - FACTORY_FPS30_OFF = 5, -}; - -#define V4L2_CID_CAMERA_FACTORY_VIB (V4L2_CID_PRIVATE_BASE+166) -enum set_Factory_Vib { - FACTORY_VIB_START = 0, - FACTORY_VIB_STOP = 1, - FACTORY_VIB_LOG = 2, -}; - -#define V4L2_CID_CAMERA_FACTORY_GYRO (V4L2_CID_PRIVATE_BASE+167) -enum set_Factory_Gyro { - FACTORY_GYRO_START = 0, - FACTORY_GYRO_STOP = 1, - FACTORY_GYRO_LOG = 2, -}; - -#define V4L2_CID_CAMERA_FACTORY_BACKLASH (V4L2_CID_PRIVATE_BASE+168) -enum set_Factory_Backlash { - FACTORY_BACKLASH_INPUT = 0, - FACTORY_BACKLASH_MAX_THR = 1, - FACTORY_BACKLASH_WIDE_RUN = 2, - FACTORY_BACKLASH_LOG = 3, -}; - -#define V4L2_CID_CAMERA_FACTORY_AF_STEP_SET (V4L2_CID_PRIVATE_BASE+169) -#define V4L2_CID_CAMERA_FACTORY_AF_POSITION (V4L2_CID_PRIVATE_BASE+170) -#define V4L2_CID_CAMERA_FACTORY_AF_INT_RESULT (V4L2_CID_PRIVATE_BASE+171) -#define V4L2_CID_CAMERA_FACTORY_AF (V4L2_CID_PRIVATE_BASE+172) -enum set_Factory_AF { - FACTORY_AF_LOCK_ON_SET = 0, - FACTORY_AF_LOCK_OFF_SET = 1, - FACTORY_AF_MOVE = 2, - FACTORY_AF_STEP_LOG = 3, - FACTORY_AF_LOCK_START = 4, - FACTORY_AF_LOCK_STOP = 5, - FACTORY_AF_FOCUS_LOG = 6, - FACTORY_AF_INT_SET = 7, - FACTORY_AF_SCAN_LIMIT_START = 8, - FACTORY_AF_SCAN_LIMIT_STOP = 10, - FACTORY_AF_SCAN_RANGE_START = 11, - FACTORY_AF_SCAN_RANGE_STOP = 12, - FACTORY_AF_STEP_SAVE = 13, - FACTORY_AF_LED_END_CHECK = 14, - FACTORY_AF_LED_LOG = 15, - FACTORY_AF_MOVE_END_CHECK = 16, - FACTORY_AF_SCAN_END_CHECK = 17, -}; - -#define V4L2_CID_CAMERA_FACTORY_DEFOCUS_WIDE (V4L2_CID_PRIVATE_BASE+173) -#define V4L2_CID_CAMERA_FACTORY_DEFOCUS_TELE (V4L2_CID_PRIVATE_BASE+174) -#define V4L2_CID_CAMERA_FACTORY_DEFOCUS (V4L2_CID_PRIVATE_BASE+175) -enum set_Factory_DeFocus { - FACTORY_DEFOCUS_RUN = 0, - FACTORY_DEFOCUS_STOP = 1, -}; - -#define V4L2_CID_CAMERA_FACTORY_RESOL_CAP (V4L2_CID_PRIVATE_BASE+176) -enum set_Factory_Resol_Cap { - FACTORY_CAP_COMP_ON = 0, - FACTORY_CAP_COMP_OFF = 1, - FACTORY_CAP_BARREL_ON = 2, - FACTORY_CAP_BARREL_OFF = 3, - FACTORY_CAP_BARREL_START = 4, - FACTORY_CAP_BARREL_STOP = 5, - FACTORY_CAP_COMP_START = 6, - FACTORY_CAP_COMP_STOP = 7, -}; - -#define V4L2_CID_CAMERA_SET_G_VALUE (V4L2_CID_PRIVATE_BASE + 177) -#define V4L2_CID_CAMERA_SET_B_VALUE (V4L2_CID_PRIVATE_BASE + 178) -#define V4L2_CID_CAMERA_SET_A_VALUE (V4L2_CID_PRIVATE_BASE + 179) -#define V4L2_CID_CAMERA_SET_M_VALUE (V4L2_CID_PRIVATE_BASE + 180) -#define V4L2_CID_CAMERA_SET_GBAM (V4L2_CID_PRIVATE_BASE + 181) -#define V4L2_CID_CAMERA_SET_K_VALUE (V4L2_CID_PRIVATE_BASE + 182) -#define V4L2_CID_CAMERA_SET_FLASH_EVC_STEP (V4L2_CID_PRIVATE_BASE + 183) - -#define V4L2_CID_CAMERA_APERTURE_CMD (V4L2_CID_PRIVATE_BASE+184) -enum set_Factory_Aperture_Cmd { - FACTORY_CMD_PREVIEW = 0, - FACTORY_CMD_CAPTURE = 1, -}; - -#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_X_MIN (V4L2_CID_PRIVATE_BASE+185) -#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_X_MAX (V4L2_CID_PRIVATE_BASE+186) -#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_Y_MIN (V4L2_CID_PRIVATE_BASE+187) -#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_Y_MAX (V4L2_CID_PRIVATE_BASE+188) -#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_X_GAIN \ - (V4L2_CID_PRIVATE_BASE+189) -#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_PEAK_X \ - (V4L2_CID_PRIVATE_BASE+190) -#define V4L2_CID_CAMERA_FACTORY_OIS_RANGE_DATA_PEAK_Y \ - (V4L2_CID_PRIVATE_BASE+191) - -#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_X_MIN (V4L2_CID_PRIVATE_BASE+192) -#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_X_MAX (V4L2_CID_PRIVATE_BASE+193) -#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_Y_MIN (V4L2_CID_PRIVATE_BASE+194) -#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_Y_MAX (V4L2_CID_PRIVATE_BASE+195) -#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_PEAK_X \ - (V4L2_CID_PRIVATE_BASE+196) -#define V4L2_CID_CAMERA_FACTORY_VIB_RANGE_DATA_PEAK_Y \ - (V4L2_CID_PRIVATE_BASE+197) - -#define V4L2_CID_CAMERA_FACTORY_GYRO_RANGE_DATA_X_MIN \ - (V4L2_CID_PRIVATE_BASE+198) -#define V4L2_CID_CAMERA_FACTORY_GYRO_RANGE_DATA_X_MAX \ - (V4L2_CID_PRIVATE_BASE+199) -#define V4L2_CID_CAMERA_FACTORY_GYRO_RANGE_DATA_Y_MIN \ - (V4L2_CID_PRIVATE_BASE+200) -#define V4L2_CID_CAMERA_FACTORY_GYRO_RANGE_DATA_Y_MAX \ - (V4L2_CID_PRIVATE_BASE+202) - -#define V4L2_CID_CAMERA_FACTORY_TEST_NUMBER (V4L2_CID_PRIVATE_BASE+203) - -#define V4L2_CID_CAMERA_FACTORY_BACKLASH_COUNT (V4L2_CID_PRIVATE_BASE+204) -#define V4L2_CID_CAMERA_FACTORY_BACKLASH_MAXTHRESHOLD \ - (V4L2_CID_PRIVATE_BASE+205) - -#define V4L2_CID_CAMERA_FACTORY_CAPTURE_CTRL (V4L2_CID_PRIVATE_BASE + 206) -enum set_Factory_Cap_Ctrl { - FACTORY_STILL_CAP_NORMAL = 0, - FACTORY_STILL_CAP_DUALCAP = 1, - FACTORY_DUAL_CAP_ON = 2, - FACTORY_DUAL_CAP_OFF = 3, -}; - -#define V4L2_CID_CAMERA_DUAL_POSTVIEW (V4L2_CID_PRIVATE_BASE + 207) -#define V4L2_CID_CAMERA_DUAL_CAPTURE (V4L2_CID_PRIVATE_BASE + 208) -#define V4L2_CID_CAMERA_SET_DUAL_CAPTURE (V4L2_CID_PRIVATE_BASE + 209) -#define V4L2_CID_CAMERA_DUAL_CAPTURE_MODE (V4L2_CID_PRIVATE_BASE + 210) - -#define V4L2_CID_CAMERA_FOCUS_AREA_MODE (V4L2_CID_PRIVATE_BASE + 211) -enum set_fouce_area { - V4L2_FOCUS_AREA_CENTER = 0, - V4L2_FOCUS_AREA_MULTI = 1, - V4L2_FOCUS_AREA_SMART_TOUCH = 2, -}; - -#define V4L2_CID_CAMERA_FACTORY_AF_SCAN_LIMIT_MIN (V4L2_CID_PRIVATE_BASE+212) -#define V4L2_CID_CAMERA_FACTORY_AF_SCAN_LIMIT_MAX (V4L2_CID_PRIVATE_BASE+213) -#define V4L2_CID_CAMERA_FACTORY_AF_SCAN_RANGE_MIN (V4L2_CID_PRIVATE_BASE+214) -#define V4L2_CID_CAMERA_FACTORY_AF_SCAN_RANGE_MAX (V4L2_CID_PRIVATE_BASE+215) -#define V4L2_CID_CAM_APERTURE_PREVIEW (V4L2_CID_PRIVATE_BASE+216) -#define V4L2_CID_CAM_APERTURE_CAPTURE (V4L2_CID_PRIVATE_BASE+217) - -#define V4L2_CID_CAMERA_FACTORY_AF_ZONE (V4L2_CID_PRIVATE_BASE+218) -enum set_Factory_AFZone_Cmd { - FACTORY_AFZONE_NORMAL = 0, - FACTORY_AFZONE_MACRO, - FACTORY_AFZONE_AUTO, -}; - -#define V4L2_CID_CAMERA_FACTORY_OIS_SHIFT (V4L2_CID_PRIVATE_BASE+219) -#define V4L2_CID_CAMERA_FACTORY_FLICKER (V4L2_CID_PRIVATE_BASE+220) -enum set_Factory_Flicker_Cmd { - FACTORY_FLICKER_AUTO = 0, - FACTORY_FLICKER_50HZ, - FACTORY_FLICKER_60HZ, - FACTORY_FLICKER_50_60, - FACTORY_FLICKER_OFF, -}; - -#define V4L2_CID_CAMERA_FACTORY_AF_LENS (V4L2_CID_PRIVATE_BASE+221) -enum set_Factory_AFLENS_Cmd { - FACTORY_AFLENS_OPEN = 0, - FACTORY_AFLENS_CLOSE, -}; - -#define V4L2_CID_CAMERA_FACTORY_LV_TARGET (V4L2_CID_PRIVATE_BASE+222) - -#define V4L2_CID_CAMERA_FACTORY_ADJ_IRIS_RANGE_MIN (V4L2_CID_PRIVATE_BASE+223) -#define V4L2_CID_CAMERA_FACTORY_ADJ_IRIS_RANGE_MAX (V4L2_CID_PRIVATE_BASE+224) -#define V4L2_CID_CAMERA_FACTORY_ADJ_IRIS (V4L2_CID_PRIVATE_BASE+225) -enum set_Factory_Adj_IRIS_Cmd { - FACTORY_ADJ_IRIS_RUN = 0, - FACTORY_ADJ_IRIS_STOP, - FACTORY_ADJ_IRIS_END_CHECK, - FACTORY_ADJ_IRIS_LOG, -}; - -#define V4L2_CID_CAMERA_FACTORY_ADJ_GAIN_LIVEVIEW_RANGE_MIN \ - (V4L2_CID_PRIVATE_BASE+226) -#define V4L2_CID_CAMERA_FACTORY_ADJ_GAIN_LIVEVIEW_RANGE_MAX \ - (V4L2_CID_PRIVATE_BASE+227) -#define V4L2_CID_CAMERA_FACTORY_ADJ_GAIN_LIVEVIEW (V4L2_CID_PRIVATE_BASE+228) -enum set_Factory_Adj_Gain_LiveView_Cmd { - FACTORY_ADJ_GAIN_LIVEVIEW_RUN = 0, - FACTORY_ADJ_GAIN_LIVEVIEW_STOP, - FACTORY_ADJ_GAIN_LIVEVIEW_END_CHECK, - FACTORY_ADJ_GAIN_LIVEVIEW_LOG, -}; - -#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_IRIS_NUM (V4L2_CID_PRIVATE_BASE+229) -#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_SET_IRIS (V4L2_CID_PRIVATE_BASE+230) -#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_ISO (V4L2_CID_PRIVATE_BASE+231) -#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_RANGE (V4L2_CID_PRIVATE_BASE+232) -#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_SPEEDTIME_X (V4L2_CID_PRIVATE_BASE+233) -#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE_SPEEDTIME_Y (V4L2_CID_PRIVATE_BASE+234) -#define V4L2_CID_CAMERA_FACTORY_SH_CLOSE (V4L2_CID_PRIVATE_BASE+235) -enum set_Factory_SH_Close_Cmd { - FACTORY_SH_CLOSE_RUN = 0, - FACTORY_SH_CLOSE_STOP, - FACTORY_SH_CLOSE_END_CHECK, - FACTORY_SH_CLOSE_LOG, -}; - -#define V4L2_CID_CAMERA_FACTORY_CAPTURE_GAIN_RANGE_MIN \ - (V4L2_CID_PRIVATE_BASE+236) -#define V4L2_CID_CAMERA_FACTORY_CAPTURE_GAIN_RANGE_MAX \ - (V4L2_CID_PRIVATE_BASE+237) -#define V4L2_CID_CAMERA_FACTORY_CAPTURE_GAIN (V4L2_CID_PRIVATE_BASE+238) -enum set_Factory_Capture_Gain_Cmd { - FACTORY_CAPTURE_GAIN_RUN = 0, - FACTORY_CAPTURE_GAIN_STOP, - FACTORY_CAPTURE_GAIN_END_CHECK, - FACTORY_CAPTURE_GAIN_LOG, -}; - -#define V4L2_CID_CAMERA_FACTORY_LSC_TABLE (V4L2_CID_PRIVATE_BASE+239) -#define V4L2_CID_CAMERA_FACTORY_LSC_REFERENCE (V4L2_CID_PRIVATE_BASE+240) - -#define V4L2_CID_CAMERA_FACTORY_PUNT_SHORT_SCAN_DATA (V4L2_CID_PRIVATE_BASE+241) -#define V4L2_CID_CAMERA_FACTORY_PUNT_LONG_SCAN_DATA (V4L2_CID_PRIVATE_BASE+242) - -#define V4L2_CID_CAMERA_PASM_MODE (V4L2_CID_PRIVATE_BASE + 243) -enum set_camera_mode_Cmd { - MODE_SMART_AUTO = 0, - MODE_PROGRAM, - MODE_A, - MODE_S, - MODE_M, - MODE_VIDEO, - MODE_BEST_GROUP_POSE, - MODE_BACKGROUND_BLUR, - MODE_HIGH_SPEED, - MODE_LIGHT_TRAIL_SHOT, - MODE_WATERFALL, - MODE_SILHOUETTE, - MODE_SUNSET, - MODE_CLOSE_UP, - MODE_FIREWORKS, - MODE_CROSS_FILTER, - MODE_BACKLIGHT, - MODE_BLUE_SKY, - MODE_NATURAL_GREEN, - MODE_FOOD, - MODE_START_FILTER, - MODE_MOVING_SHOT, - MODE_PANORAMA, -}; - -#define V4L2_CID_CAMERA_SHUTTER_SPEED (V4L2_CID_PRIVATE_BASE + 244) -#define V4L2_CID_CAMERA_F_NUMBER (V4L2_CID_PRIVATE_BASE + 245) - -#define V4L2_CID_CAMERA_IMAGE_STABILIZER (V4L2_CID_PRIVATE_BASE + 246) -enum set_Image_Stabilizer { - V4L2_IMAGE_STABILIZER_OFF = 0, - V4L2_IMAGE_STABILIZER_OIS = 1, - V4L2_IMAGE_STABILIZER_DUALIS = 2, -}; - -#define V4L2_CID_CAMERA_IS_OIS_MODE (V4L2_CID_PRIVATE_BASE + 247) -enum set_IS_OIS_mode { - V4L2_IS_OIS_NONE = 0, - V4L2_IS_OIS_MOVIE = 1, - V4L2_IS_OIS_STILL = 2, - V4L2_IS_OIS_MULTI = 3, - V4L2_IS_OIS_VSS = 4, -}; - -#define V4L2_CID_CAMERA_FACTORY_AE_TARGET (V4L2_CID_PRIVATE_BASE + 248) - -#define V4L2_CID_CAMERA_AV (V4L2_CID_PRIVATE_BASE + 249) -#define V4L2_CID_CAMERA_TV (V4L2_CID_PRIVATE_BASE + 250) -#define V4L2_CID_CAMERA_SV (V4L2_CID_PRIVATE_BASE + 251) -#define V4L2_CID_CAMERA_EV (V4L2_CID_PRIVATE_BASE + 252) - -#define V4L2_CID_CAMERA_SCENE_SUB_MODE (V4L2_CID_PRIVATE_BASE + 253) - -#define V4L2_CID_CAMERA_WB_CUSTOM_X (V4L2_CID_PRIVATE_BASE + 254) -#define V4L2_CID_CAMERA_WB_CUSTOM_Y (V4L2_CID_PRIVATE_BASE + 255) -#define V4L2_CID_CAMERA_WB_CUSTOM_VALUE (V4L2_CID_PRIVATE_BASE + 256) - -#define V4L2_CID_CAMERA_RED_EYE_FIX_RESULT (V4L2_CID_PRIVATE_BASE + 257) -#define V4L2_CID_CAMERA_FACTORY_FLASH (V4L2_CID_PRIVATE_BASE + 258) -enum set_Factory_Flash_Cmd { - FACTORY_FLASH_STROBE_CHECK_ON = 0, - FACTORY_FLASH_STROBE_CHECK_OFF = 1, - FACTORY_FLASH_CHARGE = 2, - FACTORY_FLASH_LOG = 3, - FACTORY_FLASH_CHARGE_END_CHECK = 4, - FACTORY_FLASH_STROBE_CHARGE_END_CHECK = 5, - FACTORY_FLASH_WB_LOG = 6, - FACTORY_ADJ_FLASH_WB_LOG = 7, - FACTORY_ADJ_FLASH_WB_END_CHECK = 8, - END_CHECK = 9, -}; - -#define V4L2_CID_CAMERA_FACTORY_WB (V4L2_CID_PRIVATE_BASE + 259) -enum set_Factory_WB_Cmd { - FACTORY_WB_INDOOR_RUN = 0, - FACTORY_WB_INDOOR_END_CHECK = 1, - FACTORY_WB_OUTDOOR_RUN = 2, - FACTORY_WB_OUTDOOR_END_CHECK = 3, - FACTORY_WB_LOG = 4, -}; - -#define V4L2_CID_CAMERA_FACTORY_FLASH_RANGE_X (V4L2_CID_PRIVATE_BASE + 260) -#define V4L2_CID_CAMERA_FACTORY_FLASH_RANGE_Y (V4L2_CID_PRIVATE_BASE + 261) - -#define V4L2_CID_CAMERA_FACTORY_WB_IN_RG_VALUE (V4L2_CID_PRIVATE_BASE + 262) -#define V4L2_CID_CAMERA_FACTORY_WB_IN_BG_VALUE (V4L2_CID_PRIVATE_BASE + 263) -#define V4L2_CID_CAMERA_FACTORY_WB_OUT_RG_VALUE (V4L2_CID_PRIVATE_BASE + 264) -#define V4L2_CID_CAMERA_FACTORY_WB_OUT_BG_VALUE (V4L2_CID_PRIVATE_BASE + 265) - -#define V4L2_CID_CAMERA_FACTORY_AFLED_RANGE_DATA_START_X \ - (V4L2_CID_PRIVATE_BASE + 266) -#define V4L2_CID_CAMERA_FACTORY_AFLED_RANGE_DATA_END_X \ - (V4L2_CID_PRIVATE_BASE + 267) -#define V4L2_CID_CAMERA_FACTORY_AFLED_RANGE_DATA_START_Y \ - (V4L2_CID_PRIVATE_BASE + 268) -#define V4L2_CID_CAMERA_FACTORY_AFLED_RANGE_DATA_END_Y \ - (V4L2_CID_PRIVATE_BASE + 269) - -#define V4L2_CID_CAMERA_FACTORY_AF_LED_TIME (V4L2_CID_PRIVATE_BASE + 270) - -#define V4L2_CID_CAMERA_FACTORY_AF_DIFF_CHECK_MIN (V4L2_CID_PRIVATE_BASE + 271) -#define V4L2_CID_CAMERA_FACTORY_AF_DIFF_CHECK_MAX (V4L2_CID_PRIVATE_BASE + 272) - -#define V4L2_CID_CAMERA_FACTORY_DEFECTPIXEL (V4L2_CID_PRIVATE_BASE + 273) -enum set_Factory_DefectPixel_Cmd { - FACTORY_DEFECTPIXEL_SCENARIO_6 = 0, - FACTORY_DEFECTPIXEL_RUN, - FACTORY_DEFECTPIXEL_END_CHECK, - FACTORY_DEFECTPIXEL_LOG, - FACTORY_DEFECTPIXEL_CID_1, - FACTORY_DEFECTPIXEL_CID_2, - FACTORY_DEFECTPIXEL_CID_3, - FACTORY_DEFECTPIXEL_WRITE_BLACK, - FACTORY_DEFECTPIXEL_WRITE_WHITE, - FACTORY_DEFECTPIXEL_CID_WRITE, - FACTORY_DEFECTPIXEL_FLASH_MERGE, - FACTORY_DEFECTPIXEL_DOT_WRITE_CHECK, -}; - -#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_CAP (V4L2_CID_PRIVATE_BASE + 274) -#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_DR0 (V4L2_CID_PRIVATE_BASE + 275) -#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_DR1 (V4L2_CID_PRIVATE_BASE + 276) -#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_DR2 (V4L2_CID_PRIVATE_BASE + 277) -#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_DR_HS (V4L2_CID_PRIVATE_BASE + 278) - -#define V4L2_CID_CAMERA_FACTORY_AF_LED_LV_MIN (V4L2_CID_PRIVATE_BASE + 279) -#define V4L2_CID_CAMERA_FACTORY_AF_LED_LV_MAX (V4L2_CID_PRIVATE_BASE + 280) - -#define V4L2_CID_CAMERA_FACTORY_CAM_SYS_MODE (V4L2_CID_PRIVATE_BASE + 281) -enum set_Factory_Sysmode_Cmd { - FACTORY_SYSMODE_CAPTURE = 0, - FACTORY_SYSMODE_MONITOR = 1, - FACTORY_SYSMODE_PARAM = 2, -}; - -#define V4L2_CID_CAMERA_FACTORY_ISP_FW_CHECK (V4L2_CID_PRIVATE_BASE + 282) -#define V4L2_CID_CAMERA_FACTORY_OIS_VER_CHECK (V4L2_CID_PRIVATE_BASE + 283) - -#define V4L2_CID_CAMERA_SMART_SCENE_DETECT (V4L2_CID_PRIVATE_BASE+284) -enum set_smartscenedetect_mode { - SMART_SCENE_DETECT_OFF = 0, - SMART_SCENE_DETECT_ON = 1, -}; -#define V4L2_CID_CAMERA_SMART_MOVIE_RECORDING (V4L2_CID_PRIVATE_BASE+285) -#define V4L2_CID_CAMERA_SMART_AUTO_S1_PUSH (V4L2_CID_PRIVATE_BASE+286) - -#define V4L2_CID_CAMERA_FACTORY_WB_RANGE_FLASH_WRITE \ - (V4L2_CID_PRIVATE_BASE + 287) - -#define V4L2_CID_CAMERA_FACTORY_FLASH_CHR_CHK_TM \ - (V4L2_CID_PRIVATE_BASE + 288) - -#define V4L2_CID_CAMERA_EXIF_AV (V4L2_CID_PRIVATE_BASE + 289) -#define V4L2_CID_CAMERA_FACE_DETECT_NUMBER (V4L2_CID_PRIVATE_BASE+290) -#define V4L2_CID_CAMERA_EXIF_FL (V4L2_CID_PRIVATE_BASE + 291) - -#define V4L2_CID_CAMERA_SMART_ZOOM (V4L2_CID_PRIVATE_BASE + 292) -enum set_Smart_Zoom { - V4L2_SMART_ZOOM_OFF = 0, - V4L2_SMART_ZOOM_ON = 1, -}; - -#define V4L2_CID_CAMERA_CAF (V4L2_CID_PRIVATE_BASE + 293) - -#define V4L2_CID_CAMERA_FACTORY_LIVEVIEW_OFFSET_MARK \ - (V4L2_CID_PRIVATE_BASE + 294) -#define V4L2_CID_CAMERA_FACTORY_LIVEVIEW_OFFSET_VAL \ - (V4L2_CID_PRIVATE_BASE + 295) - -#define V4L2_CID_CAMERA_FACTORY_CAPTURE_GAIN_OFFSET_MARK \ - (V4L2_CID_PRIVATE_BASE + 296) -#define V4L2_CID_CAMERA_FACTORY_CAPTURE_GAIN_OFFSET_VAL \ - (V4L2_CID_PRIVATE_BASE + 297) - -#define V4L2_CID_CAMERA_FACTORY_WB_RANGE (V4L2_CID_PRIVATE_BASE + 298) - -#define V4L2_CID_CAMERA_LV (V4L2_CID_PRIVATE_BASE + 299) - -#define V4L2_CID_PHYSICAL_ROTATION (V4L2_CID_PRIVATE_BASE + 300) - -#define V4L2_CID_CAMERA_FOCUS_RANGE (V4L2_CID_PRIVATE_BASE + 301) -enum set_fouce_range { - V4L2_FOCUS_RANGE_AUTO = 0, - V4L2_FOCUS_RANGE_MACRO = 1, - V4L2_FOCUS_RANGE_AUTO_MACRO = 2, -}; - -#define V4L2_CID_CAMERA_TIME_INFO (V4L2_CID_PRIVATE_BASE + 302) - -#define V4L2_CID_CAMERA_AF_LED (V4L2_CID_PRIVATE_BASE + 303) -enum set_AF_LED { - V4L2_AF_LED_OFF = 0, - V4L2_AF_LED_ON = 1, -}; - -#define V4L2_CID_CAMERA_LENS_TIMER (V4L2_CID_PRIVATE_BASE + 304) - -#define V4L2_CID_CAMERA_FLASH_BATT_INFO (V4L2_CID_PRIVATE_BASE + 305) -enum set_FLASH_BATT_INFO { - V4L2_FLASH_NORMAL_BATT = 0, - V4L2_FLASH_LOW_BATT = 1, -}; - -#define V4L2_CID_CAMERA_STREAM_PART2 (V4L2_CID_PRIVATE_BASE + 306) - -#define V4L2_CID_CAMERA_WIDGET_MODE_LEVEL (V4L2_CID_PRIVATE_BASE+307) -enum v4l2_widget_mode_level { - V4L2_WIDGET_MODE_LEVEL_1 = 1, - V4L2_WIDGET_MODE_LEVEL_2 = 2, - V4L2_WIDGET_MODE_LEVEL_3 = 3, -}; - -#define V4L2_CID_CAMERA_SMART_READ1 (V4L2_CID_PRIVATE_BASE + 308) -#define V4L2_CID_CAMERA_SMART_READ2 (V4L2_CID_PRIVATE_BASE + 309) - -#define V4L2_CID_CAMERA_PREVIEW_WIDTH (V4L2_CID_PRIVATE_BASE + 310) -#define V4L2_CID_CAMERA_PREVIEW_HEIGHT (V4L2_CID_PRIVATE_BASE + 311) -#define V4L2_CID_CAMERA_PREVIEW_SIZE (V4L2_CID_PRIVATE_BASE + 312) - -#define V4L2_CID_CAMERA_WARNING_CONDITION (V4L2_CID_PRIVATE_BASE + 313) -#define V4L2_CID_CAMERA_EXIF_FL_35mm (V4L2_CID_PRIVATE_BASE + 314) - -#define V4L2_CID_CAMERA_LENS_STATUS (V4L2_CID_PRIVATE_BASE + 315) -#define V4L2_CID_CAMERA_HOLD_LENS (V4L2_CID_PRIVATE_BASE + 316) - -#define V4L2_CID_CAMERA_TIMER_LED (V4L2_CID_PRIVATE_BASE + 317) -enum set_timer_LED { - V4L2_TIMER_LED_OFF = 0, - V4L2_TIMER_LED_2_SEC = 2, - V4L2_TIMER_LED_5_SEC = 5, - V4L2_TIMER_LED_10_SEC = 10, -}; -#define V4L2_CID_CAMERA_TIMER_MODE (V4L2_CID_PRIVATE_BASE + 318) -#define V4L2_CID_CAMERA_SAMSUNG_APP (V4L2_CID_PRIVATE_BASE + 319) -#define V4L2_CID_CAMERA_INIT (V4L2_CID_PRIVATE_BASE + 320) -#define V4L2_CID_CAMERA_POST_INIT (V4L2_CID_PRIVATE_BASE + 321) - -/* Pixel format FOURCC depth Description */ -enum v4l2_pix_format_mode { - V4L2_PIX_FMT_MODE_PREVIEW, - V4L2_PIX_FMT_MODE_CAPTURE, - V4L2_PIX_FMT_MODE_HDR, - V4L2_PIX_FMT_MODE_VT_MIRROR, - V4L2_PIX_FMT_MODE_VT_NONMIRROR, -}; - -#define V4L2_CID_SET_CONTINUE_FPS (V4L2_CID_PRIVATE_BASE + 500) -#define V4L2_CID_CONTINUESHOT_PROC (V4L2_CID_PRIVATE_BASE + 501) -enum v4l2_continuecshot_proc_state { - V4L2_INT_STATE_FRAME_SYNC = 0, - V4L2_INT_STATE_CAPTURE_SYNC, - V4L2_INT_STATE_CONTINUE_CANCEL, - V4L2_INT_STATE_CONTINUE_END, - V4L2_INT_STATE_START_CAPTURE, -}; - -#define V4L2_CID_CAMERA_GET_MODE (V4L2_CID_PRIVATE_BASE + 502) - -#define V4L2_CID_CAMERA_FACTORY_SEND_SETTING \ - (V4L2_CID_PRIVATE_BASE + 503) -#define V4L2_CID_CAMERA_FACTORY_SEND_VALUE \ - (V4L2_CID_PRIVATE_BASE + 504) - -#define V4L2_CID_CAMERA_FACTORY_TILT_SCAN_MIN \ - (V4L2_CID_PRIVATE_BASE + 505) -#define V4L2_CID_CAMERA_FACTORY_TILT_SCAN_MAX \ - (V4L2_CID_PRIVATE_BASE + 506) -#define V4L2_CID_CAMERA_FACTORY_TILT_FIELD \ - (V4L2_CID_PRIVATE_BASE + 507) -#define V4L2_CID_CAMERA_FACTORY_TILT_AF_RANGE_MIN \ - (V4L2_CID_PRIVATE_BASE + 508) -#define V4L2_CID_CAMERA_FACTORY_TILT_AF_RANGE_MAX \ - (V4L2_CID_PRIVATE_BASE + 509) -#define V4L2_CID_CAMERA_FACTORY_TILT_DIFF_RANGE_MIN \ - (V4L2_CID_PRIVATE_BASE + 510) -#define V4L2_CID_CAMERA_FACTORY_TILT_DIFF_RANGE_MAX \ - (V4L2_CID_PRIVATE_BASE + 511) - -#define V4L2_CID_CAMERA_FACTORY_IR_R_GAIN_MIN \ - (V4L2_CID_PRIVATE_BASE + 512) -#define V4L2_CID_CAMERA_FACTORY_IR_R_GAIN_MAX \ - (V4L2_CID_PRIVATE_BASE + 513) -#define V4L2_CID_CAMERA_FACTORY_IR_B_GAIN_MIN \ - (V4L2_CID_PRIVATE_BASE + 514) -#define V4L2_CID_CAMERA_FACTORY_IR_B_GAIN_MAX \ - (V4L2_CID_PRIVATE_BASE + 515) - -#define V4L2_CID_CAMERA_FACTORY_FLASH_MAN_CHARGE \ - (V4L2_CID_PRIVATE_BASE + 516) -#define V4L2_CID_CAMERA_FACTORY_FLASH_MAN_EN \ - (V4L2_CID_PRIVATE_BASE + 517) - -#define V4L2_CID_CAMERA_FACTORY_SEND_WORD_VALUE \ - (V4L2_CID_PRIVATE_BASE + 518) -#define V4L2_CID_CAMERA_FACTORY_SEND_LONG_VALUE \ - (V4L2_CID_PRIVATE_BASE + 519) - -#define V4L2_CID_CAMERA_FACTORY_DFPX_NLV_DR1_HD \ - (V4L2_CID_PRIVATE_BASE + 520) - -#define V4L2_CID_BURSTSHOT_PROC (V4L2_CID_PRIVATE_BASE + 521) -enum v4l2_burst_proc_state { - V4L2_INT_STATE_BURST_START = 0, - V4L2_INT_STATE_BURST_SYNC, - V4L2_INT_STATE_BURST_STOP, - V4L2_INT_STATE_BURST_SOUND, - V4L2_INT_STATE_BURST_STOP_REQ, -}; - -#define V4L2_CID_CAMERA_FACTORY_TILT \ - (V4L2_CID_PRIVATE_BASE + 522) -enum set_Factory_Tilt { - FACTORY_TILT_ONE_SCRIPT_RUN = 0, - FACTORY_TILT_ONE_SCRIPT_DISP1, - FACTORY_TILT_ONE_SCRIPT_DISP2, - FACTORY_TILT_ONE_SCRIPT_DISP3, - FACTORY_TILT_ONE_SCRIPT_DISP4, - FACTORY_TILT_ONE_SCRIPT_DISP5, -}; - -#define V4L2_CID_CAMERA_FACTORY_IR_CHECK \ - (V4L2_CID_PRIVATE_BASE + 523) -enum set_Factory_IR_Check { - FACTORY_IR_CHECK_LOG = 0, -}; - -#define V4L2_CID_BURSTSHOT_SET_POSTVIEW_SIZE (V4L2_CID_PRIVATE_BASE + 524) - -#define V4L2_CID_BURSTSHOT_SET_SNAPSHOT_SIZE (V4L2_CID_PRIVATE_BASE + 525) - -#define V4L2_CID_START_CAPTURE_KIND (V4L2_CID_PRIVATE_BASE + 526) - -#define V4L2_CID_CAMERA_FACTORY_FLASH_CHARGE (V4L2_CID_PRIVATE_BASE+527) - -enum set_Start_Capture_Mode { - START_CAPTURE_POSTVIEW = 0, - START_CAPTURE_YUV_MAIN, - START_CAPTURE_JPEG_MAIN, - START_CAPTURE_THUMB, -}; - -/* ISP DEBUG CODE */ -#define V4L2_CID_ISP_DEBUG_READ (V4L2_CID_FIMC_IS_ISP_DBG_BASE + 1) -#define V4L2_CID_ISP_DEBUG_WRITE (V4L2_CID_FIMC_IS_ISP_DBG_BASE + 2) -#define V4L2_CID_ISP_DEBUG_READ_MEM (V4L2_CID_FIMC_IS_ISP_DBG_BASE + 3) -#define V4L2_CID_ISP_DEBUG_WRITE_MEM (V4L2_CID_FIMC_IS_ISP_DBG_BASE + 4) -#define V4L2_CID_ISP_DEBUG_READ_FILE (V4L2_CID_FIMC_IS_ISP_DBG_BASE + 5) -#define V4L2_CID_ISP_DEBUG_WRITE_FILE (V4L2_CID_FIMC_IS_ISP_DBG_BASE + 6) -#define V4L2_CID_ISP_DEBUG_LOGV (V4L2_CID_FIMC_IS_ISP_DBG_BASE + 7) - -/* 12 Y/CbCr 4:2:0 64x32 macroblocks */ -#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2') -#define V4L2_PIX_FMT_NV21T v4l2_fourcc('T', 'V', '2', '1') -#define V4L2_PIX_FMT_INTERLEAVED v4l2_fourcc('I', 'T', 'L', 'V') - -/* - * * V4L2 extention for digital camera - * */ -/* Strobe flash light */ -enum v4l2_strobe_control { - /* turn off the flash light */ - V4L2_STROBE_CONTROL_OFF = 0, - /* turn on the flash light */ - V4L2_STROBE_CONTROL_ON = 1, - /* act guide light before splash */ - V4L2_STROBE_CONTROL_AFGUIDE = 2, - /* charge the flash light */ - V4L2_STROBE_CONTROL_CHARGE = 3, -}; - -enum v4l2_strobe_conf { - V4L2_STROBE_OFF = 0, /* Always off */ - V4L2_STROBE_ON = 1, /* Always splashes */ - /* Auto control presets */ - V4L2_STROBE_AUTO = 2, - V4L2_STROBE_REDEYE_REDUCTION = 3, - V4L2_STROBE_SLOW_SYNC = 4, - V4L2_STROBE_FRONT_CURTAIN = 5, - V4L2_STROBE_REAR_CURTAIN = 6, - /* Extra manual control presets */ - /* keep turned on until turning off */ - V4L2_STROBE_PERMANENT = 7, - V4L2_STROBE_EXTERNAL = 8, -}; - -enum v4l2_strobe_status { - V4L2_STROBE_STATUS_OFF = 0, - /* while processing configurations */ - V4L2_STROBE_STATUS_BUSY = 1, - V4L2_STROBE_STATUS_ERR = 2, - V4L2_STROBE_STATUS_CHARGING = 3, - V4L2_STROBE_STATUS_CHARGED = 4, -}; - -/* capabilities field */ -/* No strobe supported */ -#define V4L2_STROBE_CAP_NONE 0x0000 -/* Always flash off mode */ -#define V4L2_STROBE_CAP_OFF 0x0001 -/* Always use flash light mode */ -#define V4L2_STROBE_CAP_ON 0x0002 -/* Flashlight works automatic */ -#define V4L2_STROBE_CAP_AUTO 0x0004 -/* Red-eye reduction */ -#define V4L2_STROBE_CAP_REDEYE 0x0008 -/* Slow sync */ -#define V4L2_STROBE_CAP_SLOWSYNC 0x0010 -/* Front curtain */ -#define V4L2_STROBE_CAP_FRONT_CURTAIN 0x0020 -/* Rear curtain */ -#define V4L2_STROBE_CAP_REAR_CURTAIN 0x0040 -/* keep turned on until turning off */ -#define V4L2_STROBE_CAP_PERMANENT 0x0080 -/* use external strobe */ -#define V4L2_STROBE_CAP_EXTERNAL 0x0100 - -/* Set mode and Get status */ -struct v4l2_strobe { - /* off/on/charge:0/1/2 */ - enum v4l2_strobe_control control; - /* supported strobe capabilities */ - __u32 capabilities; - enum v4l2_strobe_conf mode; - enum v4l2_strobe_status status; /* read only */ -/* default is 0 and range of value varies from each models */ - __u32 flash_ev; - __u32 reserved[4]; -}; - -#define VIDIOC_S_STROBE _IOWR('V', 83, struct v4l2_strobe) -#define VIDIOC_G_STROBE _IOR('V', 84, struct v4l2_strobe) - -/* Object recognition and collateral actions */ -enum v4l2_recog_mode { - V4L2_RECOGNITION_MODE_OFF = 0, - V4L2_RECOGNITION_MODE_ON = 1, - V4L2_RECOGNITION_MODE_LOCK = 2, -}; - -enum v4l2_recog_action { - V4L2_RECOGNITION_ACTION_NONE = 0, /* only recognition */ - V4L2_RECOGNITION_ACTION_BLINK = 1, /* Capture on blinking */ - V4L2_RECOGNITION_ACTION_SMILE = 2, /* Capture on smiling */ -}; - -enum v4l2_recog_pattern { - V4L2_RECOG_PATTERN_FACE = 0, /* Face */ - V4L2_RECOG_PATTERN_HUMAN = 1, /* Human */ - V4L2_RECOG_PATTERN_CHAR = 2, /* Character */ -}; - -struct v4l2_recog_rect { - enum v4l2_recog_pattern p; /* detected pattern */ - struct v4l2_rect o; /* detected area */ - __u32 reserved[4]; -}; - -struct v4l2_recog_data { - __u8 detect_cnt; /* detected object counter */ - struct v4l2_rect o; /* detected area */ - __u32 reserved[4]; -}; - -struct v4l2_recognition { - enum v4l2_recog_mode mode; - - /* Which pattern to detect */ - enum v4l2_recog_pattern pattern; - - /* How many object to detect */ - __u8 obj_num; - - /* select detected object */ - __u32 detect_idx; - - /* read only :Get object coordination */ - struct v4l2_recog_data data; - - enum v4l2_recog_action action; - __u32 reserved[4]; -}; - -#define VIDIOC_S_RECOGNITION _IOWR('V', 85, struct v4l2_recognition) -#define VIDIOC_G_RECOGNITION _IOR('V', 86, struct v4l2_recognition) - -#endif /* __LINUX_VIDEODEV2_SAMSUNG_H */ diff --git a/exynos4/hal/include/videodev2_exynos_media.h b/exynos4/hal/include/videodev2_exynos_media.h deleted file mode 100644 index 2768201..0000000 --- a/exynos4/hal/include/videodev2_exynos_media.h +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Video for Linux Two header file for Exynos - * - * Copyright (c) 2012 Samsung Electronics Co., Ltd. - * http://www.samsung.com - * - * This header file contains several v4l2 APIs to be proposed to v4l2 - * community and until being accepted, will be used restrictly for Exynos. - * - * 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. - */ - -#ifndef __LINUX_VIDEODEV2_EXYNOS_H -#define __LINUX_VIDEODEV2_EXYNOS_H - -/* Pixel format FOURCC depth Description */ - -/* two planes -- one Y, one Cr + Cb interleaved */ -#define V4L2_PIX_FMT_YUV444_2P v4l2_fourcc('Y', 'U', '2', 'P') /* 24 Y/CbCr */ -#define V4L2_PIX_FMT_YVU444_2P v4l2_fourcc('Y', 'V', '2', 'P') /* 24 Y/CrCb */ - -/* three planes -- one Y, one Cr, one Cb */ -#define V4L2_PIX_FMT_YUV444_3P v4l2_fourcc('Y', 'U', '3', 'P') /* 24 Y/Cb/Cr */ - -/* two non contiguous planes - one Y, one Cr + Cb interleaved */ -/* 21 Y/CrCb 4:2:0 */ -#define V4L2_PIX_FMT_NV21M v4l2_fourcc('N', 'M', '2', '1') -/* 12 Y/CbCr 4:2:0 16x16 macroblocks */ -#define V4L2_PIX_FMT_NV12MT_16X16 v4l2_fourcc('V', 'M', '1', '2') - -/* three non contiguous planes - Y, Cb, Cr */ -/* 12 YVU420 planar */ -#define V4L2_PIX_FMT_YVU420M v4l2_fourcc('Y', 'V', 'U', 'M') - -/* compressed formats */ -#define V4L2_PIX_FMT_H264_MVC v4l2_fourcc('M', '2', '6', '4') /* H264 MVC */ -#define V4L2_PIX_FMT_FIMV v4l2_fourcc('F', 'I', 'M', 'V') /* FIMV */ -#define V4L2_PIX_FMT_FIMV1 v4l2_fourcc('F', 'I', 'M', '1') /* FIMV1 */ -#define V4L2_PIX_FMT_FIMV2 v4l2_fourcc('F', 'I', 'M', '2') /* FIMV2 */ -#define V4L2_PIX_FMT_FIMV3 v4l2_fourcc('F', 'I', 'M', '3') /* FIMV3 */ -#define V4L2_PIX_FMT_FIMV4 v4l2_fourcc('F', 'I', 'M', '4') /* FIMV4 */ -#define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */ - -/* yuv444 of JFIF JPEG */ -#define V4L2_PIX_FMT_JPEG_444 v4l2_fourcc('J', 'P', 'G', '4') -/* yuv422 of JFIF JPEG */ -#define V4L2_PIX_FMT_JPEG_422 v4l2_fourcc('J', 'P', 'G', '2') -/* yuv420 of JFIF JPEG */ -#define V4L2_PIX_FMT_JPEG_420 v4l2_fourcc('J', 'P', 'G', '0') -/* grey of JFIF JPEG */ -#define V4L2_PIX_FMT_JPEG_GRAY v4l2_fourcc('J', 'P', 'G', 'G') - -/* - * C O N T R O L S - */ -/* CID base for Exynos controls (USER_CLASS) */ -#define V4L2_CID_EXYNOS_BASE (V4L2_CTRL_CLASS_USER | 0x2000) - -/* for rgb alpha function */ -#define V4L2_CID_GLOBAL_ALPHA (V4L2_CID_EXYNOS_BASE + 1) - -/* cacheable configuration */ -#define V4L2_CID_CACHEABLE (V4L2_CID_EXYNOS_BASE + 10) - -/* jpeg captured size */ -#define V4L2_CID_CAM_JPEG_MEMSIZE (V4L2_CID_EXYNOS_BASE + 20) -#define V4L2_CID_CAM_JPEG_ENCODEDSIZE (V4L2_CID_EXYNOS_BASE + 21) - -#define V4L2_CID_SET_SHAREABLE (V4L2_CID_EXYNOS_BASE + 40) - -/* TV configuration */ -#define V4L2_CID_TV_LAYER_BLEND_ENABLE (V4L2_CID_EXYNOS_BASE + 50) -#define V4L2_CID_TV_LAYER_BLEND_ALPHA (V4L2_CID_EXYNOS_BASE + 51) -#define V4L2_CID_TV_PIXEL_BLEND_ENABLE (V4L2_CID_EXYNOS_BASE + 52) -#define V4L2_CID_TV_CHROMA_ENABLE (V4L2_CID_EXYNOS_BASE + 53) -#define V4L2_CID_TV_CHROMA_VALUE (V4L2_CID_EXYNOS_BASE + 54) -#define V4L2_CID_TV_HPD_STATUS (V4L2_CID_EXYNOS_BASE + 55) -#define V4L2_CID_TV_LAYER_PRIO (V4L2_CID_EXYNOS_BASE + 56) -#define V4L2_CID_TV_SET_DVI_MODE (V4L2_CID_EXYNOS_BASE + 57) - -/* for color space conversion equation selection */ -#define V4L2_CID_CSC_EQ_MODE (V4L2_CID_EXYNOS_BASE + 100) -#define V4L2_CID_CSC_EQ (V4L2_CID_EXYNOS_BASE + 101) -#define V4L2_CID_CSC_RANGE (V4L2_CID_EXYNOS_BASE + 102) - -/* for DRM playback scenario */ -#define V4L2_CID_USE_SYSMMU (V4L2_CID_EXYNOS_BASE + 200) -#define V4L2_CID_M2M_CTX_NUM (V4L2_CID_EXYNOS_BASE + 201) - -/* CID base for MFC controls (MPEG_CLASS) */ -#define V4L2_CID_MPEG_MFC_BASE (V4L2_CTRL_CLASS_MPEG | 0x2000) - -#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_AVAIL \ - (V4L2_CID_MPEG_MFC_BASE + 1) -#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRGMENT_ID \ - (V4L2_CID_MPEG_MFC_BASE + 2) -#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_INFO \ - (V4L2_CID_MPEG_MFC_BASE + 3) -#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_GRID_POS \ - (V4L2_CID_MPEG_MFC_BASE + 4) - -#define V4L2_CID_MPEG_MFC51_VIDEO_PACKED_PB \ - (V4L2_CID_MPEG_MFC_BASE + 5) -#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_TAG \ - (V4L2_CID_MPEG_MFC_BASE + 6) -#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_ENABLE \ - (V4L2_CID_MPEG_MFC_BASE + 7) -#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_LUMA \ - (V4L2_CID_MPEG_MFC_BASE + 8) -#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_CHROMA \ - (V4L2_CID_MPEG_MFC_BASE + 9) -#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_LUMA_BOT \ - (V4L2_CID_MPEG_MFC_BASE + 10) -#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_DATA_CHROMA_BOT \ - (V4L2_CID_MPEG_MFC_BASE + 11) -#define V4L2_CID_MPEG_MFC51_VIDEO_CRC_GENERATED \ - (V4L2_CID_MPEG_MFC_BASE + 12) -#define V4L2_CID_MPEG_MFC51_VIDEO_CHECK_STATE \ - (V4L2_CID_MPEG_MFC_BASE + 13) -#define V4L2_CID_MPEG_MFC51_VIDEO_DISPLAY_STATUS \ - (V4L2_CID_MPEG_MFC_BASE + 14) - -#define V4L2_CID_MPEG_MFC51_VIDEO_LUMA_ADDR \ - (V4L2_CID_MPEG_MFC_BASE + 15) -#define V4L2_CID_MPEG_MFC51_VIDEO_CHROMA_ADDR \ - (V4L2_CID_MPEG_MFC_BASE + 16) - -#define V4L2_CID_MPEG_MFC51_VIDEO_STREAM_SIZE \ - (V4L2_CID_MPEG_MFC_BASE + 17) -#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_COUNT \ - (V4L2_CID_MPEG_MFC_BASE + 18) -#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_TYPE \ - (V4L2_CID_MPEG_MFC_BASE + 19) -enum v4l2_mpeg_mfc51_video_frame_type { - V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_NOT_CODED = 0, - V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_I_FRAME = 1, - V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_P_FRAME = 2, - V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_B_FRAME = 3, - V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_SKIPPED = 4, - V4L2_MPEG_MFC51_VIDEO_FRAME_TYPE_OTHERS = 5, -}; - -#define V4L2_CID_MPEG_MFC51_VIDEO_H264_INTERLACE \ - (V4L2_CID_MPEG_MFC_BASE + 20) -#define V4L2_CID_MPEG_MFC51_VIDEO_H264_RC_FRAME_RATE \ - (V4L2_CID_MPEG_MFC_BASE + 21) -#define V4L2_CID_MPEG_MFC51_VIDEO_MPEG4_VOP_TIME_RES \ - (V4L2_CID_MPEG_MFC_BASE + 22) -#define V4L2_CID_MPEG_MFC51_VIDEO_MPEG4_VOP_FRM_DELTA \ - (V4L2_CID_MPEG_MFC_BASE + 23) -#define V4L2_CID_MPEG_MFC51_VIDEO_H263_RC_FRAME_RATE \ - (V4L2_CID_MPEG_MFC_BASE + 24) - -#define V4L2_CID_MPEG_MFC6X_VIDEO_FRAME_DELTA \ - (V4L2_CID_MPEG_MFC_BASE + 25) - -#define V4L2_CID_MPEG_MFC51_VIDEO_I_PERIOD_CH V4L2_CID_MPEG_VIDEO_GOP_SIZE -#define V4L2_CID_MPEG_MFC51_VIDEO_FRAME_RATE_CH \ - V4L2_CID_MPEG_MFC51_VIDEO_H264_RC_FRAME_RATE -#define V4L2_CID_MPEG_MFC51_VIDEO_BIT_RATE_CH V4L2_CID_MPEG_VIDEO_BITRATE - -/* proposed CIDs, based on 3.3-rc3 */ -#define V4L2_CID_MPEG_VIDEO_VBV_DELAY (V4L2_CID_MPEG_MFC_BASE + 26) - -#define V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_S_B \ - V4L2_MPEG_VIDEO_H264_LOOP_FILTER_MODE_DISABLED_AT_SLICE_BOUNDARY - -#define V4L2_CID_MPEG_VIDEO_H264_SEI_FRAME_PACKING \ - (V4L2_CID_MPEG_MFC_BASE + 27) -#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_CURRENT_FRAME_0 \ - (V4L2_CID_MPEG_MFC_BASE + 28) -#define V4L2_CID_MPEG_VIDEO_H264_SEI_FP_ARRANGEMENT_TYPE \ - (V4L2_CID_MPEG_MFC_BASE + 29) -enum v4l2_mpeg_video_h264_sei_fp_arrangement_type { - V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_CHEKERBOARD = 0, - V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_COLUMN = 1, - V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_ROW = 2, - V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_SIDE_BY_SIDE = 3, - V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_TOP_BOTTOM = 4, - V4L2_MPEG_VIDEO_H264_SEI_FP_TYPE_TEMPORAL = 5, -}; -#define V4L2_CID_MPEG_VIDEO_H264_FMO (V4L2_CID_MPEG_MFC_BASE + 30) -#define V4L2_CID_MPEG_VIDEO_H264_FMO_MAP_TYPE (V4L2_CID_MPEG_MFC_BASE + 31) -enum v4l2_mpeg_video_h264_fmo_map_type { - V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_INTERLEAVED_SLICES = 0, - V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_SCATTERED_SLICES = 1, - V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_FOREGROUND_WITH_LEFT_OVER = 2, - V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_BOX_OUT = 3, - V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_RASTER_SCAN = 4, - V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_WIPE_SCAN = 5, - V4L2_MPEG_VIDEO_H264_FMO_MAP_TYPE_EXPLICIT = 6, -}; -#define V4L2_CID_MPEG_VIDEO_H264_FMO_SLICE_GROUP \ - (V4L2_CID_MPEG_MFC_BASE + 32) -#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_DIRECTION \ - (V4L2_CID_MPEG_MFC_BASE + 33) -enum v4l2_mpeg_video_h264_fmo_change_dir { - V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_RIGHT = 0, - V4L2_MPEG_VIDEO_H264_FMO_CHANGE_DIR_LEFT = 1, -}; -#define V4L2_CID_MPEG_VIDEO_H264_FMO_CHANGE_RATE \ - (V4L2_CID_MPEG_MFC_BASE + 34) -#define V4L2_CID_MPEG_VIDEO_H264_FMO_RUN_LENGTH \ - (V4L2_CID_MPEG_MFC_BASE + 35) -#define V4L2_CID_MPEG_VIDEO_H264_ASO \ - (V4L2_CID_MPEG_MFC_BASE + 36) -#define V4L2_CID_MPEG_VIDEO_H264_ASO_SLICE_ORDER \ - (V4L2_CID_MPEG_MFC_BASE + 37) -#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING \ - (V4L2_CID_MPEG_MFC_BASE + 38) -#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_TYPE \ - (V4L2_CID_MPEG_MFC_BASE + 39) -enum v4l2_mpeg_video_h264_hierarchical_coding_type { - V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_B = 0, - V4L2_MPEG_VIDEO_H264_HIERARCHICAL_CODING_P = 1, -}; -#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER \ - (V4L2_CID_MPEG_MFC_BASE + 40) -#define V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP \ - (V4L2_CID_MPEG_MFC_BASE + 41) -#define V4L2_CID_MPEG_VIDEO_H264_MVC_VIEW_ID \ - (V4L2_CID_MPEG_MFC_BASE + 42) -#endif /* __LINUX_VIDEODEV2_EXYNOS_H */ diff --git a/exynos4/hal/libUMP/Android.mk b/exynos4/hal/libUMP/Android.mk deleted file mode 100644 index 2059eda..0000000 --- a/exynos4/hal/libUMP/Android.mk +++ /dev/null @@ -1,46 +0,0 @@ -# -# Copyright (C) 2010 ARM Limited. All rights reserved. -# -# Copyright (C) 2008 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. - -ifeq ($(TARGET_BOARD_PLATFORM),exynos4) - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_PRELINK_MODULE := false -LOCAL_SHARED_LIBRARIES := liblog libcutils - -LOCAL_CFLAGS:= -DLOG_TAG=\"UMP\" - -LOCAL_C_INCLUDES:= \ - $(LOCAL_PATH)/../include \ - $(LOCAL_PATH)/include - -UMP_SRCS := \ - arch_011_udd/ump_frontend.c \ - arch_011_udd/ump_ref_drv.c \ - arch_011_udd/ump_arch.c \ - os/linux/ump_uku.c \ - os/linux/ump_osu_memory.c \ - os/linux/ump_osu_locks.c - -LOCAL_SRC_FILES := $(UMP_SRCS) - -LOCAL_MODULE := libUMP -LOCAL_MODULE_TAGS := optional -include $(BUILD_SHARED_LIBRARY) - -endif diff --git a/exynos4/hal/libUMP/LICENSE b/exynos4/hal/libUMP/LICENSE deleted file mode 100644 index 9262a52..0000000 --- a/exynos4/hal/libUMP/LICENSE +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2011, 2013 ARM Limited. All rights reserved. - * - * 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. - */ -Building the UMP user space library for Linux ---------------------------------------------- - -A simple Makefile is provided, and the UMP user space library can be built -simply by issuing make. This Makefile is setup to use the ARM GCC compiler -from CodeSourcery, and it builds for ARMv6. Modification to this Makefile -is needed in order to build for other configurations. - -In order to use this library from the Mali GPU driver, invoke the Mali GPU -driver build system with the following two make variables set; -- UMP_INCLUDE_DIR should point to the include folder inside this package -- UMP_LIB should point to the built library (libUMP.so) - -This does not apply to Android builds, where the Android.mk file for the -Mali GPU driver needs to be manually edited in order to add the correct -include path and link against the correct library. diff --git a/exynos4/hal/libUMP/arch_011_udd/ump_arch.c b/exynos4/hal/libUMP/arch_011_udd/ump_arch.c deleted file mode 100644 index 1e3376d..0000000 --- a/exynos4/hal/libUMP/arch_011_udd/ump_arch.c +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (C) 2010-2013 ARM Limited. All rights reserved. - * - * 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 ump_arch.c - * - * UMP arch layer for UMP-UDD - */ - -#include "ump.h" -#include "ump_arch.h" -#include <ump/ump_debug.h> - -#include <ump/ump_uk_types.h> -#include "../os/ump_uku.h" - -#include <cutils/log.h> - -/** Pointer to an OS-Specific context that we should pass in _uku_ calls */ -void *ump_uk_ctx = NULL; - -/** Reference counting of ump_arch_open() and ump_arch_close(). */ -static volatile int ump_ref_count = 0; - -/** Lock for critical section in open/close */ -_ump_osu_lock_t * ump_lock_arch = NULL; - -ump_result ump_arch_open(void) -{ - ump_result retval = UMP_OK; - - _ump_osu_lock_auto_init( &ump_lock_arch, _UMP_OSU_LOCKFLAG_DEFAULT, 0, 0 ); - - /* Check that the lock was initialized */ - if (NULL == ump_lock_arch) - { - UMP_DEBUG_PRINT(1, ("UMP: ump_arch_open() failed to init lock\n")); - return UMP_ERROR; - } - - /* Attempt to obtain a lock */ - if( _UMP_OSU_ERR_OK != _ump_osu_lock_wait( ump_lock_arch, _UMP_OSU_LOCKMODE_RW ) ) - { - UMP_DEBUG_PRINT(1, ("UMP: ump_arch_open() failed to acquire lock\n")); - return UMP_ERROR; - } - - /* ASSERT NEEDED */ - UMP_DEBUG_ASSERT(0 <= ump_ref_count, ("UMP: Reference count invalid at _ump_base_arch_open()")); - ump_ref_count++; - - if (1 == ump_ref_count) - { - /* We are the first, open the UMP device driver */ - - if (_UMP_OSU_ERR_OK != _ump_uku_open( &ump_uk_ctx )) - { - UMP_DEBUG_PRINT(1, ("UMP: ump_arch_open() failed to open UMP device driver\n")); - retval = UMP_ERROR; - ump_ref_count--; - } - } - - /* Signal the lock so someone else can use it */ - _ump_osu_lock_signal( ump_lock_arch, _UMP_OSU_LOCKMODE_RW ); - - return retval; -} - - - -void ump_arch_close(void) -{ - _ump_osu_lock_auto_init( &ump_lock_arch, _UMP_OSU_LOCKFLAG_DEFAULT, 0, 0 ); - - /* Check that the lock was initialized */ - if(NULL == ump_lock_arch) - { - UMP_DEBUG_PRINT(1, ("UMP: ump_arch_close() failed to init lock\n")); - return; - } - - /* Attempt to obtain a lock */ - if( _UMP_OSU_ERR_OK != _ump_osu_lock_wait( ump_lock_arch, _UMP_OSU_LOCKMODE_RW ) ) - { - UMP_DEBUG_PRINT(1, ("UMP: ump_arch_close() failed to acquire lock\n")); - return; - } - - UMP_DEBUG_ASSERT(0 < ump_ref_count, ("UMP: ump_arch_close() called while no references exist")); - if (ump_ref_count > 0) - { - ump_ref_count--; - if (0 == ump_ref_count) - { - _ump_osu_errcode_t retval = _ump_uku_close(&ump_uk_ctx); - UMP_DEBUG_ASSERT(retval == _UMP_OSU_ERR_OK, ("UMP: Failed to close UMP interface")); - UMP_IGNORE(retval); - ump_uk_ctx = NULL; - _ump_osu_lock_signal( ump_lock_arch, _UMP_OSU_LOCKMODE_RW ); - _ump_osu_lock_term( ump_lock_arch ); /* Not 100% thread safe, since another thread can already be waiting for this lock in ump_arch_open() */ - ump_lock_arch = NULL; - return; - } - } - - /* Signal the lock so someone else can use it */ - _ump_osu_lock_signal( ump_lock_arch, _UMP_OSU_LOCKMODE_RW ); -} - - - -ump_secure_id ump_arch_allocate(unsigned long * size, ump_alloc_constraints constraints) -{ - _ump_uk_allocate_s call_arg; - - if ( NULL == size ) - { - return UMP_INVALID_SECURE_ID; - } - - call_arg.ctx = ump_uk_ctx; - call_arg.secure_id = UMP_INVALID_SECURE_ID; - call_arg.size = *size; -#ifdef UMP_DEBUG_SKIP_CODE - /** Run-time ASSERTing that _ump_uk_api_version_s and ump_alloc_constraints are - * interchangable */ - switch (constraints) - { - case UMP_REF_DRV_CONSTRAINT_NONE: - UMP_DEBUG_ASSERT( UMP_REF_DRV_UK_CONSTRAINT_NONE == constraints, ("ump_uk_alloc_constraints out of sync with ump_alloc_constraints") ); - break; - case UMP_REF_DRV_CONSTRAINT_PHYSICALLY_LINEAR: - UMP_DEBUG_ASSERT( UMP_REF_DRV_UK_CONSTRAINT_PHYSICALLY_LINEAR == constraints, ("ump_uk_alloc_constraints out of sync with ump_alloc_constraints") ); - break; - default: - UMP_DEBUG_ASSERT( 1, ("ump_uk_alloc_constraints out of sync with ump_alloc_constraints: %d unrecognized", constraints) ); - break; - } -#endif - call_arg.constraints = (ump_uk_alloc_constraints)constraints; - - if ( _UMP_OSU_ERR_OK != _ump_uku_allocate(&call_arg) ) - { - return UMP_INVALID_SECURE_ID; - } - - *size = call_arg.size; - - UMP_DEBUG_PRINT(4, ("UMP: Allocated ID %u, size %ul", call_arg.secure_id, call_arg.size)); - - return call_arg.secure_id; -} - - -ump_secure_id ump_arch_ion_import(int ion_fd, unsigned long *size, ump_alloc_constraints constraints) -{ - _ump_uk_ion_import_s call_arg; - - call_arg.ctx = ump_uk_ctx; - call_arg.ion_fd = ion_fd; - call_arg.secure_id = UMP_INVALID_SECURE_ID; - call_arg.size = *size; - call_arg.constraints = (ump_uk_alloc_constraints)constraints; - - UMP_DEBUG_PRINT(4, ("%s ion_fd=%d size=%lu constraints=%x", __func__, ion_fd, (unsigned long)size, constraints)); - - if ( _UMP_OSU_ERR_OK != _ump_uku_ion_import(&call_arg) ) - { - return UMP_INVALID_SECURE_ID; - } - - *size = call_arg.size; - - UMP_DEBUG_PRINT(4, ("%s Allocated ID %u, size %ul", __func__, call_arg.secure_id, call_arg.size)); - - return call_arg.secure_id; -} - - -unsigned long ump_arch_size_get(ump_secure_id secure_id) -{ - _ump_uk_size_get_s dd_size_call_arg; - - dd_size_call_arg.ctx = ump_uk_ctx; - dd_size_call_arg.secure_id = secure_id; - dd_size_call_arg.size = 0; - - if (_UMP_OSU_ERR_OK == _ump_uku_size_get( &dd_size_call_arg ) ) - { - return dd_size_call_arg.size; - } - - return 0; -} - - -void ump_arch_reference_release(ump_secure_id secure_id) -{ - _ump_uk_release_s dd_release_call_arg; - _ump_osu_errcode_t retval; - - dd_release_call_arg.ctx = ump_uk_ctx; - dd_release_call_arg.secure_id = secure_id; - - UMP_DEBUG_PRINT(4, ("UMP: Releasing ID %u", secure_id)); - - retval = _ump_uku_release( &dd_release_call_arg ); - UMP_DEBUG_ASSERT(retval == _UMP_OSU_ERR_OK, ("UMP: Failed to release reference to UMP memory")); - UMP_IGNORE(retval); -} - - -void* ump_arch_map(ump_secure_id secure_id, unsigned long size, ump_cache_enabled cache, unsigned long *cookie_out) -{ - _ump_uk_map_mem_s dd_map_call_arg; - - UMP_DEBUG_ASSERT_POINTER( cookie_out ); - - dd_map_call_arg.ctx = ump_uk_ctx; - dd_map_call_arg.secure_id = secure_id; - dd_map_call_arg.size = size; - dd_map_call_arg.is_cached = (u32) (UMP_CACHE_ENABLE==cache); - - if ( -1 == _ump_uku_map_mem( &dd_map_call_arg ) ) - { - UMP_DEBUG_PRINT(4, ("UMP: Mapping failed for ID %u", secure_id)); - return NULL; - } - - UMP_DEBUG_PRINT(4, ("Mapped %u at 0x%08lx", secure_id, (unsigned long)dd_map_call_arg.mapping)); - - *cookie_out = dd_map_call_arg.cookie; - return dd_map_call_arg.mapping; -} - - - -void ump_arch_unmap(void* mapping, unsigned long size, unsigned long cookie) -{ - _ump_uk_unmap_mem_s dd_unmap_call_arg; - - dd_unmap_call_arg.ctx = ump_uk_ctx; - dd_unmap_call_arg.mapping = mapping; - dd_unmap_call_arg.size = size; - dd_unmap_call_arg.cookie = cookie; - - UMP_DEBUG_PRINT(4, ("Unmapping 0x%08lx", (unsigned long)mapping)); - _ump_uku_unmap_mem( &dd_unmap_call_arg ); -} - -/** Memory synchronization - cache flushing of mapped memory */ -ump_cache_enabled ump_arch_msync(ump_secure_id secure_id, void* mapping, unsigned long cookie, void * address, unsigned long size, ump_cpu_msync_op op) -{ - _ump_uk_msync_s dd_msync_call_arg; - - dd_msync_call_arg.ctx = ump_uk_ctx; - dd_msync_call_arg.mapping = mapping; - dd_msync_call_arg.address = address; - dd_msync_call_arg.size = size; - dd_msync_call_arg.op = (ump_uk_msync_op)op; - dd_msync_call_arg.cookie = cookie; - dd_msync_call_arg.secure_id = secure_id; - dd_msync_call_arg.is_cached = 0; - - UMP_DEBUG_PRINT(4, ("Msync 0x%08lx", (unsigned long)mapping)); - _ump_uku_msynch( &dd_msync_call_arg ); - if ( 0==dd_msync_call_arg.is_cached ) - { - UMP_DEBUG_PRINT(4, ("Trying to flush uncached UMP mem ID: %d", secure_id)); - } - return (ump_cache_enabled)(dd_msync_call_arg.is_cached); -} - -/** Cache operation control. Tell when cache maintenance operations start and end. -This will allow the kernel to merge cache operations togheter, thus making them faster */ -int ump_arch_cache_operations_control(ump_cache_op_control op) -{ - _ump_uk_cache_operations_control_s dd_cache_control_arg; - - dd_cache_control_arg.op = (ump_uk_cache_op_control)op; - dd_cache_control_arg.ctx = ump_uk_ctx; - - UMP_DEBUG_PRINT(4, ("Cache control op:%d",(u32)op )); - _ump_uku_cache_operations_control( &dd_cache_control_arg ); - return 1; /* Always success */ -} - -int ump_arch_switch_hw_usage( ump_secure_id secure_id, ump_hw_usage new_user ) -{ - _ump_uk_switch_hw_usage_s dd_sitch_user_arg; - - dd_sitch_user_arg.secure_id = secure_id; - dd_sitch_user_arg.new_user = (ump_uk_user)new_user; - dd_sitch_user_arg.ctx = ump_uk_ctx; - - UMP_DEBUG_PRINT(4, ("Switch user UMP:%d User:%d",secure_id, (u32)new_user )); - _ump_uku_switch_hw_usage( &dd_sitch_user_arg ); - return 1; /* Always success */ -} - -int ump_arch_lock( ump_secure_id secure_id, ump_lock_usage lock_usage ) -{ - _ump_uk_lock_s dd_lock_arg; - - dd_lock_arg.ctx = ump_uk_ctx; - dd_lock_arg.secure_id = secure_id; - dd_lock_arg.lock_usage = (ump_uk_lock_usage) lock_usage; - - UMP_DEBUG_PRINT(4, ("Lock UMP:%d ",secure_id)); - _ump_uku_lock( &dd_lock_arg ); - return 1; /* Always success */ -} - -int ump_arch_unlock( ump_secure_id secure_id ) -{ - _ump_uk_unlock_s dd_unlock_arg; - - dd_unlock_arg.ctx = ump_uk_ctx; - dd_unlock_arg.secure_id = secure_id; - - UMP_DEBUG_PRINT(4, ("Lock UMP:%d ",secure_id)); - _ump_uku_unlock( &dd_unlock_arg ); - return 1; /* Always success */ -} diff --git a/exynos4/hal/libUMP/arch_011_udd/ump_arch.h b/exynos4/hal/libUMP/arch_011_udd/ump_arch.h deleted file mode 100644 index 95b943f..0000000 --- a/exynos4/hal/libUMP/arch_011_udd/ump_arch.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (C) 2010-2013 ARM Limited. All rights reserved. - * - * 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 ump_arch.h - * - * Header file for the arch dependent backend, which will do the communication with the UMP device driver. - */ - -#ifndef _UNIFIED_MEMORY_PROVIDER_ARCH_H_ -#define _UNIFIED_MEMORY_PROVIDER_ARCH_H_ - -#include "ump.h" -#include "ump_ref_drv.h" -#include "ump_internal.h" - -#ifdef __cplusplus -extern "C" { -#endif - - - -/** Open UMP interface. */ -ump_result ump_arch_open(void); - -/** Close UMP interface. */ -void ump_arch_close(void); - -/** Allocate UMP memory. */ -ump_secure_id ump_arch_allocate(unsigned long * size, ump_alloc_constraints constraints); - -/** Query size of specified UMP memory, in bytes. */ -unsigned long ump_arch_size_get(ump_secure_id secure_id); - -/** Release a reference from specified UMP memory. */ -void ump_arch_reference_release(ump_secure_id secure_id); - -/** Map specified UMP memory into CPU address space */ -void* ump_arch_map(ump_secure_id secure_id, unsigned long size, ump_cache_enabled cache, unsigned long *cookie_out); - -/** Unmap specified UMP memory from CPU adderss space */ -void ump_arch_unmap(void* mapping, unsigned long size, unsigned long cookie); - -/** Memory synchronization - cache flushing of mapped memory - * @return Is_cached: 1==True 0==NonCached */ -ump_cache_enabled ump_arch_msync(ump_secure_id secure_id, void* mapping, unsigned long cookie, void * address, unsigned long size, ump_cpu_msync_op op); - -/** Cache operation control. Tell when cache maintenance operations start and end. -This will allow the kernel to merge cache operations togheter, thus making them faster */ -int ump_arch_cache_operations_control(ump_cache_op_control op); - -/** Memory synchronization - cache flushing if previous user was different hardware */ -int ump_arch_switch_hw_usage( ump_secure_id secure_id, ump_hw_usage new_user ); - -/** Locking buffer. Blocking call if the buffer is already locked. */ -int ump_arch_lock( ump_secure_id secure_id, ump_lock_usage lock_usage ); - -/** Unlocking buffer. Let other users lock the buffer for their usage */ -int ump_arch_unlock( ump_secure_id secure_id ); - -ump_secure_id ump_arch_ion_import(int ion_fd, unsigned long *size, ump_alloc_constraints constraints); - -#ifdef __cplusplus -} -#endif - -#endif /* _UNIFIED_MEMORY_PROVIDER_ARCH_H_ */ diff --git a/exynos4/hal/libUMP/arch_011_udd/ump_frontend.c b/exynos4/hal/libUMP/arch_011_udd/ump_frontend.c deleted file mode 100644 index 66b2095..0000000 --- a/exynos4/hal/libUMP/arch_011_udd/ump_frontend.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright (C) 2010-2011, 2013 ARM Limited. All rights reserved. - * - * 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 ump_frontend.c - * - * This file implements the user space API of the UMP API. - * It relies heavily on a arch backend to do the communication with the UMP device driver. - */ - -#include "ump.h" -#include "ump_internal.h" -#include "ump_arch.h" -#include <ump/ump_debug.h> -#include <ump/ump_osu.h> - -UMP_API_EXPORT ump_result ump_open(void) -{ - return ump_arch_open(); -} - -UMP_API_EXPORT void ump_close(void) -{ - ump_arch_close(); -} - -UMP_API_EXPORT ump_secure_id ump_secure_id_get(ump_handle memh) -{ - ump_mem * mem = (ump_mem*)memh; - - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != memh, ("Handle is invalid")); - UMP_DEBUG_ASSERT(UMP_INVALID_SECURE_ID != mem->secure_id, ("Secure ID is inavlid")); - UMP_DEBUG_ASSERT(0 < mem->ref_count, ("Reference count too low")); - UMP_DEBUG_ASSERT(0 < mem->size, ("Memory size of passed handle too low")); - - return mem->secure_id; -} - -UMP_API_EXPORT ump_handle ump_handle_create_from_secure_id(ump_secure_id secure_id) -{ - unsigned long size; - - UMP_DEBUG_ASSERT(UMP_INVALID_SECURE_ID != secure_id, ("Secure ID is invalid")); - - size = ump_arch_size_get(secure_id); - if (0 != size) - { - unsigned long cookie; - /* - * The UMP memory which the secure_id referes to could now be deleted and re-created - * since we don't have any references to it yet. The mapping below will however fail if - * we have supplied incorrect size, so we are safe. - */ - void * mapping = ump_arch_map(secure_id, size, UMP_CACHE_DISABLE, &cookie); - if (NULL != mapping) - { - ump_mem * mem = _ump_osu_calloc(1, sizeof(*mem)); - if (NULL != mem) - { - mem->secure_id = secure_id; - mem->mapped_mem = mapping; - mem->size = size; - mem->cookie = cookie; - mem->is_cached = UMP_CACHE_ENABLE; /* Is set to actually check in the ump_cpu_msync_now() function */ - - _ump_osu_lock_auto_init(&mem->ref_lock, _UMP_OSU_LOCKFLAG_DEFAULT, 0, 0); - UMP_DEBUG_ASSERT(NULL != mem->ref_lock, ("Failed to initialize lock\n")); - mem->ref_count = 1; - - /* This is called only to set the cache settings in this handle */ - ump_cpu_msync_now((ump_handle)mem, UMP_MSYNC_READOUT_CACHE_ENABLED, NULL, 0); - - UMP_DEBUG_PRINT(4, ("UMP handle created for ID %u of size %lu, mapped into address 0x%08lx", mem->secure_id, mem->size, (unsigned long)mem->mapped_mem)); - - return (ump_handle)mem; - } - - ump_arch_unmap(mapping, size, cookie); - } - } - - UMP_DEBUG_PRINT(2, ("UMP handle creation failed for ID %u", secure_id)); - - return UMP_INVALID_MEMORY_HANDLE; -} - -UMP_API_EXPORT unsigned long ump_size_get(ump_handle memh) -{ - ump_mem * mem = (ump_mem*)memh; - - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != memh, ("Handle is invalid")); - UMP_DEBUG_ASSERT(UMP_INVALID_SECURE_ID != mem->secure_id, ("Secure ID is inavlid")); - UMP_DEBUG_ASSERT(0 < mem->ref_count, ("Reference count too low")); - UMP_DEBUG_ASSERT(0 < mem->size, ("Memory size of passed handle too low")); - - return mem->size; -} - -UMP_API_EXPORT void ump_read(void *dst, ump_handle srch, unsigned long offset, unsigned long length) -{ - ump_mem * src = (ump_mem*)srch; - - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != srch, ("Handle is invalid")); - UMP_DEBUG_ASSERT(UMP_INVALID_SECURE_ID != src->secure_id, ("Secure ID is inavlid")); - UMP_DEBUG_ASSERT(0 < src->ref_count, ("Reference count too low")); - UMP_DEBUG_ASSERT(0 < src->size, ("Memory size of passed handle too low")); - UMP_DEBUG_ASSERT(NULL != src->mapped_mem, ("UMP Memory is not mapped")); - UMP_DEBUG_ASSERT((src->size) >= (offset + length), ("Requested read beyond end of UMP memory")); - - _ump_osu_memcpy(dst,(char*)(src->mapped_mem) + offset, length); -} - -UMP_API_EXPORT void ump_write(ump_handle dsth, unsigned long offset, const void *src, unsigned long length) -{ - ump_mem * dst = (ump_mem*)dsth; - - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != dsth, ("Handle is invalid")); - UMP_DEBUG_ASSERT(UMP_INVALID_SECURE_ID != dst->secure_id, ("Secure ID is inavlid")); - UMP_DEBUG_ASSERT(0 < dst->ref_count, ("Reference count too low")); - UMP_DEBUG_ASSERT(0 < dst->size, ("Memory size of passed handle too low")); - UMP_DEBUG_ASSERT(NULL != dst->mapped_mem, ("UMP Memory is not mapped")); - UMP_DEBUG_ASSERT((dst->size) >= (offset + length), ("Requested write beyond end of UMP memory")); - - _ump_osu_memcpy((char*)(dst->mapped_mem) + offset, src, length); -} - - - -UMP_API_EXPORT void* ump_mapped_pointer_get(ump_handle memh) -{ - ump_mem * mem = (ump_mem*)memh; - - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != memh, ("Handle is invalid")); - UMP_DEBUG_ASSERT(UMP_INVALID_SECURE_ID != mem->secure_id, ("Secure ID is inavlid")); - UMP_DEBUG_ASSERT(0 < mem->ref_count, ("Reference count too low")); - UMP_DEBUG_ASSERT(0 < mem->size, ("Memory size of passed handle too low")); - UMP_DEBUG_ASSERT(NULL != mem->mapped_mem, ("Error in mapping pointer (not mapped)")); - - return mem->mapped_mem; -} - - - -UMP_API_EXPORT void ump_mapped_pointer_release(ump_handle memh) -{ - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != memh, ("Handle is invalid")); - UMP_DEBUG_ASSERT(UMP_INVALID_SECURE_ID != ((ump_mem*)memh)->secure_id, ("Secure ID is inavlid")); - UMP_DEBUG_ASSERT(0 < ((ump_mem*)memh)->ref_count, ("Reference count too low")); - UMP_DEBUG_ASSERT(0 < ((ump_mem*)memh)->size, ("Memory size of passed handle too low")); - UMP_DEBUG_ASSERT(NULL != ((ump_mem*)memh)->mapped_mem, ("Error in mapping pointer (not mapped)")); - - /* noop, cos we map in the pointer when handle is created, and unmap it when handle is destroyed */ -} - - - -UMP_API_EXPORT void ump_reference_add(ump_handle memh) -{ - ump_mem * mem = (ump_mem*)memh; - - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != memh, ("Handle is invalid")); - UMP_DEBUG_ASSERT(UMP_INVALID_SECURE_ID != mem->secure_id, ("Secure ID is inavlid")); - UMP_DEBUG_ASSERT(0 < mem->ref_count, ("Reference count too low")); - UMP_DEBUG_ASSERT(0 < mem->size, ("Memory size of passed handle too low")); - - _ump_osu_lock_wait(mem->ref_lock, _UMP_OSU_LOCKMODE_RW); - mem->ref_count += 1; - _ump_osu_lock_signal(mem->ref_lock, _UMP_OSU_LOCKMODE_RW); -} - - - -UMP_API_EXPORT void ump_reference_release(ump_handle memh) -{ - ump_mem * mem = (ump_mem*)memh; - - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != memh, ("Handle is invalid")); - UMP_DEBUG_ASSERT(UMP_INVALID_SECURE_ID != ((ump_mem*)mem)->secure_id, ("Secure ID is inavlid")); - UMP_DEBUG_ASSERT(0 < (((ump_mem*)mem)->ref_count), ("Reference count too low")); - UMP_DEBUG_ASSERT(0 < ((ump_mem*)mem)->size, ("Memory size of passed handle too low")); - UMP_DEBUG_ASSERT(NULL != ((ump_mem*)mem)->mapped_mem, ("Error in mapping pointer (not mapped)")); - - _ump_osu_lock_wait(mem->ref_lock, _UMP_OSU_LOCKMODE_RW); - mem->ref_count -= 1; - if (0 == mem->ref_count) - { - /* Remove memory mapping, which holds our only reference towards the UMP kernel space driver */ - ump_arch_unmap(mem->mapped_mem, mem->size, mem->cookie); - - _ump_osu_lock_signal(mem->ref_lock, _UMP_OSU_LOCKMODE_RW); - - /* Free the lock protecting the reference count */ - _ump_osu_lock_term(mem->ref_lock); - - /* Free the memory for this handle */ - _ump_osu_free(mem); - } else { - _ump_osu_lock_signal(mem->ref_lock, _UMP_OSU_LOCKMODE_RW); - } -} diff --git a/exynos4/hal/libUMP/arch_011_udd/ump_internal.h b/exynos4/hal/libUMP/arch_011_udd/ump_internal.h deleted file mode 100644 index fa14bb0..0000000 --- a/exynos4/hal/libUMP/arch_011_udd/ump_internal.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2010-2011, 2013 ARM Limited. All rights reserved. - * - * 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 ump_internal.c - * - * Internal definitions and debugging macros for the UMP implementation. - */ - -#ifndef _UNIFIED_MEMORY_PROVIDER_INTERNAL_H_ -#define _UNIFIED_MEMORY_PROVIDER_INTERNAL_H_ - -#include "ump.h" -#include <ump/ump_osu.h> - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum ump_cache_enabled -{ - UMP_CACHE_DISABLE = 0, - UMP_CACHE_ENABLE = 1 -} ump_cache_enabled; - -/** - * The actual (hidden) definition of ump_handles. - */ -typedef struct ump_mem -{ - ump_secure_id secure_id; /**< UMP device driver cookie */ - void * mapped_mem; /**< Mapped memory; all read and write use this */ - unsigned long size; /**< Size of allocated memory */ - _ump_osu_lock_t* ref_lock; /**< Lock protection ref_count */ - int ref_count; /**< The reference count of the ump_handle in userspace. It is used for finding out - when to free the memory used by this userspace handle. It is NOT the same as the - real ump_mem reference count in the devicedriver which do reference counting - for the memory that this handle reveals. */ - unsigned long cookie; /**< cookie for use in arch_unmap calls */ - ump_cache_enabled is_cached; -} ump_mem; - -#ifdef __cplusplus -} -#endif - - - -#endif /* _UNIFIED_MEMORY_PROVIDER_INTERNAL_H_ */ diff --git a/exynos4/hal/libUMP/arch_011_udd/ump_ref_drv.c b/exynos4/hal/libUMP/arch_011_udd/ump_ref_drv.c deleted file mode 100644 index 7b480f3..0000000 --- a/exynos4/hal/libUMP/arch_011_udd/ump_ref_drv.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright (C) 2010-2013 ARM Limited. All rights reserved. - * - * 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 ump_ref_drv.c - * - * Implementation of the user space API extensions provided by the reference implementation. - */ - -#include "ump_ref_drv.h" -#include "ump.h" -#include "ump_internal.h" -#include "ump_arch.h" -#include <ump/ump_debug.h> -#include <ump/ump_osu.h> - -/* Allocate a buffer which can be used directly by hardware, 4kb aligned */ -static ump_handle ump_ref_drv_allocate_internal(unsigned long size, ump_alloc_constraints constraints, ump_cache_enabled cache); -static ump_handle ump_ref_drv_ion_import_internal(int ion_fd, ump_alloc_constraints constraints, ump_cache_enabled cache); - - -/* Allocate a buffer which can be used directly by hardware, 4kb aligned */ -ump_handle ump_ref_drv_allocate(unsigned long size, ump_alloc_constraints constraints) -{ - ump_cache_enabled cache= UMP_CACHE_DISABLE; - if ( 0!=(constraints&UMP_REF_DRV_CONSTRAINT_USE_CACHE) ) - { - cache = UMP_CACHE_ENABLE; - } - return ump_ref_drv_allocate_internal(size, constraints, cache); -} - -ump_handle ump_ref_drv_ion_import(int ion_fd, ump_alloc_constraints constraints) -{ - ump_cache_enabled cache= UMP_CACHE_DISABLE; - if ( 0!=(constraints&UMP_REF_DRV_CONSTRAINT_USE_CACHE) ) - { - cache = UMP_CACHE_ENABLE; - } - return ump_ref_drv_ion_import_internal(ion_fd, constraints, cache); -} - -UMP_API_EXPORT int ump_cpu_msync_now(ump_handle memh, ump_cpu_msync_op op, void* address, int size) -{ - int offset; - ump_mem * mem = (ump_mem*)memh; - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != memh, ("Handle is invalid")); - - /* If the op is readout, we do the readout from DD. - Else we skip flushing if the userspace handle says that it is uncached */ - if ((UMP_MSYNC_READOUT_CACHE_ENABLED!=op) && (0 == mem->is_cached) ) return 0; - - if ( NULL == address ) - { - address = ((ump_mem*)mem)->mapped_mem; - } - offset = (int) ((unsigned long)address - (unsigned long)((ump_mem*)mem)->mapped_mem); - - if ( 0 == size ) - { - size = (int)((ump_mem*)mem)->size; - } - - UMP_DEBUG_ASSERT(0 < (((ump_mem*)mem)->ref_count), ("Reference count too low")); - UMP_DEBUG_ASSERT((size>=0) && (size <= (int)((ump_mem*)mem)->size), ("Memory size of passed handle too low")); - UMP_DEBUG_ASSERT(NULL != ((ump_mem*)mem)->mapped_mem, ("Error in mapping pointer (not mapped)")); - - if ( (offset+size) > (int)mem->size) - { - size = mem->size - offset; - } - - mem->is_cached = ump_arch_msync(mem->secure_id, mem->mapped_mem, mem->cookie, address, size, op); - return mem->is_cached ; -} - -UMP_API_EXPORT int ump_cache_operations_control(ump_cache_op_control op) -{ - return ump_arch_cache_operations_control(op); -} - -UMP_API_EXPORT int ump_switch_hw_usage( ump_handle memh, ump_hw_usage new_user ) -{ - ump_mem * mem = (ump_mem*)memh; - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != memh, ("Handle is invalid")); - return ump_arch_switch_hw_usage(mem->secure_id, new_user); -} - -UMP_API_EXPORT int ump_lock( ump_handle memh, ump_lock_usage lock_usage) -{ - ump_mem * mem = (ump_mem*)memh; - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != memh, ("Handle is invalid")); - return ump_arch_lock(mem->secure_id, lock_usage); -} - -UMP_API_EXPORT int ump_unlock( ump_handle memh ) -{ - ump_mem * mem = (ump_mem*)memh; - UMP_DEBUG_ASSERT(UMP_INVALID_MEMORY_HANDLE != memh, ("Handle is invalid")); - return ump_arch_unlock(mem->secure_id); -} - -UMP_API_EXPORT int ump_switch_hw_usage_secure_id( ump_secure_id ump_id, ump_hw_usage new_user ) -{ - return ump_arch_switch_hw_usage(ump_id, new_user); -} - -/** Locking buffer. Blocking call if the buffer is already locked. */ -UMP_API_EXPORT int ump_lock_secure_id( ump_secure_id ump_id, ump_lock_usage lock_usage ) -{ - return ump_arch_lock(ump_id, lock_usage); -} - -/** Unlocking buffer. Let other users lock the buffer for their usage */ -UMP_API_EXPORT int ump_unlock_secure_id( ump_secure_id ump_id ) -{ - return ump_arch_unlock(ump_id); -} - -/* Allocate a buffer which can be used directly by hardware, 4kb aligned */ -static ump_handle ump_ref_drv_allocate_internal(unsigned long size, ump_alloc_constraints constraints, ump_cache_enabled cache) -{ - ump_secure_id secure_id; - unsigned long allocated_size = size; - - UMP_DEBUG_PRINT(4, ("%s Allocating UMP memory of size %lu cache=%d", __func__, size, cache)); - - secure_id = ump_arch_allocate(&allocated_size, constraints); - if (secure_id != UMP_INVALID_SECURE_ID) - { - unsigned long cookie; - void * mapping; - - mapping = ump_arch_map(secure_id, allocated_size, cache, &cookie); - if (NULL != mapping) - { - /* - * PS: By now we have actually increased the ref count in the device driver by 2, - * one for the allocation iteself, and one for the mapping. - */ - ump_mem * mem; - mem = _ump_osu_calloc(1, sizeof(*mem)); - if (NULL != mem) - { - mem->secure_id = secure_id; - mem->mapped_mem = mapping; - mem->size = allocated_size; - mem->cookie = cookie; - mem->is_cached = UMP_CACHE_ENABLE; /* Default to ON, is disabled later if not */ - - _ump_osu_lock_auto_init(&mem->ref_lock, _UMP_OSU_LOCKFLAG_DEFAULT, 0, 0); - UMP_DEBUG_ASSERT(NULL != mem->ref_lock, ("Failed to initialize lock\n")); - mem->ref_count = 1; - - /* - * ump_arch_allocate() gave us a kernel space reference, and the same did ump_arch_map() - * We release the one from ump_arch_allocate(), and rely solely on the one from the ump_arch_map() - * That is, ump_arch_unmap() should now do the final release towards the UMP kernel space driver. - */ - ump_arch_reference_release(secure_id); - - /* This is called only to set the cache settings in this handle */ - ump_cpu_msync_now((ump_handle)mem, UMP_MSYNC_READOUT_CACHE_ENABLED, NULL, 0); - - UMP_DEBUG_PRINT(4, ("UMP handle created for ID %u of size %lu, mapped into address 0x%08lx", mem->secure_id, mem->size, (unsigned long)mem->mapped_mem)); - - return (ump_handle)mem; - } - - ump_arch_unmap(mapping, allocated_size, cookie); /* Unmap the memory */ - ump_arch_reference_release(secure_id); /* Release reference added when we allocated the UMP memory */ - } - - ump_arch_reference_release(secure_id); /* Release reference added when we allocated the UMP memory */ - } - - UMP_DEBUG_PRINT(4, ("Allocation of UMP memory failed")); - return UMP_INVALID_MEMORY_HANDLE; -} - -static ump_handle ump_ref_drv_ion_import_internal(int ion_fd, ump_alloc_constraints constraints, ump_cache_enabled cache) -{ - ump_secure_id secure_id; - unsigned long allocated_size = 0; - - UMP_DEBUG_PRINT(4, ("%s iond_fd=%d constraints=%x cache=%x, Allocating ION memory\n", __func__, ion_fd, constraints, cache)); - - secure_id = ump_arch_ion_import(ion_fd, &allocated_size, constraints); - if (secure_id != UMP_INVALID_SECURE_ID) - { - unsigned long cookie; - void * mapping; - - UMP_DEBUG_PRINT(4, ("%s secure_id=%x allocated_size=%lu\n", __func__, secure_id, allocated_size)); - - mapping = ump_arch_map(secure_id, allocated_size, cache, &cookie); - if (NULL != mapping) - { - /* - * PS: By now we have actually increased the ref count in the device driver by 2, - * one for the allocation iteself, and one for the mapping. - */ - ump_mem * mem; - mem = _ump_osu_calloc(1, sizeof(*mem)); - if (NULL != mem) - { - mem->secure_id = secure_id; - mem->mapped_mem = mapping; - mem->size = allocated_size; - mem->cookie = cookie; - mem->is_cached = UMP_CACHE_ENABLE; /* Default to ON, is disabled later if not */ - - _ump_osu_lock_auto_init(&mem->ref_lock, _UMP_OSU_LOCKFLAG_DEFAULT, 0, 0); - UMP_DEBUG_ASSERT(NULL != mem->ref_lock, ("Failed to initialize lock\n")); - mem->ref_count = 1; - - /* - * ump_arch_allocate() gave us a kernel space reference, and the same did ump_arch_map() - * We release the one from ump_arch_allocate(), and rely solely on the one from the ump_arch_map() - * That is, ump_arch_unmap() should now do the final release towards the UMP kernel space driver. - */ - ump_arch_reference_release(secure_id); - - /* This is called only to set the cache settings in this handle */ - ump_cpu_msync_now((ump_handle)mem, UMP_MSYNC_READOUT_CACHE_ENABLED, NULL, 0); - - UMP_DEBUG_PRINT(4, ("UMP handle created for ID %u of size %lu, mapped into address 0x%08lx", mem->secure_id, mem->size, (unsigned long)mem->mapped_mem)); - - return (ump_handle)mem; - } - - ump_arch_unmap(mapping, allocated_size, cookie); /* Unmap the memory */ - ump_arch_reference_release(secure_id); /* Release reference added when we allocated the UMP memory */ - } - - ump_arch_reference_release(secure_id); /* Release reference added when we allocated the UMP memory */ - } - - UMP_DEBUG_PRINT(4, ("Allocation of UMP memory failed")); - return UMP_INVALID_MEMORY_HANDLE; -} diff --git a/exynos4/hal/libUMP/include/ump/ump_debug.h b/exynos4/hal/libUMP/include/ump/ump_debug.h deleted file mode 100644 index 6f334e2..0000000 --- a/exynos4/hal/libUMP/include/ump/ump_debug.h +++ /dev/null @@ -1,288 +0,0 @@ -/* - * Copyright (C) 2010-2011, 2013 ARM Limited. All rights reserved. - * - * 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 ump_debug.h - * - * The file include several useful macros for debugging and printing. - * - UMP_PRINTF(...) Do not use this function: Will be included in Release builds. - * - UMP_DEBUG_TRACE() Prints current location in code. - * - UMP_DEBUG_PRINT(nr, (X) ) Prints the second argument if nr<=UMP_DEBUG_LEVEL. - * - UMP_DEBUG_TPRINT(nr, X ) Prints the source trace and second argument if nr<=UMP_DEBUG_LEVEL. - * - UMP_DEBUG_ERROR( (X) ) Prints an errortext, a source trace, and the given error message. - * - UMP_DEBUG_ASSERT(exp,(X)) If the asserted expr is false, the program will exit. - * - UMP_DEBUG_ASSERT_RANGE(x, min, max) Triggers if variable x is not between or equal to max and min. - * - UMP_DEBUG_ASSERT_LEQ(x, max) Triggers if variable x is not less than equal to max. - * - UMP_DEBUG_ASSERT_POINTER(pointer) Triggers if the pointer is a zero pointer. - * - UMP_DEBUG_CODE( X ) The code inside the macro is only copiled in Debug builds. - * - * The (X) means that you must add an extra parantese around the argumentlist. - * - * The printf function: UMP_PRINTF(...) is routed to _ump_sys_printf - * - * Suggested range for the DEBUG-LEVEL is [1:6] where - * [1:2] Is messages with highest priority, indicate possible errors. - * [3:4] Is messages with medium priority, output important variables. - * [5:6] Is messages with low priority, used during extensive debugging. - * - */ -#ifndef _UMP_DEBUG_H_ -#define _UMP_DEBUG_H_ - -#include <stdio.h> -#include <stdlib.h> -#include <cutils/log.h> - -/* START: Configuration */ -#ifndef UMP_PRINTF - #define UMP_PRINTF printf -#endif /* UMP_PRINTF */ - -#ifndef UMP_PRINT_FLUSH - #define UMP_PRINT_FLUSH do {} while (0) -#endif /* UMP_PRINT_FLUSH */ - -#ifndef UMP_DEBUG_LEVEL - #define UMP_DEBUG_LEVEL 1 -#endif /* UMP_DEBUG_LEVEL */ - -#ifndef UMP_DEBUG_ERROR_START_MSG - #define UMP_DEBUG_ERROR_START_MSG do {\ - UMP_PRINTF("*********************************************************************\n");\ - UMP_PRINT_FLUSH; } while (0) -#endif /* UMP_DEBUG_ERROR_START_MSG */ - -#ifndef UMP_DEBUG_ERROR_STOP_MSG - #define UMP_DEBUG_ERROR_STOP_MSG do { UMP_PRINTF("\n"); UMP_PRINT_FLUSH; } while (0) -#endif /* UMP_DEBUG_ERROR_STOP_MSG */ - -#ifndef UMP_ASSERT_QUIT_CMD - #define UMP_ASSERT_QUIT_CMD abort() -#endif /* UMP_ASSERT_QUIT_CMD */ -/* STOP: Configuration */ - -/** - * The macro UMP_FUNCTION evaluates to the name of the function enclosing - * this macro's usage, or "<unknown>" if not supported. - */ -#if (defined(__SYMBIAN32__) && defined(__ARMCC__)) || defined(_MSC_VER) -# define UMP_FUNCTION __FUNCTION__ -#elif __STDC__ && __STDC_VERSION__ >= 199901L -# define UMP_FUNCTION __FUNCTION__ -#elif defined(__GNUC__) && __GNUC__ >= 2 -# define UMP_FUNCTION __FUNCTION__ -#elif defined(__func__) -# define UMP_FUNCTION __func__ -#else -# define UMP_FUNCTION "<unknown>" -#endif - -/** - * Explicitly ignore a parameter passed into a function, to suppress compiler warnings. - * Should only be used with parameter names. - */ -#define UMP_IGNORE(x) (void)x - -/** - * @def UMP_DEBUG_TRACE() - * @brief Prints current location in code. - * Can be turned off by defining UMP_DEBUG_SKIP_TRACE - */ - -#ifndef UMP_DEBUG_SKIP_TRACE - #ifndef UMP_DEBUG_SKIP_PRINT_FUNCTION_NAME - #define UMP_DEBUG_TRACE() do { UMP_PRINTF( "In file: "__FILE__ \ - " function: %s() line:%4d\n" , UMP_FUNCTION, __LINE__); UMP_PRINT_FLUSH; } while (0) - #else - #define UMP_DEBUG_TRACE() do { UMP_PRINTF( "In file: "__FILE__ " line:%4d\n" , __LINE__); UMP_PRINT_FLUSH; } while (0) - #endif /* UMP_DEBUG_SKIP_PRINT_FUNCTION_NAME */ -#else - #define UMP_DEBUG_TRACE() -#endif /* UMP_DEBUG_SKIP_TRACE */ - -/** - * @def UMP_DEBUG_PRINT(nr, (X) ) - * @brief Prints the second argument if nr<=UMP_DEBUG_LEVEL. - * Can be turned off by defining UMP_DEBUG_SKIP_PRINT - * @param nr If nr <= UMP_DEBUG_LEVEL, we print the text. - * @param X A parantese with the contents to be sent to UMP_PRINTF - */ -#ifndef UMP_DEBUG_SKIP_PRINT - #define UMP_DEBUG_PRINT(nr, X ) if ( nr<=UMP_DEBUG_LEVEL ) ALOGE X ; -#else - #define UMP_DEBUG_PRINT(nr, X ) -#endif /* UMP_DEBUG_SKIP_PRINT */ - -/** - * @def UMP_DEBUG_TPRINT(nr, (X) ) - * @brief Prints the second argument if nr<=UMP_DEBUG_LEVEL. - * Can be turned off by defining UMP_DEBUG_SKIP_TPRINT. - * Can be shortened by defining UMP_DEBUG_TPRINT_SKIP_FUNCTION. - * @param nr If nr <= UMP_DEBUG_LEVEL, we print the text. - * @param X A parantese with the contents to be sent to UMP_PRINTF - */ - -/* helper to handle if the function name should be included or not */ -#ifndef UMP_DEBUG_TPRINT_SKIP_FUNCTION - #define UMP_DEBUG_TPRINT_INTERN do {UMP_PRINTF( ""__FILE__" %s()%4d " , UMP_FUNCTION, __LINE__); UMP_PRINT_FLUSH; } while (0) -#else - #define UMP_DEBUG_TPRINT_INTERN do {UMP_PRINTF( ""__FILE__ "%4d " , __LINE__); UMP_PRINT_FLUSH; } while (0) -#endif /* UMP_DEBUG_TPRINT_SKIP_FUNCTION */ - -#ifndef UMP_DEBUG_SKIP_TPRINT - #define UMP_DEBUG_TPRINT(nr, X ) \ - do{\ - if ( nr<=UMP_DEBUG_LEVEL )\ - {\ - UMP_DEBUG_TPRINT_INTERN;\ - UMP_PRINTF X ;\ - UMP_PRINT_FLUSH;\ - }\ - } while (0) -#else - #define UMP_DEBUG_TPRINT(nr, X ) -#endif /* UMP_DEBUG_SKIP_TPRINT */ - -/** - * @def UMP_DEBUG_ERROR( (X) ) - * @brief Prints an errortext, a source Trace, and the given error message. - * Prints filename, function, linenr, and the given error message. - * The error message must be inside a second parantese. - * The error message is written on a separate line, and a NL char is added. - * Can be turned of by defining UMP_DEBUG_SKIP_ERROR; - * You do not need to type the words ERROR in the message, since it will - * be added anyway. - * - * @note You should not end the text with a newline, since it is added by the macro. - * @note You should not write "ERROR" in the text, since it is added by the macro. - * @param X A parantese with the contents to be sent to UMP_PRINTF - */ - -#ifndef UMP_DEBUG_SKIP_ERROR - #define UMP_DEBUG_ERROR( X ) \ - do{ \ - UMP_DEBUG_ERROR_START_MSG;\ - UMP_PRINTF("ERROR: ");\ - UMP_PRINT_FLUSH;\ - UMP_DEBUG_TRACE(); \ - UMP_PRINTF X ; \ - UMP_PRINT_FLUSH;\ - UMP_DEBUG_ERROR_STOP_MSG;\ - } while (0) -#else - #define UMP_DEBUG_ERROR( X ) do{ ; } while ( 0 ) -#endif /* UMP_DEBUG_SKIP_ERROR */ - -/** - * @def UMP_DEBUG_ASSERT(expr, (X) ) - * @brief If the asserted expr is false, the program will exit. - * Prints filename, function, linenr, and the given error message. - * The error message must be inside a second parantese. - * The error message is written on a separate line, and a NL char is added. - * Can be turned of by defining UMP_DEBUG_SKIP_ERROR; - * You do not need to type the words ASSERT in the message, since it will - * be added anyway. - * - * @param X A parantese with the contents to be sent to UMP_PRINTF - * Prints filename, function, linenr, and the error message - * on a separte line. A newline char is added at the end. - * Can be turned of by defining UMP_DEBUG_SKIP_ASSERT - * @param expr Will exit program if \a expr is false; - * @param (X) Text that will be written if the assertion toggles. - */ - -#ifndef UMP_DEBUG_SKIP_ASSERT - #define UMP_DEBUG_ASSERT(expr, X ) \ - do{\ - if ( !(expr) ) \ - { \ - UMP_DEBUG_ERROR_START_MSG;\ - UMP_PRINTF("ASSERT EXIT: ");\ - UMP_PRINT_FLUSH;\ - UMP_DEBUG_TRACE(); \ - UMP_PRINTF X ; \ - UMP_PRINT_FLUSH;\ - UMP_DEBUG_ERROR_STOP_MSG;\ - UMP_ASSERT_QUIT_CMD;\ - }\ - } while (0) -#else - #define UMP_DEBUG_ASSERT(expr, X) -#endif /* UMP_DEBUG_SKIP_ASSERT */ - - -/** - * @def UMP_DEBUG_ASSERT_POINTER(pointer) - * @brief If the asserted pointer is NULL, the program terminates and TRACE info is printed - * The checking is disabled if "UMP_DEBUG_SKIP_ASSERT" is defined. - */ -#define UMP_DEBUG_ASSERT_POINTER(pointer) UMP_DEBUG_ASSERT(pointer, ("Null pointer " #pointer) ) - -/** - * @def UMP_DEBUG_ASSERT_HANDLE(handle) - * @brief If the asserted handle is not a valid handle, the program terminates and TRACE info is printed - * The checking is disabled if "UMP_DEBUG_SKIP_ASSERT" is defined. - */ -#define UMP_DEBUG_ASSERT_HANDLE(handle) UMP_DEBUG_ASSERT(UMP_NO_HANDLE != (handle), ("Invalid handle" #handle) ) - -/** - * @def UMP_DEBUG_ASSERT_ALIGNMENT(ptr, align) - * @brief If the asserted pointer is not aligned to align, the program terminates with trace info printed. - * The checking is disabled if "UMP_DEBUG_SKIP_ASSERT" is defined. - */ -#ifndef UMP_DEBUG_SKIP_ASSERT - #define UMP_DEBUG_ASSERT_ALIGNMENT(ptr, align) do { \ - UMP_DEBUG_ASSERT(0 == (align & (align - 1)), ("align %d is not a power-of-two", align)); \ - UMP_DEBUG_ASSERT(0 == (((u32)(ptr)) & (align - 1)), ("ptr %p not aligned to %d bytes", (void*)ptr, align)); \ - } while (0) -#else - #define UMP_DEBUG_ASSERT_ALIGNMENT(ptr, align) -#endif /* UMP_DEBUG_SKIP_ASSERT */ - -/** - * @def UMP_DEBUG_ASSERT_RANGE(x,min,max) - * @brief If variable x is not between or equal to max and min, the assertion triggers. - * The checking is disabled if "UMP_DEBUG_SKIP_ASSERT" is defined. - */ -#define UMP_DEBUG_ASSERT_RANGE(x, min, max) \ - UMP_DEBUG_ASSERT( (x) >= (min) && (x) <= (max), \ - (#x " out of range (%2.2f)", (double)x ) \ - ) - -/** - * @def UMP_DEBUG_ASSERT_LEQ(x,max) - * @brief If variable x is less than or equal to max, the assertion triggers. - * The checking is disabled if "UMP_DEBUG_SKIP_ASSERT" is defined. - */ -#define UMP_DEBUG_ASSERT_LEQ(x, max) \ - UMP_DEBUG_ASSERT( (x) <= (max), \ - (#x " out of range (%2.2f)", (double)x ) \ - ) - -/** - * @def UMP_DEBUG_CODE( X ) - * @brief Run the code X on debug builds. - * The code will not be used if UMP_DEBUG_SKIP_CODE is defined . - * - */ -#ifdef UMP_DEBUG_SKIP_CODE - #define UMP_DEBUG_CODE( X ) -#else - #define UMP_DEBUG_CODE( X ) X -#endif /* UMP_DEBUG_SKIP_CODE */ - -#endif /* _UMP_DEBUG_H_ */ - diff --git a/exynos4/hal/libUMP/include/ump/ump_osu.h b/exynos4/hal/libUMP/include/ump/ump_osu.h deleted file mode 100644 index 322632f..0000000 --- a/exynos4/hal/libUMP/include/ump/ump_osu.h +++ /dev/null @@ -1,430 +0,0 @@ -/* - * Copyright (C) 2010-2013 ARM Limited. All rights reserved. - * - * 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 ump_osu.h - * Defines the OS abstraction layer for the base driver - */ - -#ifndef __UMP_OSU_H__ -#define __UMP_OSU_H__ - -#include <stdarg.h> - -#ifdef __cplusplus -extern "C" -{ -#endif - - -typedef unsigned int u32; -#ifdef _MSC_VER - typedef unsigned __int64 u64; - typedef signed __int64 s64; -#else - typedef unsigned long long u64; - typedef signed long long s64; -#endif - -#ifndef NULL -#define NULL ((void*)0) -#endif - -typedef unsigned long ump_bool; - -#ifndef UMP_TRUE -#define UMP_TRUE ((ump_bool)1) -#endif - -#ifndef UMP_FALSE -#define UMP_FALSE ((ump_bool)0) -#endif - -#define UMP_STATIC static - -/** - * @addtogroup ump_user_space_api Unified Device Driver (UDD) APIs used by UMP - * - * @{ - */ - -/** - * @defgroup ump_osuapi UDD OS Abstraction for User-side (OSU) APIs for UMP - * - * @{ - */ - -/* The following is necessary to prevent the _ump_osk_errcode_t doxygen from - * becoming unreadable: */ -/** @cond OSU_COPY_OF__UMP_OSU_ERRCODE_T */ - -/** - * @brief OSU/OSK Error codes. - * - * Each OS may use its own set of error codes, and may require that the - * User/Kernel interface take certain error code. This means that the common - * error codes need to be sufficiently rich to pass the correct error code - * through from the OSK/OSU to U/K layer, across all OSs. - * - * The result is that some error codes will appear redundant on some OSs. - * Under all OSs, the OSK/OSU layer must translate native OS error codes to - * _ump_osk/u_errcode_t codes. Similarly, the U/K layer must translate from - * _ump_osk/u_errcode_t codes to native OS error codes. - * - */ -typedef enum -{ - _UMP_OSK_ERR_OK = 0, /**< Success. */ - _UMP_OSK_ERR_FAULT = -1, /**< General non-success */ - _UMP_OSK_ERR_INVALID_FUNC = -2, /**< Invalid function requested through User/Kernel interface (e.g. bad IOCTL number) */ - _UMP_OSK_ERR_INVALID_ARGS = -3, /**< Invalid arguments passed through User/Kernel interface */ - _UMP_OSK_ERR_NOMEM = -4, /**< Insufficient memory */ - _UMP_OSK_ERR_TIMEOUT = -5, /**< Timeout occured */ - _UMP_OSK_ERR_RESTARTSYSCALL = -6, /**< Special: On certain OSs, must report when an interruptable mutex is interrupted. Ignore otherwise. */ - _UMP_OSK_ERR_ITEM_NOT_FOUND = -7, /**< Table Lookup failed */ - _UMP_OSK_ERR_BUSY = -8, /**< Device/operation is busy. Try again later */ - _UMP_OSK_ERR_UNSUPPORTED = -9, /**< Optional part of the interface used, and is unsupported */ -} _ump_osk_errcode_t; - -/** @endcond */ /* end cond OSU_COPY_OF__UMP_OSU_ERRCODE_T */ - -/** - * @brief OSU Error codes. - * - * OSU error codes - enum values intentionally same as OSK - */ -typedef enum -{ - _UMP_OSU_ERR_OK = 0, /**< Success. */ - _UMP_OSU_ERR_FAULT = -1, /**< General non-success */ - _UMP_OSU_ERR_TIMEOUT = -2, /**< Timeout occured */ -} _ump_osu_errcode_t; - -/** @brief Translate OSU error code to base driver error code. - * - * The _UMP_OSU_TRANSLATE_ERROR macro translates an OSU error code to the - * error codes in use by the base driver. - */ -#define _UMP_OSU_TRANSLATE_ERROR(_ump_osu_errcode) ( ( _UMP_OSU_ERR_OK == (_ump_osu_errcode) ) ? UMP_ERR_NO_ERROR : UMP_ERR_FUNCTION_FAILED) - -/** @defgroup _ump_osu_lock OSU Mutual Exclusion Locks - * @{ */ - -/** @brief OSU Mutual Exclusion Lock flags type. - * - * This is made to look like and function identically to the OSK locks (refer - * to \ref _ump_osk_lock). However, please note the following \b important - * differences: - * - the OSU default lock is a Sleeping, non-interruptible mutex. - * - the OSU adds the ANYUNLOCK type of lock which allows a thread which doesn't - * own the lock to release the lock. - * - the order parameter when creating a lock is currently unused - * - * @note Pay careful attention to the difference in default locks for OSU and - * OSK locks; OSU locks are always non-interruptible, but OSK locks are by - * default, interruptible. This has implications for systems that do not - * distinguish between user and kernel mode. - */ -typedef enum -{ - _UMP_OSU_LOCKFLAG_DEFAULT = 0, /**< Default lock type. */ - /** @enum _ump_osu_lock_flags_t - * - * Flags from 0x0--0x8000 are RESERVED for Kernel-mode - */ - _UMP_OSU_LOCKFLAG_ANYUNLOCK = 0x10000, /**< Mutex that guarantees that any thread can unlock it when locked. Otherwise, this will not be possible. */ - /** @enum _ump_osu_lock_flags_t - * - * Flags from 0x10000 are RESERVED for User-mode - */ - _UMP_OSU_LOCKFLAG_STATIC = 0x20000, /* Flag in OSU reserved range to identify lock as a statically initialized lock */ - - } _ump_osu_lock_flags_t; - -typedef enum -{ - _UMP_OSU_LOCKMODE_UNDEF = -1, /**< Undefined lock mode. For internal use only */ - _UMP_OSU_LOCKMODE_RW = 0x0, /**< Default. Lock is used to protect data that is read from and written to */ - /** @enum _ump_osu_lock_mode_t - * - * Lock modes 0x1--0x3F are RESERVED for Kernel-mode */ -} _ump_osu_lock_mode_t; - -/** @brief Private type for Mutual Exclusion lock objects. */ -typedef struct _ump_osu_lock_t_struct _ump_osu_lock_t; - -/** @brief The number of static locks supported in _ump_osu_lock_static(). */ -#define UMP_OSU_STATIC_LOCK_COUNT (sizeof(_ump_osu_static_locks) / sizeof(_ump_osu_lock_t)) - -/** @} */ /* end group _ump_osu_lock */ - -/** @defgroup _ump_osu_memory OSU Memory Allocation - * @{ */ - -/** @brief Allocate zero-initialized memory. - * - * Returns a buffer capable of containing at least \a n elements of \a size - * bytes each. The buffer is initialized to zero. - * - * The buffer is suitably aligned for storage and subsequent access of every - * type that the compiler supports. Therefore, the pointer to the start of the - * buffer may be cast into any pointer type, and be subsequently accessed from - * such a pointer, without loss of information. - * - * When the buffer is no longer in use, it must be freed with _ump_osu_free(). - * Failure to do so will cause a memory leak. - * - * @note Most toolchains supply memory allocation functions that meet the - * compiler's alignment requirements. - * - * @param n Number of elements to allocate - * @param size Size of each element - * @return On success, the zero-initialized buffer allocated. NULL on failure - */ -void *_ump_osu_calloc( u32 n, u32 size ); - -/** @brief Allocate memory. - * - * Returns a buffer capable of containing at least \a size bytes. The - * contents of the buffer are undefined. - * - * The buffer is suitably aligned for storage and subsequent access of every - * type that the compiler supports. Therefore, the pointer to the start of the - * buffer may be cast into any pointer type, and be subsequently accessed from - * such a pointer, without loss of information. - * - * When the buffer is no longer in use, it must be freed with _ump_osu_free(). - * Failure to do so will cause a memory leak. - * - * @note Most toolchains supply memory allocation functions that meet the - * compiler's alignment requirements. - * - * Remember to free memory using _ump_osu_free(). - * @param size Number of bytes to allocate - * @return On success, the buffer allocated. NULL on failure. - */ -void *_ump_osu_malloc( u32 size ); - -/** @brief Free memory. - * - * Reclaims the buffer pointed to by the parameter \a ptr for the system. - * All memory returned from _ump_osu_malloc(), _ump_osu_calloc() and - * _ump_osu_realloc() must be freed before the application exits. Otherwise, - * a memory leak will occur. - * - * Memory must be freed once. It is an error to free the same non-NULL pointer - * more than once. - * - * It is legal to free the NULL pointer. - * - * @param ptr Pointer to buffer to free - */ -void _ump_osu_free( void *ptr ); - -/** @brief Copies memory. - * - * Copies the \a len bytes from the buffer pointed by the parameter \a src - * directly to the buffer pointed by \a dst. - * - * It is an error for \a src to overlap \a dst anywhere in \a len bytes. - * - * @param dst Pointer to the destination array where the content is to be - * copied. - * @param src Pointer to the source of data to be copied. - * @param len Number of bytes to copy. - * @return \a dst is always passed through unmodified. - */ -void *_ump_osu_memcpy( void *dst, const void *src, u32 len ); - -/** @brief Fills memory. - * - * Sets the first \a size bytes of the block of memory pointed to by \a ptr to - * the specified value - * @param ptr Pointer to the block of memory to fill. - * @param chr Value to be set, passed as u32. Only the 8 Least Significant Bits (LSB) - * are used. - * @param size Number of bytes to be set to the value. - * @return \a ptr is always passed through unmodified - */ -void *_ump_osu_memset( void *ptr, u32 chr, u32 size ); - -/** @} */ /* end group _ump_osu_memory */ - - -/** @addtogroup _ump_osu_lock - * @{ */ - -/** @brief Initialize a Mutual Exclusion Lock. - * - * Locks are created in the signalled (unlocked) state. - * - * The parameter \a initial must be zero. - * - * At present, the parameter \a order must be zero. It remains for future - * expansion for mutex order checking. - * - * @param flags flags combined with bitwise OR ('|'), or zero. There are - * restrictions on which flags can be combined, see \ref _ump_osu_lock_flags_t. - * @param initial For future expansion into semaphores. SBZ. - * @param order The locking order of the mutex. SBZ. - * @return On success, a pointer to a \ref _ump_osu_lock_t object. NULL on failure. - */ -_ump_osu_lock_t *_ump_osu_lock_init( _ump_osu_lock_flags_t flags, u32 initial, u32 order ); - -/** @brief Obtain a statically initialized Mutual Exclusion Lock. - * - * Retrieves a reference to a statically initialized lock. Up to - * _UMP_OSU_STATIC_LOCK_COUNT statically initialized locks are - * available. Only _ump_osu_lock_wait(), _ump_osu_lock_trywait(), - * _ump_osu_lock_signal() can be used with statically initialized locks. - * _UMP_OSU_LOCKMODE_RW mode should be used when waiting and signalling - * statically initialized locks. - * - * For the same \a nr a pointer to the same statically initialized lock is - * returned. That is, given the following code: - * @code - * extern u32 n; - * - * _ump_osu_lock_t *locka = _ump_osu_lock_static(n); - * _ump_osu_lock_t *lockb = _ump_osu_lock_static(n); - * @endcode - * Then (locka == lockb), for all 0 <= n < UMP_OSU_STATIC_LOCK_COUNT. - * - * @param nr index of a statically initialized lock [0..UMP_OSU_STATIC_LOCK_COUNT-1] - * @return On success, a pointer to a _ump_osu_lock_t object. NULL on failure. - */ -_ump_osu_lock_t *_ump_osu_lock_static( u32 nr ); - -/** @brief Initialize a Mutual Exclusion Lock safely across multiple threads. - * - * The _ump_osu_lock_auto_init() function guarantees that the given lock will - * be initialized once and precisely once, even in a situation involving - * multiple threads. - * - * This is necessary because the first call to certain Public API functions must - * initialize the API. However, there can be a race involved to call the first - * library function in multi-threaded applications. To resolve this race, a - * mutex can be used. This mutex must be initialized, but initialized only once - * by any thread that might compete for its initialization. This function - * guarantees the initialization to happen correctly, even when there is an - * initialization race between multiple threads. - * - * Otherwise, the operation is identical to the _ump_osu_lock_init() function. - * For more details, refer to _ump_osu_lock_init(). - * - * @param pplock pointer to storage for a _ump_osu_lock_t pointer. This - * _ump_osu_lock_t pointer may point to a _ump_osu_lock_t that has been - * initialized already - * @param flags flags combined with bitwise OR ('|'), or zero. There are - * restrictions on which flags can be combined. Refer to - * \ref _ump_osu_lock_flags_t for more information. - * The absence of any flags (the value 0) results in a sleeping-mutex, - * which is non-interruptible. - * @param initial For future expansion into semaphores. SBZ. - * @param order The locking order of the mutex. SBZ. - * @return On success, _UMP_OSU_ERR_OK is returned and a pointer to an - * initialized \ref _ump_osu_lock_t object is written into \a *pplock. - * _UMP_OSU_ERR_FAULT is returned on failure. - */ -_ump_osu_errcode_t _ump_osu_lock_auto_init( _ump_osu_lock_t **pplock, _ump_osu_lock_flags_t flags, u32 initial, u32 order ); - -/** @brief Wait for a lock to be signalled (obtained). - * - * After a thread has successfully waited on the lock, the lock is obtained by - * the thread, and is marked as unsignalled. The thread releases the lock by - * signalling it. - * - * To prevent deadlock, locks must always be obtained in the same order. - * - * @param lock the lock to wait upon (obtain). - * @param mode the mode in which the lock should be obtained. Currently this - * must be _UMP_OSU_LOCKMODE_RW. - * @return On success, _UMP_OSU_ERR_OK, _UMP_OSU_ERR_FAULT on error. - */ -_ump_osu_errcode_t _ump_osu_lock_wait( _ump_osu_lock_t *lock, _ump_osu_lock_mode_t mode); - -/** @brief Wait for a lock to be signalled (obtained) with timeout - * - * After a thread has successfully waited on the lock, the lock is obtained by - * the thread, and is marked as unsignalled. The thread releases the lock by - * signalling it. - * - * To prevent deadlock, locks must always be obtained in the same order. - * - * This version can return early if it cannot obtain the lock within the given timeout. - * - * @param lock the lock to wait upon (obtain). - * @param mode the mode in which the lock should be obtained. Currently this - * must be _UMP_OSU_LOCKMODE_RW. - * @param timeout Relative time in microseconds for the timeout - * @return _UMP_OSU_ERR_OK if the lock was obtained, _UMP_OSU_ERR_TIMEOUT if the timeout expired or _UMP_OSU_ERR_FAULT on error. - */ -_ump_osu_errcode_t _ump_osu_lock_timed_wait( _ump_osu_lock_t *lock, _ump_osu_lock_mode_t mode, u64 timeout); - -/** @brief Test for a lock to be signalled and obtains the lock when so. - * - * Obtains the lock only when it is in signalled state. The lock is then - * marked as unsignalled. The lock is released again by signalling - * it by _ump_osu_lock_signal(). - * - * If the lock could not be obtained immediately (that is, another thread - * currently holds the lock), then this function \b does \b not wait for the - * lock to be in a signalled state. Instead, an error code is immediately - * returned to indicate that the thread could not obtain the lock. - * - * To prevent deadlock, locks must always be obtained in the same order. - * - * @param lock the lock to wait upon (obtain). - * @param mode the mode in which the lock should be obtained. Currently this - * must be _UMP_OSU_LOCKMODE_RW. - * @return When the lock was obtained, _UMP_OSU_ERR_OK. If the lock could not - * be obtained, _UMP_OSU_ERR_FAULT. - */ -_ump_osu_errcode_t _ump_osu_lock_trywait( _ump_osu_lock_t *lock, _ump_osu_lock_mode_t mode); - -/** @brief Signal (release) a lock. - * - * Locks may only be signalled by the thread that originally waited upon the - * lock, unless the lock was created using the _UMP_OSU_LOCKFLAG_ANYUNLOCK flag. - * - * @param lock the lock to signal (release). - * @param mode the mode in which the lock should be obtained. This must match - * the mode in which the lock was waited upon. - */ -void _ump_osu_lock_signal( _ump_osu_lock_t *lock, _ump_osu_lock_mode_t mode ); - -/** @brief Terminate a lock. - * - * This terminates a lock and frees all associated resources. - * - * It is a programming error to terminate the lock when it is held (unsignalled) - * by a thread. - * - * @param lock the lock to terminate. - */ -void _ump_osu_lock_term( _ump_osu_lock_t *lock ); -/** @} */ /* end group _ump_osu_lock */ - -/** @} */ /* end group osuapi */ - -/** @} */ /* end group uddapi */ - - -#ifdef __cplusplus -} -#endif - -#endif /* __UMP_OSU_H__ */ diff --git a/exynos4/hal/libUMP/include/ump/ump_uk_types.h b/exynos4/hal/libUMP/include/ump/ump_uk_types.h deleted file mode 100644 index 5fdec9d..0000000 --- a/exynos4/hal/libUMP/include/ump/ump_uk_types.h +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright (C) 2010, 2012-2013 ARM Limited. All rights reserved. - * - * 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 ump_uk_types.h - * Defines the types and constants used in the user-kernel interface - */ - -#ifndef __UMP_UK_TYPES_H__ -#define __UMP_UK_TYPES_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Helpers for API version handling */ -#define MAKE_VERSION_ID(x) (((x) << 16UL) | (x)) -#define IS_VERSION_ID(x) (((x) & 0xFFFF) == (((x) >> 16UL) & 0xFFFF)) -#define GET_VERSION(x) (((x) >> 16UL) & 0xFFFF) -#define IS_API_MATCH(x, y) (IS_VERSION_ID((x)) && IS_VERSION_ID((y)) && (GET_VERSION((x)) == GET_VERSION((y)))) - -/** - * API version define. - * Indicates the version of the kernel API - * The version is a 16bit integer incremented on each API change. - * The 16bit integer is stored twice in a 32bit integer - * So for version 1 the value would be 0x00010001 - */ -#define UMP_IOCTL_API_VERSION MAKE_VERSION_ID(2) - -typedef enum -{ - _UMP_IOC_QUERY_API_VERSION = 1, - _UMP_IOC_ALLOCATE, - _UMP_IOC_RELEASE, - _UMP_IOC_SIZE_GET, - _UMP_IOC_MAP_MEM, /* not used in Linux */ - _UMP_IOC_UNMAP_MEM, /* not used in Linux */ - _UMP_IOC_MSYNC, - _UMP_IOC_CACHE_OPERATIONS_CONTROL, - _UMP_IOC_SWITCH_HW_USAGE, - _UMP_IOC_LOCK, - _UMP_IOC_UNLOCK, - /* as defined in kernel drivers/gpu/mali400/r3p2/ump/include/ump_uk_types.h */ - _UMP_IOC_ION_IMPORT, - /*_UMP_IOC_DMABUF_IMPORT,*/ -}_ump_uk_functions; - -typedef enum -{ - UMP_REF_DRV_UK_CONSTRAINT_NONE = 0, - UMP_REF_DRV_UK_CONSTRAINT_PHYSICALLY_LINEAR = 1, - UMP_REF_DRV_UK_CONSTRAINT_USE_CACHE = 4, -} ump_uk_alloc_constraints; - -typedef enum -{ - _UMP_UK_MSYNC_CLEAN = 0, - _UMP_UK_MSYNC_CLEAN_AND_INVALIDATE = 1, - _UMP_UK_MSYNC_INVALIDATE = 2, - _UMP_UK_MSYNC_FLUSH_L1 = 3, - _UMP_UK_MSYNC_READOUT_CACHE_ENABLED = 128, -} ump_uk_msync_op; - -typedef enum -{ - _UMP_UK_CACHE_OP_START = 0, - _UMP_UK_CACHE_OP_FINISH = 1, -} ump_uk_cache_op_control; - -typedef enum -{ - _UMP_UK_READ = 1, - _UMP_UK_READ_WRITE = 3, -} ump_uk_lock_usage; - -typedef enum -{ - _UMP_UK_USED_BY_CPU = 0, - _UMP_UK_USED_BY_MALI = 1, - _UMP_UK_USED_BY_UNKNOWN_DEVICE= 100, -} ump_uk_user; - -/** - * Get API version ([in,out] u32 api_version, [out] u32 compatible) - */ -typedef struct _ump_uk_api_version_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - u32 version; /**< Set to the user space version on entry, stores the device driver version on exit */ - u32 compatible; /**< Non-null if the device is compatible with the client */ -} _ump_uk_api_version_s; - -/** - * ALLOCATE ([out] u32 secure_id, [in,out] u32 size, [in] contraints) - */ -typedef struct _ump_uk_allocate_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - u32 secure_id; /**< Return value from DD to Userdriver */ - u32 size; /**< Input and output. Requested size; input. Returned size; output */ - ump_uk_alloc_constraints constraints; /**< Only input to Devicedriver */ -} _ump_uk_allocate_s; - -typedef struct _ump_uk_ion_import_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - int ion_fd; /**< ion_fd */ - u32 secure_id; /**< Return value from DD to Userdriver */ - u32 size; /**< Input and output. Requested size; input. Returned size; output */ - ump_uk_alloc_constraints constraints; /**< Only input to Devicedriver */ -} _ump_uk_ion_import_s; - -/** - * SIZE_GET ([in] u32 secure_id, [out]size ) - */ -typedef struct _ump_uk_size_get_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - u32 secure_id; /**< Input to DD */ - u32 size; /**< Returned size; output */ -} _ump_uk_size_get_s; - -/** - * Release ([in] u32 secure_id) - */ -typedef struct _ump_uk_release_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - u32 secure_id; /**< Input to DD */ -} _ump_uk_release_s; - -typedef struct _ump_uk_map_mem_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - void *mapping; /**< [out] Returns user-space virtual address for the mapping */ - void *phys_addr; /**< [in] physical address */ - unsigned long size; /**< [in] size */ - u32 secure_id; /**< [in] secure_id to assign to mapping */ - void * _ukk_private; /**< Only used inside linux port between kernel frontend and common part to store vma */ - u32 cookie; - u32 is_cached; /**< [in,out] caching of CPU mappings */ -} _ump_uk_map_mem_s; - -typedef struct _ump_uk_unmap_mem_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - void *mapping; - u32 size; - void * _ukk_private; - u32 cookie; -} _ump_uk_unmap_mem_s; - -typedef struct _ump_uk_msync_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - void *mapping; /**< [in] mapping addr */ - void *address; /**< [in] flush start addr */ - u32 size; /**< [in] size to flush */ - ump_uk_msync_op op; /**< [in] flush operation */ - u32 cookie; /**< [in] cookie stored with reference to the kernel mapping internals */ - u32 secure_id; /**< [in] secure_id that identifies the ump buffer */ - u32 is_cached; /**< [out] caching of CPU mappings */ -} _ump_uk_msync_s; - -typedef struct _ump_uk_cache_operations_control_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - ump_uk_cache_op_control op; /**< [in] cache operations start/stop */ -} _ump_uk_cache_operations_control_s; - - -typedef struct _ump_uk_switch_hw_usage_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - u32 secure_id; /**< [in] secure_id that identifies the ump buffer */ - ump_uk_user new_user; /**< [in] cookie stored with reference to the kernel mapping internals */ - -} _ump_uk_switch_hw_usage_s; - -typedef struct _ump_uk_lock_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - u32 secure_id; /**< [in] secure_id that identifies the ump buffer */ - ump_uk_lock_usage lock_usage; -} _ump_uk_lock_s; - -typedef struct _ump_uk_unlock_s -{ - void *ctx; /**< [in,out] user-kernel context (trashed on output) */ - u32 secure_id; /**< [in] secure_id that identifies the ump buffer */ -} _ump_uk_unlock_s; - -#ifdef __cplusplus -} -#endif - -#endif /* __UMP_UK_TYPES_H__ */ diff --git a/exynos4/hal/libUMP/os/linux/ump_ioctl.h b/exynos4/hal/libUMP/os/linux/ump_ioctl.h deleted file mode 100644 index b709618..0000000 --- a/exynos4/hal/libUMP/os/linux/ump_ioctl.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (C) 2010-2013 ARM Limited. All rights reserved. - * - * 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 __UMP_IOCTL_H__ -#define __UMP_IOCTL_H__ - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include <linux/types.h> -#include <linux/ioctl.h> - -#include <ump/ump_uk_types.h> - -#ifndef __user -#define __user -#endif - - -/** - * @file UMP_ioctl.h - * This file describes the interface needed to use the Linux device driver. - * The interface is used by the userpace UMP driver. - */ - -#define UMP_IOCTL_NR 0x90 - - -#define UMP_IOC_QUERY_API_VERSION _IOR(UMP_IOCTL_NR, _UMP_IOC_QUERY_API_VERSION, _ump_uk_api_version_s) -#define UMP_IOC_ALLOCATE _IOWR(UMP_IOCTL_NR, _UMP_IOC_ALLOCATE, _ump_uk_allocate_s) -#define UMP_IOC_RELEASE _IOR(UMP_IOCTL_NR, _UMP_IOC_RELEASE, _ump_uk_release_s) -#define UMP_IOC_SIZE_GET _IOWR(UMP_IOCTL_NR, _UMP_IOC_SIZE_GET, _ump_uk_size_get_s) -#define UMP_IOC_MSYNC _IOW(UMP_IOCTL_NR, _UMP_IOC_MSYNC, _ump_uk_msync_s) -/* MALI_SEC */ -#define UMP_IOC_ION_IMPORT _IOW(UMP_IOCTL_NR, _UMP_IOC_ION_IMPORT, _ump_uk_ion_import_s) -/* MALI_SEC */ -/*#define UMP_IOC_DMABUF_IMPORT _IOW(UMP_IOCTL_NR, _UMP_IOC_DMABUF_IMPORT,\ - struct ump_uk_dmabuf) */ -#define UMP_IOC_CACHE_OPERATIONS_CONTROL _IOW(UMP_IOCTL_NR, _UMP_IOC_CACHE_OPERATIONS_CONTROL, _ump_uk_cache_operations_control_s) - -#define UMP_IOC_SWITCH_HW_USAGE _IOW(UMP_IOCTL_NR, _UMP_IOC_SWITCH_HW_USAGE, _ump_uk_switch_hw_usage_s) -#define UMP_IOC_LOCK _IOW(UMP_IOCTL_NR, _UMP_IOC_LOCK, _ump_uk_lock_s) -#define UMP_IOC_UNLOCK _IOW(UMP_IOCTL_NR, _UMP_IOC_UNLOCK, _ump_uk_unlock_s) - - -#ifdef __cplusplus -} -#endif - -#endif /* __UMP_IOCTL_H__ */ diff --git a/exynos4/hal/libUMP/os/linux/ump_osu_locks.c b/exynos4/hal/libUMP/os/linux/ump_osu_locks.c deleted file mode 100644 index e109295..0000000 --- a/exynos4/hal/libUMP/os/linux/ump_osu_locks.c +++ /dev/null @@ -1,543 +0,0 @@ -/* - * Copyright (C) 2010-2013 ARM Limited. All rights reserved. - * - * 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. - */ - -#if ((!defined _XOPEN_SOURCE) || ((_XOPEN_SOURCE - 0) < 600)) -#undef _XOPEN_SOURCE -#define _XOPEN_SOURCE 600 -#endif - -#ifndef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200112L -#elif _POSIX_C_SOURCE < 200112L -#undef _POSIX_C_SOURCE -#define _POSIX_C_SOURCE 200112L -#endif - -#include <ump/ump_osu.h> -#include <ump/ump_debug.h> - -#include <pthread.h> -#include <time.h> -#include <sys/time.h> -#include <errno.h> - -/** - * @file ump_osu_locks.c - * File implements the user side of the OS interface - */ - -/** @opt Most of the time, we use the plain mutex type of osu_lock, and so - * only require the flags and mutex members. This costs 2 extra DWORDS, but - * most of the time we don't use those DWORDS. - * Therefore, ANY_UNLOCK type osu_locks can be implemented as a second - * structure containing the member _ump_osu_lock_t lock_t, plus the extra - * state required. Then, we use &container->lock_t when passing out of the - * OSU api, and CONTAINER_OF() when passing back in to recover the original - * structure. */ - -/** Private declaration of the OSU lock type */ -struct _ump_osu_lock_t_struct -{ - /** At present, only two types of mutex, so we store this information as - * the flags supplied at init time */ - _ump_osu_lock_flags_t flags; - - pthread_mutex_t mutex; /**< Used in both plain and ANY_UNLOCK osu_locks */ - - /* Extra State for ANY_UNLOCK osu_locks. These are UNINITIALIZED when - * flags does not contain _UMP_OSU_LOCKFLAG_ANYUNLOCK: */ - pthread_cond_t condition; /**< The condition object to use while blocking */ - ump_bool state; /**< The boolean which indicates the event's state */ - - UMP_DEBUG_CODE( - /** debug checking of locks */ - _ump_osu_lock_mode_t locked_as; - ) /* UMP_DEBUG_CODE */ - -}; - -/* Provide two statically initialized locks */ -UMP_STATIC _ump_osu_lock_t _ump_osu_static_locks[] = -{ - { - _UMP_OSU_LOCKFLAG_STATIC, - PTHREAD_MUTEX_INITIALIZER, - PTHREAD_COND_INITIALIZER, - UMP_FALSE, - UMP_DEBUG_CODE( _UMP_OSU_LOCKMODE_UNDEF ) - }, - { - _UMP_OSU_LOCKFLAG_STATIC, - PTHREAD_MUTEX_INITIALIZER, - PTHREAD_COND_INITIALIZER, - UMP_FALSE, - UMP_DEBUG_CODE( _UMP_OSU_LOCKMODE_UNDEF ) - }, - { - _UMP_OSU_LOCKFLAG_STATIC, - PTHREAD_MUTEX_INITIALIZER, - PTHREAD_COND_INITIALIZER, - UMP_FALSE, - UMP_DEBUG_CODE( _UMP_OSU_LOCKMODE_UNDEF ) - }, - { - _UMP_OSU_LOCKFLAG_STATIC, - PTHREAD_MUTEX_INITIALIZER, - PTHREAD_COND_INITIALIZER, - UMP_FALSE, - UMP_DEBUG_CODE( _UMP_OSU_LOCKMODE_UNDEF ) - }, -}; - -/* Critical section for auto_init */ -UMP_STATIC pthread_mutex_t static_auto_init_mutex = PTHREAD_MUTEX_INITIALIZER; - - -_ump_osu_errcode_t _ump_osu_lock_auto_init( _ump_osu_lock_t **pplock, _ump_osu_lock_flags_t flags, u32 initial, u32 order ) -{ - int call_result; - /* Validate parameters: */ - UMP_DEBUG_ASSERT_POINTER( pplock ); - - /** @opt We don't lock the Critical Section or do anything if this is already non-null */ - if ( NULL != *pplock) - { - return _UMP_OSU_ERR_OK; - } - - /* We MIGHT need to initialize it, lock the Critical Section and check again */ - call_result = pthread_mutex_lock(&static_auto_init_mutex); - /* It would be a programming error for this to fail: */ - UMP_DEBUG_ASSERT( 0 == call_result, - ("failed to lock critical section\n") ); - - if ( NULL != *pplock ) - { - /* - We caught a race condition to initialize this osu_lock. - The other thread won the race, so the osu_lock is now initialized. - */ - call_result = pthread_mutex_unlock(&static_auto_init_mutex); - - UMP_DEBUG_ASSERT(0 == call_result, - ("failed to unlock critical section\n")); - - return _UMP_OSU_ERR_OK; - } - - /* We're the first thread in: initialize the osu_lock */ - *pplock = _ump_osu_lock_init( flags, initial, order ); - - if ( NULL == *pplock ) - { - /* osu_lock creation failed */ - call_result = pthread_mutex_unlock(&static_auto_init_mutex); - UMP_DEBUG_ASSERT(0 == call_result, - ("failed to unlock critical section\n")); - - return _UMP_OSU_ERR_FAULT; - } - - - /* osu_lock created OK */ - call_result = pthread_mutex_unlock(&static_auto_init_mutex); - - UMP_DEBUG_ASSERT(0 == call_result, - ("failed to unlock critical section\n")); - - UMP_IGNORE( call_result ); - - return _UMP_OSU_ERR_OK; -} - - -_ump_osu_lock_t *_ump_osu_lock_init( _ump_osu_lock_flags_t flags, u32 initial, u32 order ) -{ - _ump_osu_lock_t * lock; - pthread_mutexattr_t mutex_attributes; - - UMP_IGNORE(order); /* order isn't implemented yet, for now callers should set it to zero. */ - - /* Validate parameters: */ - /* Flags acceptable */ - UMP_DEBUG_ASSERT( 0 == ( flags & ~( _UMP_OSU_LOCKFLAG_ANYUNLOCK)), - ("incorrect flags or trying to initialise a statically initialized lock, %.8X\n", flags) ); - - /* Parameter initial SBZ - for future expansion */ - UMP_DEBUG_ASSERT( 0 == initial, - ("initial must be zero\n") ); - - if (0 != pthread_mutexattr_init(&mutex_attributes)) - { - return NULL; - } - -#if UMP_DEBUG_EXTENDED_MUTEX_LOCK_CHECKING -#define UMP_PTHREADS_MUTEX_TYPE PTHREAD_MUTEX_ERRORCHECK -#else -#define UMP_PTHREADS_MUTEX_TYPE PTHREAD_MUTEX_DEFAULT -#endif - - if (0 != pthread_mutexattr_settype(&mutex_attributes, UMP_PTHREADS_MUTEX_TYPE)) - { - /** Return NULL on failure */ - pthread_mutexattr_destroy(&mutex_attributes); - return NULL; - - } - -#undef UMP_PTHREADS_MUTEX_TYPE - - /** @opt use containing structures for the ANY_UNLOCK type, to - * save 2 DWORDS when not in use */ - lock = _ump_osu_malloc( sizeof(_ump_osu_lock_t) ); - - if( NULL == lock ) - { - /** Return NULL on failure */ - pthread_mutexattr_destroy(&mutex_attributes); - return NULL; - } - - if (0 != pthread_mutex_init( &lock->mutex, &mutex_attributes )) - { - pthread_mutexattr_destroy(&mutex_attributes); - _ump_osu_free( lock ); - return NULL; - } - - /* done with the mutexattr object */ - pthread_mutexattr_destroy(&mutex_attributes); - - /* ANY_UNLOCK type */ - if ( flags & _UMP_OSU_LOCKFLAG_ANYUNLOCK ) - { - if (0 != pthread_cond_init( &lock->condition, NULL )) - { - /* cleanup */ - pthread_mutex_destroy( &lock->mutex ); - _ump_osu_free( lock ); - return NULL; - } - lock->state = UMP_FALSE; /* mark as unlocked by default */ - } - - lock->flags = flags; - - /** Debug lock checking */ - UMP_DEBUG_CODE( lock->locked_as = _UMP_OSU_LOCKMODE_UNDEF ); - - return lock; -} - -_ump_osu_errcode_t _ump_osu_lock_timed_wait( _ump_osu_lock_t *lock, _ump_osu_lock_mode_t mode, u64 timeout) -{ - /* absolute time specifier */ - struct timespec ts; - struct timeval tv; - - /* Parameter validation */ - UMP_DEBUG_ASSERT_POINTER( lock ); - - UMP_DEBUG_ASSERT( _UMP_OSU_LOCKMODE_RW == mode, - ("unrecognised mode, %.8X\n", mode) ); - UMP_DEBUG_ASSERT( _UMP_OSU_LOCKFLAG_ANYUNLOCK == lock->flags, ("Timed operations only implemented for ANYUNLOCK type locks")); - - /* calculate the realtime timeout value */ - - if (0 != gettimeofday(&tv, NULL)) - { - UMP_DEBUG_PRINT(1,("Could not get the current realtime value to calculate the absolute value for a timed mutex lock with a timeout")); - return _UMP_OSU_ERR_FAULT; - } - - tv.tv_usec += timeout; - -#define UMP_USECS_PER_SECOND 1000000LL -#define UMP_NANOSECS_PER_USEC 1000LL - - /* did we overflow a second in the usec part? */ - while (tv.tv_usec >= UMP_USECS_PER_SECOND) - { - tv.tv_usec -= UMP_USECS_PER_SECOND; - tv.tv_sec++; - } - - /* copy to the correct struct */ - ts.tv_sec = tv.tv_sec; - ts.tv_nsec = (tv.tv_usec * UMP_NANOSECS_PER_USEC); - -#undef UMP_USECS_PER_SECOND -#undef UMP_NANOSECS_PER_USEC - - /* lock the mutex protecting access to the state field */ - pthread_mutex_lock( &lock->mutex ); - /* loop while locked (state is UMP_TRUE) */ - /* pthread_cond_timedwait unlocks the mutex, wait, and locks the mutex once unblocked (either due to the event or the timeout) */ - while ( UMP_TRUE == lock->state ) - { - int res; - res = pthread_cond_timedwait( &lock->condition, &lock->mutex, &ts ); - if (0 == res) continue; /* test the state variable again (loop condition) */ - else if (ETIMEDOUT == res) - { - /* timeout, need to clean up and return the correct error code */ - pthread_mutex_unlock(&lock->mutex); - return _UMP_OSU_ERR_TIMEOUT; - } - else - { - UMP_DEBUG_PRINT(1, ("Unexpected return from pthread_cond_timedwait 0x%08X\n", res)); - - pthread_mutex_unlock(&lock->mutex); - return _UMP_OSU_ERR_FAULT; - } - - } - - /* DEBUG tracking of previously locked state - occurs while lock is obtained */ - UMP_DEBUG_ASSERT( _UMP_OSU_LOCKMODE_UNDEF == lock->locked_as, - ("This lock was already locked\n") ); - UMP_DEBUG_CODE( lock->locked_as = mode ); - - /* the state is UMP_FALSE (unlocked), so we set it to UMP_TRUE to indicate that it's locked and can return knowing that we own the lock */ - lock->state = UMP_TRUE; - /* final unlock of the mutex */ - pthread_mutex_unlock(&lock->mutex); - - return _UMP_OSU_ERR_OK; - -} - -_ump_osu_errcode_t _ump_osu_lock_wait( _ump_osu_lock_t *lock, _ump_osu_lock_mode_t mode) -{ - /* Parameter validation */ - UMP_DEBUG_ASSERT_POINTER( lock ); - - UMP_DEBUG_ASSERT( _UMP_OSU_LOCKMODE_RW == mode, - ("unrecognised mode, %.8X\n", mode) ); - - /** @note since only one flag can be set, we use a switch statement here. - * Otherwise, MUST add an enum into the _ump_osu_lock_t to store the - * implemented lock type */ - switch ( lock->flags ) - { - case _UMP_OSU_LOCKFLAG_STATIC: - case _UMP_OSU_LOCKFLAG_DEFAULT: - /* Usual Mutex type */ - { - int call_result; - call_result = pthread_mutex_lock( &lock->mutex ); - UMP_DEBUG_ASSERT( 0 == call_result, - ("pthread_mutex_lock call failed with error code %d\n", call_result)); - UMP_IGNORE( call_result ); - } - - /* DEBUG tracking of previously locked state - occurs while lock is obtained */ - UMP_DEBUG_ASSERT( _UMP_OSU_LOCKMODE_UNDEF == lock->locked_as, - ("This lock was already locked\n") ); - UMP_DEBUG_CODE( lock->locked_as = mode ); - break; - - case _UMP_OSU_LOCKFLAG_ANYUNLOCK: - /** @note Use of bitflags in a case statement ONLY works because this - * is the ONLY flag that is supported */ - - /* lock the mutex protecting access to the state field */ - pthread_mutex_lock( &lock->mutex ); - /* loop while locked (state is UMP_TRUE) */ - /* pthread_cond_wait unlocks the mutex, wait, and locks the mutex once unblocked */ - while ( UMP_TRUE == lock->state ) pthread_cond_wait( &lock->condition, &lock->mutex ); - - /* DEBUG tracking of previously locked state - occurs while lock is obtained */ - UMP_DEBUG_ASSERT( _UMP_OSU_LOCKMODE_UNDEF == lock->locked_as, - ("This lock was already locked\n") ); - UMP_DEBUG_CODE( lock->locked_as = mode ); - - /* the state is UMP_FALSE (unlocked), so we set it to UMP_TRUE to indicate that it's locked and can return knowing that we own the lock */ - lock->state = UMP_TRUE; - /* final unlock of the mutex */ - pthread_mutex_unlock(&lock->mutex); - break; - - default: - UMP_DEBUG_ERROR( ("lock has incorrect flags==%.8X\n", lock->flags) ); - break; - } - - return _UMP_OSU_ERR_OK; -} - -_ump_osu_errcode_t _ump_osu_lock_trywait( _ump_osu_lock_t *lock, _ump_osu_lock_mode_t mode) -{ - _ump_osu_errcode_t err = _UMP_OSU_ERR_FAULT; - /* Parameter validation */ - UMP_DEBUG_ASSERT_POINTER( lock ); - - UMP_DEBUG_ASSERT( _UMP_OSU_LOCKMODE_RW == mode, - ("unrecognised mode, %.8X\n", mode) ); - - /** @note since only one flag can be set, we use a switch statement here. - * Otherwise, MUST add an enum into the _ump_osu_lock_t to store the - * implemented lock type */ - switch ( lock->flags ) - { - case _UMP_OSU_LOCKFLAG_STATIC: - case _UMP_OSU_LOCKFLAG_DEFAULT: - /* Usual Mutex type */ - { - /* This is not subject to UMP_CHECK - overriding the result would cause a programming error */ - if ( 0 == pthread_mutex_trylock( &lock->mutex ) ) - { - err = _UMP_OSU_ERR_OK; - - /* DEBUG tracking of previously locked state - occurs while lock is obtained */ - UMP_DEBUG_ASSERT( _UMP_OSU_LOCKMODE_UNDEF == lock->locked_as - || mode == lock->locked_as, - ("tried as mode==%.8X, but was locked as %.8X\n", mode, lock->locked_as) ); - UMP_DEBUG_CODE( lock->locked_as = mode ); - } - } - break; - - case _UMP_OSU_LOCKFLAG_ANYUNLOCK: - /** @note Use of bitflags in a case statement ONLY works because this - * is the ONLY flag that is supported */ - - /* lock the mutex protecting access to the state field */ - pthread_mutex_lock(&lock->mutex); - - if ( UMP_FALSE == lock->state) - { - /* unlocked, take the lock */ - lock->state = UMP_TRUE; - err = _UMP_OSU_ERR_OK; - } - - /* DEBUG tracking of previously locked state - occurs while lock is obtained */ - /* Can do this regardless of whether we obtained ANYUNLOCK: */ - - - UMP_DEBUG_ASSERT( _UMP_OSU_LOCKMODE_UNDEF == lock->locked_as - || mode == lock->locked_as, - ("tried as mode==%.8X, but was locked as %.8X\n", mode, lock->locked_as) ); - /* If we were already locked, this does no harm, because of the above assert: */ - UMP_DEBUG_CODE( lock->locked_as = mode ); - - pthread_mutex_unlock(&lock->mutex); - break; - - default: - UMP_DEBUG_ERROR( ("lock has incorrect flags==%.8X\n", lock->flags) ); - break; - } - - return err; -} - - -void _ump_osu_lock_signal( _ump_osu_lock_t *lock, _ump_osu_lock_mode_t mode ) -{ - /* Parameter validation */ - UMP_DEBUG_ASSERT_POINTER( lock ); - - UMP_DEBUG_ASSERT( _UMP_OSU_LOCKMODE_RW == mode, - ("unrecognised mode, %.8X\n", mode) ); - - /** @note since only one flag can be set, we use a switch statement here. - * Otherwise, MUST add an enum into the _ump_osu_lock_t to store the - * implemented lock type */ - switch ( lock->flags ) - { - case _UMP_OSU_LOCKFLAG_STATIC: - case _UMP_OSU_LOCKFLAG_DEFAULT: - /* Usual Mutex type */ - - /* DEBUG tracking of previously locked state - occurs while lock is obtained */ - UMP_DEBUG_ASSERT( mode == lock->locked_as, - ("This lock was locked as==%.8X, but tried to unlock as mode==%.8X\n", lock->locked_as, mode)); - UMP_DEBUG_CODE( lock->locked_as = _UMP_OSU_LOCKMODE_UNDEF ); - - { - int call_result; - call_result = pthread_mutex_unlock( &lock->mutex ); - UMP_DEBUG_ASSERT( 0 == call_result, - ("pthread_mutex_lock call failed with error code %d\n", call_result)); - UMP_IGNORE( call_result ); - } - break; - - case _UMP_OSU_LOCKFLAG_ANYUNLOCK: - /** @note Use of bitflags in a case statement ONLY works because this - * is the ONLY flag that is supported */ - - pthread_mutex_lock(&lock->mutex); - UMP_DEBUG_ASSERT( UMP_TRUE == lock->state, ("Unlocking a _ump_osu_lock_t %p which is not locked\n", lock)); - - /* DEBUG tracking of previously locked state - occurs while lock is obtained */ - UMP_DEBUG_ASSERT( mode == lock->locked_as, - ("This lock was locked as==%.8X, but tried to unlock as %.8X\n", lock->locked_as, mode )); - UMP_DEBUG_CODE( lock->locked_as = _UMP_OSU_LOCKMODE_UNDEF ); - - /* mark as unlocked */ - lock->state = UMP_FALSE; - - /* signal the condition, only wake a single thread */ - pthread_cond_signal(&lock->condition); - - pthread_mutex_unlock(&lock->mutex); - break; - - default: - UMP_DEBUG_ERROR( ("lock has incorrect flags==%.8X\n", lock->flags) ); - break; - } -} - -void _ump_osu_lock_term( _ump_osu_lock_t *lock ) -{ - int call_result; - UMP_DEBUG_ASSERT_POINTER( lock ); - - /** Debug lock checking: */ - /* Lock is signalled on terminate - not a guarantee, since we could be locked immediately beforehand */ - UMP_DEBUG_ASSERT( _UMP_OSU_LOCKMODE_UNDEF == lock->locked_as, - ("cannot terminate held lock\n") ); - - call_result = pthread_mutex_destroy( &lock->mutex ); - UMP_DEBUG_ASSERT( 0 == call_result, - ("Incorrect mutex use detected: pthread_mutex_destroy call failed with error code %d\n", call_result) ); - - /* Destroy extra state for ANY_UNLOCK type osu_locks */ - if ( lock->flags & _UMP_OSU_LOCKFLAG_ANYUNLOCK ) - { - UMP_DEBUG_ASSERT( UMP_FALSE == lock->state, ("terminate called on locked object %p\n", lock)); - call_result = pthread_cond_destroy(&lock->condition); - UMP_DEBUG_ASSERT( 0 == call_result, - ("Incorrect condition-variable use detected: pthread_cond_destroy call failed with error code %d\n", call_result) ); - } - - UMP_IGNORE(call_result); - - _ump_osu_free( lock ); -} - -_ump_osu_lock_t *_ump_osu_lock_static( u32 nr ) -{ - UMP_DEBUG_ASSERT( nr < UMP_OSU_STATIC_LOCK_COUNT, - ("provided static lock index (%d) out of bounds (0 < nr < %d)\n", nr, UMP_OSU_STATIC_LOCK_COUNT) ); - return &_ump_osu_static_locks[nr]; -} diff --git a/exynos4/hal/libUMP/os/linux/ump_osu_memory.c b/exynos4/hal/libUMP/os/linux/ump_osu_memory.c deleted file mode 100644 index 7ba6107..0000000 --- a/exynos4/hal/libUMP/os/linux/ump_osu_memory.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2010-2011, 2013 ARM Limited. All rights reserved. - * - * 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. - */ - -#include <ump/ump_osu.h> - -#include <stdlib.h> -#include <string.h> /* memcmp, memchr, memset */ - -/** - * @file ump_osu_memory.c - * File implements the user side of the OS interface - */ - -void *_ump_osu_calloc( u32 n, u32 size ) -{ - return calloc( n, size ); -} - -void *_ump_osu_malloc( u32 size ) -{ - return malloc( size ); -} - -void *_ump_osu_realloc( void *ptr, u32 size ) -{ - return realloc( ptr, size ); -} - -void _ump_osu_free( void *ptr ) -{ - free( ptr ); -} - -void *_ump_osu_memcpy( void *dst, const void *src, u32 len ) -{ - return memcpy( dst, src, len ); -} - -void *_ump_osu_memset( void *ptr, u32 chr, u32 size ) -{ - return memset( ptr, chr, size ); -} - -int _ump_osu_memcmp( const void *ptr1, const void *ptr2, u32 size ) -{ - return memcmp( ptr1, ptr2, size ); -} diff --git a/exynos4/hal/libUMP/os/linux/ump_uku.c b/exynos4/hal/libUMP/os/linux/ump_uku.c deleted file mode 100644 index 6bca7a4..0000000 --- a/exynos4/hal/libUMP/os/linux/ump_uku.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Copyright (C) 2010-2013 ARM Limited. All rights reserved. - * - * 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 ump_uku.c - * File implements the user side of the user-kernel interface - */ - -#include "../ump_uku.h" -#include <stdio.h> -#include "ump_ioctl.h" - -#include <sys/mman.h> - -/* Needed for file operations on the device file*/ -#include <unistd.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <sys/ioctl.h> - -static _ump_osu_errcode_t ump_driver_ioctl(void *context, u32 command, void *args); - -static int ump_ioctl_api_version_used = UMP_IOCTL_API_VERSION; - -/** - * The device file to access the UMP device driver - * This is a character special file giving access to the device driver. - * Usually created using the mknod command line utility. - */ -static const char ump_device_file_name[] = "/dev/ump"; - -_ump_osu_errcode_t _ump_uku_open( void **context ) -{ - int ump_device_file; - if(NULL == context) - { - return _UMP_OSU_ERR_FAULT; - } - - ump_device_file = open(ump_device_file_name, O_RDWR); - - if (-1 == ump_device_file) - { - return _UMP_OSU_ERR_FAULT; - } - - { - struct _ump_uk_api_version_s args; - args.ctx = (void*)ump_device_file; - args.version = UMP_IOCTL_API_VERSION; - args.compatible = 3; - ump_driver_ioctl(args.ctx, UMP_IOC_QUERY_API_VERSION, &args); - if ( 1 != args.compatible ) - { - if (IS_API_MATCH(MAKE_VERSION_ID(1), args.version)) - { - ump_ioctl_api_version_used = MAKE_VERSION_ID(1); - UMP_PRINTF("The UMP devicedriver does not support cached UMP. Update it if this is needed.\n"); - } - else - { - UMP_PRINTF("The UMP devicedriver is version: %d, UMP libraries is version: %d.\n", GET_VERSION(args.version), GET_VERSION(UMP_IOCTL_API_VERSION) ); - close(ump_device_file); - return _UMP_OSU_ERR_FAULT; - } - } - } - - *context = (void *) ump_device_file; - return _UMP_OSU_ERR_OK; -} - -_ump_osu_errcode_t _ump_uku_close( void **context ) -{ - if(NULL == context) - { - return _UMP_OSU_ERR_FAULT; - } - - if(-1 == (int)*context) - { - return _UMP_OSU_ERR_FAULT; - } - - close((int)*context); - *context = (void *)-1; - - return _UMP_OSU_ERR_OK; -} - -int _ump_uku_allocate(_ump_uk_allocate_s *args) -{ - return ump_driver_ioctl(args->ctx, UMP_IOC_ALLOCATE, args); -} - -_ump_osu_errcode_t _ump_uku_ion_import(_ump_uk_ion_import_s *args) -{ - UMP_DEBUG_PRINT(3, ("%s UMP_IOC_ION_IMPORT=%x\n", __func__, UMP_IOC_ION_IMPORT)); - - return ump_driver_ioctl(args->ctx, UMP_IOC_ION_IMPORT, args); -} - -_ump_osu_errcode_t _ump_uku_release(_ump_uk_release_s *args) -{ - return ump_driver_ioctl(args->ctx, UMP_IOC_RELEASE, args); -} - -_ump_osu_errcode_t _ump_uku_size_get(_ump_uk_size_get_s *args) -{ - return ump_driver_ioctl(args->ctx, UMP_IOC_SIZE_GET, args); -} - - -void _ump_uku_msynch(_ump_uk_msync_s *args) -{ - /* This is for backwards compatibillity */ - if ( MAKE_VERSION_ID(1) == ump_ioctl_api_version_used) - { - args->is_cached = 0; - if ( _UMP_UK_MSYNC_READOUT_CACHE_ENABLED != args->op ) - { - UMP_DEBUG_PRINT(3, ("Warning: Doing UMP cache flush operations on a Device Driver that does not support cached UMP mem.\n")); - } - return; - } - ump_driver_ioctl(args->ctx, UMP_IOC_MSYNC, args); -} - -void _ump_uku_cache_operations_control( _ump_uk_cache_operations_control_s *args ) -{ - ump_driver_ioctl(args->ctx, UMP_IOC_CACHE_OPERATIONS_CONTROL, args); -} - -void _ump_uku_switch_hw_usage( _ump_uk_switch_hw_usage_s *args ) -{ - ump_driver_ioctl(args->ctx, UMP_IOC_SWITCH_HW_USAGE, args); -} - -void _ump_uku_lock( _ump_uk_lock_s *args ) -{ - ump_driver_ioctl(args->ctx, UMP_IOC_LOCK, args); -} - -void _ump_uku_unlock( _ump_uk_unlock_s *args ) -{ - ump_driver_ioctl(args->ctx, UMP_IOC_UNLOCK, args); -} - -int _ump_uku_map_mem(_ump_uk_map_mem_s *args) -{ - int flags; - if( -1 == (int)args->ctx ) - { - return -1; - } - - flags = MAP_SHARED; - - /* This is for backwards compatibillity */ - if ( MAKE_VERSION_ID(1) == ump_ioctl_api_version_used) - { - args->is_cached = 0; - } - - /* If we want the Caching to be enabled we set the flags to be PRIVATE. The UMP DD reads this and do proper handling - Note: this enforces the user to use proper invalidation*/ - if ( args->is_cached ) flags = MAP_PRIVATE; - - args->mapping = mmap(NULL, args->size, PROT_READ | PROT_WRITE ,flags , (int)args->ctx, (off_t)args->secure_id * sysconf(_SC_PAGE_SIZE)); - if (MAP_FAILED == args->mapping) - { - return -1; - } - - args->cookie = 0; /* Cookie is not used in linux _ump_uku_unmap_mem */ - - return 0; -} - -void _ump_uku_unmap_mem( _ump_uk_unmap_mem_s *args ) -{ - /* - * If a smaller size is used Linux will just remove the requested range but don't tell - * the ump driver before all of it is unmapped, either via another unmap request or upon process shutdown. - * Unmapping too much will just ignore the overhead or hit undefined behavior, - * only affecting the calling process which could mess itself up in other ways anyway. - * So we don't need any security checks here. - */ - munmap(args->mapping, args->size); -} - -static _ump_osu_errcode_t ump_driver_ioctl(void *context, u32 command, void *args) -{ - /*UMP_CHECK_NON_NULL(args, _UMP_OSK_ERR_INVALID_ARGS);*/ - - /* check for a valid file descriptor */ - /** @note manual type safety check-point */ - if( -1 == (int)context ) - { - return _UMP_OSU_ERR_FAULT; - } - - /* call ioctl handler of driver */ - if (0 != ioctl((int)context, command, args)) return _UMP_OSU_ERR_FAULT; - return _UMP_OSU_ERR_OK; -} diff --git a/exynos4/hal/libUMP/os/ump_uku.h b/exynos4/hal/libUMP/os/ump_uku.h deleted file mode 100644 index 4940932..0000000 --- a/exynos4/hal/libUMP/os/ump_uku.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2010-2013 ARM Limited. All rights reserved. - * - * 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 ump_uku.h - * Defines the user-side interface of the user-kernel interface - */ - -#ifndef __UMP_UKU_H__ -#define __UMP_UKU_H__ - -#include <ump/ump_osu.h> -#include <ump/ump_debug.h> -#include <ump/ump_uk_types.h> - -#ifdef __cplusplus -extern "C" -{ -#endif - -_ump_osu_errcode_t _ump_uku_open( void **context ); - -_ump_osu_errcode_t _ump_uku_close( void **context ); - -_ump_osu_errcode_t _ump_uku_allocate( _ump_uk_allocate_s *args ); - -_ump_osu_errcode_t _ump_uku_ion_import(_ump_uk_ion_import_s *args); - -_ump_osu_errcode_t _ump_uku_release( _ump_uk_release_s *args ); - -_ump_osu_errcode_t _ump_uku_size_get( _ump_uk_size_get_s *args ); - -_ump_osu_errcode_t _ump_uku_get_api_version( _ump_uk_api_version_s *args ); - -int _ump_uku_map_mem( _ump_uk_map_mem_s *args ); - -void _ump_uku_unmap_mem( _ump_uk_unmap_mem_s *args ); - -void _ump_uku_msynch(_ump_uk_msync_s *args); - -int _ump_uku_map_mem( _ump_uk_map_mem_s *args ); - -void _ump_uku_cache_operations_control( _ump_uk_cache_operations_control_s *args ); -void _ump_uku_switch_hw_usage( _ump_uk_switch_hw_usage_s *dd_msync_call_arg ); -void _ump_uku_lock( _ump_uk_lock_s *dd_msync_call_arg ); -void _ump_uku_unlock( _ump_uk_unlock_s *dd_msync_call_arg ); - - - -#ifdef __cplusplus -} -#endif - -#endif /* __UMP_UKU_H__ */ diff --git a/exynos4/hal/libhdmi/Android.mk b/exynos4/hal/libhdmi/Android.mk deleted file mode 100644 index 237c53c..0000000 --- a/exynos4/hal/libhdmi/Android.mk +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2008 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. - -ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),) -include $(all-subdir-makefiles) -endif diff --git a/exynos4/hal/libhdmi/SecHdmi/Android.mk b/exynos4/hal/libhdmi/SecHdmi/Android.mk deleted file mode 100644 index a6921fc..0000000 --- a/exynos4/hal/libhdmi/SecHdmi/Android.mk +++ /dev/null @@ -1,88 +0,0 @@ -# Copyright (C) 2008 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. - -ifeq ($(BOARD_USES_HDMI),true) - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := eng - -LOCAL_PRELINK_MODULE := false -#LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/hw -LOCAL_SHARED_LIBRARIES := libutils liblog libedid libcec - -LOCAL_SRC_FILES := \ - SecHdmiV4L2Utils.cpp \ - SecHdmi.cpp \ - fimd_api.c - -LOCAL_C_INCLUDES += $(LOCAL_PATH) -LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../include - -ifeq ($(TARGET_SOC),exynos4210) -LOCAL_CFLAGS += -DSAMSUNG_EXYNOS4210 -endif - -ifeq ($(TARGET_SOC),exynos4x12) -LOCAL_CFLAGS += -DSAMSUNG_EXYNOS4x12 -endif - -LOCAL_CFLAGS += \ - -DSCREEN_WIDTH=$(SCREEN_WIDTH) \ - -DSCREEN_HEIGHT=$(SCREEN_HEIGHT) \ - -DDEFAULT_FB_NUM=$(DEFAULT_FB_NUM) - -LOCAL_SHARED_LIBRARIES += libfimc - -ifeq ($(BOARD_USES_HDMI_SUBTITLES),true) -LOCAL_CFLAGS += -DBOARD_USES_HDMI_SUBTITLES -endif - -ifeq ($(BOARD_USES_FIMGAPI),true) -LOCAL_CFLAGS += -DBOARD_USES_FIMGAPI -LOCAL_C_INCLUDES += $(TARGET_HAL_PATH)/libfimg4x -LOCAL_C_INCLUDES += external/skia/include/core -LOCAL_SHARED_LIBRARIES += libfimg -endif - -ifeq ($(BOARD_HDMI_STD), STD_NTSC_M) -LOCAL_CFLAGS += -DSTD_NTSC_M -endif - -ifeq ($(BOARD_HDMI_STD),STD_480P) -LOCAL_CFLAGS += -DSTD_480P -endif - -ifeq ($(BOARD_HDMI_STD),STD_720P) -LOCAL_CFLAGS += -DSTD_720P -endif - -ifeq ($(BOARD_HDMI_STD),STD_1080P) -LOCAL_CFLAGS += -DSTD_1080P -endif - -ifeq ($(BOARD_USE_V4L2),true) -LOCAL_CFLAGS += -DBOARD_USE_V4L2 -endif - -ifeq ($(BOARD_USE_V4L2_ION),true) -LOCAL_CFLAGS += -DBOARD_USE_V4L2_ION -LOCAL_SHARED_LIBRARIES += libsamsungion -endif - -LOCAL_MODULE := libhdmi -include $(BUILD_SHARED_LIBRARY) - -endif diff --git a/exynos4/hal/libhdmi/SecHdmi/SecHdmi.cpp b/exynos4/hal/libhdmi/SecHdmi/SecHdmi.cpp deleted file mode 100644 index 021898c..0000000 --- a/exynos4/hal/libhdmi/SecHdmi/SecHdmi.cpp +++ /dev/null @@ -1,1957 +0,0 @@ -/* - * 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. - */ - -//#define LOG_NDEBUG 0 -//#define LOG_TAG "libhdmi" -#include <cutils/log.h> - -#if defined(BOARD_USE_V4L2_ION) -#include "ion.h" -#endif - -#include "SecHdmi.h" -#include "SecHdmiV4L2Utils.h" - -#define CHECK_GRAPHIC_LAYER_TIME (0) - -namespace android { - -extern unsigned int output_type; -#if defined(BOARD_USE_V4L2) -extern unsigned int g_preset_id; -#endif -extern v4l2_std_id t_std_id; -extern int g_hpd_state; -extern unsigned int g_hdcp_en; - -#if !defined(BOARD_USE_V4L2) -extern int fp_tvout; -extern int fp_tvout_v; -extern int fp_tvout_g0; -extern int fp_tvout_g1; -#endif - -#if defined(BOARD_USES_FIMGAPI) -extern unsigned int g2d_reserved_memory[HDMI_G2D_OUTPUT_BUF_NUM]; -extern unsigned int g2d_reserved_memory_size; -extern unsigned int cur_g2d_address; -extern unsigned int g2d_buf_index; -#endif - -#if defined(BOARD_USES_CEC) -SecHdmi::CECThread::~CECThread() -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - mFlagRunning = false; -} - -bool SecHdmi::CECThread::threadLoop() -{ - unsigned char buffer[CEC_MAX_FRAME_SIZE]; - int size; - unsigned char lsrc, ldst, opcode; - - { - Mutex::Autolock lock(mThreadLoopLock); - mFlagRunning = true; - - size = CECReceiveMessage(buffer, CEC_MAX_FRAME_SIZE, 100000); - - if (!size) // no data available or ctrl-c - return true; - - if (size == 1) - return true; // "Polling Message" - - lsrc = buffer[0] >> 4; - - /* ignore messages with src address == mLaddr*/ - if (lsrc == mLaddr) - return true; - - opcode = buffer[1]; - - if (CECIgnoreMessage(opcode, lsrc)) { - ALOGE("### ignore message coming from address 15 (unregistered)\n"); - return true; - } - - if (!CECCheckMessageSize(opcode, size)) { - ALOGE("### invalid message size: %d(opcode: 0x%x) ###\n", size, opcode); - return true; - } - - /* check if message broadcasted/directly addressed */ - if (!CECCheckMessageMode(opcode, (buffer[0] & 0x0F) == CEC_MSG_BROADCAST ? 1 : 0)) { - ALOGE("### invalid message mode (directly addressed/broadcast) ###\n"); - return true; - } - - ldst = lsrc; - - //TODO: macroses to extract src and dst logical addresses - //TODO: macros to extract opcode - - switch (opcode) { - case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS: - /* responce with "Report Physical Address" */ - buffer[0] = (mLaddr << 4) | CEC_MSG_BROADCAST; - buffer[1] = CEC_OPCODE_REPORT_PHYSICAL_ADDRESS; - buffer[2] = (mPaddr >> 8) & 0xFF; - buffer[3] = mPaddr & 0xFF; - buffer[4] = mDevtype; - size = 5; - break; - - case CEC_OPCODE_REQUEST_ACTIVE_SOURCE: - ALOGD("[CEC_OPCODE_REQUEST_ACTIVE_SOURCE]\n"); - /* responce with "Active Source" */ - buffer[0] = (mLaddr << 4) | CEC_MSG_BROADCAST; - buffer[1] = CEC_OPCODE_ACTIVE_SOURCE; - buffer[2] = (mPaddr >> 8) & 0xFF; - buffer[3] = mPaddr & 0xFF; - size = 4; - ALOGD("Tx : [CEC_OPCODE_ACTIVE_SOURCE]\n"); - break; - - case CEC_OPCODE_ABORT: - case CEC_OPCODE_FEATURE_ABORT: - default: - /* send "Feature Abort" */ - buffer[0] = (mLaddr << 4) | ldst; - buffer[1] = CEC_OPCODE_FEATURE_ABORT; - buffer[2] = CEC_OPCODE_ABORT; - buffer[3] = 0x04; // "refused" - size = 4; - break; - } - - if (CECSendMessage(buffer, size) != size) - ALOGE("CECSendMessage() failed!!!\n"); - - } - return true; -} - -bool SecHdmi::CECThread::start() -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - Mutex::Autolock lock(mThreadControlLock); - if (exitPending()) { - if (requestExitAndWait() == WOULD_BLOCK) { - ALOGE("mCECThread.requestExitAndWait() == WOULD_BLOCK"); - return false; - } - } - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("EDIDGetCECPhysicalAddress"); -#endif - /* set to not valid physical address */ - mPaddr = CEC_NOT_VALID_PHYSICAL_ADDRESS; - - if (!EDIDGetCECPhysicalAddress(&mPaddr)) { - ALOGE("Error: EDIDGetCECPhysicalAddress() failed.\n"); - return false; - } - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("CECOpen"); -#endif - if (!CECOpen()) { - ALOGE("CECOpen() failed!!!\n"); - return false; - } - - /* a logical address should only be allocated when a device \ - has a valid physical address, at all other times a device \ - should take the 'Unregistered' logical address (15) - */ - - /* if physical address is not valid device should take \ - the 'Unregistered' logical address (15) - */ - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("CECAllocLogicalAddress"); -#endif - mLaddr = CECAllocLogicalAddress(mPaddr, mDevtype); - - if (!mLaddr) { - ALOGE("CECAllocLogicalAddress() failed!!!\n"); - if (!CECClose()) - ALOGE("CECClose() failed!\n"); - return false; - } - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("request to run CECThread"); -#endif - - status_t ret = run("SecHdmi::CECThread", PRIORITY_DISPLAY); - if (ret != NO_ERROR) { - ALOGE("%s fail to run thread", __func__); - return false; - } - return true; -} - -bool SecHdmi::CECThread::stop() -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s request Exit", __func__); -#endif - Mutex::Autolock lock(mThreadControlLock); - if (requestExitAndWait() == WOULD_BLOCK) { - ALOGE("mCECThread.requestExitAndWait() == WOULD_BLOCK"); - return false; - } - - if (!CECClose()) - ALOGE("CECClose() failed!\n"); - - mFlagRunning = false; - return true; -} -#endif - -SecHdmi::SecHdmi(): -#if defined(BOARD_USES_CEC) - mCECThread(NULL), -#endif - mFlagCreate(false), - mFlagConnected(false), - mHdmiDstWidth(0), - mHdmiDstHeight(0), - mHdmiSrcYAddr(0), - mHdmiSrcCbCrAddr(0), - mHdmiOutputMode(DEFAULT_OUPUT_MODE), - mHdmiResolutionValue(DEFAULT_HDMI_RESOLUTION_VALUE), // V4L2_STD_480P_60_4_3 - mCompositeStd(DEFAULT_COMPOSITE_STD), - mHdcpMode(false), - mAudioMode(2), - mUIRotVal(0), - mG2DUIRotVal(0), - mCurrentHdmiOutputMode(-1), - mCurrentHdmiResolutionValue(0), // 1080960 - mCurrentHdcpMode(false), - mCurrentAudioMode(-1), - mHdmiInfoChange(true), - mFimcDstColorFormat(0), - mFimcCurrentOutBufIndex(0), - mFBaddr(NULL), - mFBsize(0), - mFBionfd(-1), - mFBIndex(0), - mDefaultFBFd(-1), - mDisplayWidth(DEFALULT_DISPLAY_WIDTH), - mDisplayHeight(DEFALULT_DISPLAY_HEIGHT) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - for (int i = 0; i < HDMI_LAYER_MAX; i++) { - mFlagLayerEnable[i] = false; - mFlagHdmiStart[i] = false; - - mSrcWidth [i] = 0; - mSrcHeight [i] = 0; - mSrcColorFormat[i] = 0; - mHdmiResolutionWidth [i] = 0; - mHdmiResolutionHeight [i] = 0; - mHdmiFd[i] = -1; - mDstWidth [i] = 0; - mDstHeight [i] = 0; - mPrevDstWidth [i] = 0; - mPrevDstHeight [i] = 0; - } - - mHdmiPresetId = DEFAULT_HDMI_PRESET_ID; - mHdmiStdId = DEFAULT_HDMI_STD_ID; - - //All layer is on - mFlagLayerEnable[HDMI_LAYER_VIDEO] = true; - mFlagLayerEnable[HDMI_LAYER_GRAPHIC_0] = true; - mFlagLayerEnable[HDMI_LAYER_GRAPHIC_1] = true; - - mHdmiSizeOfResolutionValueList = 14; - - mHdmiResolutionValueList[0] = 1080960; - mHdmiResolutionValueList[1] = 1080950; - mHdmiResolutionValueList[2] = 1080930; - mHdmiResolutionValueList[3] = 1080924; - mHdmiResolutionValueList[4] = 1080160; - mHdmiResolutionValueList[5] = 1080150; - mHdmiResolutionValueList[6] = 720960; - mHdmiResolutionValueList[7] = 7209601; - mHdmiResolutionValueList[8] = 720950; - mHdmiResolutionValueList[9] = 7209501; - mHdmiResolutionValueList[10] = 5769501; - mHdmiResolutionValueList[11] = 5769502; - mHdmiResolutionValueList[12] = 4809601; - mHdmiResolutionValueList[13] = 4809602; - -#if defined(BOARD_USES_CEC) - mCECThread = new CECThread(this); -#endif - - SecBuffer zeroBuf; - for (int i = 0; i < HDMI_FIMC_OUTPUT_BUF_NUM; i++) - mFimcReservedMem[i] = zeroBuf; -#if defined(BOARD_USE_V4L2) - for (int i = 0; i < HDMI_LAYER_MAX; i++) - for (int j = 0; j < MAX_BUFFERS_MIXER; j++) - mMixerBuffer[i][j] = zeroBuf; -#endif - - memset(&mDstRect, 0 , sizeof(struct v4l2_rect)); -} - -SecHdmi::~SecHdmi() -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - if (mFlagCreate == true) - ALOGE("%s::this is not Destroyed fail", __func__); - else - disconnect(); -} - -bool SecHdmi::create(int width, int height) -{ - Mutex::Autolock lock(mLock); - unsigned int fimc_buf_size = 0; - unsigned int gralloc_buf_size = 0; - mFimcCurrentOutBufIndex = 0; - int stride; - int vstride; - int BufNum = 0; -#if defined(BOARD_USE_V4L2_ION) - int IonClient = -1; - int IonFd = -1; - void *ion_base_addr = NULL; -#endif - -/* - * Video plaback (I420): output buffer size of FIMC3 is (1920 x 1088 x 1.5) - * Video plaback (NV12): FIMC3 is not used. - * Camera preview (YV12): output buffer size of FIMC3 is (640 x 480 x 1.5) - * UI mode (ARGB8888) : output buffer size of FIMC3 is (480 x 800 x 1.5) - */ -#ifndef SUPPORT_1080P_FIMC_OUT - setDisplaySize(width, height); -#endif - - stride = ALIGN(HDMI_MAX_WIDTH, 16); - vstride = ALIGN(HDMI_MAX_HEIGHT, 16); - - fimc_buf_size = stride * vstride * HDMI_FIMC_BUFFER_BPP_SIZE; - gralloc_buf_size = GRALLOC_BUF_SIZE * SIZE_1K; -#if defined(BOARD_USES_FIMGAPI) - g2d_reserved_memory_size = stride * vstride * HDMI_G2D_BUFFER_BPP_SIZE; -#endif - -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - if (mFlagCreate == true) { - ALOGE("%s::Already Created fail", __func__); - goto CREATE_FAIL; - } - - if (mDefaultFBFd <= 0) { - if ((mDefaultFBFd = fb_open(DEFAULT_FB)) < 0) { - ALOGE("%s:Failed to open default FB", __func__); - return false; - } - } - -#ifdef BOARD_USE_V4L2 - BufNum = HDMI_FIMC_OUTPUT_BUF_NUM; -#else - BufNum = 1; -#endif - - if (mSecFimc.create(SecFimc::DEV_3, SecFimc::MODE_SINGLE_BUF, BufNum) == false) { - ALOGE("%s::SecFimc create() fail", __func__); - goto CREATE_FAIL; - } - -#if defined(BOARD_USE_V4L2_ION) - IonClient = ion_client_create(); - if (IonClient < 0) { - ALOGE("%s::ion_client_create() failed", __func__); - goto CREATE_FAIL; - } -#if defined(BOARD_USES_FIMGAPI) - IonFd = ion_alloc(IonClient, g2d_reserved_memory_size * HDMI_G2D_OUTPUT_BUF_NUM, 0, ION_HEAP_EXYNOS_MASK); - - if (IonFd < 0) { - ALOGE("%s::ION memory allocation failed", __func__); - } else { - ion_base_addr = ion_map(IonFd, ALIGN(g2d_reserved_memory_size * HDMI_G2D_OUTPUT_BUF_NUM, PAGE_SIZE), 0); - if (ion_base_addr == MAP_FAILED) - ALOGE("%s::ION mmap failed", __func__); - } - - for (int i = 0; i < HDMI_G2D_OUTPUT_BUF_NUM; i++) - g2d_reserved_memory[i] = (unsigned int)ion_base_addr + (g2d_reserved_memory_size * i); -#endif -#else -#ifndef BOARD_USE_V4L2 - for (int i = 0; i < HDMI_FIMC_OUTPUT_BUF_NUM; i++) - mFimcReservedMem[i].phys.p = mSecFimc.getMemAddr()->phys.p + gralloc_buf_size + (fimc_buf_size * i); -#endif - -#if defined(BOARD_USES_FIMGAPI) -#if defined(BOARD_USES_HDMI_SUBTITLES) - for (int i = 0; i < HDMI_G2D_OUTPUT_BUF_NUM; i++) - g2d_reserved_memory[i] = mFimcReservedMem[HDMI_FIMC_OUTPUT_BUF_NUM - 1].phys.p + fimc_buf_size + (g2d_reserved_memory_size * i); -#else - for (int i = 0; i < HDMI_G2D_OUTPUT_BUF_NUM; i++) - g2d_reserved_memory[i] = mSecFimc.getMemAddr()->phys.p + gralloc_buf_size + (g2d_reserved_memory_size * i); -#endif -#endif -#endif - - v4l2_std_id std_id; - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::mHdmiOutputMode(%d) \n", __func__, mHdmiOutputMode); -#endif - if (mHdmiOutputMode == COMPOSITE_OUTPUT_MODE) { - std_id = composite_std_2_v4l2_std_id(mCompositeStd); - if ((int)std_id < 0) { - ALOGE("%s::composite_std_2_v4l2_std_id(%d) fail\n", __func__, mCompositeStd); - goto CREATE_FAIL; - } - if (m_setCompositeResolution(mCompositeStd) == false) { - ALOGE("%s::m_setCompositeResolution(%d) fail\n", __func__, mCompositeStd); - goto CREATE_FAIL; - } - } else if (mHdmiOutputMode >= HDMI_OUTPUT_MODE_YCBCR && - mHdmiOutputMode <= HDMI_OUTPUT_MODE_DVI) { -#if defined(BOARD_USE_V4L2) - unsigned int preset_id; - - if (hdmi_resolution_2_preset_id(mHdmiResolutionValue, &mHdmiDstWidth, &mHdmiDstHeight, &preset_id) < 0) { - ALOGE("%s::hdmi_resolution_2_preset_id(%d) fail\n", __func__, mHdmiResolutionValue); - goto CREATE_FAIL; - } -#else - if (hdmi_resolution_2_std_id(mHdmiResolutionValue, &mHdmiDstWidth, &mHdmiDstHeight, &std_id) < 0) { - ALOGE("%s::hdmi_resolution_2_std_id(%d) fail\n", __func__, mHdmiResolutionValue); - goto CREATE_FAIL; - } -#endif - } - - mFlagCreate = true; - - return true; - -CREATE_FAIL : - - if (mSecFimc.flagCreate() == true && - mSecFimc.destroy() == false) - ALOGE("%s::fimc destory fail", __func__); - - return false; -} - -bool SecHdmi::destroy(void) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - Mutex::Autolock lock(mLock); - - if (mFlagCreate == false) { - ALOGE("%s::Already Destroyed fail \n", __func__); - goto DESTROY_FAIL; - } - - for (int layer = HDMI_LAYER_BASE + 1; layer <= HDMI_LAYER_GRAPHIC_0; layer++) { - if (mFlagHdmiStart[layer] == true && m_stopHdmi(layer) == false) { - ALOGE("%s::m_stopHdmi: layer[%d] fail \n", __func__, layer); - goto DESTROY_FAIL; - } - - if (hdmi_deinit_layer(layer) < 0) { - ALOGE("%s::hdmi_deinit_layer(%d) fail \n", __func__, layer); - goto DESTROY_FAIL; - } - } - -#if !defined(BOARD_USE_V4L2) - tvout_deinit(); -#endif - - if (mSecFimc.flagCreate() == true && mSecFimc.destroy() == false) { - ALOGE("%s::fimc destory fail \n", __func__); - goto DESTROY_FAIL; - } - -#ifdef USE_LCD_ADDR_IN_HERE - { - if (0 < mDefaultFBFd) { - close(mDefaultFBFd); - mDefaultFBFd = -1; - } - } -#endif //USE_LCD_ADDR_IN_HERE - -#if defined(BOARD_USE_V4L2_ION) - if (mFBaddr != NULL) - ion_unmap((void *)mFBaddr, ALIGN(mFBsize * 4 * 2, PAGE_SIZE)); - - if (mFBionfd > 0) - ion_free(mFBionfd); - - mFBaddr = NULL; - mFBionfd = -1; - mFBsize = 0; -#endif - -#if defined(BOARD_USE_V4L2_ION) && defined(BOARD_USES_FIMGAPI) - ion_unmap((void *)g2d_reserved_memory[0], ALIGN(g2d_reserved_memory_size * HDMI_G2D_OUTPUT_BUF_NUM, PAGE_SIZE)); -#endif - - mFlagCreate = false; - - return true; - -DESTROY_FAIL : - - return false; -} - -bool SecHdmi::connect(void) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - { - Mutex::Autolock lock(mLock); - - if (mFlagCreate == false) { - ALOGE("%s::Not Yet Created \n", __func__); - return false; - } - - if (mFlagConnected == true) { - ALOGD("%s::Already Connected.. \n", __func__); - return true; - } - - if (mHdmiOutputMode >= HDMI_OUTPUT_MODE_YCBCR && - mHdmiOutputMode <= HDMI_OUTPUT_MODE_DVI) { - if (m_flagHWConnected() == false) { - ALOGD("%s::m_flagHWConnected() fail \n", __func__); - return false; - } - -#if defined(BOARD_USES_EDID) - if (!EDIDOpen()) - ALOGE("EDIDInit() failed!\n"); - - if (!EDIDRead()) { - ALOGE("EDIDRead() failed!\n"); - if (!EDIDClose()) - ALOGE("EDIDClose() failed!\n"); - } -#endif - -#if defined(BOARD_USES_CEC) - if (!(mCECThread->mFlagRunning)) - mCECThread->start(); -#endif - } - } - - if (this->setHdmiOutputMode(mHdmiOutputMode, true) == false) - ALOGE("%s::setHdmiOutputMode(%d) fail \n", __func__, mHdmiOutputMode); - - if (mHdmiOutputMode >= HDMI_OUTPUT_MODE_YCBCR && - mHdmiOutputMode <= HDMI_OUTPUT_MODE_DVI) { - if (this->setHdmiResolution(mHdmiResolutionValue, true) == false) - ALOGE("%s::setHdmiResolution(%d) fail \n", __func__, mHdmiResolutionValue); - - if (this->setHdcpMode(mHdcpMode, false) == false) - ALOGE("%s::setHdcpMode(%d) fail \n", __func__, mHdcpMode); - - mHdmiInfoChange = true; - mFlagConnected = true; - -#if defined(BOARD_USES_EDID) - // show display.. - display_menu(); -#endif - } - - return true; -} - -bool SecHdmi::disconnect(void) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - Mutex::Autolock lock(mLock); - - if (mFlagCreate == false) { - ALOGE("%s::Not Yet Created \n", __func__); - return false; - } - - if (mFlagConnected == false) { - ALOGE("%s::Already Disconnected.. \n", __func__); - return true; - } - - if (mHdmiOutputMode >= HDMI_OUTPUT_MODE_YCBCR && - mHdmiOutputMode <= HDMI_OUTPUT_MODE_DVI) { -#if defined(BOARD_USES_CEC) - if (mCECThread->mFlagRunning) - mCECThread->stop(); -#endif - -#if defined(BOARD_USES_EDID) - if (!EDIDClose()) { - ALOGE("EDIDClose() failed!\n"); - return false; - } -#endif - } - - for (int layer = SecHdmi::HDMI_LAYER_BASE + 1; layer <= SecHdmi::HDMI_LAYER_GRAPHIC_0; layer++) { - if (mFlagHdmiStart[layer] == true && m_stopHdmi(layer) == false) { - ALOGE("%s::hdmiLayer(%d) layer fail \n", __func__, layer); - return false; - } - } - -#if defined(BOARD_USE_V4L2) - for (int layer = HDMI_LAYER_BASE + 1; layer < HDMI_LAYER_MAX; layer++) { - if (hdmi_deinit_layer(layer) < 0) - ALOGE("%s::hdmi_deinit_layer(%d) fail", __func__, layer); - } -#else - tvout_deinit(); -#endif - - mFlagConnected = false; - - mHdmiOutputMode = DEFAULT_OUPUT_MODE; - mHdmiResolutionValue = DEFAULT_HDMI_RESOLUTION_VALUE; -#if defined(BOARD_USE_V4L2) - mHdmiPresetId = DEFAULT_HDMI_PRESET_ID; -#else - mHdmiStdId = DEFAULT_HDMI_STD_ID; -#endif - mCompositeStd = DEFAULT_COMPOSITE_STD; - mAudioMode = 2; - mCurrentHdmiOutputMode = -1; - mCurrentHdmiResolutionValue = 0; - mCurrentAudioMode = -1; - mFimcCurrentOutBufIndex = 0; - - return true; -} - -bool SecHdmi::flagConnected(void) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - Mutex::Autolock lock(mLock); - - if (mFlagCreate == false) { - ALOGE("%s::Not Yet Created \n", __func__); - return false; - } - - return mFlagConnected; -} - -bool SecHdmi::flush(int srcW, int srcH, int srcColorFormat, - unsigned int srcYAddr, unsigned int srcCbAddr, unsigned int srcCrAddr, - int dstX, int dstY, - int hdmiLayer, - int num_of_hwc_layer) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s [srcW=%d, srcH=%d, srcColorFormat=0x%x, srcYAddr=0x%x, srcCbAddr=0x%x, srcCrAddr=0x%x, dstX=%d, dstY=%d, hdmiLayer=%d]", - __func__, srcW, srcH, srcColorFormat, srcYAddr, srcCbAddr, srcCrAddr, dstX, dstY, hdmiLayer); -#endif - - Mutex::Autolock lock(mLock); - - if (mFlagCreate == false) { - ALOGE("%s::Not Yet Created \n", __func__); - return false; - } - -#if defined(BOARD_USE_V4L2) - if (hdmiLayer == HDMI_LAYER_VIDEO) { - mDstWidth[hdmiLayer] = mHdmiDstWidth; - mDstHeight[hdmiLayer] = mHdmiDstHeight; - } else { - if (num_of_hwc_layer == 0) { - struct v4l2_rect rect; - int tempSrcW, tempSrcH; - - if (mG2DUIRotVal == 0 || mG2DUIRotVal == 180) { - tempSrcW = srcW; - tempSrcH = srcH; - } else { - tempSrcW = srcH; - tempSrcH = srcW; - } - - hdmi_cal_rect(tempSrcW, tempSrcH, mHdmiDstWidth, mHdmiDstHeight, &rect); - mDstWidth[hdmiLayer] = rect.width; - mDstHeight[hdmiLayer] = rect.height; - mDstWidth[HDMI_LAYER_VIDEO] = 0; - mDstHeight[HDMI_LAYER_VIDEO] = 0; - } else { - mDstWidth[hdmiLayer] = mHdmiDstWidth; - mDstHeight[hdmiLayer] = mHdmiDstHeight; - } - } -#ifdef DEBUG_MSG_ENABLE - ALOGE("m_reset param(%d, %d, %d, %d)", - mDstWidth[hdmiLayer], mDstHeight[hdmiLayer], \ - mPrevDstWidth[hdmiLayer], mPrevDstHeight[hdmiLayer]); -#endif -#endif - - if (srcW != mSrcWidth[hdmiLayer] || - srcH != mSrcHeight[hdmiLayer] || - srcColorFormat != mSrcColorFormat[hdmiLayer] || - mHdmiDstWidth != mHdmiResolutionWidth[hdmiLayer] || - mHdmiDstHeight != mHdmiResolutionHeight[hdmiLayer] || -#if defined(BOARD_USE_V4L2) - mDstWidth[hdmiLayer] != mPrevDstWidth[hdmiLayer] || - mDstHeight[hdmiLayer] != mPrevDstHeight[hdmiLayer] || -#endif - mHdmiInfoChange == true) { -#ifdef DEBUG_MSG_ENABLE - ALOGD("m_reset param(%d, %d, %d, %d, %d, %d, %d)", - srcW, mSrcWidth[hdmiLayer], \ - srcH, mSrcHeight[hdmiLayer], \ - srcColorFormat,mSrcColorFormat[hdmiLayer], \ - hdmiLayer); -#endif - - if (m_reset(srcW, srcH, srcColorFormat, hdmiLayer, num_of_hwc_layer) == false) { - ALOGE("%s::m_reset(%d, %d, %d, %d, %d) fail", __func__, srcW, srcH, srcColorFormat, hdmiLayer, num_of_hwc_layer); - return false; - } - } - - if (srcYAddr == 0) { -#if defined(BOARD_USE_V4L2_ION) - unsigned int FB_size = ALIGN(srcW, 16) * ALIGN(srcH, 16) * HDMI_FB_BPP_SIZE; - void *virFBAddr = 0; - struct s3c_fb_user_ion_client ion_handle; - - if (mFBaddr != NULL) { - ion_unmap((void *)mFBaddr, ALIGN(mFBsize * 2, PAGE_SIZE)); - ion_free(mFBionfd); - } - - // get framebuffer virtual address for LCD - if (ioctl(mDefaultFBFd, S3CFB_GET_ION_USER_HANDLE, &ion_handle) < 0) { - ALOGE("%s:ioctl(S3CFB_GET_ION_USER_HANDLE) fail", __func__); - return false; - } - - virFBAddr = ion_map(ion_handle.fd, ALIGN(FB_size * 2, PAGE_SIZE), 0); - if (virFBAddr == MAP_FAILED) { - ALOGE("%s::ion_map fail", __func__); - ion_free(ion_handle.fd); - mFBaddr = NULL; - return false; - } - - if ((mFBIndex % 2) == 0) - srcYAddr = (unsigned int)virFBAddr; - else - srcYAddr = (unsigned int)virFBAddr + FB_size; - - srcCbAddr = srcYAddr; - - mFBIndex++; - mFBaddr = virFBAddr; - mFBsize = FB_size; - mFBionfd = ion_handle.fd; -#else - unsigned int phyFBAddr = 0; - - // get physical framebuffer address for LCD - if (ioctl(mDefaultFBFd, S3CFB_GET_FB_PHY_ADDR, &phyFBAddr) == -1) { - ALOGE("%s:ioctl(S3CFB_GET_FB_PHY__ADDR) fail", __func__); - return false; - } - - /* - * when early suspend, FIMD IP off. - * so physical framebuffer address for LCD is 0x00000000 - * so JUST RETURN. - */ - if (phyFBAddr == 0) { - ALOGE("%s::S3CFB_GET_FB_PHY_ADDR fail", __func__); - return true; - } - srcYAddr = phyFBAddr; - srcCbAddr = srcYAddr; -#endif - } - - if (hdmiLayer == HDMI_LAYER_VIDEO) { - if (srcColorFormat == HAL_PIXEL_FORMAT_YCbCr_420_SP || - srcColorFormat == HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP) { -#if defined(BOARD_USE_V4L2) - mMixerBuffer[hdmiLayer][0].virt.extP[0] = (char *)srcYAddr; - mMixerBuffer[hdmiLayer][0].virt.extP[1] = (char *)srcCbAddr; -#else - hdmi_set_v_param(hdmiLayer, - srcW, srcH, V4L2_PIX_FMT_NV12, - srcYAddr, srcCbAddr, - mHdmiDstWidth, mHdmiDstHeight); -#endif - } else if (srcColorFormat == HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED) { -#if defined(BOARD_USE_V4L2) - mMixerBuffer[hdmiLayer][0].virt.extP[0] = (char *)srcYAddr; - mMixerBuffer[hdmiLayer][0].virt.extP[1] = (char *)srcCbAddr; -#else - hdmi_set_v_param(hdmiLayer, - srcW, srcH, V4L2_PIX_FMT_NV12T, - srcYAddr, srcCbAddr, - mHdmiDstWidth, mHdmiDstHeight); -#endif - } else if (srcColorFormat == HAL_PIXEL_FORMAT_YCrCb_420_SP || - srcColorFormat == HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP) { -#if defined(BOARD_USE_V4L2) - mMixerBuffer[hdmiLayer][0].virt.extP[0] = (char *)srcYAddr; - mMixerBuffer[hdmiLayer][0].virt.extP[1] = (char *)srcCbAddr; -#else - hdmi_set_v_param(hdmiLayer, - srcW, srcH, V4L2_PIX_FMT_NV21, - srcYAddr, srcCbAddr, - mHdmiDstWidth, mHdmiDstHeight); -#endif - } else { - if (mSecFimc.setSrcAddr(srcYAddr, srcCbAddr, srcCrAddr, srcColorFormat) == false) { - ALOGE("%s::setSrcAddr(%d, %d, %d) fail", - __func__, srcYAddr, srcCbAddr, srcCrAddr); - return false; - } - - int y_size = 0; - if (mUIRotVal == 0 || mUIRotVal == 180) - y_size = ALIGN(ALIGN(srcW,128) * ALIGN(srcH, 32), SZ_8K); - else - y_size = ALIGN(ALIGN(srcH,128) * ALIGN(srcW, 32), SZ_8K); - - mHdmiSrcYAddr = mFimcReservedMem[mFimcCurrentOutBufIndex].phys.extP[0]; -#ifdef BOARD_USE_V4L2 - mHdmiSrcCbCrAddr = mFimcReservedMem[mFimcCurrentOutBufIndex].phys.extP[1]; -#else - mHdmiSrcCbCrAddr = mFimcReservedMem[mFimcCurrentOutBufIndex].phys.extP[0] + y_size; -#endif - if (mSecFimc.setDstAddr(mHdmiSrcYAddr, mHdmiSrcCbCrAddr, 0, mFimcCurrentOutBufIndex) == false) { - ALOGE("%s::mSecFimc.setDstAddr(%d, %d) fail \n", - __func__, mHdmiSrcYAddr, mHdmiSrcCbCrAddr); - return false; - } - - if (mSecFimc.draw(0, mFimcCurrentOutBufIndex) == false) { - ALOGE("%s::mSecFimc.draw() fail \n", __func__); - return false; - } -#if defined(BOARD_USE_V4L2) - mMixerBuffer[hdmiLayer][0].virt.extP[0] = (char *)mHdmiSrcYAddr; - mMixerBuffer[hdmiLayer][0].virt.extP[1] = (char *)mHdmiSrcCbCrAddr; -#else - if (mUIRotVal == 0 || mUIRotVal == 180) - hdmi_set_v_param(hdmiLayer, - srcW, srcH, V4L2_PIX_FMT_NV12T, - mHdmiSrcYAddr, mHdmiSrcCbCrAddr, - mHdmiDstWidth, mHdmiDstHeight); - else - hdmi_set_v_param(hdmiLayer, - srcH, srcW, V4L2_PIX_FMT_NV12T, - mHdmiSrcYAddr, mHdmiSrcCbCrAddr, - mHdmiDstWidth, mHdmiDstHeight); -#endif - mFimcCurrentOutBufIndex++; - if (mFimcCurrentOutBufIndex >= HDMI_FIMC_OUTPUT_BUF_NUM) - mFimcCurrentOutBufIndex = 0; - } - - } else { - if (srcColorFormat != HAL_PIXEL_FORMAT_BGRA_8888 && - srcColorFormat != HAL_PIXEL_FORMAT_RGBA_8888 && - srcColorFormat != HAL_PIXEL_FORMAT_RGB_565) { - if (mSecFimc.setSrcAddr(srcYAddr, srcCbAddr, srcCrAddr, srcColorFormat) == false) { - ALOGE("%s::setSrcAddr(%d, %d, %d) fail", - __func__, srcYAddr, srcCbAddr, srcCrAddr); - return false; - } - - if (mSecFimc.draw(0, mFimcCurrentOutBufIndex) == false) { - ALOGE("%s::mSecFimc.draw() failed", __func__); - return false; - } -#if defined(BOARD_USE_V4L2) - if (hdmi_set_g_scaling(hdmiLayer, - HAL_PIXEL_FORMAT_BGRA_8888, - mDstRect.width, mDstRect.height, - mHdmiSrcYAddr, &mMixerBuffer[hdmiLayer][0], - mDstRect.left , mDstRect.top, - mHdmiDstWidth, mHdmiDstHeight, - mG2DUIRotVal, - num_of_hwc_layer) < 0) - return false; -#else - if (hdmi_gl_set_param(hdmiLayer, - HAL_PIXEL_FORMAT_BGRA_8888, - mDstRect.width, mDstRect.height, - mHdmiSrcYAddr, mHdmiSrcCbCrAddr, - mDstRect.left , mDstRect.top, - mHdmiDstWidth, mHdmiDstHeight, - mG2DUIRotVal) < 0) -#endif - return false; - } else { -#if CHECK_GRAPHIC_LAYER_TIME - nsecs_t start, end; - start = systemTime(); -#endif - if (num_of_hwc_layer == 0) { /* UI only mode */ - struct v4l2_rect rect; - - if (mG2DUIRotVal == 0 || mG2DUIRotVal == 180) - hdmi_cal_rect(srcW, srcH, mHdmiDstWidth, mHdmiDstHeight, &rect); - else - hdmi_cal_rect(srcH, srcW, mHdmiDstWidth, mHdmiDstHeight, &rect); - - rect.left = ALIGN(rect.left, 16); - -#if defined(BOARD_USE_V4L2) - if (hdmi_set_g_scaling(hdmiLayer, - srcColorFormat, - srcW, srcH, - srcYAddr, &mMixerBuffer[hdmiLayer][0], - rect.left, rect.top, - rect.width, rect.height, - mG2DUIRotVal, - num_of_hwc_layer) < 0) - return false; -#else - if (hdmi_gl_set_param(hdmiLayer, - srcColorFormat, - srcW, srcH, - srcYAddr, srcCbAddr, - rect.left, rect.top, - rect.width, rect.height, - mG2DUIRotVal) < 0) - return false; -#endif - } else { /* Video Playback Mode */ -#if defined(BOARD_USE_V4L2) - if (hdmi_set_g_scaling(hdmiLayer, - srcColorFormat, - srcW, srcH, - srcYAddr, &mMixerBuffer[hdmiLayer][0], - dstX, dstY, - mHdmiDstWidth, mHdmiDstHeight, - mG2DUIRotVal, - num_of_hwc_layer) < 0) - return false; -#else - if (hdmi_gl_set_param(hdmiLayer, - srcColorFormat, - srcW, srcH, - srcYAddr, srcCbAddr, - dstX, dstY, - mHdmiDstWidth, mHdmiDstHeight, - mG2DUIRotVal) < 0) - return false; -#endif - } -#if CHECK_GRAPHIC_LAYER_TIME - end = systemTime(); - ALOGD("[UI] hdmi_gl_set_param[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start))); -#endif - } - } - - if (mFlagConnected) { -#if defined(BOARD_USE_V4L2) - unsigned int num_of_plane; - - if (hdmi_get_src_plane(srcColorFormat, &num_of_plane) < 0) { - ALOGE("%s::hdmi_get_src_plane(%d) fail", __func__, srcColorFormat); - return false; - } - - if (mFlagHdmiStart[hdmiLayer] == false && m_startHdmi(hdmiLayer, num_of_plane) == false) { - ALOGE("%s::hdmiLayer(%d) fail", __func__, hdmiLayer); - return false; - } -#else - if (mFlagHdmiStart[hdmiLayer] == false && m_startHdmi(hdmiLayer) == false) { - ALOGE("%s::hdmiLayer(%d) fail", __func__, hdmiLayer); - return false; - } -#endif - } - - return true; -} - -bool SecHdmi::clear(int hdmiLayer) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s || hdmiLayer = %d", __func__, hdmiLayer); -#endif - - Mutex::Autolock lock(mLock); - - if (mFlagCreate == false) { - ALOGE("%s::Not Yet Created \n", __func__); - return false; - } - if (mFlagHdmiStart[hdmiLayer] == true && m_stopHdmi(hdmiLayer) == false) { - ALOGE("%s::m_stopHdmi: layer[%d] fail \n", __func__, hdmiLayer); - return false; - } - return true; -} - -bool SecHdmi::setHdmiOutputMode(int hdmiOutputMode, bool forceRun) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::hdmiOutputMode = %d, forceRun = %d", __func__, hdmiOutputMode, forceRun); -#endif - - Mutex::Autolock lock(mLock); - - if (mFlagCreate == false) { - ALOGE("%s::Not Yet Created \n", __func__); - return false; - } - - if (forceRun == false && mHdmiOutputMode == hdmiOutputMode) { -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::same hdmiOutputMode(%d) \n", __func__, hdmiOutputMode); -#endif - return true; - } - - int newHdmiOutputMode = hdmiOutputMode; - - int v4l2OutputType = hdmi_outputmode_2_v4l2_output_type(hdmiOutputMode); - if (v4l2OutputType < 0) { - ALOGD("%s::hdmi_outputmode_2_v4l2_output_type(%d) fail\n", __func__, hdmiOutputMode); - return false; - } - -#if defined(BOARD_USES_EDID) - int newV4l2OutputType = hdmi_check_output_mode(v4l2OutputType); - if (newV4l2OutputType != v4l2OutputType) { - newHdmiOutputMode = hdmi_v4l2_output_type_2_outputmode(newV4l2OutputType); - if (newHdmiOutputMode < 0) { - ALOGD("%s::hdmi_v4l2_output_type_2_outputmode(%d) fail\n", __func__, newV4l2OutputType); - return false; - } - - ALOGD("%s::calibration mode(%d -> %d)... \n", __func__, hdmiOutputMode, newHdmiOutputMode); - mHdmiInfoChange = true; - } -#endif - - if (mHdmiOutputMode != newHdmiOutputMode) { - mHdmiOutputMode = newHdmiOutputMode; - mHdmiInfoChange = true; - } - - return true; -} - -bool SecHdmi::setHdmiResolution(unsigned int hdmiResolutionValue, bool forceRun) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s:: hdmiResolutionValue = %d, forceRun = %d", __func__, hdmiResolutionValue, forceRun); -#endif - - Mutex::Autolock lock(mLock); - - if (mFlagCreate == false) { - ALOGE("%s::Not Yet Created \n", __func__); - return false; - } - - if (forceRun == false && mHdmiResolutionValue == hdmiResolutionValue) { -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::same hdmiResolutionValue(%d) \n", __func__, hdmiResolutionValue); -#endif - return true; - } - - unsigned int newHdmiResolutionValue = hdmiResolutionValue; - int w = 0; - int h = 0; - -#if defined(BOARD_USES_EDID) - // find perfect resolutions.. -#if defined(BOARD_USE_V4L2) - unsigned int preset_id; - if (hdmi_resolution_2_preset_id(newHdmiResolutionValue, &w, &h, &preset_id) < 0 || - hdmi_check_resolution(preset_id) < 0) { - bool flagFoundIndex = false; - int resolutionValueIndex = m_resolutionValueIndex(newHdmiResolutionValue); - - for (int i = resolutionValueIndex + 1; i < mHdmiSizeOfResolutionValueList; i++) { - if (hdmi_resolution_2_preset_id(mHdmiResolutionValueList[i], &w, &h, &preset_id) == 0 && - hdmi_check_resolution(preset_id) == 0) { - newHdmiResolutionValue = mHdmiResolutionValueList[i]; - flagFoundIndex = true; - break; - } - } - - if (flagFoundIndex == false) { - ALOGE("%s::hdmi cannot control this resolution(%d) fail \n", __func__, hdmiResolutionValue); - // Set resolution to 480P - newHdmiResolutionValue = mHdmiResolutionValueList[mHdmiSizeOfResolutionValueList-2]; - } else { - ALOGD("%s::HDMI resolutions size is calibrated(%d -> %d)..\n", __func__, hdmiResolutionValue, newHdmiResolutionValue); - } - } -#else - v4l2_std_id std_id; - if (hdmi_resolution_2_std_id(newHdmiResolutionValue, &w, &h, &std_id) < 0 || - hdmi_check_resolution(std_id) < 0) { - bool flagFoundIndex = false; - int resolutionValueIndex = m_resolutionValueIndex(newHdmiResolutionValue); - - for (int i = resolutionValueIndex + 1; i < mHdmiSizeOfResolutionValueList; i++) { - if (hdmi_resolution_2_std_id(mHdmiResolutionValueList[i], &w, &h, &std_id) == 0 && - hdmi_check_resolution(std_id) == 0) { - newHdmiResolutionValue = mHdmiResolutionValueList[i]; - flagFoundIndex = true; - break; - } - } - - if (flagFoundIndex == false) { - ALOGE("%s::hdmi cannot control this resolution(%d) fail \n", __func__, hdmiResolutionValue); - // Set resolution to 480P - newHdmiResolutionValue = mHdmiResolutionValueList[mHdmiSizeOfResolutionValueList-2]; - } else { - ALOGD("%s::HDMI resolutions size is calibrated(%d -> %d)..\n", __func__, hdmiResolutionValue, newHdmiResolutionValue); - } - } -#endif - else { -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::find resolutions(%d) at once\n", __func__, hdmiResolutionValue); -#endif - } -#endif - - if (mHdmiResolutionValue != newHdmiResolutionValue) { - mHdmiResolutionValue = newHdmiResolutionValue; - mHdmiInfoChange = true; - } - - return true; -} - -bool SecHdmi::setHdcpMode(bool hdcpMode, bool forceRun) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - Mutex::Autolock lock(mLock); - - if (mFlagCreate == false) { - ALOGE("%s::Not Yet Created \n", __func__); - return false; - } - - if (forceRun == false && mHdcpMode == hdcpMode) { -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::same hdcpMode(%d) \n", __func__, hdcpMode); -#endif - return true; - } - - mHdcpMode = hdcpMode; - mHdmiInfoChange = true; - - return true; -} - -bool SecHdmi::setUIRotation(unsigned int rotVal, unsigned int hwcLayer) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - Mutex::Autolock lock(mLock); - - if (mFlagCreate == false) { - ALOGE("%s::Not Yet Created \n", __func__); - return false; - } - - if (rotVal % 90 != 0) { - ALOGE("%s::Invalid rotation value(%d)", __func__, rotVal); - return false; - } - - /* G2D rotation */ - if (rotVal != mG2DUIRotVal) { - mG2DUIRotVal = rotVal; - mHdmiInfoChange = true; - } - - /* FIMC rotation */ - if (hwcLayer == 0) { /* Rotate in UI only mode */ - if (rotVal != mUIRotVal) { - mSecFimc.setRotVal(rotVal); - mUIRotVal = rotVal; - mHdmiInfoChange = true; - } - } else { /* Don't rotate video layer when video is played. */ - rotVal = 0; - if (rotVal != mUIRotVal) { - mSecFimc.setRotVal(rotVal); - mUIRotVal = rotVal; - mHdmiInfoChange = true; - } - } - - return true; -} - -bool SecHdmi::setDisplaySize(int width, int height) -{ - mDisplayWidth = width; - mDisplayHeight = height; - - return true; -} - -bool SecHdmi::m_reset(int w, int h, int colorFormat, int hdmiLayer, int hwcLayer) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s called", __func__); -#endif - v4l2_std_id std_id = 0; - mFimcCurrentOutBufIndex = 0; - - int srcW = w; - int srcH = h; - -#if defined(BOARD_USE_V4L2) - if (mFlagHdmiStart[hdmiLayer] == true && m_stopHdmi(hdmiLayer) == false) { - ALOGE("%s::m_stopHdmi: layer[%d] fail", __func__, hdmiLayer); - return false; - } -#else - // stop all.. - for (int layer = HDMI_LAYER_BASE + 1; layer < HDMI_LAYER_MAX; layer++) { - if (mFlagHdmiStart[layer] == true && m_stopHdmi(layer) == false) { - ALOGE("%s::m_stopHdmi: layer[%d] fail", __func__, layer); - return false; - } - } -#endif - -#if defined(BOARD_USE_V4L2) - if (hdmi_deinit_layer(hdmiLayer) < 0) - ALOGE("%s::hdmi_deinit_layer(%d) fail", __func__, hdmiLayer); - - mHdmiFd[hdmiLayer] = hdmi_init_layer(hdmiLayer); - if (mHdmiFd[hdmiLayer] < 0) - ALOGE("%s::hdmi_init_layer(%d) fail", __func__, hdmiLayer); - - if (tvout_std_v4l2_init(mHdmiFd[hdmiLayer], mHdmiPresetId) < 0) - ALOGE("%s::tvout_std_v4l2_init fail", __func__); -#endif - - if (w != mSrcWidth [hdmiLayer] || - h != mSrcHeight [hdmiLayer] || - mHdmiDstWidth != mHdmiResolutionWidth[hdmiLayer] || - mHdmiDstHeight != mHdmiResolutionHeight[hdmiLayer] || -#if defined(BOARD_USE_V4L2) - mDstWidth[hdmiLayer] != mPrevDstWidth[hdmiLayer] || - mDstHeight[hdmiLayer] != mPrevDstHeight[hdmiLayer] || -#endif - colorFormat != mSrcColorFormat[hdmiLayer]) { - int preVideoSrcColorFormat = mSrcColorFormat[hdmiLayer]; - int videoSrcColorFormat = colorFormat; - - if (preVideoSrcColorFormat != HAL_PIXEL_FORMAT_YCbCr_420_SP && - preVideoSrcColorFormat != HAL_PIXEL_FORMAT_YCrCb_420_SP && - preVideoSrcColorFormat != HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP && - preVideoSrcColorFormat != HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP && - preVideoSrcColorFormat != HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED) { - ALOGI("%s: Unsupported preVideoSrcColorFormat = 0x%x\n", __func__, preVideoSrcColorFormat); - preVideoSrcColorFormat = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED; - } - - if (hdmiLayer == HDMI_LAYER_VIDEO) { - if (colorFormat != HAL_PIXEL_FORMAT_YCbCr_420_SP && - colorFormat != HAL_PIXEL_FORMAT_YCrCb_420_SP && - colorFormat != HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP && - colorFormat != HAL_PIXEL_FORMAT_CUSTOM_YCrCb_420_SP && - colorFormat != HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED) { -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s call mSecFimc.setSrcParams\n", __func__); -#endif - unsigned int full_wdith = ALIGN(w, 16); - unsigned int full_height = ALIGN(h, 2); - - if (mSecFimc.setSrcParams(full_wdith, full_height, 0, 0, - (unsigned int*)&w, (unsigned int*)&h, colorFormat, true) == false) { - ALOGE("%s::mSecFimc.setSrcParams(%d, %d, %d) fail \n", - __func__, w, h, colorFormat); - return false; - } - - mFimcDstColorFormat = HAL_PIXEL_FORMAT_CUSTOM_YCbCr_420_SP_TILED; - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s call mSecFimc.setDstParams\n", __func__); -#endif - if (mUIRotVal == 0 || mUIRotVal == 180) { - if (mSecFimc.setDstParams((unsigned int)w, (unsigned int)h, 0, 0, - (unsigned int*)&w, (unsigned int*)&h, mFimcDstColorFormat, true) == false) { - ALOGE("%s::mSecFimc.setDstParams(%d, %d, %d) fail \n", - __func__, w, h, mFimcDstColorFormat); - return false; - } -#if defined(BOARD_USE_V4L2) - hdmi_set_v_param(mHdmiFd[hdmiLayer], hdmiLayer, - mFimcDstColorFormat, srcW, srcH, - &mMixerBuffer[hdmiLayer][0], - 0, 0, mHdmiDstWidth, mHdmiDstHeight); -#endif - } else { - if (mSecFimc.setDstParams((unsigned int)h, (unsigned int)w, 0, 0, - (unsigned int*)&h, (unsigned int*)&w, mFimcDstColorFormat, true) == false) { - ALOGE("%s::mSecFimc.setDstParams(%d, %d, %d) fail \n", - __func__, w, h, mFimcDstColorFormat); - return false; - } -#if defined(BOARD_USE_V4L2) - hdmi_set_v_param(mHdmiFd[hdmiLayer], hdmiLayer, - mFimcDstColorFormat, srcH, srcW, - &mMixerBuffer[hdmiLayer][0], - 0, 0, mHdmiDstWidth, mHdmiDstHeight); -#endif - } - } -#if defined(BOARD_USE_V4L2) - else { - hdmi_set_v_param(mHdmiFd[hdmiLayer], hdmiLayer, - colorFormat, srcW, srcH, - &mMixerBuffer[hdmiLayer][0], - 0, 0, mHdmiDstWidth, mHdmiDstHeight); - } -#endif - mPrevDstWidth[hdmiLayer] = mHdmiDstWidth; - mPrevDstHeight[hdmiLayer] = mHdmiDstHeight; - } else { -#if defined(BOARD_USE_V4L2) - struct v4l2_rect rect; - int tempSrcW, tempSrcH; - - if (mG2DUIRotVal == 0 || mG2DUIRotVal == 180) { - tempSrcW = srcW; - tempSrcH = srcH; - } else { - tempSrcW = srcH; - tempSrcH = srcW; - } - - hdmi_cal_rect(tempSrcW, tempSrcH, mHdmiDstWidth, mHdmiDstHeight, &rect); - rect.left = ALIGN(rect.left, 16); - - if (hwcLayer == 0) { /* UI only mode */ - hdmi_set_g_param(mHdmiFd[hdmiLayer], hdmiLayer, - colorFormat, srcW, srcH, - &mMixerBuffer[hdmiLayer][0], - rect.left, rect.top, rect.width, rect.height); - mPrevDstWidth[hdmiLayer] = rect.width; - mPrevDstHeight[hdmiLayer] = rect.height; - mPrevDstWidth[HDMI_LAYER_VIDEO] = 0; - mPrevDstHeight[HDMI_LAYER_VIDEO] = 0; - } else { /* Video Playback + UI Mode */ - hdmi_set_g_param(mHdmiFd[hdmiLayer], hdmiLayer, - colorFormat, srcW, srcH, - &mMixerBuffer[hdmiLayer][0], - 0, 0, mHdmiDstWidth, mHdmiDstHeight); - mPrevDstWidth[hdmiLayer] = mHdmiDstWidth; - mPrevDstHeight[hdmiLayer] = mHdmiDstHeight; - } -#endif - } - - if (preVideoSrcColorFormat != videoSrcColorFormat) - mHdmiInfoChange = true; - - mSrcWidth[hdmiLayer] = srcW; - mSrcHeight[hdmiLayer] = srcH; - mSrcColorFormat[hdmiLayer] = colorFormat; - - mHdmiResolutionWidth[hdmiLayer] = mHdmiDstWidth; - mHdmiResolutionHeight[hdmiLayer] = mHdmiDstHeight; - -#ifdef DEBUG_MSG_ENABLE - ALOGD("m_reset saved param(%d, %d, %d, %d, %d, %d, %d) \n", - srcW, mSrcWidth[hdmiLayer], \ - srcH, mSrcHeight[hdmiLayer], \ - colorFormat,mSrcColorFormat[hdmiLayer], \ - hdmiLayer); -#endif - } - - if (mHdmiInfoChange == true) { -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("mHdmiInfoChange: %d\n", mHdmiInfoChange); -#endif - // stop all.. -#if defined(BOARD_USES_CEC) - if (mHdmiOutputMode >= HDMI_OUTPUT_MODE_YCBCR && - mHdmiOutputMode <= HDMI_OUTPUT_MODE_DVI) { - if (mCECThread->mFlagRunning) - mCECThread->stop(); - } -#endif - - if (m_setHdmiOutputMode(mHdmiOutputMode) == false) { - ALOGE("%s::m_setHdmiOutputMode() fail \n", __func__); - return false; - } - if (mHdmiOutputMode == COMPOSITE_OUTPUT_MODE) { - std_id = composite_std_2_v4l2_std_id(mCompositeStd); - if ((int)std_id < 0) { - ALOGE("%s::composite_std_2_v4l2_std_id(%d) fail\n", __func__, mCompositeStd); - return false; - } - if (m_setCompositeResolution(mCompositeStd) == false) { - ALOGE("%s::m_setCompositeRsolution() fail \n", __func__); - return false; - } - } else if (mHdmiOutputMode >= HDMI_OUTPUT_MODE_YCBCR && - mHdmiOutputMode <= HDMI_OUTPUT_MODE_DVI) { - if (m_setHdmiResolution(mHdmiResolutionValue) == false) { - ALOGE("%s::m_setHdmiResolution() fail \n", __func__); - return false; - } - - if (m_setHdcpMode(mHdcpMode) == false) { - ALOGE("%s::m_setHdcpMode() fail \n", __func__); - return false; - } -#if !defined(BOARD_USE_V4L2) - std_id = mHdmiStdId; -#endif - } - -#if !defined(BOARD_USE_V4L2) - fp_tvout = tvout_init(std_id); - - for (int layer = HDMI_LAYER_BASE + 1; layer < HDMI_LAYER_MAX; layer++) { - if (hdmi_deinit_layer(layer) < 0) - ALOGE("%s::hdmi_init_layer(%d) fail \n", __func__, layer); - } - - for (int layer = HDMI_LAYER_BASE + 1; layer < HDMI_LAYER_MAX; layer++) { - if (hdmi_init_layer(layer) < 0) - ALOGE("%s::hdmi_init_layer(%d) fail \n", __func__, layer); - } -#endif - - if (mHdmiOutputMode >= HDMI_OUTPUT_MODE_YCBCR && - mHdmiOutputMode <= HDMI_OUTPUT_MODE_DVI) { -#if defined(BOARD_USES_CEC) - if (!(mCECThread->mFlagRunning)) - mCECThread->start(); -#endif - - if (m_setAudioMode(mAudioMode) == false) - ALOGE("%s::m_setAudioMode() fail \n", __func__); - } - - mHdmiInfoChange = false; -#ifdef BOARD_USE_V4L2 - for (int i = 0; i < HDMI_FIMC_OUTPUT_BUF_NUM; i++) - mFimcReservedMem[i] = *(mSecFimc.getMemAddr(i)); -#endif - } - - return true; -} - -#if defined(BOARD_USE_V4L2) -bool SecHdmi::m_startHdmi(int hdmiLayer, unsigned int num_of_plane) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - bool ret = true; - int buf_index = 0; - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s: hdmiLayer(%d) called\n", __func__, hdmiLayer); -#endif - - if (mFlagLayerEnable[hdmiLayer]) { - static unsigned int index = 0; - - if (mFlagHdmiStart[hdmiLayer] == false) { - index = 0; - if (tvout_std_v4l2_qbuf(mHdmiFd[hdmiLayer], V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_USERPTR, - index, num_of_plane, &mMixerBuffer[hdmiLayer][0]) < 0) { - ALOGE("%s::tvout_std_v4l2_qbuf(index : %d) (mSrcBufNum : %d) failed", __func__, index, HDMI_NUM_MIXER_BUF); - return false; - } - index++; - - if (tvout_std_v4l2_streamon(mHdmiFd[hdmiLayer], V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) < 0) { - ALOGE("%s::tvout_std_v4l2_streamon() failed", __func__); - return false; - } - - mFlagHdmiStart[hdmiLayer] = true; - } else { - if (tvout_std_v4l2_qbuf(mHdmiFd[hdmiLayer], V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_USERPTR, - index, num_of_plane, &mMixerBuffer[hdmiLayer][0]) < 0) { - ALOGE("%s::tvout_std_v4l2_qbuf() failed", __func__); - return false; - } - - if (tvout_std_v4l2_dqbuf(mHdmiFd[hdmiLayer], V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_USERPTR, &buf_index, num_of_plane) < 0) { - ALOGE("%s::tvout_std_v4l2_dqbuf() failed", __func__); - return false; - } - index = buf_index; - } - } - - return true; -} -#else -bool SecHdmi::m_startHdmi(int hdmiLayer) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - bool ret = true; - int buf_index = 0; - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s: hdmiLayer(%d) called\n", __func__, hdmiLayer); -#endif - - switch (hdmiLayer) { - case HDMI_LAYER_VIDEO: - tvout_v4l2_start_overlay(fp_tvout_v); - mFlagHdmiStart[hdmiLayer] = true; - break; - case HDMI_LAYER_GRAPHIC_0 : - if (mFlagLayerEnable[hdmiLayer]) { - if (ioctl(fp_tvout_g0, FBIOBLANK, (void *)FB_BLANK_UNBLANK) != -1) - mFlagHdmiStart[hdmiLayer] = true; - } - break; - case HDMI_LAYER_GRAPHIC_1 : - if (mFlagLayerEnable[hdmiLayer]) { - if (ioctl(fp_tvout_g1, FBIOBLANK, (void *)FB_BLANK_UNBLANK) != -1) - mFlagHdmiStart[hdmiLayer] = true; - } - break; - default : - ALOGE("%s::unmathced layer(%d) fail", __func__, hdmiLayer); - ret = false; - break; - } - - return true; -} -#endif - -bool SecHdmi::m_stopHdmi(int hdmiLayer) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - bool ret = true; - if (mFlagHdmiStart[hdmiLayer] == false) { - ALOGD("%s::already HDMI(%d layer) stopped.. \n", __func__, hdmiLayer); - return true; - } - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s : layer[%d] called\n", __func__, hdmiLayer); -#endif - -#if defined(BOARD_USE_V4L2) - int fd; - - switch (hdmiLayer) { - case HDMI_LAYER_VIDEO: - break; - case HDMI_LAYER_GRAPHIC_0 : - break; - case HDMI_LAYER_GRAPHIC_1 : -#if defined(BOARD_USES_FIMGAPI) - cur_g2d_address = 0; - g2d_buf_index = 0; -#endif - break; - default : - ALOGE("%s::unmathced layer(%d) fail", __func__, hdmiLayer); - ret = false; - break; - } - - if (mFlagLayerEnable[hdmiLayer]) { - if (tvout_std_v4l2_streamoff(mHdmiFd[hdmiLayer], V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) < 0) { - ALOGE("%s::tvout_std_v4l2_streamon layer(%d) failed", __func__, hdmiLayer); - return false; - } - - /* clear buffer */ - if (tvout_std_v4l2_reqbuf(mHdmiFd[hdmiLayer], V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_USERPTR, 0) < 0) { - ALOGE("%s::tvout_std_v4l2_reqbuf(buf_num=%d)[graphic layer] failed", __func__, 0); - return -1; - } - - mFlagHdmiStart[hdmiLayer] = false; - } -#else - switch (hdmiLayer) { - case HDMI_LAYER_VIDEO: - tvout_v4l2_stop_overlay(fp_tvout_v); - mFlagHdmiStart[hdmiLayer] = false; - break; - case HDMI_LAYER_GRAPHIC_0 : - if (mFlagLayerEnable[hdmiLayer]) { - if (ioctl(fp_tvout_g0, FBIOBLANK, (void *)FB_BLANK_POWERDOWN) != -1) - mFlagHdmiStart[hdmiLayer] = false; - } - break; - case HDMI_LAYER_GRAPHIC_1 : -#if defined(BOARD_USES_FIMGAPI) - cur_g2d_address = 0; - g2d_buf_index = 0; -#endif - if (mFlagLayerEnable[hdmiLayer]) { - if (ioctl(fp_tvout_g1, FBIOBLANK, (void *)FB_BLANK_POWERDOWN) != -1) - mFlagHdmiStart[hdmiLayer] = false; - } - break; - default : - ALOGE("%s::unmathced layer(%d) fail", __func__, hdmiLayer); - ret = false; - break; - } -#endif - - return true; -} - -bool SecHdmi::m_setHdmiOutputMode(int hdmiOutputMode) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - if (hdmiOutputMode == mCurrentHdmiOutputMode) { -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::same hdmiOutputMode(%d) \n", __func__, hdmiOutputMode); -#endif - return true; - } - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s called\n", __func__); -#endif - - int v4l2OutputType = hdmi_outputmode_2_v4l2_output_type(hdmiOutputMode); - if (v4l2OutputType < 0) { - ALOGE("%s::hdmi_outputmode_2_v4l2_output_type(%d) fail\n", __func__, hdmiOutputMode); - return false; - } - - output_type = v4l2OutputType; - - mCurrentHdmiOutputMode = hdmiOutputMode; - - return true; -} - -bool SecHdmi::m_setCompositeResolution(unsigned int compositeStdId) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s called\n", __func__); -#endif - - int w = 0; - int h = 0; - - if (mHdmiOutputMode != COMPOSITE_OUTPUT_MODE) { - ALOGE("%s:: not supported output type \n", __func__); - return false; - } - - switch (compositeStdId) { - case COMPOSITE_STD_NTSC_M: - case COMPOSITE_STD_NTSC_443: - w = 704; - h = 480; - break; - case COMPOSITE_STD_PAL_BDGHI: - case COMPOSITE_STD_PAL_M: - case COMPOSITE_STD_PAL_N: - case COMPOSITE_STD_PAL_Nc: - case COMPOSITE_STD_PAL_60: - w = 704; - h = 576; - break; - default: - ALOGE("%s::unmathced composite_std(%d)", __func__, compositeStdId); - return false; - } - - t_std_id = composite_std_2_v4l2_std_id(mCompositeStd); - - mHdmiDstWidth = w; - mHdmiDstHeight = h; - - mCurrentHdmiResolutionValue = -1; - return true; -} - -bool SecHdmi::m_setHdmiResolution(unsigned int hdmiResolutionValue) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - if (hdmiResolutionValue == mCurrentHdmiResolutionValue) { -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::same hdmiResolutionValue(%d) \n", __func__, hdmiResolutionValue); -#endif - return true; - } - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s called\n", __func__); -#endif - - int w = 0; - int h = 0; - -#if defined(BOARD_USE_V4L2) - unsigned int preset_id; -#else - v4l2_std_id std_id; -#endif - - if (mHdmiOutputMode >= HDMI_OUTPUT_MODE_YCBCR && - mHdmiOutputMode <= HDMI_OUTPUT_MODE_DVI) { -#if defined(BOARD_USE_V4L2) - if (hdmi_resolution_2_preset_id(hdmiResolutionValue, &w, &h, &preset_id) < 0) { - ALOGE("%s::hdmi_resolution_2_std_id(%d) fail\n", __func__, hdmiResolutionValue); - return false; - } - mHdmiPresetId = preset_id; -#else - if (hdmi_resolution_2_std_id(hdmiResolutionValue, &w, &h, &std_id) < 0) { - ALOGE("%s::hdmi_resolution_2_std_id(%d) fail\n", __func__, hdmiResolutionValue); - return false; - } - mHdmiStdId = std_id; -#endif - } else { - ALOGE("%s:: not supported output type \n", __func__); - return false; - } - -#if defined(BOARD_USE_V4L2) - g_preset_id = preset_id; -#else - t_std_id = std_id; -#endif - - mHdmiDstWidth = w; - mHdmiDstHeight = h; - - mCurrentHdmiResolutionValue = hdmiResolutionValue; - -#ifdef DEBUG_HDMI_HW_LEVEL -#if defined(BOARD_USE_V4L2) - ALOGD("%s:: mHdmiDstWidth = %d, mHdmiDstHeight = %d, mHdmiPresetId = 0x%x, hdmiResolutionValue = 0x%x\n", - __func__, - mHdmiDstWidth, - mHdmiDstHeight, - mHdmiPresetId, - hdmiResolutionValue); -#else - ALOGD("%s:: mHdmiDstWidth = %d, mHdmiDstHeight = %d, mHdmiStdId = 0x%x, hdmiResolutionValue = 0x%x\n", - __func__, - mHdmiDstWidth, - mHdmiDstHeight, - mHdmiStdId, - hdmiResolutionValue); -#endif -#endif - - return true; -} - -bool SecHdmi::m_setHdcpMode(bool hdcpMode) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - if (hdcpMode == mCurrentHdcpMode) { -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::same hdcpMode(%d) \n", __func__, hdcpMode); -#endif - - return true; - } - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s called\n", __func__); -#endif - - if (hdcpMode == true) - g_hdcp_en = 1; - else - g_hdcp_en = 0; - - mCurrentHdcpMode = hdcpMode; - - return true; -} - -bool SecHdmi::m_setAudioMode(int audioMode) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - if (audioMode == mCurrentAudioMode) { -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::same audioMode(%d) \n", __func__, audioMode); -#endif - return true; - } - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s called\n", __func__); -#endif - - if (hdmi_check_audio() < 0) { - ALOGE("%s::hdmi_check_audio() fail \n", __func__); - return false; - } - - mCurrentAudioMode = audioMode; - - return true; -} - -int SecHdmi::m_resolutionValueIndex(unsigned int ResolutionValue) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - - int index = -1; - - for (int i = 0; i < mHdmiSizeOfResolutionValueList; i++) { - if (mHdmiResolutionValueList[i] == ResolutionValue) { - index = i; - break; - } - } - return index; -} - -bool SecHdmi::m_flagHWConnected(void) -{ -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s", __func__); -#endif - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s called\n", __func__); -#endif - - bool ret = true; - int hdmiStatus = hdmi_cable_status(); - - if (hdmiStatus <= 0) { -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::hdmi_cable_status() fail \n", __func__); -#endif - ret = false; - } else { - ret = true; - } - - return ret; -} - -}; // namespace android diff --git a/exynos4/hal/libhdmi/SecHdmi/SecHdmiCommon.h b/exynos4/hal/libhdmi/SecHdmi/SecHdmiCommon.h deleted file mode 100644 index 203dfe4..0000000 --- a/exynos4/hal/libhdmi/SecHdmi/SecHdmiCommon.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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. -** -** @author Sangwoo, Park(sw5771.park@samsung.com) -** @date 2010-09-10 -** -*/ - -//#define LOG_NDEBUG 0 -//#define LOG_TAG "libhdmi" -#include <cutils/log.h> - -#include "videodev2.h" -#if defined(BOARD_USE_V4L2) -#include "s5p_tvout_v4l2.h" -#else -#include "s5p_tvout.h" -#endif - -//#define DEBUG_MSG_ENABLE -//#define DEBUG_HDMI_HW_LEVEL -#define BOARD_USES_EDID -//#define BOARD_USES_CEC -#if defined(SAMSUNG_EXYNOS4x12) -//#define SUPPORT_G2D_UI_MODE -#endif - -#define DEFAULT_FB (0) -#define TVOUT_FB_G0 (10) -#define TVOUT_FB_G1 (11) - -#define MAX_BUFFERS_MIXER (1) -#define MAX_PLANES_MIXER (3) - -#define HDMI_NUM_MIXER_BUF (2) -#define GRALLOC_BUF_SIZE (32768) -#define SIZE_1K (1024) - -#define HDMI_FIMC_OUTPUT_BUF_NUM (4) -#define HDMI_G2D_OUTPUT_BUF_NUM (2) -#define HDMI_FIMC_BUFFER_BPP_SIZE (1.5) //NV12 Tiled is 1.5 bytes, RGB565 is 2, RGB888 is 4, Default is NV12 Tiled -#define HDMI_G2D_BUFFER_BPP_SIZE (4) //NV12 Tiled is 1.5 bytes, RGB565 is 2, RGB888 is 4 -#define HDMI_FB_BPP_SIZE (4) //ARGB888 is 4 -#define SUPPORT_1080P_FIMC_OUT -#define HDMI_MAX_WIDTH (1920) -#define HDMI_MAX_HEIGHT (1080) - -#define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) - -#if defined(STD_NTSC_M) - #define DEFAULT_OUPUT_MODE (COMPOSITE_OUTPUT_MODE) - #define DEFAULT_HDMI_RESOLUTION_VALUE (1080960) // 1080P_60 - #define DEFAULT_HDMI_PRESET_ID (V4L2_DV_1080P60) - #define DEFAULT_HDMI_STD_ID (V4L2_STD_1080P_60) - #define DEFALULT_DISPLAY_WIDTH (720) - #define DEFALULT_DISPLAY_HEIGHT (480) - #define DEFAULT_COMPOSITE_STD (COMPOSITE_STD_NTSC_M) -#elif (STD_1080P) - #define DEFAULT_OUPUT_MODE (HDMI_OUTPUT_MODE_RGB) - #define DEFAULT_HDMI_RESOLUTION_VALUE (1080960) // 1080P_60 - #define DEFAULT_HDMI_PRESET_ID (V4L2_DV_1080P60) - #define DEFAULT_HDMI_STD_ID (V4L2_STD_1080P_60) - #define DEFALULT_DISPLAY_WIDTH (1920) - #define DEFALULT_DISPLAY_HEIGHT (1080) - #define DEFAULT_COMPOSITE_STD (COMPOSITE_STD_NTSC_M) -#elif defined(STD_720P) - #define DEFAULT_OUPUT_MODE (HDMI_OUTPUT_MODE_YCBCR) - #define DEFAULT_HDMI_RESOLUTION_VALUE (720960) // 720P_60 - #define DEFAULT_HDMI_PRESET_ID (V4L2_DV_720P60) - #define DEFAULT_HDMI_STD_ID (V4L2_STD_720P_60) - #define DEFALULT_DISPLAY_WIDTH (1280) - #define DEFALULT_DISPLAY_HEIGHT (720) - #define DEFAULT_COMPOSITE_STD (COMPOSITE_STD_NTSC_M) -#elif defined(STD_480P) - #define DEFAULT_OUPUT_MODE (HDMI_OUTPUT_MODE_YCBCR) - #define DEFAULT_HDMI_RESOLUTION_VALUE (4809601) // 480P_60_4_3 - #define DEFAULT_HDMI_PRESET_ID (V4L2_DV_480P60) - #define DEFAULT_HDMI_STD_ID (V4L2_STD_480P_60_16_9) - #define DEFALULT_DISPLAY_WIDTH (720) - #define DEFALULT_DISPLAY_HEIGHT (480) - #define DEFAULT_COMPOSITE_STD (COMPOSITE_STD_NTSC_M) -#else - #define DEFAULT_OUPUT_MODE (HDMI_OUTPUT_MODE_YCBCR) - #define DEFAULT_HDMI_RESOLUTION_VALUE (4809602) // 480P_60_4_3 - #define DEFAULT_HDMI_PRESET_ID (V4L2_DV_480P60) - #define DEFAULT_HDMI_STD_ID (V4L2_STD_480P_60_4_3) - #define DEFALULT_DISPLAY_WIDTH (720) - #define DEFALULT_DISPLAY_HEIGHT (480) - #define DEFAULT_COMPOSITE_STD (COMPOSITE_STD_NTSC_M) -#endif - -enum hdp_cable_status { - HPD_CABLE_OUT = 0, // HPD_CABLE_OUT indicates HDMI cable out. - HPD_CABLE_IN // HPD_CABLE_IN indicates HDMI cable in. -}; - -enum state { - OFF = 0, - ON = 1, - NOT_SUPPORT = 2, -}; - -enum tv_mode { - HDMI_OUTPUT_MODE_YCBCR = 0, - HDMI_OUTPUT_MODE_RGB = 1, - HDMI_OUTPUT_MODE_DVI = 2, - COMPOSITE_OUTPUT_MODE = 3 -}; - -enum composite_std { - COMPOSITE_STD_NTSC_M = 0, - COMPOSITE_STD_PAL_BDGHI = 1, - COMPOSITE_STD_PAL_M = 2, - COMPOSITE_STD_PAL_N = 3, - COMPOSITE_STD_PAL_Nc = 4, - COMPOSITE_STD_PAL_60 = 5, - COMPOSITE_STD_NTSC_443 = 6 -}; - -enum hdmi_layer { - HDMI_LAYER_BASE = 0, - HDMI_LAYER_VIDEO, - HDMI_LAYER_GRAPHIC_0, - HDMI_LAYER_GRAPHIC_1, - HDMI_LAYER_MAX, -}; diff --git a/exynos4/hal/libhdmi/SecHdmi/SecHdmiV4L2Utils.cpp b/exynos4/hal/libhdmi/SecHdmi/SecHdmiV4L2Utils.cpp deleted file mode 100644 index f3ae1ac..0000000 --- a/exynos4/hal/libhdmi/SecHdmi/SecHdmiV4L2Utils.cpp +++ /dev/null @@ -1,2434 +0,0 @@ -/* - * 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. - */ - -//#define LOG_NDEBUG 0 -//#define LOG_TAG "libhdmi" -#include <cutils/log.h> - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/mman.h> -#include <fcntl.h> -#include <ctype.h> -#include <unistd.h> -#include <string.h> -#include <errno.h> -#include <signal.h> - -#if defined(BOARD_USE_V4L2) -#include "sec_utils_v4l2.h" -#include "s5p_tvout_v4l2.h" -#include "videodev2.h" -#else -#include "sec_utils.h" -#include "s5p_tvout.h" -#endif -#include "SecFimc.h" -#if defined(BOARD_USES_FIMGAPI) -#include "sec_g2d_4x.h" -#include "FimgApi.h" -#endif - -#include "audio.h" -#include "video.h" -#include "../libhdmi/libsForhdmi/libedid/libedid.h" -#include "../libhdmi/libsForhdmi/libcec/libcec.h" - -#include "SecHdmiCommon.h" -#include "SecHdmiV4L2Utils.h" - -namespace android { - -unsigned int output_type = V4L2_OUTPUT_TYPE_DIGITAL; -#if defined(BOARD_USE_V4L2) -unsigned int g_preset_id = V4L2_DV_1080P30; -#endif -v4l2_std_id t_std_id = V4L2_STD_1080P_30; -int g_hpd_state = HPD_CABLE_OUT; -unsigned int g_hdcp_en = 0; - -int fp_tvout = -1; -int fp_tvout_v = -1; -int fp_tvout_g0 = -1; -int fp_tvout_g1 = -1; - -struct vid_overlay_param vo_param; - -#if defined(BOARD_USES_FIMGAPI) -unsigned int g2d_reserved_memory[HDMI_G2D_OUTPUT_BUF_NUM]; -unsigned int g2d_reserved_memory_size = 0; -unsigned int cur_g2d_address = 0; -unsigned int g2d_buf_index = 0; -#endif - -void display_menu(void) -{ - struct HDMIVideoParameter video; - struct HDMIAudioParameter audio; - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - audio.formatCode = LPCM_FORMAT; - audio.outPacket = HDMI_ASP; - audio.channelNum = CH_2; - audio.sampleFreq = SF_44KHZ; - - ALOGI("=============== HDMI Audio =============\n"); - - if (EDIDAudioModeSupport(&audio)) - ALOGI("= 2CH_PCM 44100Hz audio supported =\n"); - - ALOGI("========= HDMI Mode & Color Space =======\n"); - - video.mode = HDMI; - if (EDIDHDMIModeSupport(&video)) { - video.colorSpace = HDMI_CS_YCBCR444; - if (EDIDColorSpaceSupport(&video)) - ALOGI("= 1. HDMI(YCbCr) =\n"); - - video.colorSpace = HDMI_CS_RGB; - if (EDIDColorSpaceSupport(&video)) - ALOGI("= 2. HDMI(RGB) =\n"); - } else { - video.mode = DVI; - if (EDIDHDMIModeSupport(&video)) - ALOGI("= 3. DVI =\n"); - } - - ALOGI("=========== HDMI Rseolution ========\n"); - - /* 480P */ - video.resolution = v720x480p_60Hz; - video.pixelAspectRatio = HDMI_PIXEL_RATIO_16_9; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= 4. 480P_60_16_9 (0x04000000) =\n"); - - video.resolution = v640x480p_60Hz; - video.pixelAspectRatio = HDMI_PIXEL_RATIO_4_3; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= 5. 480P_60_4_3 (0x05000000) =\n"); - - /* 576P */ - video.resolution = v720x576p_50Hz; - video.pixelAspectRatio = HDMI_PIXEL_RATIO_16_9; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= 6. 576P_50_16_9 (0x06000000) =\n"); - - video.pixelAspectRatio = HDMI_PIXEL_RATIO_4_3; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= 7. 576P_50_4_3 (0x07000000) =\n"); - - /* 720P 60 */ - video.resolution = v1280x720p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= 8. 720P_60 (0x08000000) =\n"); - - /* 720P_50 */ - video.resolution = v1280x720p_50Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= 9. 720P_50 (0x09000000) =\n"); - - /* 1080P_60 */ - video.resolution = v1920x1080p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= a. 1080P_60 (0x0a000000) =\n"); - - /* 1080P_50 */ - video.resolution = v1920x1080p_50Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= b. 1080P_50 (0x0b000000) =\n"); - - /* 1080I_60 */ - video.resolution = v1920x1080i_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= c. 1080I_60 (0x0c000000) =\n"); - - /* 1080I_50 */ - video.resolution = v1920x1080i_50Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= d. 1080I_50 (0x0d000000) =\n"); - - /* 1080P_30 */ - video.resolution = v1920x1080p_30Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= e. 1080P_30 (0x12000000) =\n"); - - ALOGI("=========== HDMI 3D Format ========\n"); - - /* 720P_60_SBS_HALF */ - video.resolution = v1280x720p_60Hz; - video.hdmi_3d_format = HDMI_3D_SSH_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= f. 720P_60_SBS_HALF (0x13000000) =\n"); - - /* 720P_59_SBS_HALF */ - video.resolution = v1280x720p_60Hz; - video.hdmi_3d_format = HDMI_3D_SSH_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= 10. 720P_59_SBS_HALF (0x14000000) =\n"); - - /* 720P_50_TB */ - video.resolution = v1280x720p_50Hz; - video.hdmi_3d_format = HDMI_3D_TB_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= 11. 720P_50_TB (0x15000000) =\n"); - - /* 1080P_24_TB */ - video.resolution = v1920x1080p_24Hz; - video.hdmi_3d_format = HDMI_3D_TB_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= 12. 1080P_24_TB (0x16000000) =\n"); - - /* 1080P_23_TB */ - video.resolution = v1920x1080p_24Hz; - video.hdmi_3d_format = HDMI_3D_TB_FORMAT; - if (EDIDVideoResolutionSupport(&video)) - ALOGI("= 13. 1080P_24_TB (0x17000000) =\n"); - ALOGI("=========================================\n"); -} - -int tvout_open(const char *fp_name) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int fp; - - fp = open(fp_name, O_RDWR); - if (fp < 0) - ALOGE("drv (%s) open failed!!\n", fp_name); - - return fp; -} -#if defined(BOARD_USE_V4L2) -int tvout_std_v4l2_init(int fd, unsigned int preset_id) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s:: preset_id = 0x%x", __func__, preset_id); -#endif - - int ret; - struct v4l2_output output; - struct v4l2_dv_preset preset; - - unsigned int matched = 0, i = 0; - int output_index; - -/* - if (output_type >= V4L2_OUTPUT_TYPE_DIGITAL && - output_type <= V4L2_OUTPUT_TYPE_DVI) - if (ioctl(fd_tvout, VIDIOC_HDCP_ENABLE, g_hdcp_en) < 0) - ALOGE("%s::VIDIOC_HDCP_ENABLE failed %d", __func__, errno); -*/ - - i = 0; - - do { - output.index = i; - ret = tvout_std_v4l2_enum_output(fd, &output); - ALOGD("tvout_v4l2_enum_output():: output_type=%d output.index=%d output.name=%s", output.type, output.index, output.name); - if (output.type == output_type) { - matched = 1; - break; - } - i++; - } while (ret >=0); - - if (!matched) { - ALOGE("%s::no matched output type [type=%d]", __func__, output_type); -// return -1; - } - - // set output -// tvout_std_v4l2_s_output(fp_tvout, output.index); -// output_index = 0; -// tvout_std_v4l2_g_output(fp_tvout, &output_index); - -// if (output.capabilities & V4L2_OUT_CAP_PRESETS) { - tvout_std_v4l2_enum_dv_presets(fd); - preset.preset = preset_id; - if (tvout_std_v4l2_s_dv_preset(fd, &preset) < 0 ) { - ALOGE("%s::tvout_std_v4l2_s_dv_preset failed", __func__); - return -1; - } -// } - - return 0; -} - -int tvout_std_v4l2_querycap(int fd, char *node) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_capability v4l2cap; - - if (ioctl(fd, VIDIOC_QUERYCAP, &v4l2cap) < 0) { - ALOGE("%s::VIDIOC_QUERYCAP failed", __func__); - return -1; - } - - if (!(v4l2cap.capabilities & V4L2_CAP_STREAMING)) { - ALOGE("%s::%s is not support streaming", __func__, node); - return -1; - } - - if (!(v4l2cap.capabilities & V4L2_CAP_VIDEO_OUTPUT_MPLANE)) { - ALOGE("%s::%s is not support video output mplane", __func__, node); - return -1; - } - - return 0; -} - -int tvout_std_v4l2_enum_dv_presets(int fd) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_dv_enum_preset enum_preset; - int ret = -1; - - for (int index = 0; ; index++) { - enum_preset.index = index; - ret = ioctl(fd, VIDIOC_ENUM_DV_PRESETS, &enum_preset); - - if (ret < 0) { - if (errno == EINVAL) - break; - ALOGE("%s::VIDIOC_ENUM_DV_PRESETS", __func__); - return -1; - } -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s::index=%d, preset=0x%08x, name=%s, w=%d, h=%d", - __func__, enum_preset.index, enum_preset.preset, enum_preset.name, enum_preset.width, enum_preset.height); -#endif - } - - return 0; -} - -int tvout_std_v4l2_s_dv_preset(int fd, struct v4l2_dv_preset *preset) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - if (ioctl(fd, VIDIOC_S_DV_PRESET, preset) < 0) { - ALOGE("%s::VIDIOC_S_DV_PRESET failed", __func__); - return -1; - } - - return 0; -} - -/* - ioctl VIDIOC_ENUMOUTPUT - To query the attributes of a video outputs applications initialize the index field of struct v4l2_output - and call the VIDIOC_ENUMOUTPUT ioctl with a pointer to this structure. Drivers fill the rest of the - structure or return an EINVAL error code when the index is out of bounds - */ -int tvout_std_v4l2_enum_output(int fd, struct v4l2_output *output) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret; - - ret = ioctl(fd, VIDIOC_ENUMOUTPUT, output); - - if (ret >=0) - ALOGV("tvout_v4l2_enum_output" "enum. output [index = %d] :: type : 0x%08x , name = %s\n", - output->index,output->type,output->name); - - return ret; -} - -/* - ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT - To query the current video output applications call the VIDIOC_G_OUTPUT ioctl with a pointer to an - integer where the driver stores the number of the output, as in the struct v4l2_output index field. - This ioctl will fail only when there are no video outputs, returning the EINVAL error code - */ -int tvout_std_v4l2_s_output(int fd, int index) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s:: index = 0x%x", __func__, index); -#endif - - int ret; - - ret = ioctl(fd, VIDIOC_S_OUTPUT, &index); - if (ret < 0) { - ALOGE("tvout_v4l2_s_output" "VIDIOC_S_OUTPUT failed %d\n", errno); - return ret; - } - - return ret; -} - -int tvout_std_v4l2_g_output(int fd, int *index) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret; - - ret = ioctl(fd, VIDIOC_G_OUTPUT, index); - if (ret < 0) { - ALOGE("tvout_v4l2_g_output" "VIDIOC_G_OUTPUT failed %d\n", errno); - return ret; - } else { - ALOGV("tvout_v4l2_g_output" "Current output index %d\n", *index); - } - - return ret; -} - -int tvout_std_v4l2_s_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, int w, int h, int colorformat, int num_planes) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_format fmt; - - fmt.type = type; -// if (ioctl(fd, VIDIOC_G_FMT, &fmt) < 0) { -// ALOGE("%s::VIDIOC_G_FMT failed", __func__); -// return -1; -// } - - switch (fmt.type) { - case V4L2_BUF_TYPE_VIDEO_OUTPUT: - case V4L2_BUF_TYPE_VIDEO_CAPTURE: - fmt.fmt.pix.width = w; - fmt.fmt.pix.height = h; - fmt.fmt.pix.pixelformat = colorformat; - fmt.fmt.pix.field = field; - break; - case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: - case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: - fmt.fmt.pix_mp.width = w; - fmt.fmt.pix_mp.height = h; - fmt.fmt.pix_mp.pixelformat = colorformat; - fmt.fmt.pix_mp.field = field; - fmt.fmt.pix_mp.num_planes = num_planes; - break; - default: - ALOGE("%s::invalid buffer type", __func__); - return -1; - break; - } - - if (ioctl(fd, VIDIOC_S_FMT, &fmt) < 0) { - ALOGE("%s::VIDIOC_S_FMT failed", __func__); - return -1; - } - - return 0; -} - -int tvout_std_v4l2_s_crop(int fd, enum v4l2_buf_type type, enum v4l2_field, int x, int y, int w, int h) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_crop crop; - - crop.type = type; - crop.c.left = x; - crop.c.top = y; - crop.c.width = w; - crop.c.height = h; - - if (ioctl(fd, VIDIOC_S_CROP, &crop) < 0) { - ALOGE("%s::VIDIOC_S_CROP (x=%d, y=%d, w=%d, h=%d) failed", - __func__, x, y, w, h); - return -1; - } - - return 0; -} - -int tvout_std_v4l2_s_ctrl(int fd, int id, int value) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_control vc; - - vc.id = id; - vc.value = value; - - if (ioctl(fd, VIDIOC_S_CTRL, &vc) < 0) { - ALOGE("%s::VIDIOC_S_CTRL (id=%d,value=%d) failed", __func__, id, value); - return -1; - } - - return 0; -} - -int tvout_std_v4l2_reqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int num_bufs) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_requestbuffers reqbuf; - - reqbuf.type = type; - reqbuf.memory = memory; - reqbuf.count = num_bufs; - - if (ioctl(fd, VIDIOC_REQBUFS, &reqbuf) < 0) { - ALOGE("%s::VIDIOC_REQBUFS failed", __func__); - return -1; - } - - if (reqbuf.count < num_bufs) { - ALOGE("%s::VIDIOC_REQBUFS failed ((reqbuf.count(%d) < num_bufs(%d))", - __func__, reqbuf.count, num_bufs); - return -1; - } - - return 0; -} - -int tvout_std_v4l2_querybuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int buf_index, unsigned int num_planes, SecBuffer *secBuf) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_buffer buf; - struct v4l2_plane planes[MAX_PLANES_MIXER]; - - memset(&buf, 0, sizeof(struct v4l2_buffer)); - - for (int i = 0; i < MAX_PLANES_MIXER; i++) - memset(&planes[i], 0, sizeof(struct v4l2_plane)); - - if (MAX_BUFFERS_MIXER <= buf_index || MAX_PLANES_MIXER <= num_planes) { - ALOGE("%s::exceed MAX! : buf_index=%d, num_plane=%d", __func__, buf_index, num_planes); - return -1; - } - - buf.type = type; - buf.memory = V4L2_MEMORY_MMAP; - buf.index = buf_index; - buf.length = num_planes; - buf.m.planes = planes; - - if (ioctl(fd, VIDIOC_QUERYBUF, &buf) < 0) { - ALOGE("%s::VIDIOC_QUERYBUF failed, plane_cnt=%d", __func__, buf.length); - return -1; - } - - for (unsigned int i = 0; i < num_planes; i++) { - if ((secBuf->virt.extP[i] = (char *)mmap(0, buf.m.planes[i].length, - PROT_READ | PROT_WRITE, MAP_SHARED, fd, buf.m.planes[i].m.mem_offset)) < 0) { - ALOGE("%s::mmap failed", __func__); - ALOGE("%s::Offset = 0x%x", __func__, buf.m.planes[i].m.mem_offset); - ALOGE("%s::Legnth = %d" , __func__, buf.m.planes[i].length); - ALOGE("%s::vaddr[%d][%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]); - return -1; - } - secBuf->size.extS[i] = buf.m.planes[i].length; - -#ifdef DEBUG_LIB_FIMC - ALOGD("%s::vaddr[bufidx=%d][planeidx=%d] = 0x%x", __func__, buf_index, i, (unsigned int)secBuf->virt.extP[i]); - ALOGD("%s::Legnth = %d" , __func__, buf.m.planes[i].length); -#endif - } - - return 0; -} - -int tvout_std_v4l2_qbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, int buf_index, int num_planes, SecBuffer *secBuf) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_buffer buf; - struct v4l2_plane planes[MAX_PLANES_MIXER]; - - memset(&buf, 0, sizeof(struct v4l2_buffer)); - - for (int i = 0; i < MAX_PLANES_MIXER; i++) - memset(&planes[i], 0, sizeof(struct v4l2_plane)); - - buf.type = type; - buf.memory = memory; - buf.length = num_planes; - buf.index = buf_index; - buf.m.planes = planes; - - for (unsigned int i = 0; i < buf.length; i++) { - buf.m.planes[i].m.userptr = (unsigned long)secBuf->virt.extP[i]; - buf.m.planes[i].length = secBuf->size.extS[i]; - } - - if (ioctl(fd, VIDIOC_QBUF, &buf) < 0) { - ALOGE("%s::VIDIOC_QBUF failed", __func__); - return -1; - } - - return 0; -} - -int tvout_std_v4l2_dqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, int *buf_index, int num_planes) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_buffer buf; - struct v4l2_plane planes[MAX_PLANES_MIXER]; - - memset(&buf, 0, sizeof(struct v4l2_buffer)); - - for (int i = 0; i < MAX_PLANES_MIXER; i++) - memset(&planes[i], 0, sizeof(struct v4l2_plane)); - - buf.type = type; - buf.memory = memory; - buf.length = num_planes; - buf.m.planes = planes; - - if (ioctl(fd, VIDIOC_DQBUF, &buf) < 0) { - ALOGE("%s::VIDIOC_DQBUF failed", __func__); - return -1; - } - *buf_index = buf.index; - - return 0; -} - -int tvout_std_v4l2_streamon(int fd, enum v4l2_buf_type type) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - if (ioctl(fd, VIDIOC_STREAMON, &type) < 0) { - ALOGE("%s::VIDIOC_STREAMON failed", __func__); - return -1; - } - - return 0; -} - -int tvout_std_v4l2_streamoff(int fd, enum v4l2_buf_type type) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - if (ioctl(fd, VIDIOC_STREAMOFF, &type) < 0) { - ALOGE("%s::VIDIOC_STREAMOFF failed", __func__); - return -1; - } - - return 0; -} -#else -int tvout_init(v4l2_std_id std_id) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s:: std_id = 0x%x", __func__, std_id); -#endif - - int ret; - struct v4l2_output output; - struct v4l2_standard std; - v4l2_std_id std_g_id; - struct tvout_param tv_g_param; - - unsigned int matched = 0, i = 0; - int output_index; - - // It was initialized already - if (fp_tvout <= 0) { - fp_tvout = tvout_open(TVOUT_DEV); - if (fp_tvout < 0) { - ALOGE("tvout video drv open failed\n"); - return -1; - } - } - - if (output_type >= V4L2_OUTPUT_TYPE_DIGITAL && - output_type <= V4L2_OUTPUT_TYPE_DVI) - if (ioctl(fp_tvout, VIDIOC_HDCP_ENABLE, g_hdcp_en) < 0) - ALOGE("tvout_init" "VIDIOC_HDCP_ENABLE failed %d\n", errno); - - /* ============== query capability============== */ - tvout_v4l2_querycap(fp_tvout); - - tvout_v4l2_enum_std(fp_tvout, &std, std_id); - - // set std - tvout_v4l2_s_std(fp_tvout, std_id); - tvout_v4l2_g_std(fp_tvout, &std_g_id); - - i = 0; - - do { - output.index = i; - ret = tvout_v4l2_enum_output(fp_tvout, &output); - if (output.type == output_type) { - matched = 1; - break; - } - i++; - } while (ret >=0); - - if (!matched) { - ALOGE("no matched output type [type : 0x%08x]\n", output_type); - return -1; - } - - // set output - tvout_v4l2_s_output(fp_tvout, output.index); - output_index = 0; - tvout_v4l2_g_output(fp_tvout, &output_index); - - //set fmt param - vo_param.src.base_y = (void *)0x0; - vo_param.src.base_c = (void *)0x0; - vo_param.src.pix_fmt.width = 0; - vo_param.src.pix_fmt.height = 0; - vo_param.src.pix_fmt.field = V4L2_FIELD_NONE; - vo_param.src.pix_fmt.pixelformat = V4L2_PIX_FMT_NV12T; - - vo_param.src_crop.left = 0; - vo_param.src_crop.top = 0; - vo_param.src_crop.width = 0; - vo_param.src_crop.height = 0; - - return fp_tvout; -} - -int tvout_deinit() -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - if (0 < fp_tvout) { - close(fp_tvout); - fp_tvout = -1; - } - return 0; -} - -int tvout_v4l2_querycap(int fp) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s:: fp = 0x%x", __func__, fp); -#endif - - struct v4l2_capability cap; - int ret; - - ret = ioctl(fp, VIDIOC_QUERYCAP, &cap); - - if (ret < 0) { - ALOGE("tvout_v4l2_querycap" "VIDIOC_QUERYCAP failed %d\n", errno); - return ret; - } - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("tvout_v4l2_querycap" "DRIVER : %s, CARD : %s, CAP.: 0x%08x\n", - cap.driver, cap.card, cap.capabilities); -#endif - - return ret; -} - -/* - ioctl VIDIOC_G_STD, VIDIOC_S_STD - To query and select the current video standard applications use the VIDIOC_G_STD and - VIDIOC_S_STD ioctls which take a pointer to a v4l2_std_id type as argument. VIDIOC_G_STD can - return a single flag or a set of flags as in struct v4l2_standard field id - */ - -int tvout_v4l2_g_std(int fp, v4l2_std_id *std_id) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret; - - ret = ioctl(fp, VIDIOC_G_STD, std_id); - if (ret < 0) { - ALOGE("tvout_v4l2_g_std" "VIDIOC_G_STD failed %d\n", errno); - return ret; - } - - return ret; -} - -int tvout_v4l2_s_std(int fp, v4l2_std_id std_id) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s:: std_id = 0x%x", __func__, std_id); -#endif - - int ret; - - ret = ioctl(fp, VIDIOC_S_STD, &std_id); - if (ret < 0) { - ALOGE("tvout_v4l2_s_std" "VIDIOC_S_STD failed %d\n", errno); - return ret; - } - - return ret; -} - -/* - ioctl VIDIOC_ENUMSTD - To query the attributes of a video standard, especially a custom (driver defined) one, applications - initialize the index field of struct v4l2_standard and call the VIDIOC_ENUMSTD ioctl with a pointer - to this structure. Drivers fill the rest of the structure or return an EINVAL error code when the index - is out of bounds. - */ -int tvout_v4l2_enum_std(int fp, struct v4l2_standard *std, v4l2_std_id std_id) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - std->index = 0; - while (0 == ioctl (fp, VIDIOC_ENUMSTD, std)) { - if (std->id & std_id) - ALOGV("tvout_v4l2_enum_std" "Current video standard: %s\n", std->name); - - std->index++; - } - - return 0; -} - -/* - ioctl VIDIOC_ENUMOUTPUT - To query the attributes of a video outputs applications initialize the index field of struct v4l2_output - and call the VIDIOC_ENUMOUTPUT ioctl with a pointer to this structure. Drivers fill the rest of the - structure or return an EINVAL error code when the index is out of bounds - */ -int tvout_v4l2_enum_output(int fp, struct v4l2_output *output) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret; - - ret = ioctl(fp, VIDIOC_ENUMOUTPUT, output); - - if (ret >=0) - ALOGV("tvout_v4l2_enum_output" "enum. output [index = %d] :: type : 0x%08x , name = %s\n", - output->index,output->type,output->name); - - return ret; -} - -/* - ioctl VIDIOC_G_OUTPUT, VIDIOC_S_OUTPUT - To query the current video output applications call the VIDIOC_G_OUTPUT ioctl with a pointer to an - integer where the driver stores the number of the output, as in the struct v4l2_output index field. - This ioctl will fail only when there are no video outputs, returning the EINVAL error code - */ -int tvout_v4l2_s_output(int fp, int index) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s:: index = 0x%x", __func__, index); -#endif - - int ret; - - ret = ioctl(fp, VIDIOC_S_OUTPUT, &index); - if (ret < 0) { - ALOGE("tvout_v4l2_s_output" "VIDIOC_S_OUTPUT failed %d\n", errno); - return ret; - } - - return ret; -} - -int tvout_v4l2_g_output(int fp, int *index) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret; - - ret = ioctl(fp, VIDIOC_G_OUTPUT, index); - if (ret < 0) { - ALOGE("tvout_v4l2_g_output" "VIDIOC_G_OUTPUT failed %d\n", errno); - return ret; - } else { - ALOGV("tvout_v4l2_g_output" "Current output index %d\n", *index); - } - - return ret; -} - -/* - ioctl VIDIOC_ENUM_FMT - To enumerate image formats applications initialize the type and index field of struct v4l2_fmtdesc - and call the VIDIOC_ENUM_FMT ioctl with a pointer to this structure. Drivers fill the rest of the - structure or return an EINVAL error code. All formats are enumerable by beginning at index zero - and incrementing by one until EINVAL is returned. - */ -int tvout_v4l2_enum_fmt(int fp, struct v4l2_fmtdesc *desc) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - desc->index = 0; - while (0 == ioctl(fp, VIDIOC_ENUM_FMT, desc)) { - ALOGV("tvout_v4l2_enum_fmt" "enum. fmt [id : 0x%08x] :: type = 0x%08x, name = %s, pxlfmt = 0x%08x\n", - desc->index, - desc->type, - desc->description, - desc->pixelformat); - desc->index++; - } - - return 0; -} - -int tvout_v4l2_g_fmt(int fp, int buf_type, void* ptr) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret; - struct v4l2_format format; - struct v4l2_pix_format_s5p_tvout *fmt_param = (struct v4l2_pix_format_s5p_tvout*)ptr; - - format.type = (enum v4l2_buf_type)buf_type; - - ret = ioctl(fp, VIDIOC_G_FMT, &format); - if (ret < 0) { - ALOGE("tvout_v4l2_g_fmt" "type : %d, VIDIOC_G_FMT failed %d\n", buf_type, errno); - return ret; - } else { - memcpy(fmt_param, format.fmt.raw_data, sizeof(struct v4l2_pix_format_s5p_tvout)); - ALOGV("tvout_v4l2_g_fmt" "get. fmt [base_c : 0x%08x], [base_y : 0x%08x] type = 0x%08x, width = %d, height = %d\n", - fmt_param->base_c, - fmt_param->base_y, - fmt_param->pix_fmt.pixelformat, - fmt_param->pix_fmt.width, - fmt_param->pix_fmt.height); - } - - return 0; -} - -int tvout_v4l2_s_fmt(int fp, int buf_type, void *ptr) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_format format; - int ret; - - format.type = (enum v4l2_buf_type)buf_type; - switch (buf_type) { - case V4L2_BUF_TYPE_VIDEO_OVERLAY: - format.fmt.win = *((struct v4l2_window *) ptr); - break; - - case V4L2_BUF_TYPE_PRIVATE: { - struct v4l2_vid_overlay_src *fmt_param = - (struct v4l2_vid_overlay_src *) ptr; - - memcpy(format.fmt.raw_data, fmt_param, - sizeof(struct v4l2_vid_overlay_src)); - break; - } - case V4L2_BUF_TYPE_VIDEO_OUTPUT: { - struct v4l2_pix_format_s5p_tvout *fmt_param = - (struct v4l2_pix_format_s5p_tvout *)ptr; - memcpy(format.fmt.raw_data, fmt_param, - sizeof(struct v4l2_pix_format_s5p_tvout)); - break; - } - default: - break; - } - - ret = ioctl(fp, VIDIOC_S_FMT, &format); - if (ret < 0) { - ALOGE("tvout_v4l2_s_fmt [tvout_v4l2_s_fmt] : type : %d, VIDIOC_S_FMT failed %d\n", - buf_type, errno); - return ret; - } - return 0; - -} - -int tvout_v4l2_g_fbuf(int fp, struct v4l2_framebuffer *frame) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret; - - ret = ioctl(fp, VIDIOC_G_FBUF, frame); - if (ret < 0) { - ALOGE("tvout_v4l2_g_fbuf" "VIDIOC_STREAMON failed %d\n", errno); - return ret; - } - - ALOGV("tvout_v4l2_g_fbuf" "get. fbuf: base = 0x%08X, pixel format = %d\n", - frame->base, - frame->fmt.pixelformat); - return 0; -} - -int tvout_v4l2_s_fbuf(int fp, struct v4l2_framebuffer *frame) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret; - - ret = ioctl(fp, VIDIOC_S_FBUF, frame); - if (ret < 0) { - ALOGE("tvout_v4l2_s_fbuf" "VIDIOC_STREAMON failed %d\n", errno); - return ret; - } - return 0; -} - -int tvout_v4l2_s_baseaddr(int fp, void *base_addr) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret; - - ret = ioctl(fp, S5PTVFB_WIN_SET_ADDR, base_addr); - if (ret < 0) { - ALOGE("tvout_v4l2_baseaddr" "VIDIOC_S_BASEADDR failed %d\n", errno); - return ret; - } - return 0; -} - -int tvout_v4l2_g_crop(int fp, unsigned int type, struct v4l2_rect *rect) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret; - struct v4l2_crop crop; - crop.type = (enum v4l2_buf_type)type; - ret = ioctl(fp, VIDIOC_G_CROP, &crop); - if (ret < 0) { - ALOGE("tvout_v4l2_g_crop" "VIDIOC_G_CROP failed %d\n", errno); - return ret; - } - - rect->left = crop.c.left; - rect->top = crop.c.top; - rect->width = crop.c.width; - rect->height = crop.c.height; - - ALOGV("tvout_v4l2_g_crop" "get. crop : left = %d, top = %d, width = %d, height = %d\n", - rect->left, - rect->top, - rect->width, - rect->height); - return 0; -} - -int tvout_v4l2_s_crop(int fp, unsigned int type, struct v4l2_rect *rect) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_crop crop; - int ret; - - crop.type = (enum v4l2_buf_type)type; - - crop.c.left = rect->left; - crop.c.top = rect->top; - crop.c.width = rect->width; - crop.c.height = rect->height; - - ret = ioctl(fp, VIDIOC_S_CROP, &crop); - if (ret < 0) { - ALOGE("tvout_v4l2_s_crop" "VIDIOC_S_CROP failed %d\n", errno); - return ret; - } - - return 0; -} - -int tvout_v4l2_start_overlay(int fp) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret, start = 1; - - ret = ioctl(fp, VIDIOC_OVERLAY, &start); - if (ret < 0) { - ALOGE("tvout_v4l2_start_overlay" "VIDIOC_OVERLAY failed\n"); - return ret; - } - - return ret; -} - -int tvout_v4l2_stop_overlay(int fp) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int ret, stop =0; - - ret = ioctl(fp, VIDIOC_OVERLAY, &stop); - if (ret < 0) { - ALOGE("tvout_v4l2_stop_overlay" "VIDIOC_OVERLAY failed\n"); - return ret; - } - - return ret; -} -#endif - -int hdmi_init_layer(int layer) -{ - int fd = -1; -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s (layer = %d) called", __func__, layer); -#endif - - switch (layer) { - case HDMI_LAYER_VIDEO : - if (fp_tvout_v <= 0) { - fp_tvout_v = tvout_open(TVOUT_DEV_V); - if (fp_tvout_v < 0) { - ALOGE("tvout video layer open failed\n"); - return -1; - } - fd = fp_tvout_v; - } - break; - case HDMI_LAYER_GRAPHIC_0 : - if (fp_tvout_g0 <= 0) { -#if defined(BOARD_USE_V4L2) - fp_tvout_g0 = tvout_open(TVOUT_DEV_G0); -#else - fp_tvout_g0 = fb_open(TVOUT_FB_G0); -#endif - if (fp_tvout_g0 < 0) { - ALOGE("tvout graphic layer 0 open failed\n"); - return -1; - } - fd = fp_tvout_g0; - } - break; - case HDMI_LAYER_GRAPHIC_1 : - if (fp_tvout_g1 <= 0) { -#if defined(BOARD_USE_V4L2) - fp_tvout_g1 = tvout_open(TVOUT_DEV_G1); -#else - fp_tvout_g1 = fb_open(TVOUT_FB_G1); -#endif - if (fp_tvout_g1 < 0) { - ALOGE("tvout graphic layer 1 open failed\n"); - return -1; - } - fd = fp_tvout_g1; - } - break; - default : - ALOGE("%s::unmathced layer(%d) fail", __func__, layer); - fd = -1; - break; - } - - return fd; -} - -int hdmi_deinit_layer(int layer) -{ - int ret = 0; -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("### %s(layer = %d) called", __func__, layer); -#endif - switch (layer) { - case HDMI_LAYER_VIDEO : - if (0 < fp_tvout_v) { - close(fp_tvout_v); - fp_tvout_v = -1; - } - break; - case HDMI_LAYER_GRAPHIC_0 : - if (0 < fp_tvout_g0) { - close(fp_tvout_g0); - fp_tvout_g0 = -1; - } - break; - case HDMI_LAYER_GRAPHIC_1 : - if (0 < fp_tvout_g1) { - close(fp_tvout_g1); - fp_tvout_g1 = -1; - } - break; - default : - ALOGE("%s::unmathced layer(%d) fail", __func__, layer); - ret = -1; - break; - } - - return ret; -} - -#define ROUND_UP(value, boundary) ((((uint32_t)(value)) + \ - (((uint32_t) boundary)-1)) & \ - (~(((uint32_t) boundary)-1))) - -void hdmi_cal_rect(int src_w, int src_h, int dst_w, int dst_h, struct v4l2_rect *dst_rect) -{ - if (dst_w * src_h <= dst_h * src_w) { - dst_rect->left = 0; - dst_rect->top = (dst_h - ((dst_w * src_h) / src_w)) >> 1; - dst_rect->width = dst_w; - dst_rect->height = ((dst_w * src_h) / src_w); - } else { - dst_rect->left = (dst_w - ((dst_h * src_w) / src_h)) >> 1; - dst_rect->top = 0; - dst_rect->width = ((dst_h * src_w) / src_h); - dst_rect->height = dst_h; - } -} - -#if defined(BOARD_USE_V4L2) -int hdmi_get_src_plane(int srcColorFormat, unsigned int *num_of_plane) -{ - int v4l2ColorFormat = HAL_PIXEL_FORMAT_2_V4L2_PIX(srcColorFormat); - - switch (v4l2ColorFormat) { - case V4L2_PIX_FMT_NV12: - case V4L2_PIX_FMT_NV21: - case V4L2_PIX_FMT_BGR32: - case V4L2_PIX_FMT_RGB32: - case V4L2_PIX_FMT_RGB565X: - *num_of_plane = 1; - break; - case V4L2_PIX_FMT_NV12M: - case V4L2_PIX_FMT_NV12MT: - case V4L2_PIX_FMT_NV21M: - *num_of_plane = 2; - break; - default: - ALOGE("%s::invalid color type", __func__); - return -1; - } - - return 0; -} -#endif - -#if defined(BOARD_USE_V4L2) -int hdmi_set_v_param(int fd, int layer, - int srcColorFormat, - int src_w, int src_h, - SecBuffer * dstBuffer, - int dst_x, int dst_y, int dst_w, int dst_h) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int v4l2ColorFormat = HAL_PIXEL_FORMAT_2_V4L2_PIX(srcColorFormat); - int round_up_src_w; - int round_up_src_h; - unsigned int num_of_plane; - struct v4l2_rect rect; - - /* src_w, src_h round up to DWORD because of VP restriction */ -#if defined(SAMSUNG_EXYNOS4x12) - round_up_src_w = ROUND_UP(src_w, 16); -#else defined(SAMSUNG_EXYNOS4210) - round_up_src_w = ROUND_UP(src_w, 8); -#endif - round_up_src_h = ROUND_UP(src_h, 8); - - switch (v4l2ColorFormat) { - case V4L2_PIX_FMT_NV12: - case V4L2_PIX_FMT_NV21: - dstBuffer->size.s = (round_up_src_w * round_up_src_h * 3) >> 1; - num_of_plane = 1; - break; - case V4L2_PIX_FMT_NV12M: - case V4L2_PIX_FMT_NV12MT: - case V4L2_PIX_FMT_NV21M: - dstBuffer->size.extS[0] = (round_up_src_w * round_up_src_h * 3) >> 1; - dstBuffer->size.extS[1] = (round_up_src_w * round_up_src_h * 3) >> 2; - num_of_plane = 2; - break; - default: - ALOGE("%s::invalid color type", __func__); - return false; - break; - } - - hdmi_cal_rect(src_w, src_h, dst_w, dst_h, &rect); - rect.left = ALIGN(rect.left, 16); - - /* set format for VP input */ - if (tvout_std_v4l2_s_fmt(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_FIELD_ANY, round_up_src_w, round_up_src_h, v4l2ColorFormat, num_of_plane) < 0) { - ALOGE("%s::tvout_std_v4l2_s_fmt()[video layer] failed", __func__); - return -1; - } - - /* set crop for VP input */ - if (tvout_std_v4l2_s_crop(fd, V4L2_BUF_TYPE_VIDEO_OVERLAY, V4L2_FIELD_ANY, 0, 0, src_w, src_h) < 0) { - ALOGE("%s::tvout_std_v4l2_s_crop()[video layer] failed", __func__); - return -1; - } - - /* set crop for VP output */ - if (tvout_std_v4l2_s_crop(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_FIELD_ANY, rect.left, rect.top, rect.width, rect.height) < 0) { - ALOGE("%s::tvout_std_v4l2_s_crop()[video layer] failed", __func__); - return -1; - } - - /* request buffer for VP input */ - if (tvout_std_v4l2_reqbuf(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_USERPTR, HDMI_NUM_MIXER_BUF) < 0) { - ALOGE("%s::tvout_std_v4l2_reqbuf(buf_num=%d)[video layer] failed", __func__, HDMI_NUM_MIXER_BUF); - return -1; - } - - return 0; -} - -int hdmi_set_g_param(int fd, int layer, - int srcColorFormat, - int src_w, int src_h, - SecBuffer * dstBuffer, - int dst_x, int dst_y, int dst_w, int dst_h) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - struct v4l2_rect rect; - int v4l2ColorFormat = HAL_PIXEL_FORMAT_2_V4L2_PIX(srcColorFormat); - - rect.left = dst_x; - rect.top = dst_y; - -#if defined(BOARD_USES_FIMGAPI) - rect.width = dst_w; - rect.height = dst_h; -#else - rect.width = src_w; - rect.height = src_h; -#endif - - switch (v4l2ColorFormat) { - case V4L2_PIX_FMT_BGR32: - case V4L2_PIX_FMT_RGB32: - dstBuffer->size.s = rect.width * rect.height << 2; - break; - case V4L2_PIX_FMT_RGB565X: - dstBuffer->size.s = rect.width * rect.height << 1; - break; - default: - ALOGE("%s::invalid color type", __func__); - return false; - break; - } - - /* set format for mixer graphic layer input device*/ - if (tvout_std_v4l2_s_fmt(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_FIELD_ANY, rect.width, rect.height, v4l2ColorFormat, 1) < 0) { - ALOGE("%s::tvout_std_v4l2_s_fmt() [layer=%d] failed", __func__, layer); - return -1; - } - - /* set crop for mixer graphic layer input device*/ - if (tvout_std_v4l2_s_crop(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_FIELD_ANY, rect.left, rect.top, rect.width, rect.height) < 0) { - ALOGE("%s::tvout_std_v4l2_s_crop() [layer=%d] failed", __func__, layer); - return -1; - } - - /* request buffer for mixer graphic layer input device */ - if (tvout_std_v4l2_reqbuf(fd, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, V4L2_MEMORY_USERPTR, HDMI_NUM_MIXER_BUF) < 0) { - ALOGE("%s::tvout_std_v4l2_reqbuf(buf_num=%d) [layer=%d] failed", __func__, HDMI_NUM_MIXER_BUF, layer); - return -1; - } - - /* enable alpha blending for mixer graphic layer */ - if (tvout_std_v4l2_s_ctrl(fd, V4L2_CID_TV_LAYER_BLEND_ENABLE, 1) < 0) { - ALOGE("%s::tvout_std_v4l2_s_ctrl() [layer=%d] failed", __func__, layer); - return -1; - } - - /* enable per-pixel blending for mixer graphic layer */ - if (tvout_std_v4l2_s_ctrl(fd, V4L2_CID_TV_PIXEL_BLEND_ENABLE, 1) < 0) { - ALOGE("%s::tvout_std_v4l2_s_ctrl [layer=%d] failed", __func__, layer); - return false; - } - - /* set global alpha value for mixer graphic layer */ - if (tvout_std_v4l2_s_ctrl(fd, V4L2_CID_TV_LAYER_BLEND_ALPHA, 255) < 0) { - ALOGE("%s::tvout_std_v4l2_s_ctrl() [layer=%d] failed", __func__, layer); - return -1; - } - - return 0; -} - -int hdmi_set_g_scaling(int layer, - int srcColorFormat, - int src_w, int src_h, - unsigned int src_address, SecBuffer * dstBuffer, - int dst_x, int dst_y, int dst_w, int dst_h, - int rotVal, unsigned int hwc_layer) -{ -#if defined(BOARD_USES_FIMGAPI) - int dst_color_format; - int dst_bpp; - unsigned char *dst_addr; - fimg2d_blit BlitParam; - rotation g2d_rotation; - - fimg2d_addr srcAddr; - fimg2d_image srcImage; - fimg2d_rect srcRect; - - fimg2d_addr dstAddr; - fimg2d_image dstImage; - fimg2d_rect dstRect; - - fimg2d_clip dstClip; - fimg2d_scale Scaling; - - switch (g_preset_id) { - case V4L2_DV_1080P60: - case V4L2_DV_1080P30: - case V4L2_DV_1080I60: - case V4L2_DV_720P60_SB_HALF: - case V4L2_DV_720P59_94_SB_HALF: - case V4L2_DV_1080P24_TB: - case V4L2_DV_1080P23_98_TB: - dst_color_format = CF_ARGB_8888; - dst_bpp = 4; - break; - case V4L2_DV_480P60: - case V4L2_DV_576P50: - case V4L2_DV_720P60: - case V4L2_DV_720P50_TB: - default: - dst_color_format = CF_ARGB_4444; - dst_bpp = 2; - break; - } - - static unsigned int prev_src_addr = 0; - - if ((cur_g2d_address == 0) || (src_address != prev_src_addr)) { - dst_addr = (unsigned char *)g2d_reserved_memory[g2d_buf_index]; - - g2d_buf_index++; - if (g2d_buf_index >= HDMI_G2D_OUTPUT_BUF_NUM) - g2d_buf_index = 0; - - cur_g2d_address = (unsigned int)dst_addr; - prev_src_addr = src_address; - - srcAddr = {(addr_space)ADDR_USER, (unsigned long)src_address, src_w * src_h * 4, 1, 0}; - srcImage = {srcAddr, srcAddr, src_w, src_h, src_w*4, AX_RGB, CF_ARGB_8888}; - srcRect = {0, 0, src_w, src_h}; - - dstAddr = {(addr_space)ADDR_USER, (unsigned long)dst_addr, dst_w * dst_h * dst_bpp, 1, 0}; - dstImage = {dstAddr, dstAddr, dst_w, dst_h, dst_w*dst_bpp, AX_RGB, (color_format)dst_color_format}; - dstRect = {0, 0, dst_w, dst_h}; - dstClip = {0, 0, 0, dst_w, dst_h}; - - if (rotVal == 0 || rotVal == 180) - Scaling = {SCALING_BILINEAR, SCALING_PIXELS, 0, 0, src_w, src_h, dst_w, dst_h}; - else - Scaling = {SCALING_BILINEAR, SCALING_PIXELS, 0, 0, src_w, src_h, dst_h, dst_w}; - - switch (rotVal) { - case 0: - g2d_rotation = ORIGIN; - break; - case 90: - g2d_rotation = ROT_90; - break; - case 180: - g2d_rotation = ROT_180; - break; - case 270: - g2d_rotation = ROT_270; - break; - default: - ALOGE("%s::invalid rotVal(%d) fail", __func__, rotVal); - return -1; - break; - } - - BlitParam = {BLIT_OP_SRC, NON_PREMULTIPLIED, 0xff, 0, g2d_rotation, &Scaling, 0, 0, &dstClip, 0, &srcImage, &dstImage, NULL, &srcRect, &dstRect, NULL, 0}; - - if (stretchFimgApi(&BlitParam) < 0) { - ALOGE("%s::stretchFimgApi() fail", __func__); - return -1; - } - -#ifdef DEBUG_MSG_ENABLE - ALOGD("hdmi_set_g_scaling:: \n \\ - layer=%d,\n \\ - srcColorFormat=%d,\n \\ - src_w=%d, src_h=%d,\n\\ - src_address=0x%x, dst_addr=0x%x,\n\\ - dst_x=%d, dst_y=%d, dst_w=%d, dst_h=%d ", - layer, - srcColorFormat, - src_w, src_h, - src_address, dst_addr, - dst_x, dst_y, dst_w, dst_h); -#endif - dstBuffer->virt.p = (char *)dst_addr; - } -#else - dstBuffer->virt.p = (char *)src_address; -#endif - - return 0; -} -#else -int hdmi_set_v_param(int layer, - int src_w, int src_h, int colorFormat, - unsigned int src_y_address, unsigned int src_c_address, - int dst_w, int dst_h) -{ -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int round_up_src_w; - int round_up_src_h; - if (fp_tvout_v <= 0) { - ALOGE("fp_tvout is < 0 fail\n"); - return -1; - } - - /* src_w, src_h round up to DWORD because of VP restriction */ -#if defined(SAMSUNG_EXYNOS4x12) - round_up_src_w = ROUND_UP(src_w, 16); -#else defined(SAMSUNG_EXYNOS4210) - round_up_src_w = ROUND_UP(src_w, 8); -#endif - round_up_src_h = ROUND_UP(src_h, 8); - - vo_param.src.base_y = (void *)src_y_address; - vo_param.src.base_c = (void *)src_c_address; - vo_param.src.pix_fmt.width = round_up_src_w; - vo_param.src.pix_fmt.height = round_up_src_h; - vo_param.src.pix_fmt.field = V4L2_FIELD_NONE; - vo_param.src.pix_fmt.pixelformat = colorFormat; - - tvout_v4l2_s_fmt(fp_tvout_v, V4L2_BUF_TYPE_PRIVATE, &vo_param.src); - - vo_param.src_crop.width = src_w; - vo_param.src_crop.height = src_h; - - tvout_v4l2_s_crop(fp_tvout_v, V4L2_BUF_TYPE_PRIVATE, &vo_param.src_crop); - - if (dst_w * src_h <= dst_h * src_w) { - vo_param.dst_win.w.left = 0; - vo_param.dst_win.w.top = (dst_h - ((dst_w * src_h) / src_w)) >> 1; - vo_param.dst_win.w.width = dst_w; - vo_param.dst_win.w.height = ((dst_w * src_h) / src_w); - } else { - vo_param.dst_win.w.left = (dst_w - ((dst_h * src_w) / src_h)) >> 1; - vo_param.dst_win.w.top = 0; - vo_param.dst_win.w.width = ((dst_h * src_w) / src_h); - vo_param.dst_win.w.height = dst_h; - } - - vo_param.dst.fmt.priv = 10; - vo_param.dst_win.global_alpha = 255; - tvout_v4l2_s_fbuf(fp_tvout_v, &vo_param.dst); - tvout_v4l2_s_fmt(fp_tvout_v, V4L2_BUF_TYPE_VIDEO_OVERLAY, &vo_param.dst_win); - - return 0; -} - -int hdmi_gl_set_param(int layer, - int srcColorFormat, - int src_w, int src_h, - unsigned int src_y_address, unsigned int src_c_address, - int dst_x, int dst_y, int dst_w, int dst_h, - int rotVal) -{ -#if defined(BOARD_USES_FIMGAPI) - int dst_color_format; - int dst_bpp; - unsigned char *dst_addr; - fimg2d_blit BlitParam; - rotation g2d_rotation; - - fimg2d_addr srcAddr; - fimg2d_image srcImage; - fimg2d_rect srcRect; - - fimg2d_addr dstAddr; - fimg2d_image dstImage; - fimg2d_rect dstRect; - - fimg2d_clip dstClip; - fimg2d_scale Scaling; - - struct fb_var_screeninfo var; - struct s5ptvfb_user_window window; - - int fp_tvout_g; - - if(layer == HDMI_LAYER_GRAPHIC_0) - fp_tvout_g = fp_tvout_g0; - else - fp_tvout_g = fp_tvout_g1; - - switch (t_std_id) { - case V4L2_STD_1080P_60: - case V4L2_STD_1080P_30: - case V4L2_STD_1080I_60: - case V4L2_STD_TVOUT_720P_60_SBS_HALF: - case V4L2_STD_TVOUT_720P_59_SBS_HALF: - case V4L2_STD_TVOUT_1080P_24_TB: - case V4L2_STD_TVOUT_1080P_23_TB: - dst_color_format = CF_ARGB_8888; - dst_bpp = 4; - var.bits_per_pixel = 32; - var.transp.length = 8; - break; - case V4L2_STD_480P_60_16_9: - case V4L2_STD_576P_50_16_9: - case V4L2_STD_720P_60: - case V4L2_STD_TVOUT_720P_50_TB: - default: - dst_color_format = CF_ARGB_4444; - dst_bpp = 2; - var.bits_per_pixel = 16; - var.transp.length = 4; - break; - } - - static unsigned int prev_src_addr = 0; - - if ((cur_g2d_address == 0) || (src_y_address != prev_src_addr)) { - dst_addr = (unsigned char *)g2d_reserved_memory[g2d_buf_index]; - - g2d_buf_index++; - if (g2d_buf_index >= HDMI_G2D_OUTPUT_BUF_NUM) - g2d_buf_index = 0; - - cur_g2d_address = (unsigned int)dst_addr; - prev_src_addr = src_y_address; - - srcAddr = {(addr_space)ADDR_PHYS, (unsigned long)src_y_address, src_w*src_h*4, 1, 0}; - srcImage = {srcAddr, srcAddr, src_w, src_h, src_w*4, AX_RGB, CF_ARGB_8888}; - srcRect = {0, 0, src_w, src_h}; - - dstAddr = {(addr_space)ADDR_PHYS, (unsigned long)dst_addr, dst_w*dst_h*dst_bpp, 1, 0}; - dstImage = {dstAddr, dstAddr, dst_w, dst_h, dst_w*dst_bpp, AX_RGB, (color_format)dst_color_format}; - dstRect = {0, 0, dst_w, dst_h}; - dstClip = {0, 0, 0, dst_w, dst_h}; - - if (rotVal == 0 || rotVal == 180) - Scaling = {SCALING_BILINEAR, SCALING_PIXELS, 0, 0, src_w, src_h, dst_w, dst_h}; - else - Scaling = {SCALING_BILINEAR, SCALING_PIXELS, 0, 0, src_w, src_h, dst_h, dst_w}; - - switch (rotVal) { - case 0: - g2d_rotation = ORIGIN; - break; - case 90: - g2d_rotation = ROT_90; - break; - case 180: - g2d_rotation = ROT_180; - break; - case 270: - g2d_rotation = ROT_270; - break; - default: - ALOGE("%s::invalid rotVal(%d) fail", __func__, rotVal); - return -1; - break; - } - - BlitParam = {BLIT_OP_SRC, NON_PREMULTIPLIED, 0xff, 0, g2d_rotation, &Scaling, 0, 0, &dstClip, 0, &srcImage, &dstImage, NULL, &srcRect, &dstRect, NULL, 0}; - - if (stretchFimgApi(&BlitParam) < 0) { - ALOGE("%s::stretchFimgApi() fail", __func__); - return -1; - } - - var.xres = dst_w; - var.yres = dst_h; - - var.xres_virtual = var.xres; - var.yres_virtual = var.yres; - var.xoffset = 0; - var.yoffset = 0; - var.width = 0; - var.height = 0; - var.activate = FB_ACTIVATE_FORCE; - - window.x = dst_x; - window.y = dst_y; - - tvout_v4l2_s_baseaddr(fp_tvout_g, (void *)dst_addr); - put_vscreeninfo(fp_tvout_g, &var); - - if (ioctl(fp_tvout_g, S5PTVFB_WIN_POSITION, &window) < 0) { - ALOGE("%s::S5PTVFB_WIN_POSITION ioctl failed.", __func__); - return -1; - } - } - - return 0; -#else - struct fb_var_screeninfo var; - struct s5ptvfb_user_window window; - - struct overlay_param ov_param; - - // set base address for grp layer0 of mixer - int fp_tvout_g; - -#ifdef DEBUG_MSG_ENABLE - ALOGD("hdmi_gl_set_param:: \n \\ - layer=%d,\n \\ - srcColorFormat=%d,\n \\ - src_w=%d, src_h=%d,\n\\ - src_y_address=0x%x, src_c_address=0x%x,\n\\ - dst_x=%d, dst_y=%d, dst_w=%d, dst_h=%d ", - layer, - srcColorFormat, - src_w, src_h, - src_y_address, src_c_address, - dst_x, dst_y, dst_w, dst_h); -#endif - - if (layer == HDMI_LAYER_GRAPHIC_0) - fp_tvout_g = fp_tvout_g0; - else - fp_tvout_g = fp_tvout_g1; - - var.xres = src_w; - var.yres = src_h; - var.xres_virtual = var.xres; - var.yres_virtual = var.yres; - var.xoffset = 0; - var.yoffset = 0; - var.width = src_w; - var.height = src_h; - var.activate = FB_ACTIVATE_FORCE; - if (srcColorFormat == HAL_PIXEL_FORMAT_RGB_565) { - var.bits_per_pixel = 16; - var.transp.length = 0; - } - else { - var.bits_per_pixel = 32; - var.transp.length = 8; - } - - window.x = dst_x; - window.y = dst_y; - - tvout_v4l2_s_baseaddr(fp_tvout_g, (void *)src_y_address); - put_vscreeninfo(fp_tvout_g, &var); - if (ioctl(fp_tvout_g, S5PTVFB_WIN_POSITION, &window) < 0) { - ALOGE("%s:: S5PTVFB_WIN_POSITION ioctl failed.", __func__); - return -1; - } - - return 0; -#endif -} -#endif - -int hdmi_cable_status() -{ -#if defined(BOARD_USE_V4L2) -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("%s", __func__); -#endif - - int cable_status = 0; - int fd = 0; - struct v4l2_control ctrl; - - fd = open(TVOUT_DEV_G0, O_RDWR); - if (fd <= 0) { - ALOGE("%s: graphic layer 0 drv open failed", __func__); - return -1; - } - - ctrl.id = V4L2_CID_TV_HPD_STATUS; - - if (ioctl(fd, VIDIOC_S_CTRL, &ctrl) < 0) { - ALOGE("Get HPD_STATUS fail"); - cable_status = -1; - } else { - cable_status = ctrl.value; - } - -#ifdef DEBUG_HDMI_HW_LEVEL - ALOGD("HPD_STATUS = %d", cable_status); -#endif - - close(fd); - - return cable_status; -#else - int cable_status = 0; - int fp_hpd = 0; - - fp_hpd = open(HPD_DEV, O_RDWR); - if (fp_hpd <= 0) { - ALOGE("hpd drv open failed\n"); - return -1; - } - - //Delay about 0.3s - usleep(500000); - if (ioctl(fp_hpd, HPD_GET_STATE, &cable_status) < 0) { - ALOGE("hpd drv HPD_GET_STATE ioctl failed\n"); - cable_status = -1; - } - - close(fp_hpd); - - return cable_status; -#endif -} - -int hdmi_outputmode_2_v4l2_output_type(int output_mode) -{ - int v4l2_output_type = -1; - - switch (output_mode) { - case HDMI_OUTPUT_MODE_YCBCR: - v4l2_output_type = V4L2_OUTPUT_TYPE_DIGITAL; - break; - case HDMI_OUTPUT_MODE_RGB: - v4l2_output_type = V4L2_OUTPUT_TYPE_HDMI_RGB; - break; - case HDMI_OUTPUT_MODE_DVI: - v4l2_output_type = V4L2_OUTPUT_TYPE_DVI; - break; - case COMPOSITE_OUTPUT_MODE: - v4l2_output_type = V4L2_OUTPUT_TYPE_COMPOSITE; - break; - default: - ALOGE("%s::unmathced HDMI_mode(%d)", __func__, output_mode); - v4l2_output_type = -1; - break; - } - - return v4l2_output_type; -} - -int hdmi_v4l2_output_type_2_outputmode(int v4l2_output_type) -{ - int outputMode = -1; - - switch (v4l2_output_type) { - case V4L2_OUTPUT_TYPE_DIGITAL: - outputMode = HDMI_OUTPUT_MODE_YCBCR; - break; - case V4L2_OUTPUT_TYPE_HDMI_RGB: - outputMode = HDMI_OUTPUT_MODE_RGB; - break; - case V4L2_OUTPUT_TYPE_DVI: - outputMode = HDMI_OUTPUT_MODE_DVI; - break; - case V4L2_OUTPUT_TYPE_COMPOSITE: - outputMode = COMPOSITE_OUTPUT_MODE; - break; - default: - ALOGE("%s::unmathced v4l2_output_type(%d)", __func__, v4l2_output_type); - outputMode = -1; - break; - } - - return outputMode; -} - -int composite_std_2_v4l2_std_id(int std) -{ - int std_id = -1; - - switch (std) { - case COMPOSITE_STD_NTSC_M: - std_id = V4L2_STD_NTSC_M; - break; - case COMPOSITE_STD_NTSC_443: - std_id = V4L2_STD_NTSC_443; - break; - case COMPOSITE_STD_PAL_BDGHI: - std_id = V4L2_STD_PAL_BDGHI; - break; - case COMPOSITE_STD_PAL_M: - std_id = V4L2_STD_PAL_M; - break; - case COMPOSITE_STD_PAL_N: - std_id = V4L2_STD_PAL_N; - break; - case COMPOSITE_STD_PAL_Nc: - std_id = V4L2_STD_PAL_Nc; - break; - case COMPOSITE_STD_PAL_60: - std_id = V4L2_STD_PAL_60; - break; - default: - ALOGE("%s::unmathced composite_std(%d)", __func__, std); - break; - } - - return std_id; -} - -int hdmi_check_output_mode(int v4l2_output_type) -{ - struct HDMIVideoParameter video; - struct HDMIAudioParameter audio; - int calbirate_v4l2_mode = v4l2_output_type; - - audio.formatCode = LPCM_FORMAT; - audio.outPacket = HDMI_ASP; - audio.channelNum = CH_2; - audio.sampleFreq = SF_44KHZ; - - switch (v4l2_output_type) { - case V4L2_OUTPUT_TYPE_DIGITAL : - video.mode = HDMI; - if (!EDIDHDMIModeSupport(&video)) { - calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_DVI; - ALOGI("Change mode into DVI\n"); - break; - } - - video.colorSpace = HDMI_CS_YCBCR444; - if (!EDIDColorSpaceSupport(&video)) { - calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_HDMI_RGB; - ALOGI("Change mode into HDMI_RGB\n"); - } - break; - - case V4L2_OUTPUT_TYPE_HDMI_RGB: - video.mode = HDMI; - if (!EDIDHDMIModeSupport(&video)) { - calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_DVI; - ALOGI("Change mode into DVI\n"); - break; - } - - video.colorSpace = HDMI_CS_RGB; - if (!EDIDColorSpaceSupport(&video)) { - calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_DIGITAL; - ALOGI("Change mode into HDMI_YCBCR\n"); - } - break; - - case V4L2_OUTPUT_TYPE_DVI: - video.mode = DVI; - if (!EDIDHDMIModeSupport(&video)) { - video.colorSpace = HDMI_CS_YCBCR444; - if (!EDIDColorSpaceSupport(&video)) { - calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_HDMI_RGB; - ALOGI("Change mode into HDMI_RGB\n"); - } else { - calbirate_v4l2_mode = V4L2_OUTPUT_TYPE_DIGITAL; - ALOGI("Change mode into HDMI_YCBCR\n"); - } - break; - } - - break; - - default: - break; - } - return calbirate_v4l2_mode; -} - -#if defined(BOARD_USE_V4L2) -int hdmi_check_resolution(unsigned int preset_id) -{ - struct HDMIVideoParameter video; - struct HDMIAudioParameter audio; - - switch (preset_id) { - case V4L2_DV_480P60: - video.resolution = v720x480p_60Hz; - video.pixelAspectRatio = HDMI_PIXEL_RATIO_16_9; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_576P50: - video.resolution = v720x576p_50Hz; - video.pixelAspectRatio = HDMI_PIXEL_RATIO_16_9; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_720P60: - video.resolution = v1280x720p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_720P50: - video.resolution = v1280x720p_50Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_1080P60: - video.resolution = v1920x1080p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_1080P50: - video.resolution = v1920x1080p_50Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_1080I60: - video.resolution = v1920x1080i_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_1080I50: - video.resolution = v1920x1080i_50Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_480P59_94: - video.resolution = v720x480p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_720P59_94: - video.resolution = v1280x720p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_1080I59_94: - video.resolution = v1920x1080i_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_1080P59_94: - video.resolution = v1920x1080p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_1080P30: - video.resolution = v1920x1080p_30Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_DV_720P60_SB_HALF: - video.resolution = v1280x720p_60Hz; - video.hdmi_3d_format = HDMI_3D_SSH_FORMAT; - break; - case V4L2_DV_720P59_94_SB_HALF: - video.resolution = v1280x720p_60Hz; - video.hdmi_3d_format = HDMI_3D_SSH_FORMAT; - break; - case V4L2_DV_720P50_TB: - video.resolution = v1280x720p_50Hz; - video.hdmi_3d_format = HDMI_3D_TB_FORMAT; - break; - case V4L2_DV_1080P24_TB: - video.resolution = v1920x1080p_24Hz; - video.hdmi_3d_format = HDMI_3D_TB_FORMAT; - break; - case V4L2_DV_1080P23_98_TB: - video.resolution = v1920x1080p_24Hz; - video.hdmi_3d_format = HDMI_3D_TB_FORMAT; - break; - default: - ALOGE("%s::unmathced preset_id(%d)", __func__, preset_id); - return -1; - break; - } - - if (!EDIDVideoResolutionSupport(&video)) { -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s::EDIDVideoResolutionSupport(%d) fail (not suppoted preset_id) \n", __func__, preset_id); -#endif - return -1; - } - - return 0; -} - -int hdmi_resolution_2_preset_id(unsigned int resolution, int * w, int * h, unsigned int *preset_id) -{ - int ret = 0; - - switch (resolution) { - case 1080960: - *w = 1920; - *h = 1080; - *preset_id = V4L2_DV_1080P60; - break; - case 1080950: - *w = 1920; - *h = 1080; - *preset_id = V4L2_DV_1080P50; - break; - case 1080930: - *w = 1920; - *h = 1080; - *preset_id = V4L2_DV_1080P30; - break; - case 1080924: - *w = 1920; - *h = 1080; - *preset_id = V4L2_DV_1080P24_TB; - break; - case 1080160: - *w = 1920; - *h = 1080; - *preset_id = V4L2_DV_1080I60; - break; - case 1080150: - *w = 1920; - *h = 1080; - *preset_id = V4L2_DV_1080I50; - break; - case 720960: - *w = 1280; - *h = 720; - *preset_id = V4L2_DV_720P60; - break; - case 7209601: - *w = 1280; - *h = 720; - *preset_id = V4L2_DV_720P60_SB_HALF; - break; - case 720950: - *w = 1280; - *h = 720; - *preset_id = V4L2_DV_720P50; - break; - case 7209501: - *w = 1280; - *h = 720; - *preset_id = V4L2_DV_720P50_TB; - break; - case 5769501: - *w = 720; - *h = 576; - *preset_id = V4L2_DV_576P50; - break; - case 5769502: - *w = 720; - *h = 576; - *preset_id = V4L2_DV_576P50; - break; - case 4809601: - *w = 720; - *h = 480; - *preset_id = V4L2_DV_480P60; - break; - case 4809602: - *w = 720; - *h = 480; - *preset_id = V4L2_DV_480P60; - break; - default: - ALOGE("%s::unmathced resolution(%d)", __func__, resolution); - ret = -1; - break; - } - - return ret; -} -#else -int hdmi_check_resolution(v4l2_std_id std_id) -{ - struct HDMIVideoParameter video; - struct HDMIAudioParameter audio; - - switch (std_id) { - case V4L2_STD_480P_60_16_9: - video.resolution = v720x480p_60Hz; - video.pixelAspectRatio = HDMI_PIXEL_RATIO_16_9; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_480P_60_4_3: - video.resolution = v640x480p_60Hz; - video.pixelAspectRatio = HDMI_PIXEL_RATIO_4_3; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_576P_50_16_9: - video.resolution = v720x576p_50Hz; - video.pixelAspectRatio = HDMI_PIXEL_RATIO_16_9; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_576P_50_4_3: - video.resolution = v720x576p_50Hz; - video.pixelAspectRatio = HDMI_PIXEL_RATIO_4_3; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_720P_60: - video.resolution = v1280x720p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_720P_50: - video.resolution = v1280x720p_50Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_1080P_60: - video.resolution = v1920x1080p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_1080P_50: - video.resolution = v1920x1080p_50Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_1080I_60: - video.resolution = v1920x1080i_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_1080I_50: - video.resolution = v1920x1080i_50Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_480P_59: - video.resolution = v720x480p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_720P_59: - video.resolution = v1280x720p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_1080I_59: - video.resolution = v1920x1080i_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_1080P_59: - video.resolution = v1920x1080p_60Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_1080P_30: - video.resolution = v1920x1080p_30Hz; - video.hdmi_3d_format = HDMI_2D_VIDEO_FORMAT; - break; - case V4L2_STD_TVOUT_720P_60_SBS_HALF: - video.resolution = v1280x720p_60Hz; - video.hdmi_3d_format = HDMI_3D_SSH_FORMAT; - break; - case V4L2_STD_TVOUT_720P_59_SBS_HALF: - video.resolution = v1280x720p_60Hz; - video.hdmi_3d_format = HDMI_3D_SSH_FORMAT; - break; - case V4L2_STD_TVOUT_720P_50_TB: - video.resolution = v1280x720p_50Hz; - video.hdmi_3d_format = HDMI_3D_TB_FORMAT; - break; - case V4L2_STD_TVOUT_1080P_24_TB: - video.resolution = v1920x1080p_24Hz; - video.hdmi_3d_format = HDMI_3D_TB_FORMAT; - break; - case V4L2_STD_TVOUT_1080P_23_TB: - video.resolution = v1920x1080p_24Hz; - video.hdmi_3d_format = HDMI_3D_TB_FORMAT; - break; - default: - ALOGE("%s::unmathced std_id(%lld)", __func__, std_id); - return -1; - break; - } - - if (!EDIDVideoResolutionSupport(&video)) { -#ifdef DEBUG_MSG_ENABLE - ALOGD("%s::EDIDVideoResolutionSupport(%llx) fail (not suppoted std_id) \n", __func__, std_id); -#endif - return -1; - } - - return 0; -} - -int hdmi_resolution_2_std_id(unsigned int resolution, int * w, int * h, v4l2_std_id * std_id) -{ - int ret = 0; - - switch (resolution) { - case 1080960: - *std_id = V4L2_STD_1080P_60; - *w = 1920; - *h = 1080; - break; - case 1080950: - *std_id = V4L2_STD_1080P_50; - *w = 1920; - *h = 1080; - break; - case 1080930: - *std_id = V4L2_STD_1080P_30; - *w = 1920; - *h = 1080; - break; - case 1080924: - *std_id = V4L2_STD_TVOUT_1080P_24_TB; - *w = 1920; - *h = 1080; - break; - case 1080160: - *std_id = V4L2_STD_1080I_60; - *w = 1920; - *h = 1080; - break; - case 1080150: - *std_id = V4L2_STD_1080I_50; - *w = 1920; - *h = 1080; - break; - case 720960: - *std_id = V4L2_STD_720P_60; - *w = 1280; - *h = 720; - break; - case 7209601: - *std_id = V4L2_STD_TVOUT_720P_60_SBS_HALF; - *w = 1280; - *h = 720; - break; - case 720950: - *std_id = V4L2_STD_720P_50; - *w = 1280; - *h = 720; - break; - case 7209501: - *std_id = V4L2_STD_TVOUT_720P_50_TB; - *w = 1280; - *h = 720; - break; - case 5769501: - *std_id = V4L2_STD_576P_50_16_9; - *w = 720; - *h = 576; - break; - case 5769502: - *std_id = V4L2_STD_576P_50_4_3; - *w = 720; - *h = 576; - break; - case 4809601: - *std_id = V4L2_STD_480P_60_16_9; - *w = 720; - *h = 480; - break; - case 4809602: - *std_id = V4L2_STD_480P_60_4_3; - *w = 720; - *h = 480; - break; - default: - ALOGE("%s::unmathced resolution(%d)", __func__, resolution); - ret = -1; - break; - } - - return ret; -} -#endif - -int hdmi_enable_hdcp(unsigned int hdcp_en) -{ - if (ioctl(fp_tvout, VIDIOC_HDCP_ENABLE, hdcp_en) < 0) { - ALOGD("%s::VIDIOC_HDCP_ENABLE(%d) fail \n", __func__, hdcp_en); - return -1; - } - - return 0; -} - -int hdmi_check_audio(void) -{ - struct HDMIAudioParameter audio; - enum state audio_state = ON; - int ret = 0; - - audio.formatCode = LPCM_FORMAT; - audio.outPacket = HDMI_ASP; - audio.channelNum = CH_2; - audio.sampleFreq = SF_44KHZ; - -#if defined(BOARD_USES_EDID) - if (!EDIDAudioModeSupport(&audio)) - audio_state = NOT_SUPPORT; - else - audio_state = ON; -#endif - if (audio_state == ON) { - if (ioctl(fp_tvout, VIDIOC_INIT_AUDIO, 1) < 0) { - ALOGE("%s::VIDIOC_INIT_AUDIO(1) fail", __func__); - ret = -1; - } - } else { - if (ioctl(fp_tvout, VIDIOC_INIT_AUDIO, 0) < 0) { - ALOGE("%s::VIDIOC_INIT_AUDIO(0) fail", __func__); - ret = -1; - } - } - - return ret; -} - -} diff --git a/exynos4/hal/libhdmi/SecHdmi/SecHdmiV4L2Utils.h b/exynos4/hal/libhdmi/SecHdmi/SecHdmiV4L2Utils.h deleted file mode 100644 index a4aa69c..0000000 --- a/exynos4/hal/libhdmi/SecHdmi/SecHdmiV4L2Utils.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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 __HDMI_HAL_V4L2_UTILS_H__ -#define __HDMI_HAL_V4L2_UTILS_H__ - -//#define LOG_NDEBUG 0 -//#define LOG_TAG "libhdmi" -#if defined(BOARD_USE_V4L2) -#include "SecBuffer.h" -#endif -#include "fimd_api.h" - -#ifdef __cplusplus -extern "C" { -#endif - -namespace android { - -void display_menu(void); - -int tvout_open(const char *fp_name); -#if defined(BOARD_USE_V4L2) -int tvout_std_v4l2_init(int fd, unsigned int preset_id); -int tvout_std_v4l2_querycap(int fd, char *node); -int tvout_std_v4l2_enum_dv_presets(int fd); -int tvout_std_v4l2_s_dv_preset(int fd, struct v4l2_dv_preset *preset); -int tvout_std_v4l2_enum_output(int fd, struct v4l2_output *output); -int tvout_std_v4l2_s_output(int fd, int index); -int tvout_std_v4l2_g_output(int fd, int *index); -int tvout_std_v4l2_s_fmt(int fd, enum v4l2_buf_type type, enum v4l2_field field, int w, int h, int colorformat, int num_planes); -int tvout_std_v4l2_s_crop(int fd, enum v4l2_buf_type type, enum v4l2_field field, int x, int y, int w, int h); -int tvout_std_v4l2_s_ctrl(int fd, int id, int value); -int tvout_std_v4l2_reqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int num_bufs); -int tvout_std_v4l2_querybuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, unsigned int buf_index, unsigned int num_planes, SecBuffer *secBuf); -int tvout_std_v4l2_qbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, int buf_index, int num_planes, SecBuffer *secBuf); -int tvout_std_v4l2_dqbuf(int fd, enum v4l2_buf_type type, enum v4l2_memory memory, int *buf_index, int num_planes); -int tvout_std_v4l2_streamon(int fd, enum v4l2_buf_type type); -int tvout_std_v4l2_streamoff(int fd, enum v4l2_buf_type type); -#else -int tvout_init(v4l2_std_id std_id); -int tvout_deinit(); -int tvout_v4l2_querycap(int fp); -int tvout_v4l2_g_std(int fp, v4l2_std_id *std_id); -int tvout_v4l2_s_std(int fp, v4l2_std_id std_id); -int tvout_v4l2_enum_std(int fp, struct v4l2_standard *std, v4l2_std_id std_id); -int tvout_v4l2_enum_output(int fp, struct v4l2_output *output); -int tvout_v4l2_s_output(int fp, int index); -int tvout_v4l2_g_output(int fp, int *index); -int tvout_v4l2_enum_fmt(int fp, struct v4l2_fmtdesc *desc); -int tvout_v4l2_g_fmt(int fp, int buf_type, void* ptr); -int tvout_v4l2_s_fmt(int fp, int buf_type, void *ptr); -int tvout_v4l2_g_fbuf(int fp, struct v4l2_framebuffer *frame); -int tvout_v4l2_s_fbuf(int fp, struct v4l2_framebuffer *frame); -int tvout_v4l2_s_baseaddr(int fp, void *base_addr); -int tvout_v4l2_g_crop(int fp, unsigned int type, struct v4l2_rect *rect); -int tvout_v4l2_s_crop(int fp, unsigned int type, struct v4l2_rect *rect); -int tvout_v4l2_start_overlay(int fp); -int tvout_v4l2_stop_overlay(int fp); -#endif - -int hdmi_init_layer(int layer); -int hdmi_deinit_layer(int layer); -#if defined(BOARD_USE_V4L2) -int hdmi_set_v_param(int fd, int layer, - int srcColorFormat, - int src_w, int src_h, - SecBuffer * dstBuffer, - int dst_x, int dst_y, int dst_w, int dst_h); -int hdmi_set_g_param(int fd, int layer, - int srcColorFormat, - int src_w, int src_h, - SecBuffer * dstBuffer, - int dst_x, int dst_y, int dst_w, int dst_h); -int hdmi_set_g_scaling(int layer, - int srcColorFormat, - int src_w, int src_h, - unsigned int src_address, SecBuffer * dstBuffer, - int dst_x, int dst_y, int dst_w, int dst_h, - int rotVal, unsigned int hwc_layer); -#else -int hdmi_set_v_param(int layer, - int src_w, int src_h, int colorFormat, - unsigned int src_y_address, unsigned int src_c_address, - int dst_w, int dst_h); -int hdmi_gl_set_param(int layer, - int srcColorFormat, - int src_w, int src_h, - unsigned int src_y_address, unsigned int src_c_address, - int dst_x, int dst_y, int dst_w, int dst_h, - int rotVal); -#endif -void hdmi_cal_rect(int src_w, int src_h, int dst_w, int dst_h, struct v4l2_rect *dst_rect); -#if defined(BOARD_USE_V4L2) -int hdmi_get_src_plane(int srcColorFormat, unsigned int *num_of_plane); -#endif -int hdmi_cable_status(); -int hdmi_outputmode_2_v4l2_output_type(int output_mode); -int hdmi_v4l2_output_type_2_outputmode(int v4l2_output_type); -int composite_std_2_v4l2_std_id(int std); - -int hdmi_check_output_mode(int v4l2_output_type); -#if defined(BOARD_USE_V4L2) -int hdmi_check_resolution(unsigned int preset_id); -int hdmi_resolution_2_preset_id(unsigned int resolution, int * w, int * h, unsigned int *preset_id); -#else -int hdmi_check_resolution(v4l2_std_id std_id); -int hdmi_resolution_2_std_id(unsigned int resolution, int *w, int *h, v4l2_std_id *std_id); -#endif -int hdmi_enable_hdcp(unsigned int hdcp_en); -int hdmi_check_audio(void); - -#ifdef __cplusplus -} -#endif - -} //namespace android - -#endif //__HDMI_HAL_V4L2_UTILS_H__ diff --git a/exynos4/hal/libhdmi/SecHdmi/fimd_api.c b/exynos4/hal/libhdmi/SecHdmi/fimd_api.c deleted file mode 100644 index 0f14f5d..0000000 --- a/exynos4/hal/libhdmi/SecHdmi/fimd_api.c +++ /dev/null @@ -1,229 +0,0 @@ -/* -* 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. -*/ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <errno.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/ioctl.h> -#include <sys/mman.h> -#include <sys/time.h> -#include <linux/vt.h> -#include <fcntl.h> -#include <unistd.h> -#include <poll.h> -#include <signal.h> -#include <cutils/log.h> - -#include "fimd_api.h" - -int fb_open(int win) -{ - char node[20]; - int fp = -1; - - sprintf(node, "%s%d", PFX_NODE_FB, win); - - fp = open(node, O_RDWR); - if (fp < 0) - ALOGE("%s: fb[%d] open failed", __func__, win); - - return fp; -} - -int fb_close(int fp) -{ - if (fp) - close(fp); - else - ALOGE("%s: fb is not allocated %d", __func__, fp); - - return 0; -} - -int get_fscreeninfo(int fp, struct fb_fix_screeninfo *fix) -{ - int ret = -1; - - ret = ioctl(fp, FBIOGET_FSCREENINFO, fix); - if (ret) - ALOGE("%s: FBIOGET_FSCREENINFO failed", __func__); - - return ret; -} - -int get_vscreeninfo(int fp, struct fb_var_screeninfo *var) -{ - int ret = -1; - - ret = ioctl(fp, FBIOGET_VSCREENINFO, var); - if (ret) - ALOGE("%s:: FBIOGET_VSCREENINFO failed", __func__); - - return ret; -} - -int put_vscreeninfo(int fp, struct fb_var_screeninfo *var) -{ - int ret = -1; - - ret = ioctl(fp, FBIOPUT_VSCREENINFO, var); - if (ret) - ALOGE("%s:: FBIOPUT_VSCREENINFO failed", __func__); - - return ret; -} - -int get_bytes_per_pixel(int bits_per_pixel) -{ - return (bits_per_pixel == 24 || bits_per_pixel == 25 || - bits_per_pixel == 28) ? 4 : bits_per_pixel / 8; -} - -char *fb_mmap(__u32 size, int fp) -{ - char *buffer; - - buffer = (char *)mmap(0, size, PROT_READ | PROT_WRITE, - MAP_SHARED, fp, 0); - if (!buffer) { - ALOGE("%s:: mmap failed", __func__); - return NULL; - } - - return buffer; -} - -int fb_ioctl(int fp, __u32 cmd, void *arg) -{ - int ret = -1; - - ret = ioctl(fp, cmd, arg); - if (ret < 0) - ALOGE("%s:: ioctl (%d) failed", __func__, cmd); - - return ret; -} - -int fb_on(int fp) -{ - int ret = -1; - - ret = ioctl(fp, FBIOBLANK, FB_BLANK_UNBLANK); - if (ret) - ALOGE("%s:: FBIOBLANK failed", __func__); - - return ret; -} - -int fb_off(int fp) -{ - int ret = -1; - - ret = ioctl(fp, FBIOBLANK, FB_BLANK_POWERDOWN); - if (ret) - ALOGE("%s:: FBIOBLANK failed", __func__); - - return ret; -} - -int fb_off_all() -{ - int fp, i; - - for (i = 0; i < TOTAL_FB_NUM; i++) { - fp = fb_open(i); - if (fp < 0) - return -1; - - if (ioctl(fp, FBIOBLANK, FB_BLANK_POWERDOWN) < 0) - ALOGE("%s:: FBIOBLANK failed", __func__); - - fb_off(fp); - fb_close(fp); - } - - return 0; -} - -char *fb_init_display(int fp, int width, int height, int left_x, int top_y, - int bpp) -{ - struct fb_var_screeninfo var; - struct s5ptvfb_user_window window; - int fb_size; - char *fb = NULL; - - var.xres = width; - var.yres = height; - var.bits_per_pixel = bpp; - window.x = left_x; - window.y = top_y; - - var.xres_virtual = var.xres; - var.yres_virtual = var.yres; - var.xoffset = 0; - var.yoffset = 0; - var.width = 0; - var.height = 0; - var.transp.length = 0; - var.activate = FB_ACTIVATE_FORCE; - fb_size = var.xres_virtual * var.yres_virtual * bpp / 8; - - /* FBIOPUT_VSCREENINFO should be first */ - put_vscreeninfo(fp, &var); - fb_ioctl(fp, S5PTVFB_WIN_POSITION, &window); - - /* draw image */ - fb = fb_mmap(fb_size, fp); - memset(fb, 0x0, fb_size); - - return fb; -} - -int simple_draw(char *dest, const char *src, int img_width, - struct fb_var_screeninfo *var) -{ - int bytes_per_pixel = get_bytes_per_pixel(var->bits_per_pixel); - unsigned int y; - - for (y = 0; y < var->yres; y++) - memcpy(dest + y * var->xres * bytes_per_pixel, - src + y * img_width * bytes_per_pixel, - var->xres * bytes_per_pixel); - - return 0; -} - -int draw(char *dest, const char *src, int img_width, - struct fb_var_screeninfo *var) -{ - int bytes_per_pixel = get_bytes_per_pixel(var->bits_per_pixel); - unsigned int y; - - if (var->bits_per_pixel == 16) { - memcpy(dest, src, var->xres * var->yres * 2); - } else { - for (y = 0; y < var->yres; y++) - memcpy(dest + y * var->xres * bytes_per_pixel, - src + y * img_width * bytes_per_pixel, - var->xres * bytes_per_pixel); - } - - return 0; -} diff --git a/exynos4/hal/libhdmi/SecHdmi/fimd_api.h b/exynos4/hal/libhdmi/SecHdmi/fimd_api.h deleted file mode 100644 index a8561a4..0000000 --- a/exynos4/hal/libhdmi/SecHdmi/fimd_api.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 __FIMD_API_H__ -#define __FIMD_API_H__ - -#include <linux/fb.h> -#include "s5p_tvout.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define TOTAL_FB_NUM 5 - -int fb_open(int win); -int fb_close(int fp); -int fb_on(int fp); -int fb_off(int fp); -int fb_off_all(void); -char *fb_init_display(int fp, int width, int height,\ - int left_x, int top_y, int bpp); -int fb_ioctl(int fp, __u32 cmd, void *arg); -char *fb_mmap(__u32 size, int fp); -int simple_draw(char *dest, const char *src,\ - int img_width, struct fb_var_screeninfo *var); -int draw(char *dest, const char *src,\ - int img_width, struct fb_var_screeninfo *var); -int get_fscreeninfo(int fp, struct fb_fix_screeninfo *fix); -int get_vscreeninfo(int fp, struct fb_var_screeninfo *var); -int put_vscreeninfo(int fp, struct fb_var_screeninfo *var); -int get_bytes_per_pixel(int bits_per_pixel); - -#ifdef __cplusplus -} -#endif - -#endif /* __FIMD_API_H__ */ diff --git a/exynos4/hal/libhdmi/libhdmiservice/Android.mk b/exynos4/hal/libhdmi/libhdmiservice/Android.mk deleted file mode 100644 index ebfa9d5..0000000 --- a/exynos4/hal/libhdmi/libhdmiservice/Android.mk +++ /dev/null @@ -1,126 +0,0 @@ -# Copyright (C) 2008 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. - -ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),) -ifeq ($(BOARD_USES_HDMI),true) - -LOCAL_PATH:= $(call my-dir) - -# -# libTVOut -# - -include $(CLEAR_VARS) -LOCAL_MODULE_TAGS := optional -LOCAL_PRELINK_MODULE := false - -LOCAL_SRC_FILES := \ - SecTVOutService.cpp \ - ISecTVOut.cpp \ - MessageQueue.cpp - -LOCAL_C_INCLUDES := \ - -LOCAL_SHARED_LIBRARIES := \ - libbinder \ - libutils \ - libcutils - -LOCAL_C_INCLUDES += $(TARGET_HAL_PATH)/include -LOCAL_C_INCLUDES += $(TARGET_HAL_PATH)/libhdmi -LOCAL_C_INCLUDES += $(TARGET_HAL_PATH)/libfimc -LOCAL_SHARED_LIBRARIES += libhdmi libfimc - -ifeq ($(BOARD_USES_HDMI_SUBTITLES),true) - LOCAL_CFLAGS += -DBOARD_USES_HDMI_SUBTITLES -endif - -ifeq ($(TARGET_SOC),exynos4210) - LOCAL_CFLAGS += -DSAMSUNG_EXYNOS4210 -endif - -ifeq ($(TARGET_SOC),exynos4x12) - LOCAL_CFLAGS += -DSAMSUNG_EXYNOS4x12 -endif - -LOCAL_CFLAGS += -DBOARD_USES_HDMI - -ifeq ($(BOARD_USE_V4L2),true) - LOCAL_CFLAGS += -DBOARD_USE_V4L2 -endif - -ifeq ($(BOARD_USE_V4L2_ION),true) - LOCAL_CFLAGS += -DBOARD_USE_V4L2_ION -endif - -LOCAL_MODULE := libTVOut - -include $(BUILD_SHARED_LIBRARY) - -# -# libhdmiclient -# - -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional -LOCAL_PRELINK_MODULE := false - -LOCAL_SRC_FILES:= \ - SecHdmiClient.cpp - -LOCAL_C_INCLUDES += \ - $(JNI_H_INCLUDE) - -LOCAL_SHARED_LIBRARIES := \ - libbinder \ - libutils \ - libTVOut - -ifeq ($(TARGET_SIMULATOR),true) -ifeq ($(TARGET_OS),linux) -ifeq ($(TARGET_ARCH),x86) -LOCAL_LDLIBS += -lpthread -ldl -lrt -endif -endif -endif - -ifeq ($(WITH_MALLOC_LEAK_CHECK),true) - LOCAL_CFLAGS += -DMALLOC_LEAK_CHECK -endif - -ifeq ($(TARGET_SOC),exynos4210) - LOCAL_CFLAGS += -DSAMSUNG_EXYNOS4210 -endif - -ifeq ($(TARGET_SOC),exynos4x12) - LOCAL_CFLAGS += -DSAMSUNG_EXYNOS4x12 -endif - -LOCAL_CFLAGS += -DBOARD_USES_HDMI - -ifeq ($(BOARD_USE_V4L2),true) - LOCAL_CFLAGS += -DBOARD_USE_V4L2 -endif - -ifeq ($(BOARD_USE_V4L2_ION),true) - LOCAL_CFLAGS += -DBOARD_USE_V4L2_ION -endif - -LOCAL_MODULE:= libhdmiclient - -include $(BUILD_SHARED_LIBRARY) - -endif -endif diff --git a/exynos4/hal/libhdmi/libhdmiservice/Barrier.h b/exynos4/hal/libhdmi/libhdmiservice/Barrier.h deleted file mode 100644 index 6f8507e..0000000 --- a/exynos4/hal/libhdmi/libhdmiservice/Barrier.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2007 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_BARRIER_H -#define ANDROID_BARRIER_H - -#include <stdint.h> -#include <sys/types.h> -#include <utils/threads.h> - -namespace android { - -class Barrier -{ -public: - inline Barrier() : state(CLOSED) { } - inline ~Barrier() { } - void open() { - Mutex::Autolock _l(lock); - state = OPENED; - cv.broadcast(); - } - void close() { - Mutex::Autolock _l(lock); - state = CLOSED; - } - void wait() const { - Mutex::Autolock _l(lock); - while (state == CLOSED) { - cv.wait(lock); - } - } -private: - enum { OPENED, CLOSED }; - mutable Mutex lock; - mutable Condition cv; - volatile int state; -}; - -}; // namespace android - -#endif // ANDROID_BARRIER_H diff --git a/exynos4/hal/libhdmi/libhdmiservice/ISecTVOut.cpp b/exynos4/hal/libhdmi/libhdmiservice/ISecTVOut.cpp deleted file mode 100644 index a013bf1..0000000 --- a/exynos4/hal/libhdmi/libhdmiservice/ISecTVOut.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/* -** -** Copyright 2008, The Android Open Source Project -** Copyright 2010, 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. -*/ - -/* -** -** @author Taikyung, Yu(taikyung.yu@samsung.com) -** @date 2011-07-06 -*/ - -#include <stdint.h> -#include <sys/types.h> -#include <binder/Parcel.h> -#include <utils/Log.h> -#include "ISecTVOut.h" - -namespace android { - - enum { - SET_HDMI_STATUS = IBinder::FIRST_CALL_TRANSACTION, - SET_HDMI_MODE, - SET_HDMI_RESOLUTION, - SET_HDMI_HDCP, - SET_HDMI_ROTATE, - SET_HDMI_HWCLAYER, - BLIT_2_HDMI - }; - - void BpSecTVOut::setHdmiCableStatus(uint32_t status) - { - Parcel data, reply; - data.writeInt32(status); - remote()->transact(SET_HDMI_STATUS, data, &reply); - } - - void BpSecTVOut::setHdmiMode(uint32_t mode) - { - Parcel data, reply; - data.writeInt32(mode); - remote()->transact(SET_HDMI_MODE, data, &reply); - } - - void BpSecTVOut::setHdmiResolution(uint32_t resolution) - { - Parcel data, reply; - data.writeInt32(resolution); - remote()->transact(SET_HDMI_RESOLUTION, data, &reply); - } - - void BpSecTVOut::setHdmiHdcp(uint32_t resolution) - { - Parcel data, reply; - data.writeInt32(resolution); - remote()->transact(SET_HDMI_HDCP, data, &reply); - } - - void BpSecTVOut::setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer) - { - Parcel data, reply; - data.writeInt32(rotVal); - data.writeInt32(hwcLayer); - remote()->transact(SET_HDMI_ROTATE, data, &reply); - } - - void BpSecTVOut::setHdmiHwcLayer(uint32_t hwcLayer) - { - Parcel data, reply; - data.writeInt32(hwcLayer); - remote()->transact(SET_HDMI_HWCLAYER, data, &reply); - } - - void BpSecTVOut::blit2Hdmi(uint32_t w, uint32_t h, - uint32_t colorFormat, - uint32_t physYAddr, - uint32_t physCbAddr, - uint32_t physCrAddr, - uint32_t dstX, - uint32_t dstY, - uint32_t hdmiLayer, - uint32_t num_of_hwc_layer) - { - Parcel data, reply; - data.writeInt32(w); - data.writeInt32(h); - data.writeInt32(colorFormat); - data.writeInt32(physYAddr); - data.writeInt32(physCbAddr); - data.writeInt32(physCrAddr); - data.writeInt32(dstX); - data.writeInt32(dstY); - data.writeInt32(hdmiLayer); - data.writeInt32(num_of_hwc_layer); - remote()->transact(BLIT_2_HDMI, data, &reply); - } - - IMPLEMENT_META_INTERFACE(SecTVOut, "android.os.ISecTVOut"); -}; diff --git a/exynos4/hal/libhdmi/libhdmiservice/ISecTVOut.h b/exynos4/hal/libhdmi/libhdmiservice/ISecTVOut.h deleted file mode 100644 index 5506b57..0000000 --- a/exynos4/hal/libhdmi/libhdmiservice/ISecTVOut.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -** -** Copyright 2008, The Android Open Source Project -** Copyright 2010, 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. -*/ - -/* -** -** @author Taikyung, Yu(taikyung.yu@samsung.com) -** @date 2011-07-06 -*/ - -#ifndef ISECTVOUT_H -#define ISECTVOUT_H -#include <utils/RefBase.h> -#include <binder/IInterface.h> -#include <binder/Parcel.h> - -namespace android { - class ISecTVOut: public IInterface - { - public: - DECLARE_META_INTERFACE(SecTVOut); - virtual void setHdmiCableStatus(uint32_t status) = 0; - virtual void setHdmiMode(uint32_t mode) = 0; - virtual void setHdmiResolution(uint32_t resolution) = 0; - virtual void setHdmiHdcp(uint32_t enHdcp) = 0; - virtual void setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer) = 0; - virtual void setHdmiHwcLayer(uint32_t hwcLayer) = 0; - virtual void blit2Hdmi(uint32_t w, uint32_t h, - uint32_t colorFormat, - uint32_t physYAddr, - uint32_t physCbAddr, - uint32_t physCrAddr, - uint32_t dstX, - uint32_t dstY, - uint32_t hdmiLayer, - uint32_t num_of_hwc_layer) = 0; - }; - //-------------------------------------------------------------- - class BpSecTVOut: public BpInterface<ISecTVOut> - { - public: - BpSecTVOut(const sp<IBinder>& impl): BpInterface<ISecTVOut>(impl){} - virtual void setHdmiCableStatus(uint32_t status); - virtual void setHdmiMode(uint32_t mode); - virtual void setHdmiResolution(uint32_t resolution); - virtual void setHdmiHdcp(uint32_t enHdcp); - virtual void setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer); - virtual void setHdmiHwcLayer(uint32_t hwcLayer); - virtual void blit2Hdmi(uint32_t w, uint32_t h, - uint32_t colorFormat, - uint32_t physYAddr, - uint32_t physCbAddr, - uint32_t physCrAddr, - uint32_t dstX, - uint32_t dstY, - uint32_t hdmiLayer, - uint32_t num_of_hwc_layer); - }; -}; -#endif diff --git a/exynos4/hal/libhdmi/libhdmiservice/MessageQueue.cpp b/exynos4/hal/libhdmi/libhdmiservice/MessageQueue.cpp deleted file mode 100644 index 9441019..0000000 --- a/exynos4/hal/libhdmi/libhdmiservice/MessageQueue.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* - * Copyright (C) 2009 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. - */ - -#include <stdint.h> -#include <errno.h> -#include <sys/types.h> - -#include <utils/threads.h> -#include <utils/Timers.h> -#include <utils/Log.h> -#include <binder/IPCThreadState.h> - -#include "MessageQueue.h" - -namespace android { - -// --------------------------------------------------------------------------- - -void MessageList::insert(const sp<MessageBase>& node) -{ - LIST::iterator cur(mList.begin()); - LIST::iterator end(mList.end()); - while (cur != end) { - if (*node < **cur) { - mList.insert(cur, node); - return; - } - ++cur; - } - mList.insert(++end, node); -} - -void MessageList::remove(MessageList::LIST::iterator pos) -{ - mList.erase(pos); -} - -// --------------------------------------------------------------------------- - -MessageQueue::MessageQueue() - : mInvalidate(false) -{ - mInvalidateMessage = new MessageBase(INVALIDATE); -} - -MessageQueue::~MessageQueue() -{ -} - -sp<MessageBase> MessageQueue::waitMessage(nsecs_t timeout) -{ - sp<MessageBase> result; - - bool again; - do { - const nsecs_t timeoutTime = systemTime() + timeout; - while (true) { - Mutex::Autolock _l(mLock); - nsecs_t now = systemTime(); - nsecs_t nextEventTime = -1; - - LIST::iterator cur(mMessages.begin()); - if (cur != mMessages.end()) { - result = *cur; - } - - if (result != 0) { - if (result->when <= now) { - // there is a message to deliver - mMessages.remove(cur); - break; - } - nextEventTime = result->when; - result = 0; - } - - // see if we have an invalidate message - if (mInvalidate) { - mInvalidate = false; - mInvalidateMessage->when = now; - result = mInvalidateMessage; - break; - } - - if (timeout >= 0) { - if (timeoutTime < now) { - // we timed-out, return a NULL message - result = 0; - break; - } - if (nextEventTime > 0) { - if (nextEventTime > timeoutTime) { - nextEventTime = timeoutTime; - } - } else { - nextEventTime = timeoutTime; - } - } - - if (nextEventTime >= 0) { - //ALOGD("nextEventTime = %lld ms", nextEventTime); - if (nextEventTime > 0) { - // we're about to wait, flush the binder command buffer - IPCThreadState::self()->flushCommands(); - const nsecs_t reltime = nextEventTime - systemTime(); - if (reltime > 0) { - mCondition.waitRelative(mLock, reltime); - } - } - } else { - //ALOGD("going to wait"); - // we're about to wait, flush the binder command buffer - IPCThreadState::self()->flushCommands(); - mCondition.wait(mLock); - } - } - // here we're not holding the lock anymore - - if (result == 0) - break; - - again = result->handler(); - if (again) { - // the message has been processed. release our reference to it - // without holding the lock. - result->notify(); - result = 0; - } - - } while (again); - - return result; -} - -status_t MessageQueue::postMessage( - const sp<MessageBase>& message, nsecs_t relTime, uint32_t flags) -{ - return queueMessage(message, relTime, flags); -} - -status_t MessageQueue::invalidate() { - Mutex::Autolock _l(mLock); - mInvalidate = true; - mCondition.signal(); - return NO_ERROR; -} - -status_t MessageQueue::queueMessage( - const sp<MessageBase>& message, nsecs_t relTime, uint32_t flags) -{ - Mutex::Autolock _l(mLock); - message->when = systemTime() + relTime; - mMessages.insert(message); - - //ALOGD("MessageQueue::queueMessage time = %lld ms", message->when); - //dumpLocked(message); - - mCondition.signal(); - return NO_ERROR; -} - -void MessageQueue::dump(const sp<MessageBase>& message) -{ - Mutex::Autolock _l(mLock); - dumpLocked(message); -} - -void MessageQueue::dumpLocked(const sp<MessageBase>& message) -{ - LIST::const_iterator cur(mMessages.begin()); - LIST::const_iterator end(mMessages.end()); - int c = 0; - while (cur != end) { - const char tick = (*cur == message) ? '>' : ' '; - ALOGD("%c %d: msg{.what=%08x, when=%lld}", - tick, c, (*cur)->what, (*cur)->when); - ++cur; - c++; - } -} - -// --------------------------------------------------------------------------- - -}; // namespace android diff --git a/exynos4/hal/libhdmi/libhdmiservice/MessageQueue.h b/exynos4/hal/libhdmi/libhdmiservice/MessageQueue.h deleted file mode 100644 index 890f809..0000000 --- a/exynos4/hal/libhdmi/libhdmiservice/MessageQueue.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2009 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_MESSAGE_QUEUE_H -#define ANDROID_MESSAGE_QUEUE_H - -#include <stdint.h> -#include <errno.h> -#include <sys/types.h> - -#include <utils/threads.h> -#include <utils/Timers.h> -#include <utils/List.h> - -#include "Barrier.h" - -namespace android { - -// --------------------------------------------------------------------------- - -class MessageBase; - -class MessageList -{ - List< sp<MessageBase> > mList; - typedef List< sp<MessageBase> > LIST; -public: - inline LIST::iterator begin() { return mList.begin(); } - inline LIST::const_iterator begin() const { return mList.begin(); } - inline LIST::iterator end() { return mList.end(); } - inline LIST::const_iterator end() const { return mList.end(); } - inline bool isEmpty() const { return mList.empty(); } - void insert(const sp<MessageBase>& node); - void remove(LIST::iterator pos); -}; - -// ============================================================================ - -class MessageBase : - public LightRefBase<MessageBase> -{ -public: - nsecs_t when; - uint32_t what; - int32_t arg0; - - MessageBase() : when(0), what(0), arg0(0) { } - MessageBase(uint32_t what, int32_t arg0=0) - : when(0), what(what), arg0(arg0) { } - - // return true if message has a handler - virtual bool handler() { return false; } - - // waits for the handler to be processed - void wait() const { barrier.wait(); } - - // releases all waiters. this is done automatically if - // handler returns true - void notify() const { barrier.open(); } - -protected: - virtual ~MessageBase() { } - -private: - mutable Barrier barrier; - friend class LightRefBase<MessageBase>; -}; - -inline bool operator < (const MessageBase& lhs, const MessageBase& rhs) { - return lhs.when < rhs.when; -} - -// --------------------------------------------------------------------------- - -class MessageQueue -{ - typedef List< sp<MessageBase> > LIST; -public: - - MessageQueue(); - ~MessageQueue(); - - // pre-defined messages - enum { - INVALIDATE = '_upd' - }; - - sp<MessageBase> waitMessage(nsecs_t timeout = -1); - - status_t postMessage(const sp<MessageBase>& message, - nsecs_t reltime=0, uint32_t flags = 0); - - status_t invalidate(); - - void dump(const sp<MessageBase>& message); - -private: - status_t queueMessage(const sp<MessageBase>& message, - nsecs_t reltime, uint32_t flags); - void dumpLocked(const sp<MessageBase>& message); - - Mutex mLock; - Condition mCondition; - MessageList mMessages; - bool mInvalidate; - sp<MessageBase> mInvalidateMessage; -}; - -// --------------------------------------------------------------------------- - -}; // namespace android - -#endif /* ANDROID_MESSAGE_QUEUE_H */ diff --git a/exynos4/hal/libhdmi/libhdmiservice/SecHdmiClient.cpp b/exynos4/hal/libhdmi/libhdmiservice/SecHdmiClient.cpp deleted file mode 100644 index 2e327e6..0000000 --- a/exynos4/hal/libhdmi/libhdmiservice/SecHdmiClient.cpp +++ /dev/null @@ -1,148 +0,0 @@ -/* -** -** Copyright 2008, The Android Open Source Project -** Copyright 2010, 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. -*/ - -/* -** -** @author Taikyung, Yu(taikyung.yu@samsung.com) -** @date 2011-07-06 -*/ - -#define LOG_TAG "libhdmiclient" - -#include "SecHdmiClient.h" - -namespace android { - -static sp<ISecTVOut> g_SecTVOutService = 0; - -SecHdmiClient::SecHdmiClient() -{ - g_SecTVOutService = m_getSecTVOutService(); - mEnable = 0; -} - -SecHdmiClient::~SecHdmiClient() -{ -} - -SecHdmiClient * SecHdmiClient::getInstance(void) -{ - static SecHdmiClient singleton; - return &singleton; -} - -void SecHdmiClient::setHdmiCableStatus(int status) -{ - //ALOGD("%s HDMI status: %d\n", __func__, status); - - if (g_SecTVOutService != 0) - g_SecTVOutService->setHdmiCableStatus(status); -} - -void SecHdmiClient::setHdmiMode(int mode) -{ - //ALOGD("%s HDMI Mode: %d\n", __func__, mode); - - if (g_SecTVOutService != 0) - g_SecTVOutService->setHdmiMode(mode); -} - -void SecHdmiClient::setHdmiResolution(int resolution) -{ - //ALOGD("%s HDMI Resolution: %d\n", __func__, resolution); - - if (g_SecTVOutService != 0) - g_SecTVOutService->setHdmiResolution(resolution); -} - -void SecHdmiClient::setHdmiHdcp(int enHdcp) -{ - //ALOGD("%s HDMI HDCP: %d\n", __func__, enHdcp); - - if (g_SecTVOutService != 0) - g_SecTVOutService->setHdmiHdcp(enHdcp); -} - -void SecHdmiClient::setHdmiRotate(int rotVal, uint32_t hwcLayer) -{ - //ALOGD("%s HDMI ROTATE: %d\n", __func__, rotVal); - - if (g_SecTVOutService != 0) - g_SecTVOutService->setHdmiRotate(rotVal, hwcLayer); -} - -void SecHdmiClient::setHdmiHwcLayer(uint32_t hwcLayer) -{ - //ALOGD("%s HDMI HWCLAYER: %d\n", __func__, hwcLayer); - - if (g_SecTVOutService != 0) - g_SecTVOutService->setHdmiHwcLayer(hwcLayer); -} - -void SecHdmiClient::setHdmiEnable(uint32_t enable) -{ - //ALOGD("%s HDMI ENABLE: %d\n", __func__, enable); - - if (g_SecTVOutService != 0) - mEnable = enable; -} - -void SecHdmiClient::blit2Hdmi(uint32_t w, uint32_t h, - uint32_t colorFormat, - uint32_t physYAddr, - uint32_t physCbAddr, - uint32_t physCrAddr, - uint32_t dstX, - uint32_t dstY, - uint32_t hdmiLayer, - uint32_t num_of_hwc_layer) -{ - if (g_SecTVOutService != 0 && mEnable == 1) - g_SecTVOutService->blit2Hdmi(w, h, colorFormat, physYAddr, physCbAddr, physCrAddr, dstX, dstY, hdmiLayer, num_of_hwc_layer); -} - -sp<ISecTVOut> SecHdmiClient::m_getSecTVOutService(void) -{ - int ret = 0; - - if (g_SecTVOutService == 0) { - sp<IBinder> binder; - sp<ISecTVOut> sc; - sp<IServiceManager> sm = defaultServiceManager(); - int getSvcTimes = 0; - for(getSvcTimes = 0; getSvcTimes < GETSERVICETIMEOUT; getSvcTimes++) { - binder = sm->getService(String16("SecTVOutService")); - if (binder == 0) { - ALOGW("SecTVOutService not published, waiting..."); - usleep(500000); // 0.5 s - } else { - break; - } - } - // grab the lock again for updating g_surfaceFlinger - if (getSvcTimes < GETSERVICETIMEOUT) { - sc = interface_cast<ISecTVOut>(binder); - g_SecTVOutService = sc; - } else { - ALOGW("Failed to get SecTVOutService... SecHdmiClient will get it later.."); - } - } - return g_SecTVOutService; -} - -} diff --git a/exynos4/hal/libhdmi/libhdmiservice/SecHdmiClient.h b/exynos4/hal/libhdmi/libhdmiservice/SecHdmiClient.h deleted file mode 100644 index ebee763..0000000 --- a/exynos4/hal/libhdmi/libhdmiservice/SecHdmiClient.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -** -** Copyright 2008, The Android Open Source Project -** Copyright 2010, 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. -*/ - -/* -** -** @author Taikyung, Yu(taikyung.yu@samsung.com) -** @date 2011-07-06 -*/ - -#ifndef __SEC_HDMI_CLIENT_H__ -#define __SEC_HDMI_CLIENT_H__ - -#include "utils/Log.h" - -#include <linux/errno.h> -#include <stdint.h> -#include <sys/types.h> -#include <utils/RefBase.h> -#include <cutils/log.h> -#include <binder/IBinder.h> -#include <binder/IServiceManager.h> -#include <surfaceflinger/ISurfaceComposer.h> -#include <surfaceflinger/SurfaceComposerClient.h> -#include "ISecTVOut.h" - -#define GETSERVICETIMEOUT (5) - -namespace android { - -class SecHdmiClient -{ -public: - enum HDMI_MODE - { - HDMI_MODE_NONE = 0, - HDMI_MODE_UI, - HDMI_MODE_VIDEO, - }; - -private: - SecHdmiClient(); - virtual ~SecHdmiClient(); - uint32_t mEnable; - -public: - static SecHdmiClient * getInstance(void); - void setHdmiCableStatus(int status); - void setHdmiMode(int mode); - void setHdmiResolution(int resolution); - void setHdmiHdcp(int enHdcp); - void setHdmiRotate(int rotVal, uint32_t hwcLayer); - void setHdmiHwcLayer(uint32_t hwcLayer); - void setHdmiEnable(uint32_t enable); - virtual void blit2Hdmi(uint32_t w, uint32_t h, - uint32_t colorFormat, - uint32_t physYAddr, - uint32_t physCbAddr, - uint32_t physCrAddr, - uint32_t dstX, - uint32_t dstY, - uint32_t hdmiLayer, - uint32_t num_of_hwc_layer); - -private: - sp<ISecTVOut> m_getSecTVOutService(void); - -}; - -}; - -#endif diff --git a/exynos4/hal/libhdmi/libhdmiservice/SecTVOutService.cpp b/exynos4/hal/libhdmi/libhdmiservice/SecTVOutService.cpp deleted file mode 100644 index c0150a3..0000000 --- a/exynos4/hal/libhdmi/libhdmiservice/SecTVOutService.cpp +++ /dev/null @@ -1,387 +0,0 @@ -/* -** -** Copyright 2008, The Android Open Source Project -** Copyright 2010, 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. -*/ - -/* -** -** @author Taikyung, Yu(taikyung.yu@samsung.com) -** @date 2011-07-06 -*/ - -#define LOG_TAG "SecTVOutService" - -#include <binder/IServiceManager.h> -#include <utils/RefBase.h> -#include <binder/IInterface.h> -#include <binder/Parcel.h> -#include <utils/Log.h> -#include "SecTVOutService.h" -#include <linux/fb.h> - -namespace android { -#define DEFAULT_LCD_WIDTH 800 -#define DEFAULT_LCD_HEIGHT 480 - -#define DIRECT_VIDEO_RENDERING (1) -#define DIRECT_UI_RENDERING (0) - - enum { - SET_HDMI_STATUS = IBinder::FIRST_CALL_TRANSACTION, - SET_HDMI_MODE, - SET_HDMI_RESOLUTION, - SET_HDMI_HDCP, - SET_HDMI_ROTATE, - SET_HDMI_HWCLAYER, - BLIT_2_HDMI - }; - - int SecTVOutService::HdmiFlushThread() - { - while (!mExitHdmiFlushThread) { - nsecs_t timeout = -1; - sp<MessageBase> msg = mHdmiEventQueue.waitMessage(timeout); - } - - return 0; - } - - int SecTVOutService::instantiate() - { - ALOGD("SecTVOutService instantiate"); - int r = defaultServiceManager()->addService(String16( "SecTVOutService"), new SecTVOutService ()); - ALOGD("SecTVOutService r=%d", r); - - return r; - } - - SecTVOutService::SecTVOutService () { - ALOGV("SecTVOutService created"); - mHdmiCableInserted = false; -#ifdef SUPPORT_G2D_UI_MODE - mUILayerMode = SecHdmi::HDMI_LAYER_GRAPHIC_1; -#else - mUILayerMode = SecHdmi::HDMI_LAYER_VIDEO; -#endif - mHwcLayer = 0; - mExitHdmiFlushThread = false; - - setLCDsize(); - if (mSecHdmi.create(mLCD_width, mLCD_height) == false) - ALOGE("%s::mSecHdmi.create() fail", __func__); - else - setHdmiStatus(1); - - mHdmiFlushThread = new HDMIFlushThread(this); - } - - void SecTVOutService::setLCDsize(void) { - char const * const device_template[] = { - "/dev/graphics/fb%u", - "/dev/fb%u", - 0 }; - - int fd = -1; - int i = 0; - char name[64]; - - while ((fd==-1) && device_template[i]) { - snprintf(name, 64, device_template[i], 0); - fd = open(name, O_RDWR, 0); - i++; - } - if (fd > 0) { - struct fb_var_screeninfo info; - if (ioctl(fd, FBIOGET_VSCREENINFO, &info) != -1) { - mLCD_width = info.xres; - mLCD_height = info.yres; - } else { - mLCD_width = DEFAULT_LCD_WIDTH; - mLCD_height = DEFAULT_LCD_HEIGHT; - } - close(fd); - } - return; - } - - SecTVOutService::~SecTVOutService () { - ALOGV ("SecTVOutService destroyed"); - - if (mHdmiFlushThread != NULL) { - mHdmiFlushThread->requestExit(); - mExitHdmiFlushThread = true; - mHdmiFlushThread->requestExitAndWait(); - mHdmiFlushThread.clear(); - } - } - - status_t SecTVOutService::onTransact(uint32_t code, const Parcel & data, Parcel * reply, uint32_t flags) - { - switch (code) { - case SET_HDMI_STATUS: { - int status = data.readInt32(); - setHdmiStatus(status); - } break; - - case SET_HDMI_MODE: { - int mode = data.readInt32(); - setHdmiMode(mode); - } break; - - case SET_HDMI_RESOLUTION: { - int resolution = data.readInt32(); - setHdmiResolution(resolution); - } break; - - case SET_HDMI_HDCP: { - int enHdcp = data.readInt32(); - setHdmiHdcp(enHdcp); - } break; - - case SET_HDMI_ROTATE: { - int rotVal = data.readInt32(); - int hwcLayer = data.readInt32(); - setHdmiRotate(rotVal, hwcLayer); - } break; - - case SET_HDMI_HWCLAYER: { - int hwcLayer = data.readInt32(); - setHdmiHwcLayer((uint32_t)hwcLayer); - } break; - - case BLIT_2_HDMI: { - uint32_t w = data.readInt32(); - uint32_t h = data.readInt32(); - uint32_t colorFormat = data.readInt32(); - uint32_t physYAddr = data.readInt32(); - uint32_t physCbAddr = data.readInt32(); - uint32_t physCrAddr = data.readInt32(); - uint32_t dstX = data.readInt32(); - uint32_t dstY = data.readInt32(); - uint32_t hdmiLayer = data.readInt32(); - uint32_t num_of_hwc_layer = data.readInt32(); - - blit2Hdmi(w, h, colorFormat, physYAddr, physCbAddr, physCrAddr, dstX, dstY, hdmiLayer, num_of_hwc_layer); - } break; - - default : - ALOGE ( "onTransact::default"); - return BBinder::onTransact (code, data, reply, flags); - } - - return NO_ERROR; - } - - void SecTVOutService::setHdmiStatus(uint32_t status) - { - - ALOGD("%s HDMI cable status = %d", __func__, status); - { - Mutex::Autolock _l(mLock); - - bool hdmiCableInserted = (bool)status; - - if (mHdmiCableInserted == hdmiCableInserted) - return; - - if (hdmiCableInserted == true) { - if (mSecHdmi.connect() == false) { - ALOGE("%s::mSecHdmi.connect() fail", __func__); - hdmiCableInserted = false; - } - } else { - if (mSecHdmi.disconnect() == false) - ALOGE("%s::mSecHdmi.disconnect() fail", __func__); - } - - mHdmiCableInserted = hdmiCableInserted; - } - - if (hdmiCableInserted() == true) - this->blit2Hdmi(mLCD_width, mLCD_height, HAL_PIXEL_FORMAT_BGRA_8888, 0, 0, 0, 0, 0, HDMI_MODE_UI, 0); - } - - void SecTVOutService::setHdmiMode(uint32_t mode) - { - ALOGD("%s TV mode = %d", __func__, mode); - Mutex::Autolock _l(mLock); - - if ((hdmiCableInserted() == true) && (mSecHdmi.setHdmiOutputMode(mode)) == false) { - ALOGE("%s::mSecHdmi.setHdmiOutputMode() fail", __func__); - return; - } - } - - void SecTVOutService::setHdmiResolution(uint32_t resolution) - { - //ALOGD("%s TV resolution = %d", __func__, resolution); - Mutex::Autolock _l(mLock); - - if ((hdmiCableInserted() == true) && (mSecHdmi.setHdmiResolution(resolution)) == false) { - ALOGE("%s::mSecHdmi.setHdmiResolution() fail", __func__); - return; - } - } - - void SecTVOutService::setHdmiHdcp(uint32_t hdcp_en) - { - ALOGD("%s TV HDCP = %d", __func__, hdcp_en); - Mutex::Autolock _l(mLock); - - if ((hdmiCableInserted() == true) && (mSecHdmi.setHdcpMode(hdcp_en)) == false) { - ALOGE("%s::mSecHdmi.setHdcpMode() fail", __func__); - return; - } - } - - void SecTVOutService::setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer) - { - //ALOGD("%s TV ROTATE = %d", __func__, rotVal); - Mutex::Autolock _l(mLock); - - if ((hdmiCableInserted() == true) && (mSecHdmi.setUIRotation(rotVal, hwcLayer)) == false) { - ALOGE("%s::mSecHdmi.setUIRotation() fail", __func__); - return; - } - } - - void SecTVOutService::setHdmiHwcLayer(uint32_t hwcLayer) - { - //ALOGD("%s TV HWCLAYER = %d", __func__, hwcLayer); - Mutex::Autolock _l(mLock); - - mHwcLayer = hwcLayer; - return; - } - - void SecTVOutService::blit2Hdmi(uint32_t w, uint32_t h, uint32_t colorFormat, - uint32_t pPhyYAddr, uint32_t pPhyCbAddr, uint32_t pPhyCrAddr, - uint32_t dstX, uint32_t dstY, - uint32_t hdmiMode, - uint32_t num_of_hwc_layer) - { - Mutex::Autolock _l(mLock); - - if (hdmiCableInserted() == false) - return; - - int hdmiLayer = SecHdmi::HDMI_LAYER_VIDEO; -#if defined(CHECK_UI_TIME) || defined(CHECK_VIDEO_TIME) - nsecs_t start, end; -#endif - - sp<MessageBase> msg; - - switch (hdmiMode) { - case HDMI_MODE_UI : - if (mHwcLayer >= 2) - hdmiLayer = SecHdmi::HDMI_LAYER_GRAPHIC_0; - else if (mHwcLayer == 1) - hdmiLayer = SecHdmi::HDMI_LAYER_GRAPHIC_1; - else -#ifdef SUPPORT_G2D_UI_MODE - hdmiLayer = SecHdmi::HDMI_LAYER_GRAPHIC_1; -#else - hdmiLayer = SecHdmi::HDMI_LAYER_VIDEO; -#endif - -#ifdef SUPPORT_G2D_UI_MODE - if (mHwcLayer == 0) { - if (mSecHdmi.clear(SecHdmi::HDMI_LAYER_VIDEO) == false) - ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_VIDEO); - if (mSecHdmi.clear(SecHdmi::HDMI_LAYER_GRAPHIC_0) == false) - ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_GRAPHIC_0); - } -#endif - - if (mUILayerMode != hdmiLayer) { - if (mSecHdmi.clear(mUILayerMode) == false) - ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, mUILayerMode); - } - - mUILayerMode = hdmiLayer; - -#if !defined(BOARD_USES_HDMI_SUBTITLES) - if (mHwcLayer == 0) -#endif -#if (DIRECT_UI_RENDERING == 1) - { -#ifdef CHECK_UI_TIME - start = systemTime(); -#endif - if (mSecHdmi.flush(w, h, colorFormat, pPhyYAddr, pPhyCbAddr, pPhyCrAddr, dstX, dstY, - mUILayerMode, mHwcLayer) == false) - ALOGE("%s::mSecHdmi.flush() on HDMI_MODE_UI fail", __func__); -#ifdef CHECK_UI_TIME - end = systemTime(); - ALOGD("[UI] mSecHdmi.flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start))); -#endif - } -#else - { - msg = new SecHdmiEventMsg(&mSecHdmi, w, h, colorFormat, pPhyYAddr, pPhyCbAddr, pPhyCrAddr, - dstX, dstY, mUILayerMode, mHwcLayer, HDMI_MODE_UI); - - /* post to HdmiEventQueue */ - mHdmiEventQueue.postMessage(msg, 0, 0); - } -#endif - break; - - case HDMI_MODE_VIDEO : -#if !defined(BOARD_USES_HDMI_SUBTITLES) -#ifdef SUPPORT_G2D_UI_MODE - if (mSecHdmi.clear(SecHdmi::HDMI_LAYER_GRAPHIC_0) == false) - ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_GRAPHIC_0); - if (mSecHdmi.clear(SecHdmi::HDMI_LAYER_GRAPHIC_1) == false) - ALOGE("%s::mSecHdmi.clear(%d) fail", __func__, SecHdmi::HDMI_LAYER_GRAPHIC_1); -#endif -#endif - -#if (DIRECT_VIDEO_RENDERING == 1) -#ifdef CHECK_VIDEO_TIME - start = systemTime(); -#endif - if (mSecHdmi.flush(w, h, colorFormat, pPhyYAddr, pPhyCbAddr, pPhyCrAddr, dstX, dstY, - SecHdmi::HDMI_LAYER_VIDEO, mHwcLayer) == false) - ALOGE("%s::mSecHdmi.flush() on HDMI_MODE_VIDEO fail", __func__); -#ifdef CHECK_VIDEO_TIME - end = systemTime(); - ALOGD("[Video] mSecHdmi.flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start))); -#endif -#else - msg = new SecHdmiEventMsg(&mSecHdmi, w, h, colorFormat, pPhyYAddr, pPhyCbAddr, pPhyCrAddr, - dstX, dstY, SecHdmi::HDMI_LAYER_VIDEO, mHwcLayer, HDMI_MODE_VIDEO); - - /* post to HdmiEventQueue */ - mHdmiEventQueue.postMessage(msg, 0, 0); -#endif - break; - - default: - ALOGE("unmatched HDMI_MODE : %d", hdmiMode); - break; - } - - return; - } - - bool SecTVOutService::hdmiCableInserted(void) - { - return mHdmiCableInserted; - } - -} diff --git a/exynos4/hal/libhdmi/libhdmiservice/SecTVOutService.h b/exynos4/hal/libhdmi/libhdmiservice/SecTVOutService.h deleted file mode 100644 index b1048b5..0000000 --- a/exynos4/hal/libhdmi/libhdmiservice/SecTVOutService.h +++ /dev/null @@ -1,174 +0,0 @@ -/* -** -** Copyright 2008, The Android Open Source Project -** Copyright 2010, 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. -*/ - -/* -** -** @author Taikyung, Yu(taikyung.yu@samsung.com) -** @date 2011-07-06 -*/ - -#ifndef SECTVOUTSERVICE_H -#define SECTVOUTSERVICE_H - -#include <stdint.h> -#include <sys/types.h> -#include <binder/Parcel.h> -#include <utils/KeyedVector.h> - -#include "ISecTVOut.h" -#include "SecHdmi.h" -#include "sec_format.h" -#include "sec_utils.h" -#include "MessageQueue.h" - -namespace android { -//#define CHECK_VIDEO_TIME -//#define CHECK_UI_TIME - - class SecTVOutService : public BBinder - { - public : - enum { - HDMI_MODE_NONE = 0, - HDMI_MODE_UI, - HDMI_MODE_VIDEO, - }; - - mutable Mutex mLock; - - class HDMIFlushThread : public Thread { - SecTVOutService *mTVOutService; - public: - HDMIFlushThread(SecTVOutService *service): - Thread(false), - mTVOutService(service) { } - virtual void onFirstRef() { - run("HDMIFlushThread", PRIORITY_URGENT_DISPLAY); - } - virtual bool threadLoop() { - mTVOutService->HdmiFlushThread(); - return false; - } - }; - - sp<HDMIFlushThread> mHdmiFlushThread; - int HdmiFlushThread(); - - mutable MessageQueue mHdmiEventQueue; - bool mExitHdmiFlushThread; - - SecTVOutService(); - static int instantiate (); - virtual status_t onTransact(uint32_t, const Parcel &, Parcel *, uint32_t); - virtual ~SecTVOutService (); - - virtual void setHdmiStatus(uint32_t status); - virtual void setHdmiMode(uint32_t mode); - virtual void setHdmiResolution(uint32_t resolution); - virtual void setHdmiHdcp(uint32_t enHdcp); - virtual void setHdmiRotate(uint32_t rotVal, uint32_t hwcLayer); - virtual void setHdmiHwcLayer(uint32_t hwcLayer); - virtual void blit2Hdmi(uint32_t w, uint32_t h, - uint32_t colorFormat, - uint32_t pPhyYAddr, uint32_t pPhyCbAddr, uint32_t pPhyCrAddr, - uint32_t dstX, uint32_t dstY, - uint32_t hdmiMode, uint32_t num_of_hwc_layer); - bool hdmiCableInserted(void); - void setLCDsize(void); - - private: - SecHdmi mSecHdmi; - bool mHdmiCableInserted; - int mUILayerMode; - uint32_t mLCD_width, mLCD_height; - uint32_t mHwcLayer; - }; - - class SecHdmiEventMsg : public MessageBase { - public: - enum { - HDMI_MODE_NONE = 0, - HDMI_MODE_UI, - HDMI_MODE_VIDEO, - }; - - mutable Mutex mBlitLock; - - SecHdmi *pSecHdmi; - uint32_t mSrcWidth, mSrcHeight; - uint32_t mSrcColorFormat; - uint32_t mSrcYAddr, mSrcCbAddr, mSrcCrAddr; - uint32_t mDstX, mDstY; - uint32_t mHdmiMode; - uint32_t mHdmiLayer, mHwcLayer; - - SecHdmiEventMsg(SecHdmi *SecHdmi, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcColorFormat, - uint32_t srcYAddr, uint32_t srcCbAddr, uint32_t srcCrAddr, - uint32_t dstX, uint32_t dstY, uint32_t hdmiLayer, uint32_t hwcLayer, uint32_t hdmiMode) - : pSecHdmi(SecHdmi), mSrcWidth(srcWidth), mSrcHeight(srcHeight), mSrcColorFormat(srcColorFormat), - mSrcYAddr(srcYAddr), mSrcCbAddr(srcCbAddr), mSrcCrAddr(srcCrAddr), - mDstX(dstX), mDstY(dstY), mHdmiLayer(hdmiLayer), mHwcLayer(hwcLayer), mHdmiMode(hdmiMode) { - } - - virtual bool handler() { - Mutex::Autolock _l(mBlitLock); - bool ret = true; -#if defined(CHECK_UI_TIME) || defined(CHECK_VIDEO_TIME) - nsecs_t start, end; -#endif - - switch (mHdmiMode) { - case HDMI_MODE_UI: -#ifdef CHECK_UI_TIME - start = systemTime(); -#endif - if (pSecHdmi->flush(mSrcWidth, mSrcHeight, mSrcColorFormat, mSrcYAddr, mSrcCbAddr, mSrcCrAddr, - mDstX, mDstY, mHdmiLayer, mHwcLayer) == false) { - ALOGE("%s::pSecHdmi->flush() fail on HDMI_MODE_UI", __func__); - ret = false; - } -#ifdef CHECK_UI_TIME - end = systemTime(); - ALOGD("[UI] pSecHdmi->flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start))); -#endif - break; - case HDMI_MODE_VIDEO: -#ifdef CHECK_VIDEO_TIME - start = systemTime(); -#endif - if (pSecHdmi->flush(mSrcWidth, mSrcHeight, mSrcColorFormat, mSrcYAddr, mSrcCbAddr, mSrcCrAddr, - mDstX, mDstY, mHdmiLayer, mHwcLayer) == false) { - ALOGE("%s::pSecHdmi->flush() fail on HDMI_MODE_VIDEO", __func__); - ret = false; - } -#ifdef CHECK_VIDEO_TIME - end = systemTime(); - ALOGD("[VIDEO] pSecHdmi->flush[end-start] = %ld ms", long(ns2ms(end)) - long(ns2ms(start))); -#endif - break; - default: - ALOGE("Undefined HDMI_MODE"); - ret = false; - break; - } - return ret; - } - }; - -}; -#endif diff --git a/exynos4/hal/libhdmi/libsForhdmi/Android.mk b/exynos4/hal/libhdmi/libsForhdmi/Android.mk deleted file mode 100644 index 237c53c..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/Android.mk +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (C) 2008 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. - -ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),) -include $(all-subdir-makefiles) -endif diff --git a/exynos4/hal/libhdmi/libsForhdmi/libcec/Android.mk b/exynos4/hal/libhdmi/libsForhdmi/libcec/Android.mk deleted file mode 100644 index 9a4b721..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/libcec/Android.mk +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (C) 2008 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. - -ifeq ($(BOARD_USES_HDMI),true) - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := eng - -LOCAL_PRELINK_MODULE := false -LOCAL_SHARED_LIBRARIES := liblog -LOCAL_SRC_FILES := libcec.c - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH) \ - $(LOCAL_PATH)/../../../include - -LOCAL_MODULE := libcec -include $(BUILD_SHARED_LIBRARY) - -endif diff --git a/exynos4/hal/libhdmi/libsForhdmi/libcec/cec.h b/exynos4/hal/libhdmi/libsForhdmi/libcec/cec.h deleted file mode 100644 index 4b0d3af..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/libcec/cec.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _LINUX_CEC_H_ -#define _LINUX_CEC_H_ - -#define CEC_IOC_MAGIC 'c' - -/** - * CEC device request code to set logical address. - */ -#define CEC_IOC_SETLADDR _IOW(CEC_IOC_MAGIC, 0, unsigned int) - -#endif /* _LINUX_CEC_H_ */ diff --git a/exynos4/hal/libhdmi/libsForhdmi/libcec/libcec.c b/exynos4/hal/libhdmi/libsForhdmi/libcec/libcec.c deleted file mode 100644 index e088346..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/libcec/libcec.c +++ /dev/null @@ -1,386 +0,0 @@ -/* -* 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. -*/ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <sys/ioctl.h> -#include <unistd.h> -#include <stdlib.h> -#include <cutils/log.h> - -/* drv. header */ -#include "cec.h" - -#include "libcec.h" - -#define CEC_DEBUG 0 - -/** - * @def CEC_DEVICE_NAME - * Defines simbolic name of the CEC device. - */ -#define CEC_DEVICE_NAME "/dev/CEC" - -static struct { - enum CECDeviceType devtype; - unsigned char laddr; -} laddresses[] = { - { CEC_DEVICE_RECODER, 1 }, - { CEC_DEVICE_RECODER, 2 }, - { CEC_DEVICE_TUNER, 3 }, - { CEC_DEVICE_PLAYER, 4 }, - { CEC_DEVICE_AUDIO, 5 }, - { CEC_DEVICE_TUNER, 6 }, - { CEC_DEVICE_TUNER, 7 }, - { CEC_DEVICE_PLAYER, 8 }, - { CEC_DEVICE_RECODER, 9 }, - { CEC_DEVICE_TUNER, 10 }, - { CEC_DEVICE_PLAYER, 11 }, -}; - -static int CECSetLogicalAddr(unsigned int laddr); - -#ifdef CEC_DEBUG -inline static void CECPrintFrame(unsigned char *buffer, unsigned int size); -#endif - -static int fd = -1; - -/** - * Open device driver and assign CEC file descriptor. - * - * @return If success to assign CEC file descriptor, return 1; otherwise, return 0. - */ -int CECOpen() -{ - int res = 1; - - if (fd != -1) - CECClose(); - - if ((fd = open(CEC_DEVICE_NAME, O_RDWR)) < 0) { - ALOGE("Can't open %s!\n", CEC_DEVICE_NAME); - res = 0; - } - - return res; -} - -/** - * Close CEC file descriptor. - * - * @return If success to close CEC file descriptor, return 1; otherwise, return 0. - */ -int CECClose() -{ - int res = 1; - - if (fd != -1) { - if (close(fd) != 0) { - ALOGE("close() failed!\n"); - res = 0; - } - fd = -1; - } - - return res; -} - -/** - * Allocate logical address. - * - * @param paddr [in] CEC device physical address. - * @param devtype [in] CEC device type. - * - * @return new logical address, or 0 if an arror occured. - */ -int CECAllocLogicalAddress(int paddr, enum CECDeviceType devtype) -{ - unsigned char laddr = CEC_LADDR_UNREGISTERED; - int i = 0; - - if (fd == -1) { - ALOGE("open device first!\n"); - return 0; - } - - if (CECSetLogicalAddr(laddr) < 0) { - ALOGE("CECSetLogicalAddr() failed!\n"); - return 0; - } - - if (paddr == CEC_NOT_VALID_PHYSICAL_ADDRESS) - return CEC_LADDR_UNREGISTERED; - - /* send "Polling Message" */ - while (i < sizeof(laddresses)/sizeof(laddresses[0])) { - if (laddresses[i].devtype == devtype) { - unsigned char _laddr = laddresses[i].laddr; - unsigned char message = ((_laddr << 4) | _laddr); - if (CECSendMessage(&message, 1) != 1) { - laddr = _laddr; - break; - } - } - i++; - } - - if (laddr == CEC_LADDR_UNREGISTERED) { - ALOGE("All LA addresses in use!!!\n"); - return CEC_LADDR_UNREGISTERED; - } - - if (CECSetLogicalAddr(laddr) < 0) { - ALOGE("CECSetLogicalAddr() failed!\n"); - return 0; - } - - /* broadcast "Report Physical Address" */ - unsigned char buffer[5]; - buffer[0] = (laddr << 4) | CEC_MSG_BROADCAST; - buffer[1] = CEC_OPCODE_REPORT_PHYSICAL_ADDRESS; - buffer[2] = (paddr >> 8) & 0xFF; - buffer[3] = paddr & 0xFF; - buffer[4] = devtype; - - if (CECSendMessage(buffer, 5) != 5) { - ALOGE("CECSendMessage() failed!\n"); - return 0; - } - - return laddr; -} - -/** - * Send CEC message. - * - * @param *buffer [in] pointer to buffer address where message located. - * @param size [in] message size. - * - * @return number of bytes written, or 0 if an arror occured. - */ -int CECSendMessage(unsigned char *buffer, int size) -{ - if (fd == -1) { - ALOGE("open device first!\n"); - return 0; - } - - if (size > CEC_MAX_FRAME_SIZE) { - ALOGE("size should not exceed %d\n", CEC_MAX_FRAME_SIZE); - return 0; - } - -#if CEC_DEBUG - ALOGI("CECSendMessage() : "); - CECPrintFrame(buffer, size); -#endif - - return write(fd, buffer, size); -} - -/** - * Receive CEC message. - * - * @param *buffer [in] pointer to buffer address where message will be stored. - * @param size [in] buffer size. - * @param timeout [in] timeout in microseconds. - * - * @return number of bytes received, or 0 if an arror occured. - */ -int CECReceiveMessage(unsigned char *buffer, int size, long timeout) -{ - int bytes = 0; - fd_set rfds; - struct timeval tv; - int retval; - - if (fd == -1) { - ALOGE("open device first!\n"); - return 0; - } - - tv.tv_sec = 0; - tv.tv_usec = timeout; - - FD_ZERO(&rfds); - FD_SET(fd, &rfds); - - retval = select(fd + 1, &rfds, NULL, NULL, &tv); - - if (retval == -1) { - return 0; - } else if (retval) { - bytes = read(fd, buffer, size); -#if CEC_DEBUG - ALOGI("CECReceiveMessage() : size(%d)", bytes); - if(bytes > 0) - CECPrintFrame(buffer, bytes); -#endif - } - - return bytes; -} - -/** - * Set CEC logical address. - * - * @return 1 if success, otherwise, return 0. - */ -int CECSetLogicalAddr(unsigned int laddr) -{ - if (ioctl(fd, CEC_IOC_SETLADDR, &laddr)) { - ALOGE("ioctl(CEC_IOC_SETLA) failed!\n"); - return 0; - } - - return 1; -} - -#if CEC_DEBUG -/** - * Print CEC frame. - */ -void CECPrintFrame(unsigned char *buffer, unsigned int size) -{ - if (size > 0) { - int i; - ALOGI("fsize: %d ", size); - ALOGI("frame: "); - for (i = 0; i < size; i++) - ALOGI("0x%02x ", buffer[i]); - - ALOGI("\n"); - } -} -#endif - -/** - * Check CEC message. - * - * @param opcode [in] pointer to buffer address where message will be stored. - * @param lsrc [in] buffer size. - * - * @return 1 if message should be ignored, otherwise, return 0. - */ -//TODO: not finished -int CECIgnoreMessage(unsigned char opcode, unsigned char lsrc) -{ - int retval = 0; - - /* if a message coming from address 15 (unregistered) */ - if (lsrc == CEC_LADDR_UNREGISTERED) { - switch (opcode) { - case CEC_OPCODE_DECK_CONTROL: - case CEC_OPCODE_PLAY: - retval = 1; - default: - break; - } - } - - return retval; -} - -/** - * Check CEC message. - * - * @param opcode [in] pointer to buffer address where message will be stored. - * @param size [in] message size. - * - * @return 0 if message should be ignored, otherwise, return 1. - */ -//TODO: not finished -int CECCheckMessageSize(unsigned char opcode, int size) -{ - int retval = 1; - - switch (opcode) { - case CEC_OPCODE_REQUEST_ACTIVE_SOURCE: - if (size != 1) - retval = 0; - break; - case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE: - if (size != 2) - retval = 0; - break; - case CEC_OPCODE_PLAY: - case CEC_OPCODE_DECK_CONTROL: - case CEC_OPCODE_SET_MENU_LANGUAGE: - case CEC_OPCODE_ACTIVE_SOURCE: - case CEC_OPCODE_ROUTING_INFORMATION: - case CEC_OPCODE_SET_STREAM_PATH: - if (size != 3) - retval = 0; - break; - case CEC_OPCODE_FEATURE_ABORT: - case CEC_OPCODE_DEVICE_VENDOR_ID: - case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS: - if (size != 4) - retval = 0; - break; - case CEC_OPCODE_ROUTING_CHANGE: - if (size != 5) - retval = 0; - break; - /* CDC - 1.4 */ - case 0xf8: - if (!(size > 5 && size <= 16)) - retval = 0; - break; - default: - break; - } - - return retval; -} - -/** - * Check CEC message. - * - * @param opcode [in] pointer to buffer address where message will be stored. - * @param broadcast [in] broadcast/direct message. - * - * @return 0 if message should be ignored, otherwise, return 1. - */ -//TODO: not finished -int CECCheckMessageMode(unsigned char opcode, int broadcast) -{ - int retval = 1; - - switch (opcode) { - case CEC_OPCODE_REQUEST_ACTIVE_SOURCE: - case CEC_OPCODE_SET_MENU_LANGUAGE: - case CEC_OPCODE_ACTIVE_SOURCE: - if (!broadcast) - retval = 0; - break; - case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS: - case CEC_OPCODE_DECK_CONTROL: - case CEC_OPCODE_PLAY: - case CEC_OPCODE_FEATURE_ABORT: - case CEC_OPCODE_ABORT: - if (broadcast) - retval = 0; - break; - default: - break; - } - - return retval; -} diff --git a/exynos4/hal/libhdmi/libsForhdmi/libcec/libcec.h b/exynos4/hal/libhdmi/libsForhdmi/libcec/libcec.h deleted file mode 100644 index 5bbfc15..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/libcec/libcec.h +++ /dev/null @@ -1,209 +0,0 @@ -/* - * 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 _LIBCEC_H_ -#define _LIBCEC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** Maximum CEC frame size */ -#define CEC_MAX_FRAME_SIZE 16 -/** Not valid CEC physical address */ -#define CEC_NOT_VALID_PHYSICAL_ADDRESS 0xFFFF - -/** CEC broadcast address (as destination address) */ -#define CEC_MSG_BROADCAST 0x0F -/** CEC unregistered address (as initiator address) */ -#define CEC_LADDR_UNREGISTERED 0x0F - -/* - * CEC Messages - */ - -//@{ -/** @name Messages for the One Touch Play Feature */ -#define CEC_OPCODE_ACTIVE_SOURCE 0x82 -#define CEC_OPCODE_IMAGE_VIEW_ON 0x04 -#define CEC_OPCODE_TEXT_VIEW_ON 0x0D -//@} - -//@{ -/** @name Messages for the Routing Control Feature */ -#define CEC_OPCODE_INACTIVE_SOURCE 0x9D -#define CEC_OPCODE_REQUEST_ACTIVE_SOURCE 0x85 -#define CEC_OPCODE_ROUTING_CHANGE 0x80 -#define CEC_OPCODE_ROUTING_INFORMATION 0x81 -#define CEC_OPCODE_SET_STREAM_PATH 0x86 -//@} - -//@{ -/** @name Messages for the Standby Feature */ -#define CEC_OPCODE_STANDBY 0x36 -//@} - -//@{ -/** @name Messages for the One Touch Record Feature */ -#define CEC_OPCODE_RECORD_OFF 0x0B -#define CEC_OPCODE_RECORD_ON 0x09 -#define CEC_OPCODE_RECORD_STATUS 0x0A -#define CEC_OPCODE_RECORD_TV_SCREEN 0x0F -//@} - -//@{ -/** @name Messages for the Timer Programming Feature */ -#define CEC_OPCODE_CLEAR_ANALOGUE_TIMER 0x33 -#define CEC_OPCODE_CLEAR_DIGITAL_TIMER 0x99 -#define CEC_OPCODE_CLEAR_EXTERNAL_TIMER 0xA1 -#define CEC_OPCODE_SET_ANALOGUE_TIMER 0x34 -#define CEC_OPCODE_SET_DIGITAL_TIMER 0x97 -#define CEC_OPCODE_SET_EXTERNAL_TIMER 0xA2 -#define CEC_OPCODE_SET_TIMER_PROGRAM_TITLE 0x67 -#define CEC_OPCODE_TIMER_CLEARED_STATUS 0x43 -#define CEC_OPCODE_TIMER_STATUS 0x35 -//@} - -//@{ -/** @name Messages for the System Information Feature */ -#define CEC_OPCODE_CEC_VERSION 0x9E -#define CEC_OPCODE_GET_CEC_VERSION 0x9F -#define CEC_OPCODE_GIVE_PHYSICAL_ADDRESS 0x83 -#define CEC_OPCODE_GET_MENU_LANGUAGE 0x91 -//#define CEC_OPCODE_POLLING_MESSAGE -#define CEC_OPCODE_REPORT_PHYSICAL_ADDRESS 0x84 -#define CEC_OPCODE_SET_MENU_LANGUAGE 0x32 -//@} - -//@{ -/** @name Messages for the Deck Control Feature */ -#define CEC_OPCODE_DECK_CONTROL 0x42 -#define CEC_OPCODE_DECK_STATUS 0x1B -#define CEC_OPCODE_GIVE_DECK_STATUS 0x1A -#define CEC_OPCODE_PLAY 0x41 -//@} - -//@{ -/** @name Messages for the Tuner Control Feature */ -#define CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS 0x08 -#define CEC_OPCODE_SELECT_ANALOGUE_SERVICE 0x92 -#define CEC_OPCODE_SELECT_DIGITAL_SERVICE 0x93 -#define CEC_OPCODE_TUNER_DEVICE_STATUS 0x07 -#define CEC_OPCODE_TUNER_STEP_DECREMENT 0x06 -#define CEC_OPCODE_TUNER_STEP_INCREMENT 0x05 -//@} - -//@{ -/** @name Messages for the Vendor Specific Commands Feature */ -#define CEC_OPCODE_DEVICE_VENDOR_ID 0x87 -#define CEC_OPCODE_GET_DEVICE_VENDOR_ID 0x8C -#define CEC_OPCODE_VENDOR_COMMAND 0x89 -#define CEC_OPCODE_VENDOR_COMMAND_WITH_ID 0xA0 -#define CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN 0x8A -#define CEC_OPCODE_VENDOR_REMOVE_BUTTON_UP 0x8B -//@} - -//@{ -/** @name Messages for the OSD Display Feature */ -#define CEC_OPCODE_SET_OSD_STRING 0x64 -//@} - -//@{ -/** @name Messages for the Device OSD Transfer Feature */ -#define CEC_OPCODE_GIVE_OSD_NAME 0x46 -#define CEC_OPCODE_SET_OSD_NAME 0x47 -//@} - -//@{ -/** @name Messages for the Device Menu Control Feature */ -#define CEC_OPCODE_MENU_REQUEST 0x8D -#define CEC_OPCODE_MENU_STATUS 0x8E -#define CEC_OPCODE_USER_CONTROL_PRESSED 0x44 -#define CEC_OPCODE_USER_CONTROL_RELEASED 0x45 -//@} - -//@{ -/** @name Messages for the Remote Control Passthrough Feature */ -//@} - -//@{ -/** @name Messages for the Power Status Feature */ -#define CEC_OPCODE_GIVE_DEVICE_POWER_STATUS 0x8F -#define CEC_OPCODE_REPORT_POWER_STATUS 0x90 -//@} - -//@{ -/** @name Messages for General Protocol messages */ -#define CEC_OPCODE_FEATURE_ABORT 0x00 -#define CEC_OPCODE_ABORT 0xFF -//@} - -//@{ -/** @name Messages for the System Audio Control Feature */ -#define CEC_OPCODE_GIVE_AUDIO_STATUS 0x71 -#define CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS 0x7D -#define CEC_OPCODE_REPORT_AUDIO_STATUS 0x7A -#define CEC_OPCODE_SET_SYSTEM_AUDIO_MODE 0x72 -#define CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST 0x70 -#define CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS 0x7E -//@} - -//@{ -/** @name Messages for the Audio Rate Control Feature */ -#define CEC_OPCODE_SET_AUDIO_RATE 0x9A -//@} - -//@{ -/** @name CEC Operands */ - -//TODO: not finished - -#define CEC_DECK_CONTROL_MODE_STOP 0x03 -#define CEC_PLAY_MODE_PLAY_FORWARD 0x24 -//@} - -/** - * @enum CECDeviceType - * Type of CEC device - */ -enum CECDeviceType { - /** TV */ - CEC_DEVICE_TV, - /** Recording Device */ - CEC_DEVICE_RECODER, - /** Tuner */ - CEC_DEVICE_TUNER, - /** Playback Device */ - CEC_DEVICE_PLAYER, - /** Audio System */ - CEC_DEVICE_AUDIO, -}; - -int CECOpen(); -int CECClose(); -int CECAllocLogicalAddress(int paddr, enum CECDeviceType devtype); -int CECSendMessage(unsigned char *buffer, int size); -int CECReceiveMessage(unsigned char *buffer, int size, long timeout); - -int CECIgnoreMessage(unsigned char opcode, unsigned char lsrc); -int CECCheckMessageSize(unsigned char opcode, int size); -int CECCheckMessageMode(unsigned char opcode, int broadcast); - -#ifdef __cplusplus -} -#endif - -#endif /* _LIBCEC_H_ */ diff --git a/exynos4/hal/libhdmi/libsForhdmi/libddc/Android.mk b/exynos4/hal/libhdmi/libsForhdmi/libddc/Android.mk deleted file mode 100644 index 38891be..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/libddc/Android.mk +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (C) 2008 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. - -ifeq ($(BOARD_USES_HDMI),true) - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := eng - -LOCAL_PRELINK_MODULE := false -LOCAL_SHARED_LIBRARIES := liblog -LOCAL_SRC_FILES := libddc.c - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH) \ - $(LOCAL_PATH)/../../../include - -ifeq ($(BOARD_HDMI_DDC_CH), DDC_CH_I2C_7) -LOCAL_CFLAGS += -DDDC_CH_I2C_7 -endif - -ifeq ($(BOARD_HDMI_DDC_CH), DDC_CH_I2C_1) -LOCAL_CFLAGS += -DDDC_CH_I2C_1 -endif - -ifeq ($(BOARD_HDMI_DDC_CH), DDC_CH_I2C_2) -LOCAL_CFLAGS += -DDDC_CH_I2C_2 -endif - -LOCAL_MODULE := libddc -include $(BUILD_SHARED_LIBRARY) - -endif diff --git a/exynos4/hal/libhdmi/libsForhdmi/libddc/libddc.c b/exynos4/hal/libhdmi/libsForhdmi/libddc/libddc.c deleted file mode 100644 index d283b6a..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/libddc/libddc.c +++ /dev/null @@ -1,285 +0,0 @@ -/* -* 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. -*/ - -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <sys/ioctl.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> - -#include <linux/i2c.h> -#include <cutils/log.h> -#include "i2c-dev.h" - -#include "libddc.h" - -#define DDC_DEBUG 0 - -/** - * @brief DDC device name. - * User should change this. - */ -#ifdef DDC_CH_I2C_1 -#define DEV_NAME "/dev/i2c-1" -#endif - -#ifdef DDC_CH_I2C_2 -#define DEV_NAME "/dev/i2c-2" -#endif - -#ifdef DDC_CH_I2C_7 -#define DEV_NAME "/dev/i2c-7" -#endif - -/** - * DDC file descriptor - */ -static int ddc_fd = -1; - -/** - * Reference count of DDC file descriptor - */ -static unsigned int ref_cnt = 0; - -/** - * Check if DDC file is already opened or not - * @return If DDC file is already opened, return 1; Otherwise, return 0. - */ -static int DDCFileAvailable() -{ - return (ddc_fd < 0) ? 0 : 1; -} - -/** - * Initialze DDC library. Open DDC device - * @return If succeed in opening DDC device or it is already opened, return 1;@n - * Otherwise, return 0. - */ -int DDCOpen() -{ - int ret = 1; - - // check already open?? - if (ref_cnt > 0) { - ref_cnt++; - return 1; - } - - // open - if ((ddc_fd = open(DEV_NAME,O_RDWR)) < 0) { - ALOGE("%s: Cannot open I2C_DDC : %s",__func__, DEV_NAME); - ret = 0; - } - - ref_cnt++; - return ret; -} - -/** - * Finalize DDC library. Close DDC device - * @return If succeed in closing DDC device or it is being used yet, return 1;@n - * Otherwise, return 0. - */ -int DDCClose() -{ - int ret = 1; - // check if fd is available - if (ref_cnt == 0) { -#if DDC_DEBUG - ALOGE("%s: I2C_DDC is not available!!!!", __func__); -#endif - return 1; - } - - // close - if (ref_cnt > 1) { - ref_cnt--; - return 1; - } - - if (close(ddc_fd) < 0) { -#if DDC_DEBUG - ALOGE("%s: Cannot close I2C_DDC : %s",__func__,DEV_NAME); -#endif - ret = 0; - } - - ref_cnt--; - ddc_fd = -1; - - return ret; -} - -/** - * Read data though DDC. For more information of DDC, refer DDC Spec. - * @param addr [in] Device address - * @param offset [in] Byte offset - * @param size [in] Sizes of data - * @param buffer [out] Pointer to buffer to store data - * @return If succeed in reading, return 1; Otherwise, return 0. - */ -int DDCRead(unsigned char addr, unsigned char offset, - unsigned int size, unsigned char* buffer) -{ - struct i2c_rdwr_ioctl_data msgset; - struct i2c_msg msgs[2]; - int ret = 1; - - if (!DDCFileAvailable()) { -#if DDC_DEBUG - ALOGE("%s: I2C_DDC is not available!!!!", __func__); -#endif - return 0; - } - - // set offset - msgs[0].addr = addr>>1; - msgs[0].flags = 0; - msgs[0].len = 1; - msgs[0].buf = &offset; - - // read data - msgs[1].addr = addr>>1; - msgs[1].flags = I2C_M_RD; - msgs[1].len = size; - msgs[1].buf = buffer; - - // set rdwr ioctl data - msgset.nmsgs = 2; - msgset.msgs = msgs; - - // i2c fast read - if ((ret = ioctl(ddc_fd, I2C_RDWR, &msgset)) < 0) { - perror("ddc error:"); - ret = 0; - } - - return ret; -} - -/** - * Read data though E-DDC. For more information of E-DDC, refer E-DDC Spec. - * @param segpointer [in] Segment pointer - * @param segment [in] Segment number - * @param addr [in] Device address - * @param offset [in] Byte offset - * @param size [in] Sizes of data - * @param buffer [out] Pointer to buffer to store data - * @return If succeed in reading, return 1; Otherwise, return 0. - */ - -int EDDCRead(unsigned char segpointer, unsigned char segment, unsigned char addr, - unsigned char offset, unsigned int size, unsigned char* buffer) -{ - struct i2c_rdwr_ioctl_data msgset; - struct i2c_msg msgs[3]; - int ret = 1; - - if (!DDCFileAvailable()) { -#if DDC_DEBUG - ALOGE("%s: I2C_DDC is not available!!!!", __func__); -#endif - return 0; - } - - // set segment pointer - msgs[0].addr = segpointer>>1; - // ignore ack only if segment is "0" - if (segment == 0) - msgs[0].flags = I2C_M_IGNORE_NAK; - else - msgs[0].flags = 0; - - msgs[0].len = 1; - msgs[0].buf = &segment; - - // set offset - msgs[1].addr = addr>>1; - msgs[1].flags = 0; - msgs[1].len = 1; - msgs[1].buf = &offset; - - // read data - msgs[2].addr = addr>>1; - msgs[2].flags = I2C_M_RD; - msgs[2].len = size; - msgs[2].buf = buffer; - - msgset.nmsgs = 3; - msgset.msgs = msgs; - - // eddc read - if (ioctl(ddc_fd, I2C_RDWR, &msgset) < 0) { -#if DDC_DEBUG - ALOGE("%s: ioctl(I2C_RDWR) failed!!!", __func__); -#endif - ret = 0; - } - return ret; -} - -/** - * Write data though DDC. For more information of DDC, refer DDC Spec. - * @param addr [in] Device address - * @param offset [in] Byte offset - * @param size [in] Sizes of data - * @param buffer [out] Pointer to buffer to write - * @return If succeed in writing, return 1; Otherwise, return 0. - */ -int DDCWrite(unsigned char addr, unsigned char offset, unsigned int size, unsigned char* buffer) -{ - unsigned char* temp; - int bytes; - int retval = 0; - - // allocate temporary buffer - temp = (unsigned char*) malloc((size+1)*sizeof(unsigned char)); - if (!temp) { - ALOGE("%s: not enough resources at %s", __FUNCTION__); - goto exit; - } - - temp[0] = offset; - memcpy(temp+1,buffer,size); - - if (!DDCFileAvailable()) { - ALOGE("%s: I2C_DDC is not available!!!!", __func__); - goto exit; - } - - if (ioctl(ddc_fd, I2C_SLAVE, addr>>1) < 0) { - ALOGE("%s: cannot set slave address 0x%02x", __func__,addr); - goto exit; - } - - // write temp buffer - if ((bytes = write(ddc_fd,temp,size+1)) != (size+1)) { - ALOGE("%s: fail to write %d bytes, only write %d bytes",__func__, size, bytes); - goto exit; - } - - retval = 1; - -exit: - // free temp buffer - if (temp) - free(temp); - - return retval; -} diff --git a/exynos4/hal/libhdmi/libsForhdmi/libddc/libddc.h b/exynos4/hal/libhdmi/libsForhdmi/libddc/libddc.h deleted file mode 100644 index 368855b..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/libddc/libddc.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 _LIBDDC_H_ -#define _LIBDDC_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -int DDCOpen(); -int DDCRead(unsigned char addr, unsigned char offset, unsigned int size, unsigned char* buffer); -int DDCWrite(unsigned char addr, unsigned char offset, unsigned int size, unsigned char* buffer); -int EDDCRead(unsigned char segpointer, unsigned char segment, unsigned char addr, - unsigned char offset, unsigned int size, unsigned char* buffer); -int DDCClose(); - -#ifdef __cplusplus -} -#endif - -#endif /* _LIBDDC_H_ */ diff --git a/exynos4/hal/libhdmi/libsForhdmi/libedid/Android.mk b/exynos4/hal/libhdmi/libsForhdmi/libedid/Android.mk deleted file mode 100644 index 602ae4d..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/libedid/Android.mk +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2008 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. - -ifeq ($(BOARD_USES_HDMI),true) - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := eng - -LOCAL_PRELINK_MODULE := false -LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES) -LOCAL_SHARED_LIBRARIES := liblog libddc -LOCAL_SRC_FILES := libedid.c - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH) \ - $(LOCAL_PATH)/../../../include - -LOCAL_MODULE := libedid -include $(BUILD_SHARED_LIBRARY) - -endif diff --git a/exynos4/hal/libhdmi/libsForhdmi/libedid/edid.h b/exynos4/hal/libhdmi/libsForhdmi/libedid/edid.h deleted file mode 100644 index aea1309..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/libedid/edid.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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 _EDID_H_ -#define _EDID_H_ - -//@{ -/** - * @name EDID Addresses - */ -#define EDID_ADDR (0xA0) -#define EDID_SEGMENT_POINTER (0x60) -//@} - -//@{ -/** - * @name EDID offset and bit values - */ -#define SIZEOFBYTE (8) -#define SIZEOFEDIDBLOCK (0x80) -#define EDID_EXTENSION_NUMBER_POS (0x7E) - -#define EDID_TIMING_EXT_TAG_ADDR_POS (0) -#define EDID_TIMING_EXT_REV_NUMBER_POS (1) -#define EDID_DETAILED_TIMING_OFFSET_POS (2) -#define EDID_DATA_BLOCK_START_POS (4) - -// for Extension Data Block -#define EDID_TIMING_EXT_TAG_VAL (0x02) -#define EDID_BLOCK_MAP_EXT_TAG_VAL (0xF0) - -#define EDID_SHORT_AUD_DEC_TAG_VAL (1<<5) -#define EDID_SHORT_VID_DEC_TAG_VAL (2<<5) -#define EDID_VSDB_TAG_VAL (3<<5) -#define EDID_SPEAKER_ALLOCATION_TAG_VAL (4<<5) -#define EDID_VESA_DTC_TAG_VAL (5<<5) -#define EDID_RESERVED_TAG_VAL (6<<5) - -#define EDID_EXTENDED_TAG_VAL (7<<5) -#define EDID_EXTENDED_COLORIMETRY_VAL (5) -#define EDID_EXTENDED_COLORIMETRY_BLOCK_LEN (3) - -#define EDID_TAG_CODE_MASK (1<<7 | 1<<6 | 1<<5) -#define EDID_DATA_BLOCK_SIZE_MASK (1<<4 | 1<<3 | 1<<2 | 1<<1 | 1<<0) - -#define EDID_VSDB_MIN_LENGTH_VAL (5) - -// for Established Timings -#define EDID_ET_POS (0x23) -#define EDID_ET_640x480p_VAL (0x20) - -// for DTD -#define EDID_DTD_START_ADDR (0x36) -#define EDID_DTD_BYTE_LENGTH (18) -#define EDID_DTD_TOTAL_LENGTH (EDID_DTD_BYTE_LENGTH*4) - -#define EDID_DTD_PIXELCLOCK_POS1 (0) -#define EDID_DTD_PIXELCLOCK_POS2 (1) - -#define EDID_DTD_HBLANK_POS1 (3) -#define EDID_DTD_HBLANK_POS2 (4) -#define EDID_DTD_HBLANK_POS2_MASK (0xF) - -#define EDID_DTD_HACTIVE_POS1 (2) -#define EDID_DTD_HACTIVE_POS2 (4) -#define EDID_DTD_HACTIVE_POS2_MASK (0xF0) - -#define EDID_DTD_VBLANK_POS1 (6) -#define EDID_DTD_VBLANK_POS2 (7) -#define EDID_DTD_VBLANK_POS2_MASK (0x0F) - -#define EDID_DTD_VACTIVE_POS1 (5) -#define EDID_DTD_VACTIVE_POS2 (7) -#define EDID_DTD_VACTIVE_POS2_MASK (0xF0) - -#define EDID_DTD_INTERLACE_POS (17) -#define EDID_DTD_INTERLACE_MASK (1<<7) - -// for SVD -#define EDID_SVD_VIC_MASK (0x7F) - -// for CS -#define EDID_COLOR_SPACE_POS (3) -#define EDID_YCBCR444_CS_MASK (1<<5) -#define EDID_YCBCR422_CS_MASK (1<<4) - -// for Color Depth -#define EDID_DC_48_VAL (1<<6) -#define EDID_DC_36_VAL (1<<5) -#define EDID_DC_30_VAL (1<<4) -#define EDID_DC_YCBCR_VAL (1<<3) - -#define EDID_DC_POS (6) -#define EDID_DC_MASK (EDID_DC_48_VAL | EDID_DC_36_VAL| EDID_DC_30_VAL | EDID_DC_YCBCR_VAL) - -// for colorimetry -#define EDID_XVYCC601_MASK (1<<0) -#define EDID_XVYCC709_MASK (1<<1) -#define EDID_EXTENDED_MASK (1<<0|1<<1|1<<2) - -// for SAD -#define SHORT_AUD_DESCRIPTOR_LPCM (1<<0) -#define SHORT_AUD_DESCRIPTOR_AC3 (1<<1) -#define SHORT_AUD_DESCRIPTOR_MPEG1 (1<<2) -#define SHORT_AUD_DESCRIPTOR_MP3 (1<<3) -#define SHORT_AUD_DESCRIPTOR_MPEG2 (1<<4) -#define SHORT_AUD_DESCRIPTOR_AAC (1<<5) -#define SHORT_AUD_DESCRIPTOR_DTS (1<<6) -#define SHORT_AUD_DESCRIPTOR_ATRAC (1<<7) - -#define EDID_SAD_CODE_MASK (1<<6 | 1<<5 | 1<<4 | 1<<3) -#define EDID_SAD_CHANNEL_MASK (1<<2 | 1<<1 | 1<<0) -#define EDID_SAD_192KHZ_MASK (1<<6) -#define EDID_SAD_176KHZ_MASK (1<<5) -#define EDID_SAD_96KHZ_MASK (1<<4) -#define EDID_SAD_88KHZ_MASK (1<<3) -#define EDID_SAD_48KHZ_MASK (1<<2) -#define EDID_SAD_44KHZ_MASK (1<<1) -#define EDID_SAD_32KHZ_MASK (1<<0) - -#define EDID_SAD_WORD_24_MASK (1<<2) -#define EDID_SAD_WORD_20_MASK (1<<1) -#define EDID_SAD_WORD_16_MASK (1<<0) - -// for CEC -#define EDID_CEC_PHYICAL_ADDR (4) - -// for 3D -#define EDID_HDMI_EXT_POS (8) -#define EDID_HDMI_VIDEO_PRESENT_MASK (1<<5) - -// latency -#define EDID_HDMI_LATENCY_MASK (1<<7|1<<6) -#define EDID_HDMI_LATENCY_POS (6) - -#define EDID_HDMI_3D_PRESENT_POS (13) -#define EDID_HDMI_3D_PRESENT_MASK (1<<7) -#define EDID_HDMI_3D_MULTI_PRESENT_MASK (1<<6 | 1<<5) -#define EDID_HDMI_3D_MULTI_PRESENT_BIT 5 - -#define EDID_3D_STRUCTURE_ONLY_EXIST (1<<5) -#define EDID_3D_STRUCTURE_MASK_EXIST (1<<6) - -#define EDID_3D_STRUCTURE_FP (0) -#define EDID_3D_STRUCTURE_FA (1) -#define EDID_3D_STRUCTURE_LA (2) -#define EDID_3D_STRUCTURE_SSF (3) -#define EDID_3D_STRUCTURE_LD (4) -#define EDID_3D_STRUCTURE_LDGFX (5) -#define EDID_3D_STRUCTURE_TB (6) -#define EDID_3D_STRUCTURE_SSH (8) - -#define EDID_HDMI_EXT_LENGTH_POS (14) -#define EDID_HDMI_VSDB_VIC_LEN_BIT (5) -#define EDID_HDMI_VSDB_VIC_LEN_MASK (1<<7|1<<6|1<<5) -#define EDID_HDMI_VSDB_3D_LEN_MASK (1<<4|1<<3|1<<2|1<<1|1<<0) - -#define EDID_HDMI_2D_VIC_ORDER_MASK (1<<7|1<<6|1<<5|1<<4) -#define EDID_HDMI_3D_STRUCTURE_MASK (1<<3|1<<2|1<<1|1<<0) - -// for MAX TMDS -#define EDID_MAX_TMDS_POS (7) - -// for 3D Structure -#define NUM_OF_VIC_FOR_3D 16 -//@} - -#endif /* _EDID_H_ */ diff --git a/exynos4/hal/libhdmi/libsForhdmi/libedid/libedid.c b/exynos4/hal/libhdmi/libsForhdmi/libedid/libedid.c deleted file mode 100644 index 7a81913..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/libedid/libedid.c +++ /dev/null @@ -1,1262 +0,0 @@ -/* -* 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. -*/ - -#include <stdio.h> -#include <string.h> -#include <stdlib.h> - -#include <cutils/log.h> - -#include "edid.h" -#include "libedid.h" -#include "../libddc/libddc.h" - -//#define EDID_DEBUG 1 - -#ifdef EDID_DEBUG -#define DPRINTF(args...) ALOGI(args) -#else -#define DPRINTF(args...) -#endif - -#define NUM_OF_VIC_FOR_3D 16 - -/** - * @var gEdidData - * Pointer to EDID data - */ -static unsigned char* gEdidData; - -/** - * @var gExtensions - * Number of EDID extensions - */ -static int gExtensions; - - -/** - * @var aVIC - * This contains first 16 VIC in EDID - */ -static unsigned char aVIC[NUM_OF_VIC_FOR_3D]; - -//! Structure for parsing video timing parameter in EDID -static const struct edid_params { - /** H Total */ - unsigned int HTotal; - - /** H Blank */ - unsigned int HBlank; - - /** V Total */ - unsigned int VTotal; - - /** V Blank */ - unsigned int VBlank; - - /** CEA VIC */ - unsigned char VIC; - - /** CEA VIC for 16:9 aspect ratio */ - unsigned char VIC16_9; - - /** 0 if progressive, 1 if interlaced */ - unsigned char interlaced; - - /** Pixel frequency */ - enum PixelFreq PixelClock; -} aVideoParams[] = -{ - { 800 , 160 , 525 , 45, 1 , 1 , 0, PIXEL_FREQ_25_200 ,}, // v640x480p_60Hz - { 858 , 138 , 525 , 45, 2 , 3 , 0, PIXEL_FREQ_27_027 ,}, // v720x480p_60Hz - { 1650, 370 , 750 , 30, 4 , 4 , 0, PIXEL_FREQ_74_250 ,}, // v1280x720p_60Hz - { 2200, 280 , 1125, 22, 5 , 5 , 1, PIXEL_FREQ_74_250 ,}, // v1920x1080i_60H - { 1716, 276 , 525 , 22, 6 , 7 , 1, PIXEL_FREQ_74_250 ,}, // v720x480i_60Hz - { 1716, 276 , 262 , 22, 8 , 9 , 0, PIXEL_FREQ_27_027 ,}, // v720x240p_60Hz - //{ 1716, 276 , 263 , 23, 8 , 9 , 0, PIXEL_FREQ_27_027 , }, // v720x240p_60Hz(mode 2) - { 3432, 552 , 525 , 22, 10, 11, 1, PIXEL_FREQ_54_054 , }, // v2880x480i_60Hz - { 3432, 552 , 262 , 22, 12, 13, 0, PIXEL_FREQ_54_054 , }, // v2880x240p_60Hz - //{ 3432, 552 , 263 , 23, 12, 13, 0, PIXEL_FREQ_54_054 , }, // v2880x240p_60Hz(mode 2) - { 1716, 276 , 525 , 45, 14, 15, 0, PIXEL_FREQ_54_054 , }, // v1440x480p_60Hz - { 2200, 280 , 1125, 45, 16, 16, 0, PIXEL_FREQ_148_500, }, // v1920x1080p_60H - { 864 , 144 , 625 , 49, 17, 18, 0, PIXEL_FREQ_27 , }, // v720x576p_50Hz - { 1980, 700 , 750 , 30, 19, 19, 0, PIXEL_FREQ_74_250 , }, // v1280x720p_50Hz - { 2640, 720 , 1125, 22, 20, 20, 1, PIXEL_FREQ_74_250 , }, // v1920x1080i_50H - { 1728, 288 , 625 , 24, 21, 22, 1, PIXEL_FREQ_27 , }, // v720x576i_50Hz - { 1728, 288 , 312 , 24, 23, 24, 0, PIXEL_FREQ_27 , }, // v720x288p_50Hz - //{ 1728, 288 , 313 , 25, 23, 24, 0, PIXEL_FREQ_27 , }, // v720x288p_50Hz(mode 2) - //{ 1728, 288 , 314 , 26, 23, 24, 0, PIXEL_FREQ_27 , }, // v720x288p_50Hz(mode 3) - { 3456, 576 , 625 , 24, 25, 26, 1, PIXEL_FREQ_54 , }, // v2880x576i_50Hz - { 3456, 576 , 312 , 24, 27, 28, 0, PIXEL_FREQ_54 , }, // v2880x288p_50Hz - //{ 3456, 576 , 313 , 25, 27, 28, 0, PIXEL_FREQ_54 , }, // v2880x288p_50Hz(mode 2) - //{ 3456, 576 , 314 , 26, 27, 28, 0, PIXEL_FREQ_54 , }, // v2880x288p_50Hz(mode 3) - { 1728, 288 , 625 , 49, 29, 30, 0, PIXEL_FREQ_54 , }, // v1440x576p_50Hz - { 2640, 720 , 1125, 45, 31, 31, 0, PIXEL_FREQ_148_500,}, // v1920x1080p_50Hz - { 2750, 830 , 1125, 45, 32, 32, 0, PIXEL_FREQ_74_250 ,}, // v1920x1080p_24Hz - { 2640, 720 , 1125, 45, 33, 33, 0, PIXEL_FREQ_74_250 ,}, // v1920x1080p_25Hz - { 2200, 280 , 1125, 45, 34, 34, 0, PIXEL_FREQ_74_250 ,}, // v1920x1080p_30Hz - { 3432, 552 , 525 , 45, 35, 36, 0, PIXEL_FREQ_108_108,}, // v2880x480p_60Hz - { 3456, 576 , 625 , 49, 37, 38, 0, PIXEL_FREQ_108 ,}, // v2880x576p_50Hz - { 2304, 384 , 1250, 85, 39, 39, 1, PIXEL_FREQ_72 ,}, // v1920x1080i_50Hz(1250) - { 2640, 720 , 1125, 22, 40, 40, 1, PIXEL_FREQ_148_500, }, // v1920x1080i_100Hz - { 1980, 700 , 750 , 30, 41, 41, 0, PIXEL_FREQ_148_500, }, // v1280x720p_100Hz - { 864 , 144 , 625 , 49, 42, 43, 0, PIXEL_FREQ_54 , }, // v720x576p_100Hz - { 1728, 288 , 625 , 24, 44, 45, 1, PIXEL_FREQ_54 , }, // v720x576i_100Hz - { 2200, 280 , 1125, 22, 46, 46, 1, PIXEL_FREQ_148_500, }, // v1920x1080i_120Hz - { 1650, 370 , 750 , 30, 47, 47, 0, PIXEL_FREQ_148_500, }, // v1280x720p_120Hz - { 858 , 138 , 525 , 54, 48, 49, 0, PIXEL_FREQ_54_054 , }, // v720x480p_120Hz - { 1716, 276 , 525 , 22, 50, 51, 1, PIXEL_FREQ_54_054 , }, // v720x480i_120Hz - { 864 , 144 , 625 , 49, 52, 53, 0, PIXEL_FREQ_108 , }, // v720x576p_200Hz - { 1728, 288 , 625 , 24, 54, 55, 1, PIXEL_FREQ_108 , }, // v720x576i_200Hz - { 858 , 138 , 525 , 45, 56, 57, 0, PIXEL_FREQ_108_108, }, // v720x480p_240Hz - { 1716, 276 , 525 , 22, 58, 59, 1, PIXEL_FREQ_108_108, }, // v720x480i_240Hz - // PHY Freq is not available yet - //{ 3300, 2020, 750 , 30, 60, 60, 0, PIXEL_FREQ_59_400 ,}, // v1280x720p24Hz - { 3960, 2680, 750 , 30, 61, 61, 0, PIXEL_FREQ_74_250 , }, // v1280x720p25Hz - { 3300, 2020, 750 , 30, 62, 62, 0, PIXEL_FREQ_74_250 ,}, // v1280x720p30Hz - // PHY Freq is not available yet - //{ 2200, 280 , 1125, 45, 63, 63, 0, PIXEL_FREQ_297, }, // v1920x1080p120Hz - //{ 2640, 720 , 1125, 45, 64, 64, 0, PIXEL_FREQ_297, }, // v1920x1080p100Hz - //{ 4400, 560 , 2250, 90, 1, 1, 0, 0, PIXEL_FREQ_297, }, // v4Kx2K30Hz -}; - -//! Structure for Checking 3D Mandatory Format in EDID -static const struct edid_3d_mandatory { - /** video Format */ - enum VideoFormat resolution; - - /** 3D Structure */ - enum HDMI3DVideoStructure hdmi_3d_format; -} edid_3d [] = -{ - { v1920x1080p_24Hz, HDMI_3D_FP_FORMAT }, // 1920x1080p @ 23.98/24Hz - { v1280x720p_60Hz, HDMI_3D_FP_FORMAT }, // 1280x720p @ 59.94/60Hz - { v1920x1080i_60Hz, HDMI_3D_SSH_FORMAT }, // 1920x1080i @ 59.94/60Hz - { v1920x1080p_24Hz, HDMI_3D_TB_FORMAT }, // 1920x1080p @ 23.98/24Hz - { v1280x720p_60Hz, HDMI_3D_TB_FORMAT }, // 1280x720p @ 59.94/60Hz - { v1280x720p_50Hz, HDMI_3D_FP_FORMAT }, // 1280x720p @ 50Hz - { v1920x1080i_50Hz, HDMI_3D_SSH_FORMAT }, // 1920x1080i @ 50Hz - { v1280x720p_50Hz, HDMI_3D_TB_FORMAT }, // 1280x720p @ 50Hz -}; - -/** - * Calculate a checksum. - * - * @param buffer [in] Pointer to data to calculate a checksum - * @param size [in] Sizes of data - * - * @return If checksum result is 0, return 1; Otherwise, return 0. - */ -static int CalcChecksum(const unsigned char* const buffer, const int size) -{ - unsigned char i,sum; - int ret = 1; - - // check parameter - if (buffer == NULL ) { - DPRINTF("invalid parameter : buffer\n"); - return 0; - } - for (sum = 0, i = 0 ; i < size; i++) - sum += buffer[i]; - - // check checksum - if (sum != 0) - ret = 0; - - return ret; -} - -/** - * Read EDID Block(128 bytes) - * - * @param blockNum [in] Number of block to read @n - * For example, EDID block = 0, EDID first Extension = 1, and so on. - * @param outBuffer [out] Pointer to buffer to store EDID data - * - * @return If fail to read, return 0; Otherwise, return 1. - */ -static int ReadEDIDBlock(const unsigned int blockNum, unsigned char* const outBuffer) -{ - int segNum, offset, dataPtr; - - // check parameter - if (outBuffer == NULL) { - DPRINTF("invalid parameter : outBuffer\n"); - return 0; - } - - // calculate - segNum = blockNum / 2; - offset = (blockNum % 2) * SIZEOFEDIDBLOCK; - dataPtr = (blockNum) * SIZEOFEDIDBLOCK; - - // read block - if (!EDDCRead(EDID_SEGMENT_POINTER, segNum, EDID_ADDR, offset, SIZEOFEDIDBLOCK, outBuffer)) { - DPRINTF("Fail to Read %dth EDID Block\n", blockNum); - return 0; - } - - if (!CalcChecksum(outBuffer, SIZEOFEDIDBLOCK)) { - DPRINTF("CheckSum fail : %dth EDID Block\n", blockNum); - return 0; - } - - // print data -#ifdef EDID_DEBUG - offset = 0; - do { - ALOGI("0x%02X", outBuffer[offset++]); - if (offset % 16) - ALOGI(" "); - else - ALOGI("\n"); - } while (SIZEOFEDIDBLOCK > offset); -#endif // EDID_DEBUG - return 1; -} - -/** - * Check if EDID data is valid or not. - * - * @return if EDID data is valid, return 1; Otherwise, return 0. - */ -static inline int EDIDValid(void) -{ - return (gEdidData == NULL) ? 0 : 1; -} - -/** - * Search HDMI Vender Specific Data Block(VSDB) in EDID extension block. - * - * @param extension [in] the number of EDID extension block to check - * - * @return if there is a HDMI VSDB, return the offset from start of @n - * EDID extension block. if there is no VSDB, return 0. - */ -static int GetVSDBOffset(const int extension) -{ - unsigned int BlockOffset = extension*SIZEOFEDIDBLOCK; - unsigned int offset = BlockOffset + EDID_DATA_BLOCK_START_POS; - unsigned int tag,blockLen,DTDOffset; - - if (!EDIDValid() || (extension > gExtensions)) { - DPRINTF("EDID Data is not available\n"); - return 0; - } - - DTDOffset = gEdidData[BlockOffset + EDID_DETAILED_TIMING_OFFSET_POS]; - - // check if there is HDMI VSDB - while (offset < BlockOffset + DTDOffset) { - // find the block tag and length - // tag - tag = gEdidData[offset] & EDID_TAG_CODE_MASK; - // block len - blockLen = (gEdidData[offset] & EDID_DATA_BLOCK_SIZE_MASK) + 1; - - // check if it is HDMI VSDB - // if so, check identifier value, if it's hdmi vsbd - return offset - if (tag == EDID_VSDB_TAG_VAL && - gEdidData[offset+1] == 0x03 && - gEdidData[offset+2] == 0x0C && - gEdidData[offset+3] == 0x0 && - blockLen > EDID_VSDB_MIN_LENGTH_VAL ) - return offset; - - // else find next block - offset += blockLen; - } - - // return error - return 0; -} - -/** - * Check if Sink supports the HDMI mode. - * @return If Sink supports HDMI mode, return 1; Otherwise, return 0. - */ -static int CheckHDMIMode(void) -{ - int i; - - // read EDID - if (!EDIDRead()) - return 0; - - // find VSDB - for (i = 1; i <= gExtensions; i++) - if (GetVSDBOffset(i) > 0) // if there is a VSDB, it means RX support HDMI mode - return 1; - - return 0; -} - -/** - * Check if EDID extension block is timing extension block or not. - * @param extension [in] The number of EDID extension block to check - * @return If the block is timing extension, return 1; Otherwise, return 0. - */ -static int IsTimingExtension(const int extension) -{ - int ret = 0; - if (!EDIDValid() || (extension > gExtensions)) { - DPRINTF("EDID Data is not available\n"); - return ret; - } - - if (gEdidData[extension*SIZEOFEDIDBLOCK] == EDID_TIMING_EXT_TAG_VAL) { - // check extension revsion number - // revision num == 3 - if (gEdidData[extension*SIZEOFEDIDBLOCK + EDID_TIMING_EXT_REV_NUMBER_POS] == 3) - ret = 1; - // revison num != 3 && DVI mode - else if (!CheckHDMIMode() && - gEdidData[extension*SIZEOFEDIDBLOCK + EDID_TIMING_EXT_REV_NUMBER_POS] != 2) - ret = 1; - } - return ret; -} - -/** - * Check if the video format is contained in - @n - * Detailed Timing Descriptor(DTD) of EDID extension block. - * @param extension [in] Number of EDID extension block to check - * @param videoFormat [in] Video format to check - * @return If the video format is contained in DTD of EDID extension block, -@n - * return 1; Otherwise, return 0. - */ -static int IsContainVideoDTD(const int extension,const enum VideoFormat videoFormat) -{ - int i, StartOffset, EndOffset; - - if (!EDIDValid() || (extension > gExtensions)) { - DPRINTF("EDID Data is not available\n"); - return 0; - } - - // if edid block( 0th block ) - if (extension == 0) { - StartOffset = EDID_DTD_START_ADDR; - EndOffset = StartOffset + EDID_DTD_TOTAL_LENGTH; - } else { // if edid extension block - StartOffset = extension*SIZEOFEDIDBLOCK + gEdidData[extension*SIZEOFEDIDBLOCK + EDID_DETAILED_TIMING_OFFSET_POS]; - EndOffset = (extension+1)*SIZEOFEDIDBLOCK; - } - - // check DTD(Detailed Timing Description) - for (i = StartOffset; i < EndOffset; i+= EDID_DTD_BYTE_LENGTH) { - unsigned int hblank = 0, hactive = 0, vblank = 0, vactive = 0, interlaced = 0, pixelclock = 0; - unsigned int vHActive = 0, vVActive = 0, vVBlank = 0; - - // get pixel clock - pixelclock = (gEdidData[i+EDID_DTD_PIXELCLOCK_POS2] << SIZEOFBYTE); - pixelclock |= gEdidData[i+EDID_DTD_PIXELCLOCK_POS1]; - - if (!pixelclock) - continue; - - // get HBLANK value in pixels - hblank = gEdidData[i+EDID_DTD_HBLANK_POS2] & EDID_DTD_HBLANK_POS2_MASK; - hblank <<= SIZEOFBYTE; // lower 4 bits - hblank |= gEdidData[i+EDID_DTD_HBLANK_POS1]; - - // get HACTIVE value in pixels - hactive = gEdidData[i+EDID_DTD_HACTIVE_POS2] & EDID_DTD_HACTIVE_POS2_MASK; - hactive <<= (SIZEOFBYTE/2); // upper 4 bits - hactive |= gEdidData[i+EDID_DTD_HACTIVE_POS1]; - - // get VBLANK value in pixels - vblank = gEdidData[i+EDID_DTD_VBLANK_POS2] & EDID_DTD_VBLANK_POS2_MASK; - vblank <<= SIZEOFBYTE; // lower 4 bits - vblank |= gEdidData[i+EDID_DTD_VBLANK_POS1]; - - // get VACTIVE value in pixels - vactive = gEdidData[i+EDID_DTD_VACTIVE_POS2] & EDID_DTD_VACTIVE_POS2_MASK; - vactive <<= (SIZEOFBYTE/2); // upper 4 bits - vactive |= gEdidData[i+EDID_DTD_VACTIVE_POS1]; - - vHActive = aVideoParams[videoFormat].HTotal - aVideoParams[videoFormat].HBlank; - if (aVideoParams[videoFormat].interlaced == 1) { - if (aVideoParams[videoFormat].VIC == v1920x1080i_50Hz_1250) { // VTOP and VBOT are same - vVActive = (aVideoParams[videoFormat].VTotal - aVideoParams[videoFormat].VBlank*2)/2; - vVBlank = aVideoParams[videoFormat].VBlank; - } else { - vVActive = (aVideoParams[videoFormat].VTotal - aVideoParams[videoFormat].VBlank*2 - 1)/2; - vVBlank = aVideoParams[videoFormat].VBlank; - } - } else { - vVActive = aVideoParams[videoFormat].VTotal - aVideoParams[videoFormat].VBlank; - vVBlank = aVideoParams[videoFormat].VBlank; - } - - // get Interlaced Mode Value - interlaced = (int)(gEdidData[i+EDID_DTD_INTERLACE_POS] & EDID_DTD_INTERLACE_MASK); - if (interlaced) - interlaced = 1; - - DPRINTF("EDID: hblank = %d,vblank = %d, hactive = %d, vactive = %d\n" - ,hblank,vblank,hactive,vactive); - DPRINTF("REQ: hblank = %d,vblank = %d, hactive = %d, vactive = %d\n" - ,aVideoParams[videoFormat].HBlank - ,vVBlank,vHActive,vVActive); - - if (hblank == aVideoParams[videoFormat].HBlank && vblank == vVBlank // blank - && hactive == vHActive && vactive == vVActive) { //line - unsigned int EDIDpixelclock = aVideoParams[videoFormat].PixelClock; - EDIDpixelclock /= 100; pixelclock /= 100; - - if (pixelclock == EDIDpixelclock) { - DPRINTF("Sink Support the Video mode\n"); - return 1; - } - } - } - return 0; -} - -/** - * Check if a VIC(Video Identification Code) is contained in -@n - * EDID extension block. - * @param extension [in] Number of EDID extension block to check - * @param VIC [in] VIC to check - * @return If the VIC is contained in contained in EDID extension block, -@n - * return 1; Otherwise, return 0. - */ -static int IsContainVIC(const int extension, const int VIC) -{ - unsigned int StartAddr = extension*SIZEOFEDIDBLOCK; - unsigned int ExtAddr = StartAddr + EDID_DATA_BLOCK_START_POS; - unsigned int tag,blockLen; - unsigned int DTDStartAddr = gEdidData[StartAddr + EDID_DETAILED_TIMING_OFFSET_POS]; - - if (!EDIDValid() || (extension > gExtensions)) { - DPRINTF("EDID Data is not available\n"); - return 0; - } - - // while - while (ExtAddr < StartAddr + DTDStartAddr) { - // find the block tag and length - // tag - tag = gEdidData[ExtAddr] & EDID_TAG_CODE_MASK; - // block len - blockLen = (gEdidData[ExtAddr] & EDID_DATA_BLOCK_SIZE_MASK) + 1; - DPRINTF("tag = %d\n",tag); - DPRINTF("blockLen = %d\n",blockLen-1); - - // check if it is short video description - if (tag == EDID_SHORT_VID_DEC_TAG_VAL) { - // if so, check SVD - unsigned int i; - for (i = 1; i < blockLen; i++) { - DPRINTF("EDIDVIC = %d\n",gEdidData[ExtAddr+i] & EDID_SVD_VIC_MASK); - DPRINTF("VIC = %d\n",VIC); - - // check VIC with SVDB - if (VIC == (gEdidData[ExtAddr+i] & EDID_SVD_VIC_MASK)) { - DPRINTF("Sink Device supports requested video mode\n"); - return 1; - } - } - } - // else find next block - ExtAddr += blockLen; - } - - return 0; -} - -/** - * Check if EDID contains the video format. - * @param videoFormat [in] Video format to check - * @param pixelRatio [in] Pixel aspect ratio of video format to check - * @return if EDID contains the video format, return 1; Otherwise, return 0. - */ -static int CheckResolution(const enum VideoFormat videoFormat, - const enum PixelAspectRatio pixelRatio) -{ - int i, vic; - - // read EDID - if (!EDIDRead()) - return 0; - - // check ET(Established Timings) for 640x480p@60Hz - if (videoFormat == v640x480p_60Hz // if it's 640x480p@60Hz - && (gEdidData[EDID_ET_POS] & EDID_ET_640x480p_VAL)) // it support - return 1; - - // check STI(Standard Timing Identification) - // do not need - - // check DTD(Detailed Timing Description) of EDID block(0th) - if (IsContainVideoDTD(0,videoFormat)) - return 1; - - // check EDID Extension - vic = (pixelRatio == HDMI_PIXEL_RATIO_16_9) ? - aVideoParams[videoFormat].VIC16_9 : aVideoParams[videoFormat].VIC; - - // find VSDB - for (i = 1; i <= gExtensions; i++) { - if (IsTimingExtension(i)) // if it's timing block - if (IsContainVIC(i, vic) || IsContainVideoDTD(i, videoFormat)) - return 1; - } - - return 0; -} - -/** - * Check if EDID supports the color depth. - * @param depth [in] Color depth - * @param space [in] Color space - * @return If EDID supports the color depth, return 1; Otherwise, return 0. - */ -static int CheckColorDepth(const enum ColorDepth depth,const enum ColorSpace space) -{ - int i; - unsigned int StartAddr; - - // if color depth == 24 bit, no need to check - if (depth == HDMI_CD_24) - return 1; - - // check EDID data is valid or not - // read EDID - if (!EDIDRead()) - return 0; - - // find VSDB - for (i = 1; i <= gExtensions; i++) { - if (IsTimingExtension(i) // if it's timing block - && ((StartAddr = GetVSDBOffset(i)) > 0)) { // check block - int blockLength = gEdidData[StartAddr] & EDID_DATA_BLOCK_SIZE_MASK; - if (blockLength >= EDID_DC_POS) { - // get supported DC value - int deepColor = gEdidData[StartAddr + EDID_DC_POS] & EDID_DC_MASK; - DPRINTF("EDID deepColor = %x\n",deepColor); - // check supported DeepColor - // if YCBCR444 - if (space == HDMI_CS_YCBCR444) { - if ( !(deepColor & EDID_DC_YCBCR_VAL)) - return 0; - } - - // check colorDepth - switch (depth) { - case HDMI_CD_36: - deepColor &= EDID_DC_36_VAL; - break; - case HDMI_CD_30: - deepColor &= EDID_DC_30_VAL; - break; - default : - deepColor = 0; - } - if (deepColor) - return 1; - else - return 0; - } - } - } - - return 0; -} - -/** - * Check if EDID supports the color space. - * @param space [in] Color space - * @return If EDID supports the color space, return 1; Otherwise, return 0. - */ -static int CheckColorSpace(const enum ColorSpace space) -{ - int i; - - // RGB is default - if (space == HDMI_CS_RGB) - return 1; - - // check EDID data is valid or not - // read EDID - if (!EDIDRead()) - return 0; - - // find VSDB - for (i = 1; i <= gExtensions; i++) { - if (IsTimingExtension(i)) { // if it's timing block - // read Color Space - int CS = gEdidData[i*SIZEOFEDIDBLOCK + EDID_COLOR_SPACE_POS]; - - if ((space == HDMI_CS_YCBCR444 && (CS & EDID_YCBCR444_CS_MASK)) || // YCBCR444 - (space == HDMI_CS_YCBCR422 && (CS & EDID_YCBCR422_CS_MASK))) // YCBCR422 - return 1; - } - } - return 0; -} - -/** - * Check if EDID supports the colorimetry. - * @param color [in] Colorimetry - * @return If EDID supports the colorimetry, return 1; Otherwise, return 0. - */ -static int CheckColorimetry(const enum HDMIColorimetry color) -{ - int i; - - // do not need to parse if not extended colorimetry - if (color == HDMI_COLORIMETRY_NO_DATA || - color == HDMI_COLORIMETRY_ITU601 || - color == HDMI_COLORIMETRY_ITU709) - return 1; - - // read EDID - if (!EDIDRead()) - return 0; - - // find VSDB - for (i = 1; i <= gExtensions; i++) { - if (IsTimingExtension(i)) { // if it's timing block - // check address - unsigned int ExtAddr = i*SIZEOFEDIDBLOCK + EDID_DATA_BLOCK_START_POS; - unsigned int EndAddr = i*SIZEOFEDIDBLOCK + gEdidData[i*SIZEOFEDIDBLOCK + EDID_DETAILED_TIMING_OFFSET_POS]; - unsigned int tag,blockLen; - - while (ExtAddr < EndAddr) { - // find the block tag and length - // tag - tag = gEdidData[ExtAddr] & EDID_TAG_CODE_MASK; - // block len - blockLen = (gEdidData[ExtAddr] & EDID_DATA_BLOCK_SIZE_MASK) + 1; - - // check if it is colorimetry block - if (tag == EDID_EXTENDED_TAG_VAL && // extended tag - gEdidData[ExtAddr+1] == EDID_EXTENDED_COLORIMETRY_VAL && // colorimetry block - (blockLen-1) == EDID_EXTENDED_COLORIMETRY_BLOCK_LEN) { // check length - // get supported DC value - int colorimetry = (gEdidData[ExtAddr + 2]); - int metadata = (gEdidData[ExtAddr + 3]); - - DPRINTF("EDID extened colorimetry = %x\n",colorimetry); - DPRINTF("EDID gamut metadata profile = %x\n",metadata); - - // check colorDepth - switch (color) { - case HDMI_COLORIMETRY_EXTENDED_xvYCC601: - if (colorimetry & EDID_XVYCC601_MASK && metadata) - return 1; - break; - case HDMI_COLORIMETRY_EXTENDED_xvYCC709: - if (colorimetry & EDID_XVYCC709_MASK && metadata) - return 1; - break; - default: - break; - } - return 0; - } - // else find next block - ExtAddr += blockLen; - } - } - } - - return 0; -} - -/** - * Get Max TMDS clock that HDMI Rx can receive. - * @return If available, return MaxTMDS clock; Otherwise, return 0. - */ -static unsigned int GetMaxTMDS(void) -{ - int i; - unsigned int StartAddr; - - // find VSDB - for (i = 1; i <= gExtensions; i++) { - if (IsTimingExtension(i) // if it's timing block - && ((StartAddr = GetVSDBOffset(i)) > 0)) { // check block - int blockLength = gEdidData[StartAddr] & EDID_DATA_BLOCK_SIZE_MASK; - if (blockLength >= EDID_MAX_TMDS_POS) { - // get supported DC value - return gEdidData[StartAddr + EDID_MAX_TMDS_POS]; - } - } - } - - return 0; -} - -/** - * Save first 16 VIC of EDID - */ -static void SaveVIC(void) -{ - int extension; - int vic_count = 0; - for (extension = 1; extension <= gExtensions && vic_count < NUM_OF_VIC_FOR_3D; extension++) { - unsigned int StartAddr = extension*SIZEOFEDIDBLOCK; - unsigned int ExtAddr = StartAddr + EDID_DATA_BLOCK_START_POS; - unsigned int tag,blockLen; - unsigned int DTDStartAddr = gEdidData[StartAddr + EDID_DETAILED_TIMING_OFFSET_POS]; - - while (ExtAddr < StartAddr + DTDStartAddr) { - // find the block tag and length - // tag - tag = gEdidData[ExtAddr] & EDID_TAG_CODE_MASK; - // block len - blockLen = (gEdidData[ExtAddr] & EDID_DATA_BLOCK_SIZE_MASK) + 1; - - // check if it is short video description - if (tag == EDID_SHORT_VID_DEC_TAG_VAL) { - // if so, check SVD - unsigned int edid_index; - for (edid_index = 1; edid_index < blockLen && vic_count < NUM_OF_VIC_FOR_3D; edid_index++) { - DPRINTF("EDIDVIC = %d\r\n", gEdidData[ExtAddr+edid_index] & EDID_SVD_VIC_MASK); - - // check VIC with SVDB - aVIC[vic_count++] = (gEdidData[ExtAddr+edid_index] & EDID_SVD_VIC_MASK); - } - } - // else find next block - ExtAddr += blockLen; - } - } -} - -/** - * Check if Rx supports requested 3D format. - * @param pVideo [in] HDMI Video Parameter - * @return If Rx supports requested 3D format, return 1; Otherwise, return 0. - */ -static int EDID3DFormatSupport(const struct HDMIVideoParameter * const pVideo) -{ - int edid_index; - unsigned int StartAddr; - unsigned int vic; - vic = (pVideo->pixelAspectRatio == HDMI_PIXEL_RATIO_16_9) ? - aVideoParams[pVideo->resolution].VIC16_9 : aVideoParams[pVideo->resolution].VIC; - - // if format == 2D, no need to check - if (pVideo->hdmi_3d_format == HDMI_2D_VIDEO_FORMAT) - return 1; - - // check EDID data is valid or not - if (!EDIDRead()) - return 0; - - // save first 16 VIC to check - SaveVIC(); - - // find VSDB - for (edid_index = 1; edid_index <= gExtensions; edid_index++) { - if (IsTimingExtension(edid_index) // if it's timing block - && ((StartAddr = GetVSDBOffset(edid_index)) > 0)) { // check block - unsigned int blockLength = gEdidData[StartAddr] & EDID_DATA_BLOCK_SIZE_MASK; - unsigned int VSDBHdmiVideoPre = 0; - unsigned int VSDB3DPresent = 0; - unsigned int VSDB3DMultiPresent = 0; - unsigned int HDMIVICLen; - unsigned int HDMI3DLen; - int Hdmi3DStructure = 0; - unsigned int Hdmi3DMask = 0xFFFF; - unsigned int latency_offset = 0; - - DPRINTF("VSDB Block length[0x%x] = 0x%x\r\n",StartAddr,blockLength); - - // get HDMI Video Present value - if (blockLength >= EDID_HDMI_EXT_POS) { - VSDBHdmiVideoPre = gEdidData[StartAddr + EDID_HDMI_EXT_POS] - & EDID_HDMI_VIDEO_PRESENT_MASK; - DPRINTF("EDID HDMI Video Present = 0x%x\n",VSDBHdmiVideoPre); - } else { // data related to 3D format is not available - return 0; - } - - // check if latency field is available - latency_offset = (gEdidData[StartAddr + EDID_HDMI_EXT_POS] - & EDID_HDMI_LATENCY_MASK) >> EDID_HDMI_LATENCY_POS; - if (latency_offset == 0) - latency_offset = 4; - else if (latency_offset == 3) - latency_offset = 0; - else - latency_offset = 2; - - StartAddr -= latency_offset; - - // HDMI_VIC_LEN - HDMIVICLen = (gEdidData[StartAddr + EDID_HDMI_EXT_LENGTH_POS] - & EDID_HDMI_VSDB_VIC_LEN_MASK) >> EDID_HDMI_VSDB_VIC_LEN_BIT; - - if (pVideo->hdmi_3d_format == HDMI_VIC_FORMAT) { - if (HDMIVICLen) { - for (edid_index = 0; edid_index < (int)HDMIVICLen; edid_index++) { - if (vic == gEdidData[StartAddr + EDID_HDMI_EXT_LENGTH_POS + edid_index]) - return 1; - } - return 0; - } else { - return 0; - } - } - - // HDMI_3D_LEN - HDMI3DLen = gEdidData[StartAddr + EDID_HDMI_EXT_LENGTH_POS] - & EDID_HDMI_VSDB_3D_LEN_MASK; - - DPRINTF("HDMI VIC LENGTH[%x] = %x\r\n", - StartAddr + EDID_HDMI_EXT_LENGTH_POS, HDMIVICLen); - DPRINTF("HDMI 3D LENGTH[%x] = %x\r\n", - StartAddr + EDID_HDMI_EXT_LENGTH_POS, HDMI3DLen); - - // check 3D_Present bit - if (blockLength >= (EDID_HDMI_3D_PRESENT_POS - latency_offset)) { - VSDB3DPresent = gEdidData[StartAddr + EDID_HDMI_3D_PRESENT_POS] - & EDID_HDMI_3D_PRESENT_MASK; - VSDB3DMultiPresent = gEdidData[StartAddr + EDID_HDMI_3D_PRESENT_POS] - & EDID_HDMI_3D_MULTI_PRESENT_MASK; - } - - if (VSDB3DPresent) { - DPRINTF("VSDB 3D Present!!!\r\n"); - // check with 3D madatory format - if (CheckResolution(pVideo->resolution, pVideo->pixelAspectRatio)) { - int size = sizeof(edid_3d)/sizeof(struct edid_3d_mandatory); - for (edid_index = 0; edid_index < size; edid_index++) { - if (edid_3d[edid_index].resolution == pVideo->resolution && - edid_3d[edid_index].hdmi_3d_format == pVideo->hdmi_3d_format ) - return 1; - } - } - } - - // check 3D_Multi_Present bit - if (VSDB3DMultiPresent) { - DPRINTF("VSDB 3D Multi Present!!! = 0x%02x\r\n",VSDB3DMultiPresent); - // 3D Structure only - if (VSDB3DMultiPresent == EDID_3D_STRUCTURE_ONLY_EXIST) { - // 3D Structure All - Hdmi3DStructure = (gEdidData[StartAddr + EDID_HDMI_EXT_LENGTH_POS + HDMIVICLen + 1] << 8); - Hdmi3DStructure |= gEdidData[StartAddr + EDID_HDMI_EXT_LENGTH_POS + HDMIVICLen + 2]; - DPRINTF("VSDB 3D Structure!!! = [0x%02x]\r\n",Hdmi3DStructure); - } - - // 3D Structure and Mask - if (VSDB3DMultiPresent == EDID_3D_STRUCTURE_MASK_EXIST) { - // 3D Structure All - Hdmi3DStructure = (gEdidData[StartAddr + EDID_HDMI_EXT_LENGTH_POS + HDMIVICLen + 1] << 8); - Hdmi3DStructure |= gEdidData[StartAddr + EDID_HDMI_EXT_LENGTH_POS + HDMIVICLen + 2]; - // 3D Structure Mask - Hdmi3DMask |= (gEdidData[StartAddr + EDID_HDMI_EXT_LENGTH_POS + HDMIVICLen + 3] << 8); - Hdmi3DMask |= gEdidData[StartAddr + EDID_HDMI_EXT_LENGTH_POS + HDMIVICLen + 4]; - DPRINTF("VSDB 3D Structure!!! = [0x%02x]\r\n",Hdmi3DStructure); - DPRINTF("VSDB 3D Mask!!! = [0x%02x]\r\n",Hdmi3DMask); - DPRINTF("Current 3D Video format!!! = [%d]\r\n",pVideo->hdmi_3d_format); - DPRINTF("Current 3D Video format!!! = [0x%02x]\r\n",1<<pVideo->hdmi_3d_format); - } - - // check 3D Structure and Mask - if (Hdmi3DStructure & (1<<pVideo->hdmi_3d_format)) { - DPRINTF("VSDB 3D Structure Contains Current Video Structure!!!\r\n"); - // check first 16 EDID - for (edid_index = 0; edid_index < NUM_OF_VIC_FOR_3D; edid_index++) { - DPRINTF("VIC = %d, EDID Vic = %d!!!\r\n",vic,aVIC[edid_index]); - if (Hdmi3DMask & (1<<edid_index)) { - if (vic == aVIC[edid_index]) { - DPRINTF("VSDB 3D Mask Contains Current Video format!!!\r\n"); - return 1; - } - } - } - } - } - - // check block length if HDMI_VIC or HDMI Multi available - if (blockLength >= (EDID_HDMI_EXT_LENGTH_POS - latency_offset)) { - unsigned int HDMI3DExtLen = HDMI3DLen - (VSDB3DMultiPresent>>EDID_HDMI_3D_MULTI_PRESENT_BIT)*2; - unsigned int VICOrder; - - // check if there is 3D extra data ? - //TODO: check 3D_Detail in case of SSH - if (HDMI3DExtLen) { - // check HDMI 3D Extra Data - for (edid_index = 0; edid_index < (int)(HDMI3DExtLen / 2); edid_index++) { - VICOrder = gEdidData[StartAddr + EDID_HDMI_EXT_LENGTH_POS + HDMIVICLen + - (VSDB3DMultiPresent>>EDID_HDMI_3D_MULTI_PRESENT_BIT) * 2 + edid_index * 2] - & EDID_HDMI_2D_VIC_ORDER_MASK; - VICOrder = (1<<VICOrder); - Hdmi3DStructure = gEdidData[StartAddr + EDID_HDMI_EXT_LENGTH_POS + HDMIVICLen + - (VSDB3DMultiPresent>>EDID_HDMI_3D_MULTI_PRESENT_BIT) * 2 + edid_index * 2] - & EDID_HDMI_3D_STRUCTURE_MASK; - Hdmi3DStructure = (1<<Hdmi3DStructure); - if (Hdmi3DStructure == pVideo->hdmi_3d_format && vic == aVIC[VICOrder]) - return 1; - } - } - } - } - } - - return 0; -} - -/** - * Initialize EDID library. This will intialize DDC library. - * @return If success, return 1; Otherwise, return 0. - */ -int EDIDOpen(void) -{ - // init DDC - return DDCOpen(); -} - -/** - * Finalize EDID library. This will finalize DDC library. - * @return If success, return 1; Otherwise, return 0. - */ -int EDIDClose(void) -{ - // reset EDID - EDIDReset(); - - // close EDDC - return DDCClose(); -} - -/** - * Read EDID data of Rx. - * @return If success, return 1; Otherwise, return 0; - */ -int EDIDRead(void) -{ - int block,dataPtr; - unsigned char temp[SIZEOFEDIDBLOCK]; - - // if already read?? - if (EDIDValid()) - return 1; - - // read EDID Extension Number - // read EDID - if (!ReadEDIDBlock(0,temp)) - return 0; - - // get extension - gExtensions = temp[EDID_EXTENSION_NUMBER_POS]; - - // prepare buffer - gEdidData = (unsigned char*)malloc((gExtensions+1)*SIZEOFEDIDBLOCK); - if (!gEdidData) - return 0; - - // copy EDID Block 0 - memcpy(gEdidData,temp,SIZEOFEDIDBLOCK); - - // read EDID Extension - for (block = 1,dataPtr = SIZEOFEDIDBLOCK; block <= gExtensions; block++,dataPtr+=SIZEOFEDIDBLOCK) { - // read extension 1~gExtensions - if (!ReadEDIDBlock(block, gEdidData+dataPtr)) { - // reset buffer - EDIDReset(); - return 0; - } - } - - // check if extension is more than 1, and first extension block is not block map. - if (gExtensions > 1 && gEdidData[SIZEOFEDIDBLOCK] != EDID_BLOCK_MAP_EXT_TAG_VAL) { - // reset buffer - DPRINTF("EDID has more than 1 extension but, first extension block is not block map\n"); - EDIDReset(); - return 0; - } - - return 1; -} - -/** - * Reset stored EDID data. - */ -void EDIDReset(void) -{ - if (gEdidData) { - free(gEdidData); - gEdidData = NULL; - DPRINTF("\t\t\t\tEDID is reset!!!\n"); - } -} - -/** - * Get CEC physical address. - * @param outAddr [out] CEC physical address. LSB 2 bytes is available. [0:0:AB:CD] - * @return If success, return 1; Otherwise, return 0. - */ -int EDIDGetCECPhysicalAddress(int* const outAddr) -{ - int i; - unsigned int StartAddr; - - // check EDID data is valid or not - // read EDID - if (!EDIDRead()) - return 0; - - // find VSDB - for (i = 1; i <= gExtensions; i++) { - if (IsTimingExtension(i) // if it's timing block - && (StartAddr = GetVSDBOffset(i)) > 0) { // check block - // get supported DC value - // int tempDC1 = (int)(gEdidData[tempAddr+EDID_DC_POS]); - int phyAddr = gEdidData[StartAddr + EDID_CEC_PHYICAL_ADDR] << 8; - phyAddr |= gEdidData[StartAddr + EDID_CEC_PHYICAL_ADDR+1]; - - DPRINTF("phyAddr = %x\n",phyAddr); - - *outAddr = phyAddr; - - return 1; - } - } - - return 0; -} - -/** - * Check if Rx supports HDMI/DVI mode or not. - * @param video [in] HDMI or DVI mode to check - * @return If Rx supports requested mode, return 1; Otherwise, return 0. - */ -int EDIDHDMIModeSupport(struct HDMIVideoParameter * const video) -{ - // check if read edid? - if (!EDIDRead()) { - DPRINTF("EDID Read Fail!!!\n"); - return 0; - } - - // check hdmi mode - if (video->mode == HDMI) { - if (!CheckHDMIMode()) { - DPRINTF("HDMI mode Not Supported\n"); - return 0; - } - } - return 1; -} - -/** - * Check if Rx supports requested video resoultion or not. - * @param video [in] Video parameters to check - * @return If Rx supports video parameters, return 1; Otherwise, return 0. - */ -int EDIDVideoResolutionSupport(struct HDMIVideoParameter * const video) -{ - unsigned int TMDSClock; - unsigned int MaxTMDS = 0; - - // check if read edid? - if (!EDIDRead()) { - DPRINTF("EDID Read Fail!!!\n"); - return 0; - } - - // get max tmds - MaxTMDS = GetMaxTMDS()*5; - - // Check MAX TMDS - TMDSClock = aVideoParams[video->resolution].PixelClock/100; - if (video->colorDepth == HDMI_CD_36) - TMDSClock *= 1.5; - else if (video->colorDepth == HDMI_CD_30) - TMDSClock *=1.25; - - DPRINTF("MAX TMDS = %d, Current TMDS = %d\n",MaxTMDS, TMDSClock); - if (MaxTMDS != 0 && MaxTMDS < TMDSClock) { - DPRINTF("Pixel clock is beyond Maximun TMDS in EDID\n"); - return 0; - } - - // check resolution - if (!CheckResolution(video->resolution,video->pixelAspectRatio)) { - DPRINTF("Video Resolution Not Supported\n"); - return 0; - } - - // check 3D format - if (!EDID3DFormatSupport(video)) { - DPRINTF("3D Format Not Supported\n"); - return 0; - } - - return 1; -} - -/** - * Check if Rx supports requested color depth or not. - * @param video [in] Video parameters to check - * @return If Rx supports video parameters, return 1; Otherwise, return 0. - */ -int EDIDColorDepthSupport(struct HDMIVideoParameter * const video) -{ - // check if read edid? - if (!EDIDRead()) { - DPRINTF("EDID Read Fail!!!\n"); - return 0; - } - - // check resolution - if (!CheckColorDepth(video->colorDepth,video->colorSpace)) { - DPRINTF("Color Depth Not Supported\n"); - return 0; - } - - return 1; -} - -/** - * Check if Rx supports requested color space or not. - * @param video [in] Video parameters to check - * @return If Rx supports video parameters, return 1; Otherwise, return 0. - */ -int EDIDColorSpaceSupport(struct HDMIVideoParameter * const video) -{ - // check if read edid? - if (!EDIDRead()) { - DPRINTF("EDID Read Fail!!!\n"); - return 0; - } - // check color space - if (!CheckColorSpace(video->colorSpace)) { - DPRINTF("Color Space Not Supported\n"); - return 0; - } - - return 1; -} - -/** - * Check if Rx supports requested colorimetry or not. - * @param video [in] Video parameters to check - * @return If Rx supports video parameters, return 1; Otherwise, return 0. - */ -int EDIDColorimetrySupport(struct HDMIVideoParameter * const video) -{ - // check if read edid? - if (!EDIDRead()) { - DPRINTF("EDID Read Fail!!!\n"); - return 0; - } - - // check colorimetry - if (!CheckColorimetry(video->colorimetry)) { - DPRINTF("Colorimetry Not Supported\n"); - return 0; - } - - return 1; -} - -/** - * Check if Rx supports requested audio parameters or not. - * @param audio [in] Audio parameters to check - * @return If Rx supports audio parameters, return 1; Otherwise, return 0. - */ -int EDIDAudioModeSupport(struct HDMIAudioParameter * const audio) -{ - int i; - - // read EDID - if (!EDIDRead()) { - DPRINTF("EDID Read Fail!!!\n"); - return 0; - } - - // check EDID Extension - // find timing block - for (i = 1; i <= gExtensions; i++) { - if (IsTimingExtension(i)) { // if it's timing block - // find Short Audio Description - unsigned int StartAddr = i*SIZEOFEDIDBLOCK; - unsigned int ExtAddr = StartAddr + EDID_DATA_BLOCK_START_POS; - unsigned int tag,blockLen; - unsigned int DTDStartAddr = gEdidData[StartAddr + EDID_DETAILED_TIMING_OFFSET_POS]; - - while (ExtAddr < StartAddr + DTDStartAddr) { - // find the block tag and length - // tag - tag = gEdidData[ExtAddr] & EDID_TAG_CODE_MASK; - // block len - blockLen = (gEdidData[ExtAddr] & EDID_DATA_BLOCK_SIZE_MASK) + 1; - - DPRINTF("tag = %d\n",tag); - DPRINTF("blockLen = %d\n",blockLen-1); - - // check if it is short video description - if (tag == EDID_SHORT_AUD_DEC_TAG_VAL) { - // if so, check SAD - unsigned int j, channelNum; - int audioFormat,sampleFreq,wordLen; - for (j = 1; j < blockLen; j += 3) { - audioFormat = gEdidData[ExtAddr+j] & EDID_SAD_CODE_MASK; - channelNum = gEdidData[ExtAddr+j] & EDID_SAD_CHANNEL_MASK; - sampleFreq = gEdidData[ExtAddr+j+1]; - wordLen = gEdidData[ExtAddr+j+2]; - - DPRINTF("request = %d, EDIDAudioFormatCode = %d\n",(audio->formatCode)<<3, audioFormat); - DPRINTF("request = %d, EDIDChannelNumber= %d\n",(audio->channelNum)-1, channelNum); - DPRINTF("request = %d, EDIDSampleFreq= %d\n",1<<(audio->sampleFreq), sampleFreq); - DPRINTF("request = %d, EDIDWordLeng= %d\n",1<<(audio->wordLength), wordLen); - - // check parameter - // check audioFormat - if (audioFormat & ( (audio->formatCode) << 3) && // format code - channelNum >= ( (audio->channelNum) -1) && // channel number - (sampleFreq & (1<<(audio->sampleFreq)))) { // sample frequency - if (audioFormat == LPCM_FORMAT) { // check wordLen - int ret = 0; - switch (audio->wordLength) { - case WORD_16: - case WORD_17: - case WORD_18: - case WORD_19: - case WORD_20: - ret = wordLen & (1<<1); - break; - case WORD_21: - case WORD_22: - case WORD_23: - case WORD_24: - ret = wordLen & (1<<2); - break; - } - return ret; - } - return 1; // if not LPCM - } - } - } - // else find next block - ExtAddr += blockLen; - } - } - } - - return 0; -} diff --git a/exynos4/hal/libhdmi/libsForhdmi/libedid/libedid.h b/exynos4/hal/libhdmi/libsForhdmi/libedid/libedid.h deleted file mode 100644 index dfd3096..0000000 --- a/exynos4/hal/libhdmi/libsForhdmi/libedid/libedid.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 _LIBEDID_H_ -#define _LIBEDID_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "video.h" -#include "audio.h" - -int EDIDOpen(void); -int EDIDRead(void); -void EDIDReset(void); -int EDIDHDMIModeSupport(struct HDMIVideoParameter *video); -int EDIDVideoResolutionSupport(struct HDMIVideoParameter *video); -int EDIDColorDepthSupport(struct HDMIVideoParameter *video); -int EDIDColorSpaceSupport(struct HDMIVideoParameter *video); -int EDIDColorimetrySupport(struct HDMIVideoParameter *video); -int EDIDAudioModeSupport(struct HDMIAudioParameter *audio); -int EDIDGetCECPhysicalAddress(int* outAddr); -int EDIDClose(void); - -#ifdef __cplusplus -} -#endif -#endif /* _LIBEDID_H_ */ diff --git a/exynos4/hal/libsecion/Android.mk b/exynos4/hal/libsecion/Android.mk deleted file mode 100644 index 349c53b..0000000 --- a/exynos4/hal/libsecion/Android.mk +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2008 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. - -ifeq ($(filter-out exynos4,$(TARGET_BOARD_PLATFORM)),) - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_PRELINK_MODULE := false -LOCAL_SHARED_LIBRARIES := liblog libcutils - -LOCAL_C_INCLUDES := \ - $(LOCAL_PATH)/../include - -LOCAL_SRC_FILES := libsecion.cpp - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := libsecion -include $(BUILD_SHARED_LIBRARY) - -endif diff --git a/exynos4/hal/libsecion/libsecion.cpp b/exynos4/hal/libsecion/libsecion.cpp deleted file mode 100644 index 14c9692..0000000 --- a/exynos4/hal/libsecion/libsecion.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#define LOG_TAG "libsecion" - -#include <secion.h> -#include <fcntl.h> -#include <sys/mman.h> -#include <sys/ioctl.h> -#include <cutils/log.h> - -#define ION_IOC_MAGIC 'I' -#define ION_IOC_ALLOC _IOWR(ION_IOC_MAGIC, 0, struct ion_allocation_data) -#define ION_IOC_FREE _IOWR(ION_IOC_MAGIC, 1, struct ion_handle_data) -#define ION_IOC_MAP _IOWR(ION_IOC_MAGIC, 2, struct ion_fd_data) -#define ION_IOC_SHARE _IOWR(ION_IOC_MAGIC, 4, struct ion_fd_data) -#define ION_IOC_IMPORT _IOWR(ION_IOC_MAGIC, 5, int) -#define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data) - -typedef unsigned long ion_handle; - -struct ion_allocation_data { - size_t len; - size_t align; - unsigned int flags; - ion_handle *handle; -}; - -struct ion_fd_data { - ion_handle *handle; - int fd; -}; - -struct ion_handle_data { - ion_handle *handle; -}; - -struct ion_custom_data { - unsigned int cmd; - unsigned long arg; -}; - -struct ion_msync_data { - enum ION_MSYNC_FLAGS dir; - int fd; - size_t size; - off_t offset; -}; - -struct ion_phys_data { - int fd; - ion_phys_addr_t phys; - size_t size; -}; - -enum ION_EXYNOS_CUSTOM_CMD { - ION_EXYNOS_CUSTOM_MSYNC, - ION_EXYNOS_CUSTOM_PHYS -}; - -ion_client ion_client_create(void) -{ - return open("/dev/ion", O_RDWR); -} - -void ion_client_destroy(ion_client client) -{ - close(client); -} - -ion_buffer ion_alloc(ion_client client, size_t len, size_t align, unsigned int flags) -{ - int ret; - struct ion_handle_data arg_free; - struct ion_fd_data arg_share; - struct ion_allocation_data arg_alloc; - - arg_alloc.len = len; - arg_alloc.align = align; - arg_alloc.flags = flags; - - ret = ioctl(client, ION_IOC_ALLOC, &arg_alloc); - if (ret < 0) - return ret; - - arg_share.handle = arg_alloc.handle; - ret = ioctl(client, ION_IOC_SHARE, &arg_share); - - arg_free.handle = arg_alloc.handle; - ioctl(client, ION_IOC_FREE, &arg_free); - - if (ret < 0) - return ret; - - return arg_share.fd; -} - -void ion_free(ion_buffer buffer) -{ - close(buffer); -} - -void *ion_map(ion_buffer buffer, size_t len, off_t offset) -{ - return mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, - buffer, offset); -} - -int ion_unmap(void *addr, size_t len) -{ - return munmap(addr, len); -} - -int ion_msync(ion_client client, ion_buffer buffer, long flags, size_t size, off_t offset) -{ - struct ion_msync_data arg_cdata; - arg_cdata.size = size; - arg_cdata.dir = (ION_MSYNC_FLAGS) flags; - arg_cdata.fd = buffer; - arg_cdata.offset = offset; - - struct ion_custom_data arg_custom; - arg_custom.cmd = ION_EXYNOS_CUSTOM_MSYNC; - arg_custom.arg = (unsigned long) &arg_cdata; - - return ioctl(client, ION_IOC_CUSTOM, &arg_custom); -} - -ion_phys_addr_t ion_getphys(ion_client client, ion_buffer buffer) -{ - struct ion_phys_data arg_cdata; - arg_cdata.fd = buffer; - - struct ion_custom_data arg_custom; - arg_custom.cmd = ION_EXYNOS_CUSTOM_PHYS; - arg_custom.arg = (unsigned long) &arg_cdata; - - if(ioctl(client, ION_IOC_CUSTOM, &arg_custom) < 0) - return 0; - - return arg_cdata.phys; -} - -int createIONMem(struct secion_param *param, size_t size, unsigned int flags) -{ - if(param->client < 0 && (param->client = ion_client_create()) < 0) { - ALOGE("createIONMem:: ion_client_create fail\n"); - goto fail; - } - - if(param->buffer < 0 && (param->buffer = ion_alloc(param->client, size, 0x10000, flags)) < 0) { - ALOGE("createIONMem:: ion_alloc fail\n"); - goto fail; - } - - if((param->physaddr = ion_getphys(param->client, param->buffer)) == 0) { - ALOGE("createIONMem:: ion_getphys fail, phys_addr = 0\n"); - goto fail; - } - - if((param->memory = ion_map(param->buffer, size, 0)) == (void*)-1) { - ALOGE("createIONMem:: ion_map fail\n"); - goto fail; - } else { - param->size = size; - return 0; - } - -fail: - if(param->memory != NULL) munmap(param->memory, size); - if(param->buffer > 0) ion_free(param->buffer); - param->buffer = -1; - param->size = 0; - param->memory = 0; - param->physaddr = 0; - return -1; -} - -int destroyIONMem(struct secion_param *param) -{ - if(param->memory != 0) munmap(param->memory, param->size); - if(param->buffer >= 0) ion_free(param->buffer); - param->buffer = -1; - param->size = 0; - param->memory = 0; - param->physaddr = 0; - return 0; -} diff --git a/exynos4/hal/libswconverter/Android.mk b/exynos4/hal/libswconverter/Android.mk deleted file mode 100644 index daf5d87..0000000 --- a/exynos4/hal/libswconverter/Android.mk +++ /dev/null @@ -1,34 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := \ - swconvertor.c \ - csc_linear_to_tiled_crop_neon.s \ - csc_linear_to_tiled_interleave_crop_neon.s \ - csc_tiled_to_linear_crop_neon.s \ - csc_tiled_to_linear_deinterleave_crop_neon.s \ - csc_interleave_memcpy_neon.s - -LOCAL_C_INCLUDES := \ - $(TOP)/$(TARGET_OMX_PATH)/include/khronos \ - $(TOP)/$(TARGET_OMX_PATH)/include/sec \ - $(TOP)/$(TARGET_HAL_PATH)/include \ - $(TOP)/$(TARGET_HAL_PATH)/libhwconverter - -ifeq ($(BOARD_USE_SAMSUNG_COLORFORMAT), true) -LOCAL_CFLAGS += -DUSE_SAMSUNG_COLORFORMAT -endif - -LOCAL_MODULE := libswconverter - -LOCAL_PRELINK_MODULE := false - -LOCAL_ARM_MODE := arm - -LOCAL_STATIC_LIBRARIES := -LOCAL_SHARED_LIBRARIES := liblog libfimc libhwconverter - -include $(BUILD_STATIC_LIBRARY) diff --git a/exynos4/hal/libswconverter/csc_interleave_memcpy_neon.s b/exynos4/hal/libswconverter/csc_interleave_memcpy_neon.s deleted file mode 100644 index 1ab25b6..0000000 --- a/exynos4/hal/libswconverter/csc_interleave_memcpy_neon.s +++ /dev/null @@ -1,120 +0,0 @@ -/* - * - * 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 csc_linear_to_tiled_crop_neon.s - * @brief SEC_OMX specific define - * @author ShinWon Lee (shinwon.lee@samsung.com) - * @version 1.0 - * @history - * 2012.02.01 : Create - */ - -/* - * Interleave src1, src2 to dst - * - * @param dest - * dst address[out] - * - * @param src1 - * src1 address[in] - * - * @param src2 - * src2 address[in] - * - * @param src_size - * src_size or src1 - */ - - .arch armv7-a - .text - .global csc_interleave_memcpy_neon - .type csc_interleave_memcpy_neon, %function -csc_interleave_memcpy_neon: - .fnstart - - @r0 dest - @r1 src1 - @r2 src2 - @r3 src_size - @r4 - @r5 - @r6 - @r7 - @r8 temp1 - @r9 temp2 - @r10 dest_addr - @r11 src1_addr - @r12 src2_addr - @r14 i - - stmfd sp!, {r8-r12,r14} @ backup registers - - mov r10, r0 - mov r11, r1 - mov r12, r2 - mov r14, r3 - - cmp r14, #128 - blt LESS_THAN_128 - -LOOP_128: - vld1.8 {q0}, [r11]! - vld1.8 {q2}, [r11]! - vld1.8 {q4}, [r11]! - vld1.8 {q6}, [r11]! - vld1.8 {q8}, [r11]! - vld1.8 {q10}, [r11]! - vld1.8 {q12}, [r11]! - vld1.8 {q14}, [r11]! - vld1.8 {q1}, [r12]! - vld1.8 {q3}, [r12]! - vld1.8 {q5}, [r12]! - vld1.8 {q7}, [r12]! - vld1.8 {q9}, [r12]! - vld1.8 {q11}, [r12]! - vld1.8 {q13}, [r12]! - vld1.8 {q15}, [r12]! - - vst2.8 {q0, q1}, [r10]! - vst2.8 {q2, q3}, [r10]! - vst2.8 {q4, q5}, [r10]! - vst2.8 {q6, q7}, [r10]! - vst2.8 {q8, q9}, [r10]! - vst2.8 {q10, q11}, [r10]! - vst2.8 {q12, q13}, [r10]! - vst2.8 {q14, q15}, [r10]! - - sub r14, #128 - cmp r14, #128 - bgt LOOP_128 - -LESS_THAN_128: - cmp r14, #0 - beq RESTORE_REG - -LOOP_1: - ldrb r8, [r11], #1 - ldrb r9, [r12], #1 - strb r8, [r10], #1 - strb r9, [r10], #1 - subs r14, #1 - bne LOOP_1 - -RESTORE_REG: - ldmfd sp!, {r8-r12,r15} @ restore registers - .fnend diff --git a/exynos4/hal/libswconverter/csc_linear_to_tiled_crop_neon.s b/exynos4/hal/libswconverter/csc_linear_to_tiled_crop_neon.s deleted file mode 100644 index 8f59826..0000000 --- a/exynos4/hal/libswconverter/csc_linear_to_tiled_crop_neon.s +++ /dev/null @@ -1,492 +0,0 @@ -/* - * - * 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 csc_linear_to_tiled_crop_neon.s - * @brief SEC_OMX specific define - * @author ShinWon Lee (shinwon.lee@samsung.com) - * @version 1.0 - * @history - * 2012.02.01 : Create - */ - -/* - * Converts linear data to tiled - * Crops left, top, right, buttom - * 1. Y of YUV420P to Y of NV12T - * 2. Y of YUV420S to Y of NV12T - * 3. UV of YUV420S to UV of NV12T - * - * @param nv12t_dest - * Y or UV plane address of NV12T[out] - * - * @param yuv420_src - * Y or UV plane address of YUV420P(S)[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_height - * Y: Height of YUV420, UV: Height/2 of YUV420[in] - * - * @param left - * Crop size of left. It should be even. - * - * @param top - * Crop size of top. It should be even. - * - * @param right - * Crop size of right. It should be even. - * - * @param buttom - * Crop size of buttom. It should be even. - */ - - .arch armv7-a - .text - .global csc_linear_to_tiled_crop_neon - .type csc_linear_to_tiled_crop_neon, %function -csc_linear_to_tiled_crop_neon: - .fnstart - - @r0 tiled_dest - @r1 linear_src - @r2 yuv420_width - @r3 yuv420_height - @r4 j - @r5 i - @r6 nn(tiled_addr) - @r7 mm(linear_addr) - @r8 aligned_x_size - @r9 aligned_y_size - @r10 temp1 - @r11 temp2 - @r12 temp3 - @r14 temp4 - - stmfd sp!, {r4-r12,r14} @ backup registers - - ldr r11, [sp, #44] @ top - ldr r14, [sp, #52] @ buttom - ldr r10, [sp, #40] @ left - ldr r12, [sp, #48] @ right - - sub r9, r3, r11 @ aligned_y_size = ((yuv420_height-top-buttom)>>5)<<5 - sub r9, r9, r14 - bic r9, r9, #0x1F - - sub r8, r2, r10 @ aligned_x_size = ((yuv420_width-left-right)>>6)<<6 - sub r8, r8, r12 - bic r8, r8, #0x3F - - mov r5, #0 @ i = 0 -LOOP_ALIGNED_Y_SIZE: - - mov r4, #0 @ j = 0 -LOOP_ALIGNED_X_SIZE: - - bl GET_TILED_OFFSET - - ldr r10, [sp, #44] @ r10 = top - ldr r14, [sp, #40] @ r14 = left - add r10, r5, r10 @ temp1 = linear_x_size*(i+top) - mul r10, r2, r10 - add r7, r1, r4 @ linear_addr = linear_src+j - add r7, r7, r10 @ linear_addr = linear_addr+temp1 - add r7, r7, r14 @ linear_addr = linear_addr+left - sub r10, r2, #32 - - pld [r7, r2] - vld1.8 {q0, q1}, [r7]! @ load {linear_src, 64} - pld [r7, r2] - vld1.8 {q2, q3}, [r7], r10 - pld [r7, r2] - vld1.8 {q4, q5}, [r7]! @ load {linear_src+linear_x_size*1, 64} - pld [r7, r2] - vld1.8 {q6, q7}, [r7], r10 - pld [r7, r2] - vld1.8 {q8, q9}, [r7]! @ load {linear_src+linear_x_size*2, 64} - pld [r7, r2] - vld1.8 {q10, q11}, [r7], r10 - pld [r7, r2] - vld1.8 {q12, q13}, [r7]! @ load {linear_src+linear_x_size*3, 64} - pld [r7, r2] - vld1.8 {q14, q15}, [r7], r10 - add r6, r0, r6 @ tiled_addr = tiled_dest+tiled_addr - vst1.8 {q0, q1}, [r6]! @ store {tiled_addr} - vst1.8 {q2, q3}, [r6]! - vst1.8 {q4, q5}, [r6]! @ store {tiled_addr+64*1} - vst1.8 {q6, q7}, [r6]! - vst1.8 {q8, q9}, [r6]! @ store {tiled_addr+64*2} - vst1.8 {q10, q11}, [r6]! - vst1.8 {q12, q13}, [r6]! @ store {tiled_addr+64*3} - vst1.8 {q14, q15}, [r6]! - - pld [r7, r2] - vld1.8 {q0, q1}, [r7]! @ load {linear_src+linear_x_size*4, 64} - pld [r7, r2] - vld1.8 {q2, q3}, [r7], r10 - pld [r7, r2] - vld1.8 {q4, q5}, [r7]! @ load {linear_src+linear_x_size*5, 64} - pld [r7, r2] - vld1.8 {q6, q7}, [r7], r10 - pld [r7, r2] - vld1.8 {q8, q9}, [r7]! @ load {linear_src+linear_x_size*6, 64} - pld [r7, r2] - vld1.8 {q10, q11}, [r7], r10 - pld [r7, r2] - vld1.8 {q12, q13}, [r7]! @ load {linear_src+linear_x_size*7, 64} - pld [r7, r2] - vld1.8 {q14, q15}, [r7], r10 - vst1.8 {q0, q1}, [r6]! @ store {tiled_addr+64*4} - vst1.8 {q2, q3}, [r6]! - vst1.8 {q4, q5}, [r6]! @ store {tiled_addr+64*5} - vst1.8 {q6, q7}, [r6]! - vst1.8 {q8, q9}, [r6]! @ store {tiled_addr+64*6} - vst1.8 {q10, q11}, [r6]! - vst1.8 {q12, q13}, [r6]! @ store {tiled_addr+64*7} - vst1.8 {q14, q15}, [r6]! - - pld [r7, r2] - vld1.8 {q0, q1}, [r7]! @ load {linear_src+linear_x_size*8, 64} - pld [r7, r2] - vld1.8 {q2, q3}, [r7], r10 - pld [r7, r2] - vld1.8 {q4, q5}, [r7]! @ load {linear_src+linear_x_size*9, 64} - pld [r7, r2] - vld1.8 {q6, q7}, [r7], r10 - pld [r7, r2] - vld1.8 {q8, q9}, [r7]! @ load {linear_src+linear_x_size*10, 64} - pld [r7, r2] - vld1.8 {q10, q11}, [r7], r10 - pld [r7, r2] - vld1.8 {q12, q13}, [r7]! @ load {linear_src+linear_x_size*11, 64} - pld [r7, r2] - vld1.8 {q14, q15}, [r7], r10 - vst1.8 {q0, q1}, [r6]! @ store {tiled_addr+64*8} - vst1.8 {q2, q3}, [r6]! - vst1.8 {q4, q5}, [r6]! @ store {tiled_addr+64*9} - vst1.8 {q6, q7}, [r6]! - vst1.8 {q8, q9}, [r6]! @ store {tiled_addr+64*10} - vst1.8 {q10, q11}, [r6]! - vst1.8 {q12, q13}, [r6]! @ store {tiled_addr+64*11} - vst1.8 {q14, q15}, [r6]! - - pld [r7, r2] - vld1.8 {q0, q1}, [r7]! @ load {linear_src+linear_x_size*12, 64} - pld [r7, r2] - vld1.8 {q2, q3}, [r7], r10 - pld [r7, r2] - vld1.8 {q4, q5}, [r7]! @ load {linear_src+linear_x_size*13, 64} - pld [r7, r2] - vld1.8 {q6, q7}, [r7], r10 - pld [r7, r2] - vld1.8 {q8, q9}, [r7]! @ load {linear_src+linear_x_size*14, 64} - pld [r7, r2] - vld1.8 {q10, q11}, [r7], r10 - pld [r7, r2] - vld1.8 {q12, q13}, [r7]! @ load {linear_src+linear_x_size*15, 64} - pld [r7, r2] - vld1.8 {q14, q15}, [r7], r10 - vst1.8 {q0, q1}, [r6]! @ store {tiled_addr+64*12} - vst1.8 {q2, q3}, [r6]! - vst1.8 {q4, q5}, [r6]! @ store {tiled_addr+64*13} - vst1.8 {q6, q7}, [r6]! - vst1.8 {q8, q9}, [r6]! @ store {tiled_addr+64*14} - vst1.8 {q10, q11}, [r6]! - vst1.8 {q12, q13}, [r6]! @ store {tiled_addr+64*15} - vst1.8 {q14, q15}, [r6]! - - pld [r7, r2] - vld1.8 {q0, q1}, [r7]! @ load {linear_src+linear_x_size*16, 64} - pld [r7, r2] - vld1.8 {q2, q3}, [r7], r10 - pld [r7, r2] - vld1.8 {q4, q5}, [r7]! @ load {linear_src+linear_x_size*17, 64} - pld [r7, r2] - vld1.8 {q6, q7}, [r7], r10 - pld [r7, r2] - vld1.8 {q8, q9}, [r7]! @ load {linear_src+linear_x_size*18, 64} - pld [r7, r2] - vld1.8 {q10, q11}, [r7], r10 - pld [r7, r2] - vld1.8 {q12, q13}, [r7]! @ load {linear_src+linear_x_size*19, 64} - pld [r7, r2] - vld1.8 {q14, q15}, [r7], r10 - vst1.8 {q0, q1}, [r6]! @ store {tiled_addr+64*16} - vst1.8 {q2, q3}, [r6]! - vst1.8 {q4, q5}, [r6]! @ store {tiled_addr+64*17} - vst1.8 {q6, q7}, [r6]! - vst1.8 {q8, q9}, [r6]! @ store {tiled_addr+64*18} - vst1.8 {q10, q11}, [r6]! - vst1.8 {q12, q13}, [r6]! @ store {tiled_addr+64*19} - vst1.8 {q14, q15}, [r6]! - - pld [r7, r2] - vld1.8 {q0, q1}, [r7]! @ load {linear_src+linear_x_size*20, 64} - pld [r7, r2] - vld1.8 {q2, q3}, [r7], r10 - pld [r7, r2] - vld1.8 {q4, q5}, [r7]! @ load {linear_src+linear_x_size*21, 64} - pld [r7, r2] - vld1.8 {q6, q7}, [r7], r10 - pld [r7, r2] - vld1.8 {q8, q9}, [r7]! @ load {linear_src+linear_x_size*22, 64} - pld [r7, r2] - vld1.8 {q10, q11}, [r7], r10 - pld [r7, r2] - vld1.8 {q12, q13}, [r7]! @ load {linear_src+linear_x_size*23, 64} - pld [r7, r2] - vld1.8 {q14, q15}, [r7], r10 - vst1.8 {q0, q1}, [r6]! @ store {tiled_addr+64*20} - vst1.8 {q2, q3}, [r6]! - vst1.8 {q4, q5}, [r6]! @ store {tiled_addr+64*21} - vst1.8 {q6, q7}, [r6]! - vst1.8 {q8, q9}, [r6]! @ store {tiled_addr+64*22} - vst1.8 {q10, q11}, [r6]! - vst1.8 {q12, q13}, [r6]! @ store {tiled_addr+64*23} - vst1.8 {q14, q15}, [r6]! - - pld [r7, r2] - vld1.8 {q0, q1}, [r7]! @ load {linear_src+linear_x_size*24, 64} - pld [r7, r2] - vld1.8 {q2, q3}, [r7], r10 - pld [r7, r2] - vld1.8 {q4, q5}, [r7]! @ load {linear_src+linear_x_size*25, 64} - pld [r7, r2] - vld1.8 {q6, q7}, [r7], r10 - pld [r7, r2] - vld1.8 {q8, q9}, [r7]! @ load {linear_src+linear_x_size*26, 64} - pld [r7, r2] - vld1.8 {q10, q11}, [r7], r10 - pld [r7, r2] - vld1.8 {q12, q13}, [r7]! @ load {linear_src+linear_x_size*27, 64} - pld [r7, r2] - vld1.8 {q14, q15}, [r7], r10 - vst1.8 {q0, q1}, [r6]! @ store {tiled_addr+64*24} - vst1.8 {q2, q3}, [r6]! - vst1.8 {q4, q5}, [r6]! @ store {tiled_addr+64*25} - vst1.8 {q6, q7}, [r6]! - vst1.8 {q8, q9}, [r6]! @ store {tiled_addr+64*26} - vst1.8 {q10, q11}, [r6]! - vst1.8 {q12, q13}, [r6]! @ store {tiled_addr+64*27} - vst1.8 {q14, q15}, [r6]! - - pld [r7, r2] - vld1.8 {q0, q1}, [r7]! @ load {linear_src+linear_x_size*28, 64} - pld [r7, r2] - vld1.8 {q2, q3}, [r7], r10 - pld [r7, r2] - vld1.8 {q4, q5}, [r7]! @ load {linear_src+linear_x_size*29, 64} - pld [r7, r2] - vld1.8 {q6, q7}, [r7], r10 - pld [r7, r2] - vld1.8 {q8, q9}, [r7]! @ load {linear_src+linear_x_size*30, 64} - pld [r7, r2] - vld1.8 {q10, q11}, [r7], r10 - vld1.8 {q12, q13}, [r7]! @ load {linear_src+linear_x_size*31, 64} - vld1.8 {q14, q15}, [r7], r10 - vst1.8 {q0, q1}, [r6]! @ store {tiled_addr+64*28} - vst1.8 {q2, q3}, [r6]! - vst1.8 {q4, q5}, [r6]! @ store {tiled_addr+64*29} - vst1.8 {q6, q7}, [r6]! - vst1.8 {q8, q9}, [r6]! @ store {tiled_addr+64*30} - vst1.8 {q10, q11}, [r6]! - vst1.8 {q12, q13}, [r6]! @ store {tiled_addr+64*31} - vst1.8 {q14, q15}, [r6]! - - add r4, r4, #64 @ j = j+64 - cmp r4, r8 @ j<aligned_x_size - blt LOOP_ALIGNED_X_SIZE - - add r5, r5, #32 @ i = i+32 - cmp r5, r9 @ i<aligned_y_size - blt LOOP_ALIGNED_Y_SIZE - - ldr r10, [sp, #44] @ r10 = top - ldr r11, [sp, #52] @ r11 = buttom - sub r10, r3, r10 - sub r10, r10, r11 - cmp r5, r10 @ i == (yuv420_height-top-buttom) - beq LOOP_LINEAR_Y_SIZE_2_START - -LOOP_LINEAR_Y_SIZE_1: - - mov r4, #0 @ j = 0 -LOOP_ALIGNED_X_SIZE_1: - - bl GET_TILED_OFFSET - - ldr r10, [sp, #44] @ r10 = top - ldr r14, [sp, #40] @ r14 = left - add r10, r5, r10 @ temp1 = yuv420_width*(i+top) - mul r10, r2, r10 - add r7, r1, r4 @ linear_addr = linear_src+j - add r7, r7, r10 @ linear_addr = linear_addr+temp1 - add r7, r7, r14 @ linear_addr = linear_addr+left - sub r10, r2, #32 @ temp1 = yuv420_width-32 - - pld [r7, r2] - vld1.8 {q0, q1}, [r7]! @ load {linear_src, 64} - pld [r7, r2] - vld1.8 {q2, q3}, [r7], r10 - vld1.8 {q4, q5}, [r7]! @ load {linear_src+linear_x_size*1, 64} - vld1.8 {q6, q7}, [r7] - add r6, r0, r6 @ tiled_addr = tiled_dest+tiled_addr - and r10, r5, #0x1F @ temp1 = i&0x1F - mov r10, r10, lsl #6 @ temp1 = 64*temp1 - add r6, r6, r10 @ tiled_addr = tiled_addr+temp1 - vst1.8 {q0, q1}, [r6]! @ store {tiled_addr} - vst1.8 {q2, q3}, [r6]! - vst1.8 {q4, q5}, [r6]! @ store {tiled_addr+64*1} - vst1.8 {q6, q7}, [r6]! - - add r4, r4, #64 @ j = j+64 - cmp r4, r8 @ j<aligned_x_size - blt LOOP_ALIGNED_X_SIZE_1 - - add r5, r5, #2 @ i = i+2 - ldr r10, [sp, #44] @ r10 = top - ldr r14, [sp, #52] @ r14 = buttom - sub r10, r3, r10 - sub r10, r10, r14 - cmp r5, r10 @ i<yuv420_height-top-buttom - blt LOOP_LINEAR_Y_SIZE_1 - -LOOP_LINEAR_Y_SIZE_2_START: - ldr r10, [sp, #40] @ r10 = left - ldr r11, [sp, #48] @ r11 = right - sub r10, r2, r10 - sub r10, r10, r11 - cmp r8, r10 @ aligned_x_size == (yuv420_width-left-right) - beq RESTORE_REG - - mov r5, #0 @ i = 0 -LOOP_LINEAR_Y_SIZE_2: - - mov r4, r8 @ j = aligned_x_size -LOOP_LINEAR_X_SIZE_2: - - bl GET_TILED_OFFSET - - ldr r10, [sp, #44] @ r14 = top - ldr r14, [sp, #40] @ r10 = left - add r10, r5, r10 - mul r10, r2, r10 @ temp1 = linear_x_size*(i+top) - add r7, r1, r4 @ linear_addr = linear_src+j - add r7, r7, r10 @ linear_addr = linear_addr+temp1 - add r7, r7, r14 @ linear_addr = linear_addr+left - - add r6, r0, r6 @ tiled_addr = tiled_dest+tiled_addr - and r11, r5, #0x1F @ temp2 = i&0x1F - mov r11, r11, lsl #6 @ temp2 = 64*temp2 - add r6, r6, r11 @ tiled_addr = tiled_addr+temp2 - and r11, r4, #0x3F @ temp2 = j&0x3F - add r6, r6, r11 @ tiled_addr = tiled_addr+temp2 - - ldrh r10, [r7], r2 - ldrh r11, [r7] - strh r10, [r6], #64 - strh r11, [r6] - - ldr r12, [sp, #40] @ r12 = left - ldr r14, [sp, #48] @ r14 = right - add r4, r4, #2 @ j = j+2 - sub r12, r2, r12 - sub r12, r12, r14 - cmp r4, r12 @ j<(yuv420_width-left-right) - blt LOOP_LINEAR_X_SIZE_2 - - ldr r12, [sp, #44] @ r12 = top - ldr r14, [sp, #52] @ r14 = buttom - add r5, r5, #2 @ i = i+2 - sub r12, r3, r12 - sub r12, r12, r14 - cmp r5, r12 @ i<(yuv420_height-top-buttom) - blt LOOP_LINEAR_Y_SIZE_2 - -RESTORE_REG: - ldmfd sp!, {r4-r12,r15} @ restore registers - -GET_TILED_OFFSET: - - mov r11, r5, asr #5 @ temp2 = i>>5 - mov r10, r4, asr #6 @ temp1 = j>>6 - - and r12, r11, #0x1 @ if (temp2 & 0x1) - cmp r12, #0x1 - bne GET_TILED_OFFSET_EVEN_FORMULA_1 - -GET_TILED_OFFSET_ODD_FORMULA: - sub r6, r11, #1 @ tiled_addr = temp2-1 - - ldr r7, [sp, #40] @ left - add r12, r2, #127 @ temp3 = linear_x_size+127 - sub r12, r12, r7 - ldr r7, [sp, #48] @ right - sub r12, r12, r7 - bic r12, r12, #0x7F @ temp3 = (temp3 >>7)<<7 - mov r12, r12, asr #6 @ temp3 = temp3>>6 - mul r6, r6, r12 @ tiled_addr = tiled_addr*temp3 - add r6, r6, r10 @ tiled_addr = tiled_addr+temp1 - add r6, r6, #2 @ tiled_addr = tiled_addr+2 - bic r12, r10, #0x3 @ temp3 = (temp1>>2)<<2 - add r6, r6, r12 @ tiled_addr = tiled_addr+temp3 - mov r6, r6, lsl #11 @ tiled_addr = tiled_addr<<11 - b GET_TILED_OFFSET_RETURN - -GET_TILED_OFFSET_EVEN_FORMULA_1: - ldr r7, [sp, #44] @ top - add r12, r3, #31 @ temp3 = linear_y_size+31 - sub r12, r12, r7 - ldr r7, [sp, #52] @ buttom - sub r12, r12, r7 - bic r12, r12, #0x1F @ temp3 = (temp3>>5)<<5 - sub r12, r12, #32 @ temp3 = temp3 - 32 - cmp r5, r12 @ if (i<(temp3-32)) { - bge GET_TILED_OFFSET_EVEN_FORMULA_2 - add r12, r10, #2 @ temp3 = temp1+2 - bic r12, r12, #3 @ temp3 = (temp3>>2)<<2 - add r6, r10, r12 @ tiled_addr = temp1+temp3 - ldr r7, [sp, #40] @ left - add r12, r2, #127 @ temp3 = linear_x_size+127 - sub r12, r12, r7 - ldr r7, [sp, #48] @ right - sub r12, r12, r7 - bic r12, r12, #0x7F @ temp3 = (temp3>>7)<<7 - mov r12, r12, asr #6 @ temp3 = temp3>>6 - mul r11, r11, r12 @ tiled_y_index = tiled_y_index*temp3 - add r6, r6, r11 @ tiled_addr = tiled_addr+tiled_y_index - mov r6, r6, lsl #11 @ - b GET_TILED_OFFSET_RETURN - -GET_TILED_OFFSET_EVEN_FORMULA_2: - ldr r7, [sp, #40] @ left - add r12, r2, #127 @ temp3 = linear_x_size+127 - sub r12, r12, r7 - ldr r7, [sp, #48] @ right - sub r12, r12, r7 - bic r12, r12, #0x7F @ temp3 = (temp3>>7)<<7 - mov r12, r12, asr #6 @ temp3 = temp3>>6 - mul r6, r11, r12 @ tiled_addr = temp2*temp3 - add r6, r6, r10 @ tiled_addr = tiled_addr+temp3 - mov r6, r6, lsl #11 @ tiled_addr = tiled_addr<<11@ - -GET_TILED_OFFSET_RETURN: - mov pc, lr - - .fnend diff --git a/exynos4/hal/libswconverter/csc_linear_to_tiled_interleave_crop_neon.s b/exynos4/hal/libswconverter/csc_linear_to_tiled_interleave_crop_neon.s deleted file mode 100644 index 33a31da..0000000 --- a/exynos4/hal/libswconverter/csc_linear_to_tiled_interleave_crop_neon.s +++ /dev/null @@ -1,563 +0,0 @@ -/* - * - * 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 csc_linear_to_tiled_interleave_crop_neon.s - * @brief SEC_OMX specific define - * @author ShinWon Lee (shinwon.lee@samsung.com) - * @version 1.0 - * @history - * 2012.02.01 : Create - */ - -/* - * Converts tiled data to linear - * Crops left, top, right, buttom - * 1. Y of NV12T to Y of YUV420P - * 2. Y of NV12T to Y of YUV420S - * 3. UV of NV12T to UV of YUV420S - * - * @param yuv420_dest - * Y or UV plane address of YUV420[out] - * - * @param nv12t_src - * Y or UV plane address of NV12T[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_height - * Y: Height of YUV420, UV: Height/2 of YUV420[in] - * - * @param left - * Crop size of left. It should be even. - * - * @param top - * Crop size of top. It should be even. - * - * @param right - * Crop size of right. It should be even. - * - * @param buttom - * Crop size of buttom. It should be even. - */ - - .arch armv7-a - .text - .global csc_linear_to_tiled_interleave_crop_neon - .type csc_linear_to_tiled_interleave_crop_neon, %function -csc_linear_to_tiled_interleave_crop_neon: - .fnstart - - @r0 tiled_dest - @r1 linear_src_u - @r2 linear_src_v - @r3 yuv420_width - @r4 yuv420_height - @r5 j - @r6 i - @r7 tiled_addr - @r8 linear_addr - @r9 aligned_x_size - @r10 aligned_y_size - @r11 temp1 - @r12 temp2 - @r14 temp3 - - stmfd sp!, {r4-r12,r14} @ backup registers - - ldr r4, [sp, #40] @ load linear_y_size to r4 - - ldr r10, [sp, #48] @ r10 = top - ldr r14, [sp, #56] @ r14 = buttom - ldr r11, [sp, #44] @ r11 = left - ldr r12, [sp, #52] @ r12 = right - - sub r10, r4, r10 @ aligned_y_size = ((yuv420_height-top-buttom)>>5)<<5 - sub r10, r10, r14 - bic r10, r10, #0x1F - sub r11, r3, r11 @ aligned_x_size = ((yuv420_width-left-right)>>6)<<6 - sub r11, r11, r12 - bic r9, r11, #0x3F - - mov r6, #0 @ i = 0 -LOOP_ALIGNED_Y_SIZE: - - mov r5, #0 @ j = 0 -LOOP_ALIGNED_X_SIZE: - - bl GET_TILED_OFFSET - - ldr r12, [sp, #48] @ r12 = top - ldr r8, [sp, #44] @ r8 = left - - mov r11, r3, asr #1 @ temp1 = (yuv420_width/2)*(i+top) - add r12, r6, r12 - mul r11, r11, r12 - add r11, r11, r5, asr #1 @ temp1 = temp1+j/2 - add r11, r11, r8, asr #1 @ temp1 = temp1+left/2 - - mov r12, r3, asr #1 @ temp2 = yuv420_width/2 - sub r12, r12, #16 @ temp2 = yuv420_width-16 - - add r8, r1, r11 @ linear_addr = linear_src_u+temp1 - add r11, r2, r11 @ temp1 = linear_src_v+temp1 - add r7, r0, r7 @ tiled_addr = tiled_dest+tiled_addr - - pld [r8, r3] - vld1.8 {q0}, [r8]! @ load {linear_src_u, 32} - vld1.8 {q2}, [r8], r12 - pld [r8, r3] - vld1.8 {q4}, [r8]! @ load {linear_src_u+(linear_x_size/2)*1, 32} - vld1.8 {q6}, [r8], r12 - pld [r11] - vld1.8 {q8}, [r8]! @ load {linear_src_u+(linear_x_size/2)*2, 32} - vld1.8 {q10}, [r8], r12 - pld [r11, r3, asr #1] - vld1.8 {q12}, [r8]! @ load {linear_src_u+(linear_x_size/2)*3, 32} - vld1.8 {q14}, [r8], r12 - pld [r11, r3] - vld1.8 {q1}, [r11]! @ load {linear_src_v, 32} - vld1.8 {q3}, [r11], r12 - pld [r11, r3] - vld1.8 {q5}, [r11]! @ load {linear_src_v+(linear_x_size/2)*1, 32} - vld1.8 {q7}, [r11], r12 - pld [r8] - vld1.8 {q9}, [r11]! @ load {linear_src_v+(linear_x_size/2)*2, 32} - vld1.8 {q11}, [r11], r12 - pld [r8, r3, asr #1] - vld1.8 {q13}, [r11]! @ load {linear_src_v+(linear_x_size/2)*3, 32} - vld1.8 {q15}, [r11], r12 - vst2.8 {q0, q1}, [r7]! @ store {tiled_addr} - vst2.8 {q2, q3}, [r7]! - vst2.8 {q4, q5}, [r7]! @ store {tiled_addr+64*1} - vst2.8 {q6, q7}, [r7]! - vst2.8 {q8, q9}, [r7]! @ store {tiled_addr+64*2} - vst2.8 {q10, q11}, [r7]! - vst2.8 {q12, q13}, [r7]! @ store {tiled_addr+64*3} - vst2.8 {q14, q15}, [r7]! - - pld [r8, r3] - vld1.8 {q0}, [r8]! @ load {linear_src_u+(linear_x_size/2)*4, 32} - vld1.8 {q2}, [r8], r12 - pld [r8, r3] - vld1.8 {q4}, [r8]! @ load {linear_src_u+(linear_x_size/2)*5, 32} - vld1.8 {q6}, [r8], r12 - pld [r11] - vld1.8 {q8}, [r8]! @ load {linear_src_u+(linear_x_size/2)*6, 32} - vld1.8 {q10}, [r8], r12 - pld [r11, r3, asr #1] - vld1.8 {q12}, [r8]! @ load {linear_src_u+(linear_x_size/2)*7, 32} - vld1.8 {q14}, [r8], r12 - pld [r11, r3] - vld1.8 {q1}, [r11]! @ load {linear_src_v+(linear_x_size/2)*4, 32} - vld1.8 {q3}, [r11], r12 - pld [r11, r3] - vld1.8 {q5}, [r11]! @ load {linear_src_v+(linear_x_size/2)*5, 32} - vld1.8 {q7}, [r11], r12 - pld [r8] - vld1.8 {q9}, [r11]! @ load {linear_src_v+(linear_x_size/2)*6, 32} - vld1.8 {q11}, [r11], r12 - pld [r8, r3, asr #1] - vld1.8 {q13}, [r11]! @ load {linear_src_v+(linear_x_size/2)*7, 32} - vld1.8 {q15}, [r11], r12 - vst2.8 {q0, q1}, [r7]! @ store {tiled_addr+64*4} - vst2.8 {q2, q3}, [r7]! - vst2.8 {q4, q5}, [r7]! @ store {tiled_addr+64*5} - vst2.8 {q6, q7}, [r7]! - vst2.8 {q8, q9}, [r7]! @ store {tiled_addr+64*6} - vst2.8 {q10, q11}, [r7]! - vst2.8 {q12, q13}, [r7]! @ store {tiled_addr+64*7} - vst2.8 {q14, q15}, [r7]! - - pld [r8, r3] - vld1.8 {q0}, [r8]! @ load {linear_src_u+(linear_x_size/2)*8, 32} - vld1.8 {q2}, [r8], r12 - pld [r8, r3] - vld1.8 {q4}, [r8]! @ load {linear_src_u+(linear_x_size/2)*9, 32} - vld1.8 {q6}, [r8], r12 - pld [r11] - vld1.8 {q8}, [r8]! @ load {linear_src_u+(linear_x_size/2)*10, 32} - vld1.8 {q10}, [r8], r12 - pld [r11, r3, asr #1] - vld1.8 {q12}, [r8]! @ load {linear_src_u+(linear_x_size/2)*11, 32} - vld1.8 {q14}, [r8], r12 - pld [r11, r3] - vld1.8 {q1}, [r11]! @ load {linear_src_v+(linear_x_size/2)*8, 32} - vld1.8 {q3}, [r11], r12 - pld [r11, r3] - vld1.8 {q5}, [r11]! @ load {linear_src_v+(linear_x_size/2)*9, 32} - vld1.8 {q7}, [r11], r12 - pld [r8] - vld1.8 {q9}, [r11]! @ load {linear_src_v+(linear_x_size/2)*10, 32} - vld1.8 {q11}, [r11], r12 - pld [r8, r3, asr #1] - vld1.8 {q13}, [r11]! @ load {linear_src_v+(linear_x_size/2)*11, 32} - vld1.8 {q15}, [r11], r12 - vst2.8 {q0, q1}, [r7]! @ store {tiled_addr+64*8} - vst2.8 {q2, q3}, [r7]! - vst2.8 {q4, q5}, [r7]! @ store {tiled_addr+64*9} - vst2.8 {q6, q7}, [r7]! - vst2.8 {q8, q9}, [r7]! @ store {tiled_addr+64*10} - vst2.8 {q10, q11}, [r7]! - vst2.8 {q12, q13}, [r7]! @ store {tiled_addr+64*11} - vst2.8 {q14, q15}, [r7]! - - pld [r8, r3] - vld1.8 {q0}, [r8]! @ load {linear_src_u+(linear_x_size/2)*12, 32} - vld1.8 {q2}, [r8], r12 - pld [r8, r3] - vld1.8 {q4}, [r8]! @ load {linear_src_u+(linear_x_size/2)*13, 32} - vld1.8 {q6}, [r8], r12 - pld [r11] - vld1.8 {q8}, [r8]! @ load {linear_src_u+(linear_x_size/2)*14, 32} - vld1.8 {q10}, [r8], r12 - pld [r11, r3, asr #1] - vld1.8 {q12}, [r8]! @ load {linear_src_u+(linear_x_size/2)*15, 32} - vld1.8 {q14}, [r8], r12 - pld [r11, r3] - vld1.8 {q1}, [r11]! @ load {linear_src_v+(linear_x_size/2)*12, 32} - vld1.8 {q3}, [r11], r12 - pld [r11, r3] - vld1.8 {q5}, [r11]! @ load {linear_src_v+(linear_x_size/2)*13, 32} - vld1.8 {q7}, [r11], r12 - pld [r8] - vld1.8 {q9}, [r11]! @ load {linear_src_v+(linear_x_size/2)*14, 32} - vld1.8 {q11}, [r11], r12 - pld [r8, r3, asr #1] - vld1.8 {q13}, [r11]! @ load {linear_src_v+(linear_x_size/2)*15, 32} - vld1.8 {q15}, [r11], r12 - vst2.8 {q0, q1}, [r7]! @ store {tiled_addr+64*12} - vst2.8 {q2, q3}, [r7]! - vst2.8 {q4, q5}, [r7]! @ store {tiled_addr+64*13} - vst2.8 {q6, q7}, [r7]! - vst2.8 {q8, q9}, [r7]! @ store {tiled_addr+64*14} - vst2.8 {q10, q11}, [r7]! - vst2.8 {q12, q13}, [r7]! @ store {tiled_addr+64*15} - vst2.8 {q14, q15}, [r7]! - - pld [r8, r3] - vld1.8 {q0}, [r8]! @ load {linear_src_u+(linear_x_size/2)*16, 32} - vld1.8 {q2}, [r8], r12 - pld [r8, r3] - vld1.8 {q4}, [r8]! @ load {linear_src_u+(linear_x_size/2)*17, 32} - vld1.8 {q6}, [r8], r12 - pld [r11] - vld1.8 {q8}, [r8]! @ load {linear_src_u+(linear_x_size/2)*18, 32} - vld1.8 {q10}, [r8], r12 - pld [r11, r3, asr #1] - vld1.8 {q12}, [r8]! @ load {linear_src_u+(linear_x_size/2)*19, 32} - vld1.8 {q14}, [r8], r12 - pld [r11, r3] - vld1.8 {q1}, [r11]! @ load {linear_src_v+(linear_x_size/2)*16, 32} - vld1.8 {q3}, [r11], r12 - pld [r11, r3] - vld1.8 {q5}, [r11]! @ load {linear_src_v+(linear_x_size/2)*17, 32} - vld1.8 {q7}, [r11], r12 - pld [r8] - vld1.8 {q9}, [r11]! @ load {linear_src_v+(linear_x_size/2)*18, 32} - vld1.8 {q11}, [r11], r12 - pld [r8, r3, asr #1] - vld1.8 {q13}, [r11]! @ load {linear_src_v+(linear_x_size/2)*19, 32} - vld1.8 {q15}, [r11], r12 - vst2.8 {q0, q1}, [r7]! @ store {tiled_addr+64*16} - vst2.8 {q2, q3}, [r7]! - vst2.8 {q4, q5}, [r7]! @ store {tiled_addr+64*17} - vst2.8 {q6, q7}, [r7]! - vst2.8 {q8, q9}, [r7]! @ store {tiled_addr+64*18} - vst2.8 {q10, q11}, [r7]! - vst2.8 {q12, q13}, [r7]! @ store {tiled_addr+64*19} - vst2.8 {q14, q15}, [r7]! - - pld [r8, r3] - vld1.8 {q0}, [r8]! @ load {linear_src_u+(linear_x_size/2)*20, 32} - vld1.8 {q2}, [r8], r12 - pld [r8, r3] - vld1.8 {q4}, [r8]! @ load {linear_src_u+(linear_x_size/2)*21, 32} - vld1.8 {q6}, [r8], r12 - pld [r11] - vld1.8 {q8}, [r8]! @ load {linear_src_u+(linear_x_size/2)*22, 32} - vld1.8 {q10}, [r8], r12 - pld [r11, r3, asr #1] - vld1.8 {q12}, [r8]! @ load {linear_src_u+(linear_x_size/2)*23, 32} - vld1.8 {q14}, [r8], r12 - pld [r11, r3] - vld1.8 {q1}, [r11]! @ load {linear_src_v+(linear_x_size/2)*20, 32} - vld1.8 {q3}, [r11], r12 - pld [r11, r3] - vld1.8 {q5}, [r11]! @ load {linear_src_v+(linear_x_size/2)*21, 32} - vld1.8 {q7}, [r11], r12 - pld [r8] - vld1.8 {q9}, [r11]! @ load {linear_src_v+(linear_x_size/2)*22, 32} - vld1.8 {q11}, [r11], r12 - pld [r8, r3, asr #1] - vld1.8 {q13}, [r11]! @ load {linear_src_v+(linear_x_size/2)*23, 32} - vld1.8 {q15}, [r11], r12 - vst2.8 {q0, q1}, [r7]! @ store {tiled_addr+64*20} - vst2.8 {q2, q3}, [r7]! - vst2.8 {q4, q5}, [r7]! @ store {tiled_addr+64*21} - vst2.8 {q6, q7}, [r7]! - vst2.8 {q8, q9}, [r7]! @ store {tiled_addr+64*22} - vst2.8 {q10, q11}, [r7]! - vst2.8 {q12, q13}, [r7]! @ store {tiled_addr+64*23} - vst2.8 {q14, q15}, [r7]! - - pld [r8, r3] - vld1.8 {q0}, [r8]! @ load {linear_src_u+(linear_x_size/2)*24, 32} - vld1.8 {q2}, [r8], r12 - pld [r8, r3] - vld1.8 {q4}, [r8]! @ load {linear_src_u+(linear_x_size/2)*25, 32} - vld1.8 {q6}, [r8], r12 - pld [r11] - vld1.8 {q8}, [r8]! @ load {linear_src_u+(linear_x_size/2)*26, 32} - vld1.8 {q10}, [r8], r12 - pld [r11, r3, asr #1] - vld1.8 {q12}, [r8]! @ load {linear_src_u+(linear_x_size/2)*27, 32} - vld1.8 {q14}, [r8], r12 - pld [r11, r3] - vld1.8 {q1}, [r11]! @ load {linear_src_v+(linear_x_size/2)*24, 32} - vld1.8 {q3}, [r11], r12 - pld [r11, r3] - vld1.8 {q5}, [r11]! @ load {linear_src_v+(linear_x_size/2)*25, 32} - vld1.8 {q7}, [r11], r12 - pld [r8] - vld1.8 {q9}, [r11]! @ load {linear_src_v+(linear_x_size/2)*26, 32} - vld1.8 {q11}, [r11], r12 - pld [r8, r3, asr #1] - vld1.8 {q13}, [r11]! @ load {linear_src_v+(linear_x_size/2)*27, 32} - vld1.8 {q15}, [r11], r12 - vst2.8 {q0, q1}, [r7]! @ store {tiled_addr+64*24} - vst2.8 {q2, q3}, [r7]! - vst2.8 {q4, q5}, [r7]! @ store {tiled_addr+64*25} - vst2.8 {q6, q7}, [r7]! - vst2.8 {q8, q9}, [r7]! @ store {tiled_addr+64*26} - vst2.8 {q10, q11}, [r7]! - vst2.8 {q12, q13}, [r7]! @ store {tiled_addr+64*27} - vst2.8 {q14, q15}, [r7]! - - pld [r8, r3] - vld1.8 {q0}, [r8]! @ load {linear_src_u+(linear_x_size/2)*28, 32} - vld1.8 {q2}, [r8], r12 - pld [r8, r3] - vld1.8 {q4}, [r8]! @ load {linear_src_u+(linear_x_size/2)*29, 32} - vld1.8 {q6}, [r8], r12 - pld [r11] - vld1.8 {q8}, [r8]! @ load {linear_src_u+(linear_x_size/2)*30, 32} - vld1.8 {q10}, [r8], r12 - pld [r11, r3, asr #1] - vld1.8 {q12}, [r8]! @ load {linear_src_u+(linear_x_size/2)*31, 32} - vld1.8 {q14}, [r8], r12 - pld [r11, r3] - vld1.8 {q1}, [r11]! @ load {linear_src_v+(linear_x_size/2)*28, 32} - vld1.8 {q3}, [r11], r12 - pld [r11, r3] - vld1.8 {q5}, [r11]! @ load {linear_src_v+(linear_x_size/2)*29, 32} - vld1.8 {q7}, [r11], r12 - vld1.8 {q9}, [r11]! @ load {linear_src_v+(linear_x_size/2)*30, 32} - vld1.8 {q11}, [r11], r12 - vld1.8 {q13}, [r11]! @ load {linear_src_v+(linear_x_size/2)*31, 32} - vld1.8 {q15}, [r11], r12 - vst2.8 {q0, q1}, [r7]! @ store {tiled_addr+64*28} - vst2.8 {q2, q3}, [r7]! - vst2.8 {q4, q5}, [r7]! @ store {tiled_addr+64*29} - vst2.8 {q6, q7}, [r7]! - vst2.8 {q8, q9}, [r7]! @ store {tiled_addr+64*30} - vst2.8 {q10, q11}, [r7]! - vst2.8 {q12, q13}, [r7]! @ store {tiled_addr+64*31} - vst2.8 {q14, q15}, [r7]! - - add r5, r5, #64 @ j = j+64 - cmp r5, r9 @ j<aligned_x_size - blt LOOP_ALIGNED_X_SIZE - - add r6, r6, #32 @ i = i+32 - cmp r6, r10 @ i<aligned_y_size - blt LOOP_ALIGNED_Y_SIZE - - cmp r6, r4 - beq LOOP_LINEAR_Y_SIZE_2_START - -LOOP_LINEAR_Y_SIZE_1: - - mov r5, #0 @ j = 0 -LOOP_ALIGNED_X_SIZE_1: - - bl GET_TILED_OFFSET - - ldr r12, [sp, #48] @ r12 = top - ldr r8, [sp, #44] @ r8 = left - - mov r11, r3, asr #1 @ temp1 = (yuv420_width/2)*(i+top) - add r12, r6, r12 - mul r11, r11, r12 - add r11, r11, r5, asr #1 @ temp1 = temp1+j/2 - add r11, r11, r8, asr #1 @ temp1 = temp1+left/2 - - add r8, r1, r11 @ linear_addr = linear_src_u+temp1 - add r11, r2, r11 @ temp1 = linear_src_v+temp1 - add r7, r0, r7 @ tiled_addr = tiled_dest+tiled_addr - and r14, r6, #0x1F @ temp3 = i&0x1F@ - mov r14, r14, lsl #6 @ temp3 = temp3*64 - add r7, r7, r14 @ tiled_addr = tiled_addr+temp3 - - vld1.8 {q0}, [r8]! @ load {linear_src_u, 32} - vld1.8 {q2}, [r8] - vld1.8 {q1}, [r11]! @ load {linear_src_v, 32} - vld1.8 {q3}, [r11] - vst2.8 {q0, q1}, [r7]! @ store {tiled_addr} - vst2.8 {q2, q3}, [r7]! - - add r5, r5, #64 @ j = j+64 - cmp r5, r9 @ j<aligned_x_size - blt LOOP_ALIGNED_X_SIZE_1 - - ldr r12, [sp, #48] @ r12 = top - ldr r8, [sp, #56] @ r8 = buttom - add r6, r6, #1 @ i = i+1 - sub r12, r4, r12 - sub r12, r12, r8 - cmp r6, r12 @ i<(yuv420_height-top-buttom) - blt LOOP_LINEAR_Y_SIZE_1 - -LOOP_LINEAR_Y_SIZE_2_START: - cmp r5, r3 - beq RESTORE_REG - - mov r6, #0 @ i = 0 -LOOP_LINEAR_Y_SIZE_2: - - mov r5, r9 @ j = aligned_x_size -LOOP_LINEAR_X_SIZE_2: - - bl GET_TILED_OFFSET - - ldr r12, [sp, #48] @ r12 = top - ldr r8, [sp, #44] @ r8 = left - - mov r11, r3, asr #1 @ temp1 = (yuv420_width/2)*(i+top) - add r12, r6, r12 - mul r11, r11, r12 - add r11, r11, r5, asr #1 @ temp1 = temp1+j/2 - add r11, r11, r8, asr #1 @ temp1 = temp1+left/2 - - mov r12, r3, asr #1 @ temp2 = linear_x_size/2 - sub r12, r12, #1 @ temp2 = linear_x_size-1 - - add r8, r1, r11 @ linear_addr = linear_src_u+temp1 - add r11, r2, r11 @ temp1 = linear_src_v+temp1 - add r7, r0, r7 @ tiled_addr = tiled_dest+tiled_addr - and r14, r6, #0x1F @ temp3 = i&0x1F@ - mov r14, r14, lsl #6 @ temp3 = temp3*64 - add r7, r7, r14 @ tiled_addr = tiled_addr+temp3 - and r14, r5, #0x3F @ temp3 = j&0x3F - add r7, r7, r14 @ tiled_addr = tiled_addr+temp3 - - ldrb r10, [r8], #1 - ldrb r14, [r11], #1 - mov r14, r14, lsl #8 - orr r10, r10, r14 - strh r10, [r7], #2 - - ldr r12, [sp, #44] @ r12 = left - ldr r8, [sp, #52] @ r8 = right - add r5, r5, #2 @ j = j+2 - sub r12, r3, r12 - sub r12, r12, r8 - cmp r5, r12 @ j<(yuv420_width-left-right) - blt LOOP_LINEAR_X_SIZE_2 - - ldr r12, [sp, #48] @ r12 = top - ldr r8, [sp, #56] @ r8 = buttom - add r6, r6, #1 @ i = i+1 - sub r12, r4, r12 - sub r12, r12, r8 - cmp r6, r12 @ i<(yuv420_height-top-buttom) - blt LOOP_LINEAR_Y_SIZE_2 - -RESTORE_REG: - ldmfd sp!, {r4-r12,r15} @ restore registers - -GET_TILED_OFFSET: - stmfd sp!, {r14} - - mov r12, r6, asr #5 @ temp2 = i>>5 - mov r11, r5, asr #6 @ temp1 = j>>6 - - and r14, r12, #0x1 @ if (temp2 & 0x1) - cmp r14, #0x1 - bne GET_TILED_OFFSET_EVEN_FORMULA_1 - -GET_TILED_OFFSET_ODD_FORMULA: - - ldr r7, [sp, #48] @ r7 = left , (r14 was pushed to stack) - ldr r8, [sp, #56] @ r8 = right , (r14 was pushed to stack) - sub r14, r3, r7 - sub r14, r14, r8 - add r14, r14, #127 @ temp3 = (((yuv420_width-left-right)+127)>>7)<<7 - bic r14, r14, #0x7F @ temp3 = (temp3 >>7)<<7 - mov r14, r14, asr #6 @ temp3 = temp3>>6 - sub r7, r12, #1 @ tiled_addr = temp2-1 - mul r7, r7, r14 @ tiled_addr = tiled_addr*temp3 - add r7, r7, r11 @ tiled_addr = tiled_addr+temp1 - add r7, r7, #2 @ tiled_addr = tiled_addr+2 - bic r14, r11, #0x3 @ temp3 = (temp1>>2)<<2 - add r7, r7, r14 @ tiled_addr = tiled_addr+temp3 - mov r7, r7, lsl #11 @ tiled_addr = tiled_addr<<11 - b GET_TILED_OFFSET_RETURN - -GET_TILED_OFFSET_EVEN_FORMULA_1: - ldr r7, [sp, #52] @ r7 = top, (r14 was pushed to stack) - ldr r8, [sp, #60] @ r8 = buttom, (r14 was pushed to stack) - sub r14, r4, r7 - sub r14, r14, r8 - add r14, r14, #31 @ temp3 = (((yuv420_height-top-buttom)+31)>>5)<<5 - bic r14, r14, #0x1F @ temp3 = (temp3>>5)<<5 - sub r14, r14, #32 @ temp3 = temp3 - 32 - cmp r6, r14 @ if (i<(temp3-32)) { - bge GET_TILED_OFFSET_EVEN_FORMULA_2 - add r14, r11, #2 @ temp3 = temp1+2 - bic r14, r14, #3 @ temp3 = (temp3>>2)<<2 - add r7, r11, r14 @ tiled_addr = temp1+temp3 - ldr r8, [sp, #48] @ r8 = left, (r14 was pushed to stack) - sub r14, r3, r8 - ldr r8, [sp, #56] @ r8 = right, (r14 was pushed to stack) - sub r14, r14, r8 - add r14, r14, #127 @ temp3 = (((yuv420_width-left-right)+127)>>7)<<7 - bic r14, r14, #0x7F @ temp3 = (temp3>>7)<<7 - mov r14, r14, asr #6 @ temp3 = temp3>>6 - mul r12, r12, r14 @ tiled_y_index = tiled_y_index*temp3 - add r7, r7, r12 @ tiled_addr = tiled_addr+tiled_y_index - mov r7, r7, lsl #11 @ - b GET_TILED_OFFSET_RETURN - -GET_TILED_OFFSET_EVEN_FORMULA_2: - ldr r8, [sp, #48] @ r8 = left, (r14 was pushed to stack) - sub r14, r3, r8 - ldr r8, [sp, #56] @ r8 = right, (r14 was pushed to stack) - sub r14, r14, r8 - add r14, r14, #127 @ temp3 = (((yuv420_width-left-right)+127)>>7)<<7 - bic r14, r14, #0x7F @ temp3 = (temp3>>7)<<7 - mov r14, r14, asr #6 @ temp3 = temp3>>6 - mul r7, r12, r14 @ tiled_addr = temp2*temp3 - add r7, r7, r11 @ tiled_addr = tiled_addr+temp3 - mov r7, r7, lsl #11 @ tiled_addr = tiled_addr<<11@ - -GET_TILED_OFFSET_RETURN: - ldmfd sp!, {r15} @ restore registers - - .fnend - diff --git a/exynos4/hal/libswconverter/csc_tiled_to_linear_crop_neon.s b/exynos4/hal/libswconverter/csc_tiled_to_linear_crop_neon.s deleted file mode 100644 index 9cb81b5..0000000 --- a/exynos4/hal/libswconverter/csc_tiled_to_linear_crop_neon.s +++ /dev/null @@ -1,701 +0,0 @@ -/* - * - * 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 csc_tiled_to_linear_crop_neon.s - * @brief SEC_OMX specific define - * @author ShinWon Lee (shinwon.lee@samsung.com) - * @version 1.0 - * @history - * 2012.02.01 : Create - */ - -/* - * Converts tiled data to linear - * Crops left, top, right, buttom - * 1. Y of NV12T to Y of YUV420P - * 2. Y of NV12T to Y of YUV420S - * 3. UV of NV12T to UV of YUV420S - * - * @param yuv420_dest - * Y or UV plane address of YUV420[out] - * - * @param nv12t_src - * Y or UV plane address of NV12T[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_height - * Y: Height of YUV420, UV: Height/2 of YUV420[in] - * - * @param left - * Crop size of left. It should be even. - * - * @param top - * Crop size of top. It should be even. - * - * @param right - * Crop size of right. It should be even. - * - * @param buttom - * Crop size of buttom. It should be even. - */ - - .arch armv7-a - .text - .global csc_tiled_to_linear_crop_neon - .type csc_tiled_to_linear_crop_neon, %function -csc_tiled_to_linear_crop_neon: - .fnstart - - @r0 yuv420_dest - @r1 nv12t_src - @r2 yuv420_width - @r3 yuv420_height - @r4 - @r5 i - @r6 j - @r7 tiled_offset - @r8 tiled_offset1 - @r9 linear_offset - @r10 temp1 - @r11 temp2 - @r12 temp3 - @r14 temp4 - - stmfd sp!, {r4-r12,r14} @ backup registers - - ldr r12, [sp, #48] @ r12 = right - ldr r10, [sp, #40] @ r10 = left - sub r12, r2, r12 @ temp3 = yuv420_width-right@ - sub r10, r12, r10 @ temp1 = temp3-left@ - cmp r10, #256 @ if (temp1 >= 256) - blt LOOP_HEIGHT_64_START - - ldr r5, [sp, #44] @ i = top -LOOP_HEIGHT_256: - ldr r6, [sp, #40] @ j = left - mov r14, r5, asr #5 @ temp4 = i>>5 - bic r12, r6, #0xFF @ temp3 = (j>>8)<<8 - mov r12, r12, asr #6 @ temp3 = temp3>>6 - and r11, r14, #0x1 @ if (temp4 & 0x1) - cmp r11, #0x1 - bne LOOP_HEIGHT_256_GET_TILED_EVEN -LOOP_HEIGHT_256_GET_TILED_ODD: - sub r7, r14, #1 @ tiled_offset = temp4-1 - add r10, r2, #127 @ temp1 = ((yuv420_width+127)>>7)<<7 - bic r10, r10, #0x7F - mov r10, r10, asr #6 @ tiled_offset = tiled_offset*(temp1>>6) - mul r7, r7, r10 - add r7, r7, r12 @ tiled_offset = tiled_offset+temp3 - add r7, r7, #2 @ tiled_offset = tiled_offset+2 - bic r10, r12, #0x3 @ temp1 = (temp3>>2)<<2 - add r7, r7, r10 @ tiled_offset = tiled_offset+temp1 - mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11 - add r8, r7, #4096 @ tiled_offset1 = tiled_offset+2048*2 - mov r14, #8 - b LOOP_HEIGHT_256_GET_TILED_END - -LOOP_HEIGHT_256_GET_TILED_EVEN: - add r11, r3, #31 @ temp2 = ((yuv420_height+31)>>5)<<5 - bic r11, r11, #0x1F - add r10, r5, #32 @ if ((i+32)<temp2) - cmp r10, r11 - bge LOOP_HEIGHT_256_GET_TILED_EVEN1 - add r10, r12, #2 @ temp1 = temp3+2 - bic r10, r10, #0x3 @ temp1 = (temp1>>2)<<2 - add r7, r12, r10 @ tiled_offset = temp3+temp1@ - add r10, r2, #127 @ temp1 = ((yuv420_width+127)>>7)<<7 - bic r10, r10, #0x7F - mov r10, r10, asr #6 @ tiled_offset = tiled_offset+temp4*(temp1>>6) - mla r7, r14, r10, r7 - mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11 - add r8, r7, #12288 @ tiled_offset1 = tiled_offset+2048*6 - mov r14, #8 - b LOOP_HEIGHT_256_GET_TILED_END - -LOOP_HEIGHT_256_GET_TILED_EVEN1: - add r10, r2, #127 @ temp1 = ((yuv420_width+127)>>7)<<7 - bic r10, r10, #0x7F - mov r10, r10, asr #6 @ tiled_offset = temp4*(temp1>>6) - mul r7, r14, r10 - add r7, r7, r12 @ tiled_offset = tiled_offset+temp3 - mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11 - add r8, r7, #4096 @ tiled_offset1 = tiled_offset+2048*2 - mov r14, #4 - -LOOP_HEIGHT_256_GET_TILED_END: - - ldr r12, [sp, #48] @ right - ldr r9, [sp, #44] @ top - and r10, r5, #0x1F @ temp1 = i&0x1F - add r7, r7, r10, lsl #6 @ tiled_offset = tiled_offset+64*(temp1) - add r8, r8, r10, lsl #6 @ tiled_offset1 = tiled_offset1+64*(temp1) - sub r11, r2, r6 @ temp2 = yuv420_width-left(==j)-right - sub r11, r11, r12 - sub r9, r5, r9 @ linear_offset = temp2*(i-top)@ - mul r9, r11, r9 - add r12, r6, #256 @ temp3 = ((j+256)>>8)<<8@ - bic r12, r12, #0xFF - sub r12, r12, r6 @ temp3 = temp3-j@ - and r10, r6, #0x3F @ temp1 = left(==j)&0x3F - - cmp r12, #192 @ if (temp3 > 192) - ble LOOP_HEIGHT_256_LEFT_192 - add r11, r1, r7 @ r11 = nv12t_src+tiled_offset+temp1 - add r11, r11, r10 - pld [r11] - add r12, r1, r7 @ r12 = nv12t_src+tiled_offset+2048 - pld [r11, #32] - add r12, r12, #2048 - pld [r12] - cmp r10, #0 - pld [r12, #32] - stmnefd sp!, {r9-r12, r14} @ backup registers - rsbne r10, r10, #64 - blne MEMCOPY_UNDER_64 - ldmnefd sp!, {r9-r12, r14} @ restore registers - bne LOOP_HEIGHT_256_LEFT_256_64 - vld1.8 {q0, q1}, [r11]! @ load {nv12t_src+tiled_offset+temp1, 64} - vld1.8 {q2, q3}, [r11] - add r11, r0, r9 @ r11 = yuv420_dest+linear_offset - vst1.8 {q0, q1}, [r11]! @ store {yuv420_dest+linear_offset, 64} - vst1.8 {q2, q3}, [r11]! -LOOP_HEIGHT_256_LEFT_256_64: - add r11, r1, r8 @ r11 = nv12t_src+tiled_offset1 - pld [r11] - vld1.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset+2048, 64} - pld [r11, #32] - vld1.8 {q6, q7}, [r12] - add r12, r11, #2048 @ r12 = nv12t_src+tiled_offset1+2048 - pld [r12] - vld1.8 {q8, q9}, [r11]! @ load {nv12t_src+tiled_offset1, 64} - pld [r12, #32] - vld1.8 {q10, q11}, [r11] - vld1.8 {q12, q13}, [r12]! @ load {nv12t_src+tiled_offset1+2048, 64} - vld1.8 {q14, q15}, [r12] - - sub r11, r0, r10 @ r11 = yuv420_dest+linear_offset+64-temp1 - add r12, r9, #64 - add r11, r11, r12 - - vst1.8 {q4, q5}, [r11]! @ store {yuv420_dest+linear_offset+64-temp1, 64} - vst1.8 {q6, q7}, [r11]! - vst1.8 {q8, q9}, [r11]! @ store {yuv420_dest+linear_offset+128-temp1, 64} - vst1.8 {q10, q11}, [r11]! - vst1.8 {q12, q13}, [r11]! @ store {yuv420_dest+linear_offset+192-temp1, 64} - vst1.8 {q14, q15}, [r11]! - - add r9, r9, #256 - sub r9, r9, r10 - b LOOP_HEIGHT_256_LEFT_END - -LOOP_HEIGHT_256_LEFT_192: - cmp r12, #128 @ if (temp3 > 128) - ble LOOP_HEIGHT_256_LEFT_128 - add r11, r1, r7 @ r11 = nv12t_src+tiled_offset+2048+temp1 - add r11, r11, r10 - add r11, r11, #2048 - pld [r11] - add r12, r1, r8 @ r12 = nv12t_src+tiled_offset1 - pld [r11, #32] - cmp r10, #0 - pld [r12] - stmnefd sp!, {r9-r12, r14} @ backup registers - pld [r12, #32] - rsbne r10, r10, #64 - blne MEMCOPY_UNDER_64 - ldmnefd sp!, {r9-r12, r14} @ restore registers - bne LOOP_HEIGHT_256_LEFT_192_64 - vld1.8 {q0, q1}, [r11]! @ load {nv12t_src+tiled_offset+2048+temp1, 64} - vld1.8 {q2, q3}, [r11] - add r11, r0, r9 @ r11 = yuv420_dest+linear_offset - vst1.8 {q0, q1}, [r11]! @ store {yuv420_dest+linear_offset, 64} - vst1.8 {q2, q3}, [r11]! -LOOP_HEIGHT_256_LEFT_192_64: - add r11, r1, r8 @ r11 = nv12t_src+tiled_offset1+2048 - add r11, r11, #2048 - pld [r11] - vld1.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset1, 64} - pld [r11, #32] - vld1.8 {q6, q7}, [r12] - vld1.8 {q8, q9}, [r11]! @ load {nv12t_src+tiled_offset1+2048, 64} - vld1.8 {q10, q11}, [r11] - - sub r11, r0, r10 @ r11 = yuv420_dest+linear_offset+64-temp1 - add r12, r9, #64 - add r11, r11, r12 - - vst1.8 {q4, q5}, [r11]! @ store {yuv420_dest+linear_offset+64-temp1, 64} - vst1.8 {q6, q7}, [r11]! - vst1.8 {q8, q9}, [r11]! @ store {yuv420_dest+linear_offset+128-temp1, 64} - vst1.8 {q10, q11}, [r11]! - - add r9, r9, #192 - sub r9, r9, r10 - b LOOP_HEIGHT_256_LEFT_END - -LOOP_HEIGHT_256_LEFT_128: - cmp r12, #64 @ if (temp3 > 64) - ble LOOP_HEIGHT_256_LEFT_64 - add r11, r1, r8 @ r11 = nv12t_src+tiled_offset1+temp1 - add r11, r11, r10 - pld [r11] - add r12, r1, r8 @ r12 = nv12t_src+tiled_offset1 - add r12, r12, #2048 - pld [r11, #32] - cmp r10, #0 - pld [r12] - stmnefd sp!, {r9-r12, r14} @ backup registers - pld [r12, #32] - rsbne r10, r10, #64 - blne MEMCOPY_UNDER_64 - ldmnefd sp!, {r9-r12, r14} @ restore registers - bne LOOP_HEIGHT_256_LEFT_128_64 - vld1.8 {q0, q1}, [r11]! @ load {nv12t_src+tiled_offset1+temp1, 64} - vld1.8 {q2, q3}, [r11] - add r11, r0, r9 @ r11 = yuv420_dest+linear_offset - vst1.8 {q0, q1}, [r11]! @ store {yuv420_dest+linear_offset, 64} - vst1.8 {q2, q3}, [r11]! -LOOP_HEIGHT_256_LEFT_128_64: - vld1.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset1, 64} - vld1.8 {q6, q7}, [r12] - - sub r11, r0, r10 @ r11 = yuv420_dest+linear_offset+64-temp1 - add r12, r9, #64 - add r11, r11, r12 - - vst1.8 {q4, q5}, [r11]! @ store {yuv420_dest+linear_offset+64-temp1, 64} - vst1.8 {q6, q7}, [r11]! - - add r9, r9, #128 - sub r9, r9, r10 - b LOOP_HEIGHT_256_LEFT_END - -LOOP_HEIGHT_256_LEFT_64: - add r11, r1, r8 @ r11 = nv12t_src+tiled_offset1+2048+temp1 - add r11, r11, #2048 - add r11, r11, r10 - cmp r10, #0 - pld [r11] - stmnefd sp!, {r9-r12, r14} @ backup registers - pld [r11, #32] - rsbne r10, r10, #64 - blne MEMCOPY_UNDER_64 - ldmnefd sp!, {r9-r12, r14} @ restore registers - bne LOOP_HEIGHT_256_LEFT_64_64 - vld1.8 {q0, q1}, [r11]! @ load {nv12t_src+tiled_offset1+temp1, 64} - vld1.8 {q2, q3}, [r11] - add r11, r0, r9 @ r11 = yuv420_dest+linear_offset - vst1.8 {q0, q1}, [r11]! @ store {yuv420_dest+linear_offset, 64} - vst1.8 {q2, q3}, [r11]! -LOOP_HEIGHT_256_LEFT_64_64: - add r9, r9, #64 - sub r9, r9, r10 - -LOOP_HEIGHT_256_LEFT_END: - - ldr r12, [sp, #48] @ right - add r7, r7, r14, lsl #11 @ tiled_offset = tiled_offset+temp4*2048 - add r10, r1, r7 @ r10 = nv12t_src+tiled_offset - pld [r10] - bic r6, r6, #0xFF @ j = (left>>8)<<8 - pld [r10, #32] - add r6, r6, #256 @ j = j + 256 - sub r11, r2, r12 @ temp2 = yuv420_width-right-256 - sub r11, r11, #256 - cmp r6, r11 - bgt LOOP_HEIGHT_256_WIDTH_END - -LOOP_HEIGHT_256_WIDTH: - add r12, r10, #2048 @ r12 = nv12t_src+tiled_offset+2048 - pld [r12] - vld1.8 {q0, q1}, [r10]! @ load {nv12t_src+tiled_offset, 64} - pld [r12, #32] - vld1.8 {q2, q3}, [r10] - - add r8, r8, r14, lsl #11 @ tiled_offset1 = tiled_offset1+temp4*2048 - add r10, r1, r8 @ r10 = nv12t_src+tiled_offset1 - pld [r10] - vld1.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset+2048, 64} - pld [r10, #32] - vld1.8 {q6, q7}, [r12] - - add r12, r10, #2048 @ r12 = nv12t_src+tiled_offset+2048 - pld [r12] - vld1.8 {q8, q9}, [r10]! @ load {nv12t_src+tiled_offset+2048, 64} - pld [r12, #32] - vld1.8 {q10, q11}, [r10] - - add r7, r7, r14, lsl #11 @ tiled_offset = tiled_offset+temp4*2048 - add r10, r1, r7 - pld [r10] - vld1.8 {q12, q13}, [r12]! @ load {nv12t_src+tiled_offset+2048, 64} - pld [r10, #32] - vld1.8 {q14, q15}, [r12] - - add r12, r0, r9 @ r12 = yuv420_dest+linear_offset - vst1.8 {q0, q1}, [r12]! - vst1.8 {q2, q3}, [r12]! - vst1.8 {q4, q5}, [r12]! - vst1.8 {q6, q7}, [r12]! - vst1.8 {q8, q9}, [r12]! - vst1.8 {q10, q11}, [r12]! - vst1.8 {q12, q13}, [r12]! - vst1.8 {q14, q15}, [r12]! - add r9, r9, #256 @ linear_offset = linear_offset+256 - - add r12, r10, #2048 @ r12 = nv12t_src+tiled_offset+2048 - - add r6, r6, #256 @ j=j+256 - cmp r6, r11 @ j<=temp2 - ble LOOP_HEIGHT_256_WIDTH - -LOOP_HEIGHT_256_WIDTH_END: - - add r8, r8, r14, lsl #11 @ tiled_offset1 = tiled_offset1+temp4*2048 - ldr r14, [sp, #48] @ right - sub r11, r2, r6 @ temp2 = yuv420_width-right-j - sub r11, r11, r14 - cmp r11, #0 - beq LOOP_HEIGHT_256_RIGHT_END - cmp r11, #192 - ble LOOP_HEIGHT_256_RIGHT_192 - add r12, r10, #2048 - pld [r12] - vld1.8 {q0, q1}, [r10]! @ load {nv12t_src+tiled_offset} - pld [r12, #32] - vld1.8 {q2, q3}, [r10] - - add r10, r1, r8 @ r10 = nv12t_src+tiled_offset1 - pld [r10] - vld1.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset+2048} - pld [r10, #32] - vld1.8 {q6, q7}, [r12] - - add r14, r10, #2048 @ r10 = nv12t_src+tiled_offset1+2048 - pld [r14] - vld1.8 {q8, q9}, [r10]! @ load {nv12t_src+tiled_offset1} - pld [r14, #32] - vld1.8 {q10, q11}, [r10] - - add r12, r0, r9 @ r12 = yuv420_dest+linear_offset - vst1.8 {q0, q1}, [r12]! - vst1.8 {q2, q3}, [r12]! - vst1.8 {q4, q5}, [r12]! - vst1.8 {q6, q7}, [r12]! - vst1.8 {q8, q9}, [r12]! - vst1.8 {q10, q11}, [r12]! - add r9, r9, #192 @ linear_offset = linear_offset+192 - - stmfd sp!, {r9-r12, r14} @ backup registers - sub r10, r11, #192 - mov r11, r14 - bl MEMCOPY_UNDER_64 - ldmfd sp!, {r9-r12, r14} @ restore registers - b LOOP_HEIGHT_256_RIGHT_END - -LOOP_HEIGHT_256_RIGHT_192: - cmp r11, #128 - ble LOOP_HEIGHT_256_RIGHT_128 - add r12, r10, #2048 - pld [r12] - vld1.8 {q0, q1}, [r10]! @ load {nv12t_src+tiled_offset} - pld [r12, #32] - vld1.8 {q2, q3}, [r10] - - add r14, r1, r8 @ r10 = nv12t_src+tiled_offset1 - pld [r14] - vld1.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset+2048} - pld [r14, #32] - vld1.8 {q6, q7}, [r12] - - add r12, r0, r9 @ r12 = yuv420_dest+linear_offset - vst1.8 {q0, q1}, [r12]! - vst1.8 {q2, q3}, [r12]! - vst1.8 {q4, q5}, [r12]! - vst1.8 {q6, q7}, [r12]! - add r9, r9, #128 @ linear_offset = linear_offset+128 - - stmfd sp!, {r9-r12, r14} @ backup registers - sub r10, r11, #128 - mov r11, r14 - bl MEMCOPY_UNDER_64 - ldmfd sp!, {r9-r12, r14} @ restore registers - b LOOP_HEIGHT_256_RIGHT_END - -LOOP_HEIGHT_256_RIGHT_128: - cmp r11, #64 - ble LOOP_HEIGHT_256_RIGHT_64 - add r14, r10, #2048 - pld [r14] - vld1.8 {q0, q1}, [r10]! @ load {nv12t_src+tiled_offset} - pld [r14, #32] - vld1.8 {q2, q3}, [r10] - - add r12, r0, r9 @ r12 = yuv420_dest+linear_offset - vst1.8 {q0, q1}, [r12]! - vst1.8 {q2, q3}, [r12]! - add r9, r9, #64 @ linear_offset = linear_offset+64 - - stmfd sp!, {r9-r12, r14} @ backup registers - sub r10, r11, #64 - mov r11, r14 - bl MEMCOPY_UNDER_64 - ldmfd sp!, {r9-r12, r14} @ restore registers - b LOOP_HEIGHT_256_RIGHT_END - -LOOP_HEIGHT_256_RIGHT_64: - stmfd sp!, {r9-r12, r14} @ backup registers - mov r14, r11 - mov r11, r10 - mov r10, r14 - bl MEMCOPY_UNDER_64 - ldmfd sp!, {r9-r12, r14} @ restore registers - -LOOP_HEIGHT_256_RIGHT_END: - - ldr r14, [sp, #52] @ buttom - add r5, r5, #1 @ i=i+1 - sub r14, r3, r14 @ i<yuv420_height-buttom - cmp r5, r14 - blt LOOP_HEIGHT_256 - b RESTORE_REG - -LOOP_HEIGHT_64_START: - cmp r10, #64 @ if (temp1 >= 64) - blt LOOP_HEIGHT_2_START - - ldr r5, [sp, #44] @ i = top -LOOP_HEIGHT_64: - ldr r6, [sp, #40] @ j = left - stmfd sp!, {r0-r3, r12} @ backup parameters - mov r0, r2 - mov r1, r3 - mov r2, r6 - mov r3, r5 - bl tile_4x2_read_asm - mov r7, r0 - ldmfd sp!, {r0-r3, r12} @ restore parameters - ldr r9, [sp, #44] @ linear_offset = top - add r11, r6, #64 @ temp2 = ((j+64)>>6)<<6 - bic r11, r11, #0x3F - sub r11, r11, r6 @ temp2 = temp2-j - sub r9, r5, r9 @ linear_offset = temp1*(i-top) - mul r9, r9, r10 - and r14, r6, #0x3 @ temp4 = j&0x3 - add r7, r7, r14 @ tiled_offset = tiled_offset+temp4 - stmfd sp!, {r9-r12} @ backup parameters - mov r10, r11 - add r11, r1, r7 - bl MEMCOPY_UNDER_64 - ldmfd sp!, {r9-r12} @ restore parameters - add r9, r9, r11 @ linear_offset = linear_offset+temp2 - add r6, r6, r11 @ j = j+temp2@ - - add r14, r6, #64 - cmp r14, r12 - bgt LOOP_HEIGHT_64_1 - stmfd sp!, {r0-r3, r12} @ backup parameters - mov r0, r2 - mov r1, r3 - mov r2, r6 - mov r3, r5 - bl tile_4x2_read_asm - mov r7, r0 - ldmfd sp!, {r0-r3, r12} @ restore parameters - add r7, r1, r7 - vld1.8 {q0, q1}, [r7]! - vld1.8 {q2, q3}, [r7] - add r7, r0, r9 - vst1.8 {q0, q1}, [r7]! - vst1.8 {q2, q3}, [r7] - add r9, r9, #64 - add r6, r6, #64 - -LOOP_HEIGHT_64_1: - add r14, r6, #64 - cmp r14, r12 - bgt LOOP_HEIGHT_64_2 - stmfd sp!, {r0-r3, r12} @ backup parameters - mov r0, r2 - mov r1, r3 - mov r2, r6 - mov r3, r5 - bl tile_4x2_read_asm - mov r7, r0 - ldmfd sp!, {r0-r3, r12} @ restore parameters - add r7, r1, r7 - vld1.8 {q0, q1}, [r7]! - vld1.8 {q2, q3}, [r7] - add r7, r0, r9 - vst1.8 {q0, q1}, [r7]! - vst1.8 {q2, q3}, [r7] - add r9, r9, #64 - add r6, r6, #64 - -LOOP_HEIGHT_64_2: - cmp r6, r12 - bge LOOP_HEIGHT_64_3 - stmfd sp!, {r0-r3, r12} @ backup parameters - mov r0, r2 - mov r1, r3 - mov r2, r6 - mov r3, r5 - bl tile_4x2_read_asm - mov r7, r0 - ldmfd sp!, {r0-r3, r12} @ restore parameters - sub r11, r12, r6 - stmfd sp!, {r9-r12} @ backup parameters - mov r10, r11 - add r11, r1, r7 - bl MEMCOPY_UNDER_64 - ldmfd sp!, {r9-r12} @ restore parameters - -LOOP_HEIGHT_64_3: - - ldr r14, [sp, #52] @ buttom - add r5, r5, #1 @ i=i+1 - sub r14, r3, r14 @ i<yuv420_height-buttom - cmp r5, r14 - blt LOOP_HEIGHT_64 - b RESTORE_REG - -LOOP_HEIGHT_2_START: - - ldr r5, [sp, #44] @ i = top -LOOP_HEIGHT_2: - - ldr r6, [sp, #40] @ j = left - ldr r9, [sp, #44] @ linear_offset = top - add r11, r6, #64 @ temp2 = ((j+64)>>6)<<6 - bic r11, r11, #0x3F - sub r11, r11, r6 @ temp2 = temp2-j - sub r9, r5, r9 @ linear_offset = temp1*(i-top) - mul r9, r10, r9 - add r9, r0, r9 @ linear_offset = linear_dst+linear_offset -LOOP_HEIGHT_2_WIDTH: - stmfd sp!, {r0-r3, r12} @ backup parameters - mov r0, r2 - mov r1, r3 - mov r2, r6 - mov r3, r5 - bl tile_4x2_read_asm - mov r7, r0 - ldmfd sp!, {r0-r3, r12} @ restore parameters - - and r14, r6, #0x3 @ temp4 = j&0x3@ - add r7, r7, r14 @ tiled_offset = tiled_offset+temp4@ - add r7, r1, r7 - - ldrh r14, [r7] - strh r14, [r9], #2 - - ldr r14, [sp, #48] @ right - add r6, r6, #2 @ j=j+2 - sub r14, r2, r14 @ j<yuv420_width-right - cmp r6, r14 - blt LOOP_HEIGHT_2_WIDTH - - ldr r14, [sp, #52] @ buttom - add r5, r5, #1 @ i=i+1 - sub r14, r3, r14 @ i<yuv420_height-buttom - cmp r5, r14 - blt LOOP_HEIGHT_2 - -RESTORE_REG: - ldmfd sp!, {r4-r12,r15} @ restore registers - -MEMCOPY_UNDER_64: @ count=r10, src=r11 - cmp r10, #32 - add r9, r0, r9 @ r9 = yuv420_dest+linear_offset - blt MEMCOPY_UNDER_32 - vld1.8 {q0, q1}, [r11]! @ load {nv12t_src+tiled_offset+temp1, 64} - sub r10, r10, #32 - cmp r10, #0 - vst1.8 {q0, q1}, [r9]! @ load {nv12t_src+tiled_offset+temp1, 64} - beq MEMCOPY_UNDER_END -MEMCOPY_UNDER_32: - cmp r10, #16 - blt MEMCOPY_UNDER_16 - vld1.8 {q0}, [r11]! @ load {nv12t_src+tiled_offset+temp1, 64} - sub r10, r10, #16 - cmp r10, #0 - vst1.8 {q0}, [r9]! @ load {nv12t_src+tiled_offset+temp1, 64} - beq MEMCOPY_UNDER_END -MEMCOPY_UNDER_16: - ldrb r12, [r11], #1 - strb r12, [r9], #1 - subs r10, r10, #1 - bne MEMCOPY_UNDER_16 - -MEMCOPY_UNDER_END: - and r10, r6, #0x3F @ temp1 = left(==j)&0x3F - cmp r10, #0 - mov pc, lr - -tile_4x2_read_asm: -LFB0: - add ip, r3, #32 - sub r0, r0, #1 - cmp r1, ip - cmple r3, r1 - mov ip, r2, asr #2 - mov r0, r0, asr #7 - stmfd sp!, {r4, r5, lr} -LCFI0: - add r0, r0, #1 - bge L2 - sub r1, r1, #1 - tst r1, #32 - bne L2 - tst r3, #32 - bne L2 - mov r4, r2, asr #7 - and r1, r3, #31 - eor r4, r4, r3, asr #5 - ubfx r3, r3, #6, #8 - tst r4, #1 - ubfx r4, r2, #8, #6 - and ip, ip, #15 - mov r2, r2, asr #6 - mla r3, r0, r3, r4 - orr r1, ip, r1, asl #4 - b L9 -L2: - mov r2, ip, asr #5 - and r4, r3, #31 - eor r1, r2, r3, asr #5 - and r5, r2, #127 - ubfx r3, r3, #6, #8 - tst r1, #1 - and r1, ip, #15 - mov r2, ip, asr #4 - mla r3, r0, r3, r5 - orr r1, r1, r4, asl #4 -L9: - andne r2, r2, #1 - andeq r2, r2, #1 - orrne r2, r2, #2 - mov r1, r1, asl #2 - orr r3, r1, r3, asl #13 - orr r0, r3, r2, asl #11 - ldmfd sp!, {r4, r5, pc} -LFE0: - .fnend - diff --git a/exynos4/hal/libswconverter/csc_tiled_to_linear_deinterleave_crop_neon.s b/exynos4/hal/libswconverter/csc_tiled_to_linear_deinterleave_crop_neon.s deleted file mode 100644 index cdd101e..0000000 --- a/exynos4/hal/libswconverter/csc_tiled_to_linear_deinterleave_crop_neon.s +++ /dev/null @@ -1,786 +0,0 @@ -/* - * - * 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 csc_tiled_to_linear_deinterleave_crop_neon.s - * @brief SEC_OMX specific define - * @author ShinWon Lee (shinwon.lee@samsung.com) - * @version 1.0 - * @history - * 2012.02.01 : Create - */ - -/* - * Converts and Deinterleaves tiled data to linear - * Crops left, top, right, buttom - * 1. UV of NV12T to UV of YUV420P - * - * @param yuv420_u_dest - * U plane address of YUV420P[out] - * - * @param yuv420_v_dest - * V plane address of YUV420P[out] - * - * @param nv12t_src - * UV plane address of NV12T[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_uv_height - * Height/2 of YUV420[in] - * - * @param left - * Crop size of left. It should be even. - * - * @param top - * Crop size of top. It should be even. - * - * @param right - * Crop size of right. It should be even. - * - * @param buttom - * Crop size of buttom. It should be even. - */ - - .arch armv7-a - .text - .global csc_tiled_to_linear_deinterleave_crop_neon - .type csc_tiled_to_linear_deinterleave_crop_neon, %function -csc_tiled_to_linear_deinterleave_crop_neon: - .fnstart - - @r0 yuv420_u_dest - @r1 yuv420_v_dest - @r2 nv12t_src - @r3 yuv420_width - @r4 yuv420_height - @r5 i - @r6 j - @r7 tiled_offset - @r8 tiled_offset1 - @r9 linear_offset - @r10 temp1 - @r11 temp2 - @r12 temp3 - @r14 temp4 - - stmfd sp!, {r4-r12,r14} @ backup registers - - ldr r4, [sp, #40] @ r4 = yuv420_height - - ldr r12, [sp, #52] @ r12 = right - ldr r10, [sp, #44] @ r10 = left - sub r12, r3, r12 @ temp3 = yuv420_width-right@ - sub r10, r12, r10 @ temp1 = temp3-left@ - cmp r10, #256 @ if (temp1 >= 256) - blt LOOP_HEIGHT_64_START - - ldr r5, [sp, #48] @ top -LOOP_HEIGHT_256: - ldr r6, [sp, #44] @ j = left - mov r14, r5, asr #5 @ temp4 = i>>5 - bic r12, r6, #0xFF @ temp3 = (j>>8)<<8 - mov r12, r12, asr #6 @ temp3 = temp3>>6 - and r11, r14, #0x1 @ if (temp4 & 0x1) - cmp r11, #0x1 - bne LOOP_HEIGHT_256_GET_TILED_EVEN -LOOP_HEIGHT_256_GET_TILED_ODD: - sub r7, r14, #1 @ tiled_offset = temp4-1 - add r10, r3, #127 @ temp1 = ((yuv420_width+127)>>7)<<7 - bic r10, r10, #0x7F - mov r10, r10, asr #6 @ tiled_offset = tiled_offset*(temp1>>6) - mul r7, r7, r10 - add r7, r7, r12 @ tiled_offset = tiled_offset+temp3 - add r7, r7, #2 @ tiled_offset = tiled_offset+2 - bic r10, r12, #0x3 @ temp1 = (temp3>>2)<<2 - add r7, r7, r10 @ tiled_offset = tiled_offset+temp1 - mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11 - add r8, r7, #4096 @ tiled_offset1 = tiled_offset+2048*2 - mov r14, #8 - b LOOP_HEIGHT_256_GET_TILED_END - -LOOP_HEIGHT_256_GET_TILED_EVEN: - add r11, r4, #31 @ temp2 = ((yuv420_height+31)>>5)<<5 - bic r11, r11, #0x1F - add r10, r5, #32 @ if ((i+32)<temp2) - cmp r10, r11 - bge LOOP_HEIGHT_256_GET_TILED_EVEN1 - add r10, r12, #2 @ temp1 = temp3+2 - bic r10, r10, #0x3 @ temp1 = (temp1>>2)<<2 - add r7, r12, r10 @ tiled_offset = temp3+temp1@ - add r10, r3, #127 @ temp1 = ((yuv420_width+127)>>7)<<7 - bic r10, r10, #0x7F - mov r10, r10, asr #6 @ tiled_offset = tiled_offset+temp4*(temp1>>6) - mla r7, r14, r10, r7 - mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11 - add r8, r7, #12288 @ tiled_offset1 = tiled_offset+2048*6 - mov r14, #8 - b LOOP_HEIGHT_256_GET_TILED_END - -LOOP_HEIGHT_256_GET_TILED_EVEN1: - add r10, r3, #127 @ temp1 = ((yuv420_width+127)>>7)<<7 - bic r10, r10, #0x7F - mov r10, r10, asr #6 @ tiled_offset = temp4*(temp1>>6) - mul r7, r14, r10 - add r7, r7, r12 @ tiled_offset = tiled_offset+temp3 - mov r7, r7, lsl #11 @ tiled_offset = tiled_offset<<11 - add r8, r7, #4096 @ tiled_offset1 = tiled_offset+2048*2 - mov r14, #4 - -LOOP_HEIGHT_256_GET_TILED_END: - - ldr r12, [sp, #52] @ right - ldr r9, [sp, #48] @ top - and r10, r5, #0x1F @ temp1 = i&0x1F - add r7, r7, r10, lsl #6 @ tiled_offset = tiled_offset+64*(temp1) - add r8, r8, r10, lsl #6 @ tiled_offset1 = tiled_offset1+64*(temp1) - sub r11, r3, r6 @ temp2 = yuv420_width-left(==j)-right - sub r11, r11, r12 - sub r9, r5, r9 @ linear_offset = temp2*(i-top)/2@ - mul r9, r11, r9 - mov r9, r9, asr #1 - add r12, r6, #256 @ temp3 = ((j+256)>>8)<<8@ - bic r12, r12, #0xFF - sub r12, r12, r6 @ temp3 = temp3-j@ - and r10, r6, #0x3F @ temp1 = left(==j)&0x3F - - cmp r12, #192 @ if (temp3 > 192) - ble LOOP_HEIGHT_256_LEFT_192 - add r11, r2, r7 @ r11 = nv12t_src+tiled_offset+temp1 - add r11, r11, r10 - pld [r11] - add r12, r2, r7 @ r12 = nv12t_src+tiled_offset+2048 - pld [r11, #32] - add r12, r12, #2048 - pld [r12] - cmp r10, #0 - pld [r12, #32] - stmnefd sp!, {r8-r12, r14} @ backup registers - rsbne r10, r10, #64 - blne INTERLEAVED_MEMCOPY_UNDER_64 - ldmnefd sp!, {r8-r12, r14} @ restore registers - bne LOOP_HEIGHT_256_LEFT_256_64 - vld2.8 {q0, q1}, [r11]! @ load {nv12t_src+tiled_offset+temp1, 64} - vld2.8 {q2, q3}, [r11] - add r11, r0, r9 @ r11 = yuv420_u_dest+linear_offset - vst1.8 {q0}, [r11]! - vst1.8 {q2}, [r11]! - add r11, r1, r9 @ r11 = yuv420_v_dest+linear_offset - vst1.8 {q1}, [r11]! - vst1.8 {q3}, [r11]! -LOOP_HEIGHT_256_LEFT_256_64: - add r11, r2, r8 @ r11 = nv12t_src+tiled_offset1 - pld [r11] - vld2.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset+2048, 64} - pld [r11, #32] - vld2.8 {q6, q7}, [r12] - add r12, r11, #2048 @ r12 = nv12t_src+tiled_offset1+2048 - pld [r12] - vld2.8 {q8, q9}, [r11]! @ load {nv12t_src+tiled_offset1, 64} - pld [r12, #32] - vld2.8 {q10, q11}, [r11] - vld2.8 {q12, q13}, [r12]! @ load {nv12t_src+tiled_offset1+2048, 64} - vld2.8 {q14, q15}, [r12] - - add r11, r0, r9 @ r11 = yuv420_u_dest+linear_offset+32-temp1/2 - add r11, r11, #32 - sub r11, r11, r10, asr #1 - vst1.8 {q4}, [r11]! - vst1.8 {q6}, [r11]! - vst1.8 {q8}, [r11]! - vst1.8 {q10}, [r11]! - vst1.8 {q12}, [r11]! - vst1.8 {q14}, [r11]! - - add r11, r1, r9 @ r11 = yuv420_v_dest+linear_offset+32-temp1/2 - add r11, r11, #32 - sub r11, r11, r10, asr #1 - vst1.8 {q5}, [r11]! - vst1.8 {q7}, [r11]! - vst1.8 {q9}, [r11]! - vst1.8 {q11}, [r11]! - vst1.8 {q13}, [r11]! - vst1.8 {q15}, [r11]! - - add r9, r9, #128 - sub r9, r9, r10, asr #1 - b LOOP_HEIGHT_256_LEFT_END - -LOOP_HEIGHT_256_LEFT_192: - cmp r12, #128 @ if (temp3 > 128) - ble LOOP_HEIGHT_256_LEFT_128 - add r11, r2, r7 @ r11 = nv12t_src+tiled_offset+2048+temp1 - add r11, r11, r10 - add r11, r11, #2048 - pld [r11] - add r12, r2, r8 @ r12 = nv12t_src+tiled_offset1 - pld [r11, #32] - cmp r10, #0 - pld [r12] - stmnefd sp!, {r8-r12, r14} @ backup registers - pld [r12, #32] - rsbne r10, r10, #64 - blne INTERLEAVED_MEMCOPY_UNDER_64 - ldmnefd sp!, {r8-r12, r14} @ restore registers - bne LOOP_HEIGHT_256_LEFT_192_64 - vld2.8 {q0, q1}, [r11]! @ load {nv12t_src+tiled_offset+2048+temp1, 64} - vld2.8 {q2, q3}, [r11] - add r11, r0, r9 @ r11 = yuv420_u_dest+linear_offset - vst1.8 {q0}, [r11]! - vst1.8 {q2}, [r11]! - add r11, r1, r9 @ r11 = yuv420_v_dest+linear_offset - vst1.8 {q1}, [r11]! - vst1.8 {q3}, [r11]! -LOOP_HEIGHT_256_LEFT_192_64: - add r11, r2, r8 @ r11 = nv12t_src+tiled_offset1+2048 - add r11, r11, #2048 - pld [r11] - vld2.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset1, 64} - pld [r11, #32] - vld2.8 {q6, q7}, [r12] - vld2.8 {q8, q9}, [r11]! @ load {nv12t_src+tiled_offset1+2048, 64} - vld2.8 {q10, q11}, [r11] - - add r11, r0, r9 @ r11 = yuv420_u_dest+linear_offset+32-temp1/2 - add r11, r11, #32 - sub r11, r11, r10, asr #1 - vst1.8 {q4}, [r11]! - vst1.8 {q6}, [r11]! - vst1.8 {q8}, [r11]! - vst1.8 {q10}, [r11]! - - add r11, r1, r9 @ r11 = yuv420_v_dest+linear_offset+32-temp1/2 - add r11, r11, #32 - sub r11, r11, r10, asr #1 - vst1.8 {q5}, [r11]! - vst1.8 {q7}, [r11]! - vst1.8 {q9}, [r11]! - vst1.8 {q11}, [r11]! - - add r9, r9, #96 - sub r9, r9, r10, asr #1 - b LOOP_HEIGHT_256_LEFT_END - -LOOP_HEIGHT_256_LEFT_128: - cmp r12, #64 @ if (temp3 > 64) - ble LOOP_HEIGHT_256_LEFT_64 - add r11, r2, r8 @ r11 = nv12t_src+tiled_offset1+temp1 - add r11, r11, r10 - pld [r11] - add r12, r2, r8 @ r12 = nv12t_src+tiled_offset1 - add r12, r12, #2048 - pld [r11, #32] - cmp r10, #0 - pld [r12] - stmnefd sp!, {r8-r12, r14} @ backup registers - pld [r12, #32] - rsbne r10, r10, #64 - blne INTERLEAVED_MEMCOPY_UNDER_64 - ldmnefd sp!, {r8-r12, r14} @ restore registers - bne LOOP_HEIGHT_256_LEFT_128_64 - vld2.8 {q0, q1}, [r11]! @ load {nv12t_src+tiled_offset1+temp1, 64} - vld2.8 {q2, q3}, [r11] - add r11, r0, r9 @ r11 = yuv420_u_dest+linear_offset - vst1.8 {q0}, [r11]! - vst1.8 {q2}, [r11]! - add r11, r1, r9 @ r11 = yuv420_v_dest+linear_offset - vst1.8 {q1}, [r11]! - vst1.8 {q3}, [r11]! -LOOP_HEIGHT_256_LEFT_128_64: - vld2.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset1, 64} - vld2.8 {q6, q7}, [r12] - - add r11, r0, r9 @ r11 = yuv420_u_dest+linear_offset+32-temp1/2 - add r11, r11, #32 - sub r11, r11, r10, asr #1 - vst1.8 {q4}, [r11]! - vst1.8 {q6}, [r11]! - - add r11, r1, r9 @ r11 = yuv420_v_dest+linear_offset+32-temp1/2 - add r11, r11, #32 - sub r11, r11, r10, asr #1 - vst1.8 {q5}, [r11]! - vst1.8 {q7}, [r11]! - - add r9, r9, #64 - sub r9, r9, r10, asr #1 - b LOOP_HEIGHT_256_LEFT_END - -LOOP_HEIGHT_256_LEFT_64: - add r11, r2, r8 @ r11 = nv12t_src+tiled_offset1+2048+temp1 - add r11, r11, #2048 - add r11, r11, r10 - cmp r10, #0 - pld [r11] - stmnefd sp!, {r8-r12, r14} @ backup registers - pld [r11, #32] - rsbne r10, r10, #64 - blne INTERLEAVED_MEMCOPY_UNDER_64 - ldmnefd sp!, {r8-r12, r14} @ restore registers - bne LOOP_HEIGHT_256_LEFT_64_64 - vld2.8 {q0, q1}, [r11]! @ load {nv12t_src+tiled_offset1+temp1, 64} - vld2.8 {q2, q3}, [r11] - add r11, r0, r9 @ r11 = yuv420_dest+linear_offset - vst1.8 {q0, q1}, [r11]! @ store {yuv420_dest+linear_offset, 64} - vst1.8 {q2, q3}, [r11]! -LOOP_HEIGHT_256_LEFT_64_64: - add r9, r9, #32 - sub r9, r9, r10, asr #1 - -LOOP_HEIGHT_256_LEFT_END: - - ldr r12, [sp, #52] @ right - add r7, r7, r14, lsl #11 @ tiled_offset = tiled_offset+temp4*2048 - add r10, r2, r7 @ r10 = nv12t_src+tiled_offset - pld [r10] - bic r6, r6, #0xFF @ j = (left>>8)<<8 - pld [r10, #32] - add r6, r6, #256 @ j = j + 256 - sub r11, r3, r12 @ temp2 = yuv420_width-right-256 - sub r11, r11, #256 - cmp r6, r11 - bgt LOOP_HEIGHT_256_WIDTH_END - -LOOP_HEIGHT_256_WIDTH: - add r12, r10, #2048 @ r12 = nv12t_src+tiled_offset+2048 - pld [r12] - vld2.8 {q0, q1}, [r10]! @ load {nv12t_src+tiled_offset, 64} - pld [r12, #32] - vld2.8 {q2, q3}, [r10] - - add r8, r8, r14, lsl #11 @ tiled_offset1 = tiled_offset1+temp4*2048 - add r10, r2, r8 @ r10 = nv12t_src+tiled_offset1 - pld [r10] - vld2.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset+2048, 64} - pld [r10, #32] - vld2.8 {q6, q7}, [r12] - - add r12, r10, #2048 @ r12 = nv12t_src+tiled_offset+2048 - pld [r12] - vld2.8 {q8, q9}, [r10]! @ load {nv12t_src+tiled_offset+2048, 64} - pld [r12, #32] - vld2.8 {q10, q11}, [r10] - - add r7, r7, r14, lsl #11 @ tiled_offset = tiled_offset+temp4*2048 - add r10, r2, r7 - pld [r10] - vld2.8 {q12, q13}, [r12]! @ load {nv12t_src+tiled_offset+2048, 64} - pld [r10, #32] - vld2.8 {q14, q15}, [r12] - - add r12, r0, r9 @ r12 = yuv420_u_dest+linear_offset - vst1.8 {q0}, [r12]! - vst1.8 {q2}, [r12]! - vst1.8 {q4}, [r12]! - vst1.8 {q6}, [r12]! - vst1.8 {q8}, [r12]! - vst1.8 {q10}, [r12]! - vst1.8 {q12}, [r12]! - vst1.8 {q14}, [r12]! - add r12, r1, r9 @ r12 = yuv420_v_dest+linear_offset - vst1.8 {q1}, [r12]! - vst1.8 {q3}, [r12]! - vst1.8 {q5}, [r12]! - vst1.8 {q7}, [r12]! - vst1.8 {q9}, [r12]! - vst1.8 {q11}, [r12]! - vst1.8 {q13}, [r12]! - vst1.8 {q15}, [r12]! - add r9, r9, #128 @ linear_offset = linear_offset+128 - - add r12, r10, #2048 @ r12 = nv12t_src+tiled_offset+2048 - - add r6, r6, #256 @ j=j+256 - cmp r6, r11 @ j<=temp2 - ble LOOP_HEIGHT_256_WIDTH - -LOOP_HEIGHT_256_WIDTH_END: - - add r8, r8, r14, lsl #11 @ tiled_offset1 = tiled_offset1+temp4*2048 - ldr r14, [sp, #52] @ right - sub r11, r3, r6 @ temp2 = yuv420_width-right-j - sub r11, r11, r14 - cmp r11, #0 - beq LOOP_HEIGHT_256_RIGHT_END - cmp r11, #192 - ble LOOP_HEIGHT_256_RIGHT_192 - add r12, r10, #2048 - pld [r12] - vld2.8 {q0, q1}, [r10]! @ load {nv12t_src+tiled_offset} - pld [r12, #32] - vld2.8 {q2, q3}, [r10] - - add r10, r2, r8 @ r10 = nv12t_src+tiled_offset1 - pld [r10] - vld2.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset+2048} - pld [r10, #32] - vld2.8 {q6, q7}, [r12] - - add r14, r10, #2048 @ r10 = nv12t_src+tiled_offset1+2048 - pld [r14] - vld2.8 {q8, q9}, [r10]! @ load {nv12t_src+tiled_offset1} - pld [r14, #32] - vld2.8 {q10, q11}, [r10] - - add r12, r0, r9 @ r12 = yuv420_u_dest+linear_offset - vst1.8 {q0}, [r12]! - vst1.8 {q2}, [r12]! - vst1.8 {q4}, [r12]! - vst1.8 {q6}, [r12]! - vst1.8 {q8}, [r12]! - vst1.8 {q10}, [r12]! - add r12, r1, r9 @ r12 = yuv420_v_dest+linear_offset - vst1.8 {q1}, [r12]! - vst1.8 {q3}, [r12]! - vst1.8 {q5}, [r12]! - vst1.8 {q7}, [r12]! - vst1.8 {q9}, [r12]! - vst1.8 {q11}, [r12]! - add r9, r9, #96 @ linear_offset = linear_offset+96 - - stmfd sp!, {r8-r12, r14} @ backup registers - sub r10, r11, #192 - mov r11, r14 - bl INTERLEAVED_MEMCOPY_UNDER_64 - ldmfd sp!, {r8-r12, r14} @ restore registers - b LOOP_HEIGHT_256_RIGHT_END - -LOOP_HEIGHT_256_RIGHT_192: - cmp r11, #128 - ble LOOP_HEIGHT_256_RIGHT_128 - add r12, r10, #2048 - pld [r12] - vld2.8 {q0, q1}, [r10]! @ load {nv12t_src+tiled_offset} - pld [r12, #32] - vld2.8 {q2, q3}, [r10] - - add r14, r2, r8 @ r10 = nv12t_src+tiled_offset1 - pld [r14] - vld2.8 {q4, q5}, [r12]! @ load {nv12t_src+tiled_offset+2048} - pld [r14, #32] - vld2.8 {q6, q7}, [r12] - - add r12, r0, r9 @ r12 = yuv420_u_dest+linear_offset - vst1.8 {q0}, [r12]! - vst1.8 {q2}, [r12]! - vst1.8 {q4}, [r12]! - vst1.8 {q6}, [r12]! - add r12, r1, r9 @ r12 = yuv420_v_dest+linear_offset - vst1.8 {q1}, [r12]! - vst1.8 {q3}, [r12]! - vst1.8 {q5}, [r12]! - vst1.8 {q7}, [r12]! - add r9, r9, #64 @ linear_offset = linear_offset+64 - - stmfd sp!, {r8-r12, r14} @ backup registers - sub r10, r11, #128 - mov r11, r14 - bl INTERLEAVED_MEMCOPY_UNDER_64 - ldmfd sp!, {r8-r12, r14} @ restore registers - b LOOP_HEIGHT_256_RIGHT_END - -LOOP_HEIGHT_256_RIGHT_128: - cmp r11, #64 - ble LOOP_HEIGHT_256_RIGHT_64 - add r14, r10, #2048 - pld [r14] - vld2.8 {q0, q1}, [r10]! @ load {nv12t_src+tiled_offset} - pld [r14, #32] - vld2.8 {q2, q3}, [r10] - - add r12, r0, r9 @ r12 = yuv420_u_dest+linear_offset - vst1.8 {q0}, [r12]! - vst1.8 {q2}, [r12]! - add r12, r1, r9 @ r12 = yuv420_v_dest+linear_offset - vst1.8 {q1}, [r12]! - vst1.8 {q3}, [r12]! - add r9, r9, #32 @ linear_offset = linear_offset+32 - - stmfd sp!, {r8-r12, r14} @ backup registers - sub r10, r11, #64 - mov r11, r14 - bl INTERLEAVED_MEMCOPY_UNDER_64 - ldmfd sp!, {r8-r12, r14} @ restore registers - b LOOP_HEIGHT_256_RIGHT_END - -LOOP_HEIGHT_256_RIGHT_64: - stmfd sp!, {r8-r12, r14} @ backup registers - mov r14, r11 - mov r11, r10 - mov r10, r14 - bl INTERLEAVED_MEMCOPY_UNDER_64 - ldmfd sp!, {r8-r12, r14} @ restore registers - -LOOP_HEIGHT_256_RIGHT_END: - - ldr r14, [sp, #56] @ buttom - add r5, r5, #1 @ i=i+1 - sub r14, r4, r14 @ i<yuv420_height-buttom - cmp r5, r14 - blt LOOP_HEIGHT_256 - b RESTORE_REG - -LOOP_HEIGHT_64_START: - cmp r10, #64 @ if (temp1 >= 64) - blt LOOP_HEIGHT_2_START - - ldr r5, [sp, #48] @ i = top -LOOP_HEIGHT_64: - ldr r6, [sp, #44] @ j = left - stmfd sp!, {r0-r3, r12} @ backup parameters - mov r0, r3 - mov r1, r4 - mov r2, r6 - mov r3, r5 - bl tile_4x2_read_asm - mov r7, r0 - ldmfd sp!, {r0-r3, r12} @ restore parameters - ldr r9, [sp, #48] @ linear_offset = top - ldr r12, [sp, #52] @ r12 = right - add r11, r6, #64 @ temp2 = ((j+64)>>6)<<6 - bic r11, r11, #0x3F - sub r11, r11, r6 @ temp2 = temp2-j - sub r12, r3, r12 @ temp3 = yuv420_width-right - sub r14, r12, r6 @ temp4 = temp3-left - sub r9, r5, r9 @ linear_offset = temp4*(i-top)/2 - mul r9, r9, r14 - mov r9, r9, asr #1 - and r14, r6, #0x3 @ temp4 = j&0x3 - add r7, r7, r14 @ tiled_offset = tiled_offset+temp4 - stmfd sp!, {r9-r12} @ backup parameters - mov r10, r11 - add r11, r2, r7 - bl INTERLEAVED_MEMCOPY_UNDER_64 - ldmfd sp!, {r9-r12} @ restore parameters - add r9, r9, r11, asr #1 @ linear_offset = linear_offset+temp2/2 - add r6, r6, r11 @ j = j+temp2@ - - add r14, r6, #64 - cmp r14, r12 - bgt LOOP_HEIGHT_64_1 - stmfd sp!, {r0-r3, r12} @ backup parameters - mov r0, r3 - mov r1, r4 - mov r2, r6 - mov r3, r5 - bl tile_4x2_read_asm - mov r7, r0 - ldmfd sp!, {r0-r3, r12} @ restore parameters - add r7, r2, r7 - vld2.8 {q0, q1}, [r7]! - vld2.8 {q2, q3}, [r7] - add r7, r0, r9 - vst1.8 {q0}, [r7]! - vst1.8 {q2}, [r7] - add r7, r1, r9 - vst1.8 {q1}, [r7]! - vst1.8 {q3}, [r7] - add r9, r9, #32 - add r6, r6, #64 - -LOOP_HEIGHT_64_1: - add r14, r6, #64 - cmp r14, r12 - bgt LOOP_HEIGHT_64_2 - stmfd sp!, {r0-r3, r12} @ backup parameters - mov r0, r3 - mov r1, r4 - mov r2, r6 - mov r3, r5 - bl tile_4x2_read_asm - mov r7, r0 - ldmfd sp!, {r0-r3, r12} @ restore parameters - add r7, r2, r7 - vld2.8 {q0, q1}, [r7]! - vld2.8 {q2, q3}, [r7] - add r7, r0, r9 - vst1.8 {q0}, [r7]! - vst1.8 {q2}, [r7] - add r7, r1, r9 - vst1.8 {q1}, [r7]! - vst1.8 {q3}, [r7] - add r9, r9, #32 - add r6, r6, #64 - -LOOP_HEIGHT_64_2: - cmp r6, r12 - bge LOOP_HEIGHT_64_3 - stmfd sp!, {r0-r3, r12} @ backup parameters - mov r0, r3 - mov r1, r4 - mov r2, r6 - mov r3, r5 - bl tile_4x2_read_asm - mov r7, r0 - ldmfd sp!, {r0-r3, r12} @ restore parameters - sub r11, r12, r6 - stmfd sp!, {r9-r12} @ backup parameters - mov r10, r11 - add r11, r2, r7 - bl INTERLEAVED_MEMCOPY_UNDER_64 - ldmfd sp!, {r9-r12} @ restore parameters - -LOOP_HEIGHT_64_3: - - ldr r14, [sp, #56] @ buttom - add r5, r5, #1 @ i=i+1 - sub r14, r4, r14 @ i<yuv420_height-buttom - cmp r5, r14 - blt LOOP_HEIGHT_64 - b RESTORE_REG - -LOOP_HEIGHT_2_START: - - ldr r5, [sp, #48] @ i = top -LOOP_HEIGHT_2: - - ldr r12, [sp, #52] @ linear_offset = right - ldr r6, [sp, #44] @ j = left - ldr r9, [sp, #48] @ linear_offset = top - - sub r12, r3, r12 @ temp3 = yuv420_width-right - sub r14, r12, r6 @ temp4 = temp3-left@ - sub r9, r5, r9 @ r9 = i-top - mul r9, r14, r9 @ temp4*(i-top) - mov r9, r9, lsr #1 @ linear_offset = temp4*(i-top)/2 - add r11, r0, r9 - add r12, r1, r9 -LOOP_HEIGHT_2_WIDTH: - stmfd sp!, {r0-r3, r12} @ backup parameters - mov r0, r2 - mov r1, r3 - mov r2, r6 - mov r3, r5 - bl tile_4x2_read_asm - mov r7, r0 - ldmfd sp!, {r0-r3, r12} @ restore parameters - - and r14, r6, #0x3 @ temp4 = j&0x3@ - add r7, r7, r14 @ tiled_offset = tiled_offset+temp4@ - add r7, r2, r7 - - ldrh r14, [r7] - strb r14, [r11], #1 - mov r14, r14, lsr #8 - strb r14, [r12], #1 - - ldr r14, [sp, #52] @ right - add r6, r6, #2 @ j=j+2 - sub r14, r3, r14 @ j<yuv420_width-right - cmp r6, r14 - blt LOOP_HEIGHT_2_WIDTH - - ldr r14, [sp, #56] @ buttom - add r5, r5, #1 @ i=i+1 - sub r14, r4, r14 @ i<yuv420_height-buttom - cmp r5, r14 - blt LOOP_HEIGHT_2 - -RESTORE_REG: - ldmfd sp!, {r4-r12,r15} @ restore registers - -INTERLEAVED_MEMCOPY_UNDER_64: @ count=r10, src=r11 - cmp r10, #32 - blt INTERLEAVED_MEMCOPY_UNDER_32 - vld2.8 {q0, q1}, [r11]! @ load {nv12t_src+tiled_offset+temp1, 64} - sub r10, r10, #32 - cmp r10, #0 - add r12, r0, r9 @ r12 = yuv420_u_dest+linear_offset - vst1.8 {q0}, [r12] @ load {nv12t_src+tiled_offset+temp1, 64} - add r12, r1, r9 @ r12 = yuv420_v_dest+linear_offset - vst1.8 {q1}, [r12] @ load {nv12t_src+tiled_offset+temp1, 64} - add r9, r9, #16 - beq INTERLEAVED_MEMCOPY_UNDER_END -INTERLEAVED_MEMCOPY_UNDER_32: - cmp r10, #16 - blt INTERLEAVED_MEMCOPY_UNDER_16 - vld2.8 {q0}, [r11]! @ load {nv12t_src+tiled_offset+temp1, 64} - sub r10, r10, #16 - cmp r10, #0 - add r12, r0, r9 @ r12 = yuv420_u_dest+linear_offset - vst1.8 {d0}, [r12]! @ load {nv12t_src+tiled_offset+temp1, 64} - add r12, r1, r9 @ r12 = yuv420_v_dest+linear_offset - vst1.8 {d1}, [r12]! @ load {nv12t_src+tiled_offset+temp1, 64} - add r9, r9, #8 - beq INTERLEAVED_MEMCOPY_UNDER_END -INTERLEAVED_MEMCOPY_UNDER_16: - ldrh r12, [r11], #2 - add r8, r0, r9 @ r8 = yuv420_u_dest+linear_offset - strb r12, [r8] - add r8, r1, r9 @ r8 = yuv420_v_dest+linear_offset - mov r12, r12, lsr #8 - strb r12, [r8] - subs r10, r10, #2 - add r9, r9, #1 - bne INTERLEAVED_MEMCOPY_UNDER_16 - -INTERLEAVED_MEMCOPY_UNDER_END: - and r10, r6, #0x3F @ temp1 = left(==j)&0x3F - cmp r10, #0 - mov pc, lr - -tile_4x2_read_asm: -LFB0: - add ip, r3, #32 - sub r0, r0, #1 - cmp r1, ip - cmple r3, r1 - mov ip, r2, asr #2 - mov r0, r0, asr #7 - stmfd sp!, {r4, r5, lr} -LCFI0: - add r0, r0, #1 - bge L2 - sub r1, r1, #1 - tst r1, #32 - bne L2 - tst r3, #32 - bne L2 - mov r4, r2, asr #7 - and r1, r3, #31 - eor r4, r4, r3, asr #5 - ubfx r3, r3, #6, #8 - tst r4, #1 - ubfx r4, r2, #8, #6 - and ip, ip, #15 - mov r2, r2, asr #6 - mla r3, r0, r3, r4 - orr r1, ip, r1, asl #4 - b L9 -L2: - mov r2, ip, asr #5 - and r4, r3, #31 - eor r1, r2, r3, asr #5 - and r5, r2, #127 - ubfx r3, r3, #6, #8 - tst r1, #1 - and r1, ip, #15 - mov r2, ip, asr #4 - mla r3, r0, r3, r5 - orr r1, r1, r4, asl #4 -L9: - andne r2, r2, #1 - andeq r2, r2, #1 - orrne r2, r2, #2 - mov r1, r1, asl #2 - orr r3, r1, r3, asl #13 - orr r0, r3, r2, asl #11 - ldmfd sp!, {r4, r5, pc} -LFE0: - .fnend - diff --git a/exynos4/hal/libswconverter/swconvertor.c b/exynos4/hal/libswconverter/swconvertor.c deleted file mode 100644 index 043add2..0000000 --- a/exynos4/hal/libswconverter/swconvertor.c +++ /dev/null @@ -1,1828 +0,0 @@ -/* - * - * 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 swconvertor.c - * - * @brief SEC_OMX specific define - * - * @author ShinWon Lee (shinwon.lee@samsung.com) - * - * @version 1.0 - * - * @history - * 2012.02.01 : Create - */ - -#include "stdio.h" -#include "stdlib.h" -#include "swconverter.h" - -/* - * Get tiled address of position(x,y) - * - * @param x_size - * width of tiled[in] - * - * @param y_size - * height of tiled[in] - * - * @param x_pos - * x position of tield[in] - * - * @param src_size - * y position of tield[in] - * - * @return - * address of tiled data - */ -static int tile_4x2_read(int x_size, int y_size, int x_pos, int y_pos) -{ - int pixel_x_m1, pixel_y_m1; - int roundup_x, roundup_y; - int linear_addr0, linear_addr1, bank_addr ; - int x_addr; - int trans_addr; - - pixel_x_m1 = x_size -1; - pixel_y_m1 = y_size -1; - - roundup_x = ((pixel_x_m1 >> 7) + 1); - roundup_y = ((pixel_x_m1 >> 6) + 1); - - x_addr = x_pos >> 2; - - if ((y_size <= y_pos+32) && ( y_pos < y_size) && - (((pixel_y_m1 >> 5) & 0x1) == 0) && (((y_pos >> 5) & 0x1) == 0)) { - linear_addr0 = (((y_pos & 0x1f) <<4) | (x_addr & 0xf)); - linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 6) & 0x3f)); - - if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1)) - bank_addr = ((x_addr >> 4) & 0x1); - else - bank_addr = 0x2 | ((x_addr >> 4) & 0x1); - } else { - linear_addr0 = (((y_pos & 0x1f) << 4) | (x_addr & 0xf)); - linear_addr1 = (((y_pos >> 6) & 0xff) * roundup_x + ((x_addr >> 5) & 0x7f)); - - if (((x_addr >> 5) & 0x1) == ((y_pos >> 5) & 0x1)) - bank_addr = ((x_addr >> 4) & 0x1); - else - bank_addr = 0x2 | ((x_addr >> 4) & 0x1); - } - - linear_addr0 = linear_addr0 << 2; - trans_addr = (linear_addr1 <<13) | (bank_addr << 11) | linear_addr0; - - return trans_addr; -} - -/* - * 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) -{ - unsigned int i = 0; - for(i=0; i<src_size/2; i++) { - dest1[i] = src[i*2]; - dest2[i] = src[i*2+1]; - } -} - -/* - * 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) -{ - unsigned int i = 0; - for(i=0; i<src_size; i++) { - dest[i * 2] = src1[i]; - dest[i * 2 + 1] = src2[i]; - } -} - -/* - * Converts tiled data to linear - * Crops left, top, right, buttom - * 1. Y of NV12T to Y of YUV420P - * 2. Y of NV12T to Y of YUV420S - * 3. UV of NV12T to UV of YUV420S - * - * @param yuv420_dest - * Y or UV plane address of YUV420[out] - * - * @param nv12t_src - * Y or UV plane address of NV12T[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_height - * Y: Height of YUV420, UV: Height/2 of YUV420[in] - * - * @param left - * Crop size of left - * - * @param top - * Crop size of top - * - * @param right - * Crop size of right - * - * @param buttom - * Crop size of buttom - */ -static void csc_tiled_to_linear_crop( - unsigned char *yuv420_dest, - unsigned char *nv12t_src, - unsigned int yuv420_width, - unsigned int yuv420_height, - unsigned int left, - unsigned int top, - unsigned int right, - unsigned int buttom) -{ - unsigned int i, j; - unsigned int tiled_offset = 0, tiled_offset1 = 0; - unsigned int linear_offset = 0; - unsigned int temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 0; - - temp3 = yuv420_width-right; - temp1 = temp3-left; - /* real width is greater than or equal 256 */ - if (temp1 >= 256) { - for (i=top; i<yuv420_height-buttom; i=i+1) { - j = left; - temp3 = (j>>8)<<8; - temp3 = temp3>>6; - temp4 = i>>5; - if (temp4 & 0x1) { - /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */ - tiled_offset = temp4-1; - temp1 = ((yuv420_width+127)>>7)<<7; - tiled_offset = tiled_offset*(temp1>>6); - tiled_offset = tiled_offset+temp3; - tiled_offset = tiled_offset+2; - temp1 = (temp3>>2)<<2; - tiled_offset = tiled_offset+temp1; - tiled_offset = tiled_offset<<11; - tiled_offset1 = tiled_offset+2048*2; - temp4 = 8; - } else { - temp2 = ((yuv420_height+31)>>5)<<5; - if ((i+32)<temp2) { - /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */ - temp1 = temp3+2; - temp1 = (temp1>>2)<<2; - tiled_offset = temp3+temp1; - temp1 = ((yuv420_width+127)>>7)<<7; - tiled_offset = tiled_offset+temp4*(temp1>>6); - tiled_offset = tiled_offset<<11; - tiled_offset1 = tiled_offset+2048*6; - temp4 = 8; - } else { - /* even2 fomula: x+x_block_num*y */ - temp1 = ((yuv420_width+127)>>7)<<7; - tiled_offset = temp4*(temp1>>6); - tiled_offset = tiled_offset+temp3; - tiled_offset = tiled_offset<<11; - tiled_offset1 = tiled_offset+2048*2; - temp4 = 4; - } - } - - temp1 = i&0x1F; - tiled_offset = tiled_offset+64*(temp1); - tiled_offset1 = tiled_offset1+64*(temp1); - temp2 = yuv420_width-left-right; - linear_offset = temp2*(i-top); - temp3 = ((j+256)>>8)<<8; - temp3 = temp3-j; - temp1 = left&0x3F; - if (temp3 > 192) { - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset+temp1, 64-temp1); - temp2 = ((left+63)>>6)<<6; - temp3 = ((yuv420_width-right)>>6)<<6; - if (temp2 == temp3) { - temp2 = yuv420_width-right-(64-temp1); - } - memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset+2048, 64); - memcpy(yuv420_dest+linear_offset+128-temp1, nv12t_src+tiled_offset1, 64); - memcpy(yuv420_dest+linear_offset+192-temp1, nv12t_src+tiled_offset1+2048, 64); - linear_offset = linear_offset+256-temp1; - } else if (temp3 > 128) { - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset+2048+temp1, 64-temp1); - memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset1, 64); - memcpy(yuv420_dest+linear_offset+128-temp1, nv12t_src+tiled_offset1+2048, 64); - linear_offset = linear_offset+192-temp1; - } else if (temp3 > 64) { - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset1+temp1, 64-temp1); - memcpy(yuv420_dest+linear_offset+64-temp1, nv12t_src+tiled_offset1+2048, 64); - linear_offset = linear_offset+128-temp1; - } else if (temp3 > 0) { - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset1+2048+temp1, 64-temp1); - linear_offset = linear_offset+64-temp1; - } - - tiled_offset = tiled_offset+temp4*2048; - j = (left>>8)<<8; - j = j + 256; - temp2 = yuv420_width-right-256; - for (; j<=temp2; j=j+256) { - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64); - tiled_offset1 = tiled_offset1+temp4*2048; - memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64); - memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, 64); - tiled_offset = tiled_offset+temp4*2048; - memcpy(yuv420_dest+linear_offset+192, nv12t_src+tiled_offset1+2048, 64); - linear_offset = linear_offset+256; - } - - tiled_offset1 = tiled_offset1+temp4*2048; - temp2 = yuv420_width-right-j; - if (temp2 > 192) { - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64); - memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64); - memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, 64); - memcpy(yuv420_dest+linear_offset+192, nv12t_src+tiled_offset1+2048, temp2-192); - } else if (temp2 > 128) { - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64); - memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, 64); - memcpy(yuv420_dest+linear_offset+128, nv12t_src+tiled_offset1, temp2-128); - } else if (temp2 > 64) { - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64); - memcpy(yuv420_dest+linear_offset+64, nv12t_src+tiled_offset+2048, temp2-64); - } else { - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2); - } - } - } else if (temp1 >= 64) { - for (i=top; i<(yuv420_height-buttom); i=i+1) { - j = left; - tiled_offset = tile_4x2_read(yuv420_width, yuv420_height, j, i); - temp2 = ((j+64)>>6)<<6; - temp2 = temp2-j; - linear_offset = temp1*(i-top); - temp4 = j&0x3; - tiled_offset = tiled_offset+temp4; - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2); - linear_offset = linear_offset+temp2; - j = j+temp2; - if ((j+64) <= temp3) { - tiled_offset = tile_4x2_read(yuv420_width, yuv420_height, j, i); - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64); - linear_offset = linear_offset+64; - j = j+64; - } - if ((j+64) <= temp3) { - tiled_offset = tile_4x2_read(yuv420_width, yuv420_height, j, i); - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 64); - linear_offset = linear_offset+64; - j = j+64; - } - if (j < temp3) { - tiled_offset = tile_4x2_read(yuv420_width, yuv420_height, j, i); - temp2 = temp3-j; - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, temp2); - } - } - } else { - for (i=top; i<(yuv420_height-buttom); i=i+1) { - linear_offset = temp1*(i-top); - for (j=left; j<(yuv420_width-right); j=j+2) { - tiled_offset = tile_4x2_read(yuv420_width, yuv420_height, j, i); - temp4 = j&0x3; - tiled_offset = tiled_offset+temp4; - memcpy(yuv420_dest+linear_offset, nv12t_src+tiled_offset, 2); - linear_offset = linear_offset+2; - } - } - } -} - -/* - * Converts and Deinterleaves tiled data to linear - * Crops left, top, right, buttom - * 1. UV of NV12T to UV of YUV420P - * - * @param yuv420_u_dest - * U plane address of YUV420P[out] - * - * @param yuv420_v_dest - * V plane address of YUV420P[out] - * - * @param nv12t_src - * UV plane address of NV12T[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_uv_height - * Height/2 of YUV420[in] - * - * @param left - * Crop size of left - * - * @param top - * Crop size of top - * - * @param right - * Crop size of right - * - * @param buttom - * Crop size of buttom - */ -static void csc_tiled_to_linear_deinterleave_crop( - unsigned char *yuv420_u_dest, - unsigned char *yuv420_v_dest, - unsigned char *nv12t_uv_src, - unsigned int yuv420_width, - unsigned int yuv420_uv_height, - unsigned int left, - unsigned int top, - unsigned int right, - unsigned int buttom) -{ - unsigned int i, j; - unsigned int tiled_offset = 0, tiled_offset1 = 0; - unsigned int linear_offset = 0; - unsigned int temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 0; - - temp3 = yuv420_width-right; - temp1 = temp3-left; - /* real width is greater than or equal 256 */ - if (temp1 >= 256) { - for (i=top; i<yuv420_uv_height-buttom; i=i+1) { - j = left; - temp3 = (j>>8)<<8; - temp3 = temp3>>6; - temp4 = i>>5; - if (temp4 & 0x1) { - /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */ - tiled_offset = temp4-1; - temp1 = ((yuv420_width+127)>>7)<<7; - tiled_offset = tiled_offset*(temp1>>6); - tiled_offset = tiled_offset+temp3; - tiled_offset = tiled_offset+2; - temp1 = (temp3>>2)<<2; - tiled_offset = tiled_offset+temp1; - tiled_offset = tiled_offset<<11; - tiled_offset1 = tiled_offset+2048*2; - temp4 = 8; - } else { - temp2 = ((yuv420_uv_height+31)>>5)<<5; - if ((i+32)<temp2) { - /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */ - temp1 = temp3+2; - temp1 = (temp1>>2)<<2; - tiled_offset = temp3+temp1; - temp1 = ((yuv420_width+127)>>7)<<7; - tiled_offset = tiled_offset+temp4*(temp1>>6); - tiled_offset = tiled_offset<<11; - tiled_offset1 = tiled_offset+2048*6; - temp4 = 8; - } else { - /* even2 fomula: x+x_block_num*y */ - temp1 = ((yuv420_width+127)>>7)<<7; - tiled_offset = temp4*(temp1>>6); - tiled_offset = tiled_offset+temp3; - tiled_offset = tiled_offset<<11; - tiled_offset1 = tiled_offset+2048*2; - temp4 = 4; - } - } - - temp1 = i&0x1F; - tiled_offset = tiled_offset+64*(temp1); - tiled_offset1 = tiled_offset1+64*(temp1); - temp2 = yuv420_width-left-right; - linear_offset = temp2*(i-top)/2; - temp3 = ((j+256)>>8)<<8; - temp3 = temp3-j; - temp1 = left&0x3F; - if (temp3 > 192) { - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, yuv420_v_dest+linear_offset, nv12t_uv_src+tiled_offset+temp1, 64-temp1); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+(32-temp1/2), - yuv420_v_dest+linear_offset+(32-temp1/2), - nv12t_uv_src+tiled_offset+2048, 64); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+(64-temp1/2), - yuv420_v_dest+linear_offset+(64-temp1/2), - nv12t_uv_src+tiled_offset1, 64); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+(96-temp1/2), - yuv420_v_dest+linear_offset+(96-temp1/2), - nv12t_uv_src+tiled_offset1+2048, 64); - linear_offset = linear_offset+128-temp1/2; - } else if (temp3 > 128) { - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset+2048+temp1, 64-temp1); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+(32-temp1/2), - yuv420_v_dest+linear_offset+(32-temp1/2), - nv12t_uv_src+tiled_offset1, 64); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+(64-temp1/2), - yuv420_v_dest+linear_offset+(64-temp1/2), - nv12t_uv_src+tiled_offset1+2048, 64); - linear_offset = linear_offset+96-temp1/2; - } else if (temp3 > 64) { - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset1+temp1, 64-temp1); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+(32-temp1/2), - yuv420_v_dest+linear_offset+(32-temp1/2), - nv12t_uv_src+tiled_offset1+2048, 64); - linear_offset = linear_offset+64-temp1/2; - } else if (temp3 > 0) { - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset1+2048+temp1, 64-temp1); - linear_offset = linear_offset+32-temp1/2; - } - - tiled_offset = tiled_offset+temp4*2048; - j = (left>>8)<<8; - j = j + 256; - temp2 = yuv420_width-right-256; - for (; j<=temp2; j=j+256) { - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset, 64); - tiled_offset1 = tiled_offset1+temp4*2048; - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+32, - yuv420_v_dest+linear_offset+32, - nv12t_uv_src+tiled_offset+2048, 64); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+64, - yuv420_v_dest+linear_offset+64, - nv12t_uv_src+tiled_offset1, 64); - tiled_offset = tiled_offset+temp4*2048; - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+96, - yuv420_v_dest+linear_offset+96, - nv12t_uv_src+tiled_offset1+2048, 64); - linear_offset = linear_offset+128; - } - - tiled_offset1 = tiled_offset1+temp4*2048; - temp2 = yuv420_width-right-j; - if (temp2 > 192) { - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset, 64); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+32, - yuv420_v_dest+linear_offset+32, - nv12t_uv_src+tiled_offset+2048, 64); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+64, - yuv420_v_dest+linear_offset+64, - nv12t_uv_src+tiled_offset1, 64); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+96, - yuv420_v_dest+linear_offset+96, - nv12t_uv_src+tiled_offset1+2048, temp2-192); - } else if (temp2 > 128) { - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset, 64); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+32, - yuv420_v_dest+linear_offset+32, - nv12t_uv_src+tiled_offset+2048, 64); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+64, - yuv420_v_dest+linear_offset+64, - nv12t_uv_src+tiled_offset1, temp2-128); - } else if (temp2 > 64) { - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset, 64); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset+32, - yuv420_v_dest+linear_offset+32, - nv12t_uv_src+tiled_offset+2048, temp2-64); - } else { - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset, temp2); - } - } - } else if (temp1 >= 64) { - for (i=top; i<(yuv420_uv_height-buttom); i=i+1) { - j = left; - tiled_offset = tile_4x2_read(yuv420_width, yuv420_uv_height, j, i); - temp2 = ((j+64)>>6)<<6; - temp2 = temp2-j; - temp3 = yuv420_width-right; - temp4 = temp3-left; - linear_offset = temp4*(i-top)/2; - temp4 = j&0x3; - tiled_offset = tiled_offset+temp4; - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset, temp2); - linear_offset = linear_offset+temp2/2; - j = j+temp2; - if ((j+64) <= temp3) { - tiled_offset = tile_4x2_read(yuv420_width, yuv420_uv_height, j, i); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset, 64); - linear_offset = linear_offset+32; - j = j+64; - } - if ((j+64) <= temp3) { - tiled_offset = tile_4x2_read(yuv420_width, yuv420_uv_height, j, i); - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset, 64); - linear_offset = linear_offset+32; - j = j+64; - } - if (j < temp3) { - tiled_offset = tile_4x2_read(yuv420_width, yuv420_uv_height, j, i); - temp1 = temp3-j; - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset, temp1); - } - } - } else { - for (i=top; i<(yuv420_uv_height-buttom); i=i+1) { - temp3 = yuv420_width-right; - temp4 = temp3-left; - linear_offset = temp4*(i-top)/2; - for (j=left; j<(yuv420_width-right); j=j+2) { - tiled_offset = tile_4x2_read(yuv420_width, yuv420_uv_height, j, i); - temp3 = j&0x3; - tiled_offset = tiled_offset+temp3; - csc_deinterleave_memcpy(yuv420_u_dest+linear_offset, - yuv420_v_dest+linear_offset, - nv12t_uv_src+tiled_offset, 2); - linear_offset = linear_offset+1; - } - } - } -} - -/* - * Converts linear data to tiled - * Crops left, top, right, buttom - * 1. Y of YUV420P to Y of NV12T - * 2. Y of YUV420S to Y of NV12T - * 3. UV of YUV420S to UV of NV12T - * - * @param nv12t_dest - * Y or UV plane address of NV12T[out] - * - * @param yuv420_src - * Y or UV plane address of YUV420P(S)[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_height - * Y: Height of YUV420, UV: Height/2 of YUV420[in] - * - * @param left - * Crop size of left - * - * @param top - * Crop size of top - * - * @param right - * Crop size of right - * - * @param buttom - * Crop size of buttom - */ -static void csc_linear_to_tiled_crop( - unsigned char *nv12t_dest, - unsigned char *yuv420_src, - unsigned int yuv420_width, - unsigned int yuv420_height, - unsigned int left, - unsigned int top, - unsigned int right, - unsigned int buttom) -{ - unsigned int i, j; - unsigned int tiled_x_index = 0, tiled_y_index = 0; - unsigned int aligned_x_size = 0, aligned_y_size = 0; - unsigned int tiled_offset = 0; - unsigned int temp1 = 0, temp2 = 0; - - aligned_y_size = ((yuv420_height-top-buttom)>>5)<<5; - aligned_x_size = ((yuv420_width-left-right)>>6)<<6; - - for (i=0; i<aligned_y_size; i=i+32) { - for (j=0; j<aligned_x_size; j=j+64) { - tiled_offset = 0; - tiled_x_index = j>>6; - tiled_y_index = i>>5; - if (tiled_y_index & 0x1) { - /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */ - tiled_offset = tiled_y_index-1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset+2; - temp1 = (tiled_x_index>>2)<<2; - tiled_offset = tiled_offset+temp1; - tiled_offset = tiled_offset<<11; - } else { - temp2 = (((yuv420_height-top-buttom)+31)>>5)<<5; - if ((i+32)<temp2) { - /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */ - temp1 = tiled_x_index+2; - temp1 = (temp1>>2)<<2; - tiled_offset = tiled_x_index+temp1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset+tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset<<11; - } else { - /* even2 fomula: x+x_block_num*y */ - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset<<11; - } - } - - memcpy(nv12t_dest+tiled_offset, yuv420_src+left+j+yuv420_width*(i+top), 64); - memcpy(nv12t_dest+tiled_offset+64*1, yuv420_src+left+j+yuv420_width*(i+top+1), 64); - memcpy(nv12t_dest+tiled_offset+64*2, yuv420_src+left+j+yuv420_width*(i+top+2), 64); - memcpy(nv12t_dest+tiled_offset+64*3, yuv420_src+left+j+yuv420_width*(i+top+3), 64); - memcpy(nv12t_dest+tiled_offset+64*4, yuv420_src+left+j+yuv420_width*(i+top+4), 64); - memcpy(nv12t_dest+tiled_offset+64*5, yuv420_src+left+j+yuv420_width*(i+top+5), 64); - memcpy(nv12t_dest+tiled_offset+64*6, yuv420_src+left+j+yuv420_width*(i+top+6), 64); - memcpy(nv12t_dest+tiled_offset+64*7, yuv420_src+left+j+yuv420_width*(i+top+7), 64); - memcpy(nv12t_dest+tiled_offset+64*8, yuv420_src+left+j+yuv420_width*(i+top+8), 64); - memcpy(nv12t_dest+tiled_offset+64*9, yuv420_src+left+j+yuv420_width*(i+top+9), 64); - memcpy(nv12t_dest+tiled_offset+64*10, yuv420_src+left+j+yuv420_width*(i+top+10), 64); - memcpy(nv12t_dest+tiled_offset+64*11, yuv420_src+left+j+yuv420_width*(i+top+11), 64); - memcpy(nv12t_dest+tiled_offset+64*12, yuv420_src+left+j+yuv420_width*(i+top+12), 64); - memcpy(nv12t_dest+tiled_offset+64*13, yuv420_src+left+j+yuv420_width*(i+top+13), 64); - memcpy(nv12t_dest+tiled_offset+64*14, yuv420_src+left+j+yuv420_width*(i+top+14), 64); - memcpy(nv12t_dest+tiled_offset+64*15, yuv420_src+left+j+yuv420_width*(i+top+15), 64); - memcpy(nv12t_dest+tiled_offset+64*16, yuv420_src+left+j+yuv420_width*(i+top+16), 64); - memcpy(nv12t_dest+tiled_offset+64*17, yuv420_src+left+j+yuv420_width*(i+top+17), 64); - memcpy(nv12t_dest+tiled_offset+64*18, yuv420_src+left+j+yuv420_width*(i+top+18), 64); - memcpy(nv12t_dest+tiled_offset+64*19, yuv420_src+left+j+yuv420_width*(i+top+19), 64); - memcpy(nv12t_dest+tiled_offset+64*20, yuv420_src+left+j+yuv420_width*(i+top+20), 64); - memcpy(nv12t_dest+tiled_offset+64*21, yuv420_src+left+j+yuv420_width*(i+top+21), 64); - memcpy(nv12t_dest+tiled_offset+64*22, yuv420_src+left+j+yuv420_width*(i+top+22), 64); - memcpy(nv12t_dest+tiled_offset+64*23, yuv420_src+left+j+yuv420_width*(i+top+23), 64); - memcpy(nv12t_dest+tiled_offset+64*24, yuv420_src+left+j+yuv420_width*(i+top+24), 64); - memcpy(nv12t_dest+tiled_offset+64*25, yuv420_src+left+j+yuv420_width*(i+top+25), 64); - memcpy(nv12t_dest+tiled_offset+64*26, yuv420_src+left+j+yuv420_width*(i+top+26), 64); - memcpy(nv12t_dest+tiled_offset+64*27, yuv420_src+left+j+yuv420_width*(i+top+27), 64); - memcpy(nv12t_dest+tiled_offset+64*28, yuv420_src+left+j+yuv420_width*(i+top+28), 64); - memcpy(nv12t_dest+tiled_offset+64*29, yuv420_src+left+j+yuv420_width*(i+top+29), 64); - memcpy(nv12t_dest+tiled_offset+64*30, yuv420_src+left+j+yuv420_width*(i+top+30), 64); - memcpy(nv12t_dest+tiled_offset+64*31, yuv420_src+left+j+yuv420_width*(i+top+31), 64); - } - } - - for (i=aligned_y_size; i<(yuv420_height-top-buttom); i=i+2) { - for (j=0; j<aligned_x_size; j=j+64) { - tiled_offset = 0; - tiled_x_index = j>>6; - tiled_y_index = i>>5; - if (tiled_y_index & 0x1) { - /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */ - tiled_offset = tiled_y_index-1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset+2; - temp1 = (tiled_x_index>>2)<<2; - tiled_offset = tiled_offset+temp1; - tiled_offset = tiled_offset<<11; - } else { - temp2 = (((yuv420_height-top-buttom)+31)>>5)<<5; - if ((i+32)<temp2) { - /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */ - temp1 = tiled_x_index+2; - temp1 = (temp1>>2)<<2; - tiled_offset = tiled_x_index+temp1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset+tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset<<11; - } else { - /* even2 fomula: x+x_block_num*y */ - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset<<11; - } - } - - temp1 = i&0x1F; - memcpy(nv12t_dest+tiled_offset+64*(temp1), yuv420_src+left+j+yuv420_width*(i+top), 64); - memcpy(nv12t_dest+tiled_offset+64*(temp1+1), yuv420_src+left+j+yuv420_width*(i+top+1), 64); - } - } - - for (i=0; i<(yuv420_height-top-buttom); i=i+2) { - for (j=aligned_x_size; j<(yuv420_width-left-right); j=j+2) { - tiled_offset = 0; - tiled_x_index = j>>6; - tiled_y_index = i>>5; - if (tiled_y_index & 0x1) { - /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */ - tiled_offset = tiled_y_index-1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset+2; - temp1 = (tiled_x_index>>2)<<2; - tiled_offset = tiled_offset+temp1; - tiled_offset = tiled_offset<<11; - } else { - temp2 = (((yuv420_height-top-buttom)+31)>>5)<<5; - if ((i+32)<temp2) { - /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */ - temp1 = tiled_x_index+2; - temp1 = (temp1>>2)<<2; - tiled_offset = tiled_x_index+temp1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset+tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset<<11; - } else { - /* even2 fomula: x+x_block_num*y */ - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset<<11; - } - } - - temp1 = i&0x1F; - temp2 = j&0x3F; - memcpy(nv12t_dest+tiled_offset+temp2+64*(temp1), yuv420_src+left+j+yuv420_width*(i+top), 2); - memcpy(nv12t_dest+tiled_offset+temp2+64*(temp1+1), yuv420_src+left+j+yuv420_width*(i+top+1), 2); - } - } - -} - -/* - * Converts and Interleaves linear to tiled - * Crops left, top, right, buttom - * 1. UV of YUV420P to UV of NV12T - * - * @param nv12t_uv_dest - * UV plane address of NV12T[out] - * - * @param yuv420p_u_src - * U plane address of YUV420P[in] - * - * @param yuv420p_v_src - * V plane address of YUV420P[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_uv_height - * Height/2 of YUV420[in] - * - * @param left - * Crop size of left - * - * @param top - * Crop size of top - * - * @param right - * Crop size of right - * - * @param buttom - * Crop size of buttom - */ -static void csc_linear_to_tiled_interleave_crop( - unsigned char *nv12t_uv_dest, - unsigned char *yuv420_u_src, - unsigned char *yuv420_v_src, - unsigned int yuv420_width, - unsigned int yuv420_height, - unsigned int left, - unsigned int top, - unsigned int right, - unsigned int buttom) -{ - unsigned int i, j; - unsigned int tiled_x_index = 0, tiled_y_index = 0; - unsigned int aligned_x_size = 0, aligned_y_size = 0; - unsigned int tiled_offset = 0; - unsigned int temp1 = 0, temp2 = 0; - - aligned_y_size = ((yuv420_height-top-buttom)>>5)<<5; - aligned_x_size = ((yuv420_width-left-right)>>6)<<6; - - for (i=0; i<aligned_y_size; i=i+32) { - for (j=0; j<aligned_x_size; j=j+64) { - tiled_offset = 0; - tiled_x_index = j>>6; - tiled_y_index = i>>5; - if (tiled_y_index & 0x1) { - /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */ - tiled_offset = tiled_y_index-1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset+2; - temp1 = (tiled_x_index>>2)<<2; - tiled_offset = tiled_offset+temp1; - tiled_offset = tiled_offset<<11; - } else { - temp2 = (((yuv420_height-top-buttom)+31)>>5)<<5; - if ((i+32)<temp2) { - /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */ - temp1 = tiled_x_index+2; - temp1 = (temp1>>2)<<2; - tiled_offset = tiled_x_index+temp1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset+tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset<<11; - } else { - /* even2 fomula: x+x_block_num*y */ - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset<<11; - } - } - - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*1, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+1), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+1), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*2, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+2), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+2), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*3, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+3), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+3), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*4, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+4), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+4), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*5, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+5), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+5), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*6, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+6), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+6), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*7, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+7), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+7), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*8, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+8), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+8), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*9, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+9), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+9), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*10, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+10), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+10), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*11, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+11), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+11), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*12, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+12), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+12), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*13, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+13), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+13), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*14, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+14), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+14), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*15, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+15), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+15), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*16, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+16), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+16), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*17, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+17), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+17), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*18, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+18), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+18), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*19, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+19), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+19), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*20, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+20), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+20), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*21, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+21), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+21), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*22, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+22), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+22), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*23, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+23), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+23), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*24, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+24), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+24), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*25, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+25), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+25), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*26, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+26), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+26), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*27, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+27), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+27), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*28, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+28), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+28), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*29, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+29), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+29), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*30, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+30), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+30), 32); - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*31, - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top+31), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top+31), 32); - - } - } - - for (i=aligned_y_size; i<(yuv420_height-top-buttom); i=i+1) { - for (j=0; j<aligned_x_size; j=j+64) { - tiled_offset = 0; - tiled_x_index = j>>6; - tiled_y_index = i>>5; - if (tiled_y_index & 0x1) { - /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */ - tiled_offset = tiled_y_index-1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset+2; - temp1 = (tiled_x_index>>2)<<2; - tiled_offset = tiled_offset+temp1; - tiled_offset = tiled_offset<<11; - } else { - temp2 = (((yuv420_height-top-buttom)+31)>>5)<<5; - if ((i+32)<temp2) { - /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */ - temp1 = tiled_x_index+2; - temp1 = (temp1>>2)<<2; - tiled_offset = tiled_x_index+temp1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset+tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset<<11; - } else { - /* even2 fomula: x+x_block_num*y */ - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset<<11; - } - } - temp1 = i&0x1F; - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+64*(temp1), - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top), 32); - } - } - - for (i=0; i<(yuv420_height-top-buttom); i=i+1) { - for (j=aligned_x_size; j<(yuv420_width-left-right); j=j+2) { - tiled_offset = 0; - tiled_x_index = j>>6; - tiled_y_index = i>>5; - if (tiled_y_index & 0x1) { - /* odd fomula: 2+x+(x>>2)<<2+x_block_num*(y-1) */ - tiled_offset = tiled_y_index-1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset+2; - temp1 = (tiled_x_index>>2)<<2; - tiled_offset = tiled_offset+temp1; - tiled_offset = tiled_offset<<11; - } else { - temp2 = (((yuv420_height-top-buttom)+31)>>5)<<5; - if ((i+32)<temp2) { - /* even1 fomula: x+((x+2)>>2)<<2+x_block_num*y */ - temp1 = tiled_x_index+2; - temp1 = (temp1>>2)<<2; - tiled_offset = tiled_x_index+temp1; - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_offset+tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset<<11; - } else { - /* even2 fomula: x+x_block_num*y */ - temp1 = (((yuv420_width-left-right)+127)>>7)<<7; - tiled_offset = tiled_y_index*(temp1>>6); - tiled_offset = tiled_offset+tiled_x_index; - tiled_offset = tiled_offset<<11; - } - } - temp1 = i&0x1F; - temp2 = j&0x3F; - csc_interleave_memcpy(nv12t_uv_dest+tiled_offset+temp2+64*(temp1), - yuv420_u_src+left/2+j/2+yuv420_width/2*(i+top), - yuv420_v_src+left/2+j/2+yuv420_width/2*(i+top), 1); - } - } - -} - - -/* - * Converts tiled data to linear - * Crops left, top, right, buttom - * 1. Y of NV12T to Y of YUV420P - * 2. Y of NV12T to Y of YUV420S - * 3. UV of NV12T to UV of YUV420S - * - * @param yuv420_dest - * Y or UV plane address of YUV420[out] - * - * @param nv12t_src - * Y or UV plane address of NV12T[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_height - * Y: Height of YUV420, UV: Height/2 of YUV420[in] - * - * @param left - * Crop size of left - * - * @param top - * Crop size of top - * - * @param right - * Crop size of right - * - * @param buttom - * Crop size of buttom - */ -void csc_tiled_to_linear_crop_neon( - unsigned char *yuv420_dest, - unsigned char *nv12t_src, - unsigned int yuv420_width, - unsigned int yuv420_height, - unsigned int left, - unsigned int top, - unsigned int right, - unsigned int buttom); - -/* - * Converts and Deinterleaves tiled data to linear - * Crops left, top, right, buttom - * 1. UV of NV12T to UV of YUV420P - * - * @param yuv420_u_dest - * U plane address of YUV420P[out] - * - * @param yuv420_v_dest - * V plane address of YUV420P[out] - * - * @param nv12t_src - * UV plane address of NV12T[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_uv_height - * Height/2 of YUV420[in] - * - * @param left - * Crop size of left - * - * @param top - * Crop size of top - * - * @param right - * Crop size of right - * - * @param buttom - * Crop size of buttom - */ -void csc_tiled_to_linear_deinterleave_crop_neon( - unsigned char *yuv420_u_dest, - unsigned char *yuv420_v_dest, - unsigned char *nv12t_uv_src, - unsigned int yuv420_width, - unsigned int yuv420_uv_height, - unsigned int left, - unsigned int top, - unsigned int right, - unsigned int buttom); - -/* - * Converts linear data to tiled - * Crops left, top, right, buttom - * 1. Y of YUV420P to Y of NV12T - * 2. Y of YUV420S to Y of NV12T - * 3. UV of YUV420S to UV of NV12T - * - * @param nv12t_dest - * Y or UV plane address of NV12T[out] - * - * @param yuv420_src - * Y or UV plane address of YUV420P(S)[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_height - * Y: Height of YUV420, UV: Height/2 of YUV420[in] - * - * @param left - * Crop size of left - * - * @param top - * Crop size of top - * - * @param right - * Crop size of right - * - * @param buttom - * Crop size of buttom - */ -void csc_linear_to_tiled_crop_neon( - unsigned char *nv12t_dest, - unsigned char *yuv420_src, - unsigned int yuv420_width, - unsigned int yuv420_height, - unsigned int left, - unsigned int top, - unsigned int right, - unsigned int buttom); - -/* - * Converts and Interleaves linear to tiled - * Crops left, top, right, buttom - * 1. UV of YUV420P to UV of NV12T - * - * @param nv12t_uv_dest - * UV plane address of NV12T[out] - * - * @param yuv420p_u_src - * U plane address of YUV420P[in] - * - * @param yuv420p_v_src - * V plane address of YUV420P[in] - * - * @param yuv420_width - * Width of YUV420[in] - * - * @param yuv420_uv_height - * Height/2 of YUV420[in] - * - * @param left - * Crop size of left - * - * @param top - * Crop size of top - * - * @param right - * Crop size of right - * - * @param buttom - * Crop size of buttom - */ -void csc_linear_to_tiled_interleave_crop_neon( - unsigned char *nv12t_uv_dest, - unsigned char *yuv420_u_src, - unsigned char *yuv420_v_src, - unsigned int yuv420_width, - unsigned int yuv420_height, - unsigned int left, - unsigned int top, - unsigned int right, - unsigned int buttom); - -/* - * 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) -{ - csc_tiled_to_linear_crop(y_dst, y_src, width, height, 0, 0, 0, 0); -} - -/* - * 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) -{ - csc_tiled_to_linear_crop(uv_dst, uv_src, width, height, 0, 0, 0, 0); -} - -/* - * 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) -{ - csc_tiled_to_linear_deinterleave_crop(u_dst, v_dst, uv_src, width, height, - 0, 0, 0, 0); -} - -/* - * 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) -{ - csc_linear_to_tiled_crop(y_dst, y_src, width, height, 0, 0, 0, 0); -} - -/* - * 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) -{ - csc_linear_to_tiled_interleave_crop(uv_dst, u_src, v_src, width, height, - 0, 0, 0, 0); -} - -/* - * Converts tiled data to linear for mfc 6.x - * 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] - * - * @param yuv420_height - * Y: real height of YUV420[in] - * - */ -void csc_tiled_to_linear_y_neon( - unsigned char *y_dst, - unsigned char *y_src, - unsigned int width, - unsigned int height) -{ - csc_tiled_to_linear_crop_neon(y_dst, y_src, width, height, 0, 0, 0, 0); -} - -/* - * Converts tiled data to linear for mfc 6.x - * 1. UV of NV12T to Y of YUV420S - * - * @param u_dst - * UV plane address of YUV420P[out] - * - * @param nv12t_src - * Y or UV plane address of NV12T[in] - * - * @param yuv420_width - * real width of YUV420[in] - * - * @param yuv420_height - * (real height)/2 of YUV420[in] - */ -void csc_tiled_to_linear_uv_neon( - unsigned char *uv_dst, - unsigned char *uv_src, - unsigned int width, - unsigned int height) -{ - csc_tiled_to_linear_crop_neon(uv_dst, uv_src, width, height, 0, 0, 0, 0); -} - -/* - * Converts tiled data to linear for mfc 6.x - * Deinterleave src to u_dst, v_dst - * 1. UV of NV12T to Y of YUV420P - * - * @param u_dst - * U plane address of YUV420P[out] - * - * @param v_dst - * V plane address of YUV420P[out] - * - * @param nv12t_src - * Y or UV plane address of NV12T[in] - * - * @param yuv420_width - * real width of YUV420[in] - * - * @param yuv420_height - * (real height)/2 of YUV420[in] - */ -void csc_tiled_to_linear_uv_deinterleave_neon( - unsigned char *u_dst, - unsigned char *v_dst, - unsigned char *uv_src, - unsigned int width, - unsigned int height) -{ - csc_tiled_to_linear_deinterleave_crop_neon(u_dst, v_dst, uv_src, width, height, - 0, 0, 0, 0); -} - -/* - * 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_neon( - unsigned char *y_dst, - unsigned char *y_src, - unsigned int width, - unsigned int height) -{ - csc_linear_to_tiled_crop_neon(y_dst, y_src, width, height, 0, 0, 0, 0); -} - -/* - * 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_neon( - unsigned char *uv_dst, - unsigned char *u_src, - unsigned char *v_src, - unsigned int width, - unsigned int height) -{ - csc_linear_to_tiled_interleave_crop_neon(uv_dst, u_src, v_src, - width, height, 0, 0, 0, 0); -} - -/* - * 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, - unsigned int width, - unsigned int height) -{ - unsigned int i, j; - unsigned int tmp; - - unsigned int R, G, B; - unsigned int Y, U, V; - - unsigned int offset1 = width * height; - unsigned int offset2 = width/2 * height/2; - - unsigned short int *pSrc = (unsigned short int *)rgb_src; - - unsigned char *pDstY = (unsigned char *)y_dst; - unsigned char *pDstU = (unsigned char *)u_dst; - unsigned char *pDstV = (unsigned char *)v_dst; - - unsigned int yIndex = 0; - unsigned int uIndex = 0; - unsigned int vIndex = 0; - - for (j = 0; j < height; j++) { - for (i = 0; i < width; i++) { - tmp = pSrc[j * width + i]; - - R = (tmp & 0x0000F800) >> 8; - G = (tmp & 0x000007E0) >> 3; - B = (tmp & 0x0000001F); - B = B << 3; - - Y = ((66 * R) + (129 * G) + (25 * B) + 128); - Y = Y >> 8; - Y += 16; - - pDstY[yIndex++] = (unsigned char)Y; - - if ((j % 2) == 0 && (i % 2) == 0) { - U = ((-38 * R) - (74 * G) + (112 * B) + 128); - U = U >> 8; - U += 128; - V = ((112 * R) - (94 * G) - (18 * B) + 128); - V = V >> 8; - V += 128; - - pDstU[uIndex++] = (unsigned char)U; - pDstV[vIndex++] = (unsigned char)V; - } - } - } -} - -/* - * 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, - unsigned int width, - unsigned int height) -{ - unsigned int i, j; - unsigned int tmp; - - unsigned int R, G, B; - unsigned int Y, U, V; - - unsigned int offset = width * height; - - unsigned short int *pSrc = (unsigned short int *)rgb_src; - - unsigned char *pDstY = (unsigned char *)y_dst; - unsigned char *pDstUV = (unsigned char *)uv_dst; - - unsigned int yIndex = 0; - unsigned int uvIndex = 0; - - for (j = 0; j < height; j++) { - for (i = 0; i < width; i++) { - tmp = pSrc[j * width + i]; - - R = (tmp & 0x0000F800) >> 11; - R = R * 8; - G = (tmp & 0x000007E0) >> 5; - G = G * 4; - B = (tmp & 0x0000001F); - B = B * 8; - - Y = ((66 * R) + (129 * G) + (25 * B) + 128); - Y = Y >> 8; - Y += 16; - - pDstY[yIndex++] = (unsigned char)Y; - - if ((j % 2) == 0 && (i % 2) == 0) { - U = ((-38 * R) - (74 * G) + (112 * B) + 128); - U = U >> 8; - U += 128; - V = ((112 * R) - (94 * G) - (18 * B) + 128); - V = V >> 8; - V += 128; - - pDstUV[uvIndex++] = (unsigned char)U; - pDstUV[uvIndex++] = (unsigned char)V; - } - } - } -} - -/* - * Converts ARGB8888 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 ARGB8888[in] - * - * @param width - * Width of ARGB8888[in] - * - * @param height - * Height of ARGB8888[in] - */ -void csc_ARGB8888_to_YUV420P( - unsigned char *y_dst, - unsigned char *u_dst, - unsigned char *v_dst, - unsigned char *rgb_src, - unsigned int width, - unsigned int height) -{ - unsigned int i, j; - unsigned int tmp; - - unsigned int R, G, B; - unsigned int Y, U, V; - - unsigned int offset1 = width * height; - unsigned int offset2 = width/2 * height/2; - - unsigned int *pSrc = (unsigned int *)rgb_src; - - unsigned char *pDstY = (unsigned char *)y_dst; - unsigned char *pDstU = (unsigned char *)u_dst; - unsigned char *pDstV = (unsigned char *)v_dst; - - unsigned int yIndex = 0; - unsigned int uIndex = 0; - unsigned int vIndex = 0; - - for (j = 0; j < height; j++) { - for (i = 0; i < width; i++) { - tmp = pSrc[j * width + i]; - - R = (tmp & 0x00FF0000) >> 16; - G = (tmp & 0x0000FF00) >> 8; - B = (tmp & 0x000000FF); - - Y = ((66 * R) + (129 * G) + (25 * B) + 128); - Y = Y >> 8; - Y += 16; - - pDstY[yIndex++] = (unsigned char)Y; - - if ((j % 2) == 0 && (i % 2) == 0) { - U = ((-38 * R) - (74 * G) + (112 * B) + 128); - U = U >> 8; - U += 128; - V = ((112 * R) - (94 * G) - (18 * B) + 128); - V = V >> 8; - V += 128; - - pDstU[uIndex++] = (unsigned char)U; - pDstV[vIndex++] = (unsigned char)V; - } - } - } -} - - -/* - * Converts ARGB8888 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 ARGB8888[in] - * - * @param width - * Width of ARGB8888[in] - * - * @param height - * Height of ARGB8888[in] - */ -void csc_ARGB8888_to_YUV420SP( - unsigned char *y_dst, - unsigned char *uv_dst, - unsigned char *rgb_src, - unsigned int width, - unsigned int height) -{ - unsigned int i, j; - unsigned int tmp; - - unsigned int R, G, B; - unsigned int Y, U, V; - - unsigned int offset = width * height; - - unsigned int *pSrc = (unsigned int *)rgb_src; - - unsigned char *pDstY = (unsigned char *)y_dst; - unsigned char *pDstUV = (unsigned char *)uv_dst; - - unsigned int yIndex = 0; - unsigned int uvIndex = 0; - - for (j = 0; j < height; j++) { - for (i = 0; i < width; i++) { - tmp = pSrc[j * width + i]; - - R = (tmp & 0x00FF0000) >> 16; - G = (tmp & 0x0000FF00) >> 8; - B = (tmp & 0x000000FF); - - Y = ((66 * R) + (129 * G) + (25 * B) + 128); - Y = Y >> 8; - Y += 16; - - pDstY[yIndex++] = (unsigned char)Y; - - if ((j % 2) == 0 && (i % 2) == 0) { - U = ((-38 * R) - (74 * G) + (112 * B) + 128); - U = U >> 8; - U += 128; - V = ((112 * R) - (94 * G) - (18 * B) + 128); - V = V >> 8; - V += 128; - - pDstUV[uvIndex++] = (unsigned char)U; - pDstUV[uvIndex++] = (unsigned char)V; - } - } - } -}
\ No newline at end of file |