* Setting the depth to 1 for VGA mode in frame_buffer_console_init() was not
a good idea; it didn't have any consequences in there, but actually broke the app_server's support for the VGA mode. * Cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32181 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -24,6 +24,8 @@ static uint32
|
|||||||
get_color_space_for_depth(uint32 depth)
|
get_color_space_for_depth(uint32 depth)
|
||||||
{
|
{
|
||||||
switch (depth) {
|
switch (depth) {
|
||||||
|
case 1:
|
||||||
|
return B_GRAY1;
|
||||||
case 4:
|
case 4:
|
||||||
return B_GRAY8;
|
return B_GRAY8;
|
||||||
// the app_server is smart enough to translate this to VGA mode
|
// the app_server is smart enough to translate this to VGA mode
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ struct console_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Palette is (white and black are exchanged):
|
// Palette is (white and black are exchanged):
|
||||||
// 0 - white, 1 - blue, 2 - green, 3 - cyan, 4 - red, 5 - magenta, 6 - yellow, 7 - black
|
// 0 - white, 1 - blue, 2 - green, 3 - cyan, 4 - red, 5 - magenta, 6 - yellow,
|
||||||
|
// 7 - black
|
||||||
// 8-15 - same but bright (we're ignoring those)
|
// 8-15 - same but bright (we're ignoring those)
|
||||||
|
|
||||||
static uint8 sPalette8[] = {
|
static uint8 sPalette8[] = {
|
||||||
@@ -120,7 +121,8 @@ render_glyph(int32 x, int32 y, uint8 glyph, uint8 attr)
|
|||||||
glyph = 127;
|
glyph = 127;
|
||||||
|
|
||||||
if (sConsole.depth >= 8) {
|
if (sConsole.depth >= 8) {
|
||||||
uint8 *base = (uint8 *)(sConsole.frame_buffer + sConsole.bytes_per_row * y * CHAR_HEIGHT
|
uint8* base = (uint8*)(sConsole.frame_buffer
|
||||||
|
+ sConsole.bytes_per_row * y * CHAR_HEIGHT
|
||||||
+ x * CHAR_WIDTH * sConsole.bytes_per_pixel);
|
+ x * CHAR_WIDTH * sConsole.bytes_per_pixel);
|
||||||
uint8* color = get_palette_entry(foreground_color(attr));
|
uint8* color = get_palette_entry(foreground_color(attr));
|
||||||
uint8* backgroundColor = get_palette_entry(background_color(attr));
|
uint8* backgroundColor = get_palette_entry(background_color(attr));
|
||||||
@@ -131,8 +133,10 @@ render_glyph(int32 x, int32 y, uint8 glyph, uint8 attr)
|
|||||||
for (int32 i = 0; i < sConsole.bytes_per_pixel; i++) {
|
for (int32 i = 0; i < sConsole.bytes_per_pixel; i++) {
|
||||||
if (bits & 1)
|
if (bits & 1)
|
||||||
base[x * sConsole.bytes_per_pixel + i] = color[i];
|
base[x * sConsole.bytes_per_pixel + i] = color[i];
|
||||||
else
|
else {
|
||||||
base[x * sConsole.bytes_per_pixel + i] = backgroundColor[i];
|
base[x * sConsole.bytes_per_pixel + i]
|
||||||
|
= backgroundColor[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bits >>= 1;
|
bits >>= 1;
|
||||||
}
|
}
|
||||||
@@ -140,7 +144,8 @@ render_glyph(int32 x, int32 y, uint8 glyph, uint8 attr)
|
|||||||
base += sConsole.bytes_per_row;
|
base += sConsole.bytes_per_row;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// monochrome mode
|
// VGA mode will be treated as monochrome
|
||||||
|
// (ie. only the first plane will be used)
|
||||||
|
|
||||||
uint8* base = (uint8*)(sConsole.frame_buffer
|
uint8* base = (uint8*)(sConsole.frame_buffer
|
||||||
+ sConsole.bytes_per_row * y * CHAR_HEIGHT + x * CHAR_WIDTH / 8);
|
+ sConsole.bytes_per_row * y * CHAR_HEIGHT + x * CHAR_WIDTH / 8);
|
||||||
@@ -359,10 +364,12 @@ console_module_info gFrameBufferConsoleModule = {
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
frame_buffer_update(addr_t baseAddress, int32 width, int32 height, int32 depth, int32 bytesPerRow)
|
frame_buffer_update(addr_t baseAddress, int32 width, int32 height, int32 depth,
|
||||||
|
int32 bytesPerRow)
|
||||||
{
|
{
|
||||||
TRACE(("frame_buffer_update(buffer = %p, width = %ld, height = %ld, depth = %ld, bytesPerRow = %ld)\n",
|
TRACE(("frame_buffer_update(buffer = %p, width = %ld, height = %ld, "
|
||||||
(void *)baseAddress, width, height, depth, bytesPerRow));
|
"depth = %ld, bytesPerRow = %ld)\n", (void*)baseAddress, width, height,
|
||||||
|
depth, bytesPerRow));
|
||||||
|
|
||||||
mutex_lock(&sConsole.lock);
|
mutex_lock(&sConsole.lock);
|
||||||
|
|
||||||
@@ -413,12 +420,6 @@ frame_buffer_console_init(kernel_args *args)
|
|||||||
if (sConsole.area < B_OK)
|
if (sConsole.area < B_OK)
|
||||||
return sConsole.area;
|
return sConsole.area;
|
||||||
|
|
||||||
if (args->frame_buffer.depth == 4) {
|
|
||||||
// VGA mode will be treated as monochrome
|
|
||||||
// (ie. only the first plane will be used)
|
|
||||||
args->frame_buffer.depth = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
frame_buffer_update((addr_t)frameBuffer, args->frame_buffer.width,
|
frame_buffer_update((addr_t)frameBuffer, args->frame_buffer.width,
|
||||||
args->frame_buffer.height, args->frame_buffer.depth,
|
args->frame_buffer.height, args->frame_buffer.depth,
|
||||||
args->frame_buffer.bytes_per_row);
|
args->frame_buffer.bytes_per_row);
|
||||||
|
|||||||
Reference in New Issue
Block a user