1 /******************************************************************************
2  *
3  * Copyright (C) 2018 The Android Open Source Project
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  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 /*!
21 ******************************************************************************
22 * \file ihevce_dep_mngr_private.h
23 *
24 * \brief
25 *    This file contains private structures & definations of Sync manager
26 *
27 * \date
28 *    13/12/2013
29 *
30 * \author
31 *    Ittiam
32 *
33 ******************************************************************************
34 */
35 
36 #ifndef _IHEVCE_DEP_MANAGER_PRIVATE_H_
37 #define _IHEVCE_DEP_MANAGER_PRIVATE_H_
38 
39 /*****************************************************************************/
40 /* File Includes                                                             */
41 /*****************************************************************************/
42 
43 /*****************************************************************************/
44 /* Constant Macros                                                           */
45 /*****************************************************************************/
46 
47 /*****************************************************************************/
48 /* Function Macros                                                           */
49 /*****************************************************************************/
50 
51 /*****************************************************************************/
52 /* Typedefs                                                                  */
53 /*****************************************************************************/
54 
55 /*****************************************************************************/
56 /* Enums                                                                     */
57 /*****************************************************************************/
58 typedef enum
59 {
60     DEP_MNGR_CTXT = 0,
61     DEP_MNGR_UNITS_PRCSD_MEM,
62     DEP_MNGR_WAIT_THRD_ID_MEM,
63     DEP_MNGR_SEM_HANDLE_MEM,
64 
65     /* should be last entry */
66     NUM_DEP_MNGR_MEM_RECS
67 } DEP_MNGR_MEM_T;
68 
69 /*****************************************************************************/
70 /* Structure                                                                 */
71 /*****************************************************************************/
72 
73 typedef struct
74 {
75     /*! Number of Vertical units to be processed */
76     WORD32 i4_num_vert_units;
77 
78     /*! Maximun Number of Horizontal units to be processed */
79     WORD32 i4_num_horz_units;
80 
81     /*! Number of column tiles for which encoder is working */
82     WORD32 i4_num_tile_cols;
83 
84     /*! Array to update the units which got processed in each row */
85     /*! For num_tile_cols > 1 , the memory layout is
86         0-max_num_vert_units for col_tile 0
87         0-max_num_vert_units for col_tile 1
88         ..
89         ..
90         0-max_num_vert_units for col_tile N-1
91     */
92     void *pv_units_prcsd_in_row;
93 
94     /*! Array to register the thread ids of waiting threads in each row */
95     /*! Memory Layout : (Row - Row) 1 entry per row
96         Memory Layout : (Frame - Frame) Num threads per frame
97         Memory layout : (Row - Frame)
98         Num threads for Row 0
99         Num threads for Row 1
100         Num threads for Row 2
101         ..
102         ..
103         Num threads for Row N-1
104     */
105     WORD32 *pi4_wait_thrd_id;
106 
107     /*! Number of threads in the dependency chain */
108     WORD32 i4_num_thrds;
109 
110     /*! Pointer to Array of Thread semaphore handle */
111     void **ppv_thrd_sem_handles;
112 
113     /*! Dependency Manager Mode */
114     WORD32 i4_dep_mngr_mode; /* @sa DEP_MNGR_MODE_T */
115 
116     /*! 0 : Semaphore not used., 1 : Uses semaphore                          */
117     /*! Note : This is required for using spin-lock for some dependencies.   */
118     /*! If 0, uses spin-lock(do-while) rather than semaphore for Sync        */
119     WORD8 i1_sem_enable;
120 
121     /*0: top, 1: left, 2: right, 3: bottom */
122     WORD8 ai4_tile_xtra_ctb[4];
123 
124     /* temp var: delete it */
125     //WORD32   i4_frame_map_complete;
126 
127 } dep_mngr_state_t;
128 
129 /*****************************************************************************/
130 /* Extern Variable Declarations                                              */
131 /*****************************************************************************/
132 
133 /*****************************************************************************/
134 /* Extern Function Declarations                                              */
135 /*****************************************************************************/
136 
137 #endif  //_IHEVCE_DEP_MANAGER_PRIVATE_H_
138