From 5ec797a76f3bbb8ac83678bd568cee1d2e767d86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 29 Apr 2006 16:46:21 +0000 Subject: [PATCH] * 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 --- src/kits/interface/PrivateScreen.cpp | 18 +++++++++++++++--- src/kits/interface/PrivateScreen.h | 1 + src/servers/app/ServerApp.cpp | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/kits/interface/PrivateScreen.cpp b/src/kits/interface/PrivateScreen.cpp index e45db1c0fc..f824ab54cb 100644 --- a/src/kits/interface/PrivateScreen.cpp +++ b/src/kits/interface/PrivateScreen.cpp @@ -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(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(&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) diff --git a/src/kits/interface/PrivateScreen.h b/src/kits/interface/PrivateScreen.h index 6443e37149..03cdf10f29 100644 --- a/src/kits/interface/PrivateScreen.h +++ b/src/kits/interface/PrivateScreen.h @@ -89,6 +89,7 @@ class BPrivateScreen { int32 fRefCount; color_map* fColorMap; sem_id fRetraceSem; + bool fRetraceSemValid; bool fOwnsColorMap; BRect fFrame; bigtime_t fLastUpdate; diff --git a/src/servers/app/ServerApp.cpp b/src/servers/app/ServerApp.cpp index 22caec1bd6..cff603322f 100644 --- a/src/servers/app/ServerApp.cpp +++ b/src/servers/app/ServerApp.cpp @@ -2188,8 +2188,8 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link) screen_id id; link.Read(&id); - sem_id semaphore = fDesktop->HWInterface()->RetraceSemaphore(); - fLink.StartMessage(semaphore); + fLink.StartMessage(B_OK); + fLink.Attach(fDesktop->HWInterface()->RetraceSemaphore()); fLink.Flush(); break; }