v4l2_codec2 encoder: Support zero-copy for RGB frames in converter.

The cleanup in ag/16211950 makes it easy to now support zero-copy in
the format converter for RGB video frames. This is currently not used
as the encoder input format is NV12, but we can support if for future
use cases.

Bug: 205203831
Test: arc.VideoEncodeAccel.h264_192p_i420_vm
Change-Id: I4ccc64f7a5b8f401b8df9f2f3205f091e40bbf06
(cherry picked from commit 19161c4c3531fb78cb688d05e57ce892aa85fff0)
diff --git a/common/FormatConverter.cpp b/common/FormatConverter.cpp
index 4f4a3d0..18893d5 100644
--- a/common/FormatConverter.cpp
+++ b/common/FormatConverter.cpp
@@ -206,6 +206,13 @@
         inputLayout.type = C2PlanarLayout::TYPE_RGB;
     }
 
+    if (inputFormat == mOutFormat) {
+        ALOGV("Zero-Copy is applied");
+        mGraphicBlocks.emplace_back(new BlockEntry(frameIndex));
+        *convertedBlock = inputBlock;
+        return C2_OK;
+    }
+
     if (!isReady()) {
         ALOGV("There is no available block for conversion");
         return C2_NO_MEMORY;
@@ -233,13 +240,6 @@
         const int srcStrideU = inputLayout.planes[C2PlanarLayout::PLANE_U].rowInc;
         const int srcStrideV = inputLayout.planes[C2PlanarLayout::PLANE_V].rowInc;
 
-        if (inputFormat == mOutFormat) {
-            ALOGV("Zero-Copy is applied");
-            mGraphicBlocks.emplace_back(new BlockEntry(frameIndex));
-            *convertedBlock = inputBlock;
-            return C2_OK;
-        }
-
         switch (convertMap(inputFormat, mOutFormat)) {
         case convertMap(VideoPixelFormat::YV12, VideoPixelFormat::I420):
             libyuv::I420Copy(srcY, srcStrideY, srcU, srcStrideU, srcV, srcStrideV, dstY, dstStrideY,