added DPMS functions to HWInterface as well as Initatialze and Shutdown, added a couple of TODO comments

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12058 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-03-26 23:23:40 +00:00
parent 4594032d1a
commit c3314ff5eb
4 changed files with 81 additions and 76 deletions

View File

@ -695,27 +695,45 @@ DisplayDriverPainter::StrokeLineArray(const int32 &numlines,
status_t
DisplayDriverPainter::SetDPMSMode(const uint32 &state)
{
return B_ERROR;
status_t ret = B_ERROR;
if (Lock()) {
ret = fGraphicsCard->SetDPMSMode(state);
Unlock();
}
return ret;
}
// DPMSMode
uint32
DisplayDriverPainter::DPMSMode() const
{
return 0;
/* uint32 mode = 0;
if (Lock()) {
mode = fGraphicsCard->DPMSMode();
Unlock();
}
return mode;*/
return fGraphicsCard->DPMSMode();
}
// DPMSCapabilities
uint32
DisplayDriverPainter::DPMSCapabilities() const
{
return 0;
/* uint32 caps = 0;
if (Lock()) {
caps = fGraphicsCard->DPMSMode();
Unlock();
}
return caps;*/
return fGraphicsCard->DPMSMode();;
}
// GetDeviceInfo
status_t
DisplayDriverPainter::GetDeviceInfo(accelerant_device_info *info)
{
// TODO: locking?
return fGraphicsCard->GetDeviceInfo(info);
}
@ -723,6 +741,7 @@ DisplayDriverPainter::GetDeviceInfo(accelerant_device_info *info)
status_t
DisplayDriverPainter::GetModeList(display_mode **mode_list, uint32 *count)
{
// TODO: locking?
return fGraphicsCard->GetModeList(mode_list, count);
}
@ -731,6 +750,7 @@ status_t DisplayDriverPainter::GetPixelClockLimits(display_mode *mode,
uint32 *low,
uint32 *high)
{
// TODO: locking?
return fGraphicsCard->GetPixelClockLimits(mode, low, high);
}
@ -738,6 +758,7 @@ status_t DisplayDriverPainter::GetPixelClockLimits(display_mode *mode,
status_t
DisplayDriverPainter::GetTimingConstraints(display_timing_constraints *dtc)
{
// TODO: locking?
return fGraphicsCard->GetTimingConstraints(dtc);
}
@ -747,6 +768,7 @@ DisplayDriverPainter::ProposeMode(display_mode *candidate,
const display_mode *low,
const display_mode *high)
{
// TODO: locking?
return fGraphicsCard->ProposeMode(candidate, low, high);
}

View File

@ -21,6 +21,9 @@ class HWInterface {
HWInterface();
virtual ~HWInterface();
virtual status_t Initialize() = 0;
virtual status_t Shutdown() = 0;
virtual status_t SetMode(const display_mode &mode) = 0;
// virtual void GetMode(display_mode *mode) = 0;
@ -38,6 +41,10 @@ class HWInterface {
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT) = 0;
virtual status_t SetDPMSMode(const uint32 &state) = 0;
virtual uint32 DPMSMode() const = 0;
virtual uint32 DPMSCapabilities() const = 0;
// frame buffer access
virtual RenderingBuffer* FrontBuffer() const = 0;
virtual RenderingBuffer* BackBuffer() const = 0;

View File

@ -579,41 +579,20 @@ ViewHWInterface::~ViewHWInterface()
delete fBackBuffer;
delete fFrontBuffer;
}
/*
bool
// Initialize
status_t
ViewHWInterface::Initialize()
{
Lock();
// the screen should start black
framebuffer->Lock();
rgb_color c; c.red = 0; c.blue = 0; c.green = 0; c.alpha = 255;
drawview->SetHighColor(c);
drawview->FillRect(drawview->Bounds());
drawview->Sync();
framebuffer->Unlock();
hide_cursor=0;
obscure_cursor=false;
is_initialized=true;
// We can afford to call the above functions without locking
// because the window is locked until Show() is first called
screenwin->Show();
Unlock();
return DisplayDriver::Initialize();
return B_OK;
}
void ViewHWInterface::Shutdown()
// Shutdown
status_t
ViewHWInterface::Shutdown()
{
DisplayDriver::Shutdown();
Lock();
is_initialized=false;
Unlock();
}*/
return B_OK;
}
// SetMode
status_t
@ -701,33 +680,9 @@ ViewHWInterface::SetMode(const display_mode &mode)
return ret;
}
/*
status_t ViewHWInterface::SetDPMSMode(const uint32 &state)
{
if(!is_initialized)
return B_ERROR;
// NOTE: Originally, this was a to-do item to implement software DPMS,
// but this driver will not be the official testing driver, so implementing
// this stuff the way it was intended -- blanking the server's screen but not
// the physical monitor -- is moot, but we will support blanking the
// actual monitor if it is supported.
return BScreen().SetDPMS(state);
}
uint32 ViewHWInterface::DPMSMode() const
{
// See note for SetDPMSMode if there are questions
return BScreen().DPMSState();
}
uint32 ViewHWInterface::DPMSCapabilities() const
{
// See note for SetDPMSMode if there are questions
return BScreen().DPMSCapabilites();
}
*/
status_t ViewHWInterface::GetDeviceInfo(accelerant_device_info *info)
// GetDeviceInfo
status_t
ViewHWInterface::GetDeviceInfo(accelerant_device_info *info)
{
// if(!info || !is_initialized)
// return B_ERROR;
@ -745,7 +700,9 @@ status_t ViewHWInterface::GetDeviceInfo(accelerant_device_info *info)
return B_OK;
}
status_t ViewHWInterface::GetModeList(display_mode **modes, uint32 *count)
// GetModeList
status_t
ViewHWInterface::GetModeList(display_mode **modes, uint32 *count)
{
// if(!count || !is_initialized)
// return B_ERROR;
@ -814,40 +771,52 @@ status_t ViewHWInterface::GetModeList(display_mode **modes, uint32 *count)
return B_OK;
}
status_t ViewHWInterface::GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high)
status_t
ViewHWInterface::GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high)
{
// if(!is_initialized)
// return B_ERROR;
return B_ERROR;
}
status_t ViewHWInterface::GetTimingConstraints(display_timing_constraints *dtc)
status_t
ViewHWInterface::GetTimingConstraints(display_timing_constraints *dtc)
{
// if(!is_initialized)
// return B_ERROR;
return B_ERROR;
}
status_t ViewHWInterface::ProposeMode(display_mode *candidate, const display_mode *low, const display_mode *high)
status_t
ViewHWInterface::ProposeMode(display_mode *candidate, const display_mode *low, const display_mode *high)
{
// if(!is_initialized)
// return B_ERROR;
// We should be able to get away with this because we're not dealing with any
// specific hardware. This is a Good Thing(TM) because we can support any hardware
// we wish within reasonable expectaions and programmer laziness. :P
return B_OK;
}
// SetDPMSMode
status_t
ViewHWInterface::SetDPMSMode(const uint32 &state)
{
return BScreen().SetDPMS(state);
}
// DPMSMode
uint32
ViewHWInterface::DPMSMode() const
{
return BScreen().DPMSState();
}
// DPMSCapabilities
uint32
ViewHWInterface::DPMSCapabilities() const
{
return BScreen().DPMSCapabilites();
}
// WaitForRetrace
status_t
ViewHWInterface::WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT)
{
// if(!is_initialized)
// return B_ERROR;
// Locking shouldn't be necessary here - R5 should handle this for us. :)
BScreen screen;
return screen.WaitForRetrace(timeout);

View File

@ -25,6 +25,9 @@ class ViewHWInterface : public HWInterface {
ViewHWInterface();
virtual ~ViewHWInterface();
virtual status_t Initialize();
virtual status_t Shutdown();
virtual status_t SetMode(const display_mode &mode);
// virtual void GetMode(display_mode *mode);
@ -42,6 +45,10 @@ class ViewHWInterface : public HWInterface {
virtual status_t WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT);
virtual status_t SetDPMSMode(const uint32 &state);
virtual uint32 DPMSMode() const;
virtual uint32 DPMSCapabilities() const;
// frame buffer access
virtual RenderingBuffer* FrontBuffer() const;
virtual RenderingBuffer* BackBuffer() const;