From d58ec8fb63546089fcee2f3128c48a5a1b5320c0 Mon Sep 17 00:00:00 2001 From: Ramakant Singh Date: Fri, 31 Aug 2018 17:38:43 +0530 Subject: [PATCH] commonsys-intf: display: Add support to query display wb capabilities Change-Id: I2370df1cf4db99f353e047d2db50a5d416d7650b --- libdisplayconfig/Android.mk | 10 +++++++++ libdisplayconfig/DisplayConfig.cpp | 33 ++++++++++++++++++++++++++++-- libdisplayconfig/DisplayConfig.h | 7 ++++++- 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/libdisplayconfig/Android.mk b/libdisplayconfig/Android.mk index ec9340d2..50618868 100644 --- a/libdisplayconfig/Android.mk +++ b/libdisplayconfig/Android.mk @@ -1,5 +1,9 @@ LOCAL_PATH := $(call my-dir) +display_config_version := $(shell \ + if [ -d "$(TOP)/vendor/qcom/opensource/interfaces/display/config/1.4" ];\ + then echo DISPLAY_CONFIG_1_4; fi) + include $(CLEAR_VARS) LOCAL_MODULE := libdisplayconfig LOCAL_MODULE_TAGS := optional @@ -7,6 +11,12 @@ LOCAL_HEADER_LIBRARIES := display_headers LOCAL_SRC_FILES := DisplayConfig.cpp LOCAL_SHARED_LIBRARIES := libhidlbase libhidltransport libutils \ vendor.display.config@1.0 + +ifeq ($(display_config_version), DISPLAY_CONFIG_1_4) + LOCAL_SHARED_LIBRARIES += vendor.display.config@1.4 + LOCAL_CFLAGS += -DDISPLAY_CONFIG_1_4 +endif + LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) ifeq ($(LLVM_SA), true) diff --git a/libdisplayconfig/DisplayConfig.cpp b/libdisplayconfig/DisplayConfig.cpp index 29fcc940..59d466a6 100644 --- a/libdisplayconfig/DisplayConfig.cpp +++ b/libdisplayconfig/DisplayConfig.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2017 The Linux Foundation. All rights reserved. +* Copyright (c) 2017-2018 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 @@ -27,13 +27,21 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#ifdef DISPLAY_CONFIG_1_4 +#include +#else #include +#endif + #include "DisplayConfig.h" namespace display { - +#ifdef DISPLAY_CONFIG_1_4 +using vendor::display::config::V1_4::IDisplayConfig; +#else using vendor::display::config::V1_0::IDisplayConfig; +#endif //============================================================================= // The functions below run in the client process and wherever necessary @@ -332,6 +340,27 @@ int getHDRCapabilities(int dpy, DisplayHDRCapabilities *caps) { return error; } +#ifdef DISPLAY_CONFIG_1_4 +int32_t getWriteBackCapabilities( WriteBackCapabilities *caps) { + android::sp intf = IDisplayConfig::getService(); + if (intf == NULL || caps == NULL) { + return -1; + } + + int error = -1; + intf->getWriteBackCapabilities( + [&](const auto &tmpError, const auto &tmpCaps) { + error = tmpError; + if (error) { + return; + } + caps->isWbUbwcSupported = tmpCaps.isWbUbwcSupported; + }); + + return error; +} +#endif + int setCameraLaunchStatus(uint32_t on) { android::sp intf = IDisplayConfig::getService(); if (intf == NULL) { diff --git a/libdisplayconfig/DisplayConfig.h b/libdisplayconfig/DisplayConfig.h index 17b6421e..5d54d3f4 100644 --- a/libdisplayconfig/DisplayConfig.h +++ b/libdisplayconfig/DisplayConfig.h @@ -1,5 +1,5 @@ /* -* Copyright (c) 2017 The Linux Foundation. All rights reserved. +* Copyright (c) 2017-2018 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 @@ -83,6 +83,10 @@ struct DisplayHDRCapabilities { float min_luminance = 0.0f; }; +struct WriteBackCapabilities { + bool isWbUbwcSupported; +}; + //============================================================================= // The functions below run in the client pocess and wherever necessary // do a binder call to HWC to get/set data. @@ -104,6 +108,7 @@ int setIdleTimeout(uint32_t value); int getHDRCapabilities(int dpy, DisplayHDRCapabilities *caps); int setCameraLaunchStatus(uint32_t on); bool displayBWTransactionPending(); +int32_t getWriteBackCapabilities(WriteBackCapabilities *caps); } // namespace display