diff --git a/headers/private/graphics/vesa/vesa_info.h b/headers/private/graphics/vesa/vesa_info.h index 1de16a6c30..de6c94a224 100644 --- a/headers/private/graphics/vesa/vesa_info.h +++ b/headers/private/graphics/vesa/vesa_info.h @@ -10,7 +10,10 @@ #include #include +#include + +#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 ---------------- diff --git a/headers/private/kernel/boot/kernel_args.h b/headers/private/kernel/boot/kernel_args.h index d24dad5191..d4127cf1a1 100644 --- a/headers/private/kernel/boot/kernel_args.h +++ b/headers/private/kernel/boot/kernel_args.h @@ -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; diff --git a/src/add-ons/accelerants/vesa/accelerant_protos.h b/src/add-ons/accelerants/vesa/accelerant_protos.h index 845e2570ff..108693ba83 100644 --- a/src/add-ons/accelerants/vesa/accelerant_protos.h +++ b/src/add-ons/accelerants/vesa/accelerant_protos.h @@ -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 } diff --git a/src/add-ons/accelerants/vesa/hooks.cpp b/src/add-ons/accelerants/vesa/hooks.cpp index 1235add5d8..724b27bbf1 100644 --- a/src/add-ons/accelerants/vesa/hooks.cpp +++ b/src/add-ons/accelerants/vesa/hooks.cpp @@ -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: diff --git a/src/add-ons/accelerants/vesa/mode.cpp b/src/add-ons/accelerants/vesa/mode.cpp index 01f8066a4b..9a1bb81342 100644 --- a/src/add-ons/accelerants/vesa/mode.cpp +++ b/src/add-ons/accelerants/vesa/mode.cpp @@ -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; diff --git a/src/add-ons/kernel/drivers/graphics/vesa/Jamfile b/src/add-ons/kernel/drivers/graphics/vesa/Jamfile index 4703adb230..656159be4f 100644 --- a/src/add-ons/kernel/drivers/graphics/vesa/Jamfile +++ b/src/add-ons/kernel/drivers/graphics/vesa/Jamfile @@ -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 : diff --git a/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp b/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp index 31971c671a..88b4d05d8d 100644 --- a/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp +++ b/src/add-ons/kernel/drivers/graphics/vesa/vesa.cpp @@ -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); diff --git a/src/system/boot/platform/bios_ia32/video.cpp b/src/system/boot/platform/bios_ia32/video.cpp index 230998952a..72692ed2ac 100644 --- a/src/system/boot/platform/bios_ia32/video.cpp +++ b/src/system/boot/platform/bios_ia32/video.cpp @@ -29,7 +29,7 @@ #include -//#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; diff --git a/src/system/kernel/debug/Jamfile b/src/system/kernel/debug/Jamfile index c6b6ad1c96..723a1575c0 100644 --- a/src/system/kernel/debug/Jamfile +++ b/src/system/kernel/debug/Jamfile @@ -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 : diff --git a/src/system/kernel/debug/frame_buffer_console.cpp b/src/system/kernel/debug/frame_buffer_console.cpp index c5b7b889f7..0155bf9297 100644 --- a/src/system/kernel/debug/frame_buffer_console.cpp +++ b/src/system/kernel/debug/frame_buffer_console.cpp @@ -4,6 +4,13 @@ */ +#include + +#include +#include +#include +#include + #include #include #include @@ -13,13 +20,9 @@ #include #include -#include -#include "font.h" +#include -#include -#include -#include -#include +#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; }