more cleanup. I can't seem to be able to clone the vesa accelerant so I'm a bit stuck at the moment
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15665 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -154,7 +154,7 @@ virtual void _ReservedWindowScreen4();
|
|||||||
BWindowScreen(BWindowScreen &);
|
BWindowScreen(BWindowScreen &);
|
||||||
BWindowScreen &operator=(BWindowScreen &);
|
BWindowScreen &operator=(BWindowScreen &);
|
||||||
|
|
||||||
char fAddonState;
|
char _unused;
|
||||||
char space_mode;
|
char space_mode;
|
||||||
void *io_buffer;
|
void *io_buffer;
|
||||||
bool direct_enable;
|
bool direct_enable;
|
||||||
@@ -170,6 +170,7 @@ virtual void _ReservedWindowScreen4();
|
|||||||
sem_id fActivateSem;
|
sem_id fActivateSem;
|
||||||
sem_id fDebugSem;
|
sem_id fDebugSem;
|
||||||
image_id fAddonImage;
|
image_id fAddonImage;
|
||||||
|
|
||||||
rgb_color fColorList[256];
|
rgb_color fColorList[256];
|
||||||
GetAccelerantHook m_gah;
|
GetAccelerantHook m_gah;
|
||||||
graphics_card_info fCardInfo;
|
graphics_card_info fCardInfo;
|
||||||
@@ -201,10 +202,10 @@ virtual void _ReservedWindowScreen4();
|
|||||||
static BRect CalcFrame(int32 index, int32 space, display_mode *dmode);
|
static BRect CalcFrame(int32 index, int32 space, display_mode *dmode);
|
||||||
status_t SetFullscreen(bool enable);
|
status_t SetFullscreen(bool enable);
|
||||||
status_t InitData(uint32 space, uint32 attributes);
|
status_t InitData(uint32 space, uint32 attributes);
|
||||||
status_t SetActiveState(int32 state);
|
status_t SetActiveState(int32 state);
|
||||||
status_t SetLockState(int32 state);
|
status_t SetLockState(int32 state);
|
||||||
void GetCardInfo();
|
status_t GetCardInfo();
|
||||||
void Suspend();
|
void Suspend();
|
||||||
void Resume();
|
void Resume();
|
||||||
status_t GetModeFromSpace(uint32 space, display_mode *dmode);
|
status_t GetModeFromSpace(uint32 space, display_mode *dmode);
|
||||||
status_t InitClone();
|
status_t InitClone();
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ BWindowScreen::~BWindowScreen()
|
|||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
Disconnect();
|
Disconnect();
|
||||||
if (fAddonState == 1)
|
if (fAddonImage >= 0)
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
|
|
||||||
SetFullscreen(false);
|
SetFullscreen(false);
|
||||||
@@ -438,7 +438,7 @@ BWindowScreen::SetColorList(rgb_color *list, int32 first_index, int32 last_index
|
|||||||
fColorList[x] = list[x];
|
fColorList[x] = list[x];
|
||||||
} else {
|
} else {
|
||||||
uint32 colorCount = last_index - first_index + 1;
|
uint32 colorCount = last_index - first_index + 1;
|
||||||
if (fAddonState == 1) {
|
if (fAddonImage >= 0) {
|
||||||
set_indexed_colors sic = (set_indexed_colors)m_gah(B_SET_INDEXED_COLORS, NULL);
|
set_indexed_colors sic = (set_indexed_colors)m_gah(B_SET_INDEXED_COLORS, NULL);
|
||||||
if (sic != NULL)
|
if (sic != NULL)
|
||||||
sic(colorCount, first_index, (uint8 *)fColorList, 0);
|
sic(colorCount, first_index, (uint8 *)fColorList, 0);
|
||||||
@@ -475,7 +475,7 @@ BWindowScreen::SetSpace(uint32 space)
|
|||||||
bool
|
bool
|
||||||
BWindowScreen::CanControlFrameBuffer()
|
BWindowScreen::CanControlFrameBuffer()
|
||||||
{
|
{
|
||||||
return (fAddonState == 1 && (fCardInfo.flags & B_FRAME_BUFFER_CONTROL));
|
return (fAddonImage >= 0 && (fCardInfo.flags & B_FRAME_BUFFER_CONTROL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -546,7 +546,7 @@ BWindowScreen::FrameBufferInfo()
|
|||||||
graphics_card_hook
|
graphics_card_hook
|
||||||
BWindowScreen::CardHookAt(int32 index)
|
BWindowScreen::CardHookAt(int32 index)
|
||||||
{
|
{
|
||||||
if (fAddonState != 1)
|
if (fAddonImage < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
graphics_card_hook hook = NULL;
|
graphics_card_hook hook = NULL;
|
||||||
@@ -680,11 +680,11 @@ BWindowScreen::CalcFrame(int32 index, int32 space, display_mode *dmode)
|
|||||||
status_t
|
status_t
|
||||||
BWindowScreen::SetFullscreen(bool enable)
|
BWindowScreen::SetFullscreen(bool enable)
|
||||||
{
|
{
|
||||||
status_t retval = B_ERROR;
|
status_t status = B_ERROR;
|
||||||
|
|
||||||
// TODO: Set fullscreen
|
// TODO: Set fullscreen
|
||||||
|
|
||||||
return retval;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -701,8 +701,7 @@ BWindowScreen::InitData(uint32 space, uint32 attributes)
|
|||||||
fAttributes = attributes;
|
fAttributes = attributes;
|
||||||
fScreenIndex = current_workspace();
|
fScreenIndex = current_workspace();
|
||||||
fLockState = 0;
|
fLockState = 0;
|
||||||
fAddonState = 0;
|
fAddonImage = -1;
|
||||||
direct_enable = 0;
|
|
||||||
fWindowState = 0;
|
fWindowState = 0;
|
||||||
fDebugWorkspace = 0;
|
fDebugWorkspace = 0;
|
||||||
|
|
||||||
@@ -728,8 +727,10 @@ BWindowScreen::InitData(uint32 space, uint32 attributes)
|
|||||||
|
|
||||||
memcpy(fColorList, screen.ColorMap()->color_list, 256);
|
memcpy(fColorList, screen.ColorMap()->color_list, 256);
|
||||||
|
|
||||||
GetCardInfo();
|
status = GetCardInfo();
|
||||||
|
if (status < B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
fActivateSem = create_sem(0, "WindowScreen start lock");
|
fActivateSem = create_sem(0, "WindowScreen start lock");
|
||||||
fActivateState = 0;
|
fActivateState = 0;
|
||||||
|
|
||||||
@@ -801,7 +802,7 @@ status_t
|
|||||||
BWindowScreen::SetLockState(int32 state)
|
BWindowScreen::SetLockState(int32 state)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
if (fAddonState == 1 && state == 1) {
|
if (fAddonImage >= 0 && state == 1) {
|
||||||
m_wei();
|
m_wei();
|
||||||
fill_rect_global = NULL;
|
fill_rect_global = NULL;
|
||||||
blit_rect_global = NULL;
|
blit_rect_global = NULL;
|
||||||
@@ -820,19 +821,17 @@ BWindowScreen::SetLockState(int32 state)
|
|||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
fLockState = state;
|
fLockState = state;
|
||||||
if (state == 1) {
|
if (state == 1) {
|
||||||
if (fAddonState == 0) {
|
if (fAddonImage < 0) {
|
||||||
status = InitClone();
|
status = InitClone();
|
||||||
printf("InitClone() returned %s\n", strerror(status));
|
printf("InitClone() returned %s\n", strerror(status));
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
fAddonState = 1;
|
|
||||||
m_wei = (wait_engine_idle)m_gah(B_WAIT_ENGINE_IDLE, NULL);
|
m_wei = (wait_engine_idle)m_gah(B_WAIT_ENGINE_IDLE, NULL);
|
||||||
m_re = (release_engine)m_gah(B_RELEASE_ENGINE, NULL);
|
m_re = (release_engine)m_gah(B_RELEASE_ENGINE, NULL);
|
||||||
m_ae = (acquire_engine)m_gah(B_ACQUIRE_ENGINE, NULL);
|
m_ae = (acquire_engine)m_gah(B_ACQUIRE_ENGINE, NULL);
|
||||||
} else
|
}
|
||||||
fAddonState = -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fAddonState == 1 && state == 1) {
|
if (status == B_OK && state == 1) {
|
||||||
fill_rect_global = fill_rect;
|
fill_rect_global = fill_rect;
|
||||||
blit_rect_global = blit_rect;
|
blit_rect_global = blit_rect;
|
||||||
trans_blit_rect_global = trans_blit_rect;
|
trans_blit_rect_global = trans_blit_rect;
|
||||||
@@ -850,15 +849,17 @@ BWindowScreen::SetLockState(int32 state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
status_t
|
||||||
BWindowScreen::GetCardInfo()
|
BWindowScreen::GetCardInfo()
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
|
|
||||||
BScreen screen(this);
|
BScreen screen(this);
|
||||||
display_mode mode;
|
display_mode mode;
|
||||||
if (screen.GetMode(&mode) < B_OK)
|
|
||||||
return;
|
status_t status = screen.GetMode(&mode);
|
||||||
|
if (status < B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
uint32 bitsPerPixel;
|
uint32 bitsPerPixel;
|
||||||
switch(mode.space & 0x0fff) {
|
switch(mode.space & 0x0fff) {
|
||||||
@@ -894,22 +895,24 @@ BWindowScreen::GetCardInfo()
|
|||||||
if (mode.flags & B_PARALLEL_ACCESS)
|
if (mode.flags & B_PARALLEL_ACCESS)
|
||||||
fCardInfo.flags |= B_PARALLEL_BUFFER_ACCESS;
|
fCardInfo.flags |= B_PARALLEL_BUFFER_ACCESS;
|
||||||
|
|
||||||
status_t result = B_ERROR;
|
|
||||||
|
|
||||||
frame_buffer_config config;
|
frame_buffer_config config;
|
||||||
AppServerLink link;
|
AppServerLink link;
|
||||||
link.StartMessage(AS_GET_FRAME_BUFFER_CONFIG);
|
link.StartMessage(AS_GET_FRAME_BUFFER_CONFIG);
|
||||||
link.Attach<screen_id>(screen.ID());
|
link.Attach<screen_id>(screen.ID());
|
||||||
if (link.FlushWithReply(result) == B_OK && result == B_OK)
|
|
||||||
link.Read<frame_buffer_config>(&config);
|
|
||||||
|
|
||||||
if (result == B_OK) {
|
status_t result = B_ERROR;
|
||||||
fCardInfo.id = screen.ID().id;
|
if (link.FlushWithReply(result) < B_OK || result < B_OK)
|
||||||
fCardInfo.frame_buffer = config.frame_buffer;
|
return result;
|
||||||
fCardInfo.bytes_per_row = config.bytes_per_row;
|
|
||||||
}
|
link.Read<frame_buffer_config>(&config);
|
||||||
|
|
||||||
|
fCardInfo.id = screen.ID().id;
|
||||||
|
fCardInfo.frame_buffer = config.frame_buffer;
|
||||||
|
fCardInfo.bytes_per_row = config.bytes_per_row;
|
||||||
|
|
||||||
memcpy(&card_info_global, &fCardInfo, sizeof(graphics_card_info));
|
memcpy(&card_info_global, &fCardInfo, sizeof(graphics_card_info));
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -983,6 +986,9 @@ BWindowScreen::GetModeFromSpace(uint32 space, display_mode *dmode)
|
|||||||
status_t
|
status_t
|
||||||
BWindowScreen::InitClone()
|
BWindowScreen::InitClone()
|
||||||
{
|
{
|
||||||
|
if (fAddonImage >= 0)
|
||||||
|
return B_OK;
|
||||||
|
|
||||||
CALLED();
|
CALLED();
|
||||||
AppServerLink link;
|
AppServerLink link;
|
||||||
link.StartMessage(AS_GET_ACCELERANT_NAME);
|
link.StartMessage(AS_GET_ACCELERANT_NAME);
|
||||||
@@ -995,12 +1001,16 @@ BWindowScreen::InitClone()
|
|||||||
BString accelerantName;
|
BString accelerantName;
|
||||||
link.ReadString(accelerantName);
|
link.ReadString(accelerantName);
|
||||||
fAddonImage = load_add_on(accelerantName.String());
|
fAddonImage = load_add_on(accelerantName.String());
|
||||||
if (fAddonImage < B_OK)
|
if (fAddonImage < B_OK) {
|
||||||
|
printf("InitClone: cannot load accelerant image\n");
|
||||||
return fAddonImage;
|
return fAddonImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status = get_image_symbol(fAddonImage, "get_accelerant_hook", B_SYMBOL_TYPE_ANY, (void **)&m_gah);
|
status = get_image_symbol(fAddonImage, B_ACCELERANT_ENTRY_POINT,
|
||||||
|
B_SYMBOL_TYPE_ANY, (void **)&m_gah);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
|
printf("InitClone: cannot get accelerant entry point\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
fAddonImage = -1;
|
fAddonImage = -1;
|
||||||
return status;
|
return status;
|
||||||
@@ -1008,6 +1018,7 @@ BWindowScreen::InitClone()
|
|||||||
|
|
||||||
clone_accelerant clone = (clone_accelerant)m_gah(B_CLONE_ACCELERANT, 0);
|
clone_accelerant clone = (clone_accelerant)m_gah(B_CLONE_ACCELERANT, 0);
|
||||||
if (clone == NULL) {
|
if (clone == NULL) {
|
||||||
|
printf("InitClone: cannot get clone hook\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
fAddonImage = -1;
|
fAddonImage = -1;
|
||||||
return status;
|
return status;
|
||||||
@@ -1023,6 +1034,7 @@ BWindowScreen::InitClone()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
|
printf("InitClone: cannot clone accelerant\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
fAddonImage = -1;
|
fAddonImage = -1;
|
||||||
}
|
}
|
||||||
@@ -1034,17 +1046,19 @@ BWindowScreen::InitClone()
|
|||||||
status_t
|
status_t
|
||||||
BWindowScreen::AssertDisplayMode(display_mode *dmode)
|
BWindowScreen::AssertDisplayMode(display_mode *dmode)
|
||||||
{
|
{
|
||||||
status_t result = B_OK;
|
status_t status = B_OK;
|
||||||
|
|
||||||
// TODO: Assert display mode: negotiation with app server
|
// TODO: Assert display mode: negotiation with app server
|
||||||
|
|
||||||
if (result == B_OK) {
|
if (status == B_OK) {
|
||||||
memcpy(fDisplayMode, dmode, sizeof(display_mode));
|
memcpy(fDisplayMode, dmode, sizeof(display_mode));
|
||||||
space_mode = 1;
|
space_mode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
GetCardInfo();
|
status = GetCardInfo();
|
||||||
|
if (status < B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
fFrameBufferInfo.bits_per_pixel = fCardInfo.bits_per_pixel;
|
fFrameBufferInfo.bits_per_pixel = fCardInfo.bits_per_pixel;
|
||||||
fFrameBufferInfo.bytes_per_row = fCardInfo.bytes_per_row;
|
fFrameBufferInfo.bytes_per_row = fCardInfo.bytes_per_row;
|
||||||
fFrameBufferInfo.width = fCardInfo.width;
|
fFrameBufferInfo.width = fCardInfo.width;
|
||||||
@@ -1054,5 +1068,5 @@ BWindowScreen::AssertDisplayMode(display_mode *dmode)
|
|||||||
fFrameBufferInfo.display_x = 0;
|
fFrameBufferInfo.display_x = 0;
|
||||||
fFrameBufferInfo.display_y = 0;
|
fFrameBufferInfo.display_y = 0;
|
||||||
|
|
||||||
return result;
|
return status;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user