diff options
author | Peiyong Lin <lpy@google.com> | 2018-01-22 12:23:25 -0800 |
---|---|---|
committer | Peiyong Lin <lpy@google.com> | 2018-01-24 18:12:41 +0000 |
commit | fd05d13edcf20c04c40467e9445f8f442b7667ad (patch) | |
tree | 8020197512c6cdb77e905572bbeef07644f2e1dd | |
parent | 8662c46d713143af50e99762b7a6f22e3b3925ee (diff) | |
download | libhardware-fd05d13edcf20c04c40467e9445f8f442b7667ad.tar.gz |
[HWC] Add setLayerFloatColor API.
This patch adds the struct of float color, and setLayerFloatColor API so that
SurfaceFlinger can set the layer color with more bits on each channel.
Currently the display calibration tool require 10-bits support.
BUG: 69970838
Test: make locally and applied on device
Change-Id: I8bab335cc4fbc41a3eb18306a8831d1e9a9a219a
-rw-r--r-- | include/hardware/hwcomposer2.h | 24 | ||||
-rw-r--r-- | include/hardware/hwcomposer_defs.h | 7 |
2 files changed, 30 insertions, 1 deletions
diff --git a/include/hardware/hwcomposer2.h b/include/hardware/hwcomposer2.h index 11c9bdd0..a052962a 100644 --- a/include/hardware/hwcomposer2.h +++ b/include/hardware/hwcomposer2.h @@ -114,7 +114,7 @@ typedef enum { * presentDisplay should fail as fast as possible in the case a * validateDisplay step is needed. */ - HWC2_CAPABILITY_SKIP_VALIDATE= 4, + HWC2_CAPABILITY_SKIP_VALIDATE = 4, } hwc2_capability_t; /* Possible composition types for a given layer */ @@ -262,6 +262,7 @@ typedef enum { HWC2_FUNCTION_SET_POWER_MODE, HWC2_FUNCTION_SET_VSYNC_ENABLED, HWC2_FUNCTION_VALIDATE_DISPLAY, + HWC2_FUNCTION_SET_LAYER_FLOAT_COLOR, } hwc2_function_descriptor_t; /* Layer requests returned from getDisplayRequests */ @@ -479,6 +480,7 @@ static inline const char* getFunctionDescriptorName( case HWC2_FUNCTION_SET_POWER_MODE: return "SetPowerMode"; case HWC2_FUNCTION_SET_VSYNC_ENABLED: return "SetVsyncEnabled"; case HWC2_FUNCTION_VALIDATE_DISPLAY: return "ValidateDisplay"; + case HWC2_FUNCTION_SET_LAYER_FLOAT_COLOR: return "SetLayerFloatColor"; default: return "Unknown"; } } @@ -668,6 +670,7 @@ enum class FunctionDescriptor : int32_t { SetPowerMode = HWC2_FUNCTION_SET_POWER_MODE, SetVsyncEnabled = HWC2_FUNCTION_SET_VSYNC_ENABLED, ValidateDisplay = HWC2_FUNCTION_VALIDATE_DISPLAY, + SetLayerFloatColor = HWC2_FUNCTION_SET_LAYER_FLOAT_COLOR, }; TO_STRING(hwc2_function_descriptor_t, FunctionDescriptor, getFunctionDescriptorName) @@ -1805,6 +1808,25 @@ typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_COLOR)( hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, hwc_color_t color); +/* setLayerFloatColor(..., color) + * Descriptor: HWC2_FUNCTION_SET_LAYER_FLOAT_COLOR + * Provided by HWC2 devices which don't return nullptr function pointer. + * + * Sets the color of the given layer. If the composition type of the layer is + * not HWC2_COMPOSITION_SOLID_COLOR, this call must return HWC2_ERROR_NONE and + * have no other effect. + * + * Parameters: + * color - the new color in float type, rage is [0.0, 1.0], the colorspace is + * defined by the dataspace that gets set by calling setLayerDataspace. + * + * Returns HWC2_ERROR_NONE or one of the following errors: + * HWC2_ERROR_BAD_LAYER - an invalid layer handle was passed in + */ +typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_SET_LAYER_FLOAT_COLOR)( + hwc2_device_t* device, hwc2_display_t display, hwc2_layer_t layer, + hwc_float_color_t color); + /* setLayerCompositionType(..., type) * Descriptor: HWC2_FUNCTION_SET_LAYER_COMPOSITION_TYPE * Must be provided by all HWC2 devices diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h index 1e81e6e6..fd373e31 100644 --- a/include/hardware/hwcomposer_defs.h +++ b/include/hardware/hwcomposer_defs.h @@ -58,6 +58,13 @@ typedef struct hwc_color { uint8_t a; } hwc_color_t; +typedef struct hwc_float_color { + float r; + float g; + float b; + float a; +} hwc_float_color_t; + typedef struct hwc_frect { float left; float top; |