Changeset 30885b9 in mainline
- Timestamp:
- 2009-07-31T19:11:54Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a405563
- Parents:
- 646b996
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mach/integratorcp/integratorcp.c
r646b996 r30885b9 137 137 .y = 480, 138 138 .scan = 2560, 139 .visual = VISUAL_ RGB_8_8_8_0,139 .visual = VISUAL_BGR_0_8_8_8, 140 140 }; 141 141 prop.addr = icp_get_fb_address(); -
kernel/arch/arm32/src/mach/testarm/testarm.c
r646b996 r30885b9 86 86 .y = 480, 87 87 .scan = 1920, 88 .visual = VISUAL_ BGR_8_8_8,88 .visual = VISUAL_RGB_8_8_8, 89 89 }; 90 90 fb_init(&prop); -
kernel/arch/ia32/src/drivers/vesa.c
r646b996 r30885b9 86 86 && (vesa_green_mask == 5) && (vesa_green_pos == 5) 87 87 && (vesa_blue_mask == 5) && (vesa_blue_pos == 0)) 88 visual = VISUAL_ RGB_5_5_5;88 visual = VISUAL_BGR_5_5_5; 89 89 else 90 visual = VISUAL_ RGB_5_6_5;90 visual = VISUAL_BGR_5_6_5; 91 91 break; 92 92 case 24: 93 visual = VISUAL_ RGB_8_8_8;93 visual = VISUAL_BGR_8_8_8; 94 94 break; 95 95 case 32: 96 visual = VISUAL_ RGB_0_8_8_8;96 visual = VISUAL_BGR_8_8_8_0; 97 97 break; 98 98 default: -
kernel/arch/mips32/src/mips32.c
r646b996 r30885b9 142 142 .y = 480, 143 143 .scan = 1920, 144 .visual = VISUAL_ BGR_8_8_8,144 .visual = VISUAL_RGB_8_8_8, 145 145 }; 146 146 fb_init(&gxemul_prop); -
kernel/arch/ppc32/src/ppc32.c
r646b996 r30885b9 93 93 break; 94 94 case 16: 95 visual = VISUAL_ RGB_5_5_5;95 visual = VISUAL_BGR_5_5_5; 96 96 break; 97 97 case 24: 98 visual = VISUAL_ RGB_8_8_8;98 visual = VISUAL_BGR_8_8_8; 99 99 break; 100 100 case 32: -
kernel/arch/sparc64/src/drivers/scr.c
r646b996 r30885b9 134 134 case 16: 135 135 fb_scanline = fb_linebytes * (fb_depth >> 3); 136 visual = VISUAL_ RGB_5_6_5;136 visual = VISUAL_BGR_5_6_5; 137 137 break; 138 138 case 24: 139 139 fb_scanline = fb_linebytes * 4; 140 visual = VISUAL_ RGB_8_8_8_0;140 visual = VISUAL_BGR_8_8_8_0; 141 141 break; 142 142 case 32: … … 178 178 case 16: 179 179 fb_scanline = fb_linebytes * (fb_depth >> 3); 180 visual = VISUAL_ RGB_5_6_5;180 visual = VISUAL_BGR_5_6_5; 181 181 break; 182 182 case 24: 183 183 fb_scanline = fb_linebytes * 4; 184 visual = VISUAL_ RGB_8_8_8_0;184 visual = VISUAL_BGR_8_8_8_0; 185 185 break; 186 186 case 32: -
kernel/genarch/include/fb/visuals.h
r646b996 r30885b9 36 36 #define KERN_VISUALS_H_ 37 37 38 #define VISUAL_INDIRECT_8 0 39 40 #define VISUAL_RGB_5_5_5 1 41 #define VISUAL_RGB_5_6_5 2 42 #define VISUAL_RGB_8_8_8 3 43 #define VISUAL_RGB_8_8_8_0 4 44 #define VISUAL_RGB_0_8_8_8 5 45 46 #define VISUAL_BGR_0_8_8_8 6 47 #define VISUAL_BGR_8_8_8 7 38 typedef enum { 39 VISUAL_INDIRECT_8, 40 VISUAL_BGR_5_5_5, 41 VISUAL_BGR_5_6_5, 42 VISUAL_BGR_8_8_8, 43 VISUAL_BGR_0_8_8_8, 44 VISUAL_BGR_8_8_8_0, 45 VISUAL_RGB_8_8_8, 46 VISUAL_RGB_0_8_8_8, 47 VISUAL_RGB_8_8_8_0 48 } visual_t; 48 49 49 50 #endif -
kernel/genarch/src/fb/fb.c
r646b996 r30885b9 51 51 #include <ddi/ddi.h> 52 52 #include <arch/types.h> 53 #include <byteorder.h> 53 54 54 55 SPINLOCK_INITIALIZE(fb_lock); … … 81 82 #define INV_COLOR 0xaaaaaa 82 83 83 #define RED(x, bits) (( x >> (8 + 8 + 8 - bits)) & ((1 << bits) - 1))84 #define GREEN(x, bits) (( x >> (8 + 8 - bits)) & ((1 << bits) - 1))85 #define BLUE(x, bits) (( x >> (8 - bits)) & ((1 << bits) - 1))84 #define RED(x, bits) (((x) >> (8 + 8 + 8 - (bits))) & ((1 << (bits)) - 1)) 85 #define GREEN(x, bits) (((x) >> (8 + 8 - (bits))) & ((1 << (bits)) - 1)) 86 #define BLUE(x, bits) (((x) >> (8 - (bits))) & ((1 << (bits)) - 1)) 86 87 87 88 #define COL2X(col) ((col) * FONT_WIDTH) … … 98 99 static void (*rgb_conv)(void *, uint32_t); 99 100 100 101 /** ARGB 8:8:8:8 conversion 102 * 103 */ 101 /* 102 * RGB conversion functions. 103 * 104 * These functions write an RGB value to some memory in some predefined format. 105 * The naming convention corresponds to the format created by these functions. 106 * The functions use the so called network order (i.e. big endian) with respect 107 * to their names. 108 */ 109 104 110 static void rgb_0888(void *dst, uint32_t rgb) 105 111 { 106 *((uint32_t *) dst) = rgb & 0xffffff; 107 } 108 109 110 /** ABGR 8:8:8:8 conversion 111 * 112 */ 112 *((uint32_t *) dst) = host2uint32_t_be((0 << 24) | 113 (RED(rgb, 8) << 16) | (GREEN(rgb, 8) << 8) | (BLUE(rgb, 8))); 114 } 115 113 116 static void bgr_0888(void *dst, uint32_t rgb) 114 117 { 115 *((uint32_t *) dst) 116 = (BLUE(rgb, 8) << 16) | (GREEN(rgb, 8) << 8) | RED(rgb, 8);118 *((uint32_t *) dst) = host2uint32_t_be((0 << 24) | 119 (BLUE(rgb, 8) << 16) | (GREEN(rgb, 8) << 8) | (RED(rgb, 8))); 117 120 } 118 121 119 122 static void rgb_8880(void *dst, uint32_t rgb) 120 123 { 121 *((uint32_t *) dst) 122 = (RED(rgb, 8) << 24) | (GREEN(rgb, 8) << 16) | (BLUE(rgb, 8) << 8); 123 124 } 125 126 127 /** RGB 8:8:8 conversion 128 * 129 */ 124 *((uint32_t *) dst) = host2uint32_t_be((RED(rgb, 8) << 24) | 125 (GREEN(rgb, 8) << 16) | (BLUE(rgb, 8) << 8) | 0); 126 } 127 128 static void bgr_8880(void *dst, uint32_t rgb) 129 { 130 *((uint32_t *) dst) = host2uint32_t_be((BLUE(rgb, 8) << 24) | 131 (GREEN(rgb, 8) << 16) | (RED(rgb, 8) << 8) | 0); 132 } 133 130 134 static void rgb_888(void *dst, uint32_t rgb) 135 { 136 ((uint8_t *) dst)[0] = RED(rgb, 8); 137 ((uint8_t *) dst)[1] = GREEN(rgb, 8); 138 ((uint8_t *) dst)[2] = BLUE(rgb, 8); 139 } 140 141 static void bgr_888(void *dst, uint32_t rgb) 131 142 { 132 143 ((uint8_t *) dst)[0] = BLUE(rgb, 8); … … 135 146 } 136 147 137 138 /** BGR 8:8:8 conversion 139 * 140 */ 141 static void bgr_888(void *dst, uint32_t rgb) 142 { 143 ((uint8_t *) dst)[0] = RED(rgb, 8); 144 ((uint8_t *) dst)[1] = GREEN(rgb, 8); 145 ((uint8_t *) dst)[2] = BLUE(rgb, 8); 146 } 147 148 149 /** RGB 5:5:5 conversion 150 * 151 */ 152 static void rgb_555(void *dst, uint32_t rgb) 153 { 154 *((uint16_t *) dst) 155 = (RED(rgb, 5) << 10) | (GREEN(rgb, 5) << 5) | BLUE(rgb, 5); 156 } 157 158 159 /** RGB 5:6:5 conversion 160 * 161 */ 162 static void rgb_565(void *dst, uint32_t rgb) 163 { 164 *((uint16_t *) dst) 165 = (RED(rgb, 5) << 11) | (GREEN(rgb, 6) << 5) | BLUE(rgb, 5); 166 } 167 168 169 /** RGB 3:2:3 148 static void bgr_555(void *dst, uint32_t rgb) 149 { 150 uint8_t hi = (BLUE(rgb, 5) | (GREEN(rgb, 5) << 5)) & 0xff; 151 uint8_t lo = (GREEN(rgb, 5) >> 3) | (RED(rgb, 5) << 2); 152 *((uint16_t *) dst) = host2uint16_t_be((hi << 8) | lo); 153 } 154 155 static void bgr_565(void *dst, uint32_t rgb) 156 { 157 uint8_t hi = (BLUE(rgb, 5) | (GREEN(rgb, 6) << 5)) & 0xff; 158 uint8_t lo = (GREEN(rgb, 6) >> 3) | (RED(rgb, 5) << 3); 159 *((uint16_t *) dst) = host2uint16_t_be((hi << 8) | lo); 160 } 161 162 163 /** BGR 3:2:3 170 164 * 171 165 * Even though we try 3:2:3 color scheme here, an 8-bit framebuffer … … 184 178 * 185 179 */ 186 static void rgb_323(void *dst, uint32_t rgb)180 static void bgr_323(void *dst, uint32_t rgb) 187 181 { 188 182 *((uint8_t *) dst) … … 458 452 switch (props->visual) { 459 453 case VISUAL_INDIRECT_8: 460 rgb_conv = rgb_323;454 rgb_conv = bgr_323; 461 455 pixelbytes = 1; 462 456 break; 463 case VISUAL_ RGB_5_5_5:464 rgb_conv = rgb_555;457 case VISUAL_BGR_5_5_5: 458 rgb_conv = bgr_555; 465 459 pixelbytes = 2; 466 460 break; 467 case VISUAL_ RGB_5_6_5:468 rgb_conv = rgb_565;461 case VISUAL_BGR_5_6_5: 462 rgb_conv = bgr_565; 469 463 pixelbytes = 2; 470 464 break; … … 487 481 case VISUAL_BGR_0_8_8_8: 488 482 rgb_conv = bgr_0888; 483 pixelbytes = 4; 484 break; 485 case VISUAL_BGR_8_8_8_0: 486 rgb_conv = bgr_8880; 489 487 pixelbytes = 4; 490 488 break; -
uspace/srv/fb/fb.c
r646b996 r30885b9 58 58 #include <bool.h> 59 59 #include <stdio.h> 60 #include <byteorder.h> 60 61 61 62 #include "font-8x16.h" … … 213 214 214 215 215 #define RED(x, bits) (( x >> (8 + 8 + 8 - bits)) & ((1 << bits) - 1))216 #define GREEN(x, bits) (( x >> (8 + 8 - bits)) & ((1 << bits) - 1))217 #define BLUE(x, bits) (( x >> (8 - bits)) & ((1 << bits) - 1))216 #define RED(x, bits) (((x) >> (8 + 8 + 8 - (bits))) & ((1 << (bits)) - 1)) 217 #define GREEN(x, bits) (((x) >> (8 + 8 - (bits))) & ((1 << (bits)) - 1)) 218 #define BLUE(x, bits) (((x) >> (8 - (bits))) & ((1 << (bits)) - 1)) 218 219 219 220 #define COL2X(col) ((col) * FONT_WIDTH) … … 227 228 #define GLYPH_POS(glyph, y, cursor) (((glyph) + (cursor) * FONT_GLYPHS) * screen.glyphbytes + (y) * screen.glyphscanline) 228 229 229 230 /** ARGB 8:8:8:8 conversion 231 * 232 */ 230 /* 231 * RGB conversion and mask functions. 232 * 233 * These functions write an RGB value to some memory in some predefined format. 234 * The naming convention corresponds to the format created by these functions. 235 * The functions use the so called network order (i.e. big endian) with respect 236 * to their names. 237 */ 238 233 239 static void rgb_0888(void *dst, uint32_t rgb) 234 240 { 235 *((uint32_t *) dst) = rgb & 0x00ffffff; 241 *((uint32_t *) dst) = host2uint32_t_be((0 << 24) | 242 (RED(rgb, 8) << 16) | (GREEN(rgb, 8) << 8) | (BLUE(rgb, 8))); 243 } 244 245 static void bgr_0888(void *dst, uint32_t rgb) 246 { 247 *((uint32_t *) dst) = host2uint32_t_be((0 << 24) | 248 (BLUE(rgb, 8) << 16) | (GREEN(rgb, 8) << 8) | (RED(rgb, 8))); 236 249 } 237 250 238 251 static void mask_0888(void *dst, bool mask) 239 252 { 240 *((uint32_t *) dst) = (mask ? 0x00ffffff : 0); 241 } 242 243 244 /** ABGR 8:8:8:8 conversion 245 * 246 */ 247 static void bgr_0888(void *dst, uint32_t rgb) 248 { 249 *((uint32_t *) dst) 250 = (BLUE(rgb, 8) << 16) | (GREEN(rgb, 8) << 8) | RED(rgb, 8); 253 bgr_0888(dst, mask ? 0xffffff : 0); 251 254 } 252 255 253 256 static void rgb_8880(void *dst, uint32_t rgb) 254 257 { 255 *((uint32_t *) dst) 256 = (RED(rgb, 8) << 24) | (GREEN(rgb, 8) << 16) | BLUE(rgb, 8) << 8; 258 *((uint32_t *) dst) = host2uint32_t_be((RED(rgb, 8) << 24) | 259 (GREEN(rgb, 8) << 16) | (BLUE(rgb, 8) << 8) | 0); 260 } 261 262 static void bgr_8880(void *dst, uint32_t rgb) 263 { 264 *((uint32_t *) dst) = host2uint32_t_be((BLUE(rgb, 8) << 24) | 265 (GREEN(rgb, 8) << 16) | (RED(rgb, 8) << 8) | 0); 257 266 } 258 267 259 268 static void mask_8880(void *dst, bool mask) 260 269 { 261 *((uint32_t *) dst) = (mask ? 0xffffff00 : 0); 262 } 263 264 /** RGB 8:8:8 conversion 265 * 266 */ 270 bgr_8880(dst, mask ? 0xffffff : 0); 271 } 272 267 273 static void rgb_888(void *dst, uint32_t rgb) 274 { 275 ((uint8_t *) dst)[0] = RED(rgb, 8); 276 ((uint8_t *) dst)[1] = GREEN(rgb, 8); 277 ((uint8_t *) dst)[2] = BLUE(rgb, 8); 278 } 279 280 static void bgr_888(void *dst, uint32_t rgb) 268 281 { 269 282 ((uint8_t *) dst)[0] = BLUE(rgb, 8); … … 274 287 static void mask_888(void *dst, bool mask) 275 288 { 276 if (mask) { 277 ((uint8_t *) dst)[0] = 0xff; 278 ((uint8_t *) dst)[1] = 0xff; 279 ((uint8_t *) dst)[2] = 0xff; 280 } else { 281 ((uint8_t *) dst)[0] = 0; 282 ((uint8_t *) dst)[1] = 0; 283 ((uint8_t *) dst)[2] = 0; 284 } 285 } 286 287 288 /** BGR 8:8:8 conversion 289 * 290 */ 291 static void bgr_888(void *dst, uint32_t rgb) 292 { 293 ((uint8_t *) dst)[0] = RED(rgb, 8); 294 ((uint8_t *) dst)[1] = GREEN(rgb, 8); 295 ((uint8_t *) dst)[2] = BLUE(rgb, 8); 296 } 297 298 299 /** RGB 5:5:5 conversion 300 * 301 */ 302 static void rgb_555(void *dst, uint32_t rgb) 303 { 304 *((uint16_t *) dst) 305 = (RED(rgb, 5) << 10) | (GREEN(rgb, 5) << 5) | BLUE(rgb, 5); 289 bgr_888(dst, mask ? 0xffffff : 0); 290 } 291 292 static void bgr_555(void *dst, uint32_t rgb) 293 { 294 uint8_t hi = (BLUE(rgb, 5) | (GREEN(rgb, 5) << 5)) & 0xff; 295 uint8_t lo = (GREEN(rgb, 5) >> 3) | (RED(rgb, 5) << 2); 296 *((uint16_t *) dst) = host2uint16_t_be((hi << 8) | lo); 306 297 } 307 298 308 299 static void mask_555(void *dst, bool mask) 309 300 { 310 *((uint16_t *) dst) = (mask ? 0x7fff : 0); 311 } 312 313 314 /** RGB 5:6:5 conversion 315 * 316 */ 317 static void rgb_565(void *dst, uint32_t rgb) 318 { 319 *((uint16_t *) dst) 320 = (RED(rgb, 5) << 11) | (GREEN(rgb, 6) << 5) | BLUE(rgb, 5); 301 bgr_555(dst, mask ? 0xffffff : 0); 302 } 303 304 static void bgr_565(void *dst, uint32_t rgb) 305 { 306 uint8_t hi = (BLUE(rgb, 5) | (GREEN(rgb, 6) << 5)) & 0xff; 307 uint8_t lo = (GREEN(rgb, 6) >> 3) | (RED(rgb, 5) << 3); 308 *((uint16_t *) dst) = host2uint16_t_be((hi << 8) | lo); 321 309 } 322 310 323 311 static void mask_565(void *dst, bool mask) 324 312 { 325 *((uint16_t *) dst) = (mask ? 0xffff : 0); 326 } 327 328 329 /** RGB 3:2:3 330 * 331 */ 332 static void rgb_323(void *dst, uint32_t rgb) 313 bgr_565(dst, mask ? 0xffffff : 0); 314 } 315 316 static void bgr_323(void *dst, uint32_t rgb) 333 317 { 334 318 *((uint8_t *) dst) … … 338 322 static void mask_323(void *dst, bool mask) 339 323 { 340 *((uint8_t *) dst) = (mask ? 0xff :0);324 bgr_323(dst, mask ? 0x0 : ~0x0); 341 325 } 342 326 … … 632 616 unsigned int scan, unsigned int visual) 633 617 { 634 635 636 618 switch (visual) { 637 619 case VISUAL_INDIRECT_8: 638 screen.rgb_conv = rgb_323;620 screen.rgb_conv = bgr_323; 639 621 screen.mask_conv = mask_323; 640 622 screen.pixelbytes = 1; 641 623 break; 642 case VISUAL_ RGB_5_5_5:643 screen.rgb_conv = rgb_555;624 case VISUAL_BGR_5_5_5: 625 screen.rgb_conv = bgr_555; 644 626 screen.mask_conv = mask_555; 645 627 screen.pixelbytes = 2; 646 628 break; 647 case VISUAL_ RGB_5_6_5:648 screen.rgb_conv = rgb_565;629 case VISUAL_BGR_5_6_5: 630 screen.rgb_conv = bgr_565; 649 631 screen.mask_conv = mask_565; 650 632 screen.pixelbytes = 2; … … 673 655 screen.rgb_conv = bgr_0888; 674 656 screen.mask_conv = mask_0888; 657 screen.pixelbytes = 4; 658 break; 659 case VISUAL_BGR_8_8_8_0: 660 screen.rgb_conv = bgr_8880; 661 screen.mask_conv = mask_8880; 675 662 screen.pixelbytes = 4; 676 663 break;
Note:
See TracChangeset
for help on using the changeset viewer.