* improved getting the retrace semaphore, now the PrivateScreen

will not try to retrieve the retrace semaphore again and again
  if the graphics cards doesn't support it for some reason
* disabled BScreen::WaitForRetarce() for now, since it will just
  hang on ATI Radeon at least


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17266 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2006-04-29 16:46:21 +00:00
parent 9ac741b2d2
commit 5ec797a76f
3 changed files with 18 additions and 5 deletions

View File

@ -213,12 +213,19 @@ BPrivateScreen::GetNextID(screen_id& id)
status_t
BPrivateScreen::WaitForRetrace(bigtime_t timeout)
{
// TODO: remove when interrupts are enabled again in the ATI driver
return B_ERROR;
// Get the retrace semaphore if it's the first time
// we are called. Cache the value then.
status_t status;
if (fRetraceSem < 0)
if (!fRetraceSemValid)
fRetraceSem = _RetraceSemaphore();
if (fRetraceSem < 0) {
// syncing to retrace is not supported by the accelerant
return fRetraceSem;
}
status_t status;
do {
status = acquire_sem_etc(fRetraceSem, 1, B_RELATIVE_TIMEOUT, timeout);
} while (status == B_INTERRUPTED);
@ -633,7 +640,11 @@ BPrivateScreen::_RetraceSemaphore()
link.Attach<screen_id>(ID());
sem_id id = B_BAD_SEM_ID;
link.FlushWithReply(id);
status_t status = B_ERROR;
if (link.FlushWithReply(status) == B_OK && status == B_OK) {
link.Read<sem_id>(&id);
fRetraceSemValid = true;
}
return id;
}
@ -661,6 +672,7 @@ BPrivateScreen::BPrivateScreen(screen_id id)
fID(id),
fColorMap(NULL),
fRetraceSem(-1),
fRetraceSemValid(false),
fOwnsColorMap(false),
fFrame(0, 0, 0, 0),
fLastUpdate(0)

View File

@ -89,6 +89,7 @@ class BPrivateScreen {
int32 fRefCount;
color_map* fColorMap;
sem_id fRetraceSem;
bool fRetraceSemValid;
bool fOwnsColorMap;
BRect fFrame;
bigtime_t fLastUpdate;

View File

@ -2188,8 +2188,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
screen_id id;
link.Read<screen_id>(&id);
sem_id semaphore = fDesktop->HWInterface()->RetraceSemaphore();
fLink.StartMessage(semaphore);
fLink.StartMessage(B_OK);
fLink.Attach<sem_id>(fDesktop->HWInterface()->RetraceSemaphore());
fLink.Flush();
break;
}