Merge tag 'LA.QSSI.14.0.r1-11200-qssi.0' of https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/display-commonsys into lineage-21.0

"LA.QSSI.14.0.r1-11200-qssi.0"

* tag 'LA.QSSI.14.0.r1-11200-qssi.0' of https://git.codelinaro.org/clo/la/platform/vendor/qcom-opensource/display-commonsys:
  gralloc: Add handling for buffer dequeue duration metadata

Change-Id: I0434a47052692f1632c554808f6b8812e8988b6b
diff --git a/gralloc/QtiGralloc.cpp b/gralloc/QtiGralloc.cpp
index e913090..5cde30a 100644
--- a/gralloc/QtiGralloc.cpp
+++ b/gralloc/QtiGralloc.cpp
@@ -27,6 +27,13 @@
  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+ /*
+ * Changes from Qualcomm Innovation Center are provided under the following license:
+ *
+ * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * SPDX-License-Identifier: BSD-3-Clause-Clear
+ */
+
 #include "QtiGralloc.h"
 
 #include <log/log.h>
@@ -308,6 +315,8 @@
       return MetadataType_TimedRendering;
     case QTI_CUSTOM_CONTENT_METADATA:
       return MetadataType_CustomContentMetadata;
+    case QTI_BUFFER_DEQUEUE_DURATION:
+      return MetadataType_BufferDequeueDuration;
     default:
       return MetadataType_Invalid;
   }
@@ -443,6 +452,11 @@
     case QTI_CUSTOM_CONTENT_METADATA:
       err = decodeCustomContentMetadata(bytestream, param);
       break;
+    case QTI_BUFFER_DEQUEUE_DURATION:
+      err = static_cast<Error>(android::gralloc4::decodeInt64(
+          qtigralloc::MetadataType_BufferDequeueDuration, bytestream,
+          reinterpret_cast<int64_t *>(param)));
+      break;
     default:
       param = nullptr;
       return Error::UNSUPPORTED;
@@ -526,6 +540,11 @@
     case QTI_CUSTOM_CONTENT_METADATA:
       err = encodeCustomContentMetadata(param, &bytestream);
       break;
+    case QTI_BUFFER_DEQUEUE_DURATION:
+      err = static_cast<Error>(android::gralloc4::encodeInt64(
+          qtigralloc::MetadataType_BufferDequeueDuration,
+          *reinterpret_cast<int64_t *>(param), &bytestream));
+      break;
     default:
       param = nullptr;
       return Error::UNSUPPORTED;