Add extend padding lock flag

 - ITensorInfo's padding cannot be extended if its lock_paddings flag is set to True.

Resolves: COMPMID-5714
Signed-off-by: Ramy Elgammal <ramy.elgammal@arm.com>
Change-Id: I6bca9bbf7172822af60562310578c438b9e15f46
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8875
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: SiCong Li <sicong.li@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
diff --git a/arm_compute/core/ITensorInfo.h b/arm_compute/core/ITensorInfo.h
index c48e6eb..1382649 100644
--- a/arm_compute/core/ITensorInfo.h
+++ b/arm_compute/core/ITensorInfo.h
@@ -142,6 +142,17 @@
      * @return True if the strides or the offset to the first element have changed.
      */
     virtual bool auto_padding() = 0;
+    /** Set the lock paddings flag of the tensor.
+     * It should be set to True, when the tensor could be mapped to camera or frame buffer.
+     *
+     * @return Reference to this ITensorInfo object
+     */
+    virtual ITensorInfo &set_lock_paddings(bool flag) = 0;
+    /** Get the lock paddings flag value
+     *
+     * @return lock paddings flag value
+     */
+    virtual bool lock_paddings() const = 0;
     /** Update the offset to the first element, the strides and the total size.
      *
      * @note This function can only increase the offset, strides and total size.
diff --git a/arm_compute/core/SubTensorInfo.h b/arm_compute/core/SubTensorInfo.h
index 374ea5b..21703b0 100644
--- a/arm_compute/core/SubTensorInfo.h
+++ b/arm_compute/core/SubTensorInfo.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2022 Arm Limited.
+ * Copyright (c) 2017-2023 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -116,7 +116,13 @@
         ARM_COMPUTE_ERROR_ON(_parent == nullptr);
         return _parent->auto_padding();
     };
+
+    ITensorInfo &set_lock_paddings(bool flag) override;
+
+    bool lock_paddings() const override;
+
     bool extend_padding(const PaddingSize &padding) override;
+
     size_t dimension(size_t index) const override
     {
         return _tensor_shape[index];
@@ -256,6 +262,7 @@
     Coordinates     _coords;
     ValidRegion     _valid_region;
     bool            _extend_parent;
+    bool            _lock_paddings;
 };
 } // namespace arm_compute
 #endif /*ARM_COMPUTE_SUBTENSORINFO_H */
diff --git a/arm_compute/core/TensorInfo.h b/arm_compute/core/TensorInfo.h
index 7eb8c52..8436407 100644
--- a/arm_compute/core/TensorInfo.h
+++ b/arm_compute/core/TensorInfo.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2022 Arm Limited.
+ * Copyright (c) 2016-2023 Arm Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -201,6 +201,8 @@
     ITensorInfo &set_data_layout(const DataLayout &data_layout) override;
     ITensorInfo &reset_padding() override;
     bool         auto_padding() override;
+    ITensorInfo &set_lock_paddings(bool flag) override;
+    bool lock_paddings() const override;
     bool extend_padding(const PaddingSize &padding) override;
     size_t dimension(size_t index) const override
     {
@@ -330,6 +332,7 @@
     DataLayout       _data_layout;
     bool             _are_values_constant;
     ITensorInfo::Id  _id;
+    bool             _lock_paddings;
 };
 
 /** Check whether two tensor info are equal.