* The boot loader now passes on its EDID info to the kernel, and that will

be put into a boot_item in frame_buffer_console_init().
* The VESA driver now supports gettings the EDID information as well; this
  is necessary now, since the app_server no longer takes over the mode the
  boot loader had chosen.
* Note, we might want to do this via vm86 instead in the future, and remove
  the kernel part again.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25786 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2008-06-03 15:17:59 +00:00
parent 7870b77c18
commit d16ddc579c
10 changed files with 91 additions and 29 deletions

View File

@ -10,7 +10,10 @@
#include <Accelerant.h>
#include <PCI.h>
#include <edid.h>
#define VESA_EDID_BOOT_INFO "vesa_edid/v1"
#define VESA_MODES_BOOT_INFO "vesa_modes/v1"
struct vesa_mode {
@ -34,6 +37,9 @@ struct vesa_shared_info {
uint32 vesa_mode_offset;
uint32 vesa_mode_count;
edid1_info edid_info;
bool has_edid;
};
//----------------- ioctl() interface ----------------

View File

@ -1,4 +1,4 @@
/*
/*
* Copyright 2002-2008, Axel Dörfler, axeld@pinc-software.de.
* Distributed under the terms of the MIT License.
*
@ -73,6 +73,7 @@ typedef struct kernel_args {
void *vesa_modes;
uint32 vesa_modes_size;
void *edid_info;
void *debug_output;
uint32 debug_size;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2005-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _ACCELERANT_PROTOS_H
@ -26,14 +26,18 @@ sem_id vesa_accelerant_retrace_semaphore(void);
// modes & constraints
uint32 vesa_accelerant_mode_count(void);
status_t vesa_get_mode_list(display_mode *dm);
status_t vesa_propose_display_mode(display_mode *target, const display_mode *low, const display_mode *high);
status_t vesa_propose_display_mode(display_mode *target,
const display_mode *low, const display_mode *high);
status_t vesa_set_display_mode(display_mode *mode_to_set);
status_t vesa_get_display_mode(display_mode *current_mode);
status_t vesa_get_edid_info(void *info, size_t size, uint32 *_version);
status_t vesa_get_frame_buffer_config(frame_buffer_config *config);
status_t vesa_get_pixel_clock_limits(display_mode *dm, uint32 *low, uint32 *high);
status_t vesa_get_pixel_clock_limits(display_mode *dm, uint32 *low,
uint32 *high);
status_t vesa_move_display(uint16 h_display_start, uint16 v_display_start);
status_t vesa_get_timing_constraints(display_timing_constraints *dtc);
void vesa_set_indexed_colors(uint count, uint8 first, uint8 *color_data, uint32 flags);
void vesa_set_indexed_colors(uint count, uint8 first, uint8 *color_data,
uint32 flags);
// DPMS
uint32 vesa_dpms_capabilities(void);
@ -41,34 +45,42 @@ uint32 vesa_dpms_mode(void);
status_t vesa_set_dpms_mode(uint32 dpms_flags);
// cursor
status_t vesa_set_cursor_shape(uint16 width, uint16 height, uint16 hot_x, uint16 hot_y, uint8 *andMask, uint8 *xorMask);
status_t vesa_set_cursor_shape(uint16 width, uint16 height, uint16 hot_x,
uint16 hot_y, uint8 *andMask, uint8 *xorMask);
void vesa_move_cursor(uint16 x, uint16 y);
void vesa_show_cursor(bool is_visible);
// accelerant engine
uint32 vesa_accelerant_engine_count(void);
status_t vesa_acquire_engine(uint32 capabilities, uint32 max_wait, sync_token *st, engine_token **et);
status_t vesa_acquire_engine(uint32 capabilities, uint32 max_wait,
sync_token *st, engine_token **et);
status_t vesa_release_engine(engine_token *et, sync_token *st);
void vesa_wait_engine_idle(void);
status_t vesa_get_sync_token(engine_token *et, sync_token *st);
status_t vesa_sync_to_token(sync_token *st);
// 2D acceleration
void vesa_screen_to_screen_blit(engine_token *et, blit_params *list, uint32 count);
void vesa_fill_rectangle(engine_token *et, uint32 color, fill_rect_params *list, uint32 count);
void vesa_invert_rectangle(engine_token *et, fill_rect_params *list, uint32 count);
void vesa_screen_to_screen_blit(engine_token *et, blit_params *list,
uint32 count);
void vesa_fill_rectangle(engine_token *et, uint32 color, fill_rect_params *list,
uint32 count);
void vesa_invert_rectangle(engine_token *et, fill_rect_params *list,
uint32 count);
void vesa_fill_span(engine_token *et, uint32 color, uint16 *list, uint32 count);
// overlay
uint32 vesa_overlay_count(const display_mode *dm);
const uint32 *vesa_overlay_supported_spaces(const display_mode *dm);
uint32 vesa_overlay_supported_features(uint32 a_color_space);
const overlay_buffer *vesa_allocate_overlay_buffer(color_space cs, uint16 width, uint16 height);
const overlay_buffer *vesa_allocate_overlay_buffer(color_space cs, uint16 width,
uint16 height);
status_t vesa_release_overlay_buffer(const overlay_buffer *ob);
status_t vesa_get_overlay_constraints(const display_mode *dm, const overlay_buffer *ob, overlay_constraints *oc);
status_t vesa_get_overlay_constraints(const display_mode *dm,
const overlay_buffer *ob, overlay_constraints *oc);
overlay_token vesa_allocate_overlay(void);
status_t vesa_release_overlay(overlay_token ot);
status_t vesa_configure_overlay(overlay_token ot, const overlay_buffer *ob, const overlay_window *ow, const overlay_view *ov);
status_t vesa_configure_overlay(overlay_token ot, const overlay_buffer *ob,
const overlay_window *ow, const overlay_view *ov);
#ifdef __cplusplus
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2005-2008, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@ -16,13 +16,13 @@ vesa_set_cursor_shape(uint16 width, uint16 height, uint16 hot_x, uint16 hot_y, u
}
void
void
vesa_move_cursor(uint16 x, uint16 y)
{
}
void
void
vesa_show_cursor(bool is_visible)
{
}
@ -59,6 +59,8 @@ get_accelerant_hook(uint32 feature, void *data)
return (void*)vesa_set_display_mode;
case B_GET_DISPLAY_MODE:
return (void*)vesa_get_display_mode;
case B_GET_EDID_INFO:
return (void*)vesa_get_edid_info;
case B_GET_FRAME_BUFFER_CONFIG:
return (void*)vesa_get_frame_buffer_config;
case B_GET_PIXEL_CLOCK_LIMITS:

View File

@ -112,7 +112,7 @@ vesa_propose_display_mode(display_mode *target, const display_mode *low,
TRACE(("vesa_propose_display_mode()\n"));
// just search for the specified mode in the list
for (uint32 i = 0; i < gInfo->shared_info->mode_count; i++) {
display_mode *current = &gInfo->mode_list[i];
@ -161,6 +161,22 @@ vesa_get_display_mode(display_mode *_currentMode)
}
status_t
vesa_get_edid_info(void *info, size_t size, uint32 *_version)
{
TRACE(("intel_get_edid_info()\n"));
if (!gInfo->shared_info->has_edid)
return B_ERROR;
if (size < sizeof(struct edid1_info))
return B_BUFFER_OVERFLOW;
memcpy(info, &gInfo->shared_info->edid_info, sizeof(struct edid1_info));
*_version = EDID_VERSION_1;
return B_OK;
}
status_t
vesa_get_frame_buffer_config(frame_buffer_config *config)
{
@ -185,7 +201,7 @@ vesa_get_pixel_clock_limits(display_mode *mode, uint32 *low, uint32 *high)
/* lower limit of about 48Hz vertical refresh */
*low = (total_pix * 48L) / 1000L;
if (*low > clock_limit)
if (*low > clock_limit)
return B_ERROR;
*high = clock_limit;

View File

@ -1,5 +1,6 @@
SubDir HAIKU_TOP src add-ons kernel drivers graphics vesa ;
UsePrivateHeaders kernel graphics [ FDirName graphics common ] ;
UsePrivateHeaders kernel graphics [ FDirName graphics vesa ] ;
KernelAddon vesa :

View File

@ -138,6 +138,14 @@ vesa_init(vesa_info &info)
bufferInfo->depth);
sharedInfo.bytes_per_row = bufferInfo->bytes_per_row;
// TODO: we might want to do this via vm86 instead
edid1_info *edidInfo = (edid1_info *)get_boot_item(VESA_EDID_BOOT_INFO,
NULL);
if (edidInfo != NULL) {
sharedInfo.has_edid = true;
memcpy(&sharedInfo.edid_info, edidInfo, sizeof(edid1_info));
}
physical_entry mapping;
get_memory_map((void *)sharedInfo.frame_buffer, B_PAGE_SIZE,
&mapping, 1);

View File

@ -29,7 +29,7 @@
#include <string.h>
//#define TRACE_VIDEO
#define TRACE_VIDEO
#ifdef TRACE_VIDEO
# define TRACE(x) dprintf x
#else
@ -1030,6 +1030,10 @@ platform_init_video(void)
// We found a new default mode to use!
sDefaultMode = defaultMode;
}
gKernelArgs.edid_info = kernel_args_malloc(sizeof(edid1_info));
if (gKernelArgs.edid_info != NULL)
memcpy(gKernelArgs.edid_info, &info, sizeof(edid1_info));
}
sMode = sDefaultMode;

View File

@ -1,6 +1,7 @@
SubDir HAIKU_TOP src system kernel debug ;
UsePrivateHeaders [ FDirName kernel debug ] syslog_daemon ;
UsePrivateHeaders [ FDirName graphics common ] ;
UsePrivateHeaders [ FDirName graphics vesa ] ;
KernelMergeObject kernel_debug.o :

View File

@ -4,6 +4,13 @@
*/
#include <frame_buffer_console.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <KernelExport.h>
#include <kernel.h>
#include <lock.h>
@ -13,13 +20,9 @@
#include <boot/kernel_args.h>
#include <vesa_info.h>
#include <frame_buffer_console.h>
#include "font.h"
#include <edid.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include "font.h"
//#define TRACE_FB_CONSOLE
@ -56,11 +59,11 @@ static uint8 sPalette8[] = {
};
static uint16 sPalette15[] = {
// 0bbbbbgggggrrrrr (5-5-5)
0x7fff, 0x001f, 0x03e0, 0x03ff, 0x7c00, 0x7c1f, 0x7fe0, 0x0000,
0x7fff, 0x001f, 0x03e0, 0x03ff, 0x7c00, 0x7c1f, 0x7fe0, 0x0000,
};
static uint16 sPalette16[] = {
// bbbbbggggggrrrrr (5-6-5)
0xffff, 0x001f, 0x07e0, 0x07ff, 0xf800, 0xf81f, 0xffe0, 0x0000,
0xffff, 0x001f, 0x07e0, 0x07ff, 0xf800, 0xf81f, 0xffe0, 0x0000,
};
static uint32 sPalette32[] = {
// is also used by 24 bit modes
@ -119,7 +122,7 @@ render_glyph(int32 x, int32 y, uint8 glyph, uint8 attr)
uint8 bits = FONT[CHAR_HEIGHT * glyph + y];
for (x = 0; x < CHAR_WIDTH; x++) {
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];
else
base[x * sConsole.bytes_per_pixel + i] = backgroundColor[i];
@ -206,7 +209,7 @@ console_move_cursor(int32 x, int32 y)
draw_cursor(sConsole.cursor_x, sConsole.cursor_y);
draw_cursor(x, y);
sConsole.cursor_x = x;
sConsole.cursor_y = y;
}
@ -425,6 +428,14 @@ frame_buffer_console_init(kernel_args *args)
add_boot_item(VESA_MODES_BOOT_INFO, sVesaModes, args->vesa_modes_size);
}
if (args->edid_info != NULL) {
edid1_info *info = (edid1_info *)malloc(sizeof(edid1_info));
if (info != NULL) {
memcpy(info, args->edid_info, sizeof(edid1_info));
add_boot_item(VESA_EDID_BOOT_INFO, info, sizeof(edid1_info));
}
}
return B_OK;
}