| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2010, 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: bsur_private.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/16 $ |
|---|
| 12 | * $brcm_Date: 2/5/10 3:30p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/commonutils/sur/7038/bsur_private.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/16 2/5/10 3:30p erickson |
|---|
| 21 | * SW3548-2765: added BDBG_OBJECT_ASSERT protection for surface and |
|---|
| 22 | * palette handles |
|---|
| 23 | * |
|---|
| 24 | * Hydra_Software_Devel/15 10/3/08 10:45a yuxiaz |
|---|
| 25 | * PR47303: More TestFeature1 support in BSUR. |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/14 10/1/08 5:53p nissen |
|---|
| 28 | * PR 47303: Added functions to get default surface settings and |
|---|
| 29 | * TestFeature1 settings. Added settings structure parameter to surface |
|---|
| 30 | * create function. |
|---|
| 31 | * |
|---|
| 32 | * Hydra_Software_Devel/13 4/4/08 11:26a nissen |
|---|
| 33 | * PR 40122: Added support for 10-bit 422 40-bit packed formats. |
|---|
| 34 | * |
|---|
| 35 | * Hydra_Software_Devel/12 11/8/06 10:55a nissen |
|---|
| 36 | * PR 25683: Added support for a surface ID. |
|---|
| 37 | * |
|---|
| 38 | * Hydra_Software_Devel/11 8/25/06 11:04a nissen |
|---|
| 39 | * PR 18990: Added support for 10-bit YCbCr 422 alignment. |
|---|
| 40 | * |
|---|
| 41 | * Hydra_Software_Devel/10 3/15/06 11:49a nissen |
|---|
| 42 | * PR 15840: Added support for creating YCbCr 420 surfaces. |
|---|
| 43 | * |
|---|
| 44 | * Hydra_Software_Devel/9 11/10/05 5:03p syang |
|---|
| 45 | * PR 12244: move alpha-only pixel constant color setting from BSUR to |
|---|
| 46 | * BVDC |
|---|
| 47 | * |
|---|
| 48 | * Hydra_Software_Devel/8 2/2/05 10:08a nissen |
|---|
| 49 | * PR 13979: Added user allocated palette memory alignment check. |
|---|
| 50 | * |
|---|
| 51 | * Hydra_Software_Devel/7 8/11/04 6:28p syang |
|---|
| 52 | * PR 12244: added alpha only pixel format support for gfx feeder (new B0 |
|---|
| 53 | * feature) |
|---|
| 54 | * |
|---|
| 55 | * Hydra_Software_Devel/6 11/20/03 6:55p nissen |
|---|
| 56 | * Changed palette pointer to handle. |
|---|
| 57 | * |
|---|
| 58 | * Hydra_Software_Devel/5 8/20/03 4:39p nissen |
|---|
| 59 | * Removed, added, and modified structures and macros. |
|---|
| 60 | * |
|---|
| 61 | * Hydra_Software_Devel/4 8/6/03 2:24p nissen |
|---|
| 62 | * Changed all references to "unsigned int" to "uint32_t". |
|---|
| 63 | * |
|---|
| 64 | * Hydra_Software_Devel/3 6/5/03 11:42a nissen |
|---|
| 65 | * Fixed macro to get alignment mask. |
|---|
| 66 | * |
|---|
| 67 | * Hydra_Software_Devel/2 4/25/03 3:52p nissen |
|---|
| 68 | * Added align mask macro. |
|---|
| 69 | * |
|---|
| 70 | * Hydra_Software_Devel/1 4/25/03 12:14p nissen |
|---|
| 71 | * Surface module |
|---|
| 72 | * |
|---|
| 73 | ***************************************************************************/ |
|---|
| 74 | |
|---|
| 75 | #ifndef BSUR_PRIVATE_H__ |
|---|
| 76 | #define BSUR_PRIVATE_H__ |
|---|
| 77 | |
|---|
| 78 | #ifdef __cplusplus |
|---|
| 79 | extern "C" { |
|---|
| 80 | #endif |
|---|
| 81 | |
|---|
| 82 | BDBG_OBJECT_ID_DECLARE(BSUR_Palette); |
|---|
| 83 | BDBG_OBJECT_ID_DECLARE(BSUR_Surface); |
|---|
| 84 | |
|---|
| 85 | /*************************************************************************** |
|---|
| 86 | Description: |
|---|
| 87 | This is the private palette structure. |
|---|
| 88 | ****************************************************************************/ |
|---|
| 89 | typedef struct BSUR_P_Palette_Handle |
|---|
| 90 | { |
|---|
| 91 | BDBG_OBJECT(BSUR_Palette) |
|---|
| 92 | BMEM_Handle hMem; /* handle to BMEM module */ |
|---|
| 93 | void *pvAddress; /* palette address */ |
|---|
| 94 | uint32_t ulNumEntries; /* number of palette entries */ |
|---|
| 95 | uint32_t ulConstraintMask; /* constraint mask */ |
|---|
| 96 | BPXL_Format eFormat; /* format of palette */ |
|---|
| 97 | bool bDriverOwned; /* memory allocated by driver */ |
|---|
| 98 | } |
|---|
| 99 | BSUR_P_Palette_Handle; |
|---|
| 100 | |
|---|
| 101 | /*************************************************************************** |
|---|
| 102 | Description: |
|---|
| 103 | This is the private surface structure. |
|---|
| 104 | ****************************************************************************/ |
|---|
| 105 | typedef struct BSUR_P_Surface_Handle |
|---|
| 106 | { |
|---|
| 107 | BDBG_OBJECT(BSUR_Surface) |
|---|
| 108 | BSUR_Surface_Settings stSettings; /* extended settings */ |
|---|
| 109 | BMEM_Handle hMem; /* handle to BMEM module */ |
|---|
| 110 | void *pvAddress; /* surface address */ |
|---|
| 111 | uint32_t ulWidth; /* surface width */ |
|---|
| 112 | uint32_t ulHeight; /* surface height */ |
|---|
| 113 | uint32_t ulPitch; /* surface pitch */ |
|---|
| 114 | uint32_t ulConstraintMask; /* constraint mask */ |
|---|
| 115 | uint32_t ulID; /* surface ID */ |
|---|
| 116 | BPXL_Format eFormat; /* format of palette */ |
|---|
| 117 | BSUR_Palette_Handle hPalette; /* pointer to attached palette */ |
|---|
| 118 | bool bDriverOwned; /* memory allocated by driver */ |
|---|
| 119 | } |
|---|
| 120 | BSUR_P_Surface_Handle; |
|---|
| 121 | |
|---|
| 122 | /*************************************************************************** |
|---|
| 123 | Description: |
|---|
| 124 | Gets format's alignment mask. |
|---|
| 125 | |
|---|
| 126 | Input: |
|---|
| 127 | format - Pixel format. |
|---|
| 128 | ****************************************************************************/ |
|---|
| 129 | #define BSUR_P_ALIGN_MASK( format ) \ |
|---|
| 130 | ((BPXL_BITS_PER_PIXEL(format) > 8) ? \ |
|---|
| 131 | (((BPXL_BITS_PER_PIXEL(format) / 8) & 1) ? 0 : \ |
|---|
| 132 | ((BPXL_BITS_PER_PIXEL(format) / 8) - 1)) : 0) |
|---|
| 133 | |
|---|
| 134 | /*************************************************************************** |
|---|
| 135 | Description: |
|---|
| 136 | Determines if value is unaligned to size of pixel in given format. |
|---|
| 137 | |
|---|
| 138 | Input: |
|---|
| 139 | format - Pixel format. |
|---|
| 140 | value - Value to check. |
|---|
| 141 | ****************************************************************************/ |
|---|
| 142 | #define BSUR_P_PIXEL_UNALIGNED( format, value ) \ |
|---|
| 143 | (((uint32_t) (value)) & BSUR_P_ALIGN_MASK( format )) |
|---|
| 144 | |
|---|
| 145 | /*************************************************************************** |
|---|
| 146 | Description: |
|---|
| 147 | Determines if palette address is unaligned. |
|---|
| 148 | |
|---|
| 149 | Input: |
|---|
| 150 | value - Value to check. |
|---|
| 151 | ****************************************************************************/ |
|---|
| 152 | #define BSUR_P_PALETTE_ALIGNMENT 5 |
|---|
| 153 | #define BSUR_P_PALETTE_UNALIGNED( value ) \ |
|---|
| 154 | (((uint32_t) (value)) & ((1 << BSUR_P_PALETTE_ALIGNMENT) - 1)) |
|---|
| 155 | |
|---|
| 156 | /*************************************************************************** |
|---|
| 157 | Description: |
|---|
| 158 | Determines if value is a power of 2. |
|---|
| 159 | |
|---|
| 160 | Input: |
|---|
| 161 | value - Value to check. |
|---|
| 162 | valid - Returned bool (true if power of 2). |
|---|
| 163 | ****************************************************************************/ |
|---|
| 164 | #define BSUR_P_POWER_OF_2( value, valid ) \ |
|---|
| 165 | { \ |
|---|
| 166 | uint32_t ulSize = (uint32_t) (value); \ |
|---|
| 167 | uint32_t ulCount = 0; \ |
|---|
| 168 | while( ulSize > 1 ) \ |
|---|
| 169 | { \ |
|---|
| 170 | ulSize /= 2; \ |
|---|
| 171 | ulCount++; \ |
|---|
| 172 | } \ |
|---|
| 173 | while( ulCount ) \ |
|---|
| 174 | { \ |
|---|
| 175 | ulSize *= 2; \ |
|---|
| 176 | ulCount--; \ |
|---|
| 177 | } \ |
|---|
| 178 | (valid) = (ulSize == (value)) ? true : false; \ |
|---|
| 179 | } |
|---|
| 180 | |
|---|
| 181 | /*************************************************************************** |
|---|
| 182 | Description: |
|---|
| 183 | Determines if YCbCr420 format is unaligned. (eg. BPXL_eY8, BPXL_eCb8_Cr8) |
|---|
| 184 | |
|---|
| 185 | Input: |
|---|
| 186 | value - Value to check. |
|---|
| 187 | ****************************************************************************/ |
|---|
| 188 | #define BSUR_P_YCbCr420_ALIGNMENT 6 |
|---|
| 189 | #define BSUR_P_YCbCr420_UNALIGNED( value ) \ |
|---|
| 190 | (((uint32_t) (value)) & ((1 << BSUR_P_YCbCr420_ALIGNMENT) - 1)) |
|---|
| 191 | |
|---|
| 192 | /*************************************************************************** |
|---|
| 193 | Description: |
|---|
| 194 | Determines if YCbCr422 10-bit format is unaligned. |
|---|
| 195 | (eg. BPXL_eX2_Y010_Cb10_Y110_X2_Cr10_Y010_Cb10_X2_Y110_Cr10_Y010_X2_Cb10_Y110_Cr10) |
|---|
| 196 | |
|---|
| 197 | Input: |
|---|
| 198 | value - Value to check. |
|---|
| 199 | ****************************************************************************/ |
|---|
| 200 | #define BSUR_P_YCbCr422_10BIT_ALIGNMENT 4 |
|---|
| 201 | #define BSUR_P_YCbCr422_10BIT_UNALIGNED( value ) \ |
|---|
| 202 | (((uint32_t) (value)) & ((1 << BSUR_P_YCbCr422_10BIT_ALIGNMENT) - 1)) |
|---|
| 203 | |
|---|
| 204 | /*************************************************************************** |
|---|
| 205 | Description: |
|---|
| 206 | Determines if YCbCr422 10-bit packed format is unaligned. |
|---|
| 207 | (eg. BPXL_eCr10_Y110_Cb10_Y010) |
|---|
| 208 | |
|---|
| 209 | Input: |
|---|
| 210 | value - Value to check. |
|---|
| 211 | ****************************************************************************/ |
|---|
| 212 | #define BSUR_P_YCbCr422_10BIT_PACKED_ALIGNMENT 5 |
|---|
| 213 | #define BSUR_P_YCbCr422_10BIT_PACKED_UNALIGNED( value ) \ |
|---|
| 214 | (((uint32_t) (value)) & ((1 << BSUR_P_YCbCr422_10BIT_PACKED_ALIGNMENT) - 1)) |
|---|
| 215 | |
|---|
| 216 | /*************************************************************************** |
|---|
| 217 | Description: |
|---|
| 218 | Determines if DCX TestFeature1 format is unaligned. |
|---|
| 219 | |
|---|
| 220 | Input: |
|---|
| 221 | value - Value to check. |
|---|
| 222 | ****************************************************************************/ |
|---|
| 223 | #define BSUR_P_DCX_TESTFEATURE1_ALIGNMENT 6 |
|---|
| 224 | #define BSUR_P_DCX_TESTFEATURE1_UNALIGNED( value ) \ |
|---|
| 225 | (((uint32_t) (value)) & ((1 << BSUR_P_DCX_TESTFEATURE1_ALIGNMENT) - 1)) |
|---|
| 226 | |
|---|
| 227 | #define BSUR_P_DCX_TESTFEATURE1_BITSPERPIXEL_MINIMUM 14 |
|---|
| 228 | #define BSUR_P_DCX_TESTFEATURE1_BITSPERPIXEL_MAXIMUM 64 |
|---|
| 229 | #define BSUR_P_DCX_TESTFEATURE1_BITSPERPIXEL_DEFAULT BSUR_P_DCX_TESTFEATURE1_BITSPERPIXEL_MINIMUM |
|---|
| 230 | |
|---|
| 231 | #ifdef __cplusplus |
|---|
| 232 | } |
|---|
| 233 | #endif |
|---|
| 234 | |
|---|
| 235 | #endif /* #ifndef BSUR_PRIVATE_H__ */ |
|---|
| 236 | |
|---|
| 237 | /* end of file */ |
|---|