diff options
author | 2023-04-06 01:00:25 +0000 | |
---|---|---|
committer | 2023-04-06 01:00:25 +0000 | |
commit | 265f96fb55dcacb3dc038ef5b2f9d9387c9fc037 (patch) | |
tree | c06bf31eed373974afdbe0c78a0e96c7c9028d26 | |
parent | e4f832e21dbad52f7b455d557584d8baad66dd6f (diff) |
Revert "Remove incorrect isDataSpaceValid"
This reverts commit e4f832e21dbad52f7b455d557584d8baad66dd6f.
Reason for revert:
DroidMonitor: Potential culprit for Bug b/277122111 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.”
Change-Id: I0fc4f98eb83448562c57433aa68018bcfee746bf
-rw-r--r-- | libs/nativewindow/ANativeWindow.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libs/nativewindow/ANativeWindow.cpp b/libs/nativewindow/ANativeWindow.cpp index dd5958de28..5306529fcb 100644 --- a/libs/nativewindow/ANativeWindow.cpp +++ b/libs/nativewindow/ANativeWindow.cpp @@ -79,6 +79,27 @@ static int64_t query64(ANativeWindow* window, int what) { return res < 0 ? res : value; } +static bool isDataSpaceValid(ANativeWindow* window, int32_t dataSpace) { + bool supported = false; + switch (dataSpace) { + case HAL_DATASPACE_UNKNOWN: + case HAL_DATASPACE_V0_SRGB: + return true; + // These data space need wide gamut support. + case HAL_DATASPACE_V0_SCRGB_LINEAR: + case HAL_DATASPACE_V0_SCRGB: + case HAL_DATASPACE_DISPLAY_P3: + native_window_get_wide_color_support(window, &supported); + return supported; + // These data space need HDR support. + case HAL_DATASPACE_BT2020_PQ: + native_window_get_hdr_support(window, &supported); + return supported; + default: + return false; + } +} + /************************************************************************************************** * NDK **************************************************************************************************/ @@ -198,7 +219,8 @@ int32_t ANativeWindow_setBuffersDataSpace(ANativeWindow* window, int32_t dataSpa static_assert(static_cast<int>(ADATASPACE_DEPTH) == static_cast<int>(HAL_DATASPACE_DEPTH)); static_assert(static_cast<int>(ADATASPACE_DYNAMIC_DEPTH) == static_cast<int>(HAL_DATASPACE_DYNAMIC_DEPTH)); - if (!window || !query(window, NATIVE_WINDOW_IS_VALID)) { + if (!window || !query(window, NATIVE_WINDOW_IS_VALID) || + !isDataSpaceValid(window, dataSpace)) { return -EINVAL; } return native_window_set_buffers_data_space(window, |