QCamera2: HAL3: Avoid blindly invalidating buffers

ImageReader buffers are invalidated when calling lock when buffer is
consumed, and it's not necessary to unconditionally invalidating them
when they return to HAL.

For HAL internal buffers, if they are consumed by reprocessing, they are
invalidated with postproc.

Test: Camera CTS
Bug: 63950311
Change-Id: I80e4a992e29a314dae444db958f8307c8a54fdb6
diff --git a/msm8998/QCamera2/HAL3/QCamera3Stream.cpp b/msm8998/QCamera2/HAL3/QCamera3Stream.cpp
index 083cd2b..3cb2298 100644
--- a/msm8998/QCamera2/HAL3/QCamera3Stream.cpp
+++ b/msm8998/QCamera2/HAL3/QCamera3Stream.cpp
@@ -803,13 +803,9 @@
     if (UNLIKELY(mBatchSize)) {
         rc = aggregateBufToBatch(mBufDefs[index]);
     } else {
-        // By default every buffer that goes to camera should be invalidated
-        // except Metadata/Preview/Video buffers
-        if ((getMyType() != CAM_STREAM_TYPE_METADATA) &&
-                (getMyType() != CAM_STREAM_TYPE_PREVIEW) &&
-                (getMyType() != CAM_STREAM_TYPE_VIDEO)) {
-            mBufDefs[index].cache_flags |= CPU_HAS_READ;
-        }
+        // Cache invalidation should happen in lockNextBuffer or during
+        // reprocessing. No need to invalidate every buffer without knowing
+        // which buffer is accessed by CPU.
         rc = mCamOps->qbuf(mCamHandle, mChannelHandle, &mBufDefs[index]);
         if (rc < 0) {
             return FAILED_TRANSACTION;