moved the place of implementation of locking in DisplayDriver, because the Painter version has it elsewhere. the DisplayDriver locking API is now abstract, the same locking is now in DisplayDriverImpl, Painter version uses HWInterface for locking
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12084 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3c46b74895
commit
53115c9920
@ -38,8 +38,7 @@
|
||||
\brief Sets up internal variables needed by all DisplayDriver subclasses
|
||||
*/
|
||||
DisplayDriver::DisplayDriver()
|
||||
: fLocker("DisplayDriver lock"),
|
||||
fCursorHandler(this),
|
||||
: fCursorHandler(this),
|
||||
fDPMSState(B_DPMS_ON),
|
||||
fDPMSCaps(B_DPMS_ON)
|
||||
{
|
||||
@ -205,33 +204,6 @@ DisplayDriver::IsCursorObscured(bool state)
|
||||
return obscured;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Locks the driver
|
||||
\param timeout Optional timeout specifier
|
||||
\return True if the lock was successful, false if not.
|
||||
|
||||
The return value need only be checked if a timeout was specified. Each public
|
||||
member function should lock the driver before doing anything else. Functions
|
||||
internal to the driver (protected/private) need not do this.
|
||||
*/
|
||||
bool
|
||||
DisplayDriver::Lock(bigtime_t timeout)
|
||||
{
|
||||
if (timeout == B_INFINITE_TIMEOUT)
|
||||
return fLocker.Lock();
|
||||
|
||||
return (fLocker.LockWithTimeout(timeout) == B_OK) ? true : false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Unlocks the driver
|
||||
*/
|
||||
void
|
||||
DisplayDriver::Unlock()
|
||||
{
|
||||
fLocker.Unlock();
|
||||
}
|
||||
|
||||
// Protected Internal Functions
|
||||
/*
|
||||
\brief Sets the screen mode to specified resolution and color depth.
|
||||
|
@ -50,7 +50,8 @@ static Blitter blitter;
|
||||
\brief Sets up internal variables needed by all DisplayDriverImpl subclasses
|
||||
*/
|
||||
DisplayDriverImpl::DisplayDriverImpl()
|
||||
: DisplayDriver()
|
||||
: DisplayDriver(),
|
||||
fLocker("DisplayDriver lock")
|
||||
{
|
||||
}
|
||||
|
||||
@ -2271,6 +2272,33 @@ void DisplayDriverImpl::GetTruncatedStrings(const char **instrings,const int32 &
|
||||
// TODO: Implement DisplayDriverImpl::GetTruncatedStrings
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Locks the driver
|
||||
\param timeout Optional timeout specifier
|
||||
\return True if the lock was successful, false if not.
|
||||
|
||||
The return value need only be checked if a timeout was specified. Each public
|
||||
member function should lock the driver before doing anything else. Functions
|
||||
internal to the driver (protected/private) need not do this.
|
||||
*/
|
||||
bool
|
||||
DisplayDriverImpl::Lock(bigtime_t timeout)
|
||||
{
|
||||
if (timeout == B_INFINITE_TIMEOUT)
|
||||
return fLocker.Lock();
|
||||
|
||||
return (fLocker.LockWithTimeout(timeout) == B_OK) ? true : false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Unlocks the driver
|
||||
*/
|
||||
void
|
||||
DisplayDriverImpl::Unlock()
|
||||
{
|
||||
fLocker.Unlock();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Dumps the contents of the frame buffer to a file.
|
||||
\param path Path and leaf of the file to be created without an extension
|
||||
|
@ -656,6 +656,26 @@ DisplayDriverPainter::GetTruncatedStrings(const char **instrings,
|
||||
printf("DisplayDriverPainter::GetTruncatedStrings()\n");
|
||||
}
|
||||
|
||||
// Lock
|
||||
bool
|
||||
DisplayDriverPainter::Lock(bigtime_t timeout)
|
||||
{
|
||||
// NOTE: I'm hoping I don't change the semantics and implications of
|
||||
// the original implementation, but I need the locker to be somewhere
|
||||
// else in order to serialize only the access to the back buffer
|
||||
if (timeout == B_INFINITE_TIMEOUT)
|
||||
return fGraphicsCard->Lock();
|
||||
|
||||
return (fGraphicsCard->LockWithTimeout(timeout) >= B_OK) ? true : false;
|
||||
}
|
||||
|
||||
// Unlock
|
||||
void
|
||||
DisplayDriverPainter::Unlock()
|
||||
{
|
||||
fGraphicsCard->Unlock();
|
||||
}
|
||||
|
||||
// SetMode
|
||||
void
|
||||
DisplayDriverPainter::SetMode(const display_mode &mode)
|
||||
|
@ -217,6 +217,9 @@ class DisplayDriverPainter : public DisplayDriver {
|
||||
const float &maxwidth,
|
||||
char **outstrings);
|
||||
|
||||
virtual bool Lock(bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
virtual void Unlock();
|
||||
|
||||
/* virtual void HideCursor();
|
||||
virtual bool IsCursorHidden();
|
||||
virtual void MoveCursorTo( const float &x,
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
// constructor
|
||||
HWInterface::HWInterface()
|
||||
: BLocker("hw interface lock")
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -11,12 +11,13 @@
|
||||
|
||||
#include <Accelerant.h>
|
||||
#include <GraphicsCard.h>
|
||||
#include <Locker.h>
|
||||
#include <OS.h>
|
||||
|
||||
class RenderingBuffer;
|
||||
class BRect;
|
||||
|
||||
class HWInterface {
|
||||
class HWInterface : public BLocker {
|
||||
public:
|
||||
HWInterface();
|
||||
virtual ~HWInterface();
|
||||
|
@ -50,10 +50,10 @@ UpdateQueue::InitCheck()
|
||||
void
|
||||
UpdateQueue::AddRect(const BRect& rect)
|
||||
{
|
||||
Lock();
|
||||
// Lock();
|
||||
fUpdateRegion.Include(rect);
|
||||
_Reschedule();
|
||||
Unlock();
|
||||
// Unlock();
|
||||
}
|
||||
|
||||
// _execute_updates_
|
||||
@ -76,16 +76,13 @@ UpdateQueue::_ExecuteUpdates()
|
||||
case B_OK:
|
||||
case B_TIMED_OUT:
|
||||
// execute updates
|
||||
if (Lock()) {
|
||||
// if (fInterface->Lock()) {
|
||||
int32 count = fUpdateRegion.CountRects();
|
||||
for (int32 i = 0; i < count; i++) {
|
||||
fInterface->CopyBackToFront(fUpdateRegion.RectAt(i));
|
||||
}
|
||||
// fInterface->Unlock();
|
||||
fUpdateRegion.MakeEmpty();
|
||||
// }
|
||||
Unlock();
|
||||
if (fInterface->LockWithTimeout(20000) >= B_OK) {
|
||||
int32 count = fUpdateRegion.CountRects();
|
||||
for (int32 i = 0; i < count; i++) {
|
||||
fInterface->CopyBackToFront(fUpdateRegion.RectAt(i));
|
||||
}
|
||||
fUpdateRegion.MakeEmpty();
|
||||
fInterface->Unlock();
|
||||
}
|
||||
break;
|
||||
case B_BAD_SEM_ID:
|
||||
|
@ -840,10 +840,14 @@ ViewHWInterface::BackBuffer() const
|
||||
status_t
|
||||
ViewHWInterface::Invalidate(const BRect& frame)
|
||||
{
|
||||
// TODO: get this working, figure out semaphores...
|
||||
return CopyBackToFront(frame);;
|
||||
|
||||
// TODO: get this working, the locking in the DisplayDriverPainter needs
|
||||
// to be based on locking this object, which essentially means the access
|
||||
// to the back buffer is locked, or more precise the access to the invalid
|
||||
// region scheduled to be copied to the front buffer
|
||||
// fUpdateExecutor->AddRect(frame);
|
||||
// return B_OK;
|
||||
return CopyBackToFront(frame);
|
||||
}
|
||||
|
||||
// CopyBackToFront
|
||||
|
Loading…
Reference in New Issue
Block a user