Merge "gralloc: Add support for new camera FLEX formats"
diff --git a/composer/hwc_display.h b/composer/hwc_display.h
index 4579f8d..f2f1f2e 100644
--- a/composer/hwc_display.h
+++ b/composer/hwc_display.h
@@ -57,9 +57,6 @@
class HWCToneMapper;
-/* max customer extended render intent */
-#define MAX_EXTENDED_RENDER_INTENT 0x1ff
-
// Subclasses set this to their type. This has to be different from DisplayType.
// This is to avoid RTTI and dynamic_cast
enum DisplayClass {
diff --git a/sdm/include/private/color_params.h b/sdm/include/private/color_params.h
index cdc6577..17045ed 100644
--- a/sdm/include/private/color_params.h
+++ b/sdm/include/private/color_params.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015-2019, The Linux Foundataion. All rights reserved.
+/* Copyright (c) 2015-2020, 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
@@ -45,6 +45,9 @@
namespace sdm {
+/* max customer extended render intent */
+#define MAX_EXTENDED_RENDER_INTENT 0x1ff
+
// Bitmap Pending action to indicate to the caller what's pending to be taken care of.
enum PendingAction {
kInvalidating = BITMAP(0),
diff --git a/sdm/libs/core/display_base.cpp b/sdm/libs/core/display_base.cpp
index d40e5e8..40fa217 100644
--- a/sdm/libs/core/display_base.cpp
+++ b/sdm/libs/core/display_base.cpp
@@ -1053,11 +1053,16 @@
DLOGV_IF(kTagQDCM, "Color Mode Name = %s corresponding mode_id = %d", sde_display_mode->name,
sde_display_mode->id);
DisplayError error = kErrorNone;
- uint32_t render_intent = 0;
+ int32_t render_intent = 0;
if (!str_render_intent.empty()) {
render_intent = std::stoi(str_render_intent);
}
+ if (render_intent < 0 || render_intent > MAX_EXTENDED_RENDER_INTENT) {
+ DLOGW("Invalid render intent %d for mode id = %d", render_intent, sde_display_mode->id);
+ return kErrorNotSupported;
+ }
+
error = color_mgr_->ColorMgrSetMode(sde_display_mode->id);
if (error != kErrorNone) {
DLOGE("Failed for mode id = %d", sde_display_mode->id);