Changeset fd375a8d in mainline for boot/genarch/ofw.c
- Timestamp:
- 2009-02-03T13:50:26Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 753d851
- Parents:
- eddf924
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/genarch/ofw.c
reddf924 rfd375a8d 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 29 #include <ofw.h> 30 30 #include <ofwarch.h> … … 373 373 } 374 374 375 #define RED(i) (((i) >> 5) & ((1 << 3) - 1)) 376 #define GREEN(i) (((i) >> 3) & ((1 << 2) - 1)) 377 #define BLUE(i) ((i) & ((1 << 3) - 1)) 378 #define CLIP(i) ((i) <= 255 ? (i) : 255) 379 380 375 381 /** 376 382 * Sets up the palette for the 8-bit color depth configuration so that the 377 383 * 3:2:3 color scheme can be used. Checks that setting the palette makes sense 378 384 * (appropriate nodes exist in the OBP tree and the color depth is not greater 379 * than 8). 380 * 381 * @return true if the palette has been set, false otherwise 385 * than 8). 386 * 387 * @return true if the palette has been set, false otherwise 388 * 382 389 */ 383 int setup_palette(void)390 int ofw_setup_palette(void) 384 391 { 385 392 char device_name[BUF_SIZE]; … … 387 394 /* resolve alias */ 388 395 if (ofw_get_property(ofw_aliases, "screen", device_name, 389 390 return false; 391 396 sizeof(device_name)) <= 0) 397 return false; 398 392 399 /* for depth greater than 8 it makes no sense to set up the palette */ 393 400 uint32_t depth; … … 404 411 if (screen == -1) 405 412 return false; 406 413 407 414 /* setup the palette so that the (inverted) 3:2:3 scheme is usable */ 408 415 unsigned int i; 409 416 for (i = 0; i < 256; i++) 410 if (ofw_call("call-method", 6, 1, NULL, "color!", screen, 411 255 - i, 412 i << 5, 413 (i >> 3) << 6, 414 (i >> 5) << 5) != 0); 417 ofw_call("call-method", 6, 1, NULL, "color!", screen, 418 255 - i, CLIP(BLUE(i) * 37), GREEN(i) * 85, CLIP(RED(i) * 37)); 415 419 return true; 416 420 }
Note:
See TracChangeset
for help on using the changeset viewer.