Rev 3675 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3675 | Rev 3684 | ||
---|---|---|---|
Line 371... | Line 371... | ||
371 | return false; |
371 | return false; |
372 | 372 | ||
373 | return true; |
373 | return true; |
374 | } |
374 | } |
375 | 375 | ||
- | 376 | /** |
|
- | 377 | * Sets up the palette for the 8-bit color depth configuration so that the |
|
- | 378 | * 3:2:3 color scheme can be used. Checks that setting the palette makes sense |
|
- | 379 | * (appropriate nodes exist in the OBP tree and the color depth is not greater |
|
- | 380 | * than 8). |
|
- | 381 | * |
|
- | 382 | * @return true if the palette has been set, false otherwise |
|
- | 383 | */ |
|
- | 384 | int setup_palette(void) |
|
- | 385 | { |
|
- | 386 | char device_name[BUF_SIZE]; |
|
- | 387 | ||
- | 388 | /* resolve alias */ |
|
- | 389 | if (ofw_get_property(ofw_aliases, "screen", device_name, |
|
- | 390 | sizeof(device_name)) <= 0) |
|
- | 391 | return false; |
|
- | 392 | ||
- | 393 | /* for depth greater than 8 it makes no sense to set up the palette */ |
|
- | 394 | uint32_t depth; |
|
- | 395 | phandle device = ofw_find_device(device_name); |
|
- | 396 | if (device == -1) |
|
- | 397 | return false; |
|
- | 398 | if (ofw_get_property(device, "depth", &depth, sizeof(uint32_t)) <= 0) |
|
- | 399 | return false; |
|
- | 400 | if (depth != 8) |
|
- | 401 | return false; |
|
- | 402 | ||
- | 403 | /* required in order to be able to make a method call */ |
|
- | 404 | ihandle screen = ofw_open(device_name); |
|
- | 405 | if (screen == -1) |
|
- | 406 | return false; |
|
- | 407 | ||
- | 408 | /* setup the palette so that the 3:2:3 scheme is usable */ |
|
- | 409 | unsigned int i; |
|
- | 410 | for (i = 0; i < 256; i++) |
|
- | 411 | if (ofw_call("call-method", 6, 1, NULL, "color!", screen, |
|
- | 412 | i, |
|
- | 413 | i << 5, |
|
- | 414 | (i >> 3) << 6, |
|
- | 415 | (i >> 5) << 5) != 0); |
|
- | 416 | return true; |
|
- | 417 | } |
|
376 | 418 | ||
377 | void ofw_quiesce(void) |
419 | void ofw_quiesce(void) |
378 | { |
420 | { |
379 | ofw_call("quiesce", 0, 0, NULL); |
421 | ofw_call("quiesce", 0, 0, NULL); |
380 | } |
422 | } |