gralloc: Add handling for buffer dequeue duration metadata

- Update QtiGralloc to support getting and setting buffer
  dequeue duration metadata.

Change-Id: I5fb30e3c5623fab4b00bf1e6274b83d05afadbaa
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;