1 /* 2 * 3 * Copyright 2012 Samsung Electronics S.LSI Co. LTD 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 /*! 19 * \file exynos_gscaler.h 20 * \brief header file for Gscaler HAL 21 * \author ShinWon Lee (shinwon.lee@samsung.com) 22 * \date 2012/01/09 23 * 24 * <b>Revision History: </b> 25 * - 2012/01/09 : ShinWon Lee(shinwon.lee@samsung.com) \n 26 * Create 27 * 28 * - 2012/02/07 : ShinWon Lee(shinwon.lee@samsung.com) \n 29 * Change file name to exynos_gscaler.h 30 * 31 * - 2012/02/09 : Sangwoo, Parkk(sw5771.park@samsung.com) \n 32 * Use Multiple Gscaler by Multiple Process 33 * 34 * - 2012/02/20 : Sangwoo, Park(sw5771.park@samsung.com) \n 35 * Add exynos_gsc_set_rotation() API 36 * 37 * - 2012/02/20 : ShinWon Lee(shinwon.lee@samsung.com) \n 38 * Add size constrain 39 * 40 */ 41 42 /*! 43 * \defgroup exynos_gscaler 44 * \brief API for gscaler 45 * \addtogroup Exynos 46 */ 47 #ifndef EXYNOS_GSCALER_H_ 48 #define EXYNOS_GSCALER_H_ 49 50 #include <exynos_scaler.h> 51 52 #ifdef __cplusplus 53 extern "C" { 54 #endif 55 56 //#define EXYNOS_GSC_TRACE 1 57 #ifdef EXYNOS_GSC_TRACE 58 #define EXYNOS_GSC_LOG_TAG "Exynos_gscaler" 59 #define Exynos_gsc_In() (ALOGD("Exynos_gscaler:: %s In , Line: %d", __FUNCTION__, __LINE__) 60 #define Exynos_gsc_Out() (ALOGD("Exynos_gscaler:: %s Out , Line: %d", __FUNCTION__, __LINE__) 61 #else 62 #define Exynos_gsc_In() ((void *)0) 63 #define Exynos_gsc_Out() ((void *)0) 64 #endif 65 66 typedef exynos_sc_img exynos_mpp_img; 67 68 /* 69 * Create libgscaler handle. 70 * Gscaler dev_num is dynamically changed. 71 * 72 * \ingroup exynos_gscaler 73 * 74 * \return 75 * libgscaler handle 76 */ 77 void *exynos_gsc_create( 78 void); 79 80 /*! 81 * Create exclusive libgscaler handle. 82 * Other module can't use dev_num of Gscaler. 83 * 84 * \ingroup exynos_gscaler 85 * 86 * \param dev_num 87 * gscaler dev_num[in] 88 * \param gsc_mode 89 *It should be set to GSC_M2M_MODE or GSC_OUTPUT_MODE. 90 * 91 *\param out_mode 92 *It should be set to GSC_OUT_FIMD or GSC_OUT_TV. 93 * 94 * \return 95 * libgscaler handle 96 */ 97 void *exynos_gsc_create_exclusive( 98 int dev_num, 99 int gsc_mode, 100 int out_mode, 101 int allow_drm); 102 103 /*! 104 * Destroy libgscaler handle 105 * 106 * \ingroup exynos_gscaler 107 * 108 * \param handle 109 * libgscaler handle[in] 110 */ 111 void exynos_gsc_destroy( 112 void *handle); 113 114 /*! 115 * Set csc equation property 116 * 117 * \ingroup exynos_gscaler 118 * 119 * \param handle 120 * libgscaler handle[in] 121 * 122 * \param eq_auto 123 * csc mode (0: user, 1: auto)[in] 124 * 125 * \param range_full 126 * csc range (0: narrow, 1: full)[in] 127 * 128 * \param v4l2_colorspace 129 * ITU_R v4l2 colorspace(1: 601, 3: 709)[in] 130 */ 131 int exynos_gsc_set_csc_property( 132 void *handle, 133 unsigned int eq_auto, 134 unsigned int range_full, 135 unsigned int v4l2_colorspace); 136 137 /*! 138 * Set source format. 139 * 140 * \ingroup exynos_gscaler 141 * 142 * \param handle 143 * libgscaler handle[in] 144 * 145 * \param width 146 * image width[in] 147 * 148 * \param height 149 * image height[in] 150 * 151 * \param crop_left 152 * image left crop size[in] 153 * 154 * \param crop_top 155 * image top crop size[in] 156 * 157 * \param crop_width 158 * cropped image width[in] 159 * 160 * \param crop_height 161 * cropped image height[in] 162 * 163 * \param v4l2_colorformat 164 * color format[in] 165 * 166 * \param cacheable 167 * ccacheable[in] 168 * 169 * \param mode_drm 170 * mode_drm[in] 171 * 172 * \return 173 * error code 174 */ 175 int exynos_gsc_set_src_format( 176 void *handle, 177 unsigned int width, 178 unsigned int height, 179 unsigned int crop_left, 180 unsigned int crop_top, 181 unsigned int crop_width, 182 unsigned int crop_height, 183 unsigned int v4l2_colorformat, 184 unsigned int cacheable, 185 unsigned int mode_drm); 186 187 /*! 188 * Set destination format. 189 * 190 * \ingroup exynos_gscaler 191 * 192 * \param handle 193 * libgscaler handle[in] 194 * 195 * \param width 196 * image width[in] 197 * 198 * \param height 199 * image height[in] 200 * 201 * \param crop_left 202 * image left crop size[in] 203 * 204 * \param crop_top 205 * image top crop size[in] 206 * 207 * \param crop_width 208 * cropped image width[in] 209 * 210 * \param crop_height 211 * cropped image height[in] 212 * 213 * \param v4l2_colorformat 214 * color format[in] 215 * 216 * \param cacheable 217 * ccacheable[in] 218 * 219 * \param mode_drm 220 * mode_drm[in] 221 * 222 * \return 223 * error code 224 */ 225 int exynos_gsc_set_dst_format( 226 void *handle, 227 unsigned int width, 228 unsigned int height, 229 unsigned int crop_left, 230 unsigned int crop_top, 231 unsigned int crop_width, 232 unsigned int crop_height, 233 unsigned int v4l2_colorformat, 234 unsigned int cacheable, 235 unsigned int mode_drm); 236 237 /*! 238 * Set rotation. 239 * 240 * \ingroup exynos_gscaler 241 * 242 * \param handle 243 * libgscaler handle[in] 244 * 245 * \param rotation 246 * image rotation. It should be multiple of 90[in] 247 * 248 * \param flip_horizontal 249 * image flip_horizontal[in] 250 * 251 * \param flip_vertical 252 * image flip_vertical[in] 253 * 254 * \return 255 * error code 256 */ 257 int exynos_gsc_set_rotation( 258 void *handle, 259 int rotation, 260 int flip_horizontal, 261 int flip_vertical); 262 263 /*! 264 * Set source buffer 265 * 266 * \ingroup exynos_gscaler 267 * 268 * \param handle 269 * libgscaler handle[in] 270 * 271 * \param addr 272 * buffer pointer array[in] 273 * 274 * \param acquireFenceFd 275 * acquire fence fd for the buffer or -1[in] 276 * 277 * \return 278 * error code 279 */ 280 int exynos_gsc_set_src_addr( 281 void *handle, 282 void *addr[3], 283 int mem_type, 284 int acquireFenceFd); 285 286 /*! 287 * Set destination buffer 288 * 289 * \param handle 290 * libgscaler handle[in] 291 * 292 * \param addr 293 * buffer pointer array[in] 294 * 295 * \param acquireFenceFd 296 * acquire fence fd for the buffer or -1[in] 297 * 298 * \return 299 * error code 300 */ 301 int exynos_gsc_set_dst_addr( 302 void *handle, 303 void *addr[3], 304 int mem_type, 305 int acquireFenceFd); 306 307 /*! 308 * Convert color space with presetup color format 309 * 310 * \ingroup exynos_gscaler 311 * 312 * \param handle 313 * libgscaler handle[in] 314 * 315 * \return 316 * error code 317 */ 318 int exynos_gsc_convert( 319 void *handle); 320 321 /* 322 * API for setting GSC subdev crop 323 * Used in OTF mode 324 */ 325 int exynos_gsc_subdev_s_crop( 326 void *handle, 327 exynos_mpp_img *src_img, 328 exynos_mpp_img *dst_img); 329 330 /* 331 *api for setting the GSC config. 332 It configures the GSC for given config 333 */ 334 int exynos_gsc_config_exclusive( 335 void *handle, 336 exynos_mpp_img *src_img, 337 exynos_mpp_img *dst_img); 338 339 /* 340 *api for GSC-OUT run. 341 It queues the srcBuf to GSC and deques a buf from driver. 342 It should be called after configuring the GSC. 343 */ 344 int exynos_gsc_run_exclusive( 345 void *handle, 346 exynos_mpp_img *src_img, 347 exynos_mpp_img *dst_img); 348 349 /*! 350 * Create exclusive libgscaler blend handle. 351 * Other module can't use dev_num of Gscaler. 352 * 353 * \ingroup exynos_gscaler 354 * 355 * \param dev_num 356 * gscaler dev_num[in] 357 * \param gsc_mode 358 * \return 359 * libgscaler handle 360 */ 361 void *exynos_gsc_create_blend_exclusive( 362 int dev_num, 363 int gsc_mode, 364 int out_mode, 365 int allow_drm); 366 367 /* 368 *api for setting the GSC blend config. 369 It configures the GSC for given config 370 */ 371 int exynos_gsc_config_blend_exclusive( 372 void *handle, 373 exynos_mpp_img *src_img, 374 exynos_mpp_img *dst_img, 375 struct SrcBlendInfo *srcblendinfo); 376 377 /* 378 * Blocks until the current frame is done processing. 379 */ 380 int exynos_gsc_wait_frame_done_exclusive 381 (void *handle); 382 383 /* 384 *api for GSC stop. 385 It stops the GSC OUT streaming. 386 */ 387 int exynos_gsc_stop_exclusive 388 (void *handle); 389 390 /* 391 *api for GSC free_and_close. 392 */ 393 int exynos_gsc_free_and_close 394 (void *handle); 395 396 enum { 397 GSC_M2M_MODE = 0, 398 GSC_OUTPUT_MODE, 399 GSC_CAPTURE_MODE, 400 GSC_RESERVED_MODE, 401 }; 402 403 /*flag info */ 404 enum { 405 GSC_DUMMY = 0, 406 GSC_OUT_FIMD, 407 GSC_OUT_TV, 408 GSC_RESERVED, 409 }; 410 411 enum { 412 GSC_DONE_CNG_CFG = 0, 413 GSC_NEED_CNG_CFG, 414 }; 415 416 enum { 417 GSC_MEM_MMAP = 1, 418 GSC_MEM_USERPTR, 419 GSC_MEM_OVERLAY, 420 GSC_MEM_DMABUF, 421 }; 422 423 #ifdef __cplusplus 424 } 425 #endif 426 427 #endif /*EXYNOS_GSCALER_H_*/ 428