[Decode] Moving complete count buffer to end of status buffer to avoid decode status update later than complete count buffer update

Although complete count buffer and decode status buffer share one buffer, there is chance that complete count buffer refreshed earlier then decode status buffer, since complete count buffer located at the beginning of the status buffer. It will cause issue when driver check decode status while status buffer is during refresh. To avoid such race condition, moving complete count buffer to end of status buffer.
diff --git a/media_driver/media_driver_next/agnostic/common/codec/hal/dec/shared/statusreport/decode_status_report.cpp b/media_driver/media_driver_next/agnostic/common/codec/hal/dec/shared/statusreport/decode_status_report.cpp
index 0aa72be..9443f36 100644
--- a/media_driver/media_driver_next/agnostic/common/codec/hal/dec/shared/statusreport/decode_status_report.cpp
+++ b/media_driver/media_driver_next/agnostic/common/codec/hal/dec/shared/statusreport/decode_status_report.cpp
@@ -46,8 +46,9 @@
     {
         DECODE_FUNC_CALL();
 
-        // Allocate status buffer which includes completed count and decode status
-        m_statusBufMfx = m_allocator->AllocateBuffer(m_completedCountSize + m_statusBufSizeMfx * m_statusNum, "StatusQueryBufferMfx", resourceInternalWrite, true, 0, true);
+        // Allocate status buffer which includes decode status and completed count
+        uint32_t bufferSize = m_statusBufSizeMfx * m_statusNum + m_completedCountSize;
+        m_statusBufMfx = m_allocator->AllocateBuffer(bufferSize, "StatusQueryBufferMfx", resourceInternalWrite, true, 0, true);
         DECODE_CHK_NULL(m_statusBufMfx);
         m_completedCountBuf = &(m_statusBufMfx->OsResource);
 
@@ -55,9 +56,9 @@
         uint8_t *data = (uint8_t *)m_allocator->LockResouceForRead(m_statusBufMfx);
         DECODE_CHK_NULL(data);
 
-        // complete count located at the beginging of the status buffer, following with decode status
-        m_completedCount = (uint32_t *)data;
-        m_dataStatusMfx  = data + m_completedCountSize;
+        // Decode status located at the beginging of the status buffer, following with complete count
+        m_dataStatusMfx  = data;
+        m_completedCount = (uint32_t *)(data + m_statusBufSizeMfx * m_statusNum);
 
         if (m_enableRcs)
         {
@@ -75,7 +76,7 @@
         DECODE_CHK_NULL(m_statusBufAddr);
 
         m_statusBufAddr[statusReportGlobalCount].osResource = m_completedCountBuf;
-        m_statusBufAddr[statusReportGlobalCount].offset = 0;
+        m_statusBufAddr[statusReportGlobalCount].offset = m_statusBufSizeMfx * m_statusNum;
         m_statusBufAddr[statusReportGlobalCount].bufSize = sizeof(uint32_t) * 2;
 
         for(int i = 0; i < statusReportGlobalCount; i++)
@@ -197,7 +198,7 @@
 
     void DecodeStatusReport::SetOffsetsForStatusBuf()
     {
-        const uint32_t mfxStatusOffset = m_completedCountSize;
+        const uint32_t mfxStatusOffset = 0;
         m_statusBufAddr[statusReportMfx].offset      = mfxStatusOffset + CODECHAL_OFFSETOF(DecodeStatusMfx, status);
         m_statusBufAddr[DecErrorStatusOffset].offset = mfxStatusOffset + CODECHAL_OFFSETOF(DecodeStatusMfx, m_mmioErrorStatusReg);
         m_statusBufAddr[DecMBCountOffset].offset     = mfxStatusOffset + CODECHAL_OFFSETOF(DecodeStatusMfx, m_mmioMBCountReg);
diff --git a/media_driver/media_driver_next/agnostic/common/shared/statusreport/media_status_report.cpp b/media_driver/media_driver_next/agnostic/common/shared/statusreport/media_status_report.cpp
index fd1648b..5f41cdb 100644
--- a/media_driver/media_driver_next/agnostic/common/shared/statusreport/media_status_report.cpp
+++ b/media_driver/media_driver_next/agnostic/common/shared/statusreport/media_status_report.cpp
@@ -39,7 +39,7 @@
 
     if (statusReportType == 0x50)
     {
-        offset = 0;
+        offset = m_statusBufAddr[statusReportType].offset;
     }
     else
     {