Rev 1986 | Rev 1994 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1986 | Rev 1993 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | */ |
33 | */ |
34 | 34 | ||
35 | #include <arch/drivers/scr.h> |
35 | #include <arch/drivers/scr.h> |
36 | #include <genarch/ofw/ofw_tree.h> |
36 | #include <genarch/ofw/ofw_tree.h> |
37 | #include <genarch/fb/fb.h> |
37 | #include <genarch/fb/fb.h> |
- | 38 | #include <genarch/fb/visuals.h> |
|
38 | #include <arch/types.h> |
39 | #include <arch/types.h> |
39 | #include <typedefs.h> |
40 | #include <typedefs.h> |
40 | #include <func.h> |
41 | #include <func.h> |
41 | #include <align.h> |
42 | #include <align.h> |
42 | #include <print.h> |
43 | #include <print.h> |
Line 73... | Line 74... | ||
73 | uint32_t fb_width = 0; |
74 | uint32_t fb_width = 0; |
74 | uint32_t fb_height = 0; |
75 | uint32_t fb_height = 0; |
75 | uint32_t fb_depth = 0; |
76 | uint32_t fb_depth = 0; |
76 | uint32_t fb_linebytes = 0; |
77 | uint32_t fb_linebytes = 0; |
77 | uint32_t fb_scanline = 0; |
78 | uint32_t fb_scanline = 0; |
- | 79 | unsigned int visual; |
|
78 | 80 | ||
79 | prop = ofw_tree_getprop(node, "width"); |
81 | prop = ofw_tree_getprop(node, "width"); |
80 | if (prop && prop->value) |
82 | if (prop && prop->value) |
81 | fb_width = *((uint32_t *) prop->value); |
83 | fb_width = *((uint32_t *) prop->value); |
82 | 84 | ||
Line 113... | Line 115... | ||
113 | 115 | ||
114 | if (!ofw_pci_apply_ranges(node->parent, &abs_reg , &fb_addr)) { |
116 | if (!ofw_pci_apply_ranges(node->parent, &abs_reg , &fb_addr)) { |
115 | printf("Failed to determine screen address.\n"); |
117 | printf("Failed to determine screen address.\n"); |
116 | return; |
118 | return; |
117 | } |
119 | } |
118 | 120 | ||
119 | if (fb_depth == 24) |
121 | switch (fb_depth) { |
- | 122 | case 8: |
|
- | 123 | fb_scanline = fb_linebytes * (fb_depth >> 3); |
|
- | 124 | visual = VISUAL_INDIRECT_8; |
|
- | 125 | break; |
|
- | 126 | case 16: |
|
- | 127 | fb_scanline = fb_linebytes * (fb_depth >> 3); |
|
- | 128 | visual = VISUAL_RGB_5_6_5; |
|
- | 129 | break; |
|
- | 130 | case 24: |
|
120 | fb_scanline = fb_linebytes * 4; |
131 | fb_scanline = fb_linebytes * 4; |
- | 132 | visual = VISUAL_RGB_8_8_8_0; |
|
- | 133 | break; |
|
121 | else |
134 | case 32: |
122 | fb_scanline = fb_linebytes * (fb_depth >> 3); |
135 | fb_scanline = fb_linebytes * (fb_depth >> 3); |
- | 136 | visual = VISUAL_RGB_0_8_8_8; |
|
- | 137 | break; |
|
- | 138 | default: |
|
- | 139 | printf("Unsupported bits per pixel.\n"); |
|
- | 140 | return; |
|
- | 141 | } |
|
123 | 142 | ||
124 | break; |
143 | break; |
125 | case SCR_FFB: |
144 | case SCR_FFB: |
126 | fb_depth = 32; |
- | |
127 | fb_scanline = 8192; |
145 | fb_scanline = 8192; |
- | 146 | visual = VISUAL_RGB_0_8_8_8; |
|
128 | 147 | ||
129 | ofw_upa_reg_t *reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP]; |
148 | ofw_upa_reg_t *reg = &((ofw_upa_reg_t *) prop->value)[FFB_REG_24BPP]; |
130 | if (!ofw_upa_apply_ranges(node->parent, reg, &fb_addr)) { |
149 | if (!ofw_upa_apply_ranges(node->parent, reg, &fb_addr)) { |
131 | printf("Failed to determine screen address.\n"); |
150 | printf("Failed to determine screen address.\n"); |
132 | return; |
151 | return; |
Line 135... | Line 154... | ||
135 | break; |
154 | break; |
136 | default: |
155 | default: |
137 | panic("Unexpected type.\n"); |
156 | panic("Unexpected type.\n"); |
138 | } |
157 | } |
139 | 158 | ||
140 | fb_init(fb_addr, fb_width, fb_height, fb_depth, fb_scanline, true); |
159 | fb_init(fb_addr, fb_width, fb_height, fb_scanline, visual); |
141 | } |
160 | } |
142 | 161 | ||
143 | /** @} |
162 | /** @} |
144 | */ |
163 | */ |