sdm: Add property to handle HDR
- Set "sys.hwc_disable_hdr" to 1 to disable HDR handling
in HAL.
- On setting that property, a HDR layer will be treated
as a regular layer.
Change-Id: I3309c0ec29dc1b3c56294f1bf3e542977235c475
Crs-fixed: 1114932
diff --git a/sdm/libs/hwc/hwc_display.cpp b/sdm/libs/hwc/hwc_display.cpp
index e1ce108..bb8996b 100644
--- a/sdm/libs/hwc/hwc_display.cpp
+++ b/sdm/libs/hwc/hwc_display.cpp
@@ -135,6 +135,11 @@
return -EINVAL;
}
+ HWCDebugHandler::Get()->GetProperty("sys.hwc_disable_hdr", &disable_hdr_handling_);
+ if (disable_hdr_handling_) {
+ DLOGI("HDR Handling disabled");
+ }
+
int property_swap_interval = 1;
HWCDebugHandler::Get()->GetProperty("debug.egl.swapinterval", &property_swap_interval);
if (property_swap_interval == 0) {
@@ -1365,9 +1370,11 @@
return kErrorNotSupported;
}
- if (layer_buffer.color_metadata.colorPrimaries == ColorPrimaries_BT2020 &&
- (layer_buffer.color_metadata.transfer == Transfer_SMPTE_ST2084 ||
- layer_buffer.color_metadata.transfer == Transfer_HLG)) {
+ bool hdr_layer = layer_buffer.color_metadata.colorPrimaries == ColorPrimaries_BT2020 &&
+ (layer_buffer.color_metadata.transfer == Transfer_SMPTE_ST2084 ||
+ layer_buffer.color_metadata.transfer == Transfer_HLG);
+ if (hdr_layer && !disable_hdr_handling_) {
+ // dont honor HDR when its handling is disabled
layer_buffer.flags.hdr = true;
layer_stack_.flags.hdr_present = true;
}
diff --git a/sdm/libs/hwc/hwc_display.h b/sdm/libs/hwc/hwc_display.h
index b32cf93..6fd7978 100644
--- a/sdm/libs/hwc/hwc_display.h
+++ b/sdm/libs/hwc/hwc_display.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014 - 2016, The Linux Foundation. All rights reserved.
+* Copyright (c) 2014 - 2017, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
@@ -236,6 +236,7 @@
bool animating_ = false;
HWCToneMapper *tone_mapper_ = NULL;
HWCColorMode *color_mode_ = NULL;
+ int disable_hdr_handling_ = 0; // disables HDR handling.
private:
void DumpInputBuffers(hwc_display_contents_1_t *content_list);