Support for configuring screen backlight
Accelerant interface: Introduce new hooks B_SET_BRIGHTNESS and B_GET_BRIGHTNESS. Brightness is a float in the 0..1 range. App_server: Forward brightness things between BScreen and the accelerant. intel_extreme: Implement the hooks. Note that this only works for laptop panels, but the driver will pretend to support it in other cases as well. Screen preferences: If the accelerant supports the B_GET_BRIGHTNESS hook, allow to set brightness with a slider. Otherwise, the slidere is hidden and these changes aren't visible.
This commit is contained in:
@@ -52,6 +52,8 @@ enum {
|
|||||||
B_GET_PREFERRED_DISPLAY_MODE, /* optional */
|
B_GET_PREFERRED_DISPLAY_MODE, /* optional */
|
||||||
B_GET_MONITOR_INFO, /* optional */
|
B_GET_MONITOR_INFO, /* optional */
|
||||||
B_GET_EDID_INFO, /* optional */
|
B_GET_EDID_INFO, /* optional */
|
||||||
|
B_SET_BRIGHTNESS, /* optional */
|
||||||
|
B_GET_BRIGHTNESS, /* optional */
|
||||||
|
|
||||||
/* cursor managment */
|
/* cursor managment */
|
||||||
B_MOVE_CURSOR = 0x200, /* optional */
|
B_MOVE_CURSOR = 0x200, /* optional */
|
||||||
@@ -305,6 +307,9 @@ typedef status_t (*set_dpms_mode)(uint32 dpms_flags);
|
|||||||
typedef status_t (*get_preferred_display_mode)(display_mode* preferredMode);
|
typedef status_t (*get_preferred_display_mode)(display_mode* preferredMode);
|
||||||
typedef status_t (*get_monitor_info)(monitor_info* info);
|
typedef status_t (*get_monitor_info)(monitor_info* info);
|
||||||
typedef status_t (*get_edid_info)(void* info, uint32 size, uint32* _version);
|
typedef status_t (*get_edid_info)(void* info, uint32 size, uint32* _version);
|
||||||
|
typedef status_t (*set_brightness)(float brightness);
|
||||||
|
typedef status_t (*get_brightness)(float* brightness);
|
||||||
|
|
||||||
typedef sem_id (*accelerant_retrace_semaphore)(void);
|
typedef sem_id (*accelerant_retrace_semaphore)(void);
|
||||||
|
|
||||||
typedef status_t (*set_cursor_shape)(uint16 width, uint16 height,
|
typedef status_t (*set_cursor_shape)(uint16 width, uint16 height,
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ public:
|
|||||||
uint32 DPMSState();
|
uint32 DPMSState();
|
||||||
uint32 DPMSCapabilites();
|
uint32 DPMSCapabilites();
|
||||||
|
|
||||||
|
status_t GetBrightness(float*);
|
||||||
|
status_t SetBrightness(float);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Forbidden and deprecated methods
|
// Forbidden and deprecated methods
|
||||||
BScreen(const BScreen& other);
|
BScreen(const BScreen& other);
|
||||||
|
|||||||
@@ -174,6 +174,9 @@ enum {
|
|||||||
AS_GET_DPMS_STATE,
|
AS_GET_DPMS_STATE,
|
||||||
AS_GET_DPMS_CAPABILITIES,
|
AS_GET_DPMS_CAPABILITIES,
|
||||||
|
|
||||||
|
AS_SCREEN_SET_BRIGHTNESS,
|
||||||
|
AS_SCREEN_GET_BRIGHTNESS,
|
||||||
|
|
||||||
// Misc stuff
|
// Misc stuff
|
||||||
AS_GET_ACCELERANT_PATH,
|
AS_GET_ACCELERANT_PATH,
|
||||||
AS_GET_DRIVER_PATH,
|
AS_GET_DRIVER_PATH,
|
||||||
|
|||||||
@@ -809,6 +809,11 @@ struct intel_free_graphics_memory {
|
|||||||
#define PANEL_DIVISOR_POW_CYCLE_DLY_MASK 0x1f
|
#define PANEL_DIVISOR_POW_CYCLE_DLY_MASK 0x1f
|
||||||
#define PANEL_DIVISOR_POW_CYCLE_DLY_SHIFT 0x1f
|
#define PANEL_DIVISOR_POW_CYCLE_DLY_SHIFT 0x1f
|
||||||
|
|
||||||
|
// Backlight control registers
|
||||||
|
#define INTEL_BLC_PWM_CTL2 (0x8250 | REGS_NORTH_SHARED)
|
||||||
|
#define INTEL_BLC_PWM_CTL (0x8254 | REGS_NORTH_SHARED)
|
||||||
|
#define INTEL_SBLC_PWM_CTL2 (0x8254 | REGS_SOUTH_SHARED)
|
||||||
|
|
||||||
// ring buffer commands
|
// ring buffer commands
|
||||||
|
|
||||||
#define COMMAND_NOOP 0x00
|
#define COMMAND_NOOP 0x00
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ public:
|
|||||||
uint32 DPMSState();
|
uint32 DPMSState();
|
||||||
uint32 DPMSCapabilites();
|
uint32 DPMSCapabilites();
|
||||||
|
|
||||||
|
status_t GetBrightness(float*);
|
||||||
|
status_t SetBrightness(float);
|
||||||
|
|
||||||
void* BaseAddress();
|
void* BaseAddress();
|
||||||
uint32 BytesPerRow();
|
uint32 BytesPerRow();
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ status_t intel_propose_display_mode(display_mode* target,
|
|||||||
status_t intel_set_display_mode(display_mode* mode);
|
status_t intel_set_display_mode(display_mode* mode);
|
||||||
status_t intel_get_display_mode(display_mode* currentMode);
|
status_t intel_get_display_mode(display_mode* currentMode);
|
||||||
status_t intel_get_edid_info(void* info, size_t size, uint32* _version);
|
status_t intel_get_edid_info(void* info, size_t size, uint32* _version);
|
||||||
|
status_t intel_set_brightness(float brightness);
|
||||||
|
status_t intel_get_brightness(float* brightness);
|
||||||
status_t intel_get_frame_buffer_config(frame_buffer_config* config);
|
status_t intel_get_frame_buffer_config(frame_buffer_config* config);
|
||||||
status_t intel_get_pixel_clock_limits(display_mode* mode, uint32* low,
|
status_t intel_get_pixel_clock_limits(display_mode* mode, uint32* low,
|
||||||
uint32* high);
|
uint32* high);
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ get_accelerant_hook(uint32 feature, void* data)
|
|||||||
#ifdef __HAIKU__
|
#ifdef __HAIKU__
|
||||||
case B_GET_EDID_INFO:
|
case B_GET_EDID_INFO:
|
||||||
return (void*)intel_get_edid_info;
|
return (void*)intel_get_edid_info;
|
||||||
|
case B_SET_BRIGHTNESS:
|
||||||
|
return (void*)intel_set_brightness;
|
||||||
|
case B_GET_BRIGHTNESS:
|
||||||
|
return (void*)intel_get_brightness;
|
||||||
#endif
|
#endif
|
||||||
case B_GET_FRAME_BUFFER_CONFIG:
|
case B_GET_FRAME_BUFFER_CONFIG:
|
||||||
return (void*)intel_get_frame_buffer_config;
|
return (void*)intel_get_frame_buffer_config;
|
||||||
|
|||||||
@@ -659,6 +659,37 @@ intel_get_edid_info(void* info, size_t size, uint32* _version)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
intel_set_brightness(float brightness)
|
||||||
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
|
if (brightness < 0 || brightness > 1)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
uint16_t sblc = read32(INTEL_SBLC_PWM_CTL2) >> 16;
|
||||||
|
write32(INTEL_BLC_PWM_CTL, (uint32_t)(sblc * brightness));
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
intel_get_brightness(float* brightness)
|
||||||
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
|
if (brightness == NULL)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
uint16_t sblc = read32(INTEL_SBLC_PWM_CTL2) >> 16;
|
||||||
|
uint16_t blc = read32( INTEL_BLC_PWM_CTL );
|
||||||
|
*brightness = (float)blc / sblc;
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
intel_get_frame_buffer_config(frame_buffer_config* config)
|
intel_get_frame_buffer_config(frame_buffer_config* config)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -678,6 +678,39 @@ BPrivateScreen::DPMSCapabilites()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BPrivateScreen::GetBrightness(float* brightness)
|
||||||
|
{
|
||||||
|
if (brightness == NULL)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
|
BPrivate::AppServerLink link;
|
||||||
|
link.StartMessage(AS_SCREEN_GET_BRIGHTNESS);
|
||||||
|
link.Attach<int32>(ID());
|
||||||
|
|
||||||
|
status_t status;
|
||||||
|
if (link.FlushWithReply(status) == B_OK && status == B_OK)
|
||||||
|
link.Read<float>(brightness);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BPrivateScreen::SetBrightness(float brightness)
|
||||||
|
{
|
||||||
|
BPrivate::AppServerLink link;
|
||||||
|
link.StartMessage(AS_SCREEN_SET_BRIGHTNESS);
|
||||||
|
link.Attach<int32>(ID());
|
||||||
|
link.Attach<float>(brightness);
|
||||||
|
|
||||||
|
status_t status = B_ERROR;
|
||||||
|
link.FlushWithReply(status);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void *
|
void *
|
||||||
BPrivateScreen::BaseAddress()
|
BPrivateScreen::BaseAddress()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -333,6 +333,24 @@ BScreen::DPMSCapabilites()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BScreen::GetBrightness(float* brightness)
|
||||||
|
{
|
||||||
|
if (fScreen != NULL)
|
||||||
|
return fScreen->GetBrightness(brightness);
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BScreen::SetBrightness(float brightness)
|
||||||
|
{
|
||||||
|
if (fScreen != NULL)
|
||||||
|
return fScreen->SetBrightness(brightness);
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - Deprecated methods
|
// #pragma mark - Deprecated methods
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ static const uint32 POP_TV_STANDARD_MSG = 'ptvs';
|
|||||||
static const uint32 UPDATE_DESKTOP_MSG = 'udsk';
|
static const uint32 UPDATE_DESKTOP_MSG = 'udsk';
|
||||||
static const uint32 SLIDER_MODIFICATION_MSG = 'sldm';
|
static const uint32 SLIDER_MODIFICATION_MSG = 'sldm';
|
||||||
static const uint32 SLIDER_INVOKE_MSG = 'sldi';
|
static const uint32 SLIDER_INVOKE_MSG = 'sldi';
|
||||||
|
static const uint32 SLIDER_BRIGHTNESS_MSG = 'brig';
|
||||||
static const uint32 SET_CUSTOM_REFRESH_MSG = 'scrf';
|
static const uint32 SET_CUSTOM_REFRESH_MSG = 'scrf';
|
||||||
static const uint32 DIM_COUNT_MSG = 'scrf';
|
static const uint32 DIM_COUNT_MSG = 'scrf';
|
||||||
static const uint32 MAKE_INITIAL_MSG = 'mkin';
|
static const uint32 MAKE_INITIAL_MSG = 'mkin';
|
||||||
|
|||||||
@@ -506,6 +506,22 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
|
|||||||
.Add(fTVStandardField->CreateMenuBarLayoutItem(), 1, 6)
|
.Add(fTVStandardField->CreateMenuBarLayoutItem(), 1, 6)
|
||||||
.End();
|
.End();
|
||||||
|
|
||||||
|
fBrightnessSlider = new BSlider("brightness", "Brightness",
|
||||||
|
NULL, 0, 255, B_HORIZONTAL);
|
||||||
|
|
||||||
|
status_t result = screen.GetBrightness(&fOriginalBrightness);
|
||||||
|
if (result == B_OK) {
|
||||||
|
fBrightnessSlider->SetModificationMessage(
|
||||||
|
new BMessage(SLIDER_BRIGHTNESS_MSG));
|
||||||
|
fBrightnessSlider->SetValue(fOriginalBrightness * 255);
|
||||||
|
} else {
|
||||||
|
// The driver does not support changing the brightness,
|
||||||
|
// so hide the slider
|
||||||
|
fBrightnessSlider->Hide();
|
||||||
|
|
||||||
|
fOriginalBrightness = -1;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: we don't support getting the screen's preferred settings
|
// TODO: we don't support getting the screen's preferred settings
|
||||||
/* fDefaultsButton = new BButton(buttonRect, "DefaultsButton", "Defaults",
|
/* fDefaultsButton = new BButton(buttonRect, "DefaultsButton", "Defaults",
|
||||||
new BMessage(BUTTON_DEFAULTS_MSG));*/
|
new BMessage(BUTTON_DEFAULTS_MSG));*/
|
||||||
@@ -529,7 +545,10 @@ ScreenWindow::ScreenWindow(ScreenSettings* settings)
|
|||||||
.AddStrut(floorf(controlsBox->TopBorderOffset()) - 1)
|
.AddStrut(floorf(controlsBox->TopBorderOffset()) - 1)
|
||||||
.Add(screenBox)
|
.Add(screenBox)
|
||||||
.End()
|
.End()
|
||||||
|
.AddGroup(B_VERTICAL, 0, 1)
|
||||||
.Add(controlsBox, 2)
|
.Add(controlsBox, 2)
|
||||||
|
.Add(fBrightnessSlider)
|
||||||
|
.End()
|
||||||
.End()
|
.End()
|
||||||
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
|
.AddGroup(B_HORIZONTAL, B_USE_DEFAULT_SPACING)
|
||||||
.Add(fRevertButton)
|
.Add(fRevertButton)
|
||||||
@@ -1118,6 +1137,10 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
fScreenMode.Revert();
|
fScreenMode.Revert();
|
||||||
_UpdateActiveMode();
|
_UpdateActiveMode();
|
||||||
|
|
||||||
|
BScreen screen(this);
|
||||||
|
screen.SetBrightness(fOriginalBrightness);
|
||||||
|
fBrightnessSlider->SetValue(fOriginalBrightness * 255);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1135,6 +1158,14 @@ ScreenWindow::MessageReceived(BMessage* message)
|
|||||||
PostMessage(message, fMonitorView);
|
PostMessage(message, fMonitorView);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SLIDER_BRIGHTNESS_MSG:
|
||||||
|
{
|
||||||
|
BScreen screen(this);
|
||||||
|
screen.SetBrightness(message->FindInt32("be:value") / 255.f);
|
||||||
|
_CheckApplyEnabled();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BWindow::MessageReceived(message);
|
BWindow::MessageReceived(message);
|
||||||
}
|
}
|
||||||
@@ -1214,8 +1245,13 @@ ScreenWindow::_CheckApplyEnabled()
|
|||||||
uint32 rows;
|
uint32 rows;
|
||||||
BPrivate::get_workspaces_layout(&columns, &rows);
|
BPrivate::get_workspaces_layout(&columns, &rows);
|
||||||
|
|
||||||
|
BScreen screen(this);
|
||||||
|
float brightness = -1;
|
||||||
|
screen.GetBrightness(&brightness);
|
||||||
|
|
||||||
fRevertButton->SetEnabled(columns != fOriginalWorkspacesColumns
|
fRevertButton->SetEnabled(columns != fOriginalWorkspacesColumns
|
||||||
|| rows != fOriginalWorkspacesRows
|
|| rows != fOriginalWorkspacesRows
|
||||||
|
|| brightness != fOriginalBrightness
|
||||||
|| fSelected != fOriginal);
|
|| fSelected != fOriginal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
class BBox;
|
class BBox;
|
||||||
class BPopUpMenu;
|
class BPopUpMenu;
|
||||||
class BMenuField;
|
class BMenuField;
|
||||||
|
class BSlider;
|
||||||
class BSpinner;
|
class BSpinner;
|
||||||
class BStringView;
|
class BStringView;
|
||||||
|
|
||||||
@@ -95,6 +96,8 @@ private:
|
|||||||
BPopUpMenu* fTVStandardMenu;
|
BPopUpMenu* fTVStandardMenu;
|
||||||
BMenuField* fTVStandardField;
|
BMenuField* fTVStandardField;
|
||||||
|
|
||||||
|
BSlider* fBrightnessSlider;
|
||||||
|
|
||||||
BButton* fDefaultsButton;
|
BButton* fDefaultsButton;
|
||||||
BButton* fApplyButton;
|
BButton* fApplyButton;
|
||||||
BButton* fRevertButton;
|
BButton* fRevertButton;
|
||||||
@@ -110,6 +113,7 @@ private:
|
|||||||
|
|
||||||
uint32 fOriginalWorkspacesColumns;
|
uint32 fOriginalWorkspacesColumns;
|
||||||
uint32 fOriginalWorkspacesRows;
|
uint32 fOriginalWorkspacesRows;
|
||||||
|
float fOriginalBrightness;
|
||||||
bool fModified;
|
bool fModified;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -155,6 +155,9 @@ string_for_message_code(uint32 code, BString& string)
|
|||||||
CODE(AS_GET_DPMS_STATE);
|
CODE(AS_GET_DPMS_STATE);
|
||||||
CODE(AS_GET_DPMS_CAPABILITIES);
|
CODE(AS_GET_DPMS_CAPABILITIES);
|
||||||
|
|
||||||
|
CODE(AS_SCREEN_SET_BRIGHTNESS);
|
||||||
|
CODE(AS_SCREEN_GET_BRIGHTNESS);
|
||||||
|
|
||||||
// Misc stuff
|
// Misc stuff
|
||||||
CODE(AS_GET_ACCELERANT_PATH);
|
CODE(AS_GET_ACCELERANT_PATH);
|
||||||
CODE(AS_GET_DRIVER_PATH);
|
CODE(AS_GET_DRIVER_PATH);
|
||||||
|
|||||||
@@ -3050,6 +3050,37 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AS_SCREEN_SET_BRIGHTNESS:
|
||||||
|
{
|
||||||
|
STRACE(("ServerApp %s: AS_SCREEN_SET_BRIGHTNESS\n", Signature()));
|
||||||
|
int32 id;
|
||||||
|
link.Read<int32>(&id);
|
||||||
|
|
||||||
|
float brightness;
|
||||||
|
link.Read<float>(&brightness);
|
||||||
|
|
||||||
|
status_t status = fDesktop->HWInterface()->SetBrightness(brightness);
|
||||||
|
fLink.StartMessage(status);
|
||||||
|
|
||||||
|
fLink.Flush();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case AS_SCREEN_GET_BRIGHTNESS:
|
||||||
|
{
|
||||||
|
STRACE(("ServerApp %s: AS_SCREEN_GET_BRIGHTNESS\n", Signature()));
|
||||||
|
int32 id;
|
||||||
|
link.Read<int32>(&id);
|
||||||
|
|
||||||
|
float brightness;
|
||||||
|
status_t result = fDesktop->HWInterface()->GetBrightness(&brightness);
|
||||||
|
fLink.StartMessage(result);
|
||||||
|
if (result == B_OK)
|
||||||
|
fLink.Attach<float>(brightness);
|
||||||
|
fLink.Flush();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case AS_READ_BITMAP:
|
case AS_READ_BITMAP:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: AS_READ_BITMAP\n", Signature()));
|
STRACE(("ServerApp %s: AS_READ_BITMAP\n", Signature()));
|
||||||
|
|||||||
@@ -176,6 +176,20 @@ BitmapHWInterface::DPMSCapabilities()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BitmapHWInterface::SetBrightness(float)
|
||||||
|
{
|
||||||
|
return B_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BitmapHWInterface::GetBrightness(float*)
|
||||||
|
{
|
||||||
|
return B_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RenderingBuffer*
|
RenderingBuffer*
|
||||||
BitmapHWInterface::FrontBuffer() const
|
BitmapHWInterface::FrontBuffer() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ public:
|
|||||||
virtual uint32 DPMSMode();
|
virtual uint32 DPMSMode();
|
||||||
virtual uint32 DPMSCapabilities();
|
virtual uint32 DPMSCapabilities();
|
||||||
|
|
||||||
|
virtual status_t SetBrightness(float);
|
||||||
|
virtual status_t GetBrightness(float*);
|
||||||
|
|
||||||
// frame buffer access
|
// frame buffer access
|
||||||
virtual RenderingBuffer* FrontBuffer() const;
|
virtual RenderingBuffer* FrontBuffer() const;
|
||||||
virtual RenderingBuffer* BackBuffer() const;
|
virtual RenderingBuffer* BackBuffer() const;
|
||||||
|
|||||||
@@ -912,6 +912,24 @@ DWindowHWInterface::DPMSCapabilities()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
DWindowHWInterface::SetBrightness(float brightness)
|
||||||
|
{
|
||||||
|
AutoReadLocker _(this);
|
||||||
|
|
||||||
|
return BScreen().SetBrightness(brightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
DWindowHWInterface::GetBrightness(float* brightness)
|
||||||
|
{
|
||||||
|
AutoReadLocker _(this);
|
||||||
|
|
||||||
|
return BScreen().GetBrightness(brightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
DWindowHWInterface::AvailableHWAcceleration() const
|
DWindowHWInterface::AvailableHWAcceleration() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ public:
|
|||||||
virtual uint32 DPMSMode();
|
virtual uint32 DPMSMode();
|
||||||
virtual uint32 DPMSCapabilities();
|
virtual uint32 DPMSCapabilities();
|
||||||
|
|
||||||
|
virtual status_t SetBrightness(float);
|
||||||
|
virtual status_t GetBrightness(float*);
|
||||||
|
|
||||||
// query for available hardware accleration and perform it
|
// query for available hardware accleration and perform it
|
||||||
virtual uint32 AvailableHWAcceleration() const;
|
virtual uint32 AvailableHWAcceleration() const;
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,9 @@ public:
|
|||||||
virtual uint32 DPMSMode() = 0;
|
virtual uint32 DPMSMode() = 0;
|
||||||
virtual uint32 DPMSCapabilities() = 0;
|
virtual uint32 DPMSCapabilities() = 0;
|
||||||
|
|
||||||
|
virtual status_t SetBrightness(float) = 0;
|
||||||
|
virtual status_t GetBrightness(float*) = 0;
|
||||||
|
|
||||||
virtual status_t GetAccelerantPath(BString& path);
|
virtual status_t GetAccelerantPath(BString& path);
|
||||||
virtual status_t GetDriverPath(BString& path);
|
virtual status_t GetDriverPath(BString& path);
|
||||||
|
|
||||||
|
|||||||
@@ -734,6 +734,24 @@ ViewHWInterface::DPMSCapabilities()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
ViewHWInterface::SetBrightness(float)
|
||||||
|
{
|
||||||
|
AutoReadLocker _(this);
|
||||||
|
|
||||||
|
return BScreen().SetBrightness(float);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
ViewHWInterface::GetBrightness(float*)
|
||||||
|
{
|
||||||
|
AutoReadLocker _(this);
|
||||||
|
|
||||||
|
return BScreen().GetBrightness(float);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sem_id
|
sem_id
|
||||||
ViewHWInterface::RetraceSemaphore()
|
ViewHWInterface::RetraceSemaphore()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,6 +51,9 @@ public:
|
|||||||
virtual uint32 DPMSMode();
|
virtual uint32 DPMSMode();
|
||||||
virtual uint32 DPMSCapabilities();
|
virtual uint32 DPMSCapabilities();
|
||||||
|
|
||||||
|
virtual status_t SetBrightness(float);
|
||||||
|
virtual status_t GetBrightness(float*);
|
||||||
|
|
||||||
// frame buffer access
|
// frame buffer access
|
||||||
virtual RenderingBuffer* FrontBuffer() const;
|
virtual RenderingBuffer* FrontBuffer() const;
|
||||||
virtual RenderingBuffer* BackBuffer() const;
|
virtual RenderingBuffer* BackBuffer() const;
|
||||||
|
|||||||
@@ -516,6 +516,20 @@ HTML5HWInterface::RetraceSemaphore()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
HTML5HWInterface::SetBrightness(float)
|
||||||
|
{
|
||||||
|
return B_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
HTML5HWInterface::GetBrightness(float*)
|
||||||
|
{
|
||||||
|
return B_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
HTML5HWInterface::WaitForRetrace(bigtime_t timeout)
|
HTML5HWInterface::WaitForRetrace(bigtime_t timeout)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,6 +62,9 @@ virtual status_t SetDPMSMode(uint32 state);
|
|||||||
virtual uint32 DPMSMode();
|
virtual uint32 DPMSMode();
|
||||||
virtual uint32 DPMSCapabilities();
|
virtual uint32 DPMSCapabilities();
|
||||||
|
|
||||||
|
virtual status_t SetBrightness(float);
|
||||||
|
virtual status_t GetBrightness(float*);
|
||||||
|
|
||||||
// cursor handling
|
// cursor handling
|
||||||
virtual void SetCursor(ServerCursor* cursor);
|
virtual void SetCursor(ServerCursor* cursor);
|
||||||
virtual void SetCursorVisible(bool visible);
|
virtual void SetCursorVisible(bool visible);
|
||||||
|
|||||||
@@ -133,6 +133,10 @@ AccelerantHWInterface::AccelerantHWInterface()
|
|||||||
fAccDPMSMode(NULL),
|
fAccDPMSMode(NULL),
|
||||||
fAccSetDPMSMode(NULL),
|
fAccSetDPMSMode(NULL),
|
||||||
|
|
||||||
|
// brightness hooks
|
||||||
|
fAccSetBrightness(NULL),
|
||||||
|
fAccGetBrightness(NULL),
|
||||||
|
|
||||||
// overlay hooks
|
// overlay hooks
|
||||||
fAccOverlayCount(NULL),
|
fAccOverlayCount(NULL),
|
||||||
fAccOverlaySupportedSpaces(NULL),
|
fAccOverlaySupportedSpaces(NULL),
|
||||||
@@ -401,6 +405,10 @@ AccelerantHWInterface::_SetupDefaultHooks()
|
|||||||
fAccDPMSMode = (dpms_mode)fAccelerantHook(B_DPMS_MODE, NULL);
|
fAccDPMSMode = (dpms_mode)fAccelerantHook(B_DPMS_MODE, NULL);
|
||||||
fAccSetDPMSMode = (set_dpms_mode)fAccelerantHook(B_SET_DPMS_MODE, NULL);
|
fAccSetDPMSMode = (set_dpms_mode)fAccelerantHook(B_SET_DPMS_MODE, NULL);
|
||||||
|
|
||||||
|
// brightness
|
||||||
|
fAccGetBrightness = (get_brightness)fAccelerantHook(B_GET_BRIGHTNESS, NULL);
|
||||||
|
fAccSetBrightness = (set_brightness)fAccelerantHook(B_SET_BRIGHTNESS, NULL);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1113,6 +1121,30 @@ AccelerantHWInterface::DPMSCapabilities()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
AccelerantHWInterface::SetBrightness(float brightness)
|
||||||
|
{
|
||||||
|
AutoReadLocker _(this);
|
||||||
|
|
||||||
|
if (!fAccSetBrightness)
|
||||||
|
return B_UNSUPPORTED;
|
||||||
|
|
||||||
|
return fAccSetBrightness(brightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
AccelerantHWInterface::GetBrightness(float* brightness)
|
||||||
|
{
|
||||||
|
AutoReadLocker _(this);
|
||||||
|
|
||||||
|
if (!fAccGetBrightness)
|
||||||
|
return B_UNSUPPORTED;
|
||||||
|
|
||||||
|
return fAccGetBrightness(brightness);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AccelerantHWInterface::GetAccelerantPath(BString& string)
|
AccelerantHWInterface::GetAccelerantPath(BString& string)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ public:
|
|||||||
virtual uint32 DPMSMode();
|
virtual uint32 DPMSMode();
|
||||||
virtual uint32 DPMSCapabilities();
|
virtual uint32 DPMSCapabilities();
|
||||||
|
|
||||||
|
virtual status_t SetBrightness(float);
|
||||||
|
virtual status_t GetBrightness(float*);
|
||||||
|
|
||||||
virtual status_t GetAccelerantPath(BString& path);
|
virtual status_t GetAccelerantPath(BString& path);
|
||||||
virtual status_t GetDriverPath(BString& path);
|
virtual status_t GetDriverPath(BString& path);
|
||||||
|
|
||||||
@@ -159,6 +162,10 @@ private:
|
|||||||
dpms_mode fAccDPMSMode;
|
dpms_mode fAccDPMSMode;
|
||||||
set_dpms_mode fAccSetDPMSMode;
|
set_dpms_mode fAccSetDPMSMode;
|
||||||
|
|
||||||
|
// brightness hooks
|
||||||
|
set_brightness fAccSetBrightness;
|
||||||
|
get_brightness fAccGetBrightness;
|
||||||
|
|
||||||
// overlay hooks
|
// overlay hooks
|
||||||
overlay_count fAccOverlayCount;
|
overlay_count fAccOverlayCount;
|
||||||
overlay_supported_spaces fAccOverlaySupportedSpaces;
|
overlay_supported_spaces fAccOverlaySupportedSpaces;
|
||||||
|
|||||||
@@ -468,6 +468,20 @@ RemoteHWInterface::DPMSCapabilities()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
RemoteHWInterface::SetBrightness(float)
|
||||||
|
{
|
||||||
|
return B_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
RemoteHWInterface::GetBrightness(float*)
|
||||||
|
{
|
||||||
|
return B_UNSUPPORTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sem_id
|
sem_id
|
||||||
RemoteHWInterface::RetraceSemaphore()
|
RemoteHWInterface::RetraceSemaphore()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,6 +59,9 @@ virtual status_t SetDPMSMode(uint32 state);
|
|||||||
virtual uint32 DPMSMode();
|
virtual uint32 DPMSMode();
|
||||||
virtual uint32 DPMSCapabilities();
|
virtual uint32 DPMSCapabilities();
|
||||||
|
|
||||||
|
virtual status_t SetBrightness(float);
|
||||||
|
virtual status_t GetBrightness(float*);
|
||||||
|
|
||||||
// cursor handling
|
// cursor handling
|
||||||
virtual void SetCursor(ServerCursor* cursor);
|
virtual void SetCursor(ServerCursor* cursor);
|
||||||
virtual void SetCursorVisible(bool visible);
|
virtual void SetCursorVisible(bool visible);
|
||||||
|
|||||||
Reference in New Issue
Block a user