Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-updates_testing-src > by-pkgid > 7d300afceca627f2f8172fe58d65a2e2 > files > 8

intel-media-24.2.5-1.mga9.src.rpm

From 2c6fe5df1b8c2c623f9d2dc98e0321f6b3b659bf Mon Sep 17 00:00:00 2001
From: shawnli2 <shawn.li@intel.com>
Date: Thu, 13 Jun 2024 11:42:52 +0800
Subject: [PATCH 08/22] [Decode] Decode roubustness enhancement for invalid
 reference surface

Decode driver has a robustness behavior to allocate an internal buffer as a dummy reference frame, but this buffer is always allocated as uncompressed, regardless of the destination surface MMC state, it will occur memory access violation when MMC mixed
---
 .../common/codec/hal/codechal_decode_avc.cpp   | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp b/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp
index 4bac42680..16d737dab 100644
--- a/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp
+++ b/media_driver/agnostic/common/codec/hal/codechal_decode_avc.cpp
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2011-2020, Intel Corporation
+* Copyright (c) 2011-2024, Intel Corporation
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
@@ -311,12 +311,26 @@ MOS_STATUS CodechalDecodeAvc::AllocateInvalidRefBuffer()
     {
         CODECHAL_DECODE_CHK_STATUS_RETURN(CodecHalGetResourceInfo(m_osInterface, &m_destSurface));
 
+        MOS_MEMCOMP_STATE mmcMode = MOS_MEMCOMP_DISABLED;
+#ifdef _MMC_SUPPORTED
+        if(m_mmc != nullptr && m_mmc->IsMmcEnabled())
+        {
+            CODECHAL_DECODE_CHK_STATUS_RETURN(
+            m_osInterface->pfnGetMemoryCompressionMode(
+                m_osInterface,
+                &m_destSurface.OsResource,
+                &mmcMode));
+        }
+#endif
+
         MOS_SURFACE surface;
         CODECHAL_DECODE_CHK_STATUS_MESSAGE_RETURN(AllocateSurface(
                                                       &surface,
                                                       m_destSurface.dwPitch,
                                                       m_destSurface.dwHeight,
-                                                      "InvalidRefBuffer"),
+                                                      "InvalidRefBuffer",
+                                                      Format_NV12,
+                                                      mmcMode != MOS_MEMCOMP_DISABLED ? true : false),
             "Failed to allocate invalid reference buffer.");
         m_resInvalidRefBuffer = surface.OsResource;
 
-- 
2.41.1