1 /* 2 * Copyright (c) 2011 Intel Corporation. All Rights Reserved. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the 6 * "Software"), to deal in the Software without restriction, including 7 * without limitation the rights to use, copy, modify, merge, publish, 8 * distribute, sub license, and/or sell copies of the Software, and to 9 * permit persons to whom the Software is furnished to do so, subject to 10 * the following conditions: 11 * 12 * The above copyright notice and this permission notice (including the 13 * next paragraph) shall be included in all copies or substantial portions 14 * of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR 20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 * 24 * Authors: 25 * Zeng Li <zeng.li (at) intel.com> 26 * Jason Hu <jason.hu (at) intel.com> 27 * Shengquan Yuan <shengquan.yuan (at) intel.com> 28 */ 29 #include "psb_surface.h" 30 #ifdef ANDROID 31 static uint32_t VAROTATION2HAL(int va_rotate) { 32 switch (va_rotate) { 33 case VA_ROTATION_90: 34 return HAL_TRANSFORM_ROT_90; 35 case VA_ROTATION_180: 36 return HAL_TRANSFORM_ROT_180; 37 case VA_ROTATION_270: 38 return HAL_TRANSFORM_ROT_270; 39 default: 40 return 0; 41 } 42 } 43 44 45 static uint32_t HAL2VAROTATION(int hal_rotate) { 46 switch (hal_rotate) { 47 case HAL_TRANSFORM_ROT_90: 48 return VA_ROTATION_90; 49 case HAL_TRANSFORM_ROT_180: 50 return VA_ROTATION_180; 51 case HAL_TRANSFORM_ROT_270: 52 return VA_ROTATION_270; 53 default: 54 return 0; 55 } 56 } 57 58 #else 59 #define VAROTATION2HAL(a) a 60 #define HAL2VAROTATION(a) a 61 #define psb_android_is_extvideo_mode(a) 0 62 #define psb_android_surfaceflinger_rotate(a, b) 63 #endif 64 65 void psb_InitOutLoop(VADriverContextP ctx); 66 void psb_RecalcAlternativeOutput(object_context_p obj_context); 67 void psb_CheckInterlaceRotate(object_context_p obj_context, unsigned char *pic_param_tmp); 68 VAStatus psb_DestroyRotateSurface( 69 VADriverContextP ctx, 70 object_surface_p obj_surface, 71 int rotate 72 ); 73 VAStatus psb_CreateOutLoopSurface( 74 object_context_p obj_context, 75 object_surface_p obj_surface, 76 int msvdx_rotate 77 ); 78 79 VAStatus psb_CreateScalingSurface( 80 object_context_p obj_context, 81 object_surface_p obj_surface 82 ); 83 84 VAStatus psb_CreateRotateSurface( 85 object_context_p obj_context, 86 object_surface_p obj_surface, 87 int msvdx_rotate 88 ); 89 90 int psb__dump_NV12_buffers( 91 psb_surface_p psb_surface, 92 short srcx, 93 short srcy, 94 unsigned short srcw, 95 unsigned short srch 96 ); 97 98