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@intel.com>
26  *    Jason Hu <jason.hu@intel.com>
27  *    Shengquan Yuan  <shengquan.yuan@intel.com>
28  */
29 #include "psb_surface.h"
30 #ifdef ANDROID
31 #include <system/graphics-base.h>
VAROTATION2HAL(int va_rotate)32 static uint32_t VAROTATION2HAL(int va_rotate) {
33         switch (va_rotate) {
34         case VA_ROTATION_90:
35             return HAL_TRANSFORM_ROT_90;
36         case VA_ROTATION_180:
37             return HAL_TRANSFORM_ROT_180;
38         case VA_ROTATION_270:
39             return HAL_TRANSFORM_ROT_270;
40         default:
41             return 0;
42         }
43 }
44 
45 
HAL2VAROTATION(int hal_rotate)46 static uint32_t HAL2VAROTATION(int hal_rotate) {
47         switch (hal_rotate) {
48         case HAL_TRANSFORM_ROT_90:
49             return VA_ROTATION_90;
50         case HAL_TRANSFORM_ROT_180:
51             return VA_ROTATION_180;
52         case HAL_TRANSFORM_ROT_270:
53             return VA_ROTATION_270;
54         default:
55             return 0;
56         }
57 }
58 
59 #else
60 #define VAROTATION2HAL(a) a
61 #define HAL2VAROTATION(a) a
62 #define psb_android_is_extvideo_mode(a) 0
63 #define psb_android_surfaceflinger_rotate(a, b)
64 #endif
65 
66 void psb_InitOutLoop(VADriverContextP ctx);
67 void psb_RecalcAlternativeOutput(object_context_p obj_context);
68 void psb_CheckInterlaceRotate(object_context_p obj_context, unsigned char *pic_param_tmp);
69 VAStatus psb_DestroyRotateSurface(
70     VADriverContextP ctx,
71     object_surface_p obj_surface,
72     int rotate
73 );
74 VAStatus psb_CreateOutLoopSurface(
75     object_context_p obj_context,
76     object_surface_p obj_surface,
77     int msvdx_rotate
78 );
79 
80 VAStatus psb_CreateScalingSurface(
81     object_context_p obj_context,
82     object_surface_p obj_surface
83 );
84 
85 VAStatus psb_CreateRotateSurface(
86     object_context_p obj_context,
87     object_surface_p obj_surface,
88     int msvdx_rotate
89 );
90 
91 int psb__dump_NV12_buffers(
92     psb_surface_p psb_surface,
93     short srcx,
94     short srcy,
95     unsigned short srcw,
96     unsigned short srch
97 );
98 
99