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:
Adrien Destugues
2017-11-21 09:12:18 +01:00
parent c5f9934cd8
commit 3a2b67b5ae
28 changed files with 318 additions and 1 deletions
+5
View File
@@ -52,6 +52,8 @@ enum {
B_GET_PREFERRED_DISPLAY_MODE, /* optional */
B_GET_MONITOR_INFO, /* optional */
B_GET_EDID_INFO, /* optional */
B_SET_BRIGHTNESS, /* optional */
B_GET_BRIGHTNESS, /* optional */
/* cursor managment */
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_monitor_info)(monitor_info* info);
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 status_t (*set_cursor_shape)(uint16 width, uint16 height,
+3
View File
@@ -82,6 +82,9 @@ public:
uint32 DPMSState();
uint32 DPMSCapabilites();
status_t GetBrightness(float*);
status_t SetBrightness(float);
private:
// Forbidden and deprecated methods
BScreen(const BScreen& other);
+3
View File
@@ -174,6 +174,9 @@ enum {
AS_GET_DPMS_STATE,
AS_GET_DPMS_CAPABILITIES,
AS_SCREEN_SET_BRIGHTNESS,
AS_SCREEN_GET_BRIGHTNESS,
// Misc stuff
AS_GET_ACCELERANT_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_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
#define COMMAND_NOOP 0x00
@@ -82,6 +82,9 @@ public:
uint32 DPMSState();
uint32 DPMSCapabilites();
status_t GetBrightness(float*);
status_t SetBrightness(float);
void* BaseAddress();
uint32 BytesPerRow();