| 1 | /**************************************************************************** |
|---|
| 2 | * Copyright (c) 2004 DST Technologies Inc. All Rights Reserved. |
|---|
| 3 | * |
|---|
| 4 | * Module: dsthhalgfx.h |
|---|
| 5 | * |
|---|
| 6 | ***************************************************************************/ |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | #if !defined (_DSTHAL_GFX_H_) |
|---|
| 10 | #define _DSTHAL_GFX_H_ |
|---|
| 11 | |
|---|
| 12 | #define DHL_GFX_FMT8 8 |
|---|
| 13 | #define DHL_GFX_FMT16 16 |
|---|
| 14 | #define DHL_GFX_FMT32 32 |
|---|
| 15 | |
|---|
| 16 | #define PLANE_OSD 0 |
|---|
| 17 | #define PLANE_CC 1 |
|---|
| 18 | #define PLANE_PIP 2 |
|---|
| 19 | #define MAX_PLANE 3 |
|---|
| 20 | |
|---|
| 21 | #define DHL_GFX_FORMAT (DHL_GFX_FMT32) |
|---|
| 22 | |
|---|
| 23 | #if (DHL_GFX_FMT8 == DHL_GFX_FORMAT) |
|---|
| 24 | #define DS_PIXEL_t DS_U8 |
|---|
| 25 | #elif (DHL_GFX_FMT16 == DHL_GFX_FORMAT) |
|---|
| 26 | #define DS_PIXEL_t DS_U16 |
|---|
| 27 | #elif (DHL_GFX_FMT32 == DHL_GFX_FORMAT) |
|---|
| 28 | #define DS_PIXEL_t DS_U32 |
|---|
| 29 | #else |
|---|
| 30 | # error DHL_GFX_FORMAT shall be defined! |
|---|
| 31 | #endif |
|---|
| 32 | |
|---|
| 33 | #define DHL_GFX_GetPixelFormat() DHL_GFX_FORMAT |
|---|
| 34 | |
|---|
| 35 | #if 1 |
|---|
| 36 | typedef enum tag_ColorNum_t { |
|---|
| 37 | COLOR_BLACK=1, |
|---|
| 38 | COLOR_RED, |
|---|
| 39 | COLOR_GREEN, |
|---|
| 40 | COLOR_YELLOW, |
|---|
| 41 | COLOR_BLUE, |
|---|
| 42 | COLOR_MAGENTA, |
|---|
| 43 | COLOR_CYAN, |
|---|
| 44 | COLOR_WHITE, |
|---|
| 45 | COLOR_T_BLACK, |
|---|
| 46 | COLOR_T_RED, |
|---|
| 47 | COLOR_T_GREEN, |
|---|
| 48 | COLOR_T_YELLOW, |
|---|
| 49 | COLOR_T_BLUE, |
|---|
| 50 | COLOR_T_MAGENTA, |
|---|
| 51 | COLOR_T_CYAN, |
|---|
| 52 | COLOR_T_WHITE, |
|---|
| 53 | COLOR_MASK=COLOR_BLACK |
|---|
| 54 | } ColorNum_t; |
|---|
| 55 | #else |
|---|
| 56 | #define COLOR_BLACK RGB555( 0, 0, 1) |
|---|
| 57 | #define COLOR_RED RGB555( 31, 0, 0) |
|---|
| 58 | #define COLOR_GREEN RGB555( 0, 31, 0) |
|---|
| 59 | #define COLOR_YELLOW RGB555( 31, 31, 0) |
|---|
| 60 | #define COLOR_BLUE RGB555( 0, 0, 31) |
|---|
| 61 | #define COLOR_MAGENTA RGB555( 31, 0, 31) |
|---|
| 62 | #define COLOR_CYAN RGB555( 0, 31, 31) |
|---|
| 63 | #define COLOR_WHITE RGB555( 31, 31, 31) |
|---|
| 64 | |
|---|
| 65 | #define COLOR_T_BLACK ARGB555( 0, 0, 1) |
|---|
| 66 | #define COLOR_T_RED ARGB555( 31, 0, 0) |
|---|
| 67 | #define COLOR_T_GREEN ARGB555( 0, 31, 0) |
|---|
| 68 | #define COLOR_T_YELLOW ARGB555( 31, 31, 0) |
|---|
| 69 | #define COLOR_T_BLUE ARGB555( 0, 0, 31) |
|---|
| 70 | #define COLOR_T_MAGENTA ARGB555( 31, 0, 31) |
|---|
| 71 | #define COLOR_T_CYAN ARGB555( 0, 31, 31) |
|---|
| 72 | #define COLOR_T_WHITE ARGB555( 31, 31, 31) |
|---|
| 73 | |
|---|
| 74 | #define COLOR_MASK ARGB555( 0, 0, 0) |
|---|
| 75 | #endif |
|---|
| 76 | |
|---|
| 77 | typedef enum { |
|---|
| 78 | /* |
|---|
| 79 | * Graphics formats suppported by the DPC and BLT |
|---|
| 80 | */ |
|---|
| 81 | PF_RGB32 = 0, // aRGB32(8,8,8,8) |
|---|
| 82 | PF_INDEX8 = 7, // ³»ºÎÀûÀ¸·Î´Â RGB32·Î ÀúÀå |
|---|
| 83 | PF_CC_TEMP_INDEX8, // ½ºÅ©·ÑÀ» À§ÇÑ CC Àӽà Pixel Buffer |
|---|
| 84 | PF_RECT_BOX, // ƯÁ¤»öÀÇ »ç°¢Çü ¹Ú½º¸¦ ±×¸®±â À§ÇÑ Æ÷¸ä, ±×·¡ÇÈ ¸Þ¸ð¸®´Â »ý¼º½ÃŰÁö ¾Ê´Â´Ù. |
|---|
| 85 | PF_RGB16 , // aRGB16 (1,5,5,5) : for BGT GUI plane (0) |
|---|
| 86 | PF_CC_RGB16 // aRGB16 (1,5,5,5) : for BGT CC plane (1) |
|---|
| 87 | |
|---|
| 88 | } PIXEL_FORMATS_t; |
|---|
| 89 | |
|---|
| 90 | #define PLANE_OSD 0 |
|---|
| 91 | #define PLANE_CC 1 |
|---|
| 92 | #define PLANE_PIP 2 |
|---|
| 93 | #define MAX_PLANE 3 |
|---|
| 94 | |
|---|
| 95 | typedef struct tag_RECT_t { |
|---|
| 96 | int x; |
|---|
| 97 | int y; |
|---|
| 98 | int w; /* Should not be negative but signed for calculation */ |
|---|
| 99 | int h; /* Should not be negative but signed for calculation */ |
|---|
| 100 | } RECT_t; |
|---|
| 101 | |
|---|
| 102 | #ifndef SETRECT |
|---|
| 103 | #define SETRECT(rect, xx, yy, ww, hh) { \ |
|---|
| 104 | (rect)->x = (xx); \ |
|---|
| 105 | (rect)->y = (yy); \ |
|---|
| 106 | (rect)->w = (ww); \ |
|---|
| 107 | (rect)->h = (hh); \ |
|---|
| 108 | } |
|---|
| 109 | #endif |
|---|
| 110 | |
|---|
| 111 | typedef struct tag_PIXMAP_t { |
|---|
| 112 | RECT_t InRect; |
|---|
| 113 | RECT_t OutRect; |
|---|
| 114 | |
|---|
| 115 | RECT_t rectVisible; /* ȸ鿡 º¸¿©Áú ¿µ¿ª (ÀϹÝÀûÀ¸·Î x,y,w,h¿Í °°´Ù)*/ |
|---|
| 116 | RECT_t rectTarget; /* ȸ鿡 ÂïÇôÁú Blit ¿µ¿ª (ÀϹÝÀûÀ¸·Î x,y,w,h¿Í °°´Ù) */ |
|---|
| 117 | |
|---|
| 118 | DS_U8 visible; /* Visible Flag 1: visible, 0: not visible */ |
|---|
| 119 | DS_U8 plane; /* Add by PKH 2004.06.12 */ |
|---|
| 120 | DS_U8 fmt; /* pixel format: RGB32, INDEX8 */ |
|---|
| 121 | DS_U8 psize; /* number of bits per pixel */ |
|---|
| 122 | DS_U8 blending; /* Blending Type 1:blending On, 0:blending Off (Copy)*/ |
|---|
| 123 | |
|---|
| 124 | DS_PIXEL_t *baseAddr; /* Starting address of pixel buffer */ |
|---|
| 125 | DS_U8 *FBAddr; /* Starting address of pixel buffer */ |
|---|
| 126 | DS_U16 *clut; /* optional color lookup table for indexed formats */ |
|---|
| 127 | DS_U8 *baseIO; |
|---|
| 128 | |
|---|
| 129 | } PIXMAP_t; |
|---|
| 130 | |
|---|
| 131 | typedef struct tag_OSDMAP_t { |
|---|
| 132 | RECT_t MenuInRect; |
|---|
| 133 | RECT_t MenuOutRect; |
|---|
| 134 | RECT_t CCInRect; |
|---|
| 135 | RECT_t CCOutRect; |
|---|
| 136 | RECT_t PIPInRect; |
|---|
| 137 | RECT_t PIPOutRect; |
|---|
| 138 | |
|---|
| 139 | DS_U8 bInterlaced; |
|---|
| 140 | |
|---|
| 141 | DS_U16 *baseAddr; /* Starting address of pixel buffer */ |
|---|
| 142 | DS_U8 *FBAddr; /* Starting address of pixel buffer */ |
|---|
| 143 | DS_U16 *clut; /* optional color lookup table for indexed formats */ |
|---|
| 144 | DS_U8 *baseIO; |
|---|
| 145 | |
|---|
| 146 | int bInit; |
|---|
| 147 | } OSDMAP_t, *P_OSDMAP_t; |
|---|
| 148 | |
|---|
| 149 | #if defined __cplusplus |
|---|
| 150 | extern "C" { |
|---|
| 151 | #endif |
|---|
| 152 | |
|---|
| 153 | |
|---|
| 154 | |
|---|
| 155 | // |
|---|
| 156 | // Basic APIs |
|---|
| 157 | // |
|---|
| 158 | DHL_RESULT DHL_GFX_Init(int Plane, DS_U16 osd_x, DS_U16 osd_y, DS_U16 osd_w, DS_U16 osd_h, |
|---|
| 159 | DS_U16 osd_wo, DS_U16 osd_ho, int Fmt, DS_U32 *pBufferId ); |
|---|
| 160 | DHL_RESULT DHL_GFX_Close(void); |
|---|
| 161 | DS_BOOL DHL_GFX_IsInit(int Plane); |
|---|
| 162 | DS_U8 *DHL_GFX_GetVRAM(int Plane); |
|---|
| 163 | int DHL_GFX_EnablePlane(int Plane, int OnOff); |
|---|
| 164 | DS_BOOL DHL_GFX_IsEnabled(int Plane); |
|---|
| 165 | |
|---|
| 166 | DHL_RESULT DHL_GFX_PresetOSDParam(DHL_VIDEO_FORMAT iVidOutFmt, int Plane, DS_U16 HStart, DS_U16 VStart, DS_U16 InHWidth, DS_U16 InVLength, DS_U16 OutHWidth,DS_U16 OutVLength,DS_U8 bInterlaced); |
|---|
| 167 | DHL_RESULT DHL_GFX_ChangeOSDParam(int Plane, DS_U16 HStart, DS_U16 VStart, DS_U16 InHWidth, DS_U16 InVLength, DS_U16 OutHWidth,DS_U16 OutVLength,DS_U8 bInterlaced); |
|---|
| 168 | DHL_RESULT DHL_GFX_ApplyOSDVidOutFmt(DHL_VIDEO_FORMAT iVidOutFmt); |
|---|
| 169 | |
|---|
| 170 | DHL_RESULT DHL_GFX_AllocFrameBuffer( DS_U32 *pBufferId, DS_U16 width, DS_U16 height, int fmt ); |
|---|
| 171 | DHL_RESULT DHL_GFX_FreeFrameBuffer( DS_U32 pBufferId ); |
|---|
| 172 | |
|---|
| 173 | DS_U8 *DHL_GFX_GetFBRAM(int Plane); |
|---|
| 174 | DS_U8 *DHL_GFX_GetIOAddr(int Plane); |
|---|
| 175 | DS_U8 *DHL_GFX_GetTempVAddr(void); |
|---|
| 176 | DS_U8 *DHL_GFX_GetTempFBAddr(void); |
|---|
| 177 | |
|---|
| 178 | DS_U32 DHL_GFX_GetPhysicalFrameBuffer(void); |
|---|
| 179 | DS_U32 DHL_GFX_GetBaseAddr(DS_U32 bufferId); |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | // |
|---|
| 183 | // Blend / Palette |
|---|
| 184 | // |
|---|
| 185 | void DHL_GFX_SetBlendPixMap(int Plane, char foreground, char background); |
|---|
| 186 | int DHL_GFX_SetPallete(int Plane, int StartIdx, int Length, DS_PIXEL_t *pal); |
|---|
| 187 | |
|---|
| 188 | // |
|---|
| 189 | // Utility APIs |
|---|
| 190 | // |
|---|
| 191 | void BlockFill(int Plane, DS_U16 src, int x, int y, int w, int h); |
|---|
| 192 | void BlockCopyEx(int Plane, const DS_U8 *src, int x, int y, int w, int h); |
|---|
| 193 | void DHL_GFX_DrawBox( DS_U32 pBufferId, int x, int y, int w, int h, DS_PIXEL_t color ); |
|---|
| 194 | void DHL_GFX_DrawPixels( DS_U32 pBufferId, int offsetX, int offsetY, int w, DS_PIXEL_t *pPixels ); |
|---|
| 195 | void DHL_GFX_ReadPixels( DS_U32 pBufferId, int offsetX, int offsetY, int w, int h, DS_PIXEL_t *pPixels ); |
|---|
| 196 | void DHL_GFX_DrawImage( DS_U32 pBufferId, int x, int y, int w, int h, DS_PIXEL_t *pPixels); |
|---|
| 197 | void DHL_GFX_CopyBlock(DS_U32 p_src_buffer_id, DS_U32 p_dst_buffer_id, |
|---|
| 198 | int src_x, int src_y, int src_w, int src_h, |
|---|
| 199 | int dst_x, int dst_y, int dst_w, int dst_h); |
|---|
| 200 | DS_U32 DHL_GFX_GetPhysicalFrameBuffer(void); |
|---|
| 201 | DS_U32 DHL_GFX_GetBaseAddr(DS_U32 bufferId); |
|---|
| 202 | |
|---|
| 203 | void DHL_GFX_PutString(DS_U32 bufferId, int x, int y, const char *str); |
|---|
| 204 | void DHL_GFX_UpdateScreen(int Plane); |
|---|
| 205 | |
|---|
| 206 | |
|---|
| 207 | void DHL_GFX_CopyBlock(DS_U32 p_src_buffer_id, DS_U32 p_dst_buffer_id, |
|---|
| 208 | int src_x, int src_y, int src_w, int src_h, |
|---|
| 209 | int dst_x, int dst_y, int dst_w, int dst_h); |
|---|
| 210 | #if defined __cplusplus |
|---|
| 211 | } |
|---|
| 212 | #endif |
|---|
| 213 | |
|---|
| 214 | #endif /* _DSTHAL_GFX_H_ */ |
|---|
| 215 | |
|---|
| 216 | |
|---|