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:
@@ -695,27 +695,45 @@ DisplayDriverPainter::StrokeLineArray(const int32 &numlines,
|
|||||||
status_t
|
status_t
|
||||||
DisplayDriverPainter::SetDPMSMode(const uint32 &state)
|
DisplayDriverPainter::SetDPMSMode(const uint32 &state)
|
||||||
{
|
{
|
||||||
return B_ERROR;
|
status_t ret = B_ERROR;
|
||||||
|
if (Lock()) {
|
||||||
|
ret = fGraphicsCard->SetDPMSMode(state);
|
||||||
|
Unlock();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// DPMSMode
|
// DPMSMode
|
||||||
uint32
|
uint32
|
||||||
DisplayDriverPainter::DPMSMode() const
|
DisplayDriverPainter::DPMSMode() const
|
||||||
{
|
{
|
||||||
return 0;
|
/* uint32 mode = 0;
|
||||||
|
if (Lock()) {
|
||||||
|
mode = fGraphicsCard->DPMSMode();
|
||||||
|
Unlock();
|
||||||
|
}
|
||||||
|
return mode;*/
|
||||||
|
return fGraphicsCard->DPMSMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// DPMSCapabilities
|
// DPMSCapabilities
|
||||||
uint32
|
uint32
|
||||||
DisplayDriverPainter::DPMSCapabilities() const
|
DisplayDriverPainter::DPMSCapabilities() const
|
||||||
{
|
{
|
||||||
return 0;
|
/* uint32 caps = 0;
|
||||||
|
if (Lock()) {
|
||||||
|
caps = fGraphicsCard->DPMSMode();
|
||||||
|
Unlock();
|
||||||
|
}
|
||||||
|
return caps;*/
|
||||||
|
return fGraphicsCard->DPMSMode();;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDeviceInfo
|
// GetDeviceInfo
|
||||||
status_t
|
status_t
|
||||||
DisplayDriverPainter::GetDeviceInfo(accelerant_device_info *info)
|
DisplayDriverPainter::GetDeviceInfo(accelerant_device_info *info)
|
||||||
{
|
{
|
||||||
|
// TODO: locking?
|
||||||
return fGraphicsCard->GetDeviceInfo(info);
|
return fGraphicsCard->GetDeviceInfo(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -723,6 +741,7 @@ DisplayDriverPainter::GetDeviceInfo(accelerant_device_info *info)
|
|||||||
status_t
|
status_t
|
||||||
DisplayDriverPainter::GetModeList(display_mode **mode_list, uint32 *count)
|
DisplayDriverPainter::GetModeList(display_mode **mode_list, uint32 *count)
|
||||||
{
|
{
|
||||||
|
// TODO: locking?
|
||||||
return fGraphicsCard->GetModeList(mode_list, count);
|
return fGraphicsCard->GetModeList(mode_list, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -731,6 +750,7 @@ status_t DisplayDriverPainter::GetPixelClockLimits(display_mode *mode,
|
|||||||
uint32 *low,
|
uint32 *low,
|
||||||
uint32 *high)
|
uint32 *high)
|
||||||
{
|
{
|
||||||
|
// TODO: locking?
|
||||||
return fGraphicsCard->GetPixelClockLimits(mode, low, high);
|
return fGraphicsCard->GetPixelClockLimits(mode, low, high);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -738,6 +758,7 @@ status_t DisplayDriverPainter::GetPixelClockLimits(display_mode *mode,
|
|||||||
status_t
|
status_t
|
||||||
DisplayDriverPainter::GetTimingConstraints(display_timing_constraints *dtc)
|
DisplayDriverPainter::GetTimingConstraints(display_timing_constraints *dtc)
|
||||||
{
|
{
|
||||||
|
// TODO: locking?
|
||||||
return fGraphicsCard->GetTimingConstraints(dtc);
|
return fGraphicsCard->GetTimingConstraints(dtc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -747,6 +768,7 @@ DisplayDriverPainter::ProposeMode(display_mode *candidate,
|
|||||||
const display_mode *low,
|
const display_mode *low,
|
||||||
const display_mode *high)
|
const display_mode *high)
|
||||||
{
|
{
|
||||||
|
// TODO: locking?
|
||||||
return fGraphicsCard->ProposeMode(candidate, low, high);
|
return fGraphicsCard->ProposeMode(candidate, low, high);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ class HWInterface {
|
|||||||
HWInterface();
|
HWInterface();
|
||||||
virtual ~HWInterface();
|
virtual ~HWInterface();
|
||||||
|
|
||||||
|
virtual status_t Initialize() = 0;
|
||||||
|
virtual status_t Shutdown() = 0;
|
||||||
|
|
||||||
virtual status_t SetMode(const display_mode &mode) = 0;
|
virtual status_t SetMode(const display_mode &mode) = 0;
|
||||||
// virtual void GetMode(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 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
|
// frame buffer access
|
||||||
virtual RenderingBuffer* FrontBuffer() const = 0;
|
virtual RenderingBuffer* FrontBuffer() const = 0;
|
||||||
virtual RenderingBuffer* BackBuffer() const = 0;
|
virtual RenderingBuffer* BackBuffer() const = 0;
|
||||||
|
|||||||
@@ -579,41 +579,20 @@ ViewHWInterface::~ViewHWInterface()
|
|||||||
delete fBackBuffer;
|
delete fBackBuffer;
|
||||||
delete fFrontBuffer;
|
delete fFrontBuffer;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
bool
|
// Initialize
|
||||||
|
status_t
|
||||||
ViewHWInterface::Initialize()
|
ViewHWInterface::Initialize()
|
||||||
{
|
{
|
||||||
Lock();
|
return B_OK;
|
||||||
|
|
||||||
// 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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewHWInterface::Shutdown()
|
// Shutdown
|
||||||
|
status_t
|
||||||
|
ViewHWInterface::Shutdown()
|
||||||
{
|
{
|
||||||
DisplayDriver::Shutdown();
|
return B_OK;
|
||||||
|
}
|
||||||
Lock();
|
|
||||||
is_initialized=false;
|
|
||||||
Unlock();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// SetMode
|
// SetMode
|
||||||
status_t
|
status_t
|
||||||
@@ -701,33 +680,9 @@ ViewHWInterface::SetMode(const display_mode &mode)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// GetDeviceInfo
|
||||||
status_t ViewHWInterface::SetDPMSMode(const uint32 &state)
|
status_t
|
||||||
{
|
ViewHWInterface::GetDeviceInfo(accelerant_device_info *info)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
// if(!info || !is_initialized)
|
// if(!info || !is_initialized)
|
||||||
// return B_ERROR;
|
// return B_ERROR;
|
||||||
@@ -745,7 +700,9 @@ status_t ViewHWInterface::GetDeviceInfo(accelerant_device_info *info)
|
|||||||
return B_OK;
|
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)
|
// if(!count || !is_initialized)
|
||||||
// return B_ERROR;
|
// return B_ERROR;
|
||||||
@@ -814,40 +771,52 @@ status_t ViewHWInterface::GetModeList(display_mode **modes, uint32 *count)
|
|||||||
return B_OK;
|
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;
|
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;
|
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
|
// 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
|
// specific hardware. This is a Good Thing(TM) because we can support any hardware
|
||||||
// we wish within reasonable expectaions and programmer laziness. :P
|
// we wish within reasonable expectaions and programmer laziness. :P
|
||||||
return B_OK;
|
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
|
// WaitForRetrace
|
||||||
status_t
|
status_t
|
||||||
ViewHWInterface::WaitForRetrace(bigtime_t timeout = B_INFINITE_TIMEOUT)
|
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. :)
|
// Locking shouldn't be necessary here - R5 should handle this for us. :)
|
||||||
BScreen screen;
|
BScreen screen;
|
||||||
return screen.WaitForRetrace(timeout);
|
return screen.WaitForRetrace(timeout);
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ class ViewHWInterface : public HWInterface {
|
|||||||
ViewHWInterface();
|
ViewHWInterface();
|
||||||
virtual ~ViewHWInterface();
|
virtual ~ViewHWInterface();
|
||||||
|
|
||||||
|
virtual status_t Initialize();
|
||||||
|
virtual status_t Shutdown();
|
||||||
|
|
||||||
virtual status_t SetMode(const display_mode &mode);
|
virtual status_t SetMode(const display_mode &mode);
|
||||||
// virtual void GetMode(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 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
|
// frame buffer access
|
||||||
virtual RenderingBuffer* FrontBuffer() const;
|
virtual RenderingBuffer* FrontBuffer() const;
|
||||||
virtual RenderingBuffer* BackBuffer() const;
|
virtual RenderingBuffer* BackBuffer() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user