diff options
author | Dan Gittik <dangittik@google.com> | 2019-01-18 19:30:24 +0000 |
---|---|---|
committer | Michael Wright <michaelwr@google.com> | 2019-03-05 20:15:45 +0000 |
commit | 10510ff31b0120e27710123c5a4d44a72fa15ed9 (patch) | |
tree | 9b0ef13678ac865b5407e29352f4fa98af120f3f | |
parent | 5b78d419541a4e88077772da82160dfad82561e2 (diff) | |
download | libhardware-10510ff31b0120e27710123c5a4d44a72fa15ed9.tar.gz |
Moved brightness from Lights to SF.
Test: manual.
Check that brightness works.
Fixes: 111435292
Change-Id: I1a741bd57c8e2ce0841c5e25ee6f5c8e866f192a
-rw-r--r-- | include/hardware/hwcomposer2.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h index c8b17dcc..ab0922eb 100644 --- a/include/hardware/hwcomposer2.h +++ b/include/hardware/hwcomposer2.h @@ -280,6 +280,8 @@ typedef enum { HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED, HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE, HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS, + HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT, + HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS, } hwc2_function_descriptor_t; /* Layer requests returned from getDisplayRequests */ @@ -405,6 +407,11 @@ typedef enum { * PowerMode::DOZE_SUSPEND. */ HWC2_DISPLAY_CAPABILITY_DOZE = 2, + + /** + * Specified that the display supports brightness operations. + */ + HWC2_DISPLAY_CAPABILITY_BRIGHTNESS = 3, } hwc2_display_capability_t; /* @@ -593,6 +600,8 @@ static inline const char* getFunctionDescriptorName( case HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED: return "SetDisplayedContentSamplingEnabled"; case HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE: return "GetDisplayedContentSample"; case HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS: return "SetLayerPerFrameMetadataBlobs"; + case HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT: return "GetDisplayBrightnessSupport"; + case HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS: return "SetDisplayBrightness"; default: return "Unknown"; } } @@ -665,6 +674,8 @@ static inline const char* getDisplayCapabilityName(hwc2_display_capability_t cap return "SkipClientColorTransform"; case HWC2_DISPLAY_CAPABILITY_DOZE: return "Doze"; + case HWC2_DISPLAY_CAPABILITY_BRIGHTNESS: + return "Brightness"; default: return "Unknown"; } @@ -832,6 +843,8 @@ enum class FunctionDescriptor : int32_t { SetDisplayedContentSamplingEnabled = HWC2_FUNCTION_SET_DISPLAYED_CONTENT_SAMPLING_ENABLED, GetDisplayedContentSample = HWC2_FUNCTION_GET_DISPLAYED_CONTENT_SAMPLE, SetLayerPerFrameMetadataBlobs = HWC2_FUNCTION_SET_LAYER_PER_FRAME_METADATA_BLOBS, + GetDisplayBrightnessSupport = HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT, + SetDisplayBrightness = HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS, }; TO_STRING(hwc2_function_descriptor_t, FunctionDescriptor, getFunctionDescriptorName) @@ -872,6 +885,7 @@ enum class DisplayCapability : int32_t { Invalid = HWC2_DISPLAY_CAPABILITY_INVALID, SkipClientColorTransform = HWC2_DISPLAY_CAPABILITY_SKIP_CLIENT_COLOR_TRANSFORM, Doze = HWC2_DISPLAY_CAPABILITY_DOZE, + Brightness = HWC2_DISPLAY_CAPABILITY_BRIGHTNESS, }; TO_STRING(hwc2_display_capability_t, DisplayCapability, getDisplayCapabilityName) @@ -2673,6 +2687,42 @@ typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_DISPLAY_CAPABILITIES)( hwc2_device_t* device, hwc2_display_t display, uint32_t* outNumCapabilities, uint32_t* outCapabilities); +/* getDisplayBrightnessSupport(displayToken) + * Descriptor: HWC2_FUNCTION_GET_DISPLAY_BRIGHTNESS_SUPPORT + * Required for HWC2 devices for composer 2.3 + * Optional for HWC2 devices for composer 2.1 and 2.2 + * + * getDisplayBrightnessSupport returns whether brightness operations are supported on a display. + * + * Parameters: + * outSupport - whether the display supports operations. + * + * Returns HWC2_ERROR_NONE or one of the following errors: + * HWC2_ERROR_BAD_DISPLAY when the display is invalid. + */ +typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_GET_DISPLAY_BRIGHTNESS_SUPPORT)(hwc2_device_t* device, + hwc2_display_t display, bool* outSupport); + +/* setDisplayBrightness(displayToken, brightnesss) + * Descriptor: HWC2_FUNCTION_SET_DISPLAY_BRIGHTNESS + * Required for HWC2 devices for composer 2.3 + * Optional for HWC2 devices for composer 2.1 and 2.2 + * + * setDisplayBrightness sets the brightness of a display. + * + * Parameters: + * brightness - a number between 0.0f (minimum brightness) and 1.0f (maximum brightness), or + * -1.0f to turn the backlight off. + * + * Returns HWC2_ERROR_NONE or one of the following errors: + * HWC2_ERROR_BAD_DISPLAY when the display is invalid, or + * HWC2_ERROR_UNSUPPORTED when brightness operations are not supported, or + * HWC2_ERROR_BAD_PARAMETER when the brightness is invalid, or + * HWC2_ERROR_NO_RESOURCES when the brightness cannot be applied. + */ +typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_SET_DISPLAY_BRIGHTNESS)(hwc2_device_t* device, + hwc2_display_t display, float brightness); + __END_DECLS #endif |