Add getClientTargetProperty API entry.

getClientTargetProperty will give hardware composer the ability to request some
properties of the client target that hardware composer wants. Prior to this
API, the client will does its best to produce the client target of which the
properties are pretty much fixed.

BUG: b/145968912
Test: boot
Change-Id: Ib8ba44d274a0c8a86c3fde1d09b72f592445ee91
This commit is contained in:
Peiyong Lin 2020-01-08 15:30:52 -08:00
parent fbdca5fdaa
commit f777542fd8
2 changed files with 65 additions and 26 deletions

View file

@ -306,6 +306,7 @@ typedef enum {
HWC2_FUNCTION_SET_AUTO_LOW_LATENCY_MODE,
HWC2_FUNCTION_GET_SUPPORTED_CONTENT_TYPES,
HWC2_FUNCTION_SET_CONTENT_TYPE,
HWC2_FUNCTION_GET_CLIENT_TARGET_PROPERTY,
} hwc2_function_descriptor_t;
/* Layer requests returned from getDisplayRequests */
@ -665,6 +666,7 @@ static inline const char* getFunctionDescriptorName(
case HWC2_FUNCTION_SET_AUTO_LOW_LATENCY_MODE: return "SetAutoLowLatencyMode";
case HWC2_FUNCTION_GET_SUPPORTED_CONTENT_TYPES: return "GetSupportedContentTypes";
case HWC2_FUNCTION_SET_CONTENT_TYPE: return "SetContentType";
case HWC2_FUNCTION_GET_CLIENT_TARGET_PROPERTY: return "GetClientTargetProperty";
default: return "Unknown";
}
@ -942,6 +944,7 @@ enum class FunctionDescriptor : int32_t {
SetAutoLowLatencyMode = HWC2_FUNCTION_SET_AUTO_LOW_LATENCY_MODE,
GetSupportedContentTypes = HWC2_FUNCTION_GET_SUPPORTED_CONTENT_TYPES,
SetContentType = HWC2_FUNCTION_SET_CONTENT_TYPE,
GetClientTargetProperty = HWC2_FUNCTION_GET_CLIENT_TARGET_PROPERTY,
};
TO_STRING(hwc2_function_descriptor_t, FunctionDescriptor,
getFunctionDescriptorName)
@ -3036,6 +3039,35 @@ typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_GET_SUPPORTED_CONTENT_TYPES)(hwc2_dev
typedef int32_t /*hwc_error_t*/ (*HWC2_PFN_SET_CONTENT_TYPE)(hwc2_device_t* device,
hwc2_display_t display, int32_t /* hwc2_content_type_t */ contentType);
/* getClientTargetProperty(..., outClientTargetProperty)
* Descriptor: HWC2_FUNCTION_GET_CLIENT_TARGET_PROPERTY
* Optional for HWC2 devices
*
* Retrieves the client target properties for which the hardware composer
* requests after the last call to validateDisplay. The client must set the
* properties of the client target to match the returned values.
* When this API is implemented, if client composition is needed, the hardware
* composer must return meaningful client target property with dataspace not
* setting to UNKNOWN.
* When the returned dataspace is set to UNKNOWN, it means hardware composer
* requests nothing, the client must ignore the returned client target property
* structrue.
*
* Parameters:
* outClientTargetProperty - the client target properties that hardware
* composer requests. If dataspace field is set to UNKNOWN, it means
* the hardware composer requests nothing, the client must ignore the
* returned client target property structure.
*
* Returns HWC2_ERROR_NONE or one of the following errors:
* HWC2_ERROR_BAD_DISPLAY - an invalid display handle was passed in
* HWC2_ERROR_NOT_VALIDATED - validateDisplay has not been called for this
* display
*/
typedef int32_t /*hwc2_error_t*/ (*HWC2_PFN_GET_CLIENT_TARGET_PROPERTY)(
hwc2_device_t* device, hwc2_display_t display,
hwc_client_target_property_t* outClientTargetProperty);
__END_DECLS
#endif

View file

@ -104,6 +104,39 @@ typedef enum {
HWC_TRANSFORM_FLIP_V_ROT_90 = HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_ROT_90,
} hwc_transform_t;
/* Constraints for changing vsync period */
typedef struct hwc_vsync_period_change_constraints {
/* Time in CLOCK_MONOTONIC after which the vsync period may change
* (i.e., the vsync period must not change before this time). */
int64_t desiredTimeNanos;
/*
* If true, requires that the vsync period change must happen seamlessly without
* a noticeable visual artifact. */
uint8_t seamlessRequired;
} hwc_vsync_period_change_constraints_t;
/* Timing for a vsync period change. */
typedef struct hwc_vsync_period_change_timeline {
/* The time in CLOCK_MONOTONIC when the new display will start to refresh at
* the new vsync period. */
int64_t newVsyncAppliedTimeNanos;
/* Set to true if the client is required to sent a frame to be displayed before
* the change can take place. */
uint8_t refreshRequired;
/* The time in CLOCK_MONOTONIC when the client is expected to send the new frame.
* Should be ignored if refreshRequired is false. */
int64_t refreshTimeNanos;
} hwc_vsync_period_change_timeline_t;
typedef struct hwc_client_target_property {
// The pixel format of client target requested by hardware composer.
int32_t pixelFormat;
// The dataspace of the client target requested by hardware composer.
int32_t dataspace;
} hwc_client_target_property_t;
/*******************************************************************************
* Beyond this point are things only used by HWC1, which should be ignored when
* implementing a HWC2 device
@ -304,32 +337,6 @@ enum {
HWC_POWER_MODE_DOZE_SUSPEND = 3,
};
/* Constraints for changing vsync period */
typedef struct hwc_vsync_period_change_constraints {
/* Time in CLOCK_MONOTONIC after which the vsync period may change
* (i.e., the vsync period must not change before this time). */
int64_t desiredTimeNanos;
/*
* If true, requires that the vsync period change must happen seamlessly without
* a noticeable visual artifact. */
uint8_t seamlessRequired;
} hwc_vsync_period_change_constraints_t;
/* Timing for a vsync period change. */
typedef struct hwc_vsync_period_change_timeline {
/* The time in CLOCK_MONOTONIC when the new display will start to refresh at
* the new vsync period. */
int64_t newVsyncAppliedTimeNanos;
/* Set to true if the client is required to sent a frame to be displayed before
* the change can take place. */
uint8_t refreshRequired;
/* The time in CLOCK_MONOTONIC when the client is expected to send the new frame.
* Should be ignored if refreshRequired is false. */
int64_t refreshTimeNanos;
} hwc_vsync_period_change_timeline_t;
/*****************************************************************************/
__END_DECLS