| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2009-2012, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bgrc_packet_priv.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/43 $ |
|---|
| 12 | * $brcm_Date: 3/16/12 4:16p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: GRC Packet private header |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/portinginterface/grc/7405/bgrc_packet_priv.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/43 3/16/12 4:16p nissen |
|---|
| 21 | * SW7425-2480: Added rop reset to sync blit. |
|---|
| 22 | * |
|---|
| 23 | * Hydra_Software_Devel/42 1/6/12 1:46p nissen |
|---|
| 24 | * SW7435-13 : Fixed support for 7435 A0. |
|---|
| 25 | * |
|---|
| 26 | * Hydra_Software_Devel/41 12/20/11 5:40p nissen |
|---|
| 27 | * SW7231-540: Fixed sync and scaling problems with mirroring. |
|---|
| 28 | * |
|---|
| 29 | * Hydra_Software_Devel/40 12/15/11 6:15p nissen |
|---|
| 30 | * SW7435-13 : Added support for 7435 A0. |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/39 12/14/11 4:48p nissen |
|---|
| 33 | * SW7435-13 : Added support for 7435 A0. |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/38 12/13/11 4:44p nissen |
|---|
| 36 | * SW7231-535: Fixed surface rectangle verification after sync blit. |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/37 11/4/11 8:43p nissen |
|---|
| 39 | * SWBLURAY-27238: Added include file for 2nd M2MC for 7640 B0. |
|---|
| 40 | * |
|---|
| 41 | * Hydra_Software_Devel/36 11/3/11 4:50p nissen |
|---|
| 42 | * SWBLURAY-27238: Added support for 2nd M2MC for 7640 B0. |
|---|
| 43 | * |
|---|
| 44 | * Hydra_Software_Devel/35 10/6/11 12:45p nissen |
|---|
| 45 | * SW7420-2082: Fixed debug define. |
|---|
| 46 | * |
|---|
| 47 | * Hydra_Software_Devel/34 10/6/11 12:08p nissen |
|---|
| 48 | * SW7420-2082: Added debug prints for FixedScale |
|---|
| 49 | * |
|---|
| 50 | * Hydra_Software_Devel/33 10/5/11 5:39p nissen |
|---|
| 51 | * SW7425-248: Updated use of BDBG_OBJECTs. |
|---|
| 52 | * |
|---|
| 53 | * Hydra_Software_Devel/32 10/5/11 12:47p nissen |
|---|
| 54 | * SW7425-248: Removed BDBG_OBJECT support for the 7038. |
|---|
| 55 | * |
|---|
| 56 | * Hydra_Software_Devel/31 9/17/11 7:06p nissen |
|---|
| 57 | * SW7425-248: Added BDBG_OBJECT_ID_DECLARE. |
|---|
| 58 | * |
|---|
| 59 | * Hydra_Software_Devel/30 9/17/11 6:38p nissen |
|---|
| 60 | * SW7425-248: Added BDBG_OBJECT_ASSERT. |
|---|
| 61 | * |
|---|
| 62 | * Hydra_Software_Devel/29 9/13/11 4:42p nissen |
|---|
| 63 | * SW7420-1575: Fixed surface rectangle verification, and added support |
|---|
| 64 | * for surface format verification. |
|---|
| 65 | * |
|---|
| 66 | * Hydra_Software_Devel/28 7/27/11 5:52p nissen |
|---|
| 67 | * SW7405-3671: Added support for fixed scaling with 420 destriping. |
|---|
| 68 | * |
|---|
| 69 | * Hydra_Software_Devel/27 6/23/11 10:13a nissen |
|---|
| 70 | * SW7420-1893: Prevented sync blit frin over writting packet memory. |
|---|
| 71 | * |
|---|
| 72 | * Hydra_Software_Devel/26 5/27/11 6:27p nissen |
|---|
| 73 | * SW7346-149: Added packet submitted field on context. |
|---|
| 74 | * |
|---|
| 75 | * Hydra_Software_Devel/25 5/26/11 6:09p nissen |
|---|
| 76 | * SW7335-916: Fixed linear destripe for SourceControl packet. |
|---|
| 77 | * |
|---|
| 78 | * Hydra_Software_Devel/24 5/20/11 5:56p nissen |
|---|
| 79 | * SW7335-1213: Fixing sync blit. |
|---|
| 80 | * |
|---|
| 81 | * Hydra_Software_Devel/23 3/7/11 3:57p nissen |
|---|
| 82 | * SW7420-1575: Added support for surface rectangle verification. |
|---|
| 83 | * |
|---|
| 84 | * Hydra_Software_Devel/22 3/7/11 1:33p nissen |
|---|
| 85 | * SW7038-3500: Fixed header size. |
|---|
| 86 | * |
|---|
| 87 | * Hydra_Software_Devel/21 3/2/11 7:49p nissen |
|---|
| 88 | * SW7038-3500: Fixed build errors. |
|---|
| 89 | * |
|---|
| 90 | * Hydra_Software_Devel/20 2/25/11 5:02p nissen |
|---|
| 91 | * SW7038-3500: Added initial support for 7038. |
|---|
| 92 | * |
|---|
| 93 | * Hydra_Software_Devel/19 12/6/10 12:36p nissen |
|---|
| 94 | * SW7420-1138: Added support for validating memory bounds used by blits. |
|---|
| 95 | * |
|---|
| 96 | * Hydra_Software_Devel/18 11/30/10 3:34p nissen |
|---|
| 97 | * SW7335-916: Fixed macro warnings. |
|---|
| 98 | * |
|---|
| 99 | * Hydra_Software_Devel/17 11/25/10 2:32p nissen |
|---|
| 100 | * SW7335-916: Added more debug print parameters to FixedScale packet. |
|---|
| 101 | * |
|---|
| 102 | * Hydra_Software_Devel/16 11/15/10 3:12p nissen |
|---|
| 103 | * SW7420-1150: Fixed palette to palette blits. |
|---|
| 104 | * |
|---|
| 105 | * Hydra_Software_Devel/15 11/11/10 1:38p nissen |
|---|
| 106 | * SW7335-916: Added support for FixedScale packet. |
|---|
| 107 | * |
|---|
| 108 | * Hydra_Software_Devel/14 10/27/10 12:16p nissen |
|---|
| 109 | * SW7420-1150: Fixed support for palette to palatte blits. |
|---|
| 110 | * |
|---|
| 111 | * Hydra_Software_Devel/13 9/20/10 1:55p nissen |
|---|
| 112 | * SW7405-3671: Added support for Source, Destination, and Output Control |
|---|
| 113 | * packets. |
|---|
| 114 | * |
|---|
| 115 | * Hydra_Software_Devel/12 9/15/10 5:34p nissen |
|---|
| 116 | * SW7420-1081: Switched to using BMEM_Alloc with cached memory when |
|---|
| 117 | * allocating user packets. |
|---|
| 118 | * |
|---|
| 119 | * Hydra_Software_Devel/11 8/18/10 3:21p nissen |
|---|
| 120 | * SW7405-3671: Checking if user overwrote submited packet memory. |
|---|
| 121 | * |
|---|
| 122 | * Hydra_Software_Devel/10 8/9/10 10:35p nissen |
|---|
| 123 | * SW7405-3671: Added field in context structure to support forced SW |
|---|
| 124 | * striping. |
|---|
| 125 | * |
|---|
| 126 | * Hydra_Software_Devel/9 8/2/10 2:57p nissen |
|---|
| 127 | * SW7405-3671: Removed reset state packet from sync blit. |
|---|
| 128 | * |
|---|
| 129 | * Hydra_Software_Devel/8 7/31/10 5:12p nissen |
|---|
| 130 | * SW7405-3671: Fixed packet size macros. |
|---|
| 131 | * |
|---|
| 132 | * Hydra_Software_Devel/7 7/28/10 4:01p nissen |
|---|
| 133 | * SW7405-3671: Added group header field to context. |
|---|
| 134 | * |
|---|
| 135 | * Hydra_Software_Devel/6 7/26/10 2:43p nissen |
|---|
| 136 | * SW7405-3671: Added packet size define. |
|---|
| 137 | * |
|---|
| 138 | * Hydra_Software_Devel/5 7/18/10 4:07p nissen |
|---|
| 139 | * SW7405-3671: Fixed reset state and sync. |
|---|
| 140 | * |
|---|
| 141 | * Hydra_Software_Devel/4 7/15/10 9:14p nissen |
|---|
| 142 | * SW7405-3671: Added more interrupt support. |
|---|
| 143 | * |
|---|
| 144 | * Hydra_Software_Devel/3 7/12/10 2:40p nissen |
|---|
| 145 | * SW7405-3671: Updated context structure. |
|---|
| 146 | * |
|---|
| 147 | * Hydra_Software_Devel/2 6/21/10 2:29p nissen |
|---|
| 148 | * SW7405-3671: Fixed packet settings. |
|---|
| 149 | * |
|---|
| 150 | * Hydra_Software_Devel/1 6/21/10 11:05a nissen |
|---|
| 151 | * SW7405-3671: Initial version. |
|---|
| 152 | * |
|---|
| 153 | ***************************************************************************/ |
|---|
| 154 | |
|---|
| 155 | #ifndef BGRC_PACKET_PRIV_H__ |
|---|
| 156 | #define BGRC_PACKET_PRIV_H__ |
|---|
| 157 | |
|---|
| 158 | #include "bdbg.h" |
|---|
| 159 | #include "bchp.h" |
|---|
| 160 | #include "bmem.h" |
|---|
| 161 | #include "bsur.h" |
|---|
| 162 | #include "bint.h" |
|---|
| 163 | #include "bkni.h" |
|---|
| 164 | #include "breg_mem.h" |
|---|
| 165 | #include "bgrc_packet.h" |
|---|
| 166 | #include "bgrc_errors.h" |
|---|
| 167 | #include "bchp_common.h" |
|---|
| 168 | #include "blst_list.h" |
|---|
| 169 | |
|---|
| 170 | #if (BCHP_CHIP==7435) |
|---|
| 171 | #include "bchp_m2mc.h" |
|---|
| 172 | #include "bchp_m2mc1.h" |
|---|
| 173 | #else |
|---|
| 174 | #include "bchp_m2mc.h" |
|---|
| 175 | #endif |
|---|
| 176 | |
|---|
| 177 | #if ((BCHP_CHIP==7640) && (BCHP_VER >= BCHP_VER_B0)) |
|---|
| 178 | #include "bchp_m2mc_1.h" |
|---|
| 179 | #endif |
|---|
| 180 | |
|---|
| 181 | #ifdef __cplusplus |
|---|
| 182 | extern "C" { |
|---|
| 183 | #endif |
|---|
| 184 | |
|---|
| 185 | /***************************************************************************/ |
|---|
| 186 | #ifndef BDBG_OBJECT_ID |
|---|
| 187 | #define BDBG_OBJECT(P0) |
|---|
| 188 | #define BDBG_OBJECT_SET(P0,P1) |
|---|
| 189 | #define BDBG_OBJECT_ASSERT(P0,P1) |
|---|
| 190 | #define BDBG_OBJECT_DESTROY(P0,P1) |
|---|
| 191 | #define BDBG_OBJECT_ID(P0) extern const char bgrc_id__##P0 |
|---|
| 192 | #define BDBG_OBJECT_ID_DECLARE(P0) extern const char bgrc_id_declare_##P0 |
|---|
| 193 | #endif |
|---|
| 194 | |
|---|
| 195 | /***************************************************************************/ |
|---|
| 196 | BDBG_OBJECT_ID_DECLARE(BGRC_PacketContext); |
|---|
| 197 | |
|---|
| 198 | /***************************************************************************/ |
|---|
| 199 | /*#define BGRC_PACKET_P_DEBUG*/ |
|---|
| 200 | /*#define BGRC_PACKET_P_VERIFY_SURFACE_RECTANGLE*/ |
|---|
| 201 | |
|---|
| 202 | /***************************************************************************/ |
|---|
| 203 | #define BGRC_PACKET_P_BLIT_GROUP_SIZE_MAX (1024*16) |
|---|
| 204 | |
|---|
| 205 | /***************************************************************************/ |
|---|
| 206 | #define BGRC_PACKET_P_MEMORY_ALIGN_BITS 5 |
|---|
| 207 | #define BGRC_PACKET_P_MEMORY_ALIGN_MASK ((1 << BGRC_PACKET_P_MEMORY_ALIGN_BITS) - 1) |
|---|
| 208 | |
|---|
| 209 | /***************************************************************************/ |
|---|
| 210 | #ifdef BCHP_M2MC0_REVISION |
|---|
| 211 | #define BGRC_M2MC(val) BCHP_M2MC_##val |
|---|
| 212 | #else |
|---|
| 213 | #define BGRC_M2MC(val) BCHP_M2MC_##val |
|---|
| 214 | #endif |
|---|
| 215 | |
|---|
| 216 | /***************************************************************************/ |
|---|
| 217 | #define BGRC_PACKET_P_REGISTER_COUNT \ |
|---|
| 218 | ((BGRC_M2MC(SRC_CLUT_ENTRY_i_ARRAY_BASE) - BGRC_M2MC(SRC_FEEDER_ENABLE)) / 4 + 1) |
|---|
| 219 | #define BGRC_PACKET_P_GET_STORED_REG_INDEX( reg ) \ |
|---|
| 220 | ((BGRC_M2MC(reg) - BGRC_M2MC(SRC_FEEDER_ENABLE)) / sizeof (uint32_t)) |
|---|
| 221 | |
|---|
| 222 | /***************************************************************************/ |
|---|
| 223 | #ifdef BGRC_PACKET_P_DEBUG |
|---|
| 224 | #define BGRC_PACKET_P_DEBUG_PRINT( value ) BKNI_Printf( value ) |
|---|
| 225 | #define BGRC_PACKET_P_DEBUG_PRINT_VALUE( value ) BKNI_Printf( "%08x ", value ) |
|---|
| 226 | #else |
|---|
| 227 | #define BGRC_PACKET_P_DEBUG_PRINT( value ) |
|---|
| 228 | #define BGRC_PACKET_P_DEBUG_PRINT_VALUE( value ) |
|---|
| 229 | #endif |
|---|
| 230 | |
|---|
| 231 | #ifdef BGRC_PACKET_P_DEBUG |
|---|
| 232 | #define BGRC_PACKET_P_STORE_REG( reg, value ) { BKNI_Printf("%08x ", (value)); hContext->stored_registers[BGRC_PACKET_P_GET_STORED_REG_INDEX(reg)] = (value); } |
|---|
| 233 | #else |
|---|
| 234 | #define BGRC_PACKET_P_STORE_REG( reg, value ) hContext->stored_registers[BGRC_PACKET_P_GET_STORED_REG_INDEX(reg)] = (value) |
|---|
| 235 | #endif |
|---|
| 236 | |
|---|
| 237 | #define BGRC_PACKET_P_STORE_REG_MASK( reg, value, mask ) BGRC_PACKET_P_STORE_REG( reg, (BGRC_PACKET_P_GET_REG(reg) & (mask)) | (value) ) |
|---|
| 238 | |
|---|
| 239 | #define BGRC_PACKET_P_STORE_REG_FIELD( reg, field, value ) \ |
|---|
| 240 | { \ |
|---|
| 241 | hContext->stored_registers[BGRC_PACKET_P_GET_STORED_REG_INDEX(reg)] &= ~BGRC_M2MC(reg##_##field##_MASK); \ |
|---|
| 242 | hContext->stored_registers[BGRC_PACKET_P_GET_STORED_REG_INDEX(reg)] |= BGRC_M2MC(reg##_##field##_##value) << BGRC_M2MC(reg##_##field##_SHIFT); \ |
|---|
| 243 | } |
|---|
| 244 | |
|---|
| 245 | #define BGRC_PACKET_P_STORE_REG_FIELD_DATA( reg, field, value ) \ |
|---|
| 246 | { \ |
|---|
| 247 | hContext->stored_registers[BGRC_PACKET_P_GET_STORED_REG_INDEX(reg)] &= ~BGRC_M2MC(reg##_##field##_MASK); \ |
|---|
| 248 | hContext->stored_registers[BGRC_PACKET_P_GET_STORED_REG_INDEX(reg)] |= (value) << BGRC_M2MC(reg##_##field##_SHIFT); \ |
|---|
| 249 | } |
|---|
| 250 | |
|---|
| 251 | #define BGRC_PACKET_P_STORE_REG_FIELD_COMP( reg, field, value_false, value_true, comp ) \ |
|---|
| 252 | { \ |
|---|
| 253 | if( comp ) \ |
|---|
| 254 | BGRC_PACKET_P_STORE_REG_FIELD(reg, field, value_true) \ |
|---|
| 255 | else \ |
|---|
| 256 | BGRC_PACKET_P_STORE_REG_FIELD(reg, field, value_false) \ |
|---|
| 257 | } |
|---|
| 258 | |
|---|
| 259 | #if defined(BCHP_M2MC_BLIT_SRC_TOP_LEFT_1) || defined(BCHP_M2MC0_BLIT_SRC_TOP_LEFT_1) |
|---|
| 260 | #define BGRC_PACKET_P_STORE_RECT_REGS( src_pos0, src_size0, src_pos1, src_size1, dst_pos, dst_size, out_pos, out_size ) \ |
|---|
| 261 | { \ |
|---|
| 262 | BGRC_PACKET_P_STORE_REG( BLIT_SRC_TOP_LEFT, src_pos0 ); \ |
|---|
| 263 | BGRC_PACKET_P_STORE_REG( BLIT_SRC_SIZE, src_size0 ); \ |
|---|
| 264 | BGRC_PACKET_P_STORE_REG( BLIT_SRC_TOP_LEFT_1, src_pos1 ); \ |
|---|
| 265 | BGRC_PACKET_P_STORE_REG( BLIT_SRC_SIZE_1, src_size1 ); \ |
|---|
| 266 | BGRC_PACKET_P_STORE_REG( BLIT_DEST_TOP_LEFT, dst_pos ); \ |
|---|
| 267 | BGRC_PACKET_P_STORE_REG( BLIT_DEST_SIZE, dst_size ); \ |
|---|
| 268 | BGRC_PACKET_P_STORE_REG( BLIT_OUTPUT_TOP_LEFT, out_pos ); \ |
|---|
| 269 | BGRC_PACKET_P_STORE_REG( BLIT_OUTPUT_SIZE, out_size ); \ |
|---|
| 270 | } |
|---|
| 271 | #else |
|---|
| 272 | #define BGRC_PACKET_P_STORE_RECT_REGS( src_pos0, src_size0, src_pos1, src_size1, dst_pos, dst_size, out_pos, out_size ) \ |
|---|
| 273 | { \ |
|---|
| 274 | BGRC_PACKET_P_STORE_REG( BLIT_SRC_TOP_LEFT, src_pos0 ); \ |
|---|
| 275 | BGRC_PACKET_P_STORE_REG( BLIT_SRC_SIZE, src_size0 ); \ |
|---|
| 276 | BGRC_PACKET_P_STORE_REG( BLIT_DEST_TOP_LEFT, dst_pos ); \ |
|---|
| 277 | BGRC_PACKET_P_STORE_REG( BLIT_DEST_SIZE, dst_size ); \ |
|---|
| 278 | BGRC_PACKET_P_STORE_REG( BLIT_OUTPUT_TOP_LEFT, out_pos ); \ |
|---|
| 279 | BGRC_PACKET_P_STORE_REG( BLIT_OUTPUT_SIZE, out_size ); \ |
|---|
| 280 | } |
|---|
| 281 | #endif |
|---|
| 282 | |
|---|
| 283 | #if defined(BCHP_M2MC_HORIZ_FIR_1_COEFF_PHASE0_01) || defined(BCHP_M2MC0_HORIZ_FIR_1_COEFF_PHASE0_01) |
|---|
| 284 | #define BGRC_PACKET_P_STORE_SCALE_REGS( reg, num, phase, step ) \ |
|---|
| 285 | { \ |
|---|
| 286 | BGRC_PACKET_P_STORE_REG( reg##_SCALER_##num##_INITIAL_PHASE, (phase) & BGRC_M2MC(reg##_SCALER_##num##_INITIAL_PHASE_PHASE_MASK) ); \ |
|---|
| 287 | BGRC_PACKET_P_STORE_REG( reg##_SCALER_##num##_STEP, (step) & BGRC_M2MC(reg##_SCALER_##num##_STEP_STEP_MASK) ); \ |
|---|
| 288 | } |
|---|
| 289 | #else |
|---|
| 290 | #define BGRC_PACKET_P_STORE_SCALE_REGS( reg, num, phase, step ) \ |
|---|
| 291 | { \ |
|---|
| 292 | BGRC_PACKET_P_STORE_REG( reg##_SCALER_INITIAL_PHASE, (phase) & BGRC_M2MC(reg##_SCALER_INITIAL_PHASE_PHASE_MASK) ); \ |
|---|
| 293 | BGRC_PACKET_P_STORE_REG( reg##_SCALER_STEP, (step) & BGRC_M2MC(reg##_SCALER_STEP_STEP_MASK) ); \ |
|---|
| 294 | } |
|---|
| 295 | #endif |
|---|
| 296 | |
|---|
| 297 | /***************************************************************************/ |
|---|
| 298 | #ifdef BGRC_PACKET_P_DEBUG |
|---|
| 299 | #define BGRC_PACKET_P_WRITE_REG( dst, index ) { BKNI_Printf("%08x ", hContext->stored_registers[index]); dst = hContext->stored_registers[index]; } |
|---|
| 300 | #define BGRC_PACKET_P_WRITE_DATA( dst, data ) { BKNI_Printf("%08x ", (data)); dst = data; } |
|---|
| 301 | #else |
|---|
| 302 | #define BGRC_PACKET_P_WRITE_REG( dst, index ) dst = hContext->stored_registers[index] |
|---|
| 303 | #define BGRC_PACKET_P_WRITE_DATA( dst, data ) dst = data |
|---|
| 304 | #endif |
|---|
| 305 | |
|---|
| 306 | #define BGRC_PACKET_P_GET_REG_FROM_INDEX( index ) hContext->stored_registers[index] |
|---|
| 307 | #define BGRC_PACKET_P_GET_REG( reg ) BGRC_PACKET_P_GET_REG_FROM_INDEX(BGRC_PACKET_P_GET_STORED_REG_INDEX(reg)) |
|---|
| 308 | |
|---|
| 309 | #ifdef BCHP_M2MC0_REVISION |
|---|
| 310 | #define BGRC_PACKET_P_GET_REG_FIELD( reg, field ) (BGRC_PACKET_P_GET_REG(reg) & BCHP_M2MC0_##reg##_##field##_MASK) |
|---|
| 311 | #define BGRC_PACKET_P_GET_REG_FIELD_SHIFT( reg, field ) ((BGRC_PACKET_P_GET_REG(reg) & BCHP_M2MC0_##reg##_##field##_MASK) >> BCHP_M2MC0_##reg##_##field##_SHIFT) |
|---|
| 312 | #else |
|---|
| 313 | #define BGRC_PACKET_P_GET_REG_FIELD( reg, field ) (BGRC_PACKET_P_GET_REG(reg) & BCHP_M2MC_##reg##_##field##_MASK) |
|---|
| 314 | #define BGRC_PACKET_P_GET_REG_FIELD_SHIFT( reg, field ) ((BGRC_PACKET_P_GET_REG(reg) & BCHP_M2MC_##reg##_##field##_MASK) >> BCHP_M2MC_##reg##_##field##_SHIFT) |
|---|
| 315 | #endif |
|---|
| 316 | |
|---|
| 317 | /***************************************************************************/ |
|---|
| 318 | #ifdef BCHP_M2MC1_REVISION |
|---|
| 319 | #define BGRC_P_WriteReg32( handle, reg, data ) BREG_Write32( handle, BCHP_M2MC_##reg + hGrc->ulDeviceNum * (BCHP_M2MC1_REVISION - BCHP_M2MC_REVISION), data ) |
|---|
| 320 | #define BGRC_P_ReadReg32( handle, reg ) BREG_Read32( handle, BCHP_M2MC_##reg + hGrc->ulDeviceNum * (BCHP_M2MC1_REVISION - BCHP_M2MC_REVISION) ) |
|---|
| 321 | #else |
|---|
| 322 | #ifdef BCHP_M2MC_1_REVISION |
|---|
| 323 | #define BGRC_P_WriteReg32( handle, reg, data ) BREG_Write32( handle, BCHP_M2MC_##reg + hGrc->ulDeviceNum * (BCHP_M2MC_1_REVISION - BCHP_M2MC_REVISION), data ) |
|---|
| 324 | #define BGRC_P_ReadReg32( handle, reg ) BREG_Read32( handle, BCHP_M2MC_##reg + hGrc->ulDeviceNum * (BCHP_M2MC_1_REVISION - BCHP_M2MC_REVISION) ) |
|---|
| 325 | #else |
|---|
| 326 | #define BGRC_P_WriteReg32( handle, reg, data ) BREG_Write32( handle, BCHP_M2MC_##reg, data ) |
|---|
| 327 | #define BGRC_P_ReadReg32( handle, reg ) BREG_Read32( handle, BCHP_M2MC_##reg ) |
|---|
| 328 | #endif |
|---|
| 329 | #endif |
|---|
| 330 | |
|---|
| 331 | /***************************************************************************/ |
|---|
| 332 | #define BGRC_PACKET_P_SYNC_REGISTER_COUNT \ |
|---|
| 333 | ((BCHP_M2MC_ROP_OPERATION - BCHP_M2MC_SRC_FEEDER_ENABLE) / sizeof (uint32_t)) |
|---|
| 334 | |
|---|
| 335 | #define BGRC_PACKET_P_SYNC_PACKET_SIZE (\ |
|---|
| 336 | sizeof (BM2MC_PACKET_PacketSaveState) + \ |
|---|
| 337 | sizeof (BM2MC_PACKET_PacketSourceNone) + \ |
|---|
| 338 | sizeof (BM2MC_PACKET_PacketDestinationNone) + \ |
|---|
| 339 | sizeof (BM2MC_PACKET_PacketOutputFeeder) + \ |
|---|
| 340 | sizeof (BM2MC_PACKET_PacketBlend) + \ |
|---|
| 341 | sizeof (BM2MC_PACKET_PacketRop) + \ |
|---|
| 342 | sizeof (BM2MC_PACKET_PacketSourceColorkeyEnable) + \ |
|---|
| 343 | sizeof (BM2MC_PACKET_PacketSourceColorMatrixEnable) + \ |
|---|
| 344 | sizeof (BM2MC_PACKET_PacketMirror) + \ |
|---|
| 345 | sizeof (BM2MC_PACKET_PacketFillBlit) + \ |
|---|
| 346 | sizeof (BM2MC_PACKET_PacketRestoreState)) |
|---|
| 347 | |
|---|
| 348 | #define BGRC_PACKET_P_EXTRA_PACKET_SIZE \ |
|---|
| 349 | (BGRC_PACKET_P_SYNC_PACKET_SIZE + sizeof (BM2MC_PACKET_Header)) |
|---|
| 350 | |
|---|
| 351 | /***************************************************************************/ |
|---|
| 352 | #define BGRC_PACKET_P_USING_EVENT( context, type_ ) ((context)->type_##_event && \ |
|---|
| 353 | (hGrc->callback_isr == NULL) && ((context)->type_##_callback_isr == NULL)) |
|---|
| 354 | |
|---|
| 355 | /***************************************************************************/ |
|---|
| 356 | typedef struct |
|---|
| 357 | { |
|---|
| 358 | uint32_t stripe_count; |
|---|
| 359 | uint32_t stripe_num; |
|---|
| 360 | uint32_t output_stripe_width; |
|---|
| 361 | uint32_t input_stripe_width; |
|---|
| 362 | uint32_t hor_chroma_phase; |
|---|
| 363 | uint32_t hor_phase; |
|---|
| 364 | uint32_t hor_step; |
|---|
| 365 | uint32_t ver_chroma_phase; |
|---|
| 366 | uint32_t ver_phase; |
|---|
| 367 | uint32_t ver_step; |
|---|
| 368 | uint16_t stripe_overlap; |
|---|
| 369 | } |
|---|
| 370 | BGRC_PACKET_P_Scaler; |
|---|
| 371 | |
|---|
| 372 | /***************************************************************************/ |
|---|
| 373 | typedef struct |
|---|
| 374 | { |
|---|
| 375 | uint32_t hor_phase; |
|---|
| 376 | uint32_t src_x; |
|---|
| 377 | uint32_t dst_x; |
|---|
| 378 | uint32_t out_x; |
|---|
| 379 | uint32_t src_width; |
|---|
| 380 | uint32_t out_width; |
|---|
| 381 | } |
|---|
| 382 | BGRC_PACKET_P_Stripe; |
|---|
| 383 | |
|---|
| 384 | /***************************************************************************/ |
|---|
| 385 | BDBG_OBJECT_ID_DECLARE(BGRC_PacketContext); |
|---|
| 386 | typedef struct BGRC_P_PacketContext |
|---|
| 387 | { |
|---|
| 388 | BDBG_OBJECT(BGRC_PacketContext) |
|---|
| 389 | BGRC_Handle hGrc; |
|---|
| 390 | BGRC_PacketContext_CreateSettings create_settings; |
|---|
| 391 | BINT_CallbackHandle hCallback; |
|---|
| 392 | |
|---|
| 393 | BLST_D_ENTRY(BGRC_P_PacketContext) context_link; |
|---|
| 394 | |
|---|
| 395 | BGRC_Callback advance_callback_isr; |
|---|
| 396 | void *advance_callback_data; |
|---|
| 397 | BGRC_Callback sync_callback_isr; |
|---|
| 398 | void *sync_callback_data; |
|---|
| 399 | |
|---|
| 400 | BGRC_PACKET_P_Scaler scaler; |
|---|
| 401 | BM2MC_PACKET_Header *scaler_header; |
|---|
| 402 | |
|---|
| 403 | uint32_t *buffer_alloc_addr; |
|---|
| 404 | uint32_t *buffer_base_addr; |
|---|
| 405 | uint32_t buffer_total_size; |
|---|
| 406 | uint32_t buffer_alloc_offset; |
|---|
| 407 | uint32_t buffer_submit_offset; |
|---|
| 408 | uint32_t buffer_submit_size; |
|---|
| 409 | |
|---|
| 410 | uint32_t *last_blitheader_addr; |
|---|
| 411 | uint32_t last_blitheader; |
|---|
| 412 | uint32_t last_fifo_offset; |
|---|
| 413 | uint32_t last_size_out; |
|---|
| 414 | uint32_t m2mc_offset; |
|---|
| 415 | uint32_t group_header; |
|---|
| 416 | |
|---|
| 417 | uint32_t *sync_output_addr; |
|---|
| 418 | uint32_t sync_output_offset; |
|---|
| 419 | |
|---|
| 420 | BKNI_EventHandle advance_event; |
|---|
| 421 | BKNI_EventHandle sync_event; |
|---|
| 422 | bool advance_interrupt; |
|---|
| 423 | bool sync_interrupt; |
|---|
| 424 | bool advance_wait; |
|---|
| 425 | bool sync_wait; |
|---|
| 426 | bool reset_state; |
|---|
| 427 | bool packets_submitted; |
|---|
| 428 | |
|---|
| 429 | uint8_t last_blit_type; |
|---|
| 430 | |
|---|
| 431 | uint32_t stored_registers[BGRC_PACKET_P_REGISTER_COUNT]; |
|---|
| 432 | uint32_t saved_registers[BGRC_PACKET_P_REGISTER_COUNT]; |
|---|
| 433 | |
|---|
| 434 | BM2MC_PACKET_PacketFixedScale fixed_scale; |
|---|
| 435 | BM2MC_PACKET_PacketFixedScale saved_fixed_scale; |
|---|
| 436 | BM2MC_PACKET_PacketDestripeFixedScale destripe_fixed_scale; |
|---|
| 437 | BM2MC_PACKET_PacketDestripeFixedScale saved_destripe_fixed_scale; |
|---|
| 438 | uint32_t src_format0; |
|---|
| 439 | uint32_t out_format0; |
|---|
| 440 | uint32_t saved_out_format0; |
|---|
| 441 | uint32_t saved_src_format0; |
|---|
| 442 | bool linear_destripe; |
|---|
| 443 | bool saved_linear_destripe; |
|---|
| 444 | |
|---|
| 445 | uint32_t SRC_surface_width; |
|---|
| 446 | uint32_t SRC_surface_height; |
|---|
| 447 | uint32_t SRC_surface_format; |
|---|
| 448 | uint32_t DEST_surface_width; |
|---|
| 449 | uint32_t DEST_surface_height; |
|---|
| 450 | uint32_t DEST_surface_format; |
|---|
| 451 | uint32_t OUTPUT_surface_width; |
|---|
| 452 | uint32_t OUTPUT_surface_height; |
|---|
| 453 | uint32_t OUTPUT_surface_format; |
|---|
| 454 | |
|---|
| 455 | uint32_t saved_SRC_surface_width; |
|---|
| 456 | uint32_t saved_SRC_surface_height; |
|---|
| 457 | uint32_t saved_SRC_surface_format; |
|---|
| 458 | uint32_t saved_DEST_surface_width; |
|---|
| 459 | uint32_t saved_DEST_surface_height; |
|---|
| 460 | uint32_t saved_DEST_surface_format; |
|---|
| 461 | uint32_t saved_OUTPUT_surface_width; |
|---|
| 462 | uint32_t saved_OUTPUT_surface_height; |
|---|
| 463 | uint32_t saved_OUTPUT_surface_format; |
|---|
| 464 | } |
|---|
| 465 | BGRC_P_PacketContext; |
|---|
| 466 | |
|---|
| 467 | /***************************************************************************/ |
|---|
| 468 | void BGRC_PACKET_P_PrintRegisters( BGRC_Handle hGrc ); |
|---|
| 469 | |
|---|
| 470 | void BGRC_PACKET_P_Isr( void *pvParam1, int iParam2 ); |
|---|
| 471 | void BGRC_PACKET_P_ResetState( BGRC_PacketContext_Handle hContext ); |
|---|
| 472 | void BGRC_PACKET_P_SubmitPackets( BGRC_Handle hGrc, BGRC_PacketContext_Handle hContext ); |
|---|
| 473 | BERR_Code BGRC_PACKET_P_SyncBlit( BGRC_Handle hGrc, BGRC_PacketContext_Handle hContext ); |
|---|
| 474 | |
|---|
| 475 | BM2MC_PACKET_PixelFormat BGRC_PACKET_P_ConvertPixelFormat( BPXL_Format format ); |
|---|
| 476 | void BGRC_PACKET_P_ConvertFilterCoeffs( BM2MC_PACKET_FilterCoeffs *coeffs, BGRC_FilterCoeffs filter, size_t src_size, size_t out_size ); |
|---|
| 477 | void BGRC_PACKET_P_ConvertColorMatrix( BM2MC_PACKET_ColorMatrix *matrix_out, const int32_t *matrix_in, size_t shift ); |
|---|
| 478 | |
|---|
| 479 | /***************************************************************************/ |
|---|
| 480 | #ifdef __cplusplus |
|---|
| 481 | } |
|---|
| 482 | #endif |
|---|
| 483 | |
|---|
| 484 | #endif /* #ifndef BGRC_PACKET_PRIV_H__ */ |
|---|
| 485 | |
|---|
| 486 | /* end of file */ |
|---|