diff --git a/src/servers/app/drawing/DisplayDriverPainter.cpp b/src/servers/app/drawing/DisplayDriverPainter.cpp index 33ebfc1f0d..cf8337513c 100644 --- a/src/servers/app/drawing/DisplayDriverPainter.cpp +++ b/src/servers/app/drawing/DisplayDriverPainter.cpp @@ -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); } diff --git a/src/servers/app/drawing/HWInterface.h b/src/servers/app/drawing/HWInterface.h index f9207e0a99..66fd785275 100644 --- a/src/servers/app/drawing/HWInterface.h +++ b/src/servers/app/drawing/HWInterface.h @@ -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; diff --git a/src/servers/app/drawing/ViewHWInterface.cpp b/src/servers/app/drawing/ViewHWInterface.cpp index 6c9531f7af..a3e857cfab 100644 --- a/src/servers/app/drawing/ViewHWInterface.cpp +++ b/src/servers/app/drawing/ViewHWInterface.cpp @@ -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); diff --git a/src/servers/app/drawing/ViewHWInterface.h b/src/servers/app/drawing/ViewHWInterface.h index b837b2a85a..5375f2e277 100644 --- a/src/servers/app/drawing/ViewHWInterface.h +++ b/src/servers/app/drawing/ViewHWInterface.h @@ -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;