After so much debugging, I realized that the vesa driver can't set the display mode. I'm stuck with testing till I find some other way...

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15676 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2005-12-26 14:55:41 +00:00
parent ee44f668eb
commit 0398e7fb64
1 changed files with 40 additions and 29 deletions

View File

@ -286,7 +286,7 @@ set_mouse_position(int32 x, int32 y)
BWindowScreen::BWindowScreen(const char *title, uint32 space, BWindowScreen::BWindowScreen(const char *title, uint32 space,
status_t *error, bool debug_enable) status_t *error, bool debug_enable)
: BWindow(BScreen().Frame(), title, B_TITLED_WINDOW, : BWindow(BScreen().Frame().InsetByCopy(200, 200), title, B_TITLED_WINDOW,
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE
| B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, B_CURRENT_WORKSPACE) | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, B_CURRENT_WORKSPACE)
{ {
@ -303,7 +303,7 @@ BWindowScreen::BWindowScreen(const char *title, uint32 space,
BWindowScreen::BWindowScreen(const char *title, uint32 space, BWindowScreen::BWindowScreen(const char *title, uint32 space,
uint32 attributes, status_t *error) uint32 attributes, status_t *error)
: BWindow(BScreen().Frame(), title, B_TITLED_WINDOW, : BWindow(BScreen().Frame().InsetByCopy(200, 200), title, B_TITLED_WINDOW,
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE
| B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, B_CURRENT_WORKSPACE) | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, B_CURRENT_WORKSPACE)
{ {
@ -408,6 +408,7 @@ BWindowScreen::Hide()
void void
BWindowScreen::Show() BWindowScreen::Show()
{ {
CALLED();
BWindow::Show(); BWindow::Show();
if (!fActivateState) { if (!fActivateState) {
release_sem(fActivateSem); release_sem(fActivateSem);
@ -419,6 +420,7 @@ BWindowScreen::Show()
void void
BWindowScreen::SetColorList(rgb_color *list, int32 first_index, int32 last_index) BWindowScreen::SetColorList(rgb_color *list, int32 first_index, int32 last_index)
{ {
CALLED();
if (first_index < 0 || last_index > 255 || first_index > last_index) if (first_index < 0 || last_index > 255 || first_index > last_index)
return; return;
@ -455,6 +457,7 @@ BWindowScreen::SetColorList(rgb_color *list, int32 first_index, int32 last_index
status_t status_t
BWindowScreen::SetSpace(uint32 space) BWindowScreen::SetSpace(uint32 space)
{ {
CALLED();
display_mode mode; display_mode mode;
status_t status = GetModeFromSpace(space, &mode); status_t status = GetModeFromSpace(space, &mode);
if (status == B_OK) if (status == B_OK)
@ -475,7 +478,8 @@ BWindowScreen::SetFrameBuffer(int32 width, int32 height)
{ {
CALLED(); CALLED();
display_mode highMode = *fDisplayMode; display_mode highMode = *fDisplayMode;
highMode.flags |= B_SCROLL;
highMode.virtual_height = (int16)height; highMode.virtual_height = (int16)height;
highMode.virtual_width = (int16)width; highMode.virtual_width = (int16)width;
@ -495,17 +499,15 @@ status_t
BWindowScreen::MoveDisplayArea(int32 x, int32 y) BWindowScreen::MoveDisplayArea(int32 x, int32 y)
{ {
CALLED(); CALLED();
status_t status = B_ERROR; move_display_area moveDisplayArea = (move_display_area)fGetAccelerantHook(B_MOVE_DISPLAY, NULL);
if (moveDisplayArea && moveDisplayArea((int16)x, (int16)y) == B_OK) {
// TODO: Ask app server to move the frame buffer area
if (status == B_OK) {
fFrameBufferInfo.display_x = x; fFrameBufferInfo.display_x = x;
fFrameBufferInfo.display_y = y; fFrameBufferInfo.display_y = y;
fDisplayMode->h_display_start = x; fDisplayMode->h_display_start = x;
fDisplayMode->v_display_start = y; fDisplayMode->v_display_start = y;
return B_OK;
} }
return status; return B_ERROR;
} }
@ -520,6 +522,7 @@ BWindowScreen::IOBase()
rgb_color * rgb_color *
BWindowScreen::ColorList() BWindowScreen::ColorList()
{ {
CALLED();
return fColorList; return fColorList;
} }
@ -527,6 +530,7 @@ BWindowScreen::ColorList()
frame_buffer_info * frame_buffer_info *
BWindowScreen::FrameBufferInfo() BWindowScreen::FrameBufferInfo()
{ {
CALLED();
return &fFrameBufferInfo; return &fFrameBufferInfo;
} }
@ -534,6 +538,7 @@ BWindowScreen::FrameBufferInfo()
graphics_card_hook graphics_card_hook
BWindowScreen::CardHookAt(int32 index) BWindowScreen::CardHookAt(int32 index)
{ {
CALLED();
if (fAddonImage < 0) if (fAddonImage < 0)
return NULL; return NULL;
@ -569,6 +574,7 @@ BWindowScreen::CardHookAt(int32 index)
graphics_card_info * graphics_card_info *
BWindowScreen::CardInfo() BWindowScreen::CardInfo()
{ {
CALLED();
return &fCardInfo; return &fCardInfo;
} }
@ -642,6 +648,7 @@ void BWindowScreen::_ReservedWindowScreen4() {}
BRect BRect
BWindowScreen::CalcFrame(int32 index, int32 space, display_mode *dmode) BWindowScreen::CalcFrame(int32 index, int32 space, display_mode *dmode)
{ {
CALLED();
BScreen screen; BScreen screen;
if (dmode) if (dmode)
screen.GetMode(dmode); screen.GetMode(dmode);
@ -691,9 +698,8 @@ BWindowScreen::InitData(uint32 space, uint32 attributes)
fDebugSem = create_sem(1, "WindowScreen debug sem"); fDebugSem = create_sem(1, "WindowScreen debug sem");
fOldDisplayMode = (display_mode *)calloc(1, sizeof(display_mode)); fOldDisplayMode = (display_mode *)calloc(1, sizeof(display_mode));
fDisplayMode = (display_mode *)calloc(1, sizeof(display_mode)); fDisplayMode = (display_mode *)calloc(1, sizeof(display_mode));
memcpy(fDisplayMode, &newMode, sizeof(display_mode));
memcpy(fDisplayMode, &newMode, sizeof(newMode));
fWorkState = 1; fWorkState = 1;
return B_OK; return B_OK;
@ -706,7 +712,7 @@ BWindowScreen::SetActiveState(int32 state)
CALLED(); CALLED();
status_t status = B_ERROR; status_t status = B_ERROR;
if (state == 1) { if (state == 1) {
be_app->HideCursor(); //be_app->HideCursor();
status = AssertDisplayMode(fDisplayMode); status = AssertDisplayMode(fDisplayMode);
if (status == B_OK && (status = SetupAccelerantHooks(true)) == B_OK) { if (status == B_OK && (status = SetupAccelerantHooks(true)) == B_OK) {
if (!fActivateState) { if (!fActivateState) {
@ -777,13 +783,13 @@ BWindowScreen::SetupAccelerantHooks(bool enable)
if (fAddonImage < 0) { if (fAddonImage < 0) {
status = InitClone(); status = InitClone();
if (status == B_OK) { if (status == B_OK) {
m_wei = (wait_engine_idle)fGetAccelerantHook(B_WAIT_ENGINE_IDLE, fDisplayMode); m_wei = (wait_engine_idle)fGetAccelerantHook(B_WAIT_ENGINE_IDLE, NULL);
m_re = (release_engine)fGetAccelerantHook(B_RELEASE_ENGINE, fDisplayMode); m_re = (release_engine)fGetAccelerantHook(B_RELEASE_ENGINE, NULL);
m_ae = (acquire_engine)fGetAccelerantHook(B_ACQUIRE_ENGINE, fDisplayMode); m_ae = (acquire_engine)fGetAccelerantHook(B_ACQUIRE_ENGINE, NULL);
fill_rect = (fill_rectangle)fGetAccelerantHook(B_FILL_RECTANGLE, fDisplayMode); fill_rect = (fill_rectangle)fGetAccelerantHook(B_FILL_RECTANGLE, NULL);
blit_rect = (screen_to_screen_blit)fGetAccelerantHook(B_SCREEN_TO_SCREEN_BLIT, fDisplayMode); blit_rect = (screen_to_screen_blit)fGetAccelerantHook(B_SCREEN_TO_SCREEN_BLIT, NULL);
trans_blit_rect = (screen_to_screen_transparent_blit)fGetAccelerantHook(B_SCREEN_TO_SCREEN_TRANSPARENT_BLIT, fDisplayMode); trans_blit_rect = (screen_to_screen_transparent_blit)fGetAccelerantHook(B_SCREEN_TO_SCREEN_TRANSPARENT_BLIT, NULL);
scaled_filtered_blit_rect = (screen_to_screen_scaled_filtered_blit)fGetAccelerantHook(B_SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT, fDisplayMode); scaled_filtered_blit_rect = (screen_to_screen_scaled_filtered_blit)fGetAccelerantHook(B_SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT, NULL);
} }
} }
@ -842,7 +848,6 @@ BWindowScreen::GetCardInfo()
strncpy(fCardInfo.rgba_order, "bgra", 4); strncpy(fCardInfo.rgba_order, "bgra", 4);
fCardInfo.flags = 0; fCardInfo.flags = 0;
if (mode.flags & B_SCROLL) if (mode.flags & B_SCROLL)
fCardInfo.flags |= B_FRAME_BUFFER_CONTROL; fCardInfo.flags |= B_FRAME_BUFFER_CONTROL;
if (mode.flags & B_PARALLEL_ACCESS) if (mode.flags & B_PARALLEL_ACCESS)
@ -936,10 +941,11 @@ BWindowScreen::GetModeFromSpace(uint32 space, display_mode *dmode)
status_t status_t
BWindowScreen::InitClone() BWindowScreen::InitClone()
{ {
CALLED();
if (fAddonImage >= 0) if (fAddonImage >= 0)
return B_OK; return B_OK;
CALLED();
AppServerLink link; AppServerLink link;
link.StartMessage(AS_GET_ACCELERANT_PATH); link.StartMessage(AS_GET_ACCELERANT_PATH);
link.Attach<int32>(fScreenIndex); link.Attach<int32>(fScreenIndex);
@ -965,6 +971,7 @@ BWindowScreen::InitClone()
return status; return status;
} }
status = B_ERROR;
clone_accelerant clone = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, 0); clone_accelerant clone = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, 0);
if (clone == NULL) { if (clone == NULL) {
printf("InitClone: cannot get clone hook\n"); printf("InitClone: cannot get clone hook\n");
@ -973,7 +980,6 @@ BWindowScreen::InitClone()
return status; return status;
} }
status = B_ERROR;
link.StartMessage(AS_GET_DRIVER_PATH); link.StartMessage(AS_GET_DRIVER_PATH);
link.Attach<int32>(fScreenIndex); link.Attach<int32>(fScreenIndex);
if (link.FlushWithReply(status) == B_OK && status == B_OK) { if (link.FlushWithReply(status) == B_OK && status == B_OK) {
@ -998,13 +1004,18 @@ BWindowScreen::AssertDisplayMode(display_mode *dmode)
CALLED(); CALLED();
status_t status = B_ERROR; status_t status = B_ERROR;
if (dmode->virtual_width != fDisplayMode->virtual_width BScreen screen(this);
|| dmode->virtual_height != fDisplayMode->virtual_height display_mode mode;
|| dmode->space != fDisplayMode->space) { status = screen.GetMode(&mode);
status = BScreen(this).SetMode(dmode); if (status < B_OK)
if (status < B_OK) return status;
if (mode.virtual_height != dmode->virtual_height || mode.virtual_width != dmode->virtual_width
|| mode.space != dmode->space || mode.flags != dmode->flags) {
status = screen.SetMode(dmode);
if (status < B_OK) {
printf("AssertDisplayMode: Setting mode failed: %s\n", strerror(status));
return status; return status;
}
memcpy(fDisplayMode, dmode, sizeof(display_mode)); memcpy(fDisplayMode, dmode, sizeof(display_mode));
space_mode = 1; space_mode = 1;
} }